Every solver in this module so far has been a PDE on a grid: Stable Fluids solved a Poisson equation in fixed cells, and last lesson’s finite volumes pushed fluxes through fixed faces. Here are two other ways. Smoothed particle hydrodynamics (SPH) has no grid: the fluid is a cloud of particles, and every derivative becomes a weighted sum over neighbours. The lattice Boltzmann method (LBM) keeps a grid but solves no Navier–Stokes equation on it: populations of imaginary molecules hop between nodes and collide, and Navier–Stokes comes out on average. Both borrow 11.12’s idea: let the fluid squeeze a little, and pressure comes from density through a speed of sound, with no Poisson solve.
Tools: 11.12 Compressible Flow & Shocks, 11.11 Stam's Stable Fluids, Step by Step, 11.4 Viscosity & the Navier–Stokes Equations, 11.5 Non-dimensionalization & the Reynolds Number (Strouhal), 11.6 Vorticity Dynamics & Circulation and 4.7 Energy & Symplectic Integrators (leapfrog).
Transcript
- Every solver here so far solved a PDE on a grid: Poisson in fixed cells, fluxes through fixed faces. Here are two other ways. Smoothed particle hydrodynamics has no grid at all. The lattice Boltzmann method keeps a grid, but solves no Navier-Stokes equation on it. Both let the fluid squeeze a little, so pressure comes from density, with no Poisson solve.
- SPH smears each particle over a smoothing kernel: a bump of width h that integrates to 1 and vanishes beyond 2h. The normalization is exact: the integral is 1.000000, and on a lattice with h equal to 1.3 spacings the sum is 0.999947. Density is then a sum over neighbours, and since particles carry their mass, mass is exact.
- Pressure comes from density through a stiff equation of state, so the water squeezes a little. The speed of sound, 80 metres per second, is a numerical choice: it keeps the Mach number below 0.1 and density changes near 1 percent. The time step is a CFL limit, 1.625 times ten to the minus four seconds. Real water's 1480 would need steps 18.5 times smaller.
- Release a column of water, 1 metre wide and 2 tall: 800 particles. The front passes 2.0 metres at 0.373 seconds and 3.5 metres at 0.655: 5.32 metres per second. Shallow-water theory, Ritter's, gives 8.86, so we run at 60 percent of it. Ritter's tip has no thickness and no resistance: an upper bound.
- SPH has honest weaknesses. A free-surface particle has neighbours on one side only, so its density reads low and its pressure goes negative: tension. Unclamped, top particles reach 10.6 metres per second in 0.02 seconds, where free fall gives 0.2, and particles clump. Pressure is noisy, so pressure on a body is its weak spot. SPH shines at free surfaces and splashes.
- Lattice Boltzmann keeps a grid, with nine populations at each node, moving along nine lattice velocities with weights four ninths, one ninth and one thirty-sixth. Density and velocity are their moments. A step collides, relaxing each population toward equilibrium, then streams, hopping one link. The weights give c s squared equal to one third: an equation of state, so it is weakly compressible too.
- The relaxation time sets the viscosity: nu is c s squared times tau minus one half. Check it with a decaying shear wave. At tau 0.6 the measured viscosity is 0.033436, 0.31 percent high; at 0.8 it is 0.100206. At tau 1.5 the error is 0.99 percent on a box 32 wide, four times smaller with each doubling: second order.
- Walls use bounce-back: a population that would enter the cylinder is sent back reversed, giving no-slip with no equation to solve. At Reynolds number 40 there is no street. From 100 the bubbles take turns breaking off: a Karman vortex street. The Strouhal number is 0.191 at Re 100, 0.206 at 150 and 0.214 at 200: a little high, but the street is right.
- By similarity, lattice numbers apply to hardware. A 5 centimetre strut at 50 metres per second has Reynolds number 1.71 times ten to the 5, where the Strouhal number is still about 0.2. It sheds at 200 hertz, so its side force alternates at 200. A 3 millimetre wire sheds at 3333 hertz. Near a natural frequency, lock-in can cause fatigue.
- Which method? Projection for incompressible flow and smoke; finite volumes for shocks; SPH for free surfaces and splashes; lattice Boltzmann for complex geometry and wakes. For aircraft, grid solvers remain the workhorses. Next, Module 12 takes these tools into the air. In 12.1, a wing makes lift from circulation: the Kutta condition fixes how much, and the lift is rho V gamma.
SPH: a field as a sum over particles
Give each particle a mass , a position and a density . Any field is estimated by smearing each particle’s value over a small blob:
is the particle’s volume and the smoothing kernel, a bump of width that integrates to , vanishes beyond and is smooth. We use the 2D cubic spline, with :
The constant is the normalization. Lab block A checks it: , and on a square lattice of spacing with the sum . The sim sets the particle mass so this lattice sum gives exactly kg/m.
Put and the cancel: density is a sum,
No continuity equation is solved: particles carry their mass, so mass is exact. Gradients use the exact in the same sum.
Pressure from a stiff equation of state
Weakly compressible SPH lets the water squeeze slightly and reads pressure off density with the Tait equation of state (from memory):
Linearized, , so by 11.12’s , is the speed of sound. 11.12 also priced compressibility: density changes by about . So is a numerical choice, large enough that stays below about and density changes stay near . Real water’s m/s (from memory) would ruin the time step.
The time step is a CFL limit. Sound must not cross more than a fraction of a kernel per step, so the sim takes
s at the start of the dam break ( m, m/s), and times smaller with m/s (lab B). As in 11.12, sound sets the step even when the flow is slow.
The pressure force. Euler’s equation is . The naive kernel sum for gives pair forces that are not equal and opposite, so instead write and estimate each term with the kernel:
The bracket is symmetric in and and , so pair forces obey Newton’s third law and momentum is conserved to round-off.
Viscosity. is Monaghan’s artificial viscosity (from memory):
It acts only on approaching pairs, damping impacts like 11.12’s Rusanov diffusion. It acts as a kinematic viscosity of about (from memory): m/s at (lab B), over thirty thousand times water’s . At this resolution SPH is a stabilized inviscid model.
Leapfrog. Each step is kick, drift, forces, kick:
That is velocity Verlet from 4.7 Energy & Symplectic Integrators: one force evaluation per step, symplectic for conservative forces, so energy oscillates instead of drifting over the thousands of steps the acoustic CFL demands.
The dam break
The sim’s first tab releases a water column m wide and m tall in a m tank: particles at m, with three layers of fixed wall particles that join the density sums and push back through the equation of state.
A number to compare with. Shallow-water theory (hydrostatic pressure in a thin layer) behaves like gas dynamics with depth as density. Its dam break is a rarefaction like Sod’s, along which is constant (a Riemann invariant, from memory). At the tip the depth is zero, so the front runs at Ritter’s speed m/s (lab B), drawn in red dashes.
With the defaults ( m/s, ) the front passes m at s and m at s: m/s, of Ritter’s. The numerical knobs hardly move it:
| (m/s) | front speed (m/s) | max Mach | max compression | |
|---|---|---|---|---|
| 120 | 0.05 | 5.21 | 0.052 | 0.60% |
| 80 | 0.05 | 5.32 | 0.080 | 1.05% |
| 40 | 0.05 | 5.42 | 0.161 | 2.15% |
| 20 | 0.05 | 5.37 | 0.327 | 5.48% |
| 80 | 0.01 | 5.47 | 0.083 | 1.17% |
| 80 | 0.20 | 4.90 | 0.071 | 0.70% |
(Maxima until the front reaches m, the readout’s last line.) So the gap is not the speed of sound. Ritter’s tip has zero thickness and no resistance, his reservoir is infinite, and his water starts at full speed; ours is a short column that must first fall, its tip slowed by artificial viscosity ( m/s at ) and the bumpy particle wall. Ritter is an upper bound; tank experiments are slower too (from memory).
The compression column is the Mach rule at work. Hydrostatics alone gives at (lab B); impacts and particle noise push the peak higher. It grows as falls, though more slowly than , because the noisiest particle sets it.
Lattice Boltzmann: populations on a lattice
Now a fixed lattice, but no Navier–Stokes solve. Each node holds nine numbers , the fluid moving with lattice velocity . In D2Q9 these are rest, four axis neighbours and four diagonals, with weights , (four) and (four), in lattice units .
Density and velocity are moments, the zeroth and first:
One step is collide, then stream. With the BGK (Bhatnagar–Gross–Krook) collision,
each population relaxes a fraction toward equilibrium, then hops one link along . The equilibrium is a low-Mach expansion of a Maxwell–Boltzmann distribution (from memory):
Where comes from. The weights give and (lab C). Then , , and the momentum flux is : a pressure plus momentum carried by the flow. That is an equation of state with sound speed : LBM is weakly compressible too, with .
Why mass is exact. has the same and as the it was built from, so collision changes neither, and streaming only moves numbers. Mass is conserved to round-off (the exercise checks it), with no Poisson equation anywhere.
Viscosity from the relaxation time
The Chapman–Enskog expansion (stated, not derived; from memory) gives
Heuristically, a momentum-flux disturbance shrinks by per collision, so it survives about steps, leaking momentum sideways at a rate set by ; the is the hop’s own second-order discretization error, a negative diffusion worth half a step (from memory).
Check it with a shear wave. Take , on a periodic box. Its nonlinear term vanishes, so 11.4’s Navier–Stokes reduces to the heat equation and the amplitude decays as : the decay rate measures . On a lattice, timing the decay from step to , the exercise’s solution finds
| measured | error | ||
|---|---|---|---|
| 0.6 | 0.033333 | 0.033436 | +0.31% |
| 0.8 | 0.100000 | 0.100206 | +0.21% |
| 1.0 | 0.166667 | 0.166666 | |
| 1.5 | 0.333333 | 0.330031 |
At the error is on a -wide box, at , at : a factor four per halving, second order. Mass changes by under .
Stability and the Mach limit. is required for ; as the collision overshoots equilibrium (the factor nears ) and BGK grows fragile. The equilibrium is a low-Mach expansion, so errors grow like . They fight over : more Re at fixed , pushes toward ; more raises Ma. The sim fixes (, errors of a few percent) and , so : at Re , at (lab C). Higher Re needs more nodes.
Walls by bounce-back. A population that would stream into a solid node is sent back, reversed. Each wall link then carries equal and opposite momentum, so the velocity vanishes about halfway to the solid node: no-slip with no equation to solve. A curved body becomes a staircase.
A cylinder sheds a vortex street
The second tab is a lattice with a cylinder in a far field (inlet, top and bottom rows held at equilibrium) and a copy-the-neighbour outlet. A probe behind it records the cross-stream velocity ; the time between upward zero crossings is the period, and .
At Re two bubbles stay attached and the probe settles to : no street. From Re the bubbles take turns breaking off. With the readout settled (by step ):
| Re | St (sim) | |
|---|---|---|
| 100 | 0.5600 | 0.191 |
| 150 | 0.5400 | 0.206 |
| 200 | 0.5300 | 0.214 |
| 250 | 0.5240 | 0.221 |
| 400 | 0.5150 | 0.233 |
At Re that is one period per steps (lab C). The known open-air value is for Re of a few hundred, a little lower near (from memory). Ours run high and keep rising: the far-field rows are apart (blockage speeds the flow past the cylinder), Ma is , the circle is a 20-node staircase, and by Re the real wake is three-dimensional. The street itself is right: red (counterclockwise) and blue (clockwise) vortices alternate, 11.6’s opposite-sign vortices in two staggered rows. Each row induces an upstream velocity on the other, as 11.6’s pair pushed itself along, so the street drifts slower than the free stream (from memory).
Why a lattice number applies to a strut. By 11.5, St depends only on nondimensional groups (Re, weakly Ma and blockage), not on whether the cylinder is nodes or cm of steel.
When to use which
| Method | Natural for | Weak at |
|---|---|---|
| Projection / Stable Fluids | incompressible flow, smoke, real time | free surfaces; diffusive unless refined |
| Compressible finite volume (11.12) | shocks, transonic and supersonic flight | low Mach, where sound sets the step |
| SPH | free surfaces, splashes, sloshing, impacts | pressure on bodies, walls, high Re |
| LBM | complex geometry (just solid flags), wakes, GPUs (all updates local) | high Mach; high Re needs many nodes |
For aircraft aerodynamics, grid and finite-volume solvers remain the workhorses (from memory).
Computing it
The exercise. Write one D2Q9 collide-and-stream step. The tests run the shear wave at and on a periodic lattice and require within of and mass unchanged to .
The solution measures and , with mass changing by about . Then run(1.5, 16), run(1.5, 32) and run(1.5, 64) reproduce the convergence check.
Concept checks
Problems
On a periodic lattice with , a shear wave decays. Predict its decay rate per step and the number of steps for its amplitude to halve.
Show worked solution
and , so the rate is per step. It halves after steps ( with the measured ).
For the cylinder at Re with the sim’s , , what is ? At fixed , what restores (the sim’s Re 250)? Roughly how much more computing?
Show worked solution
, so , very near . For , and nodes. The lattice grows times each way ( times the nodes) and a shedding period takes times the steps: about times the cost. Raising instead raises Ma past .
An SPH tank holds water m deep, m, . Take and . Find and the steps for s, and compare with water’s real m/s.
Show worked solution
m/s, m/s, s: about steps. With m/s, s: steps, times more.
Key Takeaways
- SPH turns fields into kernel sums (the cubic spline integrates to ); density is , so mass is exact.
- Weakly compressible SPH reads pressure from a stiff equation of state with an artificial and steps by leapfrog.
- The dam-break front runs at m/s, of Ritter’s , almost independent of . Free surfaces are SPH’s strength; tension, walls and noisy pressure its weaknesses.
- LBM D2Q9: BGK collision toward , then streaming; and are moments, , and mass is conserved to round-off.
- holds to to in shear-wave decay, converging at second order; stability needs and small .
- The lattice cylinder sheds a Kármán street with St to for Re to ; by similarity a cm strut at m/s sheds at Hz.
- Next, Module 12 takes these tools into the air. In 12.1 a wing makes lift from circulation: the Kutta condition fixes how much circulation the sharp trailing edge allows, the starting vortex you saw shed in 11.6 balances it, and the lift is .