Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Turbulence

A fluid step can add a subgrid eddy viscosity to the lattice Boltzmann flow: a large-eddy simulation with Smagorinsky’s model or Vreman’s. Smagorinsky’s eddy viscosity of each cell follows from its own non-equilibrium momentum flux in closed form, with no finite differences; Vreman’s from the finite-difference velocity gradient of its neighbours, and it vanishes in laminar shear. Either raises that cell’s relaxation time. Near no-slip walls the model can be damped with Van Driest’s mixing length, or the wall cells can be rebuilt from a law of the wall for grids that do not resolve the wall.

Commandsmodel.step.create (turbulence of a fluid procedure), solve.fluid
Step procedure"fluid" with "turbulence": {"type": "smagorinsky", …} or {"type": "vreman", …}
Solvercrates/lbm (CPU, f64); crates/lbm-gpu (GPU, f32) for both models, Van Driest’s damping and the wall models
MethodSmagorinsky 1963 with Hou et al.’s local relaxation time (1996); Vreman 2004; Van Driest damping (1956) with Spalding’s law (1961); wall model of Malaspinas & Sagaut (2014)
Verified bycrates/lbm/tests/turbulence.rs, crates/lbm/tests/mrt.rs, crates/lbm/tests/vreman.rs, crates/lbm-gpu/tests/verification.rs, crates/lbm/tests/sa_channel.rs (Spalart–Allmaras); Re_τ 180 channel studies (docs/verification.md)

Synopsis

{"name": "Flow", "procedure": {
  "type": "fluid", "domain": "Channel", "end_time": 2.0,
  "collision": "regularized",
  "turbulence": {"type": "smagorinsky", "constant": 0.1, "prandtl": 0.9, "van_driest": 26}
}}

Vreman’s model takes the same fields but van_driest:

"turbulence": {"type": "vreman", "constant": 0.18}

The Spalart–Allmaras model is a Reynolds-averaged one and takes inflow_ratio (ν̃/ν at inflows and in the initial field, 3 by default) instead of a constant:

"turbulence": {"type": "spalart_allmaras", "inflow_ratio": 3}

model.step.create takes these fields; solve.fluid runs the step. The wall model replaces van_driest with "wall_model": "musker" (Large-eddy simulation).

Parameters

FieldValueDefaultMeaning
turbulence.type"smagorinsky", "vreman", "spalart_allmaras"requiredThe subgrid model, or the Reynolds-averaged Spalart–Allmaras model. Without turbulence the step has no eddy viscosity.
turbulence.constantabove 0, at most 0.5requiredSmagorinsky’s constant C. 0.1 to 0.2 is usual; 0.17 is Lilly’s value for isotropic turbulence. For vreman, the Smagorinsky-equivalent C_s of Vreman’s c = 2.5 C_s² (0.17 gives his c = 0.07; Jacob et al. 2018 use 0.18).
turbulence.inflow_ratioat least 03spalart_allmaras only: ν̃/ν at the inflows and in the initial field (3 is the value of NASA’s Turbulence Modeling Resource). With 0 the model gives no eddy viscosity and the flow equals the model off bit for bit.
turbulence.prandtl0.1 to 100.9Turbulent Prandtl number Pr_t of the turbulent heat diffusivity ν_t / Pr_t (with heat only). 0.85 to 0.9 is usual for air and water.
turbulence.van_driest1 to 100noneVan Driest’s A⁺: damps the length scale near no-slip walls. 26 is Van Driest’s value. Smagorinsky’s model only: Vreman’s needs no damping, and the field is refused with it.
turbulence.wall_model"musker", "spalding_bounce", "spalart_allmaras_bounce", "spalding_bounce_matched", "spalding_bounce_halfway"none"musker" rebuilds each fluid cell next to a no-slip wall from Musker’s profile, for a first cell above the viscous sublayer (y⁺ 30 to 100). "spalding_bounce" is Han, Ooka and Kikumoto’s wall-function bounce as their eq. 14 states it (2021), on-node: the outermost cell layer at each plane no-slip box face is the wall (the wall plane through its centres, so a channel 2δ wide is 2δ + Δx high), bounces back and sends into the fluid the specular images of its incoming diagonals less the stress of Spalding’s law at the interior node one cell above; CPU and GPU, the box periodic along the walls, no obstacles, moving walls or heat. "spalart_allmaras_bounce" is the same wall with the Spalart–Allmaras model’s own constant-stress law in place of Spalding’s (spalart_allmaras turbulence only, and the only wall model it takes). "spalding_bounce_matched" is the same on-node wall with Spalding’s law read four cells from the wall and the three rows below relaxed by Malaspinas and Sagaut’s mixing length; CPU and GPU, with Smagorinsky’s or Vreman’s model but no van_driest, the box at least 9 cells across its walls. "spalding_bounce_halfway" is disabled because its wall-row checkerboard mode grows. Files preserve this selection when loaded, but solves refuse it at setup. Remove wall_model for resolved no-slip walls, or explicitly select and validate a supported treatment; the on-node variant changes the wall location.
collision"trt", "regularized", "mrt", "hrr""trt"Either model runs with every collision (Collision operators); with hrr the finite-difference stress uses the cell’s τ̄ with its eddy viscosity.

A value outside its range is refused when the step is set up, naming the range. With a turbulence model the fluid’s own symmetric relaxation time τ⁺ may go down to 0.5001 (MIN_TAU_TURBULENT; 0.50354 with "mrt", its stability bound; the Spalart–Allmaras model with inflow_ratio 0 gives no eddy viscosity and keeps 0.505); without one the floor is 0.505 and the refusal suggests adding turbulence.

Theory

Eddy viscosity. Smagorinsky’s model adds

ν_t = (C Δx)² |S|,   |S| = √(2 S:S)

with the filter width the lattice spacing Δx and S the local strain-rate tensor. In lattice units (Δx = Δt = 1, c_s² = ⅓) the non-equilibrium momentum flux of a cell is

P = Σ_q c_q c_q f_q − ρ (c_s² I + u u) + ½ (u F + F u)  ≈  −2 ρ c_s² τ S

the flux Guo’s forcing ties to the strain rate. The cell’s relaxation time τ = τ₀ + 3 ν_t then solves a quadratic (Hou et al. 1996), with |P| = √(P:P):

τ = ½ (τ₀ + √(τ₀² + 18 √2 C² |P| / ρ))

so τ ≥ τ₀, with τ = τ₀ where the flow does not shear. The model is built on the regularised collision’s flux (Malaspinas & Sagaut 2012).

Vreman’s model. A. W. Vreman (2004) builds the eddy viscosity from the velocity gradient α_ij = ∂_i u_j so that it vanishes for exactly the locally laminar flows whose theoretical subgrid dissipation is zero:

ν_t = c √(B_β / (α_ij α_ij)),   β_ij = Δx² Σ_m α_mi α_mj,
B_β = β₁₁β₂₂ − β₁₂² + β₁₁β₃₃ − β₁₃² + β₂₂β₃₃ − β₂₃²,   c = 2.5 C_s²

and ν_t = 0 where α = 0. B_β is the second invariant of the positive semidefinite β, a sum of squared 2 × 2 minors of α (computed that way, so never negative): ν_t is zero wherever the gradient has rank one, as in plane Couette and Poiseuille flow, any simple shear and at a no-slip wall in pure shear, so no wall damping is needed. A rigid rotation, u = Ω (−y, x, 0), is not in that set: ν_t = c Δx² |Ω| / √2. α comes from the same differences of the neighbours’ velocities as the hybrid collision’s strain rate (hrr::gradient): second-order centred, first-order one-sided next to a cell that is not fluid or a face that is not periodic, 0 with neither neighbour. The velocities come from a pass over every fluid cell before the collision, so the eddy viscosity is explicit (this step’s neighbours), where Smagorinsky’s is implicit in the cell’s own flux. The cell relaxes with τ̄ = 3 (ν + ν_t) + ½, per collision as below; a modelled wall cell keeps the wall model’s rate, and with heat α_t = ν_t / Pr_t as for Smagorinsky’s.

Dynamic σ. With collision: "hrr" and sigma: "dynamic", either model’s ν_t sets the hybrid collision’s σ per cell instead of entering τ (Collision operators, “Hybrid recursive regularised”); eddy_viscosity_ratio then reports the model’s ν_t. The von Kármán length |∇u|/|∇²u| that scales ν_t there is capped at the box’s shortest extent in cells, our guard for near-uniform regions where ∇²u vanishes (eq. 50 alone would give σ = 0 for any ν_t > 0); and Smagorinsky’s ν_t is 0 below the flux’s round-off (crates/lbm/src/turbulence.rs).

Per collision. With two relaxation times the symmetric rate takes the cell’s τ and the antisymmetric one follows, keeping Λ = (τ⁺ − ½)(τ⁻ − ½). The regularised collision relaxes its rebuilt non-equilibrium part with the cell’s τ. The multiple-relaxation-time collision replaces the rate of its five stress moments with the cell’s, as in Malaspinas & Sagaut’s eqs. 47–48.

Turbulent heat diffusivity. With heat, each cell’s turbulent diffusivity α_t = ν_t / Pr_t (the Reynolds analogy) adds to the scalar lattice’s relaxation time, τ_T = 4 (α + α_t) + ½; τ_T⁺ follows with Λ_T kept, and a cell on a single relaxation time stays on one (Heat transfer).

Van Driest damping. Smagorinsky’s eddy viscosity is largest where the shear is, at the wall, where the turbulence it stands for is suppressed, so the wall friction comes out too high. Van Driest’s mixing length damps it over the viscous sublayer:

l = C Δx (1 − exp(−y⁺/A⁺)),   y⁺ = y u_τ / ν

Wall distance. Every fluid cell with a no-slip bounce-back link is a wall cell; its wall lies halfway along the link, and the nearest such point (an axis link first, then the lowest direction) is its wall point and gives the wall’s normal. Each other fluid cell takes the nearest wall point of its 26 neighbours, spread outward in cell order until no distance shrinks (vector propagation, Danielsson 1980): exact for plane walls, within a fraction of a cell elsewhere.

Friction velocity. Each wall cell’s u_τ solves Spalding’s law of the wall at its distance y, from its speed parallel to the wall relative to the wall’s own velocity:

y⁺ = u⁺ + e^{−κB} (e^{κu⁺} − 1 − κu⁺ − (κu⁺)²/2 − (κu⁺)³/6),   κ = 0.4, B = 5.5

the sublayer u⁺ = y⁺ where the wall cell lies in it and the log law above. Every cell is damped with the u_τ of the wall cell its wall point belongs to. A still flow over a still wall has u_τ = 0, which damps the eddy viscosity fully.

Wall model. On a grid whose first cell lies above the viscous sublayer, the bounce-back cannot carry the wall stress and damping cannot help. The wall model (wall_model: "musker") samples the velocity at the second cell off the wall, solves Musker’s profile for u_τ there, and rebuilds every population of the wall cell from the profile’s velocity at the first cell, its density and its regularised stress; the cell relaxes with a mixing-length eddy viscosity (κ = 0.384, A⁺ = 26) in place of Smagorinsky’s. The method, its parameters, its reported wall force and its validation are in Large-eddy simulation.

Spalart–Allmaras model

A one-equation Reynolds-averaged model (Spalart and Allmaras 1994, with the f_t2 term, the limited S̃ and the negative form of Allmaras, Johnson and Spalart 2012). ν̃ is transported on the lattice cells (first-order upwind advection in advective form, conservative central diffusion, bounded, sub-stepped where its coefficients need it), and ν_t = ν̃ f_v1 enters every collision through the same explicit-rate route as Vreman’s model. Each cell reads its exact distance to the nearest no-slip wall (a separable distance transform, Felzenszwalb and Huttenlocher 2012; it crosses periodic faces). ν̃ is part of a checkpoint.

Without a wall model, walls are halfway bounce-back, ν̃ = 0 on them, and the boundary layer must be resolved (the first cell’s centre at y⁺ 1 or below). In a wall-resolved channel at Re_τ 180 the lattice solution converges at second order to the model’s own 1-D solution, which differs from Moser, Kim and Mansour’s DNS by +1.1 % in bulk velocity, +0.8 % at the centre line and −2.1 % in skin friction: the model’s error, not the solver’s (verification). On resolved walls the fluid keeps the laminar floor on τ⁺ (0.505): ν_t goes to 0 at a wall, so it does not hold the wall cells stable as a subgrid model’s does. It does not add to a subgrid model, it replaces one.

Its own wall law (wall_model: "spalart_allmaras_bounce", crates/lbm/src/sa_law.rs). In a layer of constant total stress χ = κ y⁺ solves the model’s steady equation exactly at every height (S̃ = u_τ/(κ y), r = 1, f_w = 1, the f_t2 terms cancel, and c_w1 = c_b1/κ² + (1 + c_b2)/σ balances the rest: Spalart and Allmaras, AIAA-92-0439, 1992, sections “Near-wall region, high Reynolds number” and “finite Reynolds number”, eqs. 7–9; the same model as their 1994 paper). The velocity that goes with it is u⁺(y⁺) = ∫₀^y⁺ dy/(1 + κ y f_v1(κ y)), with nothing fitted: u⁺ = y⁺ in the sublayer, the log law with κ 0.41 and the intercept 5.033 above (derived from the integral, not chosen). With x = κ y the integrand is (x³ + a)/(x⁴ + x³ + a), a = c_v1³, so the integral is evaluated in closed form (the quartic factored into two real quadratics, partial fractions, two logarithms and two arctangents), and u_τ is inverted by bisection at the geometric mean of a bracket, at most 62 steps (the starting bracket spans less than 2⁹ in ln y⁺, and 52 more halvings reach the last bit). The wall is Han et al.’s on-node wall (below): each boundary node takes ρ u_τ² of this law at its interior node one cell away, and after ν̃’s transport the interior node’s ν̃ is set to κ u_τ y, the model’s exact value there. The boundary nodes are outside ν̃’s field; the interior node’s face to its node is a wall one cell away (ν̃ = 0 on the node), and the wall distance is measured from the node plane. The boundary nodes do not collide and the first cells that do carry the law’s ν_t, so with the regularised and hybrid collisions the fluid’s own τ⁺ may go down to 0.5001, as with a subgrid model; the TRT collision keeps 0.505 (it is unstable in an oblique stream near the lower floor, #1063). The split is the same as with spalding_bounce (#1101): each node hands the fluid the law’s stress less its half cell’s body force, ½ ρ a, and takes that force back with its momentum, so the walls carry the whole body force of the box, a δ per wall, for either law (the split is applied after the law’s dispatch). In the 1-D model of the lattice channel at Re_τ 1000 the law’s own error at y⁺ 62 and 100 is +1.2 % and +2.2 % of C_f against the wall-resolved model, the figures the sa-wall notes give. Limitation: the law assumes the first node lies in a log layer of constant stress, y₁ ≪ δ. At Re_τ 182 the first node at y⁺ 30 or 61 is a sixth or a third of the way to the centre line, and C_f is +19 % or +41 % above the wall-resolved model’s; use it where the first node is a small fraction of δ. The channel against the wall-resolved model and Lee and Moser is in verification.

Refused, with a message that names the model: another wall model (musker, spalding_bounce: another law’s stress would disagree with the ν̃ the model keeps at the wall), interpolated walls and the hybrid collision’s dynamic σ (both backends); on the GPU also heat, fans and porous zones, and a box face with two kinds of cell (an inlet patch). backend: "cpu" runs these.

On the GPU each sub-step’s Δt is chosen on the device from that sub-step’s largest coefficient sum, by the CPU’s rule (parts = ⌈largest sum × time left⌉, Δt = time left / parts, so Δt Σ coefficients ≤ 1), with at most 64 sub-steps per time step; a time step that needs more is refused, as on the CPU. In single precision the product Δt × largest sum is checked and one more part taken where it is not below 1.

Algorithm

Each time step, before the collision:

  1. Damping (van_driest). Each wall cell’s u_τ is solved from Spalding’s law, in parallel, each wall cell’s its own: u⁺ y⁺(u⁺) = U y / ν is bracketed between 0 and √(U y / ν), started at the log law, and refined by Newton steps guarded by bisection, at most 100 (SPALDING_ITERATIONS). A speed or a Reynolds number that is not a positive finite number gives u_τ = 0.
  2. Wall model (wall_model). With "musker", each wall cell whose second cell is fluid inside the box samples that cell’s velocity and stores its modelled velocity and relaxation rate. A wall cell whose second cell is not fluid inside the box keeps the bounce-back alone. With "spalding_bounce" (Han et al.‘s eq. 14, crates/lbm/src/bounce.rs), each boundary node (the outermost cell layer at a wall face; the wall passes through its centre) takes the stress τ = ρ u_τ² along the velocity parallel to the wall of the interior node one cell above it, u_τ the root of Spalding’s law with κ 0.41 and B 5.5 at y = Δx, ρ that node’s density. The boundary nodes do not collide: after the fluid cells’ collision each runs eq. 14 instead (axis and wall-parallel populations bounced back; each diagonal into the fluid the specular image of the one arriving from the fluid, ∓τ/2 along the wall; each diagonal into the wall its opposite’s value; the rest population kept). The streaming is unchanged; populations that would arrive from outside the box are replaced by the images of those from the fluid (they reach only the populations that leave the box), so each node keeps its mass. The node hands the fluid the stress less its half cell’s body force, ½ ρ a (a the body acceleration of its cell, ρ the interior node’s density): the node’s cell spans half a cell into the fluid, and the balance of mean forces in a fully developed channel (S. B. Pope, Turbulent Flows, Cambridge University Press 2000, doi:10.1017/CBO9780511840531) gives the stress at the half cell’s inner face as τ_w − ½ ρ a Δx. The wall’s force is the momentum the nodes take from the fluid plus that ½ ρ a: τ along the wall per node and step, to round-off, and 2 Σ f + ½ ρ a_n along the normal, so the walls carry the whole body force of the box (issue #1101). In a laminar channel the profile is the Poiseuille parabola shifted by the slip a Δx²/(2ν) (the law’s u_1 = a δ Δx / ν against the parabola’s a (δ − ½Δx) Δx / ν); the slip alone raises the bulk speed by 6/(M(M+1)), M = 2N the wall-to-wall cells: 8.3 %, 2.2 % and 0.57 % at N = 4, 8, 16. The test the_laminar_on_node_profile_is_the_parabola_shifted_by_the_slip pins it, to the weakly compressible bound 9 u_max³. The recorded wall force is the two-step mean of the per-step total (flux + ½ ρ a). The boundary nodes are no fluid cells: no eddy viscosity, no part in their neighbours’ finite-difference gradients (one-sided there), left out of the cell count, the mass, the mean velocity and the fields. With damping, the interior nodes are the wall cells, one cell from the wall. The GPU runs the same scheme (node_bounce; GPU backend, “Han et al.’s on-node wall-function bounce”), within 10⁻⁴ of the CPU’s velocity and 10⁻³ of its wall drag from the first step.
  3. Collision. For each fluid cell: the flux P from its populations; the cell’s constant C, scaled by 1 − exp(−y⁺/A⁺) with damping (taken as 1 from y⁺/A⁺ = 40, where it rounds to 1); the cell’s rate from the closed form above, or the fluid’s own rate where the result is not a finite number at least τ₀ (a zero or hostile flux or density); a modelled wall cell relaxes with its wall-model rate instead. The cell’s ν_t = (τ − τ₀) / 3 is kept for the reply’s maximum and, with heat, for the scalar lattice.
  4. Heat. The scalar lattice collides each cell with τ_T raised by 4 ν_t / Pr_t.

The wall distances are spread once, when the flow is built. The spreading may lower each cell’s distance at most 64 times on average (MAX_UPDATES_PER_CELL); past that the run is refused with Limit (“the wall distances did not settle”). Damping and the wall model build the wall cells from the no-slip links only: slip faces have no friction and are left out.

If a damped run goes unstable, its error adds the largest first-cell y⁺, stating that the grid does not resolve the wall when it is past y⁺ 5.

Output

solve.fluid adds to its reply:

FieldMeaning
eddy_viscosity_ratioThe largest ν_t / ν over the fluid cells in the last step (null without a turbulence model). Under the wall model it includes the wall cells’ mixing-length viscosity.
warningsWith damping, a warning when the first cells off the walls reached y⁺ above 5 at the end of the run: the grid does not resolve the wall.

The flow fields, wall forces, heat and the steady-state report are those of any fluid step (Fluid results). A turbulent flow never settles to a tolerance; the running mean stop rule (steady.averaging) is described in Steady state and averaging.

Worked example

The flow-past sample (air past an L-bracket on the floor) with its inlet speed raised from 25 mm/s to 100 and 200 mm/s, solved with and without Smagorinsky’s model. On the sample’s 2.5 mm grid the relaxation time falls toward ½ as the speed rises; the model decides whether the run is accepted and whether it stays stable.

Geometrythe upright L-bracket (60 × 40 × 50 mm, upright facing the inlet) on the floor of a 240 × 120 × 100 mm box
Cells2.5 mm: 184 320 (182 304 fluid)
Fluidair, ρ = 1.2 kg/m³, μ = 1.8 × 10⁻⁵ Pa s
Boundariesx_min velocity U, x_max pressure 0, floor no-slip, sides and top slip; initial velocity U
CasesU = 100 mm/s (Re 333 on the 50 mm upright, τ = 0.509), 4 s; U = 200 mm/s (Re 667, τ = 0.5045), 2 s; both 3 200 steps, ten frames
Turbulencenone, or {"type": "smagorinsky", "constant": C} with C = 0.1 and 0.17
Collisiontrt, regularized, mrt
Unitsmm, t, s, N, MPa

The 200 mm/s case with C = 0.17 (the others change velocity, initial_velocity, end_time, collision and turbulence, or leave turbulence out):

[
  {"command": "file.sample", "params": {"name": "flow-past"}},
  {"command": "model.fluid_domain.edit", "params": {"name": "Wind", "material": "Air",
    "min": [-60, -40, 0], "max": [180, 80, 100], "spacing": 2.5,
    "faces": {"x_min": {"type": "velocity", "velocity": [200, 0, 0]}, "x_max": {"type": "pressure", "pressure": 0},
              "y_min": {"type": "slip"}, "y_max": {"type": "slip"}, "z_min": {"type": "wall"}, "z_max": {"type": "slip"}},
    "obstacles": ["Bracket"], "initial_velocity": [200, 0, 0]}},
  {"command": "model.step.edit", "params": {"name": "Flow", "procedure": {"type": "fluid", "domain": "Wind",
    "end_time": 2, "frames": 10, "collision": "regularized",
    "turbulence": {"type": "smagorinsky", "constant": 0.17}}}},
  {"command": "solve.fluid", "params": {"backend": "cpu"}},
  {"command": "results.slice", "params": {"field": "velocity", "axis": "y", "position": 20}},
  {"command": "results.streamlines", "params": {"show": false}}
]

Results from the solve.fluid replies (Apple M4 Max, CPU; each completed run 9–16 s). The drag is the x component of the bracket’s face forces summed, mean over the last quarter of the run; eddy_viscosity_ratio is the largest ν_t / ν in the last step.

U = 200 mm/s, regularised collision:

TurbulenceOutcomeeddy_viscosity_ratioDrag (mean)max_speedmass.relative_change
nonerefused: “the relaxation time τ = 0.50450 is below 0.505: the grid cannot resolve viscosity 0.000015 at this time step (cell Reynolds number 33.3); … or add a turbulence model (turbulence)”————
C = 0.1completed0.9801.00056 × 10⁻⁴ N443.8 mm/s−1.94 × 10⁻³
C = 0.17completed1.8379.9395 × 10⁻⁵ N414.4 mm/s−1.70 × 10⁻³

Both completed runs carry the warning that τ = 0.5045 is below 0.508, where even the regularised collision went unstable on a coarse bluff-body grid.

U = 100 mm/s:

CollisionTurbulenceOutcomeeddy_viscosity_ratioDrag (mean)
trtnoneunstable at time step 668——
trtC = 0.1unstable at time step 837——
trtC = 0.17completed; warnings: τ = 0.5090 close to ½, density varies by 30.6 %2.8562.2099 × 10⁻⁵ N
regularizednonecompleted—2.4658 × 10⁻⁵ N
regularizedC = 0.1completed0.3182.4909 × 10⁻⁵ N (+1.0 %)
regularizedC = 0.17completed0.9202.5358 × 10⁻⁵ N (+2.8 %)
mrtC = 0.17unstable at time step 130 (lattice speed 0.509)——

What to look at. At 200 mm/s the fluid’s own τ⁺ = 0.5045 is below the 0.505 floor and the step is refused; with the model the floor is 0.5001 (MIN_TAU_TURBULENT) and the run completes. The eddy viscosity scales with C²: from C = 0.1 to 0.17 its largest ratio rises 1.9 times (0.98 → 1.84, against 2.9 times for C²), the peak speed falls 7 % and the mean drag moves by 0.7 %. At 100 mm/s with the two-relaxation-time collision the model is what keeps the run stable: C = 0.1 only delays the instability (step 837 against 668), C = 0.17 holds it, at a peak ν_t/ν of 2.9 and with the reply’s warning of a 30.6 % density variation (the weakly compressible error). With the regularised collision the same flow is stable without a model, and the model adds viscosity to the laminar wake, raising the drag by 1.0 % and 2.8 %: the eddy viscosity acts wherever the flow shears, laminar flow included. This grid does not resolve the wall (the floor’s first cell is 1.25 mm off it), so no damping is used; a wall-modelled channel is in Large-eddy simulation.

Verification

Theory (crates/lbm/tests/turbulence.rs, crates/lbm/tests/mrt.rs; CPU, every run):

CaseReferenceResultToleranceTest
Plane Couette, 16 cells, C = 0.4 (ν_t/ν > 0.05), TRT and regulariseduniform ν_t = (C Δx)² U/h, linear profile, wall shear ρ (ν + ν_t) U/hprofile, shear and ν_t/ν within toleranceprofile 2e-3 of U; wall shear 0.2 %; ν_t/ν 0.2 % (regularised), 20 % (TRT: the cells next to the walls read a little more flux)couette_flow_takes_the_smagorinsky_viscosity_of_its_shear
The same, MRTthe samewithin tolerancewall shear 0.2 %; ν_t/ν 2 %smagorinsky_couette_flow_takes_the_closed_form_eddy_viscosity
Simple shear, the closed form aloneν₀ + C² γexact1e-12turbulence::tests::simple_shear_gets_the_smagorinsky_viscosity
Plane Poiseuille, C = 0.4, 8 → 64 cellsthe laminar parabola; the eddy viscosity’s error falls like Δx²observed orders TRT 1.970, 1.993, 1.998; regularised 1.839, 1.906, 1.950each above 1.8, the last within 0.06 of 2with_the_model_on_poiseuille_converges_to_the_laminar_profile_like_dx_squared
Taylor–Green vortex, C = 0.4, 16 → 64 cellsthe laminar decaysecond orderabove 1.8with_the_model_on_taylor_green_approaches_the_laminar_decay_to_second_order
Heated Couette, C = 0.4, Pr_t = 0.9steady drop q h / (ρ c (α + α_t)), α_t = ν_t / Pr_twithin tolerance0.2 %heated_couette_flow_conducts_with_the_turbulent_diffusivity
Lid-driven cavity 48², Re 5000 (cell Reynolds number 104, τ⁺ = 0.5029)refused without a model; stable with onerefused without; C = 0.17 stable over 4000 steps—the_closure_holds_a_cavity_too_fast_for_the_lattice_alone
Couette at h⁺ = 10, A⁺ = 26 (damping)wall distances exactly the half-cell offsets; largest ν_t/ν the undamped value times the factor squared at the farthest cell (y⁺ ≈ 4.7, factor 0.165)within toleranceν_t/ν 2 % (regularised), 20 % (TRT); first-cell y⁺ 1 %; wall shear the laminar one within 0.2 %van_driest_damping_scales_couette_flow_s_eddy_viscosity_by_the_wall_factor
Pipe of radius 1, 8 cells per radius (wall distance)R − rwithin 0.75 cell (staircase)0.75 cellwall_distances_in_a_pipe_follow_its_radius
Couette, 4 cells, first cell at y⁺ ≈ 12, dampedthe unresolved-wall warningwarned; undamped and resolved grids not—damping_on_a_wall_the_grid_does_not_resolve_is_warned_about
Han et al.’s eq. 14 (spalding_bounce) on one node, the paper’s numbering mapped by vectorevery assignment of eq. 14a–c; the node’s 19 populations, the incoming and outgoing ones; the momentum takenexact; mass and momentum to round-off on every face1e-15eq_14_assigns_every_population_of_a_node_on_the_floor, eq_14_conserves_mass_and_carries_the_stress_on_every_face
On-node bounce, perturbed coarse channel (13 cells across, walls through the outermost centres), 40 steps, TRT, regularised, HRRthe walls carry the sampled stresses along them; momentum budget P(t + 1) − P(t) = a M + Σ ½ρa − F with the populations in flight at the nodes; Spalding’s law at one cell; the stress along the interior node’s velocity; massto round-offbudget 2e-13, carried 2e-14, law 5e-14, direction 2e-17, mass 8e-14the_on_node_bounce_gives_the_walls_exactly_the_law_s_stress
On-node bounce, steady force-driven channel (4 cells per δ, 4 × 9 × 4 cells, periodic, TRT, 6000 steps, laminar, a = (10⁻⁵, −5·10⁻⁶, 0))the law’s stress sums to the body force on the fluid and the half cells, a (M + ½ Σ ρ); the walls along and along the normal carry it; the half cells’ shareto round-offlaw −5e-13, walls along −5e-13, walls normal −2e-12, share −6e-16the_law_s_stress_balances_the_whole_body_force_in_a_steady_channel
On-node bounce: grid relation, readback, damping distances, refusals (moving wall, edge with a non-periodic face, obstacle, box under 3 cells), 1, 3 and 7 threadsas statedas statedexactthe_boundary_nodes_are_the_outermost_layers_and_not_fluid, damping_measures_the_distance_from_the_wall_through_the_nodes, the_on_node_bounce_refuses_what_it_does_not_support, on_node_results_are_bit_for_bit_the_same_on_one_and_many_threads
Stationary toy: the k_x = π mode of the wall rows, 1e-6 seeded on a steady laminar base, on-node, regularised, τ̄ 0.5015, u⁺ 5the mode does not grow−1.2e-4 per step≤ 0the_on_node_bounce_damps_the_odd_even_mode_of_its_wall_rows
The same, both forms × regularised, HRR, MRT (from τ̄ 0.505), TRT × τ̄ 0.50015–0.8 × u⁺ ≈ 5, 11 (heavy)the growth rate per step, printed (docs/verification.md, “the odd–even mode of the wall rows”)on-node −2e-5 to −1.6e-2, every case; halfway +6e-5 to +0.13, every caseprintedthe_odd_even_mode_of_the_wall_rows_across_forms_collisions_and_tau
Disabled-model diagnostic only: wall-function bounce (spalding_bounce_halfway), perturbed coarse channel, 40 steps, every collisionthe walls carry the sampled stress; momentum budget P(t + 1) − P(t) = a M − F; Spalding’s law; massto round-off3e-15, 3e-14, 3e-14, 4e-14the_wall_function_bounce_gives_the_walls_exactly_the_law_s_stress
Wall-function bounce on a moving wallrefused, naming the facerefused—the_wall_function_bounce_refuses_a_moving_wall
Damped and wall-modelled cavity, 1, 3 and 7 threadsbit-for-bit equalityequalexactdamped_results_are_bit_for_bit_the_same_on_one_and_many_threads, wall_modelled_results_are_bit_for_bit_the_same_on_one_and_many_threads

Vreman’s model (crates/lbm/src/vreman.rs unit tests, crates/lbm/tests/vreman.rs; CPU, every run):

CaseReferenceResultToleranceTest
Zero gradient; each single component ∂_i u_j; one row (eq. 14) and one column (eq. 15) of αν_t = 0 (Vreman §II)0 exactlyexactzero_and_rank_one_gradients_give_zero_exactly
General rank-one gradient a bᵀν_t = 0below 1e-9 (round-off)1e-9the same
Rigid rotation u = Ω (−y, x, 0)ν_t = c Δx² |Ω| / √2within 1e-15 relative1e-15a_rigid_rotation_has_c_omega_over_root_two
Axisymmetric strain s (x, y, −2z); plane strain s (x, −y, 0)c √(3/2) |s|; c |s| / √2within 1e-15 relative1e-15strains_have_their_closed_forms
Sum of squared minors against eq. 8, 200 random gradientseq. 8within 1e-14 relative1e-14the_minors_are_eq_8
Plane Couette and Poiseuille, 16 cells, C_s 0.18, trt, regularized, mrt, hrrthe run without a modelevery density, velocity and wall force equal bit for bit; largest ν_t/ν exactly 0exactcouette_and_poiseuille_flow_are_unchanged_by_the_model_bit_for_bit
Taylor–Green vortex 16³, Re 50, t 3.1, trt and hrrpositive ν_t, energy below the run without a modelν_t/ν up to 0.35; k 0.0671 against 0.0729 (trt), 0.0637 against 0.0695 (hrr)—the_taylor_green_vortex_takes_a_positive_eddy_viscosity_and_decays_faster
Ball channel, 1, 3 and 7 threads, trt and hrrbit-for-bit equalityequalexactresults_are_bit_for_bit_the_same_on_one_and_many_threads
Every collision, the ball channel, 40 steps; Musker’s wall model and the wall-function bounce, coarse channelsruns, the model actsν_t/ν about 0.004; finite—every_collision_runs_with_the_model, the_wall_models_run_with_the_model
Constant 0, negative, above 0.5, not finite; Pr_t out of range; van_driest givenrefused, naming the modelrefused—bad_constants_are_refused

GPU against CPU (crates/lbm-gpu/tests/verification.rs, every collision and both streaming layouts): Couette with the model on, velocity within 1e-4, wall shear within 2e-4 and ν_t/ν within 5e-4 of the CPU’s (couette_flow_with_smagorinsky_matches_the_cpu); forced Poiseuille, velocity within 2e-5 (forced_poiseuille_with_smagorinsky_matches_the_cpu); heated Couette, temperature and wall heat within 3e-4 (heated_couette_flow_with_smagorinsky_matches_the_cpu); the Re 5000 cavity over 1000 steps, ν_t/ν within 1e-3 (a_cavity_held_by_the_closure_follows_the_cpu). Van Driest damping in a coarse three-dimensional channel (6 cells per half-height, perturbed, 150 steps), on bounce-back walls and under the wall model: velocity within 1e-4 of the largest speed, density within 1e-5, ν_t/ν and the wall cells’ largest y⁺ within 1e-3 of the CPU’s (measured on an NVIDIA GB10: velocity up to 5.6e-6, ν_t/ν up to 1.2e-4, y⁺ up to 6.3e-6; a_coarse_channel_with_van_driest_damping_follows_the_cpu). The wall-function bounce with Van Driest damping in the same channel: the same tolerances, and the walls’ drag within 1e-3 of the CPU’s (measured: velocity up to 3.1e-6, drag up to 3.5e-6; a_coarse_channel_with_the_wall_function_bounce_follows_the_cpu). On the GPU the shift of the reflected populations is applied as link streaming writes them (bounce_shift), the stress sampled before the collision (bounce_sample). Vreman’s model with trt, regularized, mrt and hrr, in the coarse channel and in a periodic box with a ball (24³, ν 0.005, 200 steps), both layouts, from the same initial state: velocity within 1e-4 of the largest speed, density within 1e-5, ν_t/ν within 1e-3 of the CPU’s (measured on the GB10: velocity up to 6.9e-6, density up to 6.3e-7, ν_t/ν up to 3.3e-5; vreman_s_model_follows_the_cpu); on the GPU its gradient comes from a velocity pass before the collision (GPU backend).

Benchmark: Re_τ 180 channel (a long study, run by hand; docs/verification.md, “Long studies”). C = 0.1, regularised collision, channel 2πδ × 2δ × πδ driven by u_τ²/δ, 10 δ/u_τ of start-up discarded and 15 averaged. Reference: Moser, Kim & Mansour (1999), Re_τ = 178: U_b/u_τ ≈ 15.7, U_c/u_τ ≈ 18.3, C_f ≈ 8.18 × 10⁻³. Recorded on Windows x86_64 (PR #668), undamped:

cells per δy⁺ per cellU_b/u_τU_c/u_τC_f
1215.09.95 (−36.6 %)13.07 (−28.6 %)2.02e-2
1810.011.55 (−26.4 %)14.42 (−21.2 %)1.50e-2
247.512.81 (−18.4 %)15.60 (−14.8 %)1.22e-2
325.614.17 (−9.8 %)17.00 (−7.1 %)9.96e-3

None of these grids is within a tolerance of the reference. The bulk speed approaches it monotonically as the first cell moves toward the viscous sublayer; without damping the eddy viscosity is too large in the first cells, so the friction is too high. The heavy CI job runs the 12-cell grid with the full protocol and checks it stays turbulent and within 3 % of the recorded means (a_coarse_channel_at_re_tau_180_stays_turbulent_with_the_study_s_means); the flow is chaotic, so the means move with the platform (9.90 and 12.95 on macOS aarch64). With van_driest: 26 short probes (5 δ/u_τ discarded, 1 averaged) gave U_b/u_τ 12.42 at 18 cells per δ and 14.00 at 24, and the 12-cell grid went unstable at 2.2 δ/u_τ: at Re_τ 180 none of these grids resolves the wall (Δy⁺ = 180 / N), and damping is meant for a first cell at y⁺ ≈ 1–2.

Wall model. The wall-modelled channel against Lee & Moser (2015) and Dean (1978) is recorded in docs/verification.md and summarised in Large-eddy simulation.

Limitations

  • Smagorinsky’s and Vreman’s models, each with a constant; the filter width is the lattice spacing. Vreman’s model has no Van Driest damping.
  • The model adds viscosity wherever the flow shears, laminar flow included: a laminar answer is reached only as the grid is refined, the eddy viscosity falling like Δx².
  • Damping is meant for a wall resolved to y⁺ ≈ 1–2 at the first cell. Above y⁺ 5 the run warns, and on a coarse grid removing the eddy viscosity at the wall can make the run unstable.
  • One wall point per cell (the nearest). The wall-distance spreading does not cross periodic faces, so near one a distance may come out longer than across it.
  • No grid of the Re_τ 180 study reaches the reference: the bulk speed is 9.8 % low at 32 cells per δ, and that grid had not settled. Each grid is one realisation; no confidence interval is stated.
  • A turbulent case stopping on its running mean has not been run; the stop rule is shown on laminar vortex shedding.
  • Curved bodies need interpolated walls. With halfway walls a curved or inclined obstacle is a staircase: on a circular cylinder at Re 3900 with 16 cells per diameter it carried 13 % more drag than with walls: "interpolated". The solve warns where a connected oblique region of the surface rises at least one cell along its axis: a curved body about 7 cells across or more (a faceted one a little earlier). A smaller curved body is not flagged (Verification).

Implementation

  • crates/lbm/src/turbulence.rs: flux (the non-equilibrium flux P), omega (the cell’s rate from Hou et al.’s closed form).
  • crates/lbm/src/vreman.rs: eddy_viscosity (Vreman’s ν_t of a gradient), model_constant; crates/lbm/src/hrr.rs: gradient (the finite differences).
  • crates/lbm/src/wall.rs: Walls (wall cells, wall distances, refresh of u_τ, factor, sample and reconstruct for the wall model), friction_velocity (Spalding), musker, wall_law, unresolved_wall.
  • crates/lbm/src/flow.rs: Flow::collide (the rate per cell for each collision), collide_thermal (α_t), refresh_damping, sample_walls, eddy_viscosity_ratio.
  • crates/lbm/src/regularized.rs, crates/lbm/src/mrt.rs: the collisions’ use of the cell’s rate.
  • crates/lbm/src/setup.rs: MAX_SMAGORINSKY, TURBULENT_PRANDTL, VAN_DRIEST, MIN_TAU_TURBULENT, and the step’s checks.
  • crates/lbm-gpu/src/lbm.wgsl: smagorinsky_omega, collide_trt_rate, wall_omega, behind the override constants SMAGORINSKY and WALL_MODEL; gradient_velocity, fd_gradient, vreman_nu, explicit_omega behind VREMAN.
  • crates/lbm/src/sa.rs: the closure (its constants, f_v1, f_v2, f_w, f_t2, f_n, s_tilde, sources) and SaField (ν̃’s transport); crates/lbm/src/distance.rs: WallDistance.
  • crates/lbm-gpu/src/lbm.wgsl, native.rs: ν̃’s transport pass and the wall distance on the device, behind the override constant SA.
  • crates/model/src/steps.rs: Turbulence, WallModel.

References

  • P. R. Spalart, S. R. Allmaras. A one-equation turbulence model for aerodynamic flows. La Recherche Aérospatiale 1994(1):5–21; first as AIAA-92-0439, 1992, doi:10.2514/6.1992-439 (the wall law: its eqs. 7–9).
  • S. R. Allmaras, F. T. Johnson, P. R. Spalart. Modifications and clarifications for the implementation of the Spalart–Allmaras turbulence model. ICCFD7-1902, 2012.
  • P. F. Felzenszwalb, D. P. Huttenlocher. Distance transforms of sampled functions. Theory of Computing 8:415–428, 2012.
  • A. W. Vreman. An eddy-viscosity subgrid-scale model for turbulent shear flow: Algebraic theory and applications. Phys. Fluids 16(10):3670–3681, 2004. doi:10.1063/1.1785131
  • J. Smagorinsky. General circulation experiments with the primitive equations. Mon. Weather Rev. 91(3):99–164, 1963. doi:10.1175/1520-0493(1963)091<0099:GCEWTP>2.3.CO;2
  • S. Hou, J. Sterling, S. Chen, G. D. Doolen. A lattice Boltzmann subgrid model for high Reynolds number flows. Fields Inst. Commun. 6:151–166, 1996. doi:10.1090/fic/006/12
  • O. Malaspinas, P. Sagaut. Consistent subgrid scale modelling for lattice Boltzmann methods. J. Fluid Mech. 700:514–542, 2012. doi:10.1017/jfm.2012.155
  • O. Malaspinas, P. Sagaut. Wall model for large-eddy simulation based on the lattice Boltzmann method. J. Comput. Phys. 275:25–40, 2014. doi:10.1016/j.jcp.2014.06.020
  • E. R. Van Driest. On turbulent flow near a wall. J. Aeronaut. Sci. 23(11):1007–1011, 1956. doi:10.2514/8.3713
  • D. B. Spalding. A single formula for the “law of the wall”. J. Appl. Mech. 28(3):455–458, 1961. doi:10.1115/1.3641728
  • P. Moin, J. Kim. Numerical investigation of turbulent channel flow. J. Fluid Mech. 118:341–377, 1982. doi:10.1017/S0022112082001116
  • P.-E. Danielsson. Euclidean distance mapping. Comput. Graph. Image Process. 14(3):227–248, 1980. doi:10.1016/0146-664X(80)90054-4
  • M. Han, R. Ooka, H. Kikumoto. A wall function approach in lattice Boltzmann method: algorithm and validation using turbulent channel flow. Fluid Dyn. Res. 53:045506, 2021. doi:10.1088/1873-7005/ac1782
  • A. J. Musker. Explicit expression for the smooth wall velocity distribution in a turbulent boundary layer. AIAA J. 17(6):655–657, 1979. doi:10.2514/3.61193
  • U. Piomelli, E. Balaras. Wall-layer models for large-eddy simulations. Annu. Rev. Fluid Mech. 34:349–374, 2002. doi:10.1146/annurev.fluid.34.082901.144919
  • R. D. Moser, J. Kim, N. N. Mansour. Direct numerical simulation of turbulent channel flow up to Re_τ = 590. Phys. Fluids 11:943–945, 1999.
  • M. Lee, R. D. Moser. Direct numerical simulation of turbulent channel flow up to Re_τ ≈ 5200. J. Fluid Mech. 774:395–415, 2015. doi:10.1017/jfm.2015.268