← Home · Computational fluid dynamics · lattice Boltzmann D2Q9 · live in the browser

Navier–Stokes wind tunnel

Flow past a cylinder, a sphere, a pear, a Joukowski aerofoil, a sports car, a Formula 1 car and a motorcycle, computed step by step from the Navier–Stokes equations. Turn the Reynolds number up and watch the flow go from creeping, through a vortex street, to a turbulent wake. Drag the picture to rotate it; pinch or scroll to zoom.

CylinderRe = 100
Vorticity ωL/U
−0+
—
CD—drag
CL—lift
St—fL/U
t·U/L0dimensionless time
τ · Ma—lattice parameters
Grid · CPU320×128L = 24 cells

Kármán vortex street

Force coefficients over timeCD   CL
Pressure on the surface

The equations

For an incompressible fluid of constant viscosity, the Navier–Stokes equations say that the acceleration of a fluid element is caused by the pressure gradient and the viscous diffusion of momentum:

∂u/∂t + (u·∇)u = −∇p/ρ + ν∇²u,   ∇·u = 0

Make the equation dimensionless with the length L of the body and the free-stream speed U, and only one parameter is left: the Reynolds number Re = UL/ν, the ratio of inertial to viscous effects. Two flows with the same shape and the same Re are the same, whether it is oil round a pencil or air round a chimney.

The vorticity ω = ∇×u is shown by default because it shows where the fluid rotates: in the boundary layers and in the wake they shed.

How it is computed

The solver is a lattice Boltzmann method (D2Q9). In each cell it follows nine distributions fi of particles with velocities ci. Each time step is a collision, which relaxes fi towards a local equilibrium, followed by streaming to the neighbouring cells. A Chapman–Enskog expansion shows that density and momentum then obey the Navier–Stokes equations with ν = (τ − ½)/3, as long as the Mach number is small.

The surface of the body uses half-way bounce-back (no-slip). The force on the body is found by momentum exchange over all surface links and gives CD and CL. At high Re a Smagorinsky model raises the local viscosity in the smallest eddies (LES) so that the computation does not break down.

The cylinder and the aerofoil are computed in 2D and extruded along the span. The sphere and the pear are bodies of revolution; they are computed in the meridian plane with the extra source terms from cylindrical coordinates (−ρur/r in the continuity equation and corresponding terms in the momentum equation). The tracer particles then follow the field in full 3D by rotating it about the axis.

If the browser has WebGL2, the 2D flows are computed on the graphics card. Each cell is a pixel in three textures holding the nine distributions, and a small program runs in every cell at once. That allows a grid of up to 1200 × 480 cells and Re up to 10,000. The page measures how fast the graphics card is and picks the largest grid that still runs smoothly. The sphere and the pear are always computed on the processor.

The smoke is a dye sent in from a row of nozzles on the left and carried along by the flow (semi-Lagrangian advection with a MacCormack correction), like the smoke streaks in a real wind tunnel.

The vehicles are computed in a section through the centre, seen from the side. Under them the road moves backwards at the speed of the air, as in a wind tunnel with a rolling road, so that no false boundary layer forms on the road. The forces on wings and spoilers are also counted separately.

The Joukowski transformation

The complex map

z = ζ + 1/ζ

is conformal: it preserves angles, and so it carries a potential flow in the ζ-plane over into a potential flow in the z-plane. The unit circle maps onto the line segment from −2 to 2. Move the circle so that its centre is at μ = −ε + i f, but keep it passing through ζ = 1, and the image becomes an aerofoil with a rounded leading edge and a sharp trailing edge at z = 2. ε sets the thickness and f the camber.

The flow past a cylinder is known exactly. At angle of attack α the complex potential is

W(ζ) = U[(ζ−μ)e−iα + R²eiα/(ζ−μ)] + (iΓ/2π) ln(ζ−μ)

The circulation Γ is free. The Kutta condition picks the value that removes the infinite velocity round the trailing edge: Γ = 4πUR sin(α+β), where sin β = f/R. The Kutta–Joukowski theorem then gives the lift L′ = ρUΓ per unit span, and CL = 8πR sin(α+β)/c ≈ 2π(α+β) for thin profiles.

Choose Ideal flow to see this solution. Note that it gives zero drag (d'Alembert's paradox). It is the viscosity in the Navier–Stokes computation that creates drag, and that in reality fixes Γ by making the boundary layer leave the trailing edge cleanly.

The boundary layer and the Blasius equation

On a flat plate parallel to the flow the pressure is constant, and all the drag comes from friction in a thin boundary layer. Ludwig Prandtl showed in 1904 that the Navier–Stokes equations can here be simplified to the boundary-layer equations, and his student Heinrich Blasius found the solution in 1908. The velocity profiles at different places x along the plate all have the same shape when the distance y is measured in the dimensionless variable

η = y·√(U/νx),   u/U = f′(η)

Putting the stream function ψ = √(νUx)·f(η) into the boundary-layer equations gives the Blasius equation, a non-linear third-order differential equation:

f‴ + ½ f f″ = 0,   f(0) = f′(0) = 0,   f′(∞) = 1

Two boundary conditions hold at the wall and one infinitely far out, so the equation cannot simply be integrated from η = 0. The page solves it with the shooting method: guess the slope f″(0), integrate outwards with Runge–Kutta, and see whether f′ ends at 1. If f′ is too large, the guess was too large. Bisection narrows the guess until it hits:

f″(0) = …

From this follow the boundary-layer thicknesses and the friction. With the local Reynolds number Rex = Ux/ν,

QuantityFormulaConstant from the solution

Choose Flat plate in the wind tunnel above. The chart below the force curves shows the simulated velocity profiles at three places along the plate as dots, plotted against η, on top of the Blasius curve. When the dots lie on the curve, the Navier–Stokes computation and the Blasius solution have the same shape. Because the plate displaces air in a closed tunnel, the air outside the boundary layer moves a little faster than U, at speed Ue. The profiles are therefore measured relative to Ue. Near the leading and trailing edges they deviate a little, because the boundary-layer approximation does not hold there, and at low Re the boundary layer is no longer thin. For the same reasons the simulated friction is somewhat higher than the Blasius value 1.328/√Re.

Work it out

Spinning bodies and the Magnus effect

Choose Rotation. The cylinder turns, and its surface drags the air with it. On the side where the surface moves with the air, the flow is faster and the pressure lower. On the other side the air is slowed and the boundary layer separates earlier. The wake is deflected, and the cylinder feels a sideways force: the Magnus effect. For an ideal flow with circulation, the Kutta–Joukowski theorem gives CL = 2π·ωR/U. The viscous flow gives less, but with the same sign. Above ωR/U ≈ 2 the vortex shedding stops.

That is why a ball with backspin flies further, a topspin ball dips, and a football struck with spin curls. Rotor sails on ships use the same effect: tall spinning cylinders that give thrust in a crosswind. More about balls, dimples and the drag crisis on the page The Flight of the Ball.

Balls floating in an air jet

A light ball floats in a vertical air jet and spins. The jet carries it, and when the ball drifts to the side, the air follows the curved surface and pulls it back.
An American football is not round. It tilts and tumbles in the jet, because the centre of pressure shifts as it turns.
A ball with holes in its shell. Air also flows through it, so it floats lower and less steadily.

Filmed at the “Floating objects” exhibit in a science centre. The videos are trimmed, stabilised and silent. Try it yourself with a hair dryer and a table-tennis ball: hold the hair dryer at an angle, and the ball still stays put.

Flow regimes

ReCylinder (2D)ReSphere
< 5Creeping flow, no separation< 20Attached flow
5–47Steady vortex pair behind the cylinder20–210Steady, axisymmetric vortex ring
47–190Periodic Kármán vortex street, St ≈ 0.12–0.19210–270Steady, but no longer axisymmetric
190–10³The wake becomes three-dimensional270–800Periodic shedding of hairpin vortices
10³–2·10⁵Turbulent wake, laminar boundary layer> 800Turbulent wake
≈ 3·10⁵Drag crisis: the boundary layer turns turbulent and CD drops sharply≈ 3·10⁵Drag crisis (a golf ball's dimples bring it lower)

For comparison, in unbounded flow: a cylinder at Re = 100 has CD ≈ 1.33 and St ≈ 0.165; a sphere has CD ≈ 2.6 at Re = 20 and CD ≈ 1.1 at Re = 100.

What the model cannot do

  • The cylinder and the aerofoil are 2D. Above Re ≈ 190 the real wake becomes three-dimensional; a 2D model keeps the vortex street too regular and gives force fluctuations that are too large.
  • The sphere and the pear are forced to be axisymmetric. Above Re ≈ 210 the real sphere breaks the symmetry, which the model cannot show.
  • On the processor the grid is 320 × 128 cells with 24 cells across the cylinder's diameter; on the graphics card up to 1200 × 480 with 90 cells. The tunnel walls (smooth, without friction) block 19 % of the cross-section, so the cylinder's CD and lift fluctuations are clearly above the values for free flow.
  • The spinning cylinder is 2D. A spinning sphere in 3D has a weaker Magnus force, and at high Re the force can even change sign (the reverse Magnus effect).
  • The sports car, the F1 car and the motorcycle are 2D sections through the centre. The air cannot flow round the sides, and the wheels are only drawn. Real vehicles run at Re ≈ 10⁶–10⁷. The figures are qualitative; use them to compare the versions of the same vehicle.
  • Above Re ≈ 1000 (on the processor) or Re ≈ 5000 (fine grid on the graphics card) the grid does not resolve the boundary layer; the turbulence is modelled, not computed. The results are qualitative. Aircraft fly at Re ≈ 10⁶–10⁸, far beyond what a browser can compute.