Simulation options¶
These following options exists for the integrators. Some options are only relevant for the IDA integrator. The options are stored as a Dict in SimulationObject.options.
How to set the simulation options¶
The easiest way to interact with the options is to use the get function
get_options()
to fetch the options dictionary, change the desired options (for instance the absolute simulation tolerance abs_tol
and the relative simulation tolerance rel_tol
), and the update the simulation object with these new options using the set function set_options(options: Dict[str, float])
. See example below.
options = simulation_object.get_options()
options['abs_tol'] = 1e-8
options['rel_tol'] = 1e-10
simulation_object.set_options(options)
Alternative, you can alter the option directly by passing a custom dictionary, see example below:
options = {'abs_tol': 1e-8, 're_tol': 1e-10}
simulation_object.set_options(options)
The next sections describe the existing CVODE options and IDA options that you can interact with through the simulation object options.
CVODE options¶
Option | Type | Default value | Description |
---|---|---|---|
abs_tol
|
float |
1.0e-6 |
The scalar absolute error tolerance |
init_step
|
float |
0.0 |
The value of the initial step size to be attempted |
max_conv_fails
|
int |
10 |
Maximum number of allowable nonlinear solver convergence failures per step |
max_err_test_fails
|
int |
50 |
Maximum number of error test failures allowed on one step |
max_hnil
|
int |
-1 |
Maximum number of messages issued by the solver warning that t + h = t on the next internal step |
max_nonlin_iters
|
int |
3 |
Maximum number of nonlinear solver iterations allowed per step |
max_num_steps
|
int |
100000 |
maximum number of steps to be taken by the solver in its attempt to reach the next output time |
max_ord
|
int |
5 |
Maximum order of the linear multistep method. Must be positive |
max_step
|
float |
0.0 |
Upper bound on the magnitude of the step size |
method
|
int |
0 |
Linear multistep method. 0 for Adams, 1 for BDF |
min_step
|
float |
0.0 |
Lower bound on the magnitude of the step size |
rel_tol
|
float |
1.0e-6 |
The scalar relative error tolerance |
show_integrator_stats
|
int |
0 |
If set to 1, prints diagnostic statistics for the simulation |
IDA options¶
Option | Type | Default value | Description |
---|---|---|---|
abs_tol
|
float |
1.0e-6 |
The scalar absolute error tolerance The scalar absolute error tolerance |
calc_ic
|
int |
0 |
If set to 1, will correct initial conditions prior to simulation. |
init_step
|
float |
0.0 |
The value of the initial step size to be attempted |
max_conv_fails
|
int |
10 |
Maximum number of allowable nonlinear solver convergence failures per step |
max_err_test_fails
|
int |
50 |
Maximum number of error test failures allowed on one step |
max_nonlin_iters
|
int |
3 |
Maximum number of nonlinear solver iterations allowed per step |
max_num_backs_ic
|
int |
100000 |
Maximum number of linesearch backtracks allowed in any Newton iteration, when solving the initial conditions calculation problem |
max_num_iters_ic
|
int |
10000 |
Maximum number of Newton iterations allowed in any one attempt to solve the initial conditions calculation problem |
max_num_jacs_ic
|
int |
5000 |
Maximum number of the approximate Jacobian or preconditioner evaluations allowed when the Newton iteration appears to be slowly converging |
max_num_steps
|
int |
100000 |
Maximum number of steps to be taken by the solver in its attempt to reach the next output time |
max_num_steps_ic
|
int |
5000 |
Maximum number of steps to be taken by the solver when correcting the initial conditions. See calc_ic. |
max_ord
|
int |
5 |
Maximum order of the linear multistep method. Must be positive |
max_step
|
float |
0.0 |
Maximum absolute value of the step size |
rel_tol
|
float |
1.0e-6 |
The scalar relative error tolerance |
show_integrator_stats
|
int |
0 |
If set to 1, prints diagnostic statistics for the simulation |