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.

In[10]:=
Click for copyable input

Wireframes

To inspect element meshes, it is convenient to look at their wireframes.

Create a triangle element mesh with six triangle elements and markers.
In[3]:=
Click for copyable input
Out[3]=
Visualize the element mesh wireframe.
In[4]:=
Click for copyable input
Out[4]=
Convert to a MeshRegion.
In[5]:=
Click for copyable input
Out[5]=
Visualize the element mesh wireframe in green.
In[6]:=
Click for copyable input
Out[6]=
Visualize the element mesh in green.
In[7]:=
Click for copyable input
Out[7]=
Visualize the element mesh in green and the faces in red.
In[8]:=
Click for copyable input
Out[8]=
Visualize the element mesh wireframe with the element identification numbers in red.
In[9]:=
Click for copyable input
Out[9]=
Visualize the element mesh wireframe with the element markers in blue.
In[10]:=
Click for copyable input
Out[10]=

All options presented so far work for all mesh elements: , , and . For more details, please consult the documentation for ElementMesh.

Visualize the boundary element mesh wireframe.
In[11]:=
Click for copyable input
Out[11]=
Visualize the boundary element mesh wireframe with the element markers in blue.
In[12]:=
Click for copyable input
Out[12]=
Visualize the point element mesh wireframe.
In[13]:=
Click for copyable input
Out[13]=
Visualize a combination of different aspects of an element mesh.
In[14]:=
Click for copyable input
Out[14]=

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.

Inspect the boundary and point elements.
In[15]:=
Click for copyable input
Out[15]=
In[16]:=
Click for copyable input
Out[16]=

One alternative way to visualize the mesh is by using MeshRegion.

Use MeshRegion and HighlightMesh for visualization.
In[17]:=
Click for copyable input
Out[17]=

If specific point elements are given, those will be used.

Create an element mesh with mesh elements, boundary elements, and point elements.
In[18]:=
Click for copyable input
Out[18]=
Visualize the point elements in a mesh.
In[19]:=
Click for copyable input
Out[19]=

For mixed type elements or multiple elements, the numbering of the elements is according to the position in the list.

Create a mixed element mesh with element markers.
In[20]:=
Click for copyable input
In[21]:=
Click for copyable input
In[23]:=
Click for copyable input
Out[23]=
Visualize the element mesh wireframe with the element identification numbers.
In[24]:=
Click for copyable input
Out[24]=
Visualize the element mesh wireframe with continuous element identification numbers.
In[25]:=
Click for copyable input
Out[25]=
Visualize the element mesh wireframe with colored markers.
In[26]:=
Click for copyable input
Out[26]=

To color the element mesh, the number of components must match the number of markers.

A marker can also be part of boundary meshes.

Create a 2D boundary mesh with markers.
In[27]:=
Click for copyable input
Out[27]=
Visualize the boundary element identtification numbers and marker as well as the point element identification numbers and markers.
In[28]:=
Click for copyable input
Out[28]=
Ceate a full mesh.
In[29]:=
Click for copyable input
Out[29]=
Visualize the boundary markers of the full mesh.
In[30]:=
Click for copyable input
Out[30]=

In 3D, the default wireframe to draw is the boundary mesh.

Construct coordinates on a circular perimeter.
In[31]:=
Click for copyable input
These are the linear incidents.
In[33]:=
Click for copyable input
Create a hexahedron element mesh.
In[34]:=
Click for copyable input
Out[34]=
Visualize the boundary element mesh wireframe.
In[35]:=
Click for copyable input
Out[35]=
Visualize the full element mesh wireframe.
In[36]:=
Click for copyable input
Out[36]=

Here is a summary of options:

"ContinuousElementID"display 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 visualization of an ElementMesh.

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.

Create a second-order ElementMesh.
In[37]:=
Click for copyable input
Out[37]=
Visualize part of the mesh and the boundary points.
In[38]:=
Click for copyable input
Out[38]=

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.

Define a plane stress operator.
In[11]:=
Click for copyable input
Set up the boundary conditions so that the beam is held fixed at the left.
In[12]:=
Click for copyable input
Solve the equation.
In[13]:=
Click for copyable input
Out[13]=

NDSolve returned two interpolating functions. One for the deformation in the x direction and one for the deformation in the y 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.

Visualize the deformed mesh.
In[18]:=
Click for copyable input
Out[19]=

In cases where the deformation is not visible because the amount of deformation is small, a scaling factor can be specified.

In[24]:=
Click for copyable input
Out[24]=

ElementMeshDeformation can be used in 2D and 3D.

Here is a summary of options:

"ScalingFactor"scales the mesh deformation by a factor

Options for ElementMeshDeformation visualization of an ElementMesh.