Avoiding Inverted Mesh Elements
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 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, it is often possible to avoid inverted curved elements by selecting the Avoid inverted curved elements check box in the node’s Settings window under Element Quality Optimization.
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. 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.
Using Linear Geometry Shape Order
When solving a model, the solver ensures that no inverted mesh elements are created. This is done by reducing the geometry shape 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 order for all elements. You do this by choosing Linear from the Geometry shape order list in the Model Settings 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 a plot.
Modifying the Geometry or Mesh
If you do not want to use linear geometry shape order to avoid problems with inverted mesh elements, you can try any of the following:
Select the Avoid inverted curved elements check box in the Free Tetrahedral node’s Settings window under Element Quality Optimization.
Visualizing Inverted Mesh Elements
You can visualize inverted mesh elements using the built-in reldetjacmin variable, which is the minimum of the determinant of the Jacobian matrix for the mapping from local (element) coordinates to global coordinates. A minimum value less than zero for an element means that the element is wrapped inside-out; that is, it is an inverted mesh element.
A typical visualization uses reldetjacmin as the quantity to plot as a volume plot. To display only the inverted elements, add a Filter subnode using the logical expression reldetjacmin<0 to include only the inverted elements.
If you experience inverted mesh elements while meshing, you usually do not have a solution. In such cases, plot the logical expression qual<0 instead, because reldetjacmin is not available. The plot then shows the inverted mesh elements as the elements for which the mesh quality is negative.
If you use reldetjacmin, the plot shows the quality of higher-order elements (if any), while qual always uses linear elements.
Adaptive Mesh Refinement (attribute node)