@@ -787,7 +787,7 @@ def simulate_to_threshold(self, future_loading_eqn: abc.Callable = None, first_o
787787 integration_method: str, optional
788788 Integration method, e.g. 'rk4' or 'euler' (default: 'euler')
789789 save_freq : float, optional
790- Frequency at which output is saved (s), e.g., save_freq = 10 \n
790+ Frequency at which output is saved (s), e.g., save_freq = 10. A save_freq of 0 will save every step. \n
791791 save_pts : list[float], optional
792792 Additional ordered list of custom times where output is saved (s), e.g., save_pts= [50, 75] \n
793793 eval_pts : list[float], optional
@@ -883,8 +883,8 @@ def simulate_to_threshold(self, future_loading_eqn: abc.Callable = None, first_o
883883 raise ValueError ("'dt' must be positive, was {}" .format (config ['dt' ]))
884884 if not isinstance (config ['save_freq' ], Number ) and not isinstance (config ['save_freq' ], tuple ):
885885 raise TypeError ("'save_freq' must be a number, was a {}" .format (type (config ['save_freq' ])))
886- if (isinstance (config ['save_freq' ], Number ) and config ['save_freq' ] <= 0 ) or \
887- (isinstance (config ['save_freq' ], tuple ) and config ['save_freq' ][1 ] <= 0 ):
886+ if (isinstance (config ['save_freq' ], Number ) and config ['save_freq' ] < 0 ) or \
887+ (isinstance (config ['save_freq' ], tuple ) and config ['save_freq' ][1 ] < 0 ):
888888 raise ValueError ("'save_freq' must be positive, was {}" .format (config ['save_freq' ]))
889889 if not isinstance (config ['save_pts' ], abc .Iterable ):
890890 raise TypeError ("'save_pts' must be list or array, was a {}" .format (type (config ['save_pts' ])))
@@ -1013,7 +1013,8 @@ def next_time(t, x):
10131013 def next_time (t , x = None ):
10141014 next_save_pt = save_pts [save_pt_index ] if save_pt_index < len (save_pts ) else float ('inf' )
10151015 next_eval_pt = eval_pts [eval_pt_index ] if eval_pt_index < len (eval_pts ) else float ('inf' )
1016- return min (dt , next_save - t , next_save_pt - t , next_eval_pt - t )
1016+ opts = (item for item in (dt , next_save - t , next_save_pt - t , next_eval_pt - t ) if item > 0 )
1017+ return min (* opts )
10171018 elif dt_mode != 'function' :
10181019 raise ValueError (f"'dt' mode { dt_mode } not supported. Must be 'constant', 'auto', or a function" )
10191020
0 commit comments