Element types#
HelloTriangle supports a variety of mesh types, which define the geometric structure of a model using nodes and elements. This section provides an overview of the supported element types, all of which are currently linear, and explains how to convert meshes from one element type to another.
Element overview#
Figures are taken from the meshio documentation.
Default element types#
When creating a mesh, the eltype argument specifies the type of element (e.g. 'tri3', 'hex8').
If eltype is not provided, HelloTriangle will choose a default element type based on the number of nodes per element — also called the plexitude.
Plexitude (nodes per element) |
Default element type |
|---|---|
1 |
point |
2 |
line2 |
3 |
tri3 |
4 |
quad4 |
6 |
wedge6 |
8 |
hex8 |
Note
Some plexitudes can correspond to more than one valid element type.
For example, 4 nodes could define either a quadrilateral surface element (quad4) or a tetrahedral volume element (tet4).
In such cases, the default follows the table above, and you will need to specify the desired eltype explicitly if you want a different one.
Element conversion#
A Mesh object can be converted to a mesh with a different element type in several ways.
For example, you can use the following methods to reduce the mesh dimension:
edge_mesh()– returns a 1D mesh from a 2D or 3D meshface_mesh()– returns a 2D mesh from a 3D volumetric meshborder_mesh()– returns the boundary mesh of the original mesh. The boundary of a volumetric 3D mesh is a 2D surface mesh, while the boundary of an unclosed 2D surface mesh is a 1D mesh.
Example: create a 3D volumetric mesh (single hexahedral element):
M = Mesh(eltype='hex8')
The border mesh of this volumetric mesh is a 2D surface mesh:
S = M.border_mesh()
Since the original mesh was composed of hexahedral elements, the border mesh will be composed of quadrilateral elements.
To change the element type while preserving the mesh dimension, use
convert(). This allows, for example, converting a quadrilateral
surface mesh to a triangular surface mesh:
T = S.convert('tri3')
Important
Converting a mesh from one element type to another using the convert() method is only
possible if both element types have the same dimensionality. For instance, 3D
elements can only be converted to other 3D elements.