Mesh generation level classes¶
Mesh
provides the primary interface to the meshing
functionality in TMR
and is used to create quadrilateral and hexahedral
meshes. The actual meshing operations are performed on the root processor with
rank 0, but all connectivity and location information is broadcast to all
processors.
Mesh
attempts to mesh all tmr.TMR.Face
and tmr.TMR.Volume
objects contained in Model
. If only a surface mesh is desired, create
a new Model
class without the volume objects.
TMR
only supports swept volume mesh generation. This requires the
specification of additional information to indicate what surfaces should be
linked and what direction should be swept. This information is provided by
indicating source and target geometry entities. When a source/target pair is
set, the mesh connectivity is copied from the source to the target. A swept
volume can only be created if:
Volume
contains a source/targetFace
object pair that share the same number of edge loops and each source/target edge pair has the same number of nodes.All other
Face
objects are structured with the same number of nodes along the swept direction.
To ensure these conditions apply, it is often necessary to set source/target pairs for faces and edges.
The primary mesh-level functions are as follows:
-
class
tmr.TMR.
Mesh
¶ Mesh the geometry model. This class handles the meshing for surface objects without any additional information. For hexahedral meshes, the model must have a source or target.
-
createModelFromMesh
(self)¶ Create a geometry model based on the input mesh
- Returns
The Model geometry representation of the underlying mesh
- Return type
-
getHexConnectivity
(self)¶ Retrieve the global connectivity from the hexahedral mesh
- Returns
Numpy array of the hexahedral connectivity
- Return type
np.ndarray
-
getMeshPoints
(self)¶ Retrieve a global array of the mesh locations
- Returns
Numpy array of the node locations
- Return type
np.ndarray
-
getQuadConnectivity
(self)¶ Retrieve the global connectivity from the quadrilateral mesh
- Returns
Numpy array of the quadrilateral connectivity
- Return type
np.ndarray
-
getTriConnectivity
(self)¶ Retrieve the global connectivity from the triangular mesh
- Returns
Numpy array of the triangle connectivity
- Return type
np.ndarray
-
mesh
(self, h=1.0, opts=None, fs=None)¶ Mesh the model with the provided mesh spacing h, default meshing options
MeshOptions
opts if it is not provided or givenElementFeatureSize
fs- Parameters
h (float) – Global mesh spacing parameter
opts (MeshOptions) – Meshing options class
fs (ElementFeatureSize) – ElementFeatureSize class specifying spacing
-
writeToBDF
(self, fname, outtype=None)¶ Write both the quadrilateral and hexahedral mesh to a BDF file
-
-
class
MeshOptions
class defines a number of options that modify
the meshing algorithm. These include the following:
-
class
tmr.TMR.
MeshOptions
¶ Defines a number of options that modify the meshing algorithm.
-
frontal_quality_factor
¶ Use the mesh quality indicator to determine when to accept new triangles in the frontal algorithm.
- Parameters
value (float) – Quality factor
-
mesh_type_default
¶ Default mesh type either structured or unstructured. In the case that it is set to structured, the algorithm firsts checks if it is possible to use a mapped mesh, and reverts to an unstructured algorithm otherwise.
-
num_smoothing_steps
¶ Number of smoothing steps to apply during both the Laplacian and quad smoothing algorithms
- Parameters
value (int) – Number of smoothing steps
-
-
class
ElementFeatureSize
class is a base class that can be used to define the feature
size of the elements in the mesh.
-
class
tmr.TMR.
ElementFeatureSize
¶ Base class for creating feature size
-
class
The mesh itself is created by meshing the vertices, edges, faces, and volumes within the mesh. These meshes are stored in the following classes:
The EdgeMesh
object is created by first computing the number of
nodes along its length, and then globally ordering the nodes. The number of
nodes is determined based on the following criteria:
If the first and second vertices are different, then at least 3 nodes are created along the edge.
If the first and second vertices are the same and the edge is not degenerate, then it forms a loop back on itself and at least 5 nodes are created (double counting the first and last node number).
If the edge is a target edge, the number of nodes is taken from the source edge.
Otherwise, the number of nodes is selected as an odd number that most closely matches the spacing requested along the edge.