Last lesson’s solver leaned on one assumption from start to finish: the air’s density never changes. That made the pressure an instant multiplier: one Poisson solve per step, and every cell knew at once what every other cell did. Physically, the speed of sound was infinite. It is not. It is about m/s at sea level, and an airliner cruises at Mach . Let the density vary and the air gets a finite speed of sound, a Mach number, and shock waves: the other half of aviation. The numerics change too: no pressure solve, but fluxes of mass, momentum and energy through cell faces, with a time step set by how fast sound crosses a cell.
Tools: 11.3 Momentum: Pressure & the Euler Equations, 11.2 Conservation of Mass: The Continuity Equation, 11.9 Turbulence: An Introduction (numerical viscosity), 11.11 Stam's Stable Fluids, Step by Step and 4.5 Stability Regions & Stiffness.
Transcript
- Last lesson's solver assumed the density never changes. That made pressure an instant multiplier, and the speed of sound infinite. Let the density vary, and the air gets a finite speed of sound, 340.3 metres per second at sea level, a Mach number, and shock waves: the other half of aviation.
- The Mach number is speed over the speed of sound. A light aircraft at 50 metres per second is Mach 0.1469, and the air ahead of it is only 1.07 percent less dense: incompressible flow is fine. A jet at Mach 0.85 is different. Over the wing, at an illustrative 1.3 times flight speed, the local Mach number reaches 1.165: a supersonic pocket, ending in a shock.
- To follow it, write the equations in conservation form: density, momentum and energy, each changing only by the flux through a face. Small changes then travel at three speeds, the eigenvalues of the flux Jacobian: u minus c, u, and u plus c. In the shocked gas of the shock tube, the fastest is 2.1916. Every scheme, and its time step, comes back to these speeds.
- Why do shocks form? Take Burgers' equation, where each value travels at its own speed. Characteristics are straight lines, and where the profile falls, they converge. For u zero equal to sine x, they first cross at t equals 1, at x equals pi. After that a smooth solution would be three-valued, so the wave becomes a jump.
- Across a normal shock at Mach 2, the jump conditions give pressure 4.5 times higher, density 2.6667 times, a downstream Mach number of 0.5774, and a temperature ratio of 1.6875. Entropy rises by 0.1309 c v. Try Mach 0.5, an expansion shock: pressure would fall to 0.125, and entropy by 0.3256. With no heat exchange, the second law forbids that. Shocks only compress, and the lost energy is wave drag.
- Now the test. Sod's shock tube: density 1 and pressure 1 on the left, density 0.125 and pressure 0.1 on the right, a diaphragm in the middle. Burst it, and three waves leave: a rarefaction fan runs left, a contact surface and a shock run right. Newton's method gives the star pressure 0.30313 and velocity 0.92745. At t equals 0.2, the fan spans 0.2634 to 0.4859, the contact sits at 0.6855, the shock at 0.8504.
- Now race two finite-volume schemes against it, on 200 cells. Rusanov adds diffusion sized by the fastest signal. HLL uses two wave speeds and adds less. Both are conservative: mass and energy are kept to round-off. The density error at t equals 0.2: 0.01530 for Rusanov, 0.01023 for HLL.
- Refine the grid and the error should halve each time. It does not. The observed order is about 0.6, not 1. The shock stays only 2 to 3 cells wide, because characteristics run into it from both sides. The contact has nothing to resharpen it: its width grows from 16 cells at 100 to 45 at 800, and its error shrinks only like the square root of the cell size.
- The time step is limited too. The CFL number says how many cells the fastest signal may cross per step. At 200 cells, Rusanov runs at 1.0 but blows up at 1.1, after 14 steps. HLL survives 1.1 and blows up at 1.2, after 11. For the light aircraft, u plus c is 390.3 against 50, so a compressible solver takes 7.8 times smaller steps.
- Next, 11.13. Everything so far solved a PDE on a grid. Particle and lattice Boltzmann methods compute a fluid by moving and colliding particles, with no grid-based PDE at all. After that, Module 12 takes all of it into flight.
Energy and the equation of state
Once density varies, 11.3’s Euler equations need an energy equation and a law tying pressure to density and temperature. In one dimension (a shock tube, or air crossing a shock head-on) the compressible Euler equations in conservation form are
Each row is 11.2’s control-volume balance: mass; momentum, carried through a face as plus the pressure pushing on it; and total energy per unit volume , internal plus kinetic, carried at plus the pressure’s work .
The closure is the ideal gas: with J/(kg K) for air, and internal energy per unit mass , with for air (from memory). Hence the in . With and flux the system is .
The speed of sound
Put a small disturbance on air at rest: , , velocity , and drop products of small terms. Mass and momentum become
A sound wave is too fast for heat to flow between neighbouring parcels and too gentle to form shocks, so it is isentropic: (the adiabatic law, which the energy equation gives for smooth flow; from memory). Then . Differentiate the first equation in , the second in , and subtract:
A wave equation: sound travels at . At sea level, Pa and kg/m give m/s (lab block A). Incompressible flow forces for any : is infinite, which is why 11.10’s pressure came from a Poisson equation.
Three signals. In moving air the sound is carried along. A disturbance spreads right at and left at , and a third kind of signal, a hot or dense spot with no pressure difference, simply drifts with the gas at . These are the eigenvalues of the flux Jacobian , the matrix saying how a small change of state changes the flux; its eigenvalues are the speeds at which small changes travel (from memory as a general fact; at rest we derived ). Lab block E builds the matrix numerically for the shock tube’s shocked gas and finds , , to about . Every scheme below, and its time step, comes back to these speeds.
Mach number: when density matters
The Mach number is . For steady flow without heat exchange the energy equation along a streamline says stays constant, with enthalpy . Divide by :
where subscript means brought to rest, and the second form uses the isentropic . This is the relation 11.2 quoted.
- A light aircraft at m/s: . The oncoming air is less dense than air brought to rest on its nose (lab A). Bernoulli’s estimate agrees: the pressure rise changes the density by , so . Incompressible flow is fine.
- A jet at Mach 0.85 at km, where K (standard atmosphere, from memory): m/s and the airspeed is m/s. Suppose the air over the wing’s suction peak reaches times flight speed (an illustrative figure). It cools as it speeds up: , so drops too and the local Mach number is . A pocket of supersonic air sits on a subsonic aircraft, and it ends in a shock. That is transonic flight, roughly (from memory).
The Prandtl–Glauert factor (from memory) scales small-disturbance pressure coefficients from incompressible values: at , at , at , at (lab A). Its blow-up at marks where linear theory fails.
Why shocks form
Take the simplest nonlinear wave equation, Burgers’ : each value of travels at speed . Along a curve , , so the characteristics are straight lines . Where decreases, fast fluid sits behind slow fluid and the lines converge. Two neighbours and meet when , first at
For , : lab block D finds the characteristic map still increasing at and folded at . After that a smooth solution would have to be three-valued, so the wave becomes a jump.
Air does the same: in a compression rises and adiabatic heating raises , so the back of a pulse outruns its front. For a simple wave the signal speed is (from memory). Weak sound is damped by viscosity before it breaks; a strong pulse, like the air piled up ahead of a supersonic nose, breaks quickly. Expansions do the opposite: their characteristics fan apart, and they spread smoothly into a rarefaction.
Jump conditions and normal shocks
A jump at has no derivatives, but the integral law survives. Over containing it,
Split the integral at ; differentiating the two pieces gives from the moving limits plus integrals of , which vanish as and close in on . What remains is the Rankine–Hugoniot condition
one per conserved quantity. For Burgers, gives .
In the frame moving with a normal shock, : mass flux , momentum flux and are equal on both sides. Solving these three for the downstream state gives the normal-shock relations (stated, not derived here):
At : , , , . Lab block B puts these back into the three jump conditions and gets residuals at round-off.
Why only compressions. Plug in : an “expansion shock” with . The entropy change of an ideal gas is . At it is ; at it is . Gas crossing a shock exchanges no heat, so the second law forbids that fall. Shocks only compress: supersonic air enters, subsonic air leaves, and the characteristics of both sides run into the shock (the Lax entropy condition, from memory), which keeps it sharp. The entropy rise is energy turned into heat that the flow never gets back, and on an aircraft that loss is wave drag.
The shock tube
Sod’s problem (1978, from memory) is a tube on with a diaphragm at : on the left, on the right, dimensionless, . Burst the diaphragm and one wave leaves along each signal speed: a rarefaction runs left (the family), a contact where the two original gases meet rides at , and a shock runs right (). Between them is a star region with one pressure and one velocity , but two densities.
To find , write behind each wave as a function of the pressure there. Behind the left rarefaction, (a Riemann invariant, from memory). Behind the right shock, the jump conditions give with , . Setting the two equal is one equation in one unknown, solved by Newton’s method in lab block C:
The lab checks the mass jump condition across that shock (residual at round-off). At each wave sits at speed: the fan, between speeds and , spans ; the contact is at , the shock at (the sim’s wave diagram).
Finite volumes, Rusanov and HLL
Store cell averages and update them by face fluxes:
Summed over cells, interior fluxes cancel in pairs. With mirror ghost cells the wall flux carries no mass or energy, so both are conserved to round-off whatever the flux formula. This matters for shocks: a conservative scheme that converges converges to a solution of the jump conditions, so shocks move at the right speed (the Lax–Wendroff theorem, from memory); non-conservative schemes can misplace them.
The face flux needs a rule. The Rusanov (local Lax–Friedrichs) flux is the average plus diffusion sized by the fastest signal:
Like 11.9’s upwind scheme, the diffusion term is a numerical viscosity proportional to . HLL (Harten, Lax and van Leer) assumes the fan from the face lies between and , with one average state between them. Applying the integral law to that box gives
which becomes plain upwind, , when (every signal moves right) and when . Its single middle state cannot hold a contact, which is why contacts still smear (HLLC restores the middle wave; from memory).
CFL. Each flux sees only its two neighbours, so no signal may cross more than one cell per step:
Sound sets the limit even in slow flow: for the light aircraft m/s against , so a compressible solver takes times smaller steps, one reason low-speed flight simulators stay incompressible. In the sim at , Rusanov runs at and blows up at after steps; HLL survives and blows up at after . The limit is sufficient, not exact: the fastest signal occupies only a few cells.
What resolution buys
The sim’s readout, for both schemes at and (the exercise’s solution reproduces the Rusanov entry at exactly):
| Rusanov | HLL | shock cells (Rus. / HLL) | contact cells (Rus. / HLL) | Rusanov error near the shock | |
|---|---|---|---|---|---|
| 100 | 2 / 2 | 16 / 11 | |||
| 200 | 2 / 3 | 25 / 16 | |||
| 400 | 3 / 3 | 33 / 22 | |||
| 800 | 3 / 3 | 45 / 30 | |||
| 1600 | 3 / 2 | 63 / 42 |
Widths count cells between and of the jump. Observed orders ( of successive error ratios): Rusanov ; HLL . Not one, and the table shows why. The shock stays to cells wide at every : characteristics run into it from both sides and their steepening balances the numerical viscosity, so its error halves with . The contact rides at on both sides, so nothing resharpens it and it spreads like heat: its width in cells grows to times per doubling, close to , so in it shrinks only like , and so does its error. Order one is a promise for smooth flow only. HLL’s error is about a third smaller: its two wave speeds add less diffusion than Rusanov’s single largest one.
Computing it
The exercise. Write the Rusanov flux and one finite-volume step with closed (mirror) walls. The tests run Sod at to , check that total mass () and energy () are unchanged to , and that the density error against the exact solution is below (the sim’s Rusanov gives ; an HLL flux, at , also passes).
The solution gives at , exactly the sim’s Rusanov readout, with mass and energy unchanged to round-off.
Concept checks
Problems
For with , : find when and where the first shock forms. A Burgers shock then joins to ; how fast does it move?
Show worked solution
is most negative, , at , so , at , where and the characteristic stays put. With , , the fold lab block D finds between and . Rankine–Hugoniot with : .
Find , , , and the entropy rise in units of for , . Compare with Mach 2.
Show worked solution
. . . , . Entropy: , against at Mach 2. The density ratio is capped at as grows (the formula’s limit), while pressure and entropy keep climbing: stronger shocks waste more energy as heat. Check with shock(3.0) in lab block B.
The sim’s Sod run at , takes steps to reach . Which state sets the fastest signal for most of the run? Estimate the step count from it.
Show worked solution
Behind the shock, and (the sim reads ). The fan reaches only , the undisturbed gases and . So the shocked gas sets , and steps. The run takes because the first few steps, before the shocked gas exists, use .
Key Takeaways
- Compressible Euler: , , .
- Linearizing gives sound at , m/s at sea level; small changes travel at , and , the eigenvalues of the flux Jacobian.
- Density changes at m/s; a Mach 0.85 jet can carry a supersonic pocket ( for a times suction peak) ending in a shock.
- Compressions steepen into shocks, first at for Burgers; jumps obey Rankine–Hugoniot, , and the second law allows only compressions ( times the pressure at Mach 2).
- Sod’s exact solution: , , found by Newton on one equation.
- Conservative finite volumes (Rusanov, HLL) with hold shocks to 2 to 3 cells and conserve mass and energy to round-off; contacts smear like , so errors converge at about , not .
- Next, 11.13: everything so far has been a PDE solved on a grid. Particle and lattice Boltzmann methods compute fluids a completely different way, by moving and colliding fluid particles or particle populations with no grid-based PDE at all; after that, Module 12 takes all of it into flight.