---
title: "How One Diaphragm Creates Three Compressible Waves Interactive Lab | Sandbox Physics"
description: "Why does bursting the diaphragm in a shock tube send out a shock, a contact surface and a rarefaction fan?"
canonical_url: "https://sandboxphysics.com/labs/shock-tube/"
language: "en"
page_type: "lab"
alternate_languages:
  zh-CN: "https://sandboxphysics.com/zh/labs/shock-tube/"
last_modified: "2026-10-27"
---

Compressible flow · hyperbolic conservation laws

# Shock Tube & Riemann Problem

**Why does bursting the diaphragm in a shock tube send out a shock, a contact surface and a rarefaction fan?** The one-dimensional Euler equations carry signals at three speeds: the flow speed minus the sound speed, the flow speed itself, and the flow speed plus the sound speed. The initial jump splits into one wave for each: a shock, a contact surface where density jumps but pressure and velocity match, and a rarefaction fan.

Set the left and right gas states separately, solve the one-dimensional Euler equations with HLL, Rusanov or HLLC finite-volume fluxes, and lay the exact Riemann solution over the result. The tube density, the x–t wave diagram, four profiles and the drift in conserved quantities update together.

> Interactive simulation: open this page in a web browser to change the parameters and run the model.

This one-dimensional inviscid ideal-gas model is made dimensionless with $L,\rho_0,p_0,\quad a_0=\sqrt{p_0/\rho_0}$; this velocity unit is not the reference sound speed. You can compare HLL, Rusanov and HLLC. Initial states that would produce a vacuum are outside what the exact solver can handle, so the run pauses and explains why. Safety floors on density and pressure can break conservation, and this implementation does not prove that density and pressure stay positive everywhere.

Physics tutorial

## Shock tubes: how one initial jump becomes three wave families

**Background** A shock tube starts with two uniform gases separated by a diaphragm. When the diaphragm is removed, the single jump between them splits on its own into a shock, a contact discontinuity and a rarefaction fan. The shock compresses the gas, the contact separates the two gases, and the fan expands the gas smoothly.

**Why it matters** In 1978 Gary Sod made these initial states a standard test for compressible-flow codes. This Lab also uses the two-wave flux introduced by Harten, Lax and van Leer in 1983, and every numerical cell can be compared with the exact self-similar Riemann solution.

Start with the essentials

- **Focus question**: Why does a single jump at the diaphragm produce a shock, a contact discontinuity and a rarefaction fan all at once?
- **One-sentence intuition**: The one-dimensional Euler system has three characteristic speeds: $u-a$, $u$, and $u+a$. The initial jump is shared out among these three families, which travel at different speeds, so one jump cannot stay a single wave.

### Core mathematical model

#### One-dimensional Euler conservation law

$$
\frac{\partial}{\partial t}\begin{bmatrix}\rho\\ \rho u\\ E\end{bmatrix}+\frac{\partial}{\partial x}\begin{bmatrix}\rho u\\ \rho u^2+p\\ u(E+p)\end{bmatrix}=0
$$

The three rows express conservation of mass, momentum and total energy. The finite-volume method moves these quantities between neighboring cells only through fluxes at the cell faces.

#### Ideal-gas equation of state and sound speed

$$
p=(\gamma-1)\!\left(E-\frac12\rho u^2\right),\qquad a=\sqrt{\frac{\gamma p}{\rho}}
$$

The heat-capacity ratio links energy, pressure and sound speed. Changing it shifts the speeds of all three wave families.

#### HLL two-wave numerical flux

$$
F_{\mathrm{HLL}}=\frac{S_R F_L-S_L F_R+S_LS_R(U_R-U_L)}{S_R-S_L}
$$

When the left signal speed is negative and the right one positive, HLL uses a single averaged state between them. The flux stays conservative, but it smears contacts more than the exact solution does.

#### Stable time step (CFL condition)

$$
\Delta t\le C_{\mathrm{CFL}}\frac{\Delta x}{\max_i\left(|u_i|+a_i\right)}
$$

In one step the fastest wave must not cross a whole cell, so a finer grid automatically gets a shorter time step.

### Common difficulties

#### A contact is not a weaker shock

**Typical misconception** Density still jumps, so the middle line must be another small shock.

**Better mental model** Pressure and velocity are the same on both sides of a contact. Only the density and the kind of gas change, and the contact moves along with the gas in the star region.

#### A smeared shock does not mean a thick real shock

**Typical misconception** The plotted front spans several cells, so a real inviscid shock must be that thick too.

**Better mental model** In the Euler equations a shock is a discontinuity. The width you see comes mainly from the numerical diffusion of the first-order HLL scheme and from the finite grid resolution.

### Run the experiment

1. 01

   #### Reproduce the Sod benchmark

   Choose Sod benchmark, keep the exact overlay visible, and run until the solver pauses automatically.

   **What to observe:** A smooth rarefaction spreads to the left, the contact drifts with the flow in the middle, and the shock on the right runs ahead. The numerical curves follow the dashed exact solution closely.

2. 02

   #### Increase the pressure ratio

   Switch to Strong shock, then raise the cell count and watch the density error.

   **What to observe:** The shock speed and the star pressure rise sharply. More cells make the front narrower and the overall error smaller, but they also force smaller time steps.

3. 03

   #### Change which waves form

   Compare Colliding flows with Symmetric expansion while the x–t diagram is visible.

   **What to observe:** When the flows collide, both outer waves become shocks; when they move apart, both become rarefaction fans. The type of each wave depends on whether the star pressure is higher or lower than the initial pressure on that side.

Physical conclusion

A Riemann problem breaks compressible flow into local wave families. The exact solution gives their structure and speeds, and a finite-volume flux rebuilds them on a grid without losing any of the conserved quantities.

Conceptual inspiration: [FluidMotion](http://www.bugman123.com/FluidMotion/index.html). Original simulations and graphics; the model limits are described above.

Fields & matter · Starter path

## From a field to an electron microscope

Map an electric field and steer a charged particle. Then find the electron's wavelength and use electron beams to see a crystal and a surface.

[Start here → **Make an Electric Field Visible** Move the probe around a dipole and check that the field always points downhill on the potential landscape. Observe · 8 min](https://sandboxphysics.com/labs/electric-field/)

1. [1 Make an Electric Field Visible](https://sandboxphysics.com/labs/electric-field/)
2. [2 A Charge Bending through Fields](https://sandboxphysics.com/labs/charged-particle/)
3. [3 Electron Wavelength & Voltage](https://sandboxphysics.com/labs/electron-wavelength/)
4. [4 Electron Diffraction & Reciprocal Space](https://sandboxphysics.com/labs/electron-diffraction/)
5. [5 TEM Bright Field, Dark Field & SAED](https://sandboxphysics.com/labs/tem-mode-selector/)
6. [6 SEM Secondary-Electron Topography](https://sandboxphysics.com/labs/sem-topography/)

[View the full path →](https://sandboxphysics.com/topics/fields-and-matter/#starter-path)
