Simple 2D fluid — theory
What this demo solves, how viscosity and Reynolds number enter, and how to read the overlays. Educational lattice Boltzmann — not production CFD.
Lattice Boltzmann (D2Q9 BGK)
Instead of discretising Navier–Stokes on a mesh with pressure Poisson solves, LBM evolves discrete velocity distribution functions on a lattice. Macroscopic density ρ and velocity (u, v) are moments of those populations.
collide (relax toward feq) → stream along eᵢ → bounce-back on solids
Nine velocities (D2Q9). BGK single-relaxation-time collision with rate ω.
Viscosity
ν = cₛ² (1/ω − 1/2) cₛ² = 1/3 ω = 1 / (3ν + 1/2)
Higher ν → more damping, thicker boundary layers, less unsteadiness. Too low ν (or high inlet speed) can make the scheme unstable; the demo softly clamps velocity (Mach control).
Reynolds number
Re = U L / ν
- U — inlet speed u₀ (lattice units)
- L — characteristic length (cylinder diameter, step height, …)
- ν — kinematic viscosity (lattice units)
Cylinder wakes: low Re attached; moderate Re → von Kármán street. On-screen Re is an order-of-magnitude lattice estimate.
Boundary conditions in the demo
- Channel — left Dirichlet-like equilibrium inlet, right copy outlet, optional top/bottom walls
- Lid-driven cavity — closed box with moving top lid (classic CFD benchmark geometry)
- Solids — bounce-back reflection of populations
Scalars & overlays
- |u| — speed map
- Vorticity — discrete curl; vortex cores and shear layers
- Density / pressure — LBM is weakly compressible; ρ variations proxy pressure
- Dye — passive scalar, semi-Lagrangian advection + decay
- Tracers / stream ribbons / vectors — Lagrangian intuition aids
Limits
- Coarse lattice; not mesh-converged
- Simplified BCs; no wall model / turbulence model
- Lattice units — not calibrated SI CFD
- For teaching wakes, Re, viscosity — not certification
Open the Simple 2D Fluid Visualizer, lower viscosity, and watch the cylinder wake. Then try the cavity preset.