Compressible bluff-body Mach 2 flow — CPU translation of the p5.js sketch (N reduced from 400 to 200 for CPU performance, same body geometry in fractions of N: vertical slab at i/N ∈ (0.4875, 0.5125), j/N ∈ (0.375, 0.625), implemented by a penalty force f = −K·u inside the body). Uniform horizontal inflow u0 with γ = 0.2 gives a strongly supersonic bluff-body flow with bow shock, wake, and pulsating vortex shedding once the wake destabilises.

Equations: ∂ρ/∂t + ∇·m = 0, ∂m/∂t + ∇·(m u) + ∇p = ∇·(ν∇u) + f, ∂e/∂t + ∇·(e u) + p∇·u = ν|∇u|² with p = γe, u = m/ρ, f the body penalty force.

Red dots: particle traces (reset cadence via slider). Yellow: bluff body. Blue polyline: ρ−1 cross-cut along j = N/2. Green polyline: ux−1 cross-cut along j = N/2. Dcum = ∫∫ ν|∇u|² dx dt — cumulative viscous dissipation, the 2nd-Law witness for this flow.