Runge-Kutta Base¶
- class pathsim.solvers._rungekutta.ExplicitRungeKutta(*solver_args, **solver_kwargs)[source]¶
Bases:
ExplicitSolverBase class for explicit Runge-Kutta integrators which implements the timestepping at intermediate stages and the error control if the coefficients for the local truncation error estimate are defined.
Note
This class is not intended to be used directly!!!
- history¶
internal history of past results
- Type:
deque[numeric]
- error_controller(dt)[source]¶
Compute scaling factor for adaptive timestep based on absolute and relative local truncation error estimate, also checks if the error tolerance is achieved and returns a success metric.
- Parameters:
dt (float) – integration timestep
- Returns:
success (bool) – timestep was successful
err (float) – truncation error estimate
scale (float) – timestep rescale from error controller
- step(f, dt)[source]¶
Performs the (explicit) timestep at the intermediate RK stages for (t+dt) based on the state and input at (t)
- Parameters:
f (numeric, array[numeric]) – evaluation of function
dt (float) – integration timestep
- Returns:
success (bool) – timestep was successful
err (float) – truncation error estimate
scale (float) – timestep rescale from error controller
- class pathsim.solvers._rungekutta.DiagonallyImplicitRungeKutta(*solver_args, **solver_kwargs)[source]¶
Bases:
ImplicitSolverBase class for diagonally implicit Runge-Kutta (DIRK) integrators which implements the timestepping at intermediate stages, involving the numerical solution of the implicit update equation and the error control if the coefficients for the local truncation error estimate are defined.
Extensions and checks to also handle explicit first stages (ESDIRK) and additional final evaluation coefficients (not stiffly accurate)
Note
This class is not intended to be used directly!!!
- error_controller(dt)[source]¶
Compute scaling factor for adaptive timestep based on absolute and relative local truncation error estimate, also checks if the error tolerance is achieved and returns a success metric.
- Parameters:
dt (float) – integration timestep
- Returns:
success (bool) – timestep was successful
err (float) – truncation error estimate
scale (float) – timestep rescale from error controller
- step(f, dt)[source]¶
performs the (explicit) timestep at the intermediate RK stages for (t+dt) based on the state and input at (t)
- Parameters:
f (array_like) – evaluation of function
dt (float) – integration timestep
- Returns:
success (bool) – timestep was successful
err (float) – truncation error estimate
scale (float) – timestep rescale from error controller