Computational Fluid Dynamics · Chapter 9 of 10 · Intermediate
Meshing and Boundary Conditions
The mesh is where most CFD errors are born and most of the engineering time is spent. Sized to the physics and capped by quality metrics, it turns geometry into a solvable grid.
Readiness check
This chapter builds the grid. Tick only what you can do closed-notes.
- Recall what y+ requires of the first cell.
- Sum a geometric series.
- Compute a mass flow from density, area, and velocity.
- Name boundary types: inlet, outlet, wall.
- Recall conservation of mass through an area change.
The core idea
A good mesh is fine where gradients are steep, smooth in size change, and within quality limits. Boundary conditions then supply the physics the domain cannot, and mass must balance across them.
inflation total H = h1(rN − 1)/(r − 1)growth ratio r ≈ 1.2, skewness < 0.85ṁ = ρAU conserved across boundariesThe mesh divides the domain into cells, structured (orderly rows) or unstructured (flexible triangles and tetrahedra) for complex geometry. Near walls, thin inflation layers resolve the boundary layer, their first cell set by the y+ target and growing geometrically by a ratio near 1.2 so the size changes smoothly. Quality metrics, skewness, aspect ratio, and growth ratio, flag cells that would spoil accuracy. Around the mesh, boundary conditions specify the flow: a velocity or mass-flow inlet, a pressure outlet, no-slip walls, and symmetry planes. Mass must conserve across these, so a contraction speeds the flow exactly as continuity demands. The final test, mesh independence, comes in Chapter 10.
The skills, taught in order
Five skills cover grid types, mesh quality, inflation layers, boundary conditions, and the road to mesh independence.
9.1 Structured and unstructured grids
Structured grids are orderly arrays of quadrilateral or hexahedral cells, efficient and accurate but hard to fit to complex shapes. Unstructured grids of triangles or tetrahedra adapt to any geometry at some cost in accuracy and solver speed. Many meshes are hybrid: structured layers at walls, unstructured fill elsewhere.
9.2 Mesh quality
Poor cells corrupt the solution. Skewness measures how far a cell departs from an ideal shape (keep it below about 0.85), aspect ratio measures stretching (high is acceptable only in boundary layers), and the growth ratio between neighbours should stay near 1.2 so cell sizes change smoothly.
| Metric | Target | Why it matters |
|---|---|---|
| Skewness | below 0.85 | distorted cells lose accuracy |
| Growth ratio | about 1.2 | smooth size change reduces error |
| Aspect ratio | moderate (high only in boundary layers) | extreme stretching hurts convergence |
| Orthogonality | as high as possible | aligned faces improve flux accuracy |
9.3 Inflation layers
Near walls, a stack of thin layers resolves the boundary layer. The first layer height comes from the y+ target; subsequent layers grow geometrically, so the total inflation thickness is a geometric series H = h1(rN − 1)/(r − 1).
9.4 Boundary conditions
Each boundary needs a physical condition: a velocity or mass-flow inlet, a pressure outlet, no-slip walls, symmetry planes, or periodic boundaries. They must be consistent with mass conservation, so the flow that enters must leave, changing speed with any area change.
9.5 Toward mesh independence
No single mesh is trusted on its own. A good mesh is the starting point for a refinement study that confirms the answer no longer changes, the verification step of Chapter 10. Meshing and verification are two halves of one habit.
Engineering connection: the inflation mesh sized here is what the turbulence model of Chapter 8 needs, and the refinement check is the subject of Chapter 10.
Worked example 1: sizing an inflation layer
A near-wall mesh starts with a first cell height h1 = 20 µm (set by a y+ = 1 target) and grows by a ratio r = 1.2 over 15 layers. Find the total thickness of the inflation region.
- ProblemFind the total inflation thickness for the mesh in Figure 1.
- Given / findh1 = 20 µm = 2×10⁻⁵ m, r = 1.2, N = 15. Find H.
- AssumptionsGeometric growth of layer heights; the total is the sum of the series.
- ModelThe total thickness is the geometric series H = h1(rN − 1)/(r − 1).
- EquationsH = h1(rN − 1)/(r − 1)
- Solver15 = 1.215 = 15.41. H = 2×10⁻⁵ × (15.41 − 1)/(1.2 − 1) = 2×10⁻⁵ × 14.41/0.2 = 2×10⁻⁵ × 72.0 = 1.44×10⁻³ m = 1.44 mm.
- CheckThe last layer is h1r¹⁴ = 20 µm × 12.8 = 0.26 mm, a smooth handoff to the bulk mesh. Fifteen layers comfortably cover a millimetre-scale boundary layer.
- ConclusionGeometric growth bridges the huge gap between a micrometre first cell and a millimetre boundary layer with only a handful of layers. The growth ratio keeps the transition smooth.
Worked example 2: a mass-flow boundary condition
Air (ρ = 1.2 kg/m³) enters a duct through a 0.1 m by 0.1 m inlet at 12 m/s. The duct contracts to an outlet area of 0.005 m². Find the inlet mass flow and the outlet velocity required by mass conservation.
- ProblemFind the inlet mass flow and the outlet velocity for the duct in Figure 2.
- Given / findρ = 1.2 kg/m³, inlet 0.1 m × 0.1 m, Uin = 12 m/s, outlet area 0.005 m². Find ṁ and Uout.
- AssumptionsSteady, incompressible; mass is conserved between inlet and outlet.
- Modelṁ = ρAU at the inlet; the same ṁ at the outlet gives Uout = ṁ/(ρAout).
- Equationsṁ = ρAinUinUout = ṁ/(ρAout)
- SolveAin = 0.01 m², so ṁ = 1.2 × 0.01 × 12 = 0.144 kg/s. Uout = 0.144/(1.2 × 0.005) = 24 m/s.
- CheckThe outlet area is half the inlet (0.005 versus 0.01 m²), so the velocity doubles from 12 to 24 m/s, consistent with constant mass flow. A boundary condition that broke this would violate continuity.
- ConclusionBoundary conditions must respect mass conservation. A mass-flow or velocity inlet paired with a pressure outlet lets the solver enforce exactly this balance.
Misconceptions and diagnostics
| Mistake | Symptom | Diagnostic question | Correction |
|---|---|---|---|
| Abrupt cell size jump | Solution error at the interface | "Is the growth ratio near 1.2?" | Grow cells smoothly between regions. |
| Skewed cells | Convergence trouble, local errors | "Is skewness below 0.85?" | Improve the mesh where skewness is high. |
| Over-constrained boundaries | No solution or unphysical pressure | "Is a pressure reference set somewhere?" | Pair a velocity or mass-flow inlet with a pressure outlet. |
| Inflation not matched to y+ | Wall treatment invalid | "Does the first layer match the model's y+?" | Set h1 from the y+ target before growing layers. |
Practice ladder
Air at ρ = 1.2 kg/m³ enters a 0.2 m² inlet at 5 m/s. Find the mass flow.
Show answer
ṁ = ρAU = 1.2 × 0.2 × 5 = 1.2 kg/s.
For the Worked Example 1 mesh, find the height of the last (15th) layer.
Show answer
hN = h1rN−1 = 20 µm × 1.2¹⁴ = 20 µm × 12.84 = 0.257 mm. It blends smoothly into the bulk mesh.
A first cell of 50 µm grows by r = 1.15 over 20 layers. Find the total inflation thickness.
Show answer
r²⁰ = 1.15²⁰ = 16.37. H = 50×10⁻⁶ × (16.37 − 1)/0.15 = 50×10⁻⁶ × 102.5 = 5.12×10⁻³ m ≈ 5.1 mm.
For a real geometry you would mesh, describe the grid type, the inflation strategy, and the boundary conditions, and how you would check quality.
What good work looks like
A grid type suited to the geometry, inflation layers sized to y+, conservative boundary conditions, and quality metrics (skewness, growth ratio) checked against targets.
Working with AI, and proving it yourself
Use AI as an examiner, not a solver
Portfolio task
Plan a mesh for a real geometry: choose the grid type, size the inflation layers from y+, list the boundary conditions, and state the quality targets you would enforce.
Retrieval and spaced review
Closed notes. Answer out loud, then reveal.
1. Structured versus unstructured grids?
Structured are orderly and efficient; unstructured fit complex geometry at some cost.
2. Name three quality metrics.
Skewness (below 0.85), growth ratio (about 1.2), and aspect ratio (moderate except in boundary layers).
3. Write the inflation total thickness.
H = h1(rN − 1)/(r − 1), a geometric series.
4. Name four boundary condition types.
Velocity or mass-flow inlet, pressure outlet, no-slip wall, symmetry.
5. Why does a contraction speed the flow?
Mass conservation: with ṁ = ρAU constant, smaller area means higher velocity.
Textbook mapping
| Item | Mapping |
|---|---|
| Primary source | Versteeg and Malalasekera, An Introduction to Computational Fluid Dynamics, Chapters 9 and 11 (Boundary Conditions, Complex Geometries) |
| Cross-reference | Ferziger and Peric, Ch. 8 · Finite Element Methods (meshing) |
| Core topics | 9.1 Grid types · 9.2 Mesh quality · 9.3 Inflation layers · 9.4 Boundary conditions · 9.5 Toward mesh independence |
| Engineering connection | The inflation mesh serves the turbulence model and feeds the refinement study. |
| Read next | Chapter 10: Errors, Verification, and Validation. |