Lattice Boltzmann II

Validation and boundary conditions

Lars Pastewka

Learning objectives

  • Validate the solver by measuring its viscosity (shear-wave decay, milestone 4)
  • Implement rigid and moving walls via bounce-back boundary conditions
  • Simulate the lid-driven cavity, the classic benchmark (milestone 5)
  • Recognize the practical stability limits of the method

Recap: the lattice Boltzmann equation

\[f_i(\mathbf{x} + \mathbf{c}_i, t+1) = f_i(\mathbf{x}, t) - \omega\left[f_i - f_i^\text{eq}\right]\]

with the Chapman-Enskog viscosity

\[\nu = \frac{1}{3}\left(\frac{1}{\omega} - \frac{1}{2}\right)\]

This lecture: how to validate this relation and how to impose boundary conditions.

You wrote a solver – does it solve Navier-Stokes?

  • The code streams and collides populations \(f_i\) – nothing in it “looks like” Navier-Stokes
  • Strategy: compare against an analytical solution of the equations you claim to solve
  • Best test: measure a material property – the viscosity – and compare with the prescribed \(\nu(\omega)\)

Shear-wave decay

Initialize a sinusoidal perturbation on a periodic domain:

\[u_x(y, 0) = \varepsilon \sin\!\left(\frac{2\pi y}{L_y}\right)\]

with \(\varepsilon\) small (\(\sim 0.01\)) and \(\rho = 1\).

The decay law

Linearized Navier-Stokes (Stokes flow) reduces to momentum diffusion, so the amplitude decays exponentially:

\[ a(t) = \varepsilon\, e^{-\nu \zeta^2 t}, \qquad \zeta = \frac{2\pi}{L_y} \]

The decay rate contains only \(\nu\) and the known wavenumber \(\zeta\) – the viscosity is directly measurable.

Measuring the viscosity (milestone 4)

  • Record the amplitude \(a_\text{sim}(t)\) (sample at \(y^* = L_y/4\), or project onto the sine mode)
  • Fit \(\ln a_\text{sim}(t)\) vs. \(t\): slope \(m\) gives \(\nu_\text{sim} = -m/\zeta^2\)
  • Sweep \(\omega = 0.2, 0.4, \ldots, 1.8\) and plot \(\nu_\text{sim}(\omega)\)
  • Compare with \(\nu = \frac{1}{3}(1/\omega - 1/2)\) – deviations grow as \(\omega \to 2\)

Boundary conditions: overview

Boundary Rule Status
Periodic wrap indices during streaming milestone 2
Rigid wall bounce-back milestone 5
Moving wall bounce-back + momentum correction milestone 5
  • We impose conditions on the populations \(f_i\), not directly on \(\rho\) or \(\mathbf{u}\)
  • Notation: \(f_i^{\star}\) = post-collision (pre-streaming), \(f_i\) = post-streaming

Rigid wall: bounce-back

\[f_{\bar{i}}(\mathbf{x}_b, t+1) = f_i^{\star}(\mathbf{x}_b, t)\]

  • \(\bar{i}\) = opposite channel (\(\bar{1}=3\), \(\bar{2}=4\), \(\bar{5}=7\), \(\bar{6}=8\))
  • Wall sits halfway between node rows (“dry node”)
  • Realizes a no-slip condition

Moving wall

Bounced populations exchange momentum with the wall:

\[ f_{\bar{i}}(\mathbf{x}_b, t+1) = f_i^{\star}(\mathbf{x}_b, t) - 2 w_i \rho_w \frac{\mathbf{c}_i \cdot \mathbf{u}_w}{c_s^2} \]

  • \(c_s^2 = 1/3\); take \(\rho_w \approx \bar{\rho}\)
  • Wall moves parallel to its surface (mass conservation)

The lid-driven cavity

  • Square box; bottom and sides: bounce-back
  • Lid slides at \(u_\text{lid}\): moving-wall condition
  • No analytical solution – but a classic benchmark [Ghia, Ghia & Shin (1982)]
  • Run to steady state

Expected result (milestone 5)

  • Primary vortex off-center, shifted toward the lid
  • Secondary vortices in the bottom corners
  • Visualize with streamlines or velocity vectors

Gotcha: the corner nodes

The two top corner nodes belong to both a side wall and the moving lid – the boundary rules overlap.

  • Either: plain bounce-back at the corners, moving-wall correction only on the lid interior
  • Or: apply the lid velocity at the corners too
  • At low Mach number both give essentially the same flow – pick one and document it

Stability practicalities

  • Keep \(u_\text{lid} \ll c_s \approx 0.577\) – in practice \(u_\text{lid} \lesssim 0.1\) (low Mach number)
  • Keep \(\omega\) safely below 2: \(\nu \to 0\) means no damping of numerical noise
  • Blow-up looks like: checkerboard noise in \(\rho\), then NaN everywhere within a few steps
  • If unstable: lower \(u_\text{lid}\), lower \(\omega\), or refine the lattice

Summary

  • Validation: shear-wave decay measures \(\nu\); fit \(\ln a(t)\), sweep \(\omega\), compare with \(\frac{1}{3}(1/\omega - 1/2)\)
  • Boundary conditions act on populations: bounce-back (\(f_{\bar{i}} \leftarrow f_i^{\star}\)) gives no-slip walls
  • Moving walls add the momentum correction \(-2 w_i \rho_w (\mathbf{c}_i \cdot \mathbf{u}_w)/c_s^2\)
  • Lid-driven cavity: primary vortex toward the lid + corner vortices – milestone 5
  • Stay at low Mach number and \(\omega < 2\)

Reading