Skip to content

Lattice Boltzmann D2Q9

Learning goal

Convince yourself that the strangest claim in Chapter 7 is true: the viscosity of a lattice Boltzmann fluid is a prediction, not an input. You never tell the solver what \(\nu\) is. You set a relaxation time \(\tau\), and the Chapman–Enskog expansion says the fluid that emerges will have \(\nu = c_s^2(\tau - \tfrac12)\). Then you measure it.

Things to try

  1. Let the channel converge, then read the two viscosity rows. The measured value tracks \(c_s^2(\tau-\tfrac12)\) to well under a percent. Nothing in the code computes a viscous stress — there is only streaming, a local relaxation toward equilibrium, and a body force. Navier–Stokes is an emergent property of that loop.

  2. Sweep \(\tau\) from 0.6 to 1.5. Agreement stays good but degrades at the top end, reaching about 1% near \(\tau = 1.5\). That is not sloppiness: halfway bounce-back places the wall exactly midway between nodes only in the limit of small \(\tau\), and BGK develops a viscosity- dependent slip that shifts the effective wall position. Chapter 7 plots precisely this drift. A "converged" answer that moves when you change a numerical parameter is telling you something physical about your boundary condition.

  3. Push \(\tau\) toward 0.5. \(\nu \to 0\), so \(Re\) climbs — and the solver gets closer and closer to instability. The BGK relaxation is only stable for \(\tau > \tfrac12\), and the margin evaporates exactly where you most want to be (high Reynolds number). This single constraint is why so much LBM research is about better collision operators (MRT, regularised, entropic) rather than about better physics.

  4. Watch the Mach number. LBM's equilibrium is a Hermite expansion truncated at second order, so it is only a low-Mach fluid. Keep \(u/c_s \lesssim 0.1\); above that the truncation error appears as a spurious compressibility that no amount of grid refinement removes.

  5. Switch to the cylinder. Below \(Re \approx 47\) the wake is a steady, symmetric pair of attached vortices. Push past it and the symmetry breaks: alternating vortices shed into a von Kármán street at a Strouhal number near 0.2 — one of the most robust numbers in fluid dynamics, and a free validation case for any new solver.

  6. Note what the solid boundary costs. The cylinder is drawn on the lattice by marking cells solid and reflecting populations — bounce-back, four lines of code. The staircase geometry this creates is LBM's great practical advantage (complex geometry is nearly free) and its notorious weakness (the boundary is only first-order accurate unless you work harder).

The lattice is not an ansatz

The nine velocities and their weights \(\tfrac49\), \(\tfrac19\), \(\tfrac1{36}\) look like fitted constants. They are the abscissae and weights of the third-order Gauss–Hermite quadrature of velocity space: the continuous moment integral \(\int f\psi\,d\mathbf{v}\) is being replaced by a quadrature that is exact for polynomials up to third order. The widget's lattice satisfies

\[\sum_i w_i = 1,\quad \sum_i w_ic_{i\alpha} = 0,\quad \sum_i w_ic_{i\alpha}c_{i\beta} = c_s^2\delta_{\alpha\beta}, \quad \sum_i w_ic_{i\alpha}c_{i\beta}c_{i\gamma}c_{i\delta} = c_s^4(\delta\delta + \delta\delta + \delta\delta)\]

to machine precision, with \(c_s^2 = 1/3\) falling out of the quadrature rather than being chosen. Change the weights and you do not get a different fluid — you get a lattice that fails the moment conditions and recovers no fluid at all.

The D2Q9 lattice · Chapman–Enskog · Thermal LBM & convection · Variable transport · Verification & validation · Viscosity (PC316) · Reynolds number (PC316)