Base class for GEAR-type integrators that defines the universal methods.
Numerical integration method based on BDFs (linear multistep methods).
Uses n-th order BDF for timestepping and (n-1)-th order BDF coefficients
to estimate a lower ordersolutuin for error control.
The adaptive timestep BDF coefficients are dynamically computed at the
beginning of each timestep from the buffered previous timsteps.
Revert integration engine to previous timestep, this is only
relevant for adaptive methods where the simulation timestep ‘dt’
is rescaled and the engine step is recomputed with the smaller
timestep.
Finalizes the timestep by resetting the solver for the implicit
update equation and computing the lower order estimate of the
solution for error control.
The simplest adaptive multistep stiff solver. A-stability makes it safe
for any stiff block diagram. The multistep approach reuses past solution
values, so per-step cost is lower than single-step implicit methods
(ESDIRK), but a startup phase is needed to fill the history buffer. For
higher accuracy, use GEAR32 or ESDIRK43.
Good balance of accuracy and stability for stiff block diagrams. The
stability wedge is nearly as wide as GEAR21 (\(\approx 86°\))
while providing an extra order of accuracy. For most stiff systems this
is a practical default when a multistep solver is preferred over ESDIRK.
Narrower stability wedge than GEAR32. Eigenvalues near the imaginary
axis may be poorly damped. Use only when the stiff modes are strongly
dissipative and 4th order accuracy is needed. Otherwise, GEAR32 or
ESDIRK43 are safer choices.
The stability wedge is significantly narrower than lower-order GEAR
variants. Only justified for mildly stiff problems where 5th order
accuracy yields a clear efficiency gain. For strongly stiff systems,
GEAR21/GEAR32 or ESDIRK54 are more robust.
Variable-step, variable-order BDF (orders 2–5). Adapts both timestep
and order automatically.
At each step the error controller compares estimates from orders
\(n-1\) and \(n+1\) and selects the order that minimises the
normalised error, allowing larger steps. Analogous to MATLAB’s
ode15s. Uses ESDIRK32 as startup solver.
Stability: A-stable at order 2, \(A(\alpha)\)-stable at orders 3–5
Note
The most autonomous stiff solver in this library. Automatically selects
higher orders in smooth regions for larger steps and drops to low order
in stiff or transient regions for stability. A good default when the
character of the block diagram is unknown or changes during the
simulation (e.g. switching events, varying loads).
Compute scaling factor for adaptive timestep based on absolute and
relative tolerances of the local truncation error estimate obtained from
esimated lower and higher order solution.
Checks if the error tolerance is achieved and returns a success metric.
Adapts the stepping order such that the normalized error is minimized and
larger steps can be taken by the integrator.
Parameters:
tr_m (array[float]) – lower order truncation error estimate
tr_p (array[float]) – higher order truncation error estimate
Returns:
success (bool) – True if the timestep was successful
error (float) – estimated error of the internal error controller
scale (float) – estimated timestep rescale factor for error control