Fill out the form to download

Required field
Required field
Not a valid email address
Required field
Required field
  • Set up your own cloud-native simulation in minutes.

  • Documentation

    How to Check and Improve Mesh Quality?

    This knowledge base article will guide you on how to check mesh quality and how to improve it.

    visualization of mesh volume ratio larger than 4 in mesh quality viewer in simscale
    Figure 1: Mesh elements with volume ratio > 4 highlighted


    A high-quality mesh is one of the most critical factors that must be considered to ensure simulation accuracy, and this is why it is very important to check and improve your mesh quality. In this article, we will use the Standard mesher as an example.

    Please visit this tutorial to learn how to use the standard mesher within SimScale.

    The following topics are discussed:

    • Checking the Meshing Log to have a quantitative idea about the overall mesh quality.
    • Using the Mesh Quality feature to locate bad elements.
    • Using manual mesh refinement to improve mesh quality.
    initial mesh that will be checked and improved to be in the simulation
    Figure 2 : Initial standard mesh on a pump. The standard mesh can have both tetrahedral ad hexahedral elements.

    The picture above is the initial mesh that will be used as an example.

    1. Meshing Log

    First, generate the mesh and once the mesh has been generated, you can see the mesh quality in the Meshing Log. You will find the Meshing Log under the Mesh settings in the simulation tree.

    In the meshing log, you will find the statistical results of your generated mesh. These results will be mentioned as mesh metrics and these metrics will differ depending on the mesh type. It is worth keeping in mind that we need to monitor these values because it will affect the result of the simulation. Below are values that can be used as a best practice reference on when to check and improve your mesh quality:

    • tetAspectRatio: \(\ll \) 100
    • Non-orthogonality: \(\ll \) 75
    • tetEdgeRatio: \(\ll \) 100
    • VolumeRatio: \(\ll \) 100
    example of bad mesh metrics that need to be checked and improved
    Figure 3: Example of bad mesh metrics. Volume ratio should be << 100.

    The picture above shows that our mesh has bad quality because the maximum volume ratio is 93. Now, we have learned how to identify a bad quality mesh, but what is the cause and where are these bad quality elements located? Let’s find out.

    2. Mesh Quality Feature

    The Mesh quality is a SimScale feature, which visualizes the element quality. You will find this feature below the Meshing Log. In this example, we are only going to focus on reducing the maximum value for our volume ratio.

    2.1 Results

    To visualize the volume ratio, do the following:

    1. Click ‘Results’.
    2. Choose the ‘Volume ratio’.
    visualization of mesh volume ratio in mesh quality viewer
    Figure 4: Mesh volume ratio in mesh quality viewer.

    Everything in blue shows that the volume ratio is small in the overall domain. However, the current view can only show the surface elements. The best way to locate the bad quality elements is to isolate them and to do this we can use Isovolumes.

    2.2 Isovolumes

    Isovolumes serves as a filter to isolate elements, whose volume ratio falls under a defined range. In this example, we will find mesh cells that have a volume ratio between 20 and 93. The steps below will explain how you can isolate these elements:

    1. Click the ‘+’ icon next to Isovolumes.
    2. Type the range of the Volume ratio you are interested in. In this example, we want to identify the elements in between 20 and 93 volumetric ratio. Keeping the volume ratio below 100 is good enough for incompressible flow simulation. Here, we reduced the minimum limit to be able to locate the bad elements faster. The assumption is that the element quality will most likely change gradually.
    3. Locate the highlighted elements on the screen.
    isolated elements with volume ratio between 20 and 93
    Figure 5: Isolated bad elements.

    In the picture above, bad elements can be seen, but it is difficult to determine their location. You can focus on the bad elements by changing the view to Transparent Surface Outline Mesh, and then zooming in.

    specific location of bad mesh elements in pump model
    Figure 6: Specific location of bad mesh elements.

    Now, we know where the bad elements are located. Such issues often occur due to the CAD model issues, ill-defined surfaces, small gaps, or sharp corners. The most cost-effective way to deal with these issues is through CAD cleaning.

    However, if you don’t have a chance to do CAD cleaning, you can try to refine the mesh for the whole domain or only refine the mesh where the bad elements exist.

    3. Improve Mesh Quality

    The meshing log might report a bad mesh quality. This is usually bad news but does not necessarily mean that the mesh is inconvenient to use. If there are only a few elements that have bad quality, and if those elements are not at the inlet or outlet boundaries, probably the simulation will still work all right.

    There are two ways to improve the mesh quality:

    • CAD cleaning: Modify the CAD model to prevent the generation of bad quality elements. As an example, remove the tiny gaps, remove the sharp angles, defeature, remove the small features.
    this picture shows the comparison of an original pcb cad model and a cleaned one
    Figure 7: Common CAD cleaning measures on PCBs
    • Mesh settings: Perform manual adjustments to prevent the generation of bad quality elements. For instance, adjust the global mesh settings and add manual refinements to control the cell size.

    Mesh quality metrics are highly correlated to each other. In other words, if the Aspect ratio is bad, most probably the other quality metrics will be bad too. Therefore, it is important to aim for reducing the maximum AspectRatio quality metric.

    ideal and high aspect ratio for tetrahedral and hex elements
    Figure 8: Low and high aspect ratio per element type

    Some useful tips to reduce the maximum Aspect ratio are listed below. Keep in mind that these measures won’t always work. The best workflow is to understand why the quality is bad and apply a corresponding measure accordingly:

    1. Reduce the ‘Number of layers’: Use at least 1 layer. If you are aiming for the correct y+ range, ignore this measure.
    2. Increase the ‘Overall relative thickness’: Keep the range between 10-60%. If you are aiming for the correct y+ range, ignore this measure.
    3. Reduce the ‘Growth rate’: Keep the range between 1.1-1.5. If you are aiming for the correct y+ range, ignore this measure.
    4. Increase the ‘Small feature suppression’: This value will determine the smallest edge length in the mesh, as well as the smallest cell size. Keep in mind that if this value is too high, the mesher will fail.
    5. Increase the ‘Gap refinement factor’: Usually, 0.5 will improve the mesh quality significantly. Ideally, keep this value above 1. Keep in mind that increasing this value will increase the overall mesh size significantly if there is a considerable volume of gap region/s in your model.
    global mesh settings for the standard mesher algorithm in simscale
    Figure 9: Global mesh settings for the standard mesher

    6. Use ‘Local refinement’ and ‘Region refinement’ to locally control the maximum cell size. For example, if there is an edge with a size of 1 \(mm\) in the CAD model, assign 1 \(mm\) maximum edge length at this region.

    7. If you are using manual mesh refinements, be conscious about the cell size assignment. Above all, sudden cell size changes to keep the VolumeRatio small.

    Example: Refine the Elements Locally

    Previously, we found some regions with bad element qualities (Figure 5 and Figure 6). You can always use SimScale’s automatic sizing feature to adjust the mesh size. Increasing the Fineness level will gradually increase the mesh size in the overall domain.

    Another possibility is to refine the mesh in the problematic region with region refinement. Below is an example of how to refine the mesh in a specific region of your model:

    isolated bad mesh elements of pump model
    Figure 10: Isolated bad mesh elements in the region highlighted in red.

    The picture above shows the problematic region where there is a face in the geometry that becomes smaller and smaller. This is a problem because when the thickness of this face becomes too small, sharp edge cells are generated in this region. We will need a region refinement to mesh this region properly. For that:

    1. Add a region refinement.
    2. Create a geometry primitive (Cartesian box).
    3. Assign the Cartesian box you’ve just created.
    4. Assign a suitable cell size to the region.
    region refinement to improve mesh quality
    Figure 11: The cartesian box for mesh region refinement.
    cartesian box configuration for region refinement to improve mesh
    Figure 12: The cartesian box configuration.

    We can also see that the mesh generated at the inlet of the pump is too coarse, and we can refine this by refining the whole model by increasing the fineness level.

    final finer mesh shown in simscale platform
    Figure 13: Final mesh with increases refinement at the inlet and outlet.

    Expected Outcome

    After regenerating the mesh, we will get new mesh with new mesh quality statistics.

    mesh quality statistics after checing and improving mesh quality
    Figure 14: New mesh quality statistics showing reduced max volume ratio.

    The initial mesh was updated with a region refinement as well as an increase in the general mesh fineness. We can see that the maximum volume ratio has decreased to 60.240.

    visual observation of problematic region after region refinement is applied to the mesh
    Figure 15: A visual observation of region refinement.

    We can also observe visually that the element sizes are relatively smaller in the region where the refinement was applied.


    If none of the above suggestions solved your problem, then please post the issue on our forum or contact us.

    Last updated: October 14th, 2022