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.

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.

update(updates_dict: dict[str, object] | None = None, silent: bool = False, **kwargs: object) set[str][source]

Propagate updates to the owned norm and then the controller.