GustafssonController

class cubie.integrators.GustafssonController(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n: int = 1, **kwargs)[source]

Bases: BaseAdaptiveStepController

Adaptive controller using Gustafsson acceleration.

__init__(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], n: int = 1, **kwargs) None[source]

Initialise a Gustafsson predictive controller.

Parameters:
  • precision – Precision used for controller calculations.

  • n – Number of state variables.

  • **kwargs – Optional parameters passed to GustafssonStepControlConfig. See GustafssonStepControlConfig for available parameters including dt_min, dt_max, atol, rtol, algorithm_order, min_gain, max_gain, gamma, newton_max_iters, deadband_min, deadband_max. None values are ignored.

build_controller(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], clamp: Callable, min_gain: float, max_gain: float, dt_min: float, dt_max: float, n: int, atol: ndarray, rtol: ndarray, algorithm_order: int, safety: float) ControllerCache[source]

Create the device function for the Gustafsson controller.

Parameters:
  • precision – Precision callable used to coerce scalars on device.

  • clamp – Callable that clamps proposed step sizes.

  • min_gain – Minimum allowed gain when adapting the step size.

  • max_gain – Maximum allowed gain when adapting the step size.

  • dt_min – Minimum permissible step size.

  • dt_max – Maximum permissible step size.

  • n – Number of state variables controlled per step.

  • atol – Absolute tolerance vector.

  • rtol – Relative tolerance vector.

  • algorithm_order – Order of the integration algorithm.

  • safety – Safety factor used when scaling the step size.

Returns:

CUDA device function implementing the Gustafsson controller.

Return type:

Callable

property gamma: float

Return the damping factor applied to the gain.

property local_memory_elements: int

Return the number of local memory slots required.

property newton_max_iters: int

Return the maximum number of Newton iterations considered.