# Mesh Generation Overview (Tetrahedral)

#### Unstructured Mesh Generation

The following section focuses on the principles of unstructured volume mesh generation (e. g. tetrahedral mesh). Similar considerations apply to other unstructured mesh types (e. g. Surface and Planar).

First, we explain the basic procedure of creating a tetrahedral mesh. Let us assume that a model consisting of several parts needs to be meshed. The solution methods require consistent meshes at the interfaces of different parts in order to set up the matrix equations correctly.

The following picture shows two blocks touching each other at one of their faces. If the meshes were created independently for both blocks, the meshes might become inconsistent at the interfaces.

The typical solution to this problem is to create a "non-manifold" simulation model first. This intermediate operation converts coincident faces from two solids to a single common double-sided face. Once this is done, the edges and faces of the model can be meshed in a first step. Based on this surface mesh, the volume mesh can then be created afterward. The non-manifold model guarantees that the surface meshes of neighboring solids are identical at their interfaces since they are built from the same surface mesh of the mutual double-sided face.

The following picture illustrates this procedure:

The tetrahedral mesh generation can be summarized as follows:

1. Build the non-manifold simulation model.

2. Mesh the model’s edges and faces: "surface meshing"

3. Mesh the model’s volumes based on surface mesh: "volume meshing"

Once the initial volume mesh is created, its quality can be improved by mesh smoothing or mesh optimization.

Mesh smoothing is an iterative scheme that moves the mesh nodes in order to improve the quality of the tetrahedrons.

In contrast, mesh optimization is a technique that swaps edges and faces and reconnects them to form better quality tetrahedrons. The following picture shows a 2D example of how mesh optimization can improve mesh quality:

The tetrahedral mesh will be automatically created whenever a solver is started requesting this type of mesh. However, in order to visualize the mesh before running a simulation, you can enter the mesh view at any time (Home: Mesh > Mesh View, ). The global mesh properties dialog box (Home: Mesh > Global Properties, ) allows you to change the mesh preview to the tetrahedral mesh type if this has not already been done by a previous solver run.

Since the creation of the tetrahedral mesh is a computational expensive task, the mesh is not automatically updated after each change. You can force a mesh update by clicking the Update button in the mesh properties dialog box or by choosing Mesh: Mesh Control > Update  ( ).

In the dialog one can define global mesh generation parameters such as maximum and minimum cell size. The mesh generation can be further controlled by parameters accessible by the "Special..." button in the dialog box. The dialog contains settings to influence the non-manifold model creation stage (Model preparation) and the mesh refinement settings e. g.  to control the quality of the approximation of the curved surfaces (Mesh Control). Please refer to the dialog documentation available through the "Help" button on the dialog for the explanation of the individual settings.

Due to mesh refinement based on the curvature of the object’s faces, the mesh becomes infinitely dense at a structure’s singularities such as the tip of a cone:

The infinite refinement due to surface curvature is prevented by specifying the minimum cell size in  Home: Mesh > Global Properties,.

Some imported models may contain "noise" - extremely small geometric details due to modeling inaccuracies or translation errors. The following picture shows such an example with a small gap and a small spike. Even if the tetrahedral mesh generation is able to properly mesh these types of geometry, this may nevertheless result in unnecessarily fine meshes:

Some of the small structure details ("features") can be automatically suppressed by using an appropriate setting in the Model preparation section of the dialog accessible via Home: Mesh > Global Properties > Specials. The mesher will then try to suppress tiny mesh edges below a specified threshold, as shown in the picture below.

##### Local Mesh Properties for Unstructured Meshes

Some mesh generation parameters, such as "Maximum step width" can be specified also for individual objects. The parameters for a selected object are accessible through Mesh: Mesh Control > Local Properties in the Mesh View or via the context menu by right-clicking the object in the Navigation Tree. Please note that Local Mesh Properties can be defined for a group of objects by using Navigation Tree: > Groups > Mesh Groups.

The tetrahedral mesh generation usually tries to generate tetrahedrons as equilateral as possible in order to obtain a high quality mesh. Therefore, the Max. stepwidth setting is a single value consistently applied to all directions.

Now consider the following structure as an example:

The feeds are modelled by two cylinders with a relatively small radius. Using the default settings, the shape of the cylinders is not accurately represented by the tetrahedral mesh as shown in the following picture:

Specifying a maximum mesh step width for the two cylinders (e.g. half the radius) forces the mesher to sample the cylinders more accurately. As an alternative, the curvature refinement factor could be increased which would also yield a better resolution of the cylinders. The latter criterion, however, would be applied to all other shapes as well, which is not always the desired solution.

##### Meshing Thin Conductors using Tetrahedral Mesh

Meshing thin conductors using a tetrahedral mesh can noticeably reduce the mesh quality. Note that due to the PBA® technique, this is not the case for hexahedral types of meshes.

The following picture shows a cross-section of a mesh for a structure with a thin perfectly electrically conducting strip:

As can clearly be seen, the thin strip causes some of the tetrahedrons to become very flat, resulting in poor overall mesh quality. The latter will cause performance degradation since the convergence of the iterative equation system solvers strongly depends on the mesh quality. Furthermore, the convergence of the adaptive mesh refinement strategies is negatively affected by low quality meshes.

As a rule, you should always consider whether the finite thickness of the conductors should be taken into account when using tetrahedral meshes. Whenever possible, you should model such conductors as infinitely thin which yields shorter simulation times.

If you already have a model with finitely thick conductors, it may be easiest to use the Shape from picked faces operation which is explained in detail in the Planar Structure Tutorial.

### The following topics will try to explain how a tetrahedral mesh influences the simulation and what requirements should be fulfilled to obtain good results on tetrahedral meshes. For an overview on hexahedral meshing, see Mesh Generation Overview (Hexahedral)

Mesh and simulation

The mesh influences the accuracy and the simulation time of the solver. Please mind that tetrahedral meshes combined with first order elements need a higher resolution to gain the same accuracy as when higher order elements are used. (Second order elements are default in all CST EM Studio solvers.)

Viewing the mesh

The mesh can be displayed in the Mesh View. Besides, graphical feedback from the mesh generation may be available (see: Meshing Feedback Tips and Tricks).

Automatic mesh generation

A tetrahedral mesh is generated by an automatic mesh generator. If a solver will be started with a tetrahedral method, the mesh generator will be started automatically, unless a valid tetrahedral mesh already exists.

Alternatively, you may run the mesh generation to view the mesh before you start a specific solver by selecting Mesh: Mesh Control > Update in the Mesh View. Previewing the mesh is not necessary, but is recommended to get obtain insight as to whether  the defined problem is sufficiently resolved by the mesh, particularly if you do not use the adaptive mesh refinement.

Mesh and structure approximation - surface and volume mesh

Shape boundaries and sheets are discretized by the surface mesh consisting of triangles. A fine surface mesh will result in a good approximation of the structure geometry. Each triangle of the surface mesh is a side of one or two adjacent tetrahedrons. Consequently, each tetrahedron is part of a unique volume structure element (shape). This means that tetrahedral meshes always resolve material jumps and domain boundaries.

The set of tetrahedrons is called the volume mesh.

Controlling the mesh globally

The behavior of the automatic mesh generation can be changed by adjusting its parameters. These parameters can be accessed from the global mesh properties dialog box (Mesh: Mesh Control > Global Properties, ) and the corresponding specials sub dialog box. (Mesh: Mesh Control > Global Properties > Specials).

Controlling the mesh locally for specific structure elements

It is possible to set specific mesh control values for single structure elements. This can be carried out by selecting the corresponding shape and choosing either Mesh: Mesh Control > Local Properties or Local Mesh Properties from the context menu.

Note that by multi-selection (holding down the CTRL key while selecting a shape) it is possible to simultaneously set the mesh property for several shapes.

Setting a locally finer mesh may be recommended for

• structure elements of high importance for the simulation,

• shapes with a too coarse geometry representation in the mesh (e.g. a cylinder, for which the mesh representation does not look smooth enough).