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:
| Equation | Type | Required BCs |
|---|---|---|
| Continuity | 1st order in $p$ | 1 condition somewhere |
| Momentum | 2nd order in $\mathbf{u}$ | 2 conditions per direction |
| Energy | 2nd order in $T$ | 2 conditions |
Types of Boundary Conditions
1. Inlet Conditions
Purpose: Specify fluid entering the domain. Common specifications:| Type | Variables Specified | Use Case |
|---|---|---|
| Velocity inlet | $u, v, w, k, \epsilon$ | Known velocity profile |
| Mass flow inlet | $\dot{m}$, direction | Fixed mass flow rate |
| Pressure inlet | $p_0, T_0$ | Compressible/HVAC |
| Turbulence | $k, \epsilon$ or $I, L$ | Turbulent flows |
At inlet face $f$:
- $u_f = u_{specified}$
- $\phi_f = \phi_{specified}$ for all transported scalars
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:| Type | Specification | Physics |
|---|---|---|
| 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 |
- Pressure: $p_f = p_{specified}$
- Velocity: Extrapolated from interior
- Scalars: Zero gradient $\frac{\partial \phi}{\partial n} = 0$
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)$
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$
- Half-car model (vertical symmetry plane)
- Periodic turbine blade passages
- Axisymmetric flows on wedge domain
5. Periodic Conditions
Purpose: Model repeating geometries. Types:- Translational periodic: $\phi(x) = \phi(x + L)$
- Rotational periodic: For turbomachinery
Wall Functions
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
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:
- Turbulent quantities at the wall:
$$\epsilon_P = \frac{u_\tau^3}{\kappa y_P}$$
Standard vs Enhanced Wall Functions
| Approach | y+ Range | Accuracy | Cost |
|---|---|---|---|
| Standard wall function | 30-300 | Moderate | Low |
| Enhanced (blended) | 1-300 | Higher | Moderate |
| Low-Re (resolve) | ~1 | Highest | High |
- 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
| Mistake | Symptom | Solution |
|---|---|---|
| Outlet too close | Reversed flow at outlet | Extend domain |
| Wrong outlet BC | Non-physical pressure | Use pressure outlet |
| Missing turbulence at inlet | Laminar-like results | Specify $k, \epsilon$ |
| Symmetry on asymmetric flow | Wrong flow patterns | Use full domain |
| Wall function with $y^+ < 30$ | Incorrect wall shear | Adjust 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.