Contents
On this page
This page introduces the tools for working with meshes in triellipt.
In what follows, we assume the following import is used:
Pythonimport triellipt as tri
The trimesh.TriMesh class is responsible for holding and managing the triangular mesh.
The primary mesh attributes are:
Refer also to additional data structures:
Note that the mesh object supports arithmetic operations with float and complex numbers, which modify the mesh points and produce a new mesh.
The nonconforming element contacts are introduced in the mesh as zero-area triangles.
Assume we have a nonconforming contact that spans the nodes A, B, and C:
● / \ / \ B--C--A \ / \ / ●---● \ / ●
This contact appears in the triangulation matrix as an additional triangle:
│ ... │ │ ABC │ │ ... │
This triangle has zero area, but it restores the combinatorial mesh connectivity.
Terminology:
The mesh may contain ghost nodes — nodes that are not involved in triangles.
Theses nodes can be deleted from the mesh, see triellipt.TriMesh.delghosts().
The mesh nodes can be aligned in an edge–core manner:
For details, see triellipt.TriMesh.alignnodes().
The module geom provides tools for creating .geo files for use with Gmsh.
Usual workflow:
.geo file.For example we first create four connected lines:
Pythonline1 = tri.geom.line(0 + 0j, 1 + 0j)
line2 = tri.geom.line(1 + 0j, 1 + 1j)
line3 = tri.geom.line(1 + 1j, 0 + 1j)
line4 = tri.geom.line(0 + 1j, 0 + 0j)
We then combine these lines into a loop:
Pythonloop = tri.geom.makeloop(line1, line2, line3, line4)
and discretize the loop:
Pythonpath = loop.discretize((10, 1))
For more details, see triellipt.geom.CurvesLoop.discretize().
The resuting path can be dumped to a .geo file:
Pythonpath.togeo(abspath_to_geo, mesh_seeds)
For more details, see triellipt.geom.PathMap.togeo().
The module mshread provides an interface for reading Gmsh meshes.
Usual workflow:
.msh extension.For example we create a reader:
Pythonreader = tri.mshread.getreader(
absolute_path_to_folder_with_meshes
)
and read the mesh:
Pythonmesh = reader.read_mesh('some-mesh.msh')
The list of available meshes can be obtained as follows:
Pythonread.listmeshes()
The module mesher provides two functions for generating structured grids:
The mesh can potentially be coarsened in the bulk region — see triellipt.TriMesh.reduced().
This procedure can produce nonconforming meshes with multiple discretization layers.
Meshes can also be joined along a common boundary, if present.
This provides an opportunity to construct composite meshes.
For more details, refer to triellipt.amr.join_meshes().
The module amr provides tools for mesh refinement and coarsening.
The functionality is provided by the AMR unit, which is built upon the input mesh:
Pythonunit = tri.amr.getunit(mesh)
The basic tools in the unit are the methods .refine() and .coarsen().
Both methods take triangle numbers as input arguments.
The AMR unit provides two basic options for selecting triangles:
.find_ prefixed methods.Refinement and coarsening fronts are sets of triangles associated with hanging nodes.
Consider a nonconforming element interface:
G
●
/ \
/ \
B--C--A
\ / \ /
E ●---● F
\ /
●
D
(a) Primary data is the number of the core triangle CEF, as passed to the .coarse() method.
For more details, refer to triellipt.amr.TriFront.
It is possible to interpolate data during refinement and coarsening steps.
The AMR unit contains a dictionary .data as an attribute, whose entries are automatically interpolated when the unit is refined or coarsened.
Copyright © 2023, Igor Semenov.