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

Shock Mach Ms
Post-shock P*
Shock Speed
Contact Speed

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.

Related Engineering Fields

The solution method for the 1D Riemann problem handled by this tool is the very foundation of supersonic and hypersonic aerodynamic design. For example, this concept is applied to predict the shock wave angle generated at the tip of a supersonic vehicle and the pressure/temperature distribution behind it. Particularly, inside the intake of a scramjet engine, controlling complex shock wave systems to efficiently compress air makes CFD analysis centered on Riemann solvers indispensable.

It also directly relates to explosion safety engineering and analysis of detonation phenomena in explosives. When an explosive like TNT detonates, an extremely high-pressure "detonation wave"—a strong shock wave—is generated. The shock tube theory is applied and extended as a fundamental model for understanding this propagation. Observing a "strong shock wave" in the simulator is your first step towards an intuitive understanding of the rapid rise in overpressure caused by a blast wave.

Furthermore, in a more unexpected field, this theory—multidimensional and relativistically extended—is used in astrophysics, specifically in simulations of supernova remnant expansion. The jump conditions across a shock wave describe the fundamental physics crucial for elucidating the mechanism by which shock waves propagating through the interstellar medium accelerate cosmic rays.

For Further Learning

As a next step, we recommend learning about the "2D Riemann Problem". Step out of the one-dimensional tube and consider a problem where four gas blocks in different states interact on a plane. This allows you to observe a significantly richer set of phenomena: shock wave reflection, "shock-shock interaction" where shocks from different families intersect, and even vortex generation. This is the prototype for the complex flows handled by practical CFD codes.

If you wish to deepen your mathematical understanding, grasping the "Method of Characteristics" is essential. Behind this tool, this method is used to construct the continuous solution in the expansion fan region. By learning the property that solutions to the Euler equations—a hyperbolic partial differential equation—keep a constant value (Riemann invariant) along curves called characteristics, you will intuitively understand the mathematical structure behind why such an expansion fan appears.

Finally, venture into the world of "Numerical Riemann Solvers". These are various numerical algorithms (e.g., Roe solver, HLL solver) that approximate this "exact solution" at high speed. In practical CFD, the exact solution is not used due to the balance between computational cost and robustness; instead, these approximate solvers work at the core. Knowing what they approximate and where they simplify is essential knowledge for an engineer to critically evaluate CFD results.