Element Mesh Visualization
The element mesh wireframe visualizations are an efficient means of creating an approximate visualization of an ElementMesh. The visualization uses linear elements to visualize the mesh. For a more complete visualization of meshes, an ElementMesh should be converted to a MeshRegion; HighlightMesh could be used for more advanced visualization.
An ElementMesh is typically created with either ToBoundaryMesh or ToElementMesh.
To use the package, the FEM context needs to be loaded.
Wireframes
To inspect element meshes, it is convenient to look at their wireframes.
mesh["Wireframe"] | show the edges making the mesh wireframe |
mesh["Wireframe"[pos]] | show the elements having positions corresponding to the list of positions pos. |
mesh["Wirefame"[ElementMarker m]] | show the elements having ElementMarker corresponding to the marker m. |
ElementMesh wireframe commands.
More information on mesh quality can be found in the Element Mesh Generation tutorial.
All options presented so far work for all mesh elements: "MeshElements", "BoundaryElements" and "PointElements". For more details, please consult the documentation for ElementMesh.
Note that the interface between different mesh element markers forms an internal boundary.
Note that for the point elements, only the boundary incidents are visualized. If no point elements are given explicitly, then the point elements are derived from the incidents of the boundary elements.
One alternative way to visualize the mesh is by using MeshRegion.
If specific point elements are given, those will be used.
For mixed-type elements or multiple elements, the numbering of the elements is according to the position in the list.
To color the element mesh, the number of "MeshElementStyle" components must match the number of markers.
A marker can also be part of boundary meshes.
In 3D, the default wireframe to draw is the boundary mesh.
"ContinuousElementID" | displays elements with continuous numbers |
"MeshElement" | specifies which mesh element should be drawn |
"MeshElementIDStyle" | specifies the style with which the mesh element ID should be drawn |
"MeshElementMarkerStyle" | specifies the style with which the mesh element marker should be drawn |
"MeshElementStyle" | specifies the style with which the mesh element should be drawn |
Options for "Wireframe" visualization of an ElementMesh.
STL files can be imported as boundary element meshes.
A wireframe in 3D displays all boundary elements by default. If components in the boundary mesh are finely resolved, the wireframe mesh may be excessively dense in those areas. As an alternative, an edge frame mesh can be used in 3D. Dominant edges are those edges where neighboring surfaces have a different normal.
"Edgeframe" has the same options as Graphics3D, with the following additions:
"BoundaryGroupingThreshold" | controls the grouping of boundaries by normal direction |
"EdgeframeDirective" | specifies how edges should be drawn |
Options for "Edgeframe" visualization of an ElementMesh.
Boundary markers are auto-created. They can be visualized by assigning different colors to them.
Sometimes one wants to scroll though boundary markers or point markers to find a particular surface or boundary point where a boundary condition is to be applied.
For more control over the point markers in a full element mesh, the option "PointMarkers""BoundaryDeduced" can be specified to ToElementMesh.
Another option is to display all surfaces and add a legend.
A similar setup can be made for boundary points.
Issues
The intent of the wireframe visualization is to give an approximate visualization of an ElementMesh. The visualization uses linear elements to visualize the mesh.
Note that the mid-side nodes are on the curve of the Disk, but since the wireframe visualization is linear only, it appears as if the nodes are outside.
Visualizing Deformations
When analyzing structural mechanics with NDSolve, the deformation of objects under load is computed over a region. Sometimes it is convenient to visualize the region as if it were deformed by the load.
The exact physics in this example is not relevant here; it suffices to say that for structural mechanics applications computed with the finite element method with NDSolve, the number of dependent variables specifies the number of deformation functions.
NDSolve returned two interpolating functions, one for the deformation in the direction and one for the deformation in the direction. In order to show the deformed beam, an element mesh must be created for the beam at rest, which is deformed by the interpolating functions given.
In cases where the deformation is not visible because the amount of deformation is small, a scaling factor can be specified.
ElementMeshDeformation can be used in 2D and 3D.
Options for ElementMeshDeformation visualization of an ElementMesh.
The automatic scaling factor computation uses a relation between the smallest typical length and the largest deformation.
Converting ElementMesh
It is possible to convert ElementMesh into various other formats for visualization purposes. A conversion to a MeshRegion can be done as follows:
It is also possible to convert ElementMesh to GraphicsComplex.
Special directives can be given.
Options for GraphicsComplex can be specified.