Validation 2 — A nozzle with a standing normal shock¶
Time: ~10 minutes. Case: examples/benchmarks/cdv_nozzle_shock.toml.
Gated by: tests/validation/test_cdv_nozzle_shock.py, which also runs
this case file.
A converging-diverging nozzle fed from a reservoir chokes at its throat and accelerates the gas past Mach 1 beyond it. If the back pressure is too high for a supersonic exit but too low for a fully subsonic one, a normal shock stands in the diverging section, where the total pressure it costs lets the flow behind it reach the back pressure exactly. This page checks that aeolus1d puts the shock where the back pressure puts it, and gets the flow either side of it right.
Where the case is
examples/benchmarks/ is in a clone, in the GUI installers and, from the
release after 0.5.2, in the pip install aeolus1d wheel, where
aeolus1d examples prints its directory on line 1. The commands below run
from a clone. The comparison snippet imports the exact solution from
tests/, which only a clone has.
The problem¶
NASA's NPARC Alliance publishes a "Converging-Diverging Verification (CDV) Nozzle", https://www.grc.nasa.gov/WWW/wind/valid/cdv/cdv.html, on Liou's geometry (AIAA 87-0355). The area follows a cosine law along the 10 in nozzle:
- 2.5 in² at the inflow, x = 0;
- 1.0 in² at the throat, x = 5 in;
- 1.5 in² at the exit, x = 10 in.
The reservoir holds 1 psi and 100 R. NPARC tabulates the inviscid quasi-one-dimensional solution at three exit pressures:
| p_exit / p_t | Flow | Exact exit Mach |
|---|---|---|
| 0.89 | subsonic throughout | 0.4114360 |
| 0.75 | a normal shock at x = 7.5623 in | 0.5019145 |
| 0.16 | supersonic at the exit | 1.854124 |
The exact solution used here, the isentropic area-Mach relation with a normal shock where one stands, is checked first: it reproduces NPARC's tables to the seven figures they print, within 2e-6. That includes the shock between NPARC's two bracketing rows at 7.562273 and 7.562293 in, and M = 1.6117 to 0.6649 across it.
The bundled case is the 0.75 one: 100 cells with each cell's area the
cosine law at its centre (a tabulated area_profile), the gas at rest at the
exit pressure to start, a stagnation_inlet at 1 psi and 100 R, a
pressure_outlet at 0.75 psi, MUSCL with minmod at CFL 0.5, run to 40 transit
times (L / a₀ with a₀ the reservoir sound speed; 68 ms).
Run it¶
Terminal¶
aeolus1d run examples/benchmarks/cdv_nozzle_shock.toml --out /tmp/nozzle.h5
About 10 s; the summary line reads
pipe 'nozzle' : rho=[0.1555, 0.4202] u=[35.6, 193.6] p=[1648, 6625].
GUI¶
- File → Open Example → Benchmarks → cdv_nozzle_shock.
- Click Run in the Runner dock (or press F5).
- In the post-processing tab pick p. The pressure falls through the throat at x = 0.127 m, keeps falling in the supersonic part, then jumps at the shock near x = 0.192 m and recovers toward the exit pressure.
Compare with the exact solution¶
From the repository root:
import h5py
import numpy as np
from tests.validation.test_cdv_nozzle_shock import Exact
with h5py.File("/tmp/nozzle.h5") as f:
rho, u, p = (f[f"pipes/nozzle/{k}"][:] for k in ("rho", "u", "p"))
M = u / np.sqrt(1.4 * p / rho)
x_in = (np.arange(100) + 0.5) * 0.1 # cell centres, in inches
ex = Exact(0.75)
M_x = np.array([ex.mach(x) for x in x_in])
away = np.abs(x_in - ex.x_shock) > 0.2 # more than 2 cells from the shock
print(np.mean(np.abs(M - M_x)[away])) # 9.17e-4
Results¶

Left and middle: Mach number and p/p_t along the nozzle, MUSCL on 100 cells against the exact solution in black, at the three exit pressures. Every 4th cell is drawn, each case from a different cell: upstream of its shock the 0.75 flow is the supersonic one, and the markers would otherwise hide each other. Right: p/p_t across the shock of the 0.75 case, every cell on 100 cells, and 400 cells as a line. The grey vertical line is the throat.
On 100 cells (measured 2026-11-10; errors are means over the cells more than 2 cells from the shock, absolute, in M and p/p_t):
| p_exit / p_t | Scheme | L1 M | L1 p/p_t | Exit M error | Shock [cells] |
|---|---|---|---|---|---|
| 0.89 | first order | 2.14e-4 | 1.27e-4 | 8.2e-5 | |
| 0.89 | MUSCL | 2.89e-4 | 1.59e-4 | 1.38e-4 | |
| 0.75 | first order | 9.14e-4 | 5.21e-4 | 1.83e-4 | −0.09 |
| 0.75 | MUSCL | 9.17e-4 | 5.18e-4 | 2.07e-4 | +0.18 |
| 0.16 | first order | 9.42e-4 | 5.11e-4 | 3.8e-5 | |
| 0.16 | MUSCL | 9.41e-4 | 5.06e-4 | 3.8e-5 |
The bundled case reads the 0.75 MUSCL row: L1 M 9.17e-4, L1 p 5.17e-4, the shock 0.18 of a cell downstream of its exact position.
- Away from the shock the error converges at second order in both schemes, for example L1 M 2.1e-4, 5.4e-5 and 1.3e-5 at 100, 200 and 400 cells (subsonic, first order).
- The shock's total-pressure loss is right to 4e-5 at 100 cells: 0.89083 against the exact 0.890798.
- The shock settles on the cell face nearest its exact position, so its error is at most half a cell. That is a property of a captured steady shock, not of the scheme's order.
- The subsonic case is the slow one to settle: acoustic waves cross the nozzle for about 70 transit times before the state stops moving to 1e-6.
The test gates each error at 1.5 times the table, the shock within half a cell, and the loss to 1e-4. It found nothing to fix.
Reproduce the figure¶
python scripts/validation_figures.py cdv_nozzle
It runs the test's own harness at the three exit pressures (and the shock case
again on 400 cells), prints the errors, and writes
docs/img/validation/cdv_nozzle.png.