One-dimensional Euler conservation law
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.
Compressible flow · hyperbolic conservation laws
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.
Physics tutorial
BackgroundA 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 mattersIn 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
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.
The heat-capacity ratio links energy, pressure and sound speed. Changing it shifts the speeds of all three wave families.
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.
In one step the fastest wave must not cross a whole cell, so a finer grid automatically gets a shorter time step.
Typical misconceptionDensity still jumps, so the middle line must be another small shock.
Better mental modelPressure 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.
Typical misconceptionThe plotted front spans several cells, so a real inviscid shock must be that thick too.
Better mental modelIn 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.
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.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.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.Conceptual inspiration: FluidMotion. Original simulations and graphics; the model limits are described above.