In the final part of the Meshing in FEA blog series we will discuss a key step in the meshing process, convergence.

# What is mesh convergence?

In finite element analysis (FEA) convergence means arriving at the true solution of the partial differential equations (PDEs) as the geometry, or spatial domain, is meshed more finely. The process of mesh convergence involves decreasing the element size and analysing the impact of this process on the accuracy of the solution.

Typically, the smaller the mesh size, the more accurate the solution as the behavior of the design or product is better sampled across its physical domain. The higher the accuracy, the larger the simulations can become in terms of data to store and handle, which translates to longer runtimes. Engineers often perform mesh convergence studies to obtain the optimal balance between accuracy and runtime.

# The convergence process

Before starting the mesh convergence process, it is important that you have a clear understanding of the physics of the problem and what kind of accuracy is required. In addition, you should analyze the problem geometry prior to modeling to pick out which features are fundamental to the design and those that can be removed or simplified. This will eliminate any unnecessary headaches that may occur when trying to mesh complex geometries. It is also very important that you are confident in the model setup, e.g. material properties, boundary conditions, and so on. These parameters can all add uncertainty to the problem, which could affect the true solution, so it is paramount to take these into consideration before starting the mesh convergence process.

When you are confident in your FEA model setup, you can start with an initial mesh. This mesh should be as coarse as possible but give a sensible output to confirm the model is functioning as expected. For our explicit time-domain simulations, for example, we typically start at 15 elements per smallest acoustic wavelength. Once the setup is validated and the initial results are obtained, you can start the mesh convergence process. This involves running simulations with finer and finer meshes and comparing the results. The comparison of scalar quantities such as resonant frequency or arrival times allows you to judge whether the solution is converging to the steady and true solution.

# Controlling the mesh

Mesh convergence is made easy in OnScale. Any parameter, e.g. element size, can be swept on the cloud through the Cloud Scheduler.

There are other ways to control the mesh than using smaller and smaller elements for the entire simulated domain. Let’s consider the options for structured models first and then we’ll talk about unstructured models afterwards.

## Structured

As mentioned in Part 3 of the series, structured meshes have an implicit connectivity allowing for easy identification of elemental and nodal positions. Structured meshes often employ orthogonal quadrilateral (2D) or hexahedral (3D) elements. This type of mesh can be controlled using a few different methods in OnScale. Element size is often set in OnScale with reference to the minimum velocity and wavelength in the model. Check out Part 1 of the series for more details.

It is recommended that you have at least 15 elements per wavelength to resolve the model. However, some areas may require a finer mesh. The example I am using to demonstrate ways to control the mesh is a PZT disc in a water load. Structured meshes can be refined in certain areas. One way to do this is to specify a minimum number of elements through a certain layer using #keyindx.

Figure 1: Example code to set minimum number of elements between keypoints in j direction

OnScale uses keypoints to allow for rapid parameterization of models. So, if you have a model with three different layers, it is beneficial to put a keypoint at each of these layers, so that when the thickness of one changes, the model adapts to this. In the code above, the last syntax option is 4, meaning that there will always be at least 4 elements through every thickness layer (which is in J(Y) direction for this model).

Figure 2: Result of example code in Figure 1

This is useful for models with very thin layers in the geometry as the box size may be larger than the thickness of these layers. It is important for key materials such as piezoelectric materials to have at least 8 elements through the thickness to be solved properly. The number of elements through each keypoint can also be set manually.

Figure 3: Example code to manually set number of elements in j direction

The first (bottom) green layer in the model is between keypoints j1 and j2, which means there are 7 nodes and 6 elements that make up this layer. The second (middle) red layer in the model is between keypoints j2 and j3, which means there are 11 nodes and 10 elements and so on.

Figure 4: Result of example code in Figure 3

Keypoints can be specified in XYZ directions. This example show the Y keypoints, but this method can be applied to all directions. Do note that with this method, the refinement is done across the plane on a particular axis. For example, in Figure 4 the red material has 10 elements through the thickness but so does the green material in the section to the right. If you have a very small section of detail to refine, this may not be feasible method as it could drastically increase the solve time due to the small explicit timestep determined by the smallest element.

Instead, OnScale has a refined grid method that allows you to partially combine a fine and coarse grid together. The setup process is more complex so if you would like more information on this method, please get in touch via our Forum.

Figure 5: Example of refined grid method

## Unstructured

As mentioned in Part 3 of the series, unstructured meshes have a general connectivity (GCON) whose structure is arbitrary. Unstructured element types are non-orthogonal, such as triangles (2D) and tetrahedra (3D). The example I will use to explain how to control the mesh in unstructured meshes is a plate with a hole.

In OnScale, the size of unstructured elements can be specified using the mopt command for that element type.

Figure 6: Code example of defining element size through edgelen

The edgelen option in the mopt command uses the value specified as the length of the element edge. It is important to note that if you have scaled your CAD then this is applied to your edge length. So, for the above example the triangles’ element edge length is 0.5e-7 m.

Figure 7: Result of example code in Figure 6

Another way to set up an unstructured mesh is to use the nsample option in the mopt command.

Figure 8: Code example of defining element size through nsample

This option calculates the edge length by getting the largest diagonal distance in the CAD geometry and dividing this by the value specified.

Figure 9: Result of example code in Figure 8

Unstructured meshes can be refined on specific edges and surfaces using the sample ratio.

Figure 10: Code example of refining elements using sample ratio

Edges and surfaces can be defined in the cad command for load application but also for edge/surface refinement. In 2D models, the edge2d command is used to define edges with the last syntax argument setting the sample ratio: the ratio of that specific edge length to the edge length specified in the mopt command.

Figure 11: Result of example code in Figure 10

We hope you enjoyed our Meshing in FEA blog series. Be sure to keep an eye out for more series covering important FEA topics!