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.

01

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.
0 or 1 weak itemsContinue with this chapter.
2 weak itemsRevisit y+ and near-wall meshing in Chapter 8.
3 or more weak itemsReview boundary conditions in Chapter 2.
02

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 boundaries

The 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 skill works when: you size the first cell to y+, grow it smoothly, and set conservative boundary conditions.
The skill breaks down when: cells jump in size or skew badly, or a boundary condition violates mass conservation.
The concept. Thin inflation layers hug the wall to resolve the boundary layer, each a little taller than the last by a fixed growth ratio, blending into the coarser bulk mesh above.
03

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.

MetricTargetWhy it matters
Skewnessbelow 0.85distorted cells lose accuracy
Growth ratioabout 1.2smooth size change reduces error
Aspect ratiomoderate (high only in boundary layers)extreme stretching hurts convergence
Orthogonalityas high as possiblealigned 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.

04

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.

Figure 1. Fifteen geometrically growing layers turn a 20 micrometre first cell into a 1.44 mm boundary-layer mesh, resolving the wall while keeping the cell count manageable.
  1. ProblemFind the total inflation thickness for the mesh in Figure 1.
  2. Given / findh1 = 20 µm = 2×10⁻⁵ m, r = 1.2, N = 15. Find H.
  3. AssumptionsGeometric growth of layer heights; the total is the sum of the series.
  4. ModelThe total thickness is the geometric series H = h1(rN − 1)/(r − 1).
  5. EquationsH = h1(rN − 1)/(r − 1)
  6. 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.
  7. 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.
  8. 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.
Result. H = 1.44 mm over 15 layers.
05

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.

Figure 2. Mass conservation links the inlet and outlet: halving the area through the contraction doubles the velocity, exactly as ṁ = ρAU with constant ṁ requires.
  1. ProblemFind the inlet mass flow and the outlet velocity for the duct in Figure 2.
  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.
  3. AssumptionsSteady, incompressible; mass is conserved between inlet and outlet.
  4. Modelṁ = ρAU at the inlet; the same ṁ at the outlet gives Uout = ṁ/(ρAout).
  5. Equationsṁ = ρAinUinUout = ṁ/(ρAout)
  6. SolveAin = 0.01 m², so ṁ = 1.2 × 0.01 × 12 = 0.144 kg/s. Uout = 0.144/(1.2 × 0.005) = 24 m/s.
  7. 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.
  8. ConclusionBoundary conditions must respect mass conservation. A mass-flow or velocity inlet paired with a pressure outlet lets the solver enforce exactly this balance.
Result. ṁ = 0.144 kg/s; Uout = 24 m/s through the half-area outlet.
06

Misconceptions and diagnostics

MistakeSymptomDiagnostic questionCorrection
Abrupt cell size jumpSolution error at the interface"Is the growth ratio near 1.2?"Grow cells smoothly between regions.
Skewed cellsConvergence trouble, local errors"Is skewness below 0.85?"Improve the mesh where skewness is high.
Over-constrained boundariesNo 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.
07

Practice ladder

Level 1 · Direct skill

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.

Level 2 · Mixed concept

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.

Level 3 · Independent problem

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.

Level 4 · Transfer to real engineering

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.

08

Working with AI, and proving it yourself

Use AI as an examiner, not a solver

"Check that my inflation first layer matches the y+ I need and grows smoothly."
"Give me four boundaries; I will assign a condition to each."
"Mesh this for me." Sizing the layers and conditions yourself is the skill.
"What is the outlet velocity?" Applying mass conservation is the point.

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.

Must include: a grid type, an inflation calculation, a boundary-condition list, and quality targets.
09

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.

TodayFinish this quiz and Levels 1 and 2 of the ladder.
+1 dayRe-derive the inflation thickness and outlet velocity from a blank page.
+3 daysPlan the mesh and boundaries for two new geometries.
+7 daysCarry the mesh into verification, Chapter 10.
+30 daysReuse the quality targets every time you build a mesh.
10

Textbook mapping

ItemMapping
Primary sourceVersteeg and Malalasekera, An Introduction to Computational Fluid Dynamics, Chapters 9 and 11 (Boundary Conditions, Complex Geometries)
Cross-referenceFerziger and Peric, Ch. 8 · Finite Element Methods (meshing)
Core topics9.1 Grid types · 9.2 Mesh quality · 9.3 Inflation layers · 9.4 Boundary conditions · 9.5 Toward mesh independence
Engineering connectionThe inflation mesh serves the turbulence model and feeds the refinement study.
Read nextChapter 10: Errors, Verification, and Validation.