---
name: ssprk33
description: "Advance a spatially discretized conservation law at third order while retaining a stability property already held by forward Euler. Shu–Osher SSPRK(3,3) uses three slope evaluations and the same forward Euler step bound for properties such as TVD or positivity."
---

# Shu–Osher SSPRK(3,3)

## 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+h f(t,v)$, a forward Euler update at time $t$. For $h\ge0$, compute

$$
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 $h$ in each Euler update. There are exactly three RHS calls, with time offsets $0,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\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, $h\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)$ and CFL 1, the supplied verification shows SSPRK(3,3) remains within $[0,1]$. A non-SSP third-order Runge–Kutta method yields a new minimum of $-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 $t$, $t+h$, $t+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)](https://doi.org/10.1016/0021-9991%2888%2990177-5)
