SSPRK22

class pathsim.solvers.ssprk22.SSPRK22(*solver_args, **solver_kwargs)[source]

Bases: ExplicitRungeKutta

Two-stage, 2nd order Strong Stability Preserving (SSP) Runge-Kutta method.

Also known as Heun’s method. SSP methods preserve monotonicity and total variation diminishing (TVD) properties of the spatial discretisation under a timestep restriction scaled by the SSP coefficient.

Characteristics

  • Order: 2

  • Stages: 2

  • Explicit, fixed timestep

  • SSP coefficient \(\mathcal{C} = 1\)

Note

Relevant when a block diagram wraps a method-of-lines discretisation of a hyperbolic PDE (e.g. shallow water, compressible Euler) inside an ODE block and the spatial operator is TVD under forward Euler. For typical ODE-based block diagrams without such structure, RK4 or RKDP54 are more appropriate choices.

References

interpolate(r, dt)[source]

Interpolate solution after successful timestep as a ratio in the interval [t, t+dt].

This is especially relevant for Runge-Kutta solvers that have a higher order interpolant. Otherwise this is just linear interpolation using the buffered state.

Parameters:
  • r (float) – ration for interpolation within timestep

  • dt (float) – integration timestep

Returns:

x – interpolated state

Return type:

numeric, array[numeric]