Skip to main content

Wall functions

Overview

Wall functions allow Reynolds-averaged simulations at high Reynolds number without resolving the thin viscous sub-layer adjacent to solid boundaries. Instead of placing many mesh layers in the region where molecular viscosity dominates, the first cell centre is located in the logarithmic layer and empirical law-of-the-wall relations supply the missing near-wall physics.

Wall functions are implemented as boundary conditions on turbulence fields (nut, epsilon, omega, etc.) applied to wall patches. They work together with a no-slip velocity condition on U and must be paired with a mesh whose near-wall spacing satisfies the intended y+y^+ range - see Mesh requirements.

Near-wall flow

At a solid wall the no-slip condition forces the mean velocity to zero, so flow near the surface is dominated by variation in the wall-normal direction. Away from corners and separation, the near-wall mean flow is well approximated as a one-dimensional boundary-layer profile: parallel velocity uu varies with distance yy from the wall, while gradients in the wall-parallel directions are small compared with u/y\partial u / \partial y.

Near wall velocity profile

DNS data from Lee and Moser 39

The profile divides naturally into regions:

RegionApproximate y+y^+Character
Viscous sub-layery+5y^+ \lesssim 5u+y+u^+ \approx y^+; molecular viscosity dominates
Buffer layer5y+305 \lesssim y^+ \lesssim 30Transition between viscous and turbulent stress
Log (inertial) layery+30y^+ \gtrsim 30u+1κln(y+)+Bu^+ \approx \frac{1}{\kappa}\ln(y^+) + B

Non-dimensional quantities are defined using the friction velocity uτu_\tau:

u+=uuτ,y+=yuτν,uτ=τwρ u^+ = \frac{u}{u_\tau}, \qquad y^+ = \frac{y u_\tau}{\nu}, \qquad u_\tau = \sqrt{\frac{\tau_w}{\rho}}

where τw\tau_w is the wall shear stress, ρ\rho is density, and ν\nu is kinematic viscosity. In the log layer, turbulent stress dominates and the velocity profile follows the logarithmic law with von Kármán constant κ0.41\kappa \approx 0.41 and roughness parameter E9.8E \approx 9.8 (giving B=lnE/κB = \ln E / \kappa).

Resolving this profile directly requires very fine near-wall meshing (y+1y^+ \sim 1). Wall functions avoid that cost by assuming the cell centre adjacent to the wall lies in the log layer and that the profile between the wall and that point follows the law of the wall.

Momentum transfer

For incompressible RAS with a linear eddy viscosity closure, the mean momentum equation uses an effective viscosity μeff=μ+μt\mu_\mathrm{eff} = \mu + \mu_t (see Linear eddy viscosity models). Near a wall, the wall-parallel shear stress is related to the velocity gradient in the wall-normal direction:

τw=μuyw=ρuτ2 \tau_w = \mu \left.\frac{\partial u}{\partial y}\right|_w = \rho u_\tau^2

In the finite-volume discretisation, the velocity gradient between the wall (no-slip, uw=0u_w = 0) and the centroid of the first interior cell (distance yy, velocity uu) is approximated using an effective viscosity at the wall patch:

τw(μ+μt)uy \tau_w \approx (\mu + \mu_t)\,\frac{u}{y}

If the cell-centre velocity and distance are known, the law of the wall provides the correct u+u^+ for the corresponding y+y^+. Combining the definitions above gives a closure for the turbulent viscosity at the wall patch:

τw=μy+u+uy=(μ+μt)uy \tau_w = \mu\,\frac{y^+}{u^+}\,\frac{u}{y} = (\mu + \mu_t)\,\frac{u}{y}

and therefore

μt=μ(y+u+1) \mu_t = \mu\left(\frac{y^+}{u^+} - 1\right)

OpenFOAM momentum wall functions (nutUWallFunction, nutkWallFunction, etc.) evaluate y+y^+ from the local flow and set νt=μt/ρ\nu_t = \mu_t / \rho on the nut patch field accordingly. The velocity field retains noSlip on U; the wall function modifies only the turbulent viscosity used in the wall-adjacent stress calculation, not the wall velocity itself.

Velocity-based and kk-based formulations

Two common routes to y+y^+ are available:

  • Velocity-based (nutUWallFunction, nutUBlendedWallFunction, …): y+y^+ is computed from the magnitude of the tangential velocity at the first cell centre relative to the wall.

  • kk-based (nutkWallFunction, nutkRoughWallFunction): uτu_\tau is estimated from the turbulent kinetic energy at the cell centre, uτ=Cμ1/4k1/2u_\tau = C_\mu^{1/4} k^{1/2}, and hence y+=yuτ/νy^+ = y u_\tau / \nu.

Both approaches apply the same log-layer formula for νt\nu_t in the inertial region:

νt=νy+κln(Ey+) \nu_t = \nu\, y^+ \frac{\kappa}{\ln(E y^+)}

In the viscous sub-layer limit (y+0y^+ \to 0), the wall function reverts to νt=ν\nu_t = \nu (i.e. μt=μ\mu_t = \mu).

Blending treatments

When the first cell centre falls in the buffer layer, neither the pure viscous nor the pure log-layer estimate is accurate. OpenFOAM wall functions support blending between the two predictions via the blending entry:

blendingBehaviour
stepwiseViscous below ylam+y^+_\mathrm{lam}, log-layer above (high-Re default)
maxνt=max(νt,vis,νt,log)\nu_t = \max(\nu_{t,\mathrm{vis}}, \nu_{t,\mathrm{log}})
binomialSmooth blend; used by nutUBlendedWallFunction and recommended with omegaWallFunction for automatic wall treatment

The blended friction-velocity form used by nutUBlendedWallFunction is:

uτ=(uτ,visn+uτ,logn)1/n u_\tau = \left(u_{\tau,\mathrm{vis}}^{\,n} + u_{\tau,\mathrm{log}}^{\,n}\right)^{1/n}

with blending exponent n=4n = 4 by default 48.

Scalar wall functions

Turbulence model scalars require consistent wall treatment alongside nut:

FieldTypical wall BCRole
kkqRWallFunctionZero-gradient; not a wall function - assumes kk at the cell centre is representative in the log layer
epsilonepsilonWallFunctionSets ϵ\epsilon and turbulent production GG from y+y^+
omegaomegaWallFunctionSets ω\omega and GG; use blending binomial with nutUBlendedWallFunction for full automatic wall treatment
k (low-Re)kLowReWallFunctionAnalytic sub-layer profile when resolving y+1y^+ \sim 1

kqRWallFunction is a wrapper around zero-gradient and does not impose a value at the wall. In high-Re wall-function mode, turbulent kinetic energy is not forced to zero on the patch; near-wall damping is handled through νt\nu_t.

High and low Reynolds number operation

High Reynolds number (wall-function mode) is intended for 30y+30030 \lesssim y^+ \lesssim 300 on the first cell centre. The mesh skips the viscous sub-layer; blending stepwise or lowReCorrection false on epsilonWallFunction uses only the log-layer limit.

Low Reynolds number operation resolves the sub-layer (y+1y^+ \lesssim 1, typically 10–20 wall-normal layers) and uses laminar viscosity near the wall. Enable low-Re corrections (blending binomial, lowReCorrection true, or dedicated conditions such as nutLowReWallFunction and kLowReWallFunction) when the first cell centre lies below the log layer.

Mismatch between the chosen wall treatment and the actual y+y^+ distribution is a common source of inaccurate drag or heat-transfer predictions and should be checked with a post-processing function object such as yPlus.

Usage

Wall functions are specified on wall patches in the field files. A typical high-Re kkϵ\epsilon setup:

// 0/U
fixedWalls
{
type noSlip;
}

// 0/nut
fixedWalls
{
type nutkWallFunction;
value uniform 0;
}

// 0/k
fixedWalls
{
type kqRWallFunction;
value uniform 0;
}

// 0/epsilon
fixedWalls
{
type epsilonWallFunction;
value uniform 0;
}

Shared coefficients (Cmu, kappa, E) can be set on any wall-function patch; defaults are Cμ=0.09C_\mu = 0.09, κ=0.41\kappa = 0.41, E=9.8E = 9.8.

Model options

OpenFOAM includes several momentum wall-function variants. The following summarise the main RAS options documented in this section:

Additional conditions, including velocity-based, rough-wall, tabulated, and low-Re variants, are documented under Wall boundary conditions.

Further information

Source code:

Related: