(LBM-RRBGK)= # Lattice Boltzmann method The Lattice Boltzmann Method (LBM) is the numerical engine at the core of Nassu. Rather than discretizing the Navier-Stokes equations directly, it descends from kinetic gas theory: it tracks how a statistical distribution of molecular velocities evolves through collisions and transport, and recovers the macroscopic flow as a by-product. This page sketches that origin and the rest of the chapter builds it up, step by step, into the algorithm the solver actually runs on the GPU. The Lattice Boltzmann Method has its roots in kinetic gas theory, more specifically Boltzmann equation, which is written as: $$ \Omega\left(f\right) = \frac{\partial f}{\partial t} + \xi_{\alpha}\frac{\partial f}{\partial x_{\alpha}} + \frac{F_{\alpha}}{\rho}\frac{\partial f}{\partial \xi_{\alpha}} $$ (boltzmann_eq) In this approach, the flow space is defined as particles constantly colliding and changing its direction of motion. Such behaviour is quantified by the distribution function $f$, which represents the amount of particles at certain position and time, travelling at certain velocity $\xi_{\alpha}$. This consists in a mesoscopic representation, since it lies between the microscopic (where particles are considered individually) and macroscopic (where only the macroscopic fluid motion is perceived) scales. When all mesoscopic velocities are considered in a summation, it is possible to obtain the fluid macroscopic density $\rho$ at certain position through the integration of distribution function over mesoscopic velocity space. Similarly, higher order macroscopic moments can also be obtained from the distribution function and mesoscopic velocities. Thereby, it's possible to recover the macroscopic description from mesoscopic. The collision operator $\Omega\left(f\right)$ is a function that represents the constant collisions, modifying the distribution function value and leading to flow evolution, as illustrated below: ```{figure} /_static/img/theory/LBM/boltzmann_particles.svg --- align: center width: 80 % --- ``` The most usual collision operator is the Bhatnagar, Gross and Krook (BGK) {footcite}`bhatnagar1954model`, which uses a mean free-path treatment and expresses the fact that collisions tend to relax the distribution function towards an equilibrium value: $$ \Omega_{\mathrm{BGK}} = -\frac{1}{\tau}\left(f-f^{\mathrm{eq}}\right) $$ (BGK_collision) where $\tau$ is the relaxation time, and represents a suitable average collision time. The LBM aims to solve macroscopic conservation equations through the modelling and numerical solution of particle distribution functions. It discretizes both physical and velocity space in a lattice arrangement commonly referred as velocity set, as illustrated below: ```{figure} /_static/img/theory/LBM/velocity_set.svg --- align: center width: 70% --- ``` where the D2Q9 velocity set is defined for 2 dimensions and 9 directions while the D3Q19 for 3 dimensions and 19 velocity directions $\left\{c_{i\alpha}\right\}$, with $\mathbf{c_0} = \mathbf{0}$. ```{admonition} Why D3Q27 for LES --- class: note --- The solver also supports the D3Q27 velocity set, which is the preferred set for LES simulations with the RR-BGK collision operator: it carries enough directions to represent the full third-order moment exactly, where D3Q19 needs a correction. ``` For each direction a weight $\left\{w_{i}\right\}$ is attributed such that $\sum w_{i} = 1$. The distribution function is also separated for each direction being commonly referred to as "populations" $\left\{f_{i}\right\}$ in this discrete form. ```{note} In LBM, all mesoscopic variables are non-dimensional and flow characterization is performed through dimensionless parameters, for instance Reynolds number. ``` ## How to read this chapter The pages below form one continuous narrative, from kinetic theory to the practical unit system you use to set up a simulation. Read them in order: 1. {doc}`A Primer on Kinetic Theory ` introduces the distribution function $f$, shows that density, velocity and stress are its velocity moments, presents the Maxwell-Boltzmann equilibrium, and explains the BGK relaxation idea. Start here if the words "mesoscopic" or "distribution function" are new to you. 1. {doc}`Lattice Boltzmann Equation ` discretizes the velocity space. It motivates the Hermite expansion and Gauss-Hermite quadrature, which is what *produces* the discrete velocity sets D2Q9, D3Q19 and D3Q27 and their weights, and assembles the collide-and-stream algorithm. 1. {doc}`Collision Operators ` builds from plain BGK to the recursive regularized operator (RR-BGK) that Nassu uses in production, explaining why regularization is needed for stable LES, and ends with the memory-efficient moment-only collision. 1. {doc}`From the Lattice to Navier-Stokes ` is the centerpiece: a guided Chapman-Enskog derivation that recovers continuity and Navier-Stokes from the lattice equation and pins down the viscosity-relaxation relation. 1. {doc}`Macroscopics ` revisits $\rho$, $u_\alpha$, $\Pi_{\alpha\beta}^{\mathrm{neq}}$ and $S_{\alpha\beta}$ and their moment definitions, connecting the Chapman-Enskog results to the quantities the solver stores. 1. {doc}`Physical and Lattice Units ` is the most practical page: how to map metres and seconds to lattice units, how to choose $\tau$, $\Delta x$ and $\Delta t$, the Reynolds and Mach constraints in practice, and a fully worked conversion example. 1. {doc}`Compressible LBM ` extends the method to non-isothermal and high-Mach flows, relaxing the weakly-compressible assumption. 1. {doc}`Porous media ` adds a volumetric momentum sink as a body force, combining a linear Darcy term and a quadratic Forchheimer/canopy term, used to model a porous medium or vegetation canopy and as an outlet sponge that damps pressure waves. 1. {doc}`Boundary conditions ` covers the boundary conditions that act directly on the fluid lattice: solid walls, moving walls, free surfaces, the uniform-velocity inlet, and outlets. Module-specific BCs (turbulent inlets, wall-model stresses, scalar and thermal boundaries) live with their respective chapters. ```{eval-rst} .. footbibliography:: ``` ```{toctree} --- caption: Lattice Boltzmann Method hidden: true maxdepth: 1 --- A Primer on Kinetic Theory Lattice Boltzmann Equation Collision Operators From the Lattice to Navier-Stokes Macroscopics Physical and Lattice Units Compressible LBM Porous media Boundary conditions ```