websights

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.

    non-orthogonality greater than 60 mesh quality viewer
    Figure 1: Mesh elements with Non-orthogonality > 60 highlighted

    Approach

    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.
    • Visually inspecting the mesh.
    • Using the Mesh Quality feature to locate bad elements.
    • Improving mesh quality
    car inside mesh
    Figure 2: Initial standard mesh on the interior of a Car. The standard mesh can have both tetrahedral and hexahedral elements.

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

    1. Meshing Log

    To begin, create the mesh for your simulation. Once the mesh generation is complete, you can review the mesh’s quality by accessing the Meshing Log, which is located under the Mesh settings in the simulation tree.

    meshing log how to access
    Figure 3: How to access the Meshing log, where mesh metrics will be displayed

    The Meshing Log provides statistical data on the generated mesh, referred to as mesh metrics. These metrics vary depending on the type of mesh used. It is crucial to monitor these values, as they significantly influence the accuracy and convergence of your simulation results.

    As a best practice, consider the following reference values to assess and improve your mesh quality:

    • tetAspectRatio: \(\ll \) 100
    • Non-orthogonality: \(\ll \) 88
    • tetEdgeRatio: \(\ll \) 100
    • VolumeRatio: \(\ll \) 100

    Different metrics for FEA/CFD

    Whereas keeping all of these values controlled is always a good approach to achieving simulation convergence, there are some which are more relevant to FEA/CFD analysis. As a general rule, CFD simulations with a Non-orthogonality higher than 88 are very likely to fail. For FEA the relevant metrics are Skewness (< 10) and Aspect/TetAspect Ratio (< 30/16).

    For more information, take a look at the corresponding section from the general documentation on Mesh Quality.

    The picture below shows that the mesh for our Car Interior Model is lacking in quality, especially when looking at its non-orthogonality which is above 89:

    bad quality metrics
    Figure 4: Example of bad mesh metrics. Non-orthogonality should be < 88.

    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. Visual Inspection of the Mesh

    The primary objective of visually inspecting a mesh is to identify potential issues, particularly in areas where:

    • Boundary layers exhibit irregular behavior (e.g., collapsing)
    • The model’s resolution appears too coarse
    • There is a noticeable concentration of cell elements

    For instance, during this analysis, we’ll focus on identifying regions with high cell concentrations, as this is one of the most common issues that can be detected through visual inspection.

    Let’s take the spot highlighted in the figure below as an example:

    visual cell concentration
    Figure 5: Visually noticeable mesh cell concentration

    By looking at the mesh, it seems like some feature in the original CAD model is making elements near this point smaller in size. If we zoom in, we find out that there’s an edge intersection causing this to happen – and as an additional byproduct of our inspection we can also see a potentially problematic small face leading to a sharp edge!

    cell concentration geometric causes
    Figure 6: Geometry features which cause the cell concentration

    Cells tend to concentrate in specific regions because the mesher attempts to capture the intricate features of the original CAD model. To achieve a smooth transition between small and large cells, the mesh becomes particularly fine near these areas.

    Unwanted features in the CAD model

    The preparation of a CAD model depends on its intended application – whether in architecture, 3D printing, manufacturing, or another field. Simulation is no exception. For effective simulation, the CAD model should be as streamlined as possible, minimizing unnecessary small faces and edges that can result in an excessively large mesh. Simplifying the model in this way ensures better performance and more accurate simulation results (form more information take a look at our CAD Preparation and Upload documentation).

    This is interesting because, as will be discussed further, CAD cleaning is the most effective way of reaching a high quality mesh.

    3. Mesh Quality Feature

    Mesh quality is a SimScale feature, which visualizes the element quality. You will find this feature below the Meshing Log. In this example, we will focus on reducing the maximum value for our Non-orthogonality.

    access mesh quality viewer
    Figure 7: How to access the Mesh quality viewer

    3.1 Results

    To visualize the Non-orthogonality, do the following:

    1. Click ‘Mesh quality’
    2. Apply ‘Non-orthogonality’ to the Coloring option under Parts Color.
    Figure 8: Mesh Non-orthogonality in mesh quality viewer.

    The non-orthogonality varies significantly across the domain, as indicated by the color gradient aligned with the legend. However, to effectively identify and address elements with poor quality, it’s best to isolate them. This can be achieved using Isovolumes.

    3.2 Isovolumes

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

    1. Go to the Mesh quality viewer
    2. Click the ‘Iso Volume’ icon.
    3. Type the range of the Non-orthogonality you are interested in, which is 80 to 89.99 in this case. Keeping the non-orthogonality below 88 is usually enough for a first convergence of the model – especially if there are non-orthogonal correctors put in place.
    4. Locate the highlighted elements on the screen.
    great non-orthogonality elements
    Figure 9: Isolated bad elements

    In the picture above, bad elements can be seen, but you can focus on the bad elements by zooming in.

    close up great non-orthogonality elements
    Figure 10: Specific location of bad mesh elements.

    How to use transparency in the mesh quality viewer?

    There are two ways to set your model to a lower opacity in the mesher:

    1. Select a render mode and set Opacity to a lower value under Parts Color.
    Transparency in the mesher
    Figure 11: Setting up a model to transparent in the Mesh quality viewer

    Now that we’ve identified the locations of the problematic elements, it’s important to understand that these issues – as pointed earlier – often stem from CAD model imperfections, such as poorly defined surfaces, small gaps, or sharp corners. The most cost-effective solution is to address these issues through CAD cleaning.

    However, if CAD cleaning isn’t an option, you can either refine the mesh across the entire domain or focus specifically on the areas with poor-quality elements. These two approaches will be our next steps.

    4. 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 12: 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 13: 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 15: 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 1: Trying to 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 a Local element size.

    Figure 6 shows the problematic region where there is a sharp edge in contact with an irregular surface. This is a problem because when the thickness of this face becomes too small, sharp edge cells are generated in this region. We will try to apply a Local element size refinement to solve the issue. For that:

    1. Add a Surface custom sizing refinement.
    2. Select the faces where it will be applied.
    3. Assign a suitable cell size.
    Figure 16: Settings for Surface custom sizing mesh refinement.

    The difference between the two meshes is notable when looking at the region of interest, as presented in the picture below.

    visual results of the local element size refinement
    Figure 17: Final mesh with increased refinement at the inlet and outlet.

    Example 2: Cleaning up the CAD

    After regenerating the mesh, we will get a new mesh with new mesh quality statistics. In this particular case, the local refinement wasn’t enough to solve the issues with the mesh and made it much larger as a result. A better option then, seemed to be cleaning up the geometry altogether.

    In our case, one option might be the following:

    cleaned up geometry for simulation
    Figure 18: Adapted geometry now with fewer problematic spots

    Some of the changes made were:

    • Simplification of the heads and arms
    • Closing of gaps between the heads and back of the passenger and the seats
    • Removing details from the seats

    In summary, they basically consisted of a simplification of shapes and closing up of gaps which were making it hard to generate a mesh with a low enough Non-orthogonality.

    When generating a mesh with these adjustments to the geometry, the max Non-orthogonality dropped to a more acceptable level:

    meshing log metrics after cleaning up the geometry
    Figure 19: Non-orthogonality after generating a mesh with the adpated geometry

    An option now is to apply some Non-orthogonal correctors if deemed necessary.

    Note

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

    Last updated: October 31st, 2024

    Contents