OneDimensional Hydrodynamics: The Shock Tube
Joachim Köppen Kiel July 2016

nbr. of cells
density left
density right
time step
display time interval
elapsed time

Density
Speed
Temperature

### Some brief explanations

• This is a simulation of the movement of gas in a linear tube. It shows the evolution of the density, velocity, and temperature of the gas, starting from the initial situation, which is a rather simple but fundamental example: In the beginning, the left half is filled with gas of high density, while the right half is filled with gas at lower density (but not zero!), separated by a thin membrane. In both parts, the gas is at rest and at the same temperature ( = 1 in arbitrary units). Thus, there is no systematic flow in either direction. At time zero, this membrane is suddenly removed, and the gas rushes from the high density side to fill the low density side. This happens with some interesting features, which can be nicely seen in the simulation.
• The simulation is started by clicking Start. It can be interupted by Stop and continued by Resume. Clear wipes the screen at any instant, so that one may show only the situation at a later time
• The display time interval is the time between the drawing of the curves. If you set this parameter to zero, almost every instant is shown (but there are still 50 time steps between successive curves).
• The time step has to be chosen suitably: too large a value will cause the simulation to become unstable, and negative densities will appear, so that the simulation is automatically stopped. There is a maximum acceptable value - from the Courant-Friedrichs-Levy condition - below which the simulation gives reliable results. But the execution becomes slower with smaller time step.
• The nbr of cells determines the spatial resolution of the simulation. Small values make faster runs, because they can be run with a longer time step, but the details of the curves are washed out. A large number of cells (maximum: 1000) resolve these details, but take longer due to the smaller time step.
• When the shock hits the right hand limit, the results become unreliable, because the reflections at the end walls of the tube cannot be computed accurately with our simple method.

• The simulation is based on the numerical solution of the hydrodynamic equations (conservation of mass, momentum, and energy), discretized on a equidistant spatial grid. At each instant of time, one computes from these equations how the density, speed, and temperature at every point of the grid change during a small time step. Applying these changes gives the situation at the next time instant.