(macroscopics)= # Macroscopics This page collects the macroscopic quantities the solver works with and gives each one its discrete moment definition. It is the practical companion to the {ref}`Chapman-Enskog ` derivation: that page proved *which* equations the lattice recovers and *why*; this page lists *what* you read off the populations to evaluate them. The kinetic primer set the pattern that every macroscopic is a velocity moment of the distribution; here that pattern becomes finite sums over the discrete populations. Through a Chapman-Enskog expansion {footcite}`chapman1970mathematical` it is possible to recover the following macroscopic balance equations from LBE: $$ \begin{aligned} &\partial_t\rho + \partial_\alpha\left( \rho u_\alpha \right) = 0 \\ &\partial_t\left(\rho u_\alpha\right) + \partial_\beta\left(\rho u_\alpha u_\beta\right) = - \partial_\alpha p + \partial_\beta\left[\eta\left(\partial_\alpha u_\beta + \partial_\beta u_\alpha\right)\right] + F_\alpha \end{aligned} $$ (baleqs) ```{note} These equations use **index (Einstein) notation**: a Greek subscript such as $\alpha$ runs over the spatial directions $x, y, z$, and any index repeated within a term is implicitly summed over, so $\partial_\alpha u_\alpha$ means $\partial_x u_x + \partial_y u_y + \partial_z u_z$. It is a compact way to write vector and tensor equations; see [Einstein notation](https://en.wikipedia.org/wiki/Einstein_notation). ``` such that the fluid's dynamic viscosity can be related to LBM mesoscopic variables as: $$ \eta = \rho c_s^2\Delta t\left(\frac{1}{\omega} - \frac{1}{2}\right) $$ (visc) ```{admonition} Valid only at low Mach --- class: important --- > This recovery holds only at low Mach number, $\mathrm{Ma} = u_{\mathrm{max}}/c_s$. The compressibility error grows as $\mathrm{Ma}^2$, so the maximum velocity must be controlled; the practical working threshold used throughout the solver is $\mathrm{Ma} < 0.1$, derived on the {ref}`Chapman-Enskog ` page. ``` Each of the four macroscopics below plays a distinct role, and each is a moment of the populations, in the exact sense introduced in the kinetic primer: - **Density** $\rho$ is the zeroth moment. It also fixes the pressure through the ideal-gas relation $p = \rho c_s^2$ recovered in the Chapman-Enskog analysis, so there is no separate pressure variable to solve for. - **Velocity** $u_\alpha$ is the first moment, corrected by half a force step (the Guo correction) so that the second-order accuracy of the scheme is preserved when a body force is present. - **Non-equilibrium stress** $\Pi_{\alpha\beta}^{\mathrm{neq}}$ is the second moment of the *non-equilibrium* part of the populations. The Chapman-Enskog analysis identified this object as the carrier of the viscous stress (it is the $\Pi_{\alpha\beta}^{(1)}$ of {eq}`ce_pi1`). - **Rate-of-strain** $S_{\alpha\beta}$ is obtained algebraically from $\Pi_{\alpha\beta}^{\mathrm{neq}}$, with no finite differences. It is the input the Smagorinsky subgrid model needs, which is why an LBM-LES can compute its turbulent viscosity locally and cheaply. Macroscopics such as the density $\rho$ and velocity are recovered from the population moments: $$ \sum_{i=0}^{q-1}f_{i}=\rho, $$ (macr_fmom_1st) $$ \sum_{i=0}^{q-1}f_{i}c_{i,\alpha}=\rho u_{\alpha}-\frac{\Delta t}{2}F_{\alpha}, $$ (macr_fmom_2nd) We also define the second-order moment of non-equilibrium populations: $$ \Pi_{\alpha\beta}^{\mathrm{neq}} = \sum_{i} f_{i}^{\mathrm{neq}}c_{i\alpha}c_{i\beta} $$ (pi_neq) and the rate-of-strain is computed from the second-order moment of non-equilibrium populations: $$ S_{\alpha\beta} = - \frac{\omega}{2 \rho c_s^2 \Delta t} \left[ \Pi_{\alpha\beta}^{\mathrm{neq}} + \frac{\Delta t}{2}\left( F_\alpha u_\beta + F_\beta u_\alpha \right) \right] $$ (strain) ```{note} The **rate-of-strain tensor** $S_{\alpha\beta}$ measures how fast a fluid element is deforming: it is the symmetric part of the velocity-gradient tensor, $S_{\alpha\beta} = \tfrac{1}{2}(\partial_\alpha u_\beta + \partial_\beta u_\alpha)$. Its magnitude is what drives the Smagorinsky subgrid viscosity in the LES model. See [strain-rate tensor](https://en.wikipedia.org/wiki/Strain-rate_tensor). ``` In return, the second-order moment of non-equilibrium populations $\Pi_{\alpha\beta}^{\mathrm{neq}}$ can be calculated from the rate-of-strain tensor with: $$ \Pi_{\alpha\beta}^{\mathrm{neq}} = - \frac{2 \rho c_s^2 \Delta t}{\omega}S_{\alpha\beta} - \frac{\Delta t}{2}\left( F_\alpha u_\beta + F_\beta u_\alpha \right) $$ (pineqfromstrain) This last relation is the bridge back to the LES model: the Smagorinsky subgrid viscosity is computed from $S_{\alpha\beta}$, and the modified relaxation it implies is fed back through $\Pi_{\alpha\beta}^{\mathrm{neq}}$. ## Next steps Everything so far has been written with $\Delta x = \Delta t = 1$. The next page makes that convention explicit and shows how to convert between these lattice units and physical metres and seconds for a real simulation. ```{eval-rst} .. footbibliography:: ```