BaseAdaptiveStepController

class cubie.integrators.step_control.adaptive_step_controller.BaseAdaptiveStepController(config: AdaptiveStepControlConfig)[source]

Bases: BaseStepController

Base class for adaptive step-size controllers.

__init__(config: AdaptiveStepControlConfig) None[source]

Initialise the adaptive controller.

Parameters:

config – Configuration for the controller.

property algorithm_order: int

Return the integration algorithm order assumed by the controller.

property atol: ndarray

Return absolute tolerance.

build() ControllerCache[source]

Construct the device function implementing the controller.

Returns:

Compiled CUDA device function for adaptive control.

Return type:

Callable

abstractmethod 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 specific controller.

Parameters:
  • precision – Precision callable used to coerce values.

  • clamp – Callable that limits step updates.

  • 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 handled by the controller.

  • 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 controller policy.

Return type:

Callable

property deadband_max: float

Return the upper gain threshold for unity selection.

property deadband_min: float

Return the lower gain threshold for unity selection.

abstract property local_memory_elements: int

Return number of floats required for controller local memory.

property max_gain: float

Return the maximum gain factor.

property min_gain: float

Return the minimum gain factor.

property rtol: ndarray

Return relative tolerance.

property safety: float

Return the safety scaling factor.