Lesson 6 of 13 20 min

Boundary Conditions

A CFD problem is not just the governing equations — it's the equations plus boundary conditions. The solution inside the domain is entirely determined by what happens at the boundaries. Wrong boundary conditions guarantee wrong answers, regardless of mesh quality or solver settings.

The Mathematical Necessity

The Navier-Stokes equations are a system of PDEs. For a well-posed problem, we need:

  • Existence: A solution exists
  • Uniqueness: Only one solution exists
  • Stability: Small changes in BCs → small changes in solution

This requires specifying the right number and type of boundary conditions:

EquationTypeRequired BCs
Continuity1st order in $p$1 condition somewhere
Momentum2nd order in $\mathbf{u}$2 conditions per direction
Energy2nd order in $T$2 conditions

Types of Boundary Conditions

Click each boundary type to see how it's implemented and when to use it.

1. Inlet Conditions

Purpose: Specify fluid entering the domain. Common specifications:
TypeVariables SpecifiedUse Case
Velocity inlet$u, v, w, k, \epsilon$Known velocity profile
Mass flow inlet$\dot{m}$, directionFixed mass flow rate
Pressure inlet$p_0, T_0$Compressible/HVAC
Turbulence$k, \epsilon$ or $I, L$Turbulent flows
Implementation (velocity inlet):

At inlet face $f$:

  • $u_f = u_{specified}$
  • $\phi_f = \phi_{specified}$ for all transported scalars
Turbulence specification:

If turbulence intensity $I$ and length scale $L$ are given:

$$k = \frac{3}{2}(U_{avg} \cdot I)^2$$

$$\epsilon = C_\mu^{3/4} \frac{k^{3/2}}{L}$$

2. Outlet Conditions

Purpose: Allow fluid to leave the domain without reflecting back. Types:
TypeSpecificationPhysics
Pressure outlet$p = p_{specified}$Subsonic exit to atmosphere
Outflow$\frac{\partial \phi}{\partial n} = 0$Fully developed flow
Mass flow outlet$\dot{m} = \dot{m}_{specified}$Fixed extraction
Implementation (pressure outlet):
  • Pressure: $p_f = p_{specified}$
  • Velocity: Extrapolated from interior
  • Scalars: Zero gradient $\frac{\partial \phi}{\partial n} = 0$
Warning: Place outlets far from regions of interest. Flow should be nearly uniform at the outlet.

3. Wall Conditions

Purpose: Model the fluid-solid interface. No-slip condition:

$$\mathbf{u}_{wall} = \mathbf{0}$$ (for stationary walls)

For thermal:
  • Fixed temperature: $T_{wall} = T_{specified}$
  • Heat flux: $q''_{wall} = q''_{specified}$
  • Convection: $q'' = h(T_{wall} - T_\infty)$
Implementation:

The no-slip condition is a Dirichlet condition — velocity at the wall cell face is set directly. For the momentum equation:

$$a_P u_P = \sum a_{nb} u_{nb} + S + a_{wall} \cdot 0$$

Where $a_{wall}$ includes the wall shear stress contribution.

4. Symmetry/Slip Conditions

Purpose: Reduce domain size using physical or geometric symmetry. Conditions:
  • Normal velocity: $u_n = 0$
  • Normal gradients: $\frac{\partial u_t}{\partial n} = 0$
  • No flux: $\frac{\partial \phi}{\partial n} = 0$
Use cases:
  • Half-car model (vertical symmetry plane)
  • Periodic turbine blade passages
  • Axisymmetric flows on wedge domain
Warning: Only use symmetry if the flow is truly symmetric. Unsteady flows with vortex shedding are NOT symmetric.

5. Periodic Conditions

Purpose: Model repeating geometries. Types:
  • Translational periodic: $\phi(x) = \phi(x + L)$
  • Rotational periodic: For turbomachinery
Implementation: Values on one periodic boundary are copied to the matching boundary, treating them as neighbors.

Wall Functions

Visualize the law of the wall and how wall functions bridge the near-wall region.

The Near-Wall Challenge

Turbulent boundary layers have extreme gradients near the wall. Resolving them requires:

  • Very fine mesh ($y^+ \approx 1$)
  • Many cells in the boundary layer (>15)
  • Huge cell count increase
Solution: Wall functions — empirical formulas that bridge the viscous sublayer.

The Law of the Wall

In the logarithmic region ($30 < y^+ < 300$):

$$u^+ = \frac{1}{\kappa} \ln(y^+) + B$$

Where:

  • $u^+ = u/u_\tau$ = dimensionless velocity
  • $y^+ = y u_\tau / \nu$ = dimensionless distance
  • $\kappa = 0.41$ = von Kármán constant
  • $B \approx 5.2$ = log-law constant
  • $u_\tau = \sqrt{\tau_w/\rho}$ = friction velocity

How Wall Functions Work

  • First cell is placed in the log-law region ($30 < y^+ < 300$)
  • Wall shear stress is computed from the law of the wall:
$$\tau_w = \frac{\rho u_P u_\tau}{u^+}$$
  • Turbulent quantities at the wall:
$$k_P = \frac{u_\tau^2}{\sqrt{C_\mu}}$$

$$\epsilon_P = \frac{u_\tau^3}{\kappa y_P}$$

Standard vs Enhanced Wall Functions

Approachy+ RangeAccuracyCost
Standard wall function30-300ModerateLow
Enhanced (blended)1-300HigherModerate
Low-Re (resolve)~1HighestHigh
Guidelines:
  • External aero: Wall functions often acceptable
  • Heat transfer: May need resolved boundary layer
  • Separation/reattachment: Enhanced or resolved preferred

Numerical Implementation

Ghost Cell Method

For FVM, boundary conditions are often implemented using ghost cells:

Interior cells:    [ P ] [ E ]
                     |
Boundary face:  =====|=====
                     |
Ghost cell:        [ G ]

The ghost cell value $\phi_G$ is set based on the BC type:

  • Dirichlet (fixed value): $\phi_G = 2\phi_{BC} - \phi_P$
  • Neumann (fixed gradient): $\phi_G = \phi_P - \Delta x \cdot \frac{\partial \phi}{\partial n}$

Coefficient Modification

Alternatively, modify the discretization coefficients:

For a Dirichlet condition $\phi_{wall} = \phi_0$:

  • Set $a_{wall} = 0$ (no flux from wall)
  • Modify source: $S_P = S_P + $ wall contribution

For a Neumann condition $\frac{\partial \phi}{\partial n} = q$:

  • The flux is directly specified
  • No coefficient modification needed

Common Boundary Condition Mistakes

MistakeSymptomSolution
Outlet too closeReversed flow at outletExtend domain
Wrong outlet BCNon-physical pressureUse pressure outlet
Missing turbulence at inletLaminar-like resultsSpecify $k, \epsilon$
Symmetry on asymmetric flowWrong flow patternsUse full domain
Wall function with $y^+ < 30$Incorrect wall shearAdjust mesh or model

Compressible Flow BCs

For compressible flows, boundary conditions are based on characteristic analysis:

Subsonic Inlet

  • Specify: $p_0, T_0$, flow direction
  • Extrapolate: One characteristic (pressure wave)

Subsonic Outlet

  • Specify: $p_{exit}$
  • Extrapolate: All other variables

Supersonic Inlet

  • Specify: All variables ($\rho, u, v, w, T$)
  • No extrapolation (all characteristics enter)

Supersonic Outlet

  • Specify: Nothing
  • Extrapolate: All variables (all characteristics leave)

Practical Guidelines

Inlet Placement

  • Place far enough upstream that flow develops
  • Use velocity profile if developed flow exists
  • Include turbulence levels matching experiments

Outlet Placement

  • Far from recirculation zones
  • Flow should be nearly uniform
  • Monitor for reverse flow (indicates too close)

Domain Size (External Flows)

  • Upstream: 5-10 characteristic lengths
  • Downstream: 10-20 characteristic lengths
  • Lateral: 5-10 characteristic lengths
  • Symmetry reduces requirements

Checking BCs

Always verify:

  • Mass conservation (inlet = outlet for steady flow)
  • No reverse flow at outlets
  • Wall y+ in correct range for turbulence model
  • Reasonable velocity/pressure profiles

Key Takeaways

  • Boundary conditions complete the mathematical problem — wrong BCs = wrong solution
  • Inlet: Specify velocity or pressure, plus turbulence quantities
  • Outlet: Usually pressure outlet for subsonic, place far from region of interest
  • Walls: No-slip for viscous, wall functions for high-Re turbulent flows
  • Symmetry: Only use for truly symmetric flows
  • y+: Must match turbulence model requirements
  • Ghost cells: Common implementation technique for FVM

What's Next

With boundaries specified, we need to discretize the convection terms. The next lesson covers Convection Schemes — how different interpolation methods (upwind, central, QUICK) affect accuracy and stability.