fhat. Workspace

Shu–Osher SSPRK(3,3)

Keep forward Euler stability properties with third-order time steps.

errorO(h3)cost3 f / stepexplicit

Shu & Osher 1988Also known as Shu–Osher RK3, SSPRK3

Full skillv0.1.0

Use with your agent

Use the fhat method "ssprk33" (https://fhat.dev/methods/ssprk33/SKILL.md) for this problem. Check first whether it applies.

1. What this solves

A spatial discretization can keep the solution in its global value range under a forward Euler step. The three-stage third-order Shu–Osher update retains that property at the same forward Euler step bound. Its convex combinations can also retain a positivity or total-variation bound, when forward Euler has the corresponding property. A global range bound and a TVD bound are different properties, and neither is a count of local peaks.

2. When to use

Use an explicit method of lines with a known forward Euler bound from the spatial operator, boundary treatment and limiter. Identify which convex constraint or functional matters. For example, use the step for a finite-volume flux with a proven total-variation-diminishing (TVD) bound or for a positivity-preserving update with a verified CFL limit. Third-order time convergence applies in smooth regimes.

3. When not to use (and what to use instead)

Situation Use instead
The spatial operator fails the target property even with forward Euler Fix the spatial or boundary update, or establish another property before choosing the time integrator.
The forward Euler bound makes fast decay prohibitively expensive bdf2 or radau-iia-5 for stiffness, with a separate check if positivity or monotonicity remains mandatory.
Smooth nonstiff ODE with no such property required rk4 on a fixed grid or dormand-prince-rk45 under tolerance control.
Long-time symplectic dynamics stormer-verlet for separable systems or gauss-legendre-4 for canonical nonseparable systems.

4. Algorithm

Let E(t,v)=v+hf(t,v)E(t,v)=v+h f(t,v), a forward Euler update at time tt. For h≥0h\ge0, compute

U1=E(t,y),U2=34y+14E(t+h,U1),Y=13y+23E(t+h/2,U2).U_1=E(t,y),\qquad U_2=\tfrac34 y+\tfrac14 E(t+h,U_1),\qquad Y=\tfrac13 y+\tfrac23 E(t+h/2,U_2).

Use the full hh in each Euler update. There are exactly three RHS calls, with time offsets 0,h,h/20,h,h/2 in that order. Every stage combines states with nonnegative weights summing to one. If Euler preserves the convex set, or does not increase the convex functional, at each relevant stage under h≤hFEh\le h_{\mathrm{FE}}, the same bound holds for this integrator. The SSP coefficient is one.

5. Parameters

Choose a nonnegative step using the actual forward Euler bound. A CFL bound depends on the flux, wave speeds, grid and boundary update. Ensure it holds at the stages. For the periodic nonnegative Burgers test with Godunov flux, hmax⁡iui/Δx≤1h\max_i u_i/\Delta x\le1 suffices. Staying within the bound is a stability requirement. Check temporal accuracy independently.

6. Applying it to your code

Keep the starting state until the last convex combination and apply identical spatial and boundary logic at each RHS call. The reference takes step(fun, t, y, h) for an already defined RHS. It returns a state without carrying out a CFL calculation. A zero step returns the input without evaluating the RHS. Add the code comment ssprk33 v0.1.0, Shu & Osher (1988).

7. Verification

Create port_adapter.py exporting step(fun, t, y, h) -> y_next. The RHS returns a vector of the same size. From the adapter directory run python <skill>/checks/check_port.py and show its output. Languages other than Python can use the inputs and flux formulas in checks/cases.json. The port checker covers fixed cases, smooth third order, nonautonomous stage times, TVD, conservation and the global range bound.

Check a problem with a front at the intended CFL, and measure the quantity required by the application at successive times. For periodic Burgers with initial cells (0,0,1)(0,0,1) and CFL 1, the supplied verification shows SSPRK(3,3) remains within [0,1][0,1]. A non-SSP third-order Runge–Kutta method yields a new minimum of −1/48-1/48 with the same operator and step, even though forward Euler preserves the initial bounds.

8. Failure signatures

Symptom Likely cause
Values outside the allowed range Check the Euler property and the true CFL bound at all stages, including the boundaries. Check the convex weights.
Autonomous tests pass while forcing tests fail The RHS times should be tt, t+ht+h, t+h/2t+h/2 in that order.
Convergence is reduced near a discontinuity Inspect the space and time errors separately. The smooth third-order claim requires regularity.

9. Files and commands

reference/ssprk33.py contains the three-stage update. uv run examples/burgers.py measures variation and bounds. uv run verify/check_cases.py verifies order, CFL cases, the non-SSP counterexample and broken ports. uv run checks/make_cases.py prints the fixture JSON.

10. Sources

  • Shu and Osher give the three-stage time discretization (eq. 2.18, CFL coefficient one), with its total-variation-diminishing property under the forward Euler step bound and its extension to convex functionals (Remark 2.1), in their journal paper on efficient essentially non-oscillatory (ENO) shock-capturing schemes. Shu and Osher (1988)

Evidence

Output of the verification scripts, run on the reference implementation of version 0.1.0 when this page was built.

Passed verify/check_cases.py: Confirms third order and the forward Euler TVD and range guarantees on periodic Burgers, then rejects three broken ports and verifies a third-order counterexample.
PASS forced: endpoint gap 0.00e+00
PASS manufactured: endpoint gap 0.00e+00
PASS burgers: endpoint gap 0.00e+00
PASS burgers: endpoint gap 0.00e+00
PASS smooth endpoint orders 3.029, 3.014, 3.007
PASS CFL 0.8 and 1.0: max TV increase 0.00e+00, new-extremum overshoot 0.00e+00, mass error 2.66e-15
PASS three callback times [2, 2.5, 2.25]
PASS CFL 1: initial/SSP TV 2.000000/1.266276; min Euler/SSP/non-SSP 0.000000/0.025716/-0.020833
PASS non_ssp_rk3: rejected by 4 fixture(s)
PASS autonomous_times: rejected by 2 fixture(s)
PASS wrong_final_weight: rejected by 4 fixture(s)

More methods are coming.