DIRKStep
DIRKStep provides a diagonally implicit Runge–Kutta integrator that
solves stage systems with the cached Newton–Krylov helpers supplied by
cubie.integrators.matrix_free_solvers. The factory consumes
DIRKTableau instances,
exposing L-stable SDIRK and ESDIRK schemes for stiff problems while preserving
adaptive error control through embedded weights.
- class cubie.integrators.algorithms.DIRKStep(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n: int, evaluate_f: Callable | None = None, evaluate_observables: Callable | None = None, evaluate_driver_at_t: Callable | None = None, get_solver_helper_fn: Callable | None = None, tableau: DIRKTableau = DIRKTableau(a=((0.16666666666666666, 0.0, 0.0), (0.6666666666666666, 0.16666666666666666, 0.0), (0.16666666666666666, 0.6666666666666666, 0.16666666666666666)), b=(0.16666666666666666, 0.6666666666666666, 0.16666666666666666), c=(0.0, 0.5, 1.0), order=4, b_hat=None), n_drivers: int = 0, **kwargs)[source]
Bases:
ODEImplicitStepDiagonally implicit Runge–Kutta step with an embedded error estimate.
- __init__(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n: int, evaluate_f: Callable | None = None, evaluate_observables: Callable | None = None, evaluate_driver_at_t: Callable | None = None, get_solver_helper_fn: Callable | None = None, tableau: DIRKTableau = DIRKTableau(a=((0.16666666666666666, 0.0, 0.0), (0.6666666666666666, 0.16666666666666666, 0.0), (0.16666666666666666, 0.6666666666666666, 0.16666666666666666)), b=(0.16666666666666666, 0.6666666666666666, 0.16666666666666666), c=(0.0, 0.5, 1.0), order=4, b_hat=None), n_drivers: int = 0, **kwargs) None[source]
Initialise the DIRK step configuration.
This constructor creates a DIRK step object and automatically selects appropriate default step controller settings based on whether the tableau has an embedded error estimate. Tableaus with error estimates default to adaptive stepping (PI controller), while errorless tableaus default to fixed stepping.
- Parameters:
precision – Floating-point precision for CUDA computations.
n – Number of state variables in the ODE system.
evaluate_f – Device function for evaluating f(t, y) right-hand side.
evaluate_observables – Device function computing system observables.
evaluate_driver_at_t – Optional device function evaluating drivers at arbitrary times.
get_solver_helper_fn – Factory function returning solver helper for Jacobian operations.
tableau – DIRK tableau describing the coefficients. Defaults to
DEFAULT_DIRK_TABLEAU.n_drivers – Number of driver variables in the system.
**kwargs – Optional parameters passed to config classes. See DIRKStepConfig, ImplicitStepConfig, and solver config classes for available parameters. None values are ignored.
Notes
The step controller defaults are selected dynamically:
If
tableau.has_error_estimateisTrue: UsesDIRK_ADAPTIVE_DEFAULTS(PI controller)If
tableau.has_error_estimateisFalse: UsesDIRK_FIXED_DEFAULTS(fixed-step controller)
This automatic selection prevents incompatible configurations where an adaptive controller is paired with an errorless tableau.
- build_implicit_helpers() None[source]
Construct the nonlinear solver chain used by implicit methods.
- class cubie.integrators.algorithms.generic_dirk.DIRKStepConfig(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n: int = 1, n_drivers: int = 0, evaluate_f: Callable | None = None, evaluate_observables: Callable | None = None, evaluate_driver_at_t: Callable | None = None, get_solver_helper_fn: Callable | None = None, beta: float = 1.0, gamma: float = 1.0, M: ndarray | MutableDenseMatrix = Matrix([[1]]), preconditioner_order: int = 2, solver_function=None, tableau: DIRKTableau = DIRKTableau(a=((0.16666666666666666, 0.0, 0.0), (0.6666666666666666, 0.16666666666666666, 0.0), (0.16666666666666666, 0.6666666666666666, 0.16666666666666666)), b=(0.16666666666666666, 0.6666666666666666, 0.16666666666666666), c=(0.0, 0.5, 1.0), order=4, b_hat=None), stage_increment_location: str = 'local', stage_base_location: str = 'local', accumulator_location: str = 'local', stage_rhs_location: str = 'local')[source]
Bases:
ImplicitStepConfigConfiguration describing the DIRK integrator.
- tableau: DIRKTableau