braincell.quad.ssprk3_step

Contents

braincell.quad.ssprk3_step#

braincell.quad.ssprk3_step(target, *args)[source]#

Advance one step with the Strong-Stability-Preserving RK3 method.

The Shu-Osher third-order strong-stability-preserving Runge-Kutta scheme (SSPRK3) is a convex combination of forward Euler steps:

\[\begin{split}k_1 &= f(t_n, y_n), \\ k_2 &= f\!\left(t_n + \Delta t,\, y_n + \Delta t \, k_1\right), \\ k_3 &= f\!\left(t_n + \tfrac{1}{2}\Delta t,\ y_n + \tfrac{1}{4}\Delta t \, k_1 + \tfrac{1}{4}\Delta t \, k_2\right), \\ y_{n+1} &= y_n + \tfrac{\Delta t}{6}\left(k_1 + k_2 + 4 k_3\right).\end{split}\]

Because every stage can be written as a convex combination of forward Euler updates, SSPRK3 inherits the monotonicity (TVD) properties of forward Euler under the same CFL number. This makes it the explicit method of choice for problems with discontinuities or sharp gradients where preserving positivity matters. Local truncation error is \(O(\Delta t^4)\); global error is \(O(\Delta t^3)\).

Parameters:
  • target (DiffEqModule) – Differential-equation module to advance.

  • *args – Extra positional arguments forwarded to target’s integration hooks.

Returns:

Updates target’s state in place.

Return type:

None

Notes

Butcher tableau (ssprk3_tableau):

\[\begin{split}\begin{array}{c|ccc} 0 & 0 & 0 & 0 \\ 1 & 1 & 0 & 0 \\ \tfrac{1}{2} & \tfrac{1}{4} & \tfrac{1}{4} & 0 \\ \hline & \tfrac{1}{6} & \tfrac{1}{6} & \tfrac{2}{3} \end{array}\end{split}\]

References

Examples

>>> import brainstate
>>> import brainunit as u
>>> from braincell.quad import ssprk3_step
>>> with brainstate.environ.context(t=0. * u.ms, dt=0.01 * u.ms):
...     ssprk3_step(my_neuron)