Avoiding Inverted Mesh Elements
This section will go through how to avoid inverted mesh elements while solving. Refer to Information, Warning, and Error Nodes for information about avoiding bad quality elements when building the mesh.
Inverted Mesh Elements
If you have a mesh that is coarse along a curved boundary, you might encounter problems with inverted mesh elements. This means that a mesh element is wrapped inside-out or has zero area (in 2D) or volume (in 3D). More precisely, there is some coordinate for which the Jacobian matrix for the mapping from local to global coordinates has a negative or zero determinant. In most cases, the linear (straight) mesh elements that you see in a mesh plot are not inverted, but the higher-order curved mesh elements used for computing the solution might be. Studying the linear minimum element quality therefore does not reveal the presence of inverted mesh elements in most cases.
Inverted mesh elements in themselves do not pose any immediate threat to the overall accuracy of your solution. However, if you are using an iterative solver, it might fail to converge. If you reach convergence and the solution looks good, it likely is. It is worth bearing in mind that the faces where there are inverted elements are less than perfectly resolved. If these faces are important for your results, you might want to pursue a mesh without inverted elements or at least make sure that the mesh resolution is sufficiently fine to guarantee an accurate solution. The easiest way to get an idea of the accuracy is to try a few different meshes and see how the solution changes. If the variation does not exceed your limits of acceptance, you are fine.
The solver prints a message about inverted curved elements to the Messages window and corresponding warnings to the Log window if they appear. Warnings () nodes also appear in the solver sequence where the inverted mesh elements appear. If you are using a Free Tetrahedral node to create the mesh, the Avoid inverted curved elements check box is selected by default in the node’s Settings window under Element Quality Optimization to reduce the risk of inverted curved elements.
For a moving mesh, the mesh can become inverted, in which case an error occurs. In the Error () node, which appears in the solver sequence, information about the location of the inverted elements appears.
Visualizing Inverted Linear Elements
If you experience inverted mesh elements while meshing or while importing meshes, create Mesh Plots with the logical expression qual<eps. The plot then shows both the inverted mesh elements, for which the mesh quality is negative, and the totally degenerated elements, for which the mesh quality is zero or very close to zero. The quality measure qual always uses the linear elements.
Visualizing Inverted Curved Elements
If the method used to avoid inverted elements fails, it may happen that inverted elements are present in the mesh you solve on, as described in the first section. You can visualize inverted mesh elements using the built-in qualcurvedskewness variable, the elementwise product of skewness and reldetjacmin, which is a measure of the deformation when generating the higher-order element. A minimum value less than zero for an element means that the element is wrapped inside-out; that is, it is an inverted curved mesh element.
Use the nonlinear quality measure qualcurvedskewness (Curved skewness) to plot or evaluate inverted curved elements. Add a Mesh Plots with an element filter set to qualcurvedskewness<0 to include only the inverted elements. Note that the curved quality can only be evaluated on full-dimensional elements, that is volume elements in 3D and surface elements in 2D. Change the Geometry shape function setting to the appropriate higher order shape function for the Mesh dataset. Use the expression qualcurvedskewness<0.1 to include also highly curved and low quality elements.
Visualizing Inverted Elements in a Deformed Mesh
If inverted mesh elements occur while deforming a mesh, check the Error () node in the solver sequence, to see information about the location of the inverted elements.
To inspect problematic areas in 2D, add a Surface plot, plotting the expression qualskewness using the solution dataset. Select the Wireframe check box in the surface plot to see the individual deformed mesh elements. For 3D, it can be useful to create similar plots using Slice plots for different cross-sections. Use the locations in the Error node as a guidance on where to locate the Slices.
If remeshing of a deformed mesh fails, the problematic mesh is available as a Problematic Deformed Mesh () node under Meshes, so that you can inspect the mesh around the coordinates for the inverted mesh elements.
Curved Interior Domain Elements
In many situations, the inverted elements can be fixed by curving elements inside the domain to match the boundary. You find the Avoid inverted elements by curving interior domain check box, which controls if elements inside the domain are curved, in the Settings window for the Component node. The default behavior is to curve interior domain elements when needed. In 3D, this setting also has the effect that elements inside a face can be curved to match the face edges.
Figure 8-19: Curved interior mesh elements (left) and the corresponding linear mesh (right).
In some situations, it is impossible to avoid the inverted elements no matter how the interior mesh elements are curved. This can, for example, happen if the domain becomes infinitely thin where two circles (or cylinders in 3D) touch, or if the mesh is extremely coarse and does not approximate the true geometry shape well enough. Then the higher-order node points (that control the curving) are moved away from the geometry boundaries, typically making the elements less curved than they should be according to the geometry. When this happens, the solver will print information indicating how many points were moved and how much in the Log window.
Visualizing the Geometry Approximation
The geomapproxdist variable indicates, for each element, how far a node point in the element was moved from the geometry. To see the parts of the geometry that are affected, add Mesh Plots with surface plots of geomapproxdist, or make a volume plot with an element filter set to geomapproxdist>0.
Modifying the Geometry or Mesh
To reduce problems with badly shaped elements or geometry approximations you can try any of the following:
Create a Swept 3D mesh instead of using the tet mesher.
Using Linear Interior Domain Elements
If you disable the use of curved interior domain elements, the solver tries to avoid inverted elements by linearization. This is done by reducing the geometry shape function order for the corresponding elements to first order. By default, the solver does this automatically. Alternatively, you can avoid problems with inverted mesh elements by using linear geometry shape function order for all elements. You do this by choosing, for example, Linear from the Geometry shape function list in the General section of the Settings window for the main Component node.
Visualizing Linearized Elements
The variable linearizedelem is 1 in elements that are linearized and 0 elsewhere. You can use this variable to identify mesh elements with linearized elements. For example, use linearizedelem as the expression in Mesh Plots.
See Swept Meshing of a Bracket Geometry:
Application Library path COMSOL_Multiphysics/Meshing_Tutorials/bracket_swept_mesh.
See the tutorial Removing Small Geometric Entities with Remove Details for an example that uses Information nodes to find and remove small details in a geometry.
See the tutorial Removing Small Geometric Entities with Repair in Introduction to the CAD Import Module for an example that uses the CAD Defeaturing tools to remove fillets.