The Lighthill-Whitham-Richards (LWR) model treats a stream of traffic like a
compressible fluid: instead of tracking every driver, it tracks a continuous
density field ρ(x,t) — vehicles per metre of road — and a flow
(flux) that depends on that density. When the road narrows or an incident cuts
capacity, density piles up upstream faster than it can escape downstream, and a
sharp boundary — a shockwave — forms and travels backward
against the direction of traffic, exactly like the jam wave you feel arriving in
a real hold-up long after the incident itself has cleared.
v(ρ) = v_max·(1 − ρ/ρ_jam), so flow q = ρ·v rises, peaks, then falls as the road fills up.ρ(x,t).
The shockwave speed follows the Rankine-Hugoniot jump condition
s = (q₂ − q₁) / (ρ₂ − ρ₁) — the same formula used for shocks in
gas dynamics. It is why a jam can appear to move upstream even though every
single car in it is still crawling forward.
A stretch of motorway is solved as a continuous density field, the way the Lighthill-Whitham-Richards model treats traffic like a compressible fluid, so that a lane-closure bottleneck visibly triggers a shockwave — a traffic jam boundary — that crawls backward against the flow.
A Godunov finite-volume scheme advances vehicle density ρ(x,t) using the Greenshields speed-density relation. Where a bottleneck caps the flow that can pass, density backs up and a sharp shock front forms and propagates upstream, matching the Rankine-Hugoniot jump condition.
Raise the inflow density to add more demand, and dial up bottleneck severity to choke capacity at the cone-marked pinch point. Watch the colour-coded density ribbon and the instanced vehicles bunch into a red jam that creeps backward, then ease off the bottleneck to watch it dissolve.
The same Godunov numerical-flux technique used here to resolve sharp traffic shocks was originally developed for shock waves in compressible gas dynamics — traffic jams and sonic booms share the same mathematics.