CFD Mesh Generation (aerodynamics/cfd/cfd-mesh-generation)
Use when the task is CFD mesh generation for an aerospace flow
case: choosing the grid type, sizing the near-wall spacing from a
y plus target, building boundary-layer prism layers, checking cell
quality, sizing the far-field domain, or planning refinement.
Domain quick reference
- Grid types: a structured grid is hexahedral with implicit
point ordering, efficient for simple geometries such as airfoil
sections, cascades, and ducts; an unstructured grid of tetrahedra
or polyhedra fits complex geometries such as a full aircraft;
a hybrid grid stacks prism layers on the walls and fills the rest
with unstructured cells, the standard for wall-bounded external
aerodynamics.
- Near-wall resolution: the first cell height comes from the
dimensionless wall distance y+ = y * u_tau / nu, so
y = y+ * nu / u_tau; u_tau = v_inf * sqrt(cf / 2) follows from
the skin friction coefficient. A target y+ near 1 resolves the
viscous sublayer, values up to about 30 blend wall treatment,
and wall functions tolerate y+ up to about 300.
- Boundary-layer prism layers grow the first cell outward with a
geometric growth ratio, commonly 1.1 to 1.3, until the
boundary-layer thickness is covered; the layer count follows the
geometric series sum h1 * (r^n - 1) / (r - 1).
- Cell quality metrics: skewness near 0 is good and above about
0.9 is bad, the orthogonality angle should stay above about 20
degrees, and the aspect ratio should stay small for general cells
while boundary-layer cells legitimately run high.
- Domain sizing: far-field boundaries sit tens of chord or body
lengths away, commonly 20 to 50 chords for external aero, so the
boundary condition effect stays small; the cell count scales with
domain volume over spacing cubed.
- Mesh refinement: each refinement level halves the cell size, so
level n gives size_n = base / 2^n; refine the wake, shock, and
separation regions, and adapt where the error indicator is large.
Workflow
- Choose the grid type with grid_type_recommendation from the
geometry complexity and the boundary-layer resolution need.
- Estimate u_tau from cf and v_inf, then size the first cell
height from the y+ target with first_cell_height_from_cf (or
first_cell_height when u_tau is known).
- Count the prism layers with prism_layer_count from the first
cell height, boundary-layer thickness, and growth ratio.
- Check cell quality with quality_flags on skewness, orthogonality
angle, and aspect ratio; pass boundary_layer_cell=True for
near-wall cells so their high aspect ratio is not flagged.
- Size the far-field domain and estimate the cell count with
estimate_cell_count; plan refinement levels with
refinement_sizes.
- Verify the achieved y plus of the produced first cell with
achieved_y_plus before generating the mesh.
Pitfalls
- Sizing the first cell from the wrong y+ band: a y+ near 1 cell
paired with a wall-function treatment wastes cells; the y+ target
must match the wall treatment.
- Confusing the first cell height with twice it: y+ uses the cell
center distance from the wall, not the cell width.
- Growth ratios near 1 explode the prism layer count; ratios above
about 1.5 degrade the boundary-layer profile resolution.
- Ignoring quality metrics: skewed or low-orthogonality cells stall
the solver even when the near-wall spacing is correct.
- A domain too small contaminates the solution from the far-field
boundary; a domain too large wastes cells.
- Treating boundary-layer aspect ratio like general-cell aspect
ratio: high aspect ratio is expected in prisms, not in the free
stream.
Behavior contract (gate 3)
The grid type, y plus, prism layer, quality, domain sizing, and
refinement logic is exercised by the gate 3 contract test:
scripts/test_cfd_mesh_generation.py against
scripts/cfd_mesh_generation_logic.py (stdlib unittest, offline).
Run:
python3 scripts/test_cfd_mesh_generation.py
Compliance
- NACA Report 824 is US government work (public domain); summary
and reference data only, per standards-map.yaml. The mesh
generation methodology here is common CFD practice, not
reproduced text.
- compliance: STANDARDS-REF, gated: false.
1---2name: cfd-mesh-generation3description: Use when the task is CFD mesh generation, grid type selection, prism layer setup, near-wall resolution, domain sizing, or cell quality checking for a solver run. Generate a CFD mesh for an aerospace flow case: choose between structured, unstructured, and hybrid grids, size the near-wall first cell height from a y plus target and skin friction coefficient, build boundary-layer prism layers with a growth ratio, flag cell quality with skewness, orthogonality, and aspect ratio checks, size the far-field domain, and plan refinement levels. Produces the grid type recommendation, first cell height, prism layer count, quality verdict, cell count estimate, and refinement plan. Trigger: mesh generation, grid types, prism layers, first cell height, skewness, orthogonality, aspect ratio, domain size, mesh refinement.4license: Apache-2.05---67# CFD Mesh Generation (aerodynamics/cfd/cfd-mesh-generation)89Use when the task is CFD mesh generation for an aerospace flow10case: choosing the grid type, sizing the near-wall spacing from a11y plus target, building boundary-layer prism layers, checking cell12quality, sizing the far-field domain, or planning refinement.1314## Domain quick reference1516- Grid types: a structured grid is hexahedral with implicit17 point ordering, efficient for simple geometries such as airfoil18 sections, cascades, and ducts; an unstructured grid of tetrahedra19 or polyhedra fits complex geometries such as a full aircraft;20 a hybrid grid stacks prism layers on the walls and fills the rest21 with unstructured cells, the standard for wall-bounded external22 aerodynamics.23- Near-wall resolution: the first cell height comes from the24 dimensionless wall distance y+ = y * u_tau / nu, so25 y = y+ * nu / u_tau; u_tau = v_inf * sqrt(cf / 2) follows from26 the skin friction coefficient. A target y+ near 1 resolves the27 viscous sublayer, values up to about 30 blend wall treatment,28 and wall functions tolerate y+ up to about 300.29- Boundary-layer prism layers grow the first cell outward with a30 geometric growth ratio, commonly 1.1 to 1.3, until the31 boundary-layer thickness is covered; the layer count follows the32 geometric series sum h1 * (r^n - 1) / (r - 1).33- Cell quality metrics: skewness near 0 is good and above about34 0.9 is bad, the orthogonality angle should stay above about 2035 degrees, and the aspect ratio should stay small for general cells36 while boundary-layer cells legitimately run high.37- Domain sizing: far-field boundaries sit tens of chord or body38 lengths away, commonly 20 to 50 chords for external aero, so the39 boundary condition effect stays small; the cell count scales with40 domain volume over spacing cubed.41- Mesh refinement: each refinement level halves the cell size, so42 level n gives size_n = base / 2^n; refine the wake, shock, and43 separation regions, and adapt where the error indicator is large.4445## Workflow46471. Choose the grid type with grid_type_recommendation from the48 geometry complexity and the boundary-layer resolution need.492. Estimate u_tau from cf and v_inf, then size the first cell50 height from the y+ target with first_cell_height_from_cf (or51 first_cell_height when u_tau is known).523. Count the prism layers with prism_layer_count from the first53 cell height, boundary-layer thickness, and growth ratio.544. Check cell quality with quality_flags on skewness, orthogonality55 angle, and aspect ratio; pass boundary_layer_cell=True for56 near-wall cells so their high aspect ratio is not flagged.575. Size the far-field domain and estimate the cell count with58 estimate_cell_count; plan refinement levels with59 refinement_sizes.606. Verify the achieved y plus of the produced first cell with61 achieved_y_plus before generating the mesh.6263## Pitfalls6465- Sizing the first cell from the wrong y+ band: a y+ near 1 cell66 paired with a wall-function treatment wastes cells; the y+ target67 must match the wall treatment.68- Confusing the first cell height with twice it: y+ uses the cell69 center distance from the wall, not the cell width.70- Growth ratios near 1 explode the prism layer count; ratios above71 about 1.5 degrade the boundary-layer profile resolution.72- Ignoring quality metrics: skewed or low-orthogonality cells stall73 the solver even when the near-wall spacing is correct.74- A domain too small contaminates the solution from the far-field75 boundary; a domain too large wastes cells.76- Treating boundary-layer aspect ratio like general-cell aspect77 ratio: high aspect ratio is expected in prisms, not in the free78 stream.7980## Behavior contract (gate 3)8182The grid type, y plus, prism layer, quality, domain sizing, and83refinement logic is exercised by the gate 3 contract test:84scripts/test_cfd_mesh_generation.py against85scripts/cfd_mesh_generation_logic.py (stdlib unittest, offline).86Run:87python3 scripts/test_cfd_mesh_generation.py8889## Compliance9091- NACA Report 824 is US government work (public domain); summary92 and reference data only, per standards-map.yaml. The mesh93 generation methodology here is common CFD practice, not94 reproduced text.95- compliance: STANDARDS-REF, gated: false.