Gyredocs
Depth Practice
API

Gyre/Mathematics & Numerical Methods

Turbulence closure (RANS, Spalart–Allmaras)

In one minuteTurbulent flows are computed with the Reynolds-averaged equations closed by the negative Spalart–Allmaras model. The model equation is one more row of the same discrete operator, so the Newton linearisation, the adjoint and the shape derivatives (including the wall distance) remain exact.

Written at L2 Practice goes to L4 Theory 1900 words Markdown

At flight Reynolds numbers the boundary layers on an aircraft are turbulent, and resolving the turbulence itself is out of reach for design work. Gyre therefore offers the Reynolds-averaged Navier–Stokes (RANS) equations with a one-equation closure: the Spalart–Allmaras model in its negative form (SA-neg), the variant written for discretizations, such as high-order DG, whose solution can undershoot at the edge of a boundary layer.

One extra transported quantity, ν~\tilde\nu, produces an eddy viscosity μt\mu_t that is added to the molecular viscosity seen by the mean flow; everything else in the solver is unchanged.

yaml
flow:
  mach: 0.2
  reynolds: 5.0e6
  turbulence: sa          # 'none' (default) or 'sa'; needs reynolds
  extra: {chi_inf: 3.0, prt: 0.9}   # optional: free-stream nu_tilde/nu, turbulent Prandtl number

With turbulence: sa the state has one more variable per node, ρν~\rho\tilde\nu, stored after the energy. No-slip walls impose ν~=0\tilde\nu = 0 and define the wall distance; the far field and inlets supply ν~=χ∞ν\tilde\nu = \chi_\infty \nu. Outputs, gradients, error estimates and the discipline interface work as for laminar flow; chi_inf and prt are ordinary differentiable flow parameters.

The model is integrated to the wall (no wall functions), so the first element must be thin enough for the polynomial inside it to resolve the viscous sublayer: see the flat-plate study for the resolution used there.

  • Included: SA-neg with the 2012 modifications of Allmaras, Johnson and Spalart (the S~\tilde S limiter that keeps the modified vorticity positive, the negative branch, the ft2f_{t2} laminar-suppression term), a constant turbulent Prandtl number, an exact curved wall distance that takes part in shape derivatives.
  • Not included: trip terms and transition modelling (the flow is turbulent wherever the model produces eddy viscosity), rotation/curvature and compressibility corrections, the quadratic constitutive relation, the 23ρk\tfrac23 \rho k term of the Boussinesq stress (neglected as is usual for this model), wall functions, other models.
  • Verified on a manufactured solution, a linearisation study, the zero-pressure-gradient flat plate of the NASA Turbulence Modeling Resource and adjoint-versus-finite-difference derivatives (verification); in three dimensions a spanwise extrusion of that plate reproduces its section. Separated flows, aerofoils at flight Reynolds number and turbulent flows that are three-dimensional in themselves have not been run.

Model equations#

The working variable is ν~\tilde\nu, with χ=ν~/ν\chi = \tilde\nu/\nu. Gyre solves the conservative form for ρν~\rho\tilde\nu,

∂(ρν~)∂t+∇⋅(ρu ν~)=ρ (P−D)+1σ∇⋅(ρ(ν+ν~fn)∇ν~)−1σ(ν+ν~fn) ∇ρ⋅∇ν~+cb2σ ρ ∣∇ν~∣2,(1)\pd{(\rho\tilde\nu)}{t} + \nabla\cdot(\rho\mathbf u\,\tilde\nu) = \rho\,(P - D) + \frac{1}{\sigma}\nabla\cdot\big(\rho(\nu + \tilde\nu f_n)\nabla\tilde\nu\big) - \frac{1}{\sigma}(\nu + \tilde\nu f_n)\,\nabla\rho\cdot\nabla\tilde\nu + \frac{c_{b2}}{\sigma}\,\rho\,\abs{\nabla\tilde\nu}^2 , \tag{1}

with production PP and destruction DD that depend on the sign of ν~\tilde\nu:

ν~≥0\tilde\nu \ge 0 ν~<0\tilde\nu < 0
PP cb1(1−ft2) S~ ν~c_{b1}(1 - f_{t2})\,\tilde S\,\tilde\nu cb1(1−ct3) S ν~c_{b1}(1 - c_{t3})\,S\,\tilde\nu
DD (cw1fw−cb1κ2ft2)ν~2d2\big(c_{w1} f_w - \dfrac{c_{b1}}{\kappa^2} f_{t2}\big)\dfrac{\tilde\nu^2}{d^2} −cw1ν~2d2-c_{w1}\dfrac{\tilde\nu^2}{d^2}
fnf_n 11 cn1+χ3cn1−χ3\dfrac{c_{n1} + \chi^3}{c_{n1} - \chi^3}
μt\mu_t ρν~fv1\rho\tilde\nu f_{v1},   fv1=χ3χ3+cv13\; f_{v1} = \dfrac{\chi^3}{\chi^3 + c_{v1}^3} 00

SS is the magnitude of the vorticity and dd the distance to the nearest no-slip wall. The mean flow sees the viscosity μ+μt\mu + \mu_t and the conductivity cp(μ/Pr+μt/Prt)c_p(\mu/\mathit{Pr} + \mu_t/\mathit{Pr}_t).

For ν~≥0\tilde\nu \ge 0 the modified vorticity is

S~={S+SˉSˉ≥−cv2SS+S (cv22S+cv3Sˉ)(cv3−2cv2)S−SˉotherwiseSˉ=ν~fv2κ2d2,fv2=1−χ1+χfv1,\tilde S = \begin{cases} S + \bar S & \bar S \ge -c_{v2} S \\[4pt] S + \dfrac{S\,(c_{v2}^2 S + c_{v3}\bar S)}{(c_{v3} - 2c_{v2})S - \bar S} & \text{otherwise} \end{cases} \qquad \bar S = \frac{\tilde\nu f_{v2}}{\kappa^2 d^2},\quad f_{v2} = 1 - \frac{\chi}{1 + \chi f_{v1}} ,

which is positive whenever SS is and has a continuous first derivative at the switch. The wall function of the destruction term is

fw=g(1+cw36g6+cw36)1/6,g=r+cw2(r6−r),r=min⁡ ⁣(ν~S~κ2d2, rlim),f_w = g\left(\frac{1 + c_{w3}^6}{g^6 + c_{w3}^6}\right)^{1/6},\qquad g = r + c_{w2}(r^6 - r),\qquad r = \min\!\Big(\frac{\tilde\nu}{\tilde S\kappa^2 d^2},\, r_\text{lim}\Big),

and ft2=ct3exp⁡(−ct4χ2)f_{t2} = c_{t3}\exp(-c_{t4}\chi^2). Constants: cb1=0.1355c_{b1} = 0.1355, cb2=0.622c_{b2} = 0.622, σ=2/3\sigma = 2/3, κ=0.41\kappa = 0.41, cw1=cb1/κ2+(1+cb2)/σc_{w1} = c_{b1}/\kappa^2 + (1 + c_{b2})/\sigma, cw2=0.3c_{w2} = 0.3, cw3=2c_{w3} = 2, cv1=7.1c_{v1} = 7.1, cv2=0.7c_{v2} = 0.7, cv3=0.9c_{v3} = 0.9, ct3=1.2c_{t3} = 1.2, ct4=0.5c_{t4} = 0.5, cn1=16c_{n1} = 16, rlim=10r_\text{lim} = 10; Prt=0.9\mathit{Pr}_t = 0.9 and χ∞=3\chi_\infty = 3 by default (prt, chi_inf).

A polynomial that represents the sharp edge of a boundary layer undershoots, so ν~\tilde\nu becomes slightly negative there. The original model then loses its footing: the eddy viscosity turns negative and the diffusion coefficient can change sign. SA-neg continues the equation to ν~<0\tilde\nu < 0 so that it stays well posed: no eddy viscosity, a diffusion coefficient that remains positive through fnf_n, and source terms that drive ν~\tilde\nu back towards zero. The positive and the negative branch join with continuous first derivatives, which is what Newton’s method and the adjoint need.

Discretization#

Equation (1) goes through the machinery of the mean-flow equations (DGSEM, BR2):

  • Convection. In the volume, the two-point mass flux of the mean flow times the arithmetic mean of ν~\tilde\nu; on faces, upwinding of ν~\tilde\nu with the interface mass flux fρ∗f_\rho^* of the Riemann solver, fρν~∗=12fρ∗(ν~L+ν~R)−12(fρ∗)2+δ2 (ν~R−ν~L)f^*_{\rho\tilde\nu} = \tfrac12 f_\rho^*(\tilde\nu_L + \tilde\nu_R) - \tfrac12\sqrt{(f_\rho^*)^2 + \delta^2}\,(\tilde\nu_R - \tilde\nu_L).
  • Diffusion. The conservative diffusion term is one more row of the viscous flux and takes the BR2 path unchanged. ν~\tilde\nu and ρ\rho join the velocity and the temperature as gradient variables.
  • Sources. Production, destruction and the two non-conservative gradient terms are evaluated with the BR2 gradient q=G+∑frfq = G + \sum_f r_f, the same lifted gradient the viscous volume flux uses, so that they see the jumps between elements.

The Gauss–Lobatto solution nodes include points on the wall, where d=0d = 0 and ν~/d\tilde\nu/d is undefined for a discrete ν~\tilde\nu that satisfies its wall condition only weakly. The source is therefore integrated with Gauss quadrature: state and BR2 gradient are interpolated to the (p+1)d(p+1)^d Gauss points of each element, where d>0d > 0, the source is evaluated there, and the result is tested against the nodal basis,

(JR)i−=1wi∑gℓi(ξg) wg Jg st(Ug,qg,dg).(J R)_{i} \mathrel{-}= \frac{1}{w_i}\sum_g \ell_i(\xi_g)\, w_g\, J_g\, s_t(U_g, q_g, d_g).

A source that depends on the gradient of the solution is adjoint consistent only if it is evaluated with a gradient that includes the interface contributions (Oliver and Darmofal). Using the element-local gradient GG alone would leave the primal scheme consistent but make the discrete adjoint inconsistent with the continuous one, and functionals would lose their superconvergence. The BR2 gradient qq already contains the face liftings, so the same array serves the viscous flux and the source.

Newton’s method and the adjoint need a residual with continuous first derivatives. The model’s own switches (the S~\tilde S limiter and the sign branch) have them by construction. The remaining kinks are smoothed:

Quantity Model Gyre Size of the change
vorticity magnitude ∣ω∣\abs{\boldsymbol\omega} ∣ω∣2+ϵ2−ϵ\sqrt{\abs{\boldsymbol\omega}^2 + \epsilon^2} - \epsilon at most ϵ=10−6\epsilon = 10^{-6} (units u∞/Lrefu_\infty/L_\text{ref}); exactly zero in irrotational flow
limiter of rr min⁡(r,rlim)\min(r, r_\text{lim}) C1C^1 blend on rlim±1r_\text{lim} \pm 1 none for r≤9r \le 9
fv1f_{v1} and μt\mu_t at ν~=0\tilde\nu = 0 χ3\chi^3 max⁡(χ,0)3\max(\chi, 0)^3 none (C2C^2 already)
interface upwinding ∣fρ∗∣\abs{f_\rho^*} (fρ∗)2+δ2\sqrt{(f_\rho^*)^2 + \delta^2} a dissipation floor δ=10−3ρˉ\delta = 10^{-3}\bar\rho
Condition ν~\tilde\nu
no-slip walls ν~=0\tilde\nu = 0, in the convective flux and in the BR2 lifting (Dirichlet)
farfield exterior state χ∞μ∞\chi_\infty\mu_\infty; the mass-flux upwinding takes it on inflow and the interior value on outflow
total_inlet χ∞ μ(Tb)\chi_\infty\,\mu(T_b) at the boundary state
slip walls, symmetry, pressure_outlet the interior value; no diffusive flux

Wall distance#

The wall distance is computed once per discretization for every Gauss point: a k-d tree over samples of the wall faces proposes candidate faces, and a projected Gauss–Newton iteration on each candidate’s polynomial (of the geometry degree) finds the closest point. The result is stored as interpolation weights of the foot point on the geometry nodes of its wall face, not as a number.

Because the foot point is stored as weights on mesh nodes, the distance is re-evaluated inside the differentiable geometry,

d(X)=∣xg(X)−xfoot(X)∣,d(X) = \abs{x_g(X) - x_\text{foot}(X)} ,

whenever the node coordinates XX change. By the envelope theorem the derivative of a minimum with respect to a parameter is the partial derivative at the minimiser, so holding the foot-point parameters fixed gives the exact first derivative of the distance with respect to XX, as long as the closest face does not change. Shape derivatives of turbulent cases therefore include the wall-distance sensitivity; the adjoint study checks them against finite differences that recompute the distance.

Solver#

In the units of the solver the mean-flow equations are of order one and the turbulence equation of order ν~∼χ/Re\tilde\nu \sim \chi/\mathit{Re}, six or seven orders smaller at flight Reynolds number. Unweighted, an inexact Krylov solve and the convergence monitor would not see it. The rows of the turbulence equation are therefore weighted by Re/χref\mathit{Re}/\chi_\text{ref} with χref=100\chi_\text{ref} = 100: the Newton residual norm is ∥s Rw∥\norm{s\,R_w}, the forward Krylov solver works on (SA)x=Sb(SA)x = Sb and the adjoint one on (S−1AT)x=S−1b(S^{-1}A\T)x = S^{-1}b. The solutions are those of the unscaled systems; only the norm the tolerances refer to changes. The implicit solver, the block-Jacobi preconditioner and p-multigrid are otherwise the same as for laminar flow, with element blocks one variable larger.

  • The eddy viscosity enters the stable time step and the block preconditioner, but there is no positivity enforcement for ρ\rho, pp or μ+μt\mu + \mu_t beyond what the model provides.
  • Start-up from a uniform free stream relies on pseudo-transient continuation; there is no dedicated turbulence start-up strategy and no measured robustness on separated flows.
  • Wall-resolved meshes have element aspect ratios of the order of a thousand at the wall. Element-block Jacobi does not see that anisotropy: used alone it leaves linear solves on such meshes slow or short of their tolerance. Two remedies exist. The piecewise-constant coarse level of the p-multigrid hierarchy (solver.levels at its default, which includes p=0p = 0) makes them converge with block Jacobi (solver statistics of the adjoint study). The line smoother (solver.smoother: line, how it works) inverts the coupling along the wall-normal lines of elements exactly and needs a fraction of the Krylov iterations (measured). There is no incomplete-factorisation preconditioner, and nothing has been measured on a turbulent mesh larger than the flat plate of the preset.
  • The entropy analysis of the two-point fluxes covers the mean-flow convective terms only; nothing is proven for the model equation.

References: Allmaras, Johnson and Spalart (2012); Oliver and Darmofal (2009); see the bibliography.

    ↑ ↓ moveEnter open[ ] change depthResults show section and depth level