Shock Tube Simulator Back
Compressible Flow · CFD

Shock Tube Simulator — Riemann Problem Solver

Compute the exact 1D Riemann solution. Visualize pressure, density, and velocity profiles across the shock wave, contact discontinuity, and rarefaction fan in real time.

Left State (High Pressure)

Right State (Low Pressure)

Presets

Shock Parameters

Results
Shock Mach Ms
Post-shock P*
Shock Speed
Contact Speed
Shock Wave x-t Diagram
Density
Pressure Waveform
Theory & Key Formulas

$$\frac{p_4}{p_1} = \frac{p_2}{p_1}\left[1 - \frac{(\gamma_4-1)(a_1/a_4)(p_2/p_1-1)}{\sqrt{2\gamma_1[2\gamma_1+(\gamma_1+1)(p_2/p_1-1)]}}\right]^{-2\gamma_4/(\gamma_4-1)}$$

膜圧力比(Riemann不変量):/p_1$ 初期圧力比、$ 音速 [m/s]

$$M_s = \frac{V_s}{a_1}, \quad \frac{p_2}{p_1} = \frac{2\gamma_1 M_s^2 - (\gamma_1-1)}{\gamma_1+1}$$

衝撃波マッハ数と圧力比:\(V_s\) 衝撃波速度、\(\gamma\) 比熱比

What is a Shock Tube?

🙋
What exactly is a shock tube? It sounds like a pipe that makes a loud bang.
🎓
Basically, it's a simple but brilliant device for studying supersonic flow. Imagine a tube with a high-pressure gas on the left and a low-pressure gas on the right, separated by a thin diaphragm. When you burst the diaphragm, a complex wave pattern instantly forms. This simulator lets you recreate that exact physics.
🙋
Wait, really? So what are the different waves I see in the simulator plot after I hit "Solve"?
🎓
Great observation! Three key features always appear. From left to right: a rarefaction fan (a smooth expansion wave), a contact discontinuity (where density jumps but pressure is equal), and a shock wave (a sharp, discontinuous jump in all properties). Try moving the "Left Pressure" slider way up to make the shock much stronger.
🙋
So the "Riemann Problem" is just figuring out where these waves are and how strong they are? How do we solve it?
🎓
Exactly! It's a classic initial-value problem in gas dynamics. The solution isn't guessed; it's calculated by enforcing physical laws across each wave. The core is finding the unique "middle" pressure and velocity that connect the left and right states. Change the gas type (like to Helium) and see how the wave speeds and profiles shift dramatically—the solver recalculates everything in real-time based on these fundamental equations.

Physical Model & Key Equations

The flow is modeled by the one-dimensional Euler equations for an inviscid, compressible, ideal gas. The system is governed by conservation of mass, momentum, and energy.

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

Here, $\rho$ is density, $u$ is velocity, $p$ is pressure, and $E = \rho e + \frac{1}{2}\rho u^2$ is the total energy per unit volume, with $e$ as internal energy. For an ideal gas, $p = (\gamma - 1) \rho e$, where $\gamma$ is the specific heat ratio (the "Gamma" parameter in the simulator).

The exact solution to the Riemann problem uses the Rankine-Hugoniot jump conditions across shocks and the isentropic relations through rarefactions. The critical step is solving for the intermediate pressure $p_*$ and velocity $u_*$ using a pressure function $f(p)$ that depends on whether the wave is a shock or rarefaction.

$$ f_L(p_*) + f_R(p_*) + u_R - u_L = 0 $$

For a left shock: $f_L(p_*) = (p_* - p_L) \sqrt{\frac{A_L}{p_* + B_L}}$. For a left rarefaction: $f_L(p_*) = \frac{2a_L}{\gamma-1}\left[\left(\frac{p_*}{p_L}\right)^{(\gamma-1)/(2\gamma)} - 1\right]$. Here, $a$ is the speed of sound, and $A_L, B_L$ are functions of $\gamma$ and density. The simulator's solver iterates on this equation to find $p_*$.

Real-World Applications

CFD Code Verification: The shock tube is the most fundamental test case for any compressible flow solver (like those in ANSYS Fluent or OpenFOAM). Engineers compare their numerical results against the exact solution from this simulator to validate that their code correctly captures shocks, contacts, and rarefactions.

Supersonic Wind Tunnel Design: Shock tubes can generate short-duration, high-speed flows for testing. The principles modeled here are used to design the driver and driven sections of the tube to achieve a desired test condition for a scaled aircraft or missile model.

Explosion & Blast Wave Studies: The sudden release of high-pressure gas models the initial phases of an explosion. Analyzing the resulting shock wave's pressure profile helps in assessing structural damage and designing protective barriers.

Astrophysical Phenomena: The same Riemann problem physics scales to interstellar scales. It is used to model supernova remnants, where a massive star's ejecta (high-pressure region) expands into the interstellar medium (low-pressure region), creating colossal shock fronts.

Common Misconceptions and Points to Note

First, you might think "shock waves always propagate at supersonic speeds", but this refers to the speed relative to the shock wave itself. The propagation speed of the wave observed in the simulator is determined by the Mach number relative to the initial state's speed of sound. For example, a "weak shock wave" created by only slightly increasing the pressure difference between left and right can have a Mach number close to 1, such as 1.05, propagating at nearly the speed of sound. Conversely, in the "strong shock wave" preset, the Mach number can exceed 3, which is a phenomenon closer to an explosion.

Next, the importance of the contact discontinuity is often overlooked. Since pressure and velocity are continuous across this surface, you can easily miss it at a glance on the graph. However, this is the surface where density, temperature, and even entropy become discontinuous—a surface imprinted with the fluid's "history." For instance, if you change the gases on the left and right in the initial state (e.g., left: helium, right: air), the density differs significantly across this surface, profoundly impacting subsequent flow and mixing phenomena. In practical CFD, suppressing the numerical diffusion of this surface is key to computational accuracy.

Finally, note that the specific heat ratio γ setting should not be taken lightly. Changing from the default air (γ=1.4) to a diatomic gas, monatomic gas, or high-temperature gas alters the results more than you might expect. For example, with the monatomic gas argon (γ=1.67), the temperature rise behind the shock wave becomes more pronounced than with air, even for the same pressure ratio. This is because the specific heat ratio reflects the molecular degrees of freedom of the gas and determines the allocation to internal energy. Avoid indiscriminately reusing default values; cultivate the habit of checking the properties of the fluid you are dealing with.

How to Use

  1. Set left chamber pressure (PLval, kPa) and density (rhoLval, kg/m³) using sliders—typical air: PL=101.3 kPa, ρL=1.225 kg/m³
  2. Set right chamber pressure (PRval, kPa) and density (rhoRval, kg/m³)—for shock tube rupture scenarios, use PR=20 kPa, ρR=0.24 kg/m³
  3. Click solve to compute shock speed, contact discontinuity position, rarefaction fan, and pressure/density/velocity across the domain at t=0.001s

Worked Example

Air shock tube at t=1 ms: left side PL=200 kPa, ρL=2.35 kg/m³; right side PR=50 kPa, ρR=0.59 kg/m³. Solver outputs shock Mach ≈2.8, shock velocity ≈960 m/s, contact surface velocity ≈320 m/s, intermediate pressure ≈95 kPa. Rarefaction fan spans 45 m/s velocity gradient. Density jump across shock reaches 6.1×, validated against γ=1.4 acoustic relations.

Practical Notes

  1. Ensure PL > PR to generate physical shock; reversed pressures produce expansion fans only—verify sign before solving
  2. For diaphragm rupture (paper/membrane), use thin membrane stiffness (~5 kPa threshold) to trigger shock transition near t=0
  3. Shock tube diagnostics: measure reflected shock time when pressure wave reaches closed end; useful for ballistics or detonation studies
  4. Contact line position marks material interface; useful for tracking mixing in gaseous explosives or blast waves through air-helium interfaces