Shock tube calculator

What happens when the diaphragm goes. The exact solution for any two gases: shock Mach number, the four regions, the reflected shock at the end wall. Then a 1-D run of the closed tube that follows the waves back and forth to your end time. Free, no sign-up, runs in your browser.

The defaults are the "Shock tube simulation project" Skill-Lync's CFD students run in CONVERGE: N₂ at 6 bar driving O₂ at 101,325 Pa in a 0.2 m tube. The last tab checks a report's numbers, after Skill-Lync read 277 of those reports.

Exact Riemann solution (Toro ch. 4), reflected shock (Anderson ch. 7) · checked in Python with different methods · Updated 20 Nov 2026

Driver on the left, diaphragm between. Each gas keeps its own γ and gas constant; perfect gas, inviscid. The exact solution holds until the first wave reaches a wall.

Shock Mach Mₛ1.471W 485.9 m/s
T₂ behind the shock390.2 Kreflected T₅ 490.9 K
T₃ behind the fan230.6 Kp₂ = p₃ = 238.8 kPa
00.050.10.150.2250300350400x along the tube (m), diaphragm dashedTemperature (K) · line exact, dots 1-D solver
  • Incident shock: Mach 1.471, 485.9 m/s into the O2. It takes the O2 from 300 K to 390.2 K and 101.3 to 238.8 kPa, and sets it moving at 217.7 m/s.
  • Expansion fan: the N2 cools as it expands, 300 K → 230.6 K. The fan's head runs back at 353.1 m/s, its tail at -91.83 m/s.
  • Contact surface at 217.7 m/s: pressure and velocity match across it, temperature jumps 230.6 → 390.2 K. The hot gas is the driven O2; the driver N2 is the cold one.
  • Reflected shock at the driven end wall (after 206 µs): 510.2 kPa and 490.9 K with the gas at rest. The exact solution here holds until 206 µs, when the first wave reaches a wall.

What does the shock tube project ask?

Set up a closed tube in CONVERGE, 0.2 m long with a 0.01 × 0.01 m section, split in the middle. The left half holds N₂ at 6 bar, the right half O₂ at 101,325 Pa, both at 300 K. An event keeps the halves apart, then opens the "diaphragm" (in most reports at 0.001 s). The run ends at 0.003 s, with adaptive mesh refinement (AMR) following the gases. The report plots pressure, temperature and cell count against time.

Skill-Lync has 277 public reports on this project in its PG Program in CFD. 150 use the N₂/O₂ pair and 149 the 6 bar driver; 115 open the diaphragm at 0.001 s; 193 use AMR. 96 are mostly screenshots. Only 4 work out an exact solution to compare with, one of them for Sod's problem in OpenFOAM. This page gives that exact solution, and a 1-D run for the part after the waves hit the walls.

The exact solution: four regions and a shock Mach number

When the diaphragm opens, three waves leave it. A shock runs into the low-pressure gas, compressing and heating it and setting it moving. An expansion fan runs back into the driver gas, which cools as it expands. Between them a contact surface, moving with the gas, separates the two gases. Pressure and velocity are equal on both sides of the contact; temperature and density are not.

The shock strength p₂/p₁ follows from the diaphragm pressure ratio p₄/p₁ and the two speeds of sound (the shock tube equation):

The calculator solves the same thing as Toro's exact Riemann solver, with each gas keeping its own γ and gas constant, and checks the result against the equation above. For the CONVERGE case:

RegionGasp (kPa)T (K)u (m/s)ρ (kg/m³)
4: Driver, undisturbedN₂600.0300.00.06.738
3: Driver, behind the fanN₂238.8230.6217.73.490
2: Driven, behind the shockO₂238.8390.2217.72.355
1: Driven, undisturbedO₂101.3300.00.01.300
5: Driven, behind the reflected shockO₂510.2490.90.04.000

The shock moves at 485.9 m/s (Mach 1.471 in O₂), the contact at 217.7 m/s. The fan's head runs back at 353.1 m/s, the speed of sound in the N₂; its tail actually moves backwards too, at 91.8 m/s. With air on both sides (O₂ 0.23 / N₂ 0.77 by mass, as CONVERGE's predefined mixture) the shock is a little faster, 504.9 m/s, and T₂ is 386.3 K.

The hot gas is the O₂. The N₂ that pushes it cools to 230.6 K. Two reports (one copied into the other) say the N₂ heated up to 460 K, and two put the high- and low-pressure labels on the wrong mean-temperature curves.

The reflected shock: why the end wall reaches 491 K

The shock reaches the driven end wall 206 µs after the diaphragm opens. The gas behind it is moving at 217.7 m/s and a wall cannot let it through, so a second shock reflects back and stops it. Its Mach number relative to the gas ahead of it, M_R, follows from Mₛ:

Here M_R = 1.4051, and the gas at the wall goes to 510.2 kPa and 490.9 K, at rest. This hot, still slug of gas is what a shock tube is built for: chemists put a fuel-oxidiser mixture there and time how long it takes to ignite.

8 reports quote a peak temperature between 460 and 500 K, and one times it at 0.0003 s after the opening, which is about 100 µs after the reflection. Those are this reflected-shock state. A peak at the wall lasts microseconds; 3-D output written every 10 µs, or a mean over a region, will show less.

After the first reflections: the closed tube to 3 ms

In a 0.2 m tube the exact solution only lasts 206 µs. After that the reflected shock meets the contact, the fan bounces off the driver end wall, and the waves keep crossing the tube until the end time. There is no closed formula for that, so the second tab runs a 1-D inviscid simulation of the closed tube. With 1,000 cells over the CONVERGE case's 2 ms of flow:

Quantity1-D runWhat it is
Hottest point521.7 KDriven end wall, 2.67 ms simulation time: later waves re-shock the gas above the first reflection's 490.9 K
Coldest point170.2 KDriver end wall, 1.76 ms: the fan reflects and expands the N₂ a second time
Driver half, mass-averaged Tmin 199.2 KThe curve a region-mean plot of the high-pressure region shows
Driven half, mass-averaged Tmax 346.1 KThe same for the low-pressure region
Mean pressure at 3 ms346.8 kPa1.1% of the energy is still in motion

The reports' own plots agree with this. 9 reports quote region-mean temperatures: the high-pressure region falling to 200-215 K and the low-pressure region rising to 340-345 K, against 199 K and 346 K here. An inviscid 1-D model captures the bulk of what the 3-D CONVERGE run does in this tube.

Where does the pressure end up? The walls are adiabatic and nothing leaves, so the total energy is fixed. With the same γ on both sides, once the gas stops moving:

That is the level the pressure settles at as viscosity damps the waves: not 6 bar, not 1 bar, and not the 238.8 kPa between the first waves. Heat lost to walls at 300 K does not change it either: once all the gas is back at its starting 300 K, pV = mRT gives the same 350.7 kPa.

AMR on species refines the contact, not the shock

Most reports refine on species: the sub-grid criterion is set on N₂ or O₂ mass fraction (at least 18 say so in the text; more show it in screenshots). That refines where the composition changes, which is only at the contact surface. The shock runs through pure O₂ and the fan through pure N₂: no species gradient, so no refinement. With a species criterion the cell count follows the mixing at the contact, not the shock.

To capture the shock add temperature or velocity as a criterion. The 1-D run shows how little the grid matters for the peaks in this case: the hottest point is 514.1 K with 100 cells (the 2 mm base grid) and 521.2 K with 2,000. What a coarse grid loses is the sharpness of the fronts.

Time step and CFL number

An explicit compressible solver is stable only if no signal crosses more than a cell per step:

In this case the fastest signal is the sound wave riding on the gas behind the shock, u₂ + a₂ = 594.5 m/s. The shock itself runs at 485.9 m/s and the gas at 217.7 m/s. A report that sizes the step with the shock speed gets one 22% too long for an acoustic CFL limit, though a small CFL number such as 0.2 covers that. Solvers differ in which speed their CFL number uses, so read your solver's definition before comparing.

Which slips does the check tab catch?

  • The wrong gas heating up: the driver gas cools; the driven gas is the hot one.
  • A peak temperature compared with T₂, the reflected-shock T₅ and the 1-D run's hottest point, and whether it looks like a region mean.
  • A minimum temperature against T₃ behind the fan and the coldest point after the fan reflects.
  • Region-mean extremes against the 1-D run's mass-averaged halves.
  • The end pressure against the energy-conserving rest pressure.
  • A shock speed that is the speed of sound or the gas velocity, and a CFL time step sized on the shock speed.

What this calculator does not cover

  • Viscosity and heat transfer. Real shock tubes grow a boundary layer behind the shock that slows it and shortens the test time; the reflected shock can bifurcate where it meets that layer.
  • A real diaphragm. It opens instantly here. A real one takes tens to hundreds of microseconds to open, and the shock forms some distance downstream.
  • Real-gas and chemistry effects. γ is constant for each gas. Here the temperatures stay below 550 K, where that is a fair assumption for N₂ and O₂; strong shocks dissociate gases and need variable properties.
  • 3-D effects. The run is 1-D. The CONVERGE case with slip walls is essentially 1-D too, which is why the numbers agree.
Learn CFD

Setting up a compressible transient case, choosing what the mesh should refine on and checking the result against an exact solution is daily work for a CFD engineer. The shock tube and the Prandtl-Meyer problem are both cases in the CONVERGE module of Skill-Lync's CFD program.

Frequently asked questions

How do you calculate the shock Mach number in a shock tube?

Solve the shock tube equation for p₂/p₁ given the diaphragm pressure ratio p₄/p₁ and the two speeds of sound, then W = a₁ √((γ₁+1)/(2γ₁)(p₂/p₁ − 1) + 1). For N₂ at 6 bar driving O₂ at 101,325 Pa, both at 300 K: p₂ = 238.8 kPa, W = 485.9 m/s, Mach 1.471.

What temperature does the gas reach behind the reflected shock?

When the incident shock hits the closed end it reflects and brings the gas to rest a second time. In Skill-Lync's CONVERGE case the O₂ goes from 300 K to 390.2 K behind the incident shock and to 490.9 K (510.2 kPa) behind the reflected one. That is the test condition chemists use for ignition-delay measurements.

Why does the high-pressure gas get colder in a shock tube?

The driver gas expands through a rarefaction fan, and an expansion cools a gas. The N₂ falls from 300 K to 230.6 K behind the fan, and to about 170 K at the driver end wall when the fan reflects. The hot gas is the driven O₂ on the other side of the contact surface.

What pressure does a closed shock tube settle at?

With the same γ on both sides and adiabatic walls, energy conservation fixes it: (p₄L₄ + p₁L₁)/L once the gas stops moving. For the 0.2 m tube with the diaphragm in the middle that is 350.7 kPa, not 6 bar and not 1 bar. 2 ms after opening, an inviscid run still has 1.1% of the energy as motion and a mean of 346.8 kPa.

Does adaptive mesh refinement on species capture the shock?

No. A sub-grid criterion on N₂ or O₂ mass fraction refines where the composition changes, which is only at the contact surface. Across the shock and the expansion fan the gas is all O₂ or all N₂, so a species criterion never sees them. Add temperature or velocity as a criterion to refine at the shock.

What time step does a shock tube simulation need?

For an explicit solver, Δt ≤ CFL·Δx / max(|u| + a). In the CONVERGE case the fastest signal is u + a = 594.5 m/s behind the incident shock, faster than the shock itself (485.9 m/s). With 2 mm cells and CFL 0.5 that is Δt ≈ 1.68 µs.

Related on Skill-Lync

Sources

  • E. F. Toro, Riemann Solvers and Numerical Methods for Fluid Dynamics (Springer, 3rd ed. 2009): ch. 4, the exact Riemann solver and its test 1 (Sod), p* = 0.30313, u* = 0.92745, which the checking script reproduces; ch. 10 (HLLC) and ch. 14 (MUSCL-Hancock), the schemes in the closed-tube run.
  • J. D. Anderson, Modern Compressible Flow, ch. 7 (unsteady wave motion): moving and reflected normal shocks, the shock tube relations and the shock tube equation.
  • G. A. Sod, "A survey of several finite difference methods for systems of nonlinear hyperbolic conservation laws", Journal of Computational Physics 27 (1978) 1-31: the shock tube as a test problem.
  • IUPAC standard atomic weights: molar masses of N₂ (28.0134), O₂ (31.9988), He, Ar, H₂ and CO₂; CONVERGE's air as O₂ 0.23 / N₂ 0.77 by mass.
  • Skill-Lync, 277 public Shock tube simulation project reports, read 20 Nov 2026: geometry, gases, initial conditions, events, AMR settings and the temperatures and pressures they quote.
  • Skill-Lync, scripts/verify/shock_tube.py: p* by Brent's method, the reflected shock by root-finding on the wall condition and a separate closed-tube solver (Rusanov flux, SSP Runge-Kutta). The page will not build if its numbers drift from the script's.
Free counselling

From a shock tube run to a CFD career.

Setting up transient compressible cases, choosing refinement that follows the physics and explaining a gap to the exact answer honestly is what CFD roles ask for. A Skill-Lync counsellor can tell you which CFD course fits where you are now.

Talk to a CFD course counsellor

Free. We call you back, usually the same day.

By submitting you agree to our Terms and Privacy Policy.

Talk to a career counsellor

Talk to a career counsellor

Free 20-minute call. We'll map the right course to where you want to work.

By submitting you agree to our Terms and Privacy Policy.