1D Shock Tube Calculator

This web app is meant to serve as simple visual calculator for shock tube setups. The default conditions are set up to match the Sod shock tube verification case. You can build custom gases, add multiple material sections, and scrub through the x-t diagram to view state traces. The model assumes inviscid, nonreacting gases with constant specific heats. Compare grid resolutions before interpreting fine features.

Material Sections

Estimated RAM: —
Estimated CSV: —
Line Color:

x-t Diagram

Preparing the default run…

Density

Pressure

Velocity

How to Use

Enter a positive length, density, and pressure for each section, with gamma greater than 1 and positive molecular weight. Choose which thermodynamic variable to calculate from the other two. Preset gas properties are constant approximations; they do not model temperature-dependent heat capacities, real-gas effects, or chemical reactions.

Select "Run Simulation" to generate the results. Click or tap a time on the x-t diagram, or use the time slider and arrow keys, to select a stored snapshot. The line graphs show density, pressure, and velocity versus position at that time. Hovering reports the nearest snapshot and cell center.

For the default Sod setup, dotted curves show the exact solution until the first wave reaches a boundary. This checks the numerical solution against an idealized reference; it does not validate a laboratory shock tube. CSV files include full-precision values, explicit units, and the completed run settings in their first comment line.

What is this?

The FMECL shock tube at Texas A&M.

The FMECL shock tube at Texas A&M at my graduate school lab. [Source]

The Riemann problem is a specific type of partial differential equation initial value problem, which normally includes a conservation law with piecewise constant initial data and a single jump discontinuity. This nicely manifests physically as a "shock tube" problem, where a shock wave is driven through a tube filled with gas in two different states. These two states are the high pressure "driver" section and the ambient or low pressure "driven" section. They are named as such because the conditions of the driver section drive the shock through the tube. In a physical lab, you would have a long tube with a diaphragm in the middle separating a high-pressure gas from a low-pressure gas. When that diaphragm bursts, you get the resulting shock wave problem. This problem, in its simplest form, is a very common test case for codes to validate their methods and how they handle discontinuities.

Shock tube before and after diaphragm rupture: a left-moving expansion wave, right-moving contact surface, and right-moving shock.

A diagram of the shock tube/Riemann problem, the left side would be the driver and right would be the driven. [Source]

This setup creates three main features that you can see moving across the x-t diagram:

  • The Expansion Fan (Rarefaction): A series of waves moving back into the high-pressure side that smoothly lower the pressure.
  • The Contact Discontinuity: The boundary between the original "left" and "right" gases. Pressure and velocity are continuous across it; density, temperature, and composition may jump.
  • The Shock Wave: A sharp, thin front moving into the low-pressure side that causes a sudden spike in density and pressure.

In 1978, Gary Sod published a specific set of initial conditions, the same ones this site initializes to, that became the gold standard for testing numerical methods. Because an exact mathematical answer exists for this problem, it is often used as a showcase, and those who are familiar with the problem enjoy pointing out the intricacies in it.

Methods

Summary

This simulation uses first-order finite volumes and an HLLC approximate Riemann solver, with a more diffusive Rusanov fallback for invalid intermediate states. Four-stage, third-order SSP Runge-Kutta integration advances the fluid state, material mass, and volume fractions together. The spatial scheme remains first order; shocks and interfaces broaden across several cells.

The Riemann Problem

At every boundary between two cells, we have what is called a Riemann problem. The solver's job is to calculate the net flux (the flow of mass, momentum, and energy) across the boundary of two cells by assuming a specific wave pattern forms when the cells are at different states.

The HLLC Wave Structure

This app incorporates the HLLC (Harten-Lax-van Leer-Contact) method. While older solvers only assumed two waves moving outward, they often "smeared" the results because they ignored the physics happening in the center. HLLC fixes this by tracking three specific waves. Assuming the setup is similar to the Sod shock tube, the three waves are:

  • SL: The estimated leftmost signal speed.
  • SR: The estimated rightmost signal speed.
  • SM: The estimated contact speed between them.

This creates four distinct regions in the flow. The "C" in HLLC is the novel contribution of the developed method. By explicitly accounting for the middle contact wave, the solver can keep the density jump sharper instead of letting the "left" and "right" gases blur together over time.

Stability and Visualization

The CFL number limits each time step using the local wave speeds. Every stage is checked for finite, positive density and pressure, and failed steps are retried with a smaller step. CFL control alone does not guarantee accuracy or physical validity. Runs stop with an error if the state cannot be resolved, or if the time, step, or storage limits are exceeded.

The x-t diagram shows position horizontally and time vertically. Colors use the nearest stored snapshot; profiles use the actual cell centers. Interface markers follow the interpolated velocity and stop when they leave the tube. In physical units, temperature is a cell number-weighted value; a cell crossing a material interface can contain gases at different temperatures. Open boundaries copy the adjacent state and can reflect some waves; they are not exact nonreflecting boundaries.

Material volume fractions set the pressure closure, while conservative partial densities set molecular weight and temperature. No physical mixing or diffusion is modeled. Thin sections retain their initial mass through cell-overlap averaging, but need several cells to resolve their waves. Use shorter runs and finer grids to check whether the result has converged.

Resources