# The Phase API¶

### class dymos.Phase¶

The Phase object in Dymos. The Phase object is an OpenMDAO Group which contains the options for the variables in the optimal control problem (states, times, controls, parameters), the transcription, and the ODE class. The role of the Phase is to unite the problem formulation with the transcription and the ODE in order to transcribe a single portion of a trajectory into a nonlinear programming problem to be solved by the optimizer. On setup, the Phase runs through its setup stack which will add the appropriate OpenMDAO systems as prescribed by its associated Transcription.

Public API Methods:

add_boundary_constraint(self, name, loc, constraint_name=None, units=None, shape=None, indices=None, lower=None, upper=None, equals=None, scaler=None, adder=None, ref=None, ref0=None, linear=False)

Add a boundary constraint to a variable in the phase.

Arguments:

name: Name of the variable to constrain. If name is not a state, control, or 'time', then this is assumed to be the path of the variable to be constrained in the ODE.

loc: The location of the boundary constraint ('initial' or 'final').

constraint_name: The name of the variable as provided to the boundary constraint comp. By default this is the last element in name when split by dots. The user may override the constraint name if splitting the path causes name collisions.

units: The units in which the boundary constraint is to be applied. If None, use the units associated with the constrained output. If provided, must be compatible with the variables units.

shape: The shape of the variable being boundary-constrained. This can be inferred automatically for time, states, controls, and parameters, but is required if the constrained variable is an output of the ODE system.

indices: The indices of the output variable to be boundary constrained. Indices assumes C-order flattening. For instance, when constraining element [0, 1] of a variable of shape [2, 2], indices would be [3].

lower: Lower boundary for the variable.

upper: Upper boundary for the variable.

equals: Equality constraint value for the variable.

scaler: Value to multiply the model value to get the scaled value. Scaler is second in precedence.

adder: Value to add to the model value to get the scaled value. Adder is first in precedence.

ref: Value of response variable that scales to 1.0 in the driver.

ref0: Value of response variable that scales to 0.0 in the driver.

linear: Set to True if constraint is linear. Default is False.

add_control(self, name, units=unspecified, desc=unspecified, opt=unspecified, fix_initial=unspecified, fix_final=unspecified, targets=unspecified, rate_targets=unspecified, rate2_targets=unspecified, val=unspecified, shape=unspecified, lower=unspecified, upper=unspecified, scaler=unspecified, adder=unspecified, ref0=unspecified, ref=unspecified, continuity=unspecified, continuity_scaler=unspecified, rate_continuity=unspecified, rate_continuity_scaler=unspecified, rate2_continuity=unspecified, rate2_continuity_scaler=unspecified)

Adds a dynamic control variable to be tied to a parameter in the ODE.

Arguments:

name: The name assigned to the control variable. If the ODE has been decorated with parameters, this should be the name of a control in the system.

units: The units with which the control parameter in this phase will be defined. It must be compatible with the units of the targets to which the control is connected.

desc: A description of the control variable.

opt: If True, the control value will be a design variable for the optimization problem. If False, allow the control to be connected externally.

fix_initial: If True, the initial value of this control is fixed and not a design variable. This option is invalid if opt=False.

fix_final: If True, the final value of this control is fixed and not a design variable. This option is invalid if opt=False.

targets: Targets in the ODE to which this control is connected. In the future, if left _unspecified (the default), the phase control will try to connect to an ODE input of the same name. Currently _unspecified is the same as None, but a deprecation warning is issued. Set targets to None to prevent this (the old default behavior).

rate_targets: The targets in the ODE to which the control rate is connected.

rate2_targets: The parameter in the ODE to which the control 2nd derivative is connected.

val: The default value of the control variable at the control input nodes.

shape: The shape of the control variable at each point in time. Only needed for controls that don't have a target in the ode.

lower: The lower bound of the control variable at the nodes. This option is invalid if opt=False.

upper: The upper bound of the control variable at the nodes. This option is invalid if opt=False.

scaler: The scaler of the control variable at the nodes. This option is invalid if opt=False.

adder: The adder of the control variable at the nodes. This option is invalid if opt=False.

ref0: The zero-reference value of the control variable at the nodes. This option is invalid if opt=False.

ref: The unit-reference value of the control variable at the nodes. This option is invalid if opt=False.

continuity: Enforce continuity of control values at segment boundaries. This option is invalid if opt=False.

continuity_scaler: Scaler of the continuity constraint. This option is invalid if opt=False. This option is only relevant in the Radau pseudospectral transcription where the continuity constraint is nonlinear. For Gauss-Lobatto the continuity constraint is linear.

rate_continuity: Enforce continuity of control first derivatives (in dimensionless time) at segment boundaries. This option is invalid if opt=False.

rate_continuity_scaler: Scaler of the rate continuity constraint at segment boundaries. This option is invalid if opt=False.

rate2_continuity: Enforce continuity of control second derivatives at segment boundaries. This option is invalid if opt=False.

rate2_continuity_scaler: Scaler of the dimensionless rate continuity constraint at segment boundaries. This option is invalid if opt=False.

add_parameter(self, name, val=unspecified, units=unspecified, opt=False, desc=unspecified, lower=unspecified, upper=unspecified, scaler=unspecified, adder=unspecified, ref0=unspecified, ref=unspecified, targets=unspecified, shape=unspecified, dynamic=unspecified, include_timeseries=unspecified)

Add a parameter (static control variable) to the phase.

Arguments:

name: Name of the parameter.

val: Default value of the parameter at all nodes.

units: Units in which the parameter is defined. If 0, use the units declared for the parameter in the ODE.

opt: If True, the value(s) of this parameter will be design variables in the optimization problem, in the path 'phase_name.indep_controls.controls:control_name'. If False (default), the this parameter will still be owned by an IndepVarComp in the phase, but it will not be a design variable in the optimization.

desc: A description of the parameter.

lower: The lower bound of the parameter value.

upper: The upper bound of the parameter value.

scaler: The scaler of the parameter value for the optimizer.

ref0: The zero-reference value of the parameter for the optimizer.

ref: The unit-reference value of the parameter for the optimizer.

targets: Targets in the ODE to which this parameter is connected. In the future, if left _unspecified (the default), the phase parameter will try to connect to an ODE input of the same name. Currently _unspecified is the same as None, but a deprecation warning is issued. Set targets to None to prevent this (the old default behavior).

shape: The shape of the parameter.

dynamic: True if the targets in the ODE may be dynamic (if the inputs are sized to the number of nodes) else False.

include_timeseries: True if the static parameters should be included in output timeseries, else False.

add_path_constraint(self, name, constraint_name=None, units=None, shape=None, indices=None, lower=None, upper=None, equals=None, scaler=None, adder=None, ref=None, ref0=None, linear=False)

Add a path constraint to a variable in the phase.

Arguments:

name: Name of the response variable in the system.

constraint_name: The name of the variable as provided to the boundary constraint comp. By default this is the last element in name when split by dots. The user may override the constraint name if splitting the path causes name collisions.

units: The units in which the boundary constraint is to be applied. If None, use the units associated with the constrained output. If provided, must be compatible with the variables units.

shape: The shape of the variable being boundary-constrained. This can be inferred automatically for time, states, controls, and parameters, but is required if the constrained variable is an output of the ODE system.

indices: The indices of the output variable to be path constrained. Indices assumes C-order flattening. For instance, when constraining element [0, 1] of a variable of shape [2, 2], indices would be [3].

lower: Lower boundary for the variable.

upper: Upper boundary for the variable.

equals: Equality constraint value for the variable.

scaler: Value to multiply the model value to get the scaled value. Scaler is second in precedence.

adder: Value to add to the model value to get the scaled value. Adder is first in precedence.

ref: Value of response variable that scales to 1.0 in the driver.

ref0: Value of response variable that scales to 0.0 in the driver.

linear: Set to True if constraint is linear. Default is False.

add_polynomial_control(self, name, order, desc=unspecified, val=unspecified, units=unspecified, opt=unspecified, fix_initial=unspecified, fix_final=unspecified, lower=unspecified, upper=unspecified, scaler=unspecified, adder=unspecified, ref0=unspecified, ref=unspecified, targets=unspecified, rate_targets=unspecified, rate2_targets=unspecified, shape=unspecified)

Adds an polynomial control variable to be tied to a parameter in the ODE.

Polynomial controls are defined by values at the Legendre-Gauss-Lobatto nodes of a single polynomial, defined on [-1, 1] in phase tau space.

For a polynomial control of a given order, the number of nodes used to define the polynomial is (order + 1).

Arguments:

name: Name of the controllable parameter in the ODE.

order: The order of the interpolating polynomial used to represent the control valeu in phase tau space.

desc: A description of the polynomial control.

val: Default value of the control at all nodes. If val scalar and the control is dynamic it will be broadcast.

units: Units in which the control variable is defined. If 0, use the units declared for the parameter in the ODE.

opt: If True (default) the value(s) of this control will be design variables in the optimization problem, in the path 'phase_name.indep_controls.controls:control_name'. If False, the values of this control will exist as input controls:{name}.

fix_initial: If True, the given initial value of the polynomial control is not a design variable and will not be changed during the optimization.

fix_final: If True, the given final value of the polynomial control is not a design variable and will not be changed during the optimization.

lower: The lower bound of the control at the nodes of the phase.

upper: The upper bound of the control at the nodes of the phase.

scaler: The scaler of the control value at the nodes of the phase.

adder: The adder of the control value at the nodes of the phase.

ref0: The zero-reference value of the control at the nodes of the phase.

ref: The unit-reference value of the control at the nodes of the phase.

targets: Targets in the ODE to which this polynomial control is connected.

rate_targets: The name of the parameter in the ODE to which the first time-derivative of the control value is connected.

rate2_targets: The name of the parameter in the ODE to which the second time-derivative of the control value is connected.

shape: The shape of the control variable at each point in time.

add_state(self, name, units=unspecified, shape=unspecified, rate_source=unspecified, targets=unspecified, val=unspecified, fix_initial=unspecified, fix_final=unspecified, lower=unspecified, upper=unspecified, scaler=unspecified, adder=unspecified, ref0=unspecified, ref=unspecified, defect_scaler=unspecified, defect_ref=unspecified, solve_segments=unspecified, connected_initial=unspecified)

Add a state variable to be integrated by the phase.

Arguments:

name: Name of the state variable in the RHS.

units: Units in which the state variable is defined. Internally components may use different units for the state variable, but the IndepVarComp which provides its value will provide it in these units, and collocation defects will use these units. If units is not specified here then the unit will be determined from the rate_source.

shape: The shape of the state variable. For instance, a 3D cartesian position vector would have a shape of (3,). This only needs to be specified if the rate_source target points to a control or state whose shape isn't known in time.

rate_source: The path to the ODE output which provides the rate of this state variable.

targets: The path to the targets of the state variable in the ODE system. If given this will override the value given by the @declare_state decorator on the ODE. In the future, if left _unspecified (the default), the phase variable will try to connect to an ODE input of the same name. Currently _unspecified is the same as None, but a deprecation warning is issued. Set targets to None to prevent this (the old default behavior).

val: The default value of the state at the state discretization nodes of the phase.

fix_initial: If True, omit the first value of the state from the design variables (prevent the optimizer from changing it).

fix_final: If True, omit the final value of the state from the design variables (prevent the optimizer from changing it).

lower: The lower bound of the state at the nodes of the phase.

upper: The upper bound of the state at the nodes of the phase.

scaler: The scaler of the state value at the nodes of the phase.

adder: The adder of the state value at the nodes of the phase.

ref0: The zero-reference value of the state at the nodes of the phase.

ref: The unit-reference value of the state at the nodes of the phase.

defect_scaler: The scaler of the state defect at the collocation nodes of the phase.

defect_ref: The unit-reference value of the state defect at the collocation nodes of the phase. If provided, this value overrides defect_scaler.

solve_segments: If True, a solver will be used to converge the collocation defects within a segment. Note that the state continuity defects between segements will still be handled by the optimizer.

connected_initial: If True, then the initial value for this state comes from an externally connected source.

Adds a new timeseries output upon which outputs can be provided.

Arguments:

name: A name for the timeseries output path.

transcription: A transcription object which provides a grid upon which the outputs of the timeseries are provided.

subset: The name of the node subset in the given transcription at which outputs are to be provided.

add_timeseries_output(self, name, output_name=None, units=None, shape=None, timeseries='timeseries')

Add a variable to the timeseries outputs of the phase.

Arguments:

name: The name(s) of the variable to be used as a timeseries output. Must be one of 'time', 'time_phase', one of the states, controls, control rates, or parameters, in the phase, or the path to an output variable in the ODE.

output_name: The name of the variable as listed in the phase timeseries outputs. By default this is the last element in name when split by dots. The user may override the constraint name if splitting the path causes name collisions.

units: The units to express the timeseries output. If None, use the units associated with the target. If provided, must be compatible with the target units. If a list of names is provided, units can be a matching list or dictionary.

shape: The shape of the timeseries output variable. This must be provided (if not scalar) since Dymos doesn't necessarily know the shape of ODE outputs until setup time.

timeseries: The name of the timeseries to which the output is being added.

interpolate(self, xs=None, ys=None, nodes='all', kind='linear', axis=0)

Return an array of values on interpolated to the given node subset of the phase.

Arguments:

xs: Array of integration variable values.

ys: Array of control/state/parameter values.

nodes: The name of the node subset or None (default).

kind: Specifies the kind of interpolation, as per the scipy.interpolate package. One of ('linear', 'nearest', 'zero', 'slinear', 'quadratic', 'cubic' where 'zero', 'slinear', 'quadratic' and 'cubic' refer to a spline interpolation of zeroth, first, second or third order) or as an integer specifying the order of the spline interpolator to use. Default is 'linear'.

axis: Specifies the axis along which interpolation should be performed. Default is the first axis (0).

set_control_options(self, name, units=unspecified, desc=unspecified, opt=unspecified, fix_initial=unspecified, fix_final=unspecified, targets=unspecified, rate_targets=unspecified, rate2_targets=unspecified, val=unspecified, shape=unspecified, lower=unspecified, upper=unspecified, scaler=unspecified, adder=unspecified, ref0=unspecified, ref=unspecified, continuity=unspecified, continuity_scaler=unspecified, rate_continuity=unspecified, rate_continuity_scaler=unspecified, rate2_continuity=unspecified, rate2_continuity_scaler=unspecified)

Set options on an existing dynamic control variable in the phase.

Arguments:

name: The name assigned to the control variable. If the ODE has been decorated with parameters, this should be the name of a control in the system.

units: The units with which the control parameter in this phase will be defined. It must be compatible with the units of the targets to which the control is connected.

desc: A description of the control variable.

opt: If True, the control value will be a design variable for the optimization problem. If False, allow the control to be connected externally.

fix_initial: If True, the initial value of this control is fixed and not a design variable. This option is invalid if opt=False.

fix_final: If True, the final value of this control is fixed and not a design variable. This option is invalid if opt=False.

targets: Targets in the ODE to which this control is connected. In the future, if left _unspecified (the default), the phase control will try to connect to an ODE input of the same name. Currently _unspecified is the same as None, but a deprecation warning is issued. Set targets to None to prevent this (the old default behavior).

rate_targets: The targets in the ODE to which the control rate is connected.

rate2_targets: The parameter in the ODE to which the control 2nd derivative is connected.

val: The default value of the control variable at the control input nodes.

shape: The shape of the control variable at each point in time. Only needed for controls that don't have a target in the ode.

lower: The lower bound of the control variable at the nodes. This option is invalid if opt=False.

upper: The upper bound of the control variable at the nodes. This option is invalid if opt=False.

scaler: The scaler of the control variable at the nodes. This option is invalid if opt=False.

adder: The adder of the control variable at the nodes. This option is invalid if opt=False.

ref0: The zero-reference value of the control variable at the nodes. This option is invalid if opt=False.

ref: The unit-reference value of the control variable at the nodes. This option is invalid if opt=False.

continuity: Enforce continuity of control values at segment boundaries. This option is invalid if opt=False.

continuity_scaler: Scaler of the continuity constraint. This option is invalid if opt=False. This option is only relevant in the Radau pseudospectral transcription where the continuity constraint is nonlinear. For Gauss-Lobatto the continuity constraint is linear.

rate_continuity: Enforce continuity of control first derivatives (in dimensionless time) at segment boundaries. This option is invalid if opt=False.

rate_continuity_scaler: Scaler of the rate continuity constraint at segment boundaries. This option is invalid if opt=False.

rate2_continuity: Enforce continuity of control second derivatives at segment boundaries. This option is invalid if opt=False.

rate2_continuity_scaler: Scaler of the dimensionless rate continuity constraint at segment boundaries. This option is invalid if opt=False.

set_parameter_options(self, name, val=unspecified, units=unspecified, opt=False, desc=unspecified, lower=unspecified, upper=unspecified, scaler=unspecified, adder=unspecified, ref0=unspecified, ref=unspecified, targets=unspecified, shape=unspecified, dynamic=unspecified, include_timeseries=unspecified)

Set options for an existing parameter (static control variable) in the phase.

Arguments:

name: Name of the parameter.

val: Default value of the parameter at all nodes.

units: Units in which the parameter is defined. If 0, use the units declared for the parameter in the ODE.

opt: If True the value(s) of this parameter will be design variables in the optimization problem, in the path 'phase_name.indep_controls.controls:control_name'. If False (default), the this parameter will still be owned by an IndepVarComp in the phase, but it will not be a design variable in the optimization.

desc: A description of the parameter.

lower: The lower bound of the parameter value.

upper: The upper bound of the parameter value.

scaler: The scaler of the parameter value for the optimizer.

ref0: The zero-reference value of the parameter for the optimizer.

ref: The unit-reference value of the parameter for the optimizer.

targets: Targets in the ODE to which this parameter is connected. In the future, if left _unspecified (the default), the phase parameter will try to connect to an ODE input of the same name. Currently _unspecified is the same as None, but a deprecation warning is issued. Set targets to None to prevent this (the old default behavior).

shape: The shape of the parameter.

dynamic: True if the targets in the ODE may be dynamic (if the inputs are sized to the number of nodes) else False.

include_timeseries: True if the static parameters should be included in output timeseries, else False.

set_polynomial_control_options(self, name, order, desc=unspecified, val=unspecified, units=unspecified, opt=unspecified, fix_initial=unspecified, fix_final=unspecified, lower=unspecified, upper=unspecified, scaler=unspecified, adder=unspecified, ref0=unspecified, ref=unspecified, targets=unspecified, rate_targets=unspecified, rate2_targets=unspecified, shape=unspecified)

Set options on an existing polynomial control variable in the phase.

Arguments:

name: Name of the controllable parameter in the ODE.

order: The order of the interpolating polynomial used to represent the control value in phase tau space.

desc: A description of the polynomial control.

val: Default value of the control at all nodes. If val scalar and the control is dynamic it will be broadcast.

units: Units in which the control variable is defined. If 0, use the units declared for the parameter in the ODE.

opt: If True (default) the value(s) of this control will be design variables in the optimization problem, in the path 'phase_name.indep_controls.controls:control_name'. If False, the values of this control will exist as input controls:{name}.

fix_initial: If True, the given initial value of the polynomial control is not a design variable and will not be changed during the optimization.

fix_final: If True, the given final value of the polynomial control is not a design variable and will not be changed during the optimization.

lower: The lower bound of the control at the nodes of the phase.

upper: The upper bound of the control at the nodes of the phase.

scaler: The scaler of the control value at the nodes of the phase.

adder: The adder of the control value at the nodes of the phase.

ref0: The zero-reference value of the control at the nodes of the phase.

ref: The unit-reference value of the control at the nodes of the phase.

targets: Targets in the ODE to which this polynomial control is connected.

rate_targets: The name of the parameter in the ODE to which the first time-derivative of the control value is connected.

rate2_targets: The name of the parameter in the ODE to which the second time-derivative of the control value is connected.

shape: The shape of the control variable at each point in time.

set_refine_options(self, refine=unspecified, tol=unspecified, min_order=unspecified, max_order=unspecified, smoothness_factor=unspecified)

Set the specified option(s) for grid refinement in the phase.

Arguments:

refine: If True, this Phase will undergo refinement during the grid refinement procedure.

tol: The error tolerance used by all grid-refinement algorithms.

min_order: The minimum allowable transcription order for segments in the phase. Used in hp and ph refinement methods.

max_order: The maximum allowable transcription order for segments in the phase. Used in hp and ph refinement methods.

smoothness_factor: The maximum allowable ratio of state second derivatives. If exceeded the segment must be split. Used in hp refinement method.

set_state_options(self, name, units=unspecified, shape=unspecified, rate_source=unspecified, targets=unspecified, val=unspecified, fix_initial=unspecified, fix_final=unspecified, lower=unspecified, upper=unspecified, scaler=unspecified, adder=unspecified, ref0=unspecified, ref=unspecified, defect_scaler=unspecified, defect_ref=unspecified, solve_segments=unspecified, connected_initial=unspecified)

Set options that apply the EOM state variable of the given name.

Arguments:

name: Name of the state variable in the RHS.

units: Units in which the state variable is defined. Internally components may use different units for the state variable, but the IndepVarComp which provides its value will provide it in these units, and collocation defects will use these units. If units is not specified here then the unit will be determined from the rate_source.

shape: The shape of the state variable. For instance, a 3D cartesian position vector would have a shape of (3,). This only needs to be specified if the rate_source target points to a control or state whose shape isn't known in time.

rate_source: The path to the ODE output which provides the rate of this state variable.

targets: The path to the targets of the state variable in the ODE system. If given this will override the value given by the @declare_state decorator on the ODE. In the future, if left _unspecified (the default), the phase variable will try to connect to an ODE input of the same name. Currently _unspecified is the same as None, but a deprecation warning is issued. Set targets to None to prevent this (the old default behavior).

val: The default value of the state at the state discretization nodes of the phase.

fix_initial: If True, omit the first value of the state from the design variables (prevent the optimizer from changing it).

fix_final: If True, omit the final value of the state from the design variables (prevent the optimizer from changing it).

lower: The lower bound of the state at the nodes of the phase.

upper: The upper bound of the state at the nodes of the phase.

scaler: The scaler of the state value at the nodes of the phase.

adder: The adder of the state value at the nodes of the phase.

ref0: The zero-reference value of the state at the nodes of the phase.

ref: The unit-reference value of the state at the nodes of the phase.

defect_scaler: The scaler of the state defect at the collocation nodes of the phase.

defect_ref: The unit-reference value of the state defect at the collocation nodes of the phase. If provided, this value overrides defect_scaler.

solve_segments: If True, a solver will be used to converge the collocation defects within a segment. Note that the state continuity defects between segements will still be handled by the optimizer.

connected_initial: If True, then the initial value for this state comes from an externally connected source.

set_time_options(self, units=unspecified, fix_initial=unspecified, fix_duration=unspecified, input_initial=unspecified, input_duration=unspecified, initial_val=unspecified, initial_bounds=unspecified, initial_scaler=unspecified, initial_adder=unspecified, initial_ref0=unspecified, initial_ref=unspecified, duration_val=unspecified, duration_bounds=unspecified, duration_scaler=unspecified, duration_adder=unspecified, duration_ref0=unspecified, duration_ref=unspecified, targets=unspecified, time_phase_targets=unspecified, t_initial_targets=unspecified, t_duration_targets=unspecified)

Sets options for time in the phase.

Only those options which are specified in the arguments will be updated.

Arguments:

units: The default units for time variables in the phase. Default is 's'.

fix_initial: If True, the initial time of the phase is not treated as a design variable for the optimization problem.

fix_duration: If True, the duration of the phase is not treated as a design variable for the optimization problem.

input_initial: If True, the user is expected to link phase.t_initial to an external output source. Providing input_initial=True makes all initial time optimization settings irrelevant.

input_duration: If True, the user is expected to link phase.t_duration to an external output source. Providing input_duration=True makes all time duration optimization settings irrelevant.

initial_val: Default value of the time at the start of the phase.

initial_bounds: The bounds (lower, upper) for time at the start of the phase.

initial_scaler: Scalar for the initial value of time.

initial_ref0: Zero-reference for the initial value of time.

initial_ref: Unit-reference for the initial value of time.

duration_val: Default value for the time duration of the phase.

duration_bounds: The bounds (lower, upper) for the time duration of the phase.

duration_scaler: Scaler for phase time duration.

duration_ref0: Zero-reference for phase time duration.

duration_ref: Unit-reference for phase time duration.

targets: Targets in the ODE for the value of current time.

time_phase_targets: Targets in the ODE for the value of current phase elapsed time.

t_initial_targets: Targets in the ODE for the value of phase initial time.

t_duration_targets: Targets in the ODE for the value of phase time duration.

simulate(self, times_per_seg=10, method='RK45', atol=1e-09, rtol=1e-09, record_file=None)

Simulate the Phase using scipy.integrate.solve_ivp.

Arguments:

times_per_seg: Number of equally spaced times per segment at which output is requested. If None, output will be provided at all Nodes.

method: The scipy.integrate.solve_ivp integration method.

atol: Absolute convergence tolerance for scipy.integrate.solve_ivp.

rtol: Relative convergence tolerance for scipy.integrate.solve_ivp.

record_file: If a string, the file to which the result of the simulation will be saved. If None, no record of the simulation will be saved.