Meshing
The meshes: compared in 2D, still being built in 3D
The C-grids behind every 2D code comparison row, drawn from the files both codes ran on, and the first 3D Ahmed meshes: the snappyHexMesh reference and our own LeonMesh, with its checkMesh failures listed.
Status. In 2D, code comparison passed: the meshes below are the ones of the code comparison rows. In 3D, preview, unvalidated: the meshes are work in progress: the snappyHexMesh mesh is the reference mesh OpenFOAM ran on; LeonMesh, our own mesher, does not pass checkMesh yet, is not faster than snappyHexMesh yet, and no solver result in this blog uses it.
Every comparison on the scoreboard depends on the mesh before it depends on the solver. Here are the meshes themselves: the 2D grids of the code comparison cases, regenerated from the same code or read from the same files that LeonSim and OpenFOAM ran on, and the 3D meshes of the Ahmed body, where meshing is the open problem.
2D: body-fitted C-grids
All four 2D rows of the scoreboard use a single-block, body-fitted C-grid. The grid lines follow the wall, the first cell is thin enough to resolve the boundary layer, and the cut in the wake closes onto itself so wake faces are ordinary internal faces. This is what the production solver runs on, and it is the same mesh the OpenFOAM leg of each comparison reads: in these cases the mesh is never a difference between the two codes.
NACA 0012, the OpenFOAM comparison
NACA 4412, NASA’s grid
NASA TMR flat plate and bump
Laminar Re 500
The earlier tutorial posts (6 to 10) used a Cartesian cut-cell mesh instead; it is not drawn here because it is no longer the production path.
3D: the Ahmed body, half model
3D is where the mesh is still the hard part. The Ahmed body (25° slant) on four stilts over a floor needs layers on a body with sharp edges, thin stilts and a concave stilt-underside junction. Both meshes below are the half model (symmetry plane at y = 0), with four prism layers on the body, stilts and the floor around the body, first layer 1 mm, growth 1.2. Both are drawn from their polyMesh files, on a CPU.
The reference: snappyHexMesh
LeonMesh: our own, work in progress
| checkMesh, OpenFOAM v1912, all geometry and topology checks | snappyHexMesh | LeonMesh |
|---|---|---|
| cells | 358,593 | 442,502 |
| topology | OK | OK |
| negative volumes | 0 | 0 |
| failed checks | 3 | 6 |
| non-orthogonality, max / average | 60.1 / 6.0 | 90.5 / 6.9 (11 faces above 70°) |
| max skewness | 3.16 | 2,417 (13 faces) |
| faces failing the face-tet check | 0 | 214 |
| wrongly oriented face pyramids | 0 | 24 |
| cells with small determinant / low-weight faces | 98 / 12 | 0 / 7 |
| concave cells | 11,625 | 14,119 |
| meshing time | 65 s on 4 cores (80 s with set-up) | 95 to 104 s on 1 NumPy core |
The three failures of the snappyHexMesh reference are the soft kind (small determinants, concave cells, low interpolation weights) that OpenFOAM runs through. LeonMesh’s extra failures are not: a skewness of 2,417 and 214 bad face decompositions are the kind of defect that breaks a solver, and the skewed faces are the same faces as the bad-decomposition ones. 10 of the 13 are at the nose ridge, 3 at the stilt-underside junction.
Where the fast mesher stands
LeonMesh is our attempt at a mesher that is much faster than snappyHexMesh, runs on the GPU and writes an OpenFOAM polyMesh, so that the result can be checked against OpenFOAM on the same mesh. It is a draft pull request (#118), off by default. What exists is a NumPy reference on the CPU: an octree with polyhedral hanging-node faces, snapping with a quality gate and feature edges, an offset surface and prism layers, and a port of checkMesh. What it does not have yet:
- A clean checkMesh. Six failed checks against the reference’s three, all from the two spots named above. Two obvious fixes (shrinking the failing columns, tapering the layers near edges) made it worse and are kept off.
- Speed. About 95 to 104 s on one CPU core against 65 s on four cores for snappyHexMesh. The two slow NumPy steps, the snap (about 60 s) and the surface refinement (27 s), are the ones to port to GPU kernels. The GPU speed is a target only; nothing has been timed on a GPU.
- The acceptance gates that count. OpenFOAM’s forces on a LeonMesh mesh against the same case on the reference mesh (the Ahmed case) and a second geometry (the NACA 0012 slab) have not run: they need a mesh that passes checkMesh first, and a small amount of compute (about $0.7 for the whole round).
So there is no claim here about accuracy, only about shape. If the two spots are fixed, the next evidence is a checkMesh no worse than the reference, and then the OpenFOAM force comparison on both meshes. Until both exist, snappyHexMesh remains the Ahmed reference.
Numbers: docs/cgrid-gpu/fast-mesher.md (section 8) and the logs log.checkMesh.snappy-sandbox-v1912 and log.checkMesh of the LeonMesh case in the project files. Reproduce the 2D figures with python3 website/renders/mesh_plots.py and the 3D ones with python3 website/renders/mesh3d_plots.py; the LeonMesh polyMesh comes from python3 tools/leonmesh_ahmed.py --out CASE --checkmesh on the branch of PR #118.