TimeSolver#
- class TimeSolver#
Bases:
objectEvolve the world in time.
Each world has already its own TimeSolver. This TimeSolver can be accessed through the world.timesolver property.
TimeSolvers should not be initialized by the end user.
- __init__(impl)#
- set_method(method_name)#
Set the Runga Kutta method used by the time solver.
Implemented methods are:
‘Heun’
‘BogackiShampine’
‘CashKarp’
‘Fehlberg’
‘DormandPrince’
The default and recommended Runge Kutta method is ‘Fehlberg’.
- steps(nsteps)#
Make n steps with the time solver.
- run_while(condition)#
Run the solver while the evaluation of the condition is True.
- Parameters:
condition (Callable[[], bool]) – Callable condition returning a boolean.
- run(duration)#
Run the solver for a given duration.
- Parameters:
duration (float) – Duration in seconds.
- solve(timepoints, quantity_dict, file_name=None, tqdm=False)#
Solve the differential equation.
The functions collects values of a list of specified quantities on specified timepoints.
- Parameters:
timepoints (iterable[float]) – Specified timepoints.
quantity_dict (dict) – Specified quantities to collect.
file_name (str, optional) – Optional name of an output file, in which the data is also written as tab-separated values during the simulation.
tqdm (bool (default=False)) – Prints tqdm progress bar if set to True.
- Returns:
output – Collected values of specified quantities at specified timepoints.
- Return type:
TimeSolverOutput
- property timestep: float#
Return the timestep value.
- property adaptive_timestep: bool#
Return the adaptive_timestep value.
True if an adaptive time step is used, False otherwise. To enable an adaptive time step, set to True, to disable set to False.
- property time: float#
Return the time value.
- property max_error: float#
Return the maximum error per step the solver can tollerate.
The default value is 1e-5.
- property headroom: float#
Return the solver headroom.
The default value is 0.8.
- property lower_bound: float#
Return the lower bound which is used to cap the scaling of the time step from below.
The default value is 0.5.
See also
headroom,max_error,sensible_factor,sensible_timestep_default,upper_bound
- property upper_bound: float#
Return the upper bound which is used to cap the scaling of the time step from the top.
The default value is 2.0.
See also
headroom,lower_bound,max_error,sensible_factor,sensible_timestep_default
- property sensible_factor: float#
Return the sensible time step factor which is used as a scaling factor when determining a sensible timestep.
The default value is 0.01.
See also
headroom,lower_bound,max_error,sensible_timestep_default,upper_bound
- property sensible_timestep_default: float#
Return the time step which is used if no sensible time step can be calculated (e.g. when the total torque is zero).
The default value is 1e-14 s.
See also