BaseAdaptiveStepController

class cubie.integrators.step_control.adaptive_step_controller.BaseAdaptiveStepController(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], dt: float = None, n_states: int = 1, **kwargs)[source]

Bases: BaseStepController

Base class for adaptive step-size controllers; owns norm.

_update(updates: dict[str, object], silent: bool) → set[str][source]

Update the owned norm, then the controller.

Parameters:
  • updates – Setting names to new values; gains the norm’s norm_fn.

  • silent – Suppress the other-controller parameter warning.

Returns:

Names the controller recognised.

Return type:

set[str]

Notes

The norm’s solver_width follows n_states.

property algorithm_order: int

Return the integration algorithm order assumed by the controller.

abstractmethod build_controller(precision: type[float16] | type[float32] | type[float64] | dtype[float16] | dtype[float32] | dtype[float64], clamp: Callable, min_step_shrink: float, max_step_growth: float, dt_min: float, dt_max: float, algorithm_order: int, safety: float, error_norm: Callable) → 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_step_shrink – Most the step may shrink per adjustment.

  • max_step_growth – Most the step may grow per adjustment.

  • dt_min – Minimum permissible step size.

  • dt_max – Maximum permissible step size.

  • algorithm_order – Order of the integration algorithm.

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

  • error_norm – Device function (error, state, state_prev) -> nrm2.

Returns:

Cache containing the compiled controller device function.

Return type:

ControllerCache

compile_controller() → ControllerCache[source]

Construct the device function implementing the controller.

Returns:

Cache containing the compiled adaptive controller device function.

Return type:

ControllerCache

property deadband_max: float

Return the upper gain threshold for unity selection.

property deadband_min: float

Return the lower gain threshold for unity selection.

property max_step_growth: float

Return the most the step may grow per adjustment.

property min_step_shrink: float

Return the most the step may shrink per adjustment.

property safety: float

Return the safety scaling factor.