(theory_bc)= # Boundary Conditions (BC) Boundary nodes are those in the immediate vicinity of a numerical boundary. A boundary node carries many populations but only a few macroscopic quantities have physical meaning at the boundary, so defining a boundary condition in LBM is a question of which macroscopics to impose. In Nassu's macroscopic-storing RR-BGK solver this is the foundation of every boundary condition: a BC is **defined by the hydrodynamic moments imposed at the boundary node**, and the populations are reconstructed from those moments by the collision operator on the next step. The node positions coincide with the boundaries. This regularized, moment-based formulation is developed in the {ref}`Moment-Based Boundary Conditions ` page, which the per-type pages below specialise. Population bounce-back - reflecting individual populations across the link - is the local, viscosity-dependent legacy form. It places the wall half a node off the boundary, so it is documented alongside the moment-based families for completeness rather than as a co-equal method. ```{warning} **A subtle trap: edges and corners belong to more than one boundary.** A node shared by two faces would otherwise receive conflicting populations from each BC. Nassu resolves this by imposing a fixed overwriting order, applied first to last: SLIP (z) $\Rightarrow$ SLIP (y) and WALL (y) $\Rightarrow$ OUTLET and INLET Changing this order silently changes which BC wins at every edge and corner. To know more about this order and its impact, check *BC order validation test*. ``` These pages cover the boundary conditions that act directly on the fluid lattice. The boundary conditions specific to other modules live with their physics: turbulent inlets in the {ref}`Turbulent inflow ` chapter, near-wall stress closures in the {ref}`Wall model ` chapter, and scalar/thermal BCs in their respective chapters. The implemented fluid boundary conditions, as moment closures (impose / derive / reconstruct), are listed below: - Solid Wall : - Regularized (moment-based): impose $\mathbf{u}=\mathbf{0}$, fix density, derive the rate-of-strain from the one-sided finite difference, reconstruct populations. Node-coincident wall, increased stability; uses non-local interior values. - Halfway Bounce-Back (legacy, local): second-order accurate but the wall sits half a node off the boundary with a relaxation-time dependence. - Moving Wall : - Regularized (moment-based): impose $\mathbf{u}=\mathbf{u}_\mathrm{w}$, fix density, derive the stress, reconstruct. Same treatment as the no-slip wall with a non-null wall velocity. - Velocity Bounce-Back (legacy, local): second-order but steadily raises the domain-average density, which can destabilise long runs. - Free Surface : - Regularized Neumann (slip): impose zero normal velocity, fix density, zero-gradient the tangential velocity and stress. High stability and local. - Inlet : - Uniform Velocity: impose density and velocity, equilibrium state ($S_{\alpha\beta}=0$). Does not raise the average density; operates at constant density. - Turbulent inlets (SEM, PODFS): see the {ref}`Turbulent inflow ` chapter. - Outlet : - Regularized Neumann: fix the outlet density (pressure); take velocity and stress zero-gradient from the interior. Holds a stable domain-average density; place it far from regions of high pressure gradient. - Neumann: zero-gradient on all macroscopics including density, which keeps it flexible but does not guarantee a stable domain-average density. - Anti Bounce-Back (legacy, local): fully local and keeps a stable pressure, but with stability issues that can cause divergence. ```{toctree} --- caption: Boundary Conditions hidden: true maxdepth: 1 --- Moment-Based BCs Solid Wall Moving Wall Free Surface Inlet Outlet ```