“Hmmm” says the dentist, “your teeth are fine but those gums have got to go.” Or so the old joke goes. It can be a similar experience for people running CFD codes: boundary conditions are correctly set up; residuals are acceptably converged and the colourful display of pressure, velocity and turbulence quantities all look reassuringly plausible. Then, midway through the presentation comes the inevitable question from the floor “Can we have a look at the mesh quality in the region of the junction please?” Sure enough, instead of a neatly arranged set of rectangles, the mesh resembles a cracked mirror – and all results are now highly suspect. Your engineering conclusions are now worryingly inconclusive!
So what is a mesh, and why it is so hard to get a good one? Mathematically, a mesh is a discrete basis for the solution of the Navier-Stokes equations (governing the conservation of mass, momentum and energy of a moving fluid). Practically, a mesh is the collection of points, lines and cells that occupy the space around a body in a fluid flow – required before the CFD solver can go to work.
There are some exotic techniques that do not require a mesh, but most standard CFD suites provide an interface to CAD, with automatic generation of a mesh on the surface representation of the product (whether an engine, aircraft, or other object to be studied). The job of the surface mesh is to accurately reflect the geometric shape of the object, making sure that the sizes of the elements on the surface capture the required detail and – importantly – the curvature of the surface.
Once the surface mesh is generated, the volume mesh occupying the space around the object can be produced, and herein lies the challenge! The quality of the elements in the volume mesh is the key to the quality of the CFD solution and yet the rapid, robust generation of high quality meshes for arbitrary shaped objects is exceedingly difficult. This is in part because the best mesh for a given simulation challenge is only known (paradoxically) once the flow solution has been generated, i.e. we only know where the highest concentration of cells is needed when we know where the most important flow features are located. Fundamentally though, the mesh is its own data structure and decisions about where to put the first cells in a volume mesh dictate the evolution of the rest of the mesh - with iteration a costly option in light of the need for fast turnaround. A (mesh specialist) colleague once told me “anyone can write a CFD solver before lunchtime, but to write a good mesh generator takes a lifetime”.
Aside from the mesh quality (different solvers require different shaped cells, often with little latitude for variation) the key impact that a mesh will have on the time to solution will be the number of cells in total. For simple test cases this might be up to a million cells, and for serious industrial applications end users are now getting close to routine use of billion cell meshes.
I think that it is interesting that meshing has remained so challenging for so long. The world market for commercial CFD codes is now circa $1billion, and of course there are some very good products available. There are also numerous research level codes that are exploring new forms of mesh generation, but they are yet to reach a level of maturity whereby they can be relied upon by industry.
There are some extremely well regarded international workshops held that enable CFD code vendors or indeed anyone writing CFD code to benchmark their capabilities. The drag prediction and high lift workshops (among others) are run by NASA, and the meshes for those workshops are generated in advance to ensure consistency of the solver results. Perhaps we should have a mesh generation workshop as well!
In considering future advances in mesh generation, the adoption of a totally different approach based on the availability of new forms of hardware is a distinct possibility. The algorithms that have gone into writing mesh generators to date have used as a paradigm for computing that is rapidly being displaced.
My prediction is that the next big leap forward for mesh generation will make use of highly parallel architectures and some form of machine learning. Incidentally, this might actually reduce the amount of source code needed to write the new mesh generation software – time will tell!