fe_quality#
Purpose
Mesh quality measurement tools
Description
This function provides mesh quality measurement, visualization and report tools. Badly shaped elements are known to cause computation error and imprecision, and basic geometric tests can help to acknowledge such property. Every element cannot be tested the same way therefore the lab command presents the tests available for each kind. The geometric measurements performed are described in the following section.
An integrated call is provided for feplot,
fe_quality(cf.mdl);
This call performs all test available and opens a GUI allowing the user to customize the views.
Available tests
Degenerate#
Degenerated elements have overlaying nodes which is generally unwanted. The set is automatically generated when such elements are detected.
Jacobian#
This test computes the minimum Jacobian for each element and detects negative values. It is directly related to the element volume so that a wrapped element would show such pattern. The set is generated only if elements with negative Jacobian are detected.
AspectRatio#
This test can be applied to any kind of element. It computes the ratio of the longest edge length to the shortest one. Thus a good element will have an aspect ratio close to one while a badly shaped element will have a greater aspect ratio. The Default tolerance for visualization is set to 2.
MaxIntAng#
This test can be applied to triangle and quadrangle elements (tria3, tria6, quad4, quad8, quadb). It measures the greatest angle in an element which is an indication of element distortion. The default tolerance is set to 110 degrees.
GammaK#
This test is applied to triangle elements (tria3, tria6). It computes the ratio between the radius of the inscribed circle and the circumcircle. This indicator is named γK and is bounded between 0 and 1. Well shaped elements will have a γK coefficient close to one. Degenerated triangles show γK = 0. The default tolerance is set to 0.5.
MidNodeEgde#
This test is applied to quadratic triangles (tria6). It measures the distance of the middle nodes to the edge nodes. The ratio between the distance from the middle node to the first edge node (l1) and the distance from the middle node to the second edge node (l2) is computed for each element as MNE = maxi=1...3(max(l1i/l2i,l2i/l1i)/min(l1i/l2i,l2i/l1i)) The default tolerance is set to 1.5.
MaxAngleMid2Edge#
This test is applied to quadratic triangles (tria6). It measures the distortion of the edges by computing the maximum angle between the straight edge (between both edge extreme nodes) and the actual edges through the middle node. The maximum over the whole triangle is output, the default tolerance is set to 30 degrees.
Taper#
This test is applied to 2D quadrangle elements (quadb). It compares the areas of the 4 triangles formed by the diagonals and each edge to the area of the full quadrangle. The exact computation is max(2Ai/AK). Thus a well shaped element will show a taper ratio close to 0.5, while a badly shaped element can have taper ratios over 1. The default tolerance is set to 0.8.
Skew#
This test is applied to quadrangle elements (quad4, quad8, quadb). It evaluates the element distortion by measuring the angle formed by the diagonals (the maximum angle is taken). A square will then show a skew angle of 90 degrees, while a distorted element will show angles over 150 degrees. The default tolerance is set to 110 degrees.
Wrap#
This test is applied to quadrangle elements (quad4, quad8, quadb). It measures the coplanarity of the 4 vertices by comparing the height of the 4th point to the plan generated by the first three points (H), relatively to the element dimension. The exact formulation is W = H/l(D1)+l(D2). Perfectly planar elements will have a null wrap coefficient. The default tolerance is set to 10−2
RadiusEdge#
This test is applied to tetrahedron elements (tetra4, tetra10). It measures the ratio between the radius of the circumsphere to the minimum edge length of a tetrahedron. Well shaped elements will show a small value while badly shaped elements will show far greater values. The radius edge coefficient is lower bounded by the radius edge ratio of the regular tetrahedron: RE ≥ √6/4. The default maximum value is set to 2, which usually is sufficient to have a quality mesh. Sliver elements may not be detected by this measure.
Sliver#
This test is applied to tetrahedron elements (tetra4, tetra10). A sliver element is a nearly flat tetrahedron, such pathology can lead to bad conditioning due to the very small volumes that can be engendered by these particular elements. This is well detected by computing the ratio between the maximum edge length to the minimum altitude (from a vertice to the opposed face). Sliver elements will have large values and possibly infinite if degenerated. The degenerated elements are set to a value of 105 for visualization, the default tolerance is set to 10.
FaceAspect#
This can be applied to hexahedron and pentahedron elements (hexa8, hexa20, penta6, penta15). It measures the aspect ratio of each face of the elements. The default tolerance is set to 2.
Unstraight#
This can be applied to any element with middle nodes. It measures the Euclidean distance between the edge middle (if the edge were straight) and the actual position of the middle edge node. Tolerance is set at 0.1.
RadiusCircum#
This measure can only be accessed separately, with an explicity specification in the meas command. It measures the circum radiuses of triangle elements. This is applicable to tria3 and tria6 elements.
Commands
lab[...]#
Outputs or prints the tests available and their default tolerance. If no output is asked this is printed to the prompt. fe_quality('lab') outputs the list of element tested with the command for detailed information. fe_quality('lab EltName' prints the tests available for the element EltName and the default tolerances associated.
meas[...]#
Computes the mesh quality measurements. For a feplotmodel, the results are stored in the stack under the entry 'info','MeshQual'. The results are given by element groups unless a specific element selection is given as a third argument. Accepted calls are MQ = fe_quality('meas',model); Computes all available tests per element group.
MQ = fe_quality('meas -view MName',model); Computes the MName test and visualize it.
MQ = fe_quality('meas',model,'EltSel') Computes all measurement tests for the specified EltSel element selection.
MQ is the mesh quality output. It is a structure of fields eltid, data and lab. All fields are cell arrays of the same size related to the measures described in the lab entry as MName_ElemF_EGID for which corresponding EltId and measurement values (data) are given. Direct visualization of the results can be obtained with the -view option.
view[...]#
Performs a visualization of the quality measurements of a feplotmodel. The stack entry 'info','MeshQual' must exist (created by meas). Two feplotselections are generated. First the elements are face colored in transparency with a colored ranking. Second, the elements outside the measurement tolerance are plotted in white patches of full opacity. Both plots generate an EltSet, the elements plotted are stored in 'set','MeshQual_eltsel', the elements outside tolerance are stored in 'set', 'MeshQual_MName_tol_val' with MName the test considered and val the tolerance value.
The tolerance can be defined using the command option -tol val. A positive (resp. negative) tolerance val defines pathologic elements over (resp. under) the threshold.
Command option -noGlobalMesh customizes the selection so that the global mesh in transparency is not displayed.
It is possible to plot a sub selection of the elements measured by specifying an EltSel as third argument. The curve colordataelt plot can also be output.
fe_quality('view'); Default visualization, AspectRatio is plotted as it is available for every element.
fe_quality('view MName -tol val',cf); feplotpointer, MName and tolerance val test are specified.
fe_quality('view',cf,EltSel); An additional element selection EltSel to restrict the mesh quality measurement plot.
MeshDim#
fe_quality('MeshDim',model) returns a line vector [weight average min max] giving an indication on the mesh dimensions. The mesh edge lengths of all elements are computed, and the average, min and max data are output.
Command option -print allows printing this data in a human readable format to the output display.
Another use of command MeshDim is to recover element indices with a threshold on their length. Use command option -getOverval with a three output argument call. [r1,r2,r3]=fe_quality('MeshDim -getOver val',model); will output in r3 element indices in model.Elt that verify
- minimum edge length over val if val>0
- miminum edge length under or equal to abs(val) if val<=0
print#
Prints out the mesh quality report sorted in 'info', 'MeshQual' of a model or a feplotfigure. By default the results are printed to the prompt, a specific file can be given in the print command. E.g.
fe_quality('print myMeshQualityReport',model);
CleanNJStraight#
This command attempts to improve a model numerical conditioning by straightening the edges of quadratic elements with negative Jacobians. This command can be iteratively performed as the local movements of specific middle edge nodes can result in distubances in the connected elements.
model=fe_quality('CleanNJStraight',model); will output the model with altered nodal positions corresponding to the edge straightening of quadratic elements with negative Jacobian.
Command option -nitN will ask to run a maximum of N passes unless all Jacobians become positive.
clear[...]#
This command clears the element quality visualization and can also clean up the stack of any element sets created during the view procedures. All entries created by fe_quality in the model Stack are of the 'info' or 'set' type with a name starting by MeshQual.
fe_quality('clear') clears the feplotselection and visualization.
fe_quality('clearall') clears the visualization and removes every stack entry concerning mesh quality.
fe_quality('clear MName') removes from the stack a specified MName measurement visualization.