As a CFD engineer, you are going to solve a wide range of industrial problems. Whether you use high fidelity open source CFD tools like OpenFOAM, Code Saturne or SU2, state of the art proprietary tools like Fluent, CFX, StarCCM+ or your own in house code to solve your complicated problems, you definitely need one very common thing: the computational mesh. And investing your time (and probably money) on your mesh is a very wise decision.
Prof. Hrvoje Jasak, one of the creators of OpenFOAM said that who owns the mesh, owns the solution. I can’t agree more! Theoretical knowledge is very important in CFD but you can just conclude it that you can obtain a sufficiently accurate solution for your problem if your mesh and numerical schemes/algorithms are able to solve whatever phenomena you are computing.
So, what are the key metrics you need to check whether your mesh is good enough or not. The major metrics should be mesh quality and efficiency and effectiveness as I will be explaining in no time.Â
Mesh quality
The mesh quality is one of the most important things you want to make sure about. Bad quality meshes can distort your results at best and in the worst scenario, may affect stability and convergence of your simulation.The most important quality metrics would be non-orthoginality and skewness while aspect ratio and smooth transition are also important.
Non-orthoginality is the deviation of cell faces from the perpendicular direction and usually expressed in angles (0 to 90 degrees in OpenFOAM, with 0 the best and 90 the worst) or the cosine of angles to normalize the angle values between 0 and 1 (Fluent, CFX, with 1 the best and 0 the worst). With finite volume methods, non-orthogonality mainly affects the Laplacian terms and gradient calculations where the face normals play a very important role to get proper second order accuracy. If your non-orthogonality is high, it will add numerical diffusion to the solution and reduce the accuracy of second order discretization schemes to first order.
Mesh skewness is the deviation of the vector connecting two cell centers and the face center. In finite volume methods, the governing equations written in volume integrals are rewritten using surface integrals. These surface integrals are discretized using face center quantities on the mesh. Again, we use cell center quantities to calculate these face center quantities. Therefore, if the discrepancy between cell centers and face center is too large, in other words, if the mesh skewness is too large, all the terms in the Navier-Stokes equations are affected because all of these need center to face approximation. For mesh skewness, consult with your CFD code’s guidelines and if it is over recommended values, it is better to remesh!
Aspect ratio is the ratio between the longest side of a cell and the shortest side. It is also an important metric but extremely high aspect ratios are still fine as long as the gradients in the largest direction are small. For example, prism cells inside boundary layer may have very high aspect ratios and these are totally fine.
Mesh transition between different cell sizes should be smooth since large transition ratios can add diffusion to the solution. We want gradual changes rather than sharp transitions, especially inside the regions with a lot of flow features to be solved such as boundary layers and separation zones. You may want to look for sharp changes inside the flow field from the results and refine these areas for slower mesh transitions.
We need to be very careful with the mesh quality because a single very bad cell or face can distort the results badly or even lead to divergence. Remember, the Navier-Stokes equations have advection and diffusion terms. If an error starts at a cell, it will not stay there throughout the whole simulation. It might move around or spread throughout the whole domain being carried by means of advection and diffusion, leading to inaccurate results everywhere!
Efficiency and effectiveness
There is no written rule on the efficiency and effectiveness of a mesh. But the rule of thumb is to generate the mesh coarse enough to enable you to carry out your CFD calculations on your own machine while fine enough to get sufficiently accurate results. Remember, not many companies or universities own hundred-node-clusters with thousands of CPU and GPU cores with terabytes of RAM and HPC on cloud is still very expensive, especially for SMEs. Even if you have access to such a luxurious compute, your commercial CFD code has license limitations. So, it is very likely that you cannot run your CFD simulation for flow around a NACA airfoil or Ahmed body with hundreds of millions of cells and advanced LES models.
The optimal method to assure the accuracy of your simulations is to use mesh dependency test. You start with a coarse mesh and refine it by cutting the cell half in each spatial direction. It means your cell count increases by 8 times for each refinement step which may not be very practical. Remember, there are usually a large percentage of volume in your domain where you do not need a very fine mesh to solve.
So, an efficient approach is to start with a very coarse mesh and refine your mesh gradually in order to resolve important flow features. So, the important question is where should we refine the mesh. Adaptive mesh refinement techniques are available now both in commercial codes and open source codes. While using this may require additional time and knowledge, these can give you the idea where to refine the mesh. Most of these methods mark the areas where gradients are large or iteration errors are large and automatically refine these areas. If you know where to refine because you have the idea of what your exact solution looks like, you can just trust your imagination and refine these areas. If you are not sure, the adaptive meshing can give you an idea of refinement locations you need to define.
Again, you need to ensure that your mesh is able to capture all the important flow features and it should have suitable topology. For example, you need to define enough prism layers near the wall if you want accurate boundary layer formation and resistance values for your object. You need to use hexahedral cells and refine the mesh near your free-surface if you want accurate wave-structure interactions. You need to use refinement regions behind your bluff body in order to properly capture the wake characteristics.
Summary
Meshing is one of the most important steps in CFD and we need to strive for quality efficiently. Putting a lot of effort into meshing can give you much easier life in later steps because of accurate results and faster convergences.