Physics Fluid Dynamics Lattice Boltzmann WebGL GLSL

No Poisson Solver Required: D2Q9 Lattice Boltzmann (BGK) Mesoscopic Fluid Dynamics in WebGL2


ν = (τ − 0.5)/3 = 0.0267 | Ma = 0.11 | Zero Poisson Solves! Click/Drag to paint bounce-back walls
Live D2Q9 Lattice Boltzmann (BGK) Wind Tunnel. Watch vortex shedding emerge purely from local 9-velocity collision and streaming with zero global pressure projection. Click-drag anywhere to paint exact no-slip bounce-back obstacles!

In Solving Navier–Stokes at 60 FPS, we enforced incompressibility ($\nabla \cdot \vec{u} = 0$) via Helmholtz–Hodge projection – burning 20 to 40 ping-pong Jacobi shader passes every frame to solve the global elliptic pressure Poisson equation $\nabla^2 p = \nabla \cdot \vec{u}^*$. That global pressure solve is the classic scaling bottleneck of continuum CFD.

The Lattice Boltzmann Method (LBM) (Chapman–Enskog D2Q9, arXiv:1512.02599; Extended-Regularized LBM, arXiv:2610.31072) bypasses the Poisson solver completely by stepping down one level of abstraction from macroscopic PDEs to mesoscopic kinetic gas theory. Each lattice cell stores 9 discrete velocity probability populations $f_0, \dots, f_8$ (D2Q9) that execute two strictly local operations per step: algebraic BGK relaxation toward Maxwell–Boltzmann equilibrium, and nearest-neighbor streaming. In the low-Mach limit ($Ma \ll 1$), the Chapman–Enskog expansion proves this local cellular automaton recovers the exact incompressible Navier–Stokes equations!


0. D2Q9 BGK Collision–Streaming & Chapman–Enskog Viscosity

With discrete lattice velocities $\vec{e}_0 = (0,0)$, cardinal $\vec{e}_{1..4}$ ($w_q = 1/9$), and diagonal $\vec{e}_{5..8}$ ($w_q = 1/36$, rest $w_0 = 4/9$, lattice sound speed $c_s^2 = 1/3$), macroscopic density $\rho$ and momentum $\rho\vec{u}$ are exact zero- and first-order velocity moments:

D2Q9 Lattice Boltzmann BGK Equation & Emergent Kinematic Viscosity (arXiv:1512.02599)
$$\rho = \sum_{q=0}^{8} f_q, \qquad \vec{u} = \frac{1}{\rho}\sum_{q=0}^{8} f_q \vec{e}_q, \qquad f_q^{\text{eq}}(\rho, \vec{u}) = w_q \rho \left[ 1 + 3(\vec{e}_q \cdot \vec{u}) + \frac{9}{2}(\vec{e}_q \cdot \vec{u})^2 - \frac{3}{2}|\vec{u}|^2 \right]$$ $$f_q(\vec{x} + \vec{e}_q \Delta t,\; t + \Delta t) = f_q(\vec{x}, t) - \frac{1}{\tau}\Bigl(f_q(\vec{x}, t) - f_q^{\text{eq}}(\rho, \vec{u})\Bigr), \qquad \nu = c_s^2\left(\tau - \frac{1}{2}\right)\Delta t = \frac{1}{3}\left(\tau - \frac{1}{2}\right)$$

Notice that pressure emerges locally via the isothermal ideal-gas equation of state $p = c_s^2 \rho = \frac{1}{3}\rho$ – requiring zero global linear solves – while arbitrary curved no-slip solid obstacles reduce to a 1-line bounce-back rule $f_{\bar{q}}(\vec{x}_f, t+1) = f_q^*(\vec{x}_f, t)$!

The Classic BGK Stability Cliff ($\tau \to 0.5^+$): Because kinematic viscosity scales as $\nu = \frac{1}{3}(\tau - 0.5)$, dialing $\tau$ below $0.53$ to chase high Reynolds numbers causes non-hydrodynamic ghost modes to over-relax ($1 - 1/\tau \to -1$) and explode in checkerboard ringing – use regularized collision projection (E-RLBM, arXiv:2610.31072) or Multi-Relaxation-Time (MRT) moment damping for $\mathrm{Re} \gt 5000$.

1. Continuum Stable Fluids vs. Mesoscopic D2Q9 Lattice Boltzmann

Dimension Stable Fluids Jacobi (Previous Post) D2Q9 Lattice Boltzmann (BGK, arXiv:1512.02599)
Pressure Enforcement 20–40 global Jacobi Poisson passes per frame Purely local ideal-gas EOS $p = \frac{1}{3}\rho$ (1 pass/step!)
Complex Curved Obstacles Requires boundary normal projection & slip masks Trivial 1-line bounce-back $f_{\bar{q}} \leftarrow f_q^*$ on any voxel mask
GPU Memory Footprint 1 RGBA16F texture $(u_x, u_y, p, \text{dye})$ 3 RGBA16F MRT attachments (9 velocity populations $f_0..f_8$)