Personal
Cutting the Grid: The First Step in CFD
Using an ONERA M6 wing course project to explain why CFD needs a mesh, how structured and unstructured meshes differ, what y+ means, and how mesh quality affects the result.
The most eye-catching part of a CFD (computational fluid dynamics) paper is usually the colourful pressure contours. Once you run a case yourself, you find that most of the time goes into building the mesh beforehand, and that step also decides most of how accurate the result will be.
Why the air gets cut into cells
The Navier-Stokes equations that describe airflow have no closed-form solution outside a few simple cases. CFD divides the space around the wing into millions or tens of millions of small cells, solves the equations approximately in each one, and assembles the results into the whole flow field. Cells that are too coarse smear out detail, cells that are too fine cost too much to run, and badly shaped cells make the equations hard to solve stably.
Two kinds of mesh
A structured mesh is like graph paper. Cells sit in rows and columns and each has fixed neighbours. It can follow the wing surface layer by layer, needs fewer cells for the same accuracy, and does better in the boundary layer and around shocks. The drawback is that complex shapes are hard to mesh this way, often needing manual blocking and a lot of experience.
An unstructured mesh is more like gravel, with triangles and tetrahedra filling the space automatically. It handles complex geometry, local refinement is easy, and it is quick to get started. It usually needs more cells for the same accuracy, though, and it tends to produce stretched, skewed cells.
The layer next to the wing
Air touching the wing surface is almost stationary, and within a very thin layer further out it quickly gets back up to speed. That layer is the boundary layer. Skin friction and flow separation both depend on it, so the mesh has to be especially fine there.
The usual measure of whether it is fine enough is y+, the distance from the wall to the first cell converted into a dimensionless number using the local flow conditions. A y+ of 1 or less means the first cell sits inside the innermost part of the boundary layer, where viscosity dominates.
For the ONERA M6 project we set y+ ≤ 1 and worked back to the first-layer thickness; every y+ value came out below 0.75. We also estimated the boundary layer thickness at about 1.23 cm with a flat-plate assumption and added extra inflation layers to cover it. Inflation layers are flat cells stacked against the wall, each a little thicker than the one below, built to capture the boundary layer.
The ONERA M6 wing
The ONERA M6 is a swept wing with no twist. It was measured in detail in a wind tunnel in 1972, and because the data is so clean it has been used to check CFD codes for decades.
We ran a transonic case at Mach 0.84. Air flowing over the upper surface speeds up past the speed of sound and then drops back to subsonic speed abruptly. That abrupt change is a shock, and the ONERA M6 is known for a lambda-shaped shock on its upper surface. A shock is very thin, but pressure jumps across it, and a mesh that is too coarse will miss it. We first ran a coarse mesh of about 6 million nodes, saw a strong shock on the upper surface, and extended the refined zone over the upper surface and towards the trailing edge. The refined meshes had 8.4 to 11.2 million nodes.
Cell shape
Two numbers are commonly used to judge mesh quality. Aspect ratio is a cell’s longest side divided by its shortest. Inflation-layer cells are long and flat by design, but cells that are too flat amplify numerical error. Skewness measures how far a cell is from its ideal shape: 0 is best, and a value near 1 means the cell is almost flattened, which makes the equations hard to converge.
Our mesh had an average aspect ratio of 284.58 and a maximum skewness of 0.977. Both are high, and that was the compromise an unstructured mesh allowed with the computing power we had. The results show it. The pressure coefficient distributions follow the shape and trend of the wind tunnel data, but the agreement gets worse towards the wingtip. The report concluded that the next step should be a structured mesh, to improve cell quality at the source.
What I took from it
This project changed how I look at simulation results. A contour plot needs to be compared with test data before I trust it. The same solver can reach a different conclusion on a different mesh, so the mesh should be judged along with the result. Starting coarse also saves effort, because a coarse mesh shows the rough shape of the flow and where the hard parts are before you decide where to spend computing power. The report states plainly that the wingtip did not match, that mesh quality was poor, and what to change next, and I think that part is the most useful to anyone who takes on the same problem later.
The full report is on the project page.