GenericRosenbrockWStep

GenericRosenbrockWStep provides a linearly implicit Rosenbrock-W integrator that requires only one Jacobian factorisation per step. The factory consumes RosenbrockTableau instances and couples user-supplied device callbacks with matrix-free linear solves from cubie.integrators.matrix_free_solvers.

class cubie.integrators.algorithms.GenericRosenbrockWStep(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, driver_del_t: Callable | None = None, get_solver_helper_fn: Callable | None = None, tableau: RosenbrockTableau = RosenbrockTableau(a=((0.0, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0)), b=(2.0, 0.5773502691896257, 0.42264973081037427), c=(0.0, 1.0, 1.0), order=3, b_hat=(2.113248654051871, 1.0, 0.4226497308103742), C=((0.0, 0.0, 0.0), (-1.6076951545867364, 0.0, 0.0), (-3.4641016151377553, -1.7320508075688774, 0.0)), gamma=0.7886751345948129, gamma_stages=(0.7886751345948129, -0.2113248654051871, -1.0773502691896257)), **kwargs)[source]

Bases: ODEImplicitStep

Rosenbrock-W 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, driver_del_t: Callable | None = None, get_solver_helper_fn: Callable | None = None, tableau: RosenbrockTableau = RosenbrockTableau(a=((0.0, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0)), b=(2.0, 0.5773502691896257, 0.42264973081037427), c=(0.0, 1.0, 1.0), order=3, b_hat=(2.113248654051871, 1.0, 0.4226497308103742), C=((0.0, 0.0, 0.0), (-1.6076951545867364, 0.0, 0.0), (-3.4641016151377553, -1.7320508075688774, 0.0)), gamma=0.7886751345948129, gamma_stages=(0.7886751345948129, -0.2113248654051871, -1.0773502691896257)), **kwargs) None[source]

Initialise the Rosenbrock-W step configuration.

This constructor creates a Rosenbrock-W 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.

  • driver_del_t – Optional compiled CUDA device function computing time derivatives of drivers (required for some Rosenbrock formulations).

  • get_solver_helper_fn – Factory function returning solver helper for Jacobian operations.

  • tableau – Rosenbrock tableau describing the coefficients and gamma values. Defaults to DEFAULT_ROSENBROCK_TABLEAU.

  • **kwargs – Optional parameters passed to config classes. See RosenbrockWStepConfig, ImplicitStepConfig, and solver config classes for available parameters. None values are ignored.

Notes

The step controller defaults are selected dynamically:

  • If tableau.has_error_estimate is True: Uses ROSENBROCK_ADAPTIVE_DEFAULTS (PI controller)

  • If tableau.has_error_estimate is False: Uses ROSENBROCK_FIXED_DEFAULTS (fixed-step controller)

This automatic selection prevents incompatible configurations where an adaptive controller is paired with an errorless tableau.

Rosenbrock methods linearize the ODE around the current state, avoiding the need for iterative Newton solves. This makes them efficient for moderately stiff problems. The gamma parameter from the tableau controls the implicit treatment of the linearized system.

build_implicit_helpers() None[source]

Construct the linear solver used by Rosenbrock methods.

build_step(evaluate_f: Callable, evaluate_observables: Callable, evaluate_driver_at_t: Callable | None, solver_function: Callable, numba_precision: type, n: int, n_drivers: int) StepCache[source]

Compile the Rosenbrock-W device step.

property cached_auxiliary_count: int

Return the number of cached auxiliary entries for the JVP.

Lazily builds implicit helpers so as not to return an errant ‘None’.

property is_adaptive: bool

Return True if algorithm calculates an error estimate.

property is_implicit: bool

Return True because the method solves linear systems.

property is_multistage: bool

Return True as the method has multiple stages.

property order: int

Return the classical order of accuracy.

register_buffers() None[source]

Register buffers according to locations in compile settings.

property threads_per_step: int

Return the number of CUDA threads that advance one state.

class cubie.integrators.algorithms.generic_rosenbrock_w.RosenbrockWStepConfig(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: RosenbrockTableau = RosenbrockTableau(a=((0.0, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0), (1.2679491924311228, 0.0, 0.0)), b=(2.0, 0.5773502691896257, 0.42264973081037427), c=(0.0, 1.0, 1.0), order=3, b_hat=(2.113248654051871, 1.0, 0.4226497308103742), C=((0.0, 0.0, 0.0), (-1.6076951545867364, 0.0, 0.0), (-3.4641016151377553, -1.7320508075688774, 0.0)), gamma=0.7886751345948129, gamma_stages=(0.7886751345948129, -0.2113248654051871, -1.0773502691896257)), time_derivative_function: Callable | None = None, prepare_jacobian_function: Callable | None = None, driver_del_t: Callable | None = None, stage_rhs_location: str = 'local', stage_store_location: str = 'local', cached_auxiliaries_location: str = 'local', base_state_placeholder_location: str = 'local', krylov_iters_out_location: str = 'local')[source]

Bases: ImplicitStepConfig

Configuration describing the Rosenbrock-W integrator.

base_state_placeholder_location: str
cached_auxiliaries_location: str
driver_del_t: Callable | None
krylov_iters_out_location: str
prepare_jacobian_function: Callable | None
stage_rhs_location: str
stage_store_location: str
tableau: RosenbrockTableau
time_derivative_function: Callable | None