CFD Mesh guide

CFD Mesh guide

The mesh phase is probably the most critical phase of a CFD simulation. Most of the times a CFD simulation fails is because of poor mesh quality, and even is boundary conditions errors are possible those are usually very easy to fix. The convergence and quality of a CFD simulation is directly dependent on the mesh quality

The CFD mesh is heavily dependent on geometry details and requires the user to fine tune the mesh parameters to achieve an high quality mesh, sometimes it can be required to change the CAD geometry to obtain an high quality mesh

SimWorks offers advanced functionalities to tune the mesh settings.

 

CFD mesh density

A CFD mesh is made of multiple cells which are contained inside the portion of fluid the user wants to simulate. By combining all the cells and calculating the main flow parameters values and gradients inside them it is possible to solve numerically the full fluidodynamic field. It is important to note that within a cell the flow parameters are only approximated so with a fine mesh results will generally be more accurate

On the other hand increasing the mesh density leads to an exponential increase in computational resources used. A good way of accessing whether the approximation is acceptable it to carry out what it is called a mesh sensitivity study, which basically implies to carry out a simulation with a coarse mesh and then see how the results change as the mesh density is increased. In theory once a certain mesh density is achieved results will become unsensitive to further mesh refinements. In a real life application once the result variation with a finer mesh is small enough not to affect engineering decisions then the ideal mesh density is achieved.

CFD mesh next to glider surface
Mesh next to th glider surface

One other important aspect to bear in mind is that in general a finer CFD mesh will capture geometrical details in a more effective way, while a coarse mesh can approximate some details leading to a different geometry with respect to the original one. This can be easily checked loading the CFD mesh in the SimWorks Field viewer.

The most effective way of finding the best compromise is to define a progressively finer mesh close to the geometry surface, it is nevertheless important to make sure that the mesh density transition is smooth enough to avoid introduce error in the solution.

SimWorks offers multiple tools to achieve this. Even if all those tools have been covered in previous tutorial you will find all of them collected in this CFD mesh guide.

Global mesh parameters

The Mesh tab in the Simulation editor window containg a section with the Global Mesh Parameters. Those apply to the whole mesh, while we have already used most of them in the previous tutorials those can have a substantial effect on the global mesh quality, please find the list below a detailed description: 

1) Base cell size: this is the starting cell size, everytime the user defines a surface refinement value or a refinement box the cell size is halved. So for instance in our example the cells away from the surface have a dimension of 0.5m, if the user specifies a 3 level next to the surface the mesher will reduce the cell size by 2^3 = 8 times, so the cell size on the surfaces will be 0.5 / 8 = 0.0625m

2) Cells between levels: Everytime multiple steps of mesh density are defined in an area there will be a transition region, this sets how aggressive this transition would be. So in our example everytime the cell size is halved there will be at least 2 cells with any given refinement value. See in the image below how the mesh transitions from level 0 (cell size 0.5m) to level 3 (cell size 0.0625m) each time with at least 2 cells in each transition area:

3) Featue angle (deg): the actual surface mesh levels are defined as a couple for instance (0 3) this allows the mesher to automatically increase te density from level 0 to level 3 to capture certain geometricla features. One of the main ones is the curvature level, reducing the Feature angle will increase the mesh density in curved areas of the geometry as shown in the example below (from the OpenFOAM website):

4) Edge refinement: alongside the cell dimension the user can increase the density on the edges by increasing this value. This parameter is also explicitly defined in each of the Surface Mesh groups (see below) and can be specified on certain areas of the geometry, we always advice to set a value which is at least equal to the highest surface mesh level of the surface mesh group

5) Point in mesh: to define which area is to be meshed the software requires a point position. This point has to be outside of the geometry and inside the Outer domain, andin general has to be inside the area of fluid the user wants to simulate

6) Radius: this parameter is only visual and it is not used by the software. It is useful to both properly visualise the point in mesh but also it is useful to give the user a feeling of the max cell dimension if set at the same value of the base cell size

7) STL linear and angular deflections: SimWorks will convert the original geometry file (IGS or STP) in a tasselated STL file. The mesher will then mesh the volume according to the local refinement levels, remove the cells which do not belong to the domain and project the ones that are left on the STL surface. It is therefore critical, especially when working with complex geometries, to have a properly tasselated high quality STL file. Reducing both the linear and angular deflection values will result in a finer STL which is more accurate for the subsequent meshing phase. Obviously making the STL finer will take more computational resources. A good way of of visualising the STL quality is to load it up in Paraview, you can find the relevant STL files inside the simularion folder then case/constant/triSurface, bear in mind that the first 6 STL files are related to the outer domain. You can see that the STL mesh is finer in the curved areas of the glider and in our case the STL mesh is sufficiently fine. But please do check everytime you have problems meshing complex geometries: 

Open the relevant STL files
Actual glider STL file

Surface Mesh groups

If you have not already carried out our base glider tutorial please do that before proceeding with this guide. In that instance we used the default settings in SimWorks, looking at the Mesh tab in the Simulation editor you can see that there are 7 Surface mesh groups, the first 6 ones refer to the Outer domain faces, while the Surface Mesh 7 group includes all the Glider parts.  

As you can see from the settings we used the base cell size was 0.5m while the maximum Surface refinement level and the edge level were 3, meaning that both on the surface and on the geometry edges we achieved a 0.5 / 2^3 =  0.0625m cell size. While this was enough for an approximate solution the mesh was very coarse and did not even capture well the geometry:

Base glider CFD mesh settings in SimWorks
Base glider CFD mesh

SimWorks supports the creation of Surface mesh groups to allow the user to define specific settings on certain portions of the geometry, we will then increase the mesh density on the wings and the tail:

1) Select the layering Refinement levels from the Geometry viewer window

2) Press CTR + select both the wings and the tail surfaces, a popup window will appear

3) Click on the button Create a new Surface Mesh Group inside the popup, this will create a new Surface mesh group with all the parts selected

4) Increase the Surface level to (0 5) and the Edge level to 5 on the newly defined surface group, the Refinement levels window will be updated with the new values in the Geometry viewer window

5) Add the prism layers next to the surface by defining the First cell height as 0.005, the Number of layers to 3 and Expansion ratio to 3. This will add prism layers to the mesh surface to properly model the flow next to the wall

6) Complete the Stup and the Mesh phases from the main menu

7) Load the mesh in the Field viewer window

You can see the now the geometry details on the wings and tail are well captured and the mesh density is locally increased. However as you can the cell size transition is very arupt between the far field and the cells next to the geometry.

SimWorks CFD mesh advanced settings
SimWorks CFD mesh density increasedon tails and wings

Refinement boxes

To reduce the mesh size variation next to the surface we will use the Refinement boxes functionality in SimWorks. The refinement box will increase the mesh density within a certain volume:

1) Add 2 Refinement boxes from the Simulation editor window

2) Define the Refinement box parameters as per image below,the Refinement lvel layering view in te Geometry viewer will be updated accordingly

3) As done before complete the mesh and run phases and load the mesh in the Field viewer

To reduce the mesh size variation next to the surface we will use the Refinement boxes functionality in SimWorks. The refinement box will increase the mesh density within a certain volume:

1) Add 2 Refinement boxes from the Simulation editor window

2) Define the Refinement box parameters as per image below,the Refinement lvel layering view in te Geometry viewer will be updated accordingly

3) As done before complete the mesh and run phases and load the mesh in the Field viewer

You can see in the images below the mesh has been increased within the refinement boxes and the cell size transition is now much smoother than before.

The same approach used above can be user to define Part groups under the Regions tab in the Simulation editor window allowing the user to define specific boundary conditions on portions of the geometry.

 If you have any questions or suggestions please do not hesitate to contact us.

Try our free CFD software SimWorks, no registration required or contact us to find out more