otf.time_integration.solver
Explicit and wrapped ODE solvers for time integration.
This module provides a small collection of time-integration algorithms used
by the otf package: simple single-step and multistage integrators (e.g.
ForwardEuler, RK4), multistep Adams methods, and a SolveIvp wrapper
around scipy.integrate.solve_ivp that matches the solver interface used in
this package.
Classes:
| Name | Description |
|---|---|
ForwardEuler |
Forward Euler solver. |
FourStepAdamsBashforth |
Four-step Adams–Bashforth explicit multistep integrator. |
RK4 |
4th-order Runge–Kutta solver. |
SolveIvp |
|
TwoStepAdamsBashforth |
Two-step explicit Adams–Bashforth multistep integrator. |
ForwardEuler
Bases: SinglestepSolver
Forward Euler solver.
See documentation of SinglestepSolver.
Source code in src/otf/time_integration/base.py
FourStepAdamsBashforth
Bases: MultistepSolver
Four-step Adams–Bashforth explicit multistep integrator.
Requires a pre_multistep_solver to generate the first three steps when
beginning integration, or callers must supply the initial history of
four states. pre_multistep_solver may be passed as None in which case
the caller is responsible for providing the required initial history when
invoking solve/solve_true.
Initialize the four-step Adams–Bashforth solver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
BaseSystem
|
The system to integrate. |
required |
pre_multistep_solver
|
BaseSolver | None
|
Optional solver used to produce initial steps until four history
values are available. If |
None
|
Source code in src/otf/time_integration/solver.py
RK4
Bases: MultistageSolver
4th-order Runge–Kutta solver.
See documentation of base_solver.SinglestepSolver.
See https://en.wikipedia.org/wiki/Runge%E2%80%93Kutta_methods
Source code in src/otf/time_integration/base.py
SolveIvp
Bases: MultistageSolver
scipy.integrate.solve_ivp wrapper matching the solver interface.
This adapter lets users employ SciPy's solve_ivp while keeping the same
external solve/solve_true signatures used across other solvers in this
package. Note that integration is performed in NumPy/SciPy (not JAX).
Initialize the SolveIvp adapter.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
BaseSystem
|
An instance of |
required |
options
|
dict
|
Optional keyword arguments that are passed directly to
|
dict()
|
Notes
Integration is performed by SciPy (NumPy), not JAX. The options
dictionary may be modified after initialization.
Source code in src/otf/time_integration/solver.py
TwoStepAdamsBashforth
Bases: MultistepSolver
Two-step explicit Adams–Bashforth multistep integrator.
This class implements the classical two-step Adams–Bashforth method for
explicit integration of the nonlinear terms. A pre_multistep_solver may
be provided to generate initial steps when starting the integration. If
pre_multistep_solver is None, callers must supply the required two
initial history states when invoking solve/solve_true.
Initialize the two-step Adams–Bashforth solver.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
system
|
BaseSystem
|
The system to integrate. |
required |
pre_multistep_solver
|
BaseSolver | None
|
Optional solver used to produce initial steps until two history
values are available. If |
None
|