Boundary conditions -- types, well-posedness, practical setup
Well-posedness of the boundary value problem
The Navier-Stokes equations are mixed-type. The pressure equation is elliptic. The convective terms are hyperbolic. Mixed-type equations have consequences for boundary conditions:
- The inlet is where characteristics enter the domain. The velocity vector points inward. You must specify all variables that flow inward.
- The outlet is where characteristics leave the domain. Do not specify variables flowing outward. The solution determines them instead. Specifying too many BCs at an outlet causes over-specification. Numerical errors reflect upstream and cause divergence.
- The walls are parabolic boundaries. No characteristics enter or leave across a stationary wall. The boundary condition is of mixed elliptic-parabolic type. The no-slip condition u = 0 at the wall is the key constraint.
Well-posedness means three things: the correct BCs give a unique solution, and the solution changes continuously with the input data. An ill-posed BC set causes:
1. Instant divergence (usually over-specified with too many fixed values) 2. Non-convergence of residuals (often under-specified or conflicting) 3. Unphysical steady-state (usually wrong BC type for the flow regime) 4. Backflow at the outlet causes divergence (the characteristic direction has reversed)
Inlet boundary conditions
Velocity inlet / fixed-velocity
U equals U_inlet. Fixed inlet velocity is most common for external aerodynamics and internal pipe flows. The velocity profile at the inlet matters:
| Profile | When to use | Key effect |
| --------- | ------------- | ------------ |
| Uniform (top-hat) | Inlet far from any shear | Artificially thin shear layer, slow natural development |
| Parabolic (Poiseuille) | Pipe inlet, fully developed flow | Realistic initial profile, correct initial shear |
| Log-law | Pipe-duct inlet near turbulence | Best for LES, matching experiments |
| Power-law (boundary layer) | Airfoil-flat-plate inlet | Approximate BL development, fast startup |
Turbulence quantities at the inlet use these formulas:
- k equals 3/2 (U I)^2 where I is turbulence intensity
- epsilon equals C_mu^{3/4} k^{3/2} over l where l is about 0.07 L (mixing length)
- omega equals k^{1/2} over (C_mu^{1/4} l)
Standard values for I: pipe flow is 1 to 5%. External aerodynamics is 0.1 to 2%. Indoor ventilation is 0.05 to 0.5%.
Pressure inlet
p = p_inlet + p_inlet_fluctuation(t). Pressure-inlet BCs are common for compressible flows. A nozzle inlet uses total pressure and temperature as the key inputs. These determine the static properties at the inlet. Low-Mach-number solvers treat a fixed total pressure as equivalent to a fixed static pressure at subsonic inlet.
Mass-flow inlet
Mass flow rate m-dot equals the integral of rho U dot n dA over A_inlet. A fixed flow rate (pump or motor simulations) requires fixing the mass flux instead of velocity. The solver adjusts the inlet velocity profile to deliver the target mass flow. In OpenFOAM, the BC name is massFlowInletVelocity.
Outlet boundary conditions
Fixed pressure / pressure-outlet
p = p_atm. velocity and all other variables use zero gradient. Fixed static pressure at the outlet is the standard choice for most low-Mach incompressible simulations. The zero-gradient for velocity works well for convectively-outflowing variables.
The danger is backflow. Backflow happens when the pressure gradient reverses. Flow enters the domain at the outlet. Recirculation zones cause this. The zero-gradient BC becomes wrong for incoming flow. OpenFOAM fixedValue outlet for velocity is not recommended if recirculation is possible. Use inletOutlet (with fixed inflow and zero-gradient outflow) or the zeroGradient option.
Outflow / zero-gradient
Zero gradient for all variables is the simplest outlet BC. This BC is consistent with physics only when far-downstream flow is sufficiently developed. Streamwise gradients must be negligible. Do not use it for:
- Exits near recirculation zones
- Compressible outlets where pressure waves propagate
- External aerodynamics (far-field BCs are more appropriate)
Pressure far-field
p equals p_infinity and U equals U_infinity. Compressible external flows use a Riemann-invariant far-field BC. One characteristic enters the domain (supersonic inflow or subsonic inflow). One leaves (supersonic outflow or subsonic outflow). The Riemann invariant allows the solver to handle the combination of incoming and outgoing characteristics correctly. In OpenFOAM, fanPressureFvPatchVectorField handles inlet. waveTransmissive handles outlets. compressible TurbulentInlet handles far-field turbulence.
Wave-transmissive / non-reflecting
p + rho c u' = 0 defines the condition. A non-reflecting outlet minimizes spurious pressure-wave reflections. This BC is critical for:
- Aeroacoustics (sound propagation studies)
- Combustion instabilities
- Compressible flows at Mach greater than 0.3 where pressure waves matter
- LES and DNS where acoustic reflections contaminate the solution
Wall boundary conditions
No-slip wall
U = 0 defines the standard viscous wall BC. To resolve the viscous sublayer for accurate wall shear stress, the mesh must resolve it too. Wall functions bypass this requirement by integrating the governing equations from the wall to the first off-wall node.
| Resolution | y_1+ | Wall treatment |
| ------------ | ------ | ---------------- |
| Wall-resolved (DNS-LES-low-Re RANS) | y_1+ less than or equal to 1 | No wall functions. Viscous sublayer resolved. |
| Wall-function RANS (standard) | 30 less than y_1+ less than 300 | Log-law integration |
| Wall-function RANS (enhanced) | 5 less than y_1+ less than 300 | Enhanced wall treatment (viscous sublayer plus buffer layer plus log-law) |
Slip wall / symmetry
U dot n = 0 and U dot t = 0 defines no-slip symmetry. U dot n = 0 and partial(U dot t)/partial n = 0 defines slip symmetry. Symmetry and slip walls carry no viscous shear stress and block all mass flux.
Adiabatic wall / zero heat flux
partial T / partial n = 0 handles perfectly insulated walls.
Fixed temperature wall
T equals T_wall is common in heat transfer simulations. T_wall can be constant or a function of time. Transient heating and cooling use time-varying T_wall.
Periodic boundary conditions
phi(x, y, z) = phi(x + L_x, y + L_y, z + L_z) defines periodicity. Periodic BCs let you simulate a representative elementary volume (REV). The REV stands in for a much larger domain. Common uses:
- Channel flow (fully developed): periodic in streamwise direction
- Porous media flow: small REV periodic in all directions
- Turbulence simulation (isotropic turbulence decay): periodic in all directions
In OpenFOAM, cyclic patches handle simple periodic BCs. cyclicAMI handles non-conformal periodic interfaces between meshes that do not align.
Interface and coupling boundary conditions
AMI (Arbitrary Mesh Interface)
AMI connects two non-conformal meshes. The interface is conservative. Mass, momentum, and energy are conserved across the interface. AMI uses surface interpolation (nearest-neighbor or weighted-least-squares) to map values from one patch to the other. m-dot_A plus m-dot_B equals 0 and p_A equals p_B.
| AMI type | Conservative? | Interpolation | Use case |
| ---------- | --------------- | --------------- | ---------- |
| AMI | Yes (default) | Weighted interpolation | Rotating machinery, sliding mesh |
| nearestPatchFaceAMI | No | Nearest-neighbor | Fast, approximate |
| faceAreaWeightAMI | Yes | Face-area weighted | Moderate accuracy |
Coupled patches (internal faces)
phi_f = phi_plus and [n dot nabla phi] = 0. Internal faces between adjacent cells are coupled. The discretisation uses values from both cells to compute the flux. OpenFOAM uses the coupled BC type for internal faces. This is the default, so you do not need to specify it.
Common mistakes and debugging
| Mistake | Symptom | Fix |
| --------- | --------- | ----- |
| Fixed pressure plus fixed velocity at outlet | Instant divergence (over-specified) | Remove pressure fix, use zeroGradient on velocity |
| Backflow at zeroGradient outlet | Divergence when Re or delta p high | Use inletOutlet or totalPressure |
| Wall function with y_1+ less than 1 | Unphysical wall shear stress | Use y_1+ greater than or equal to 30 or switch to low-y+ wall functions |
| Uniform inlet with shear layer | Slow BL development (unphysical) | Use parabolic or log-law profile |
| Slip wall where no-slip is needed | Zero drag, no boundary layer | Switch to noSlip |
Cross-references
- Turbulence Models -- wall functions for k-epsilon and k-omega
- OpenFOAM Turbulence -- wall function implementations
- OpenFOAM Case Setup -- boundary condition file syntax (0/U, 0/p)
- FVM Overview -- how BCs enter the discretised equation
- ANSYS Fluent OverviewAnsys
- Compressible FlowCFD
- Finite Volume Method -- general transport equation, Gauss theorem, discretisation schemesCFD
- Governing Equations of Fluid MechanicsCFD
- Pressure-velocity Coupling -- SIMPLE, PISO, PIMPLE, under-relaxationCFD
- OpenFOAM Boundary ConditionsOpenFOAM
- OpenFOAM Case Setup — Dictionaries, BCs, and Turbulence ConfigurationOpenFOAM
- OpenFOAM Multiphase Flows — VOF, Eulerian-Eulerian, and DPMOpenFOAM