morphogen.mesh.tetra¶
Tetrahedral meshes of a box: linear (4-node) or quadratic (10-node) elements.
Quadratic elements follow the VTK / Abaqus C3D10 node order: corners 0-3, then the
mid-edge nodes of edges (0, 1), (1, 2), (0, 2), (0, 3), (1, 3), (2, 3). They are
isoparametric: a mid-edge node may leave the middle of its straight edge, and the edge
is then the parabola through its three nodes (morphogen.mesh.curved.curved_mesh()
puts the nodes of the interfaces on the implicit surfaces of the phases). An element is
straight when its mid-edge nodes are the middles of its edges, curved otherwise
(TetMesh.deviations(), TetMesh.curved).
A mesh of the box is bounded by its faces. A mesh of whole periodic cells (whole)
fills the volume of the box without being cut by its faces: its outer boundary is made
of pairs of translated facets, and every node on it has translates by the periods of the
box (TetMesh.periodic_links()). The faces of the elements on that boundary are
recorded (outer) when the mesh is made, so that they are known in a mesh of some of
its phases too, where the walls of the pores are free faces as well.
- morphogen.mesh.tetra.TET_EDGES = array([[0, 1], [1, 2], [0, 2], [0, 3], [1, 3], [2, 3]])¶
Corner pairs of the six edges of a tetrahedron, in mid-node order.
- morphogen.mesh.tetra.TET_FACES = array([[0, 2, 1], [0, 1, 3], [1, 2, 3], [0, 3, 2]])¶
Corner triples of the four faces (outward normals for positive tetrahedra), and the mid-edge nodes of each face (indices into the 10-node element).
- morphogen.mesh.tetra.TET10_NODES = array([[1. , 0. , 0. , 0. ], [0. , 1. , 0. , 0. ], [0. , 0. , 1. , 0. ], [0. , 0. , 0. , 1. ], [0.5, 0.5, 0. , 0. ], [0. , 0.5, 0.5, 0. ], [0.5, 0. , 0.5, 0. ], [0.5, 0. , 0. , 0.5], [0. , 0.5, 0. , 0.5], [0. , 0. , 0.5, 0.5]])¶
Barycentric coordinates of the ten nodes of a quadratic tetrahedron
- morphogen.mesh.tetra.tet_volumes(nodes: ndarray, elements: ndarray) ndarray[source]¶
Signed volumes of the tetrahedra of corners 0-3 (straight edges).
- morphogen.mesh.tetra.edge_deviations(nodes: ndarray, elements: ndarray) ndarray[source]¶
The departures (elements x 6 x 3) of the mid-edge nodes of 10-node tetrahedra from the middles of their straight edges: zero for straight elements.
- morphogen.mesh.tetra.corner_gradients(nodes: ndarray, elements: ndarray) ndarray[source]¶
Gradients (elements x 4 x 3) of the barycentric coordinates of the straight tetrahedra of corners 0-3.
- morphogen.mesh.tetra.jacobian_ratios(gradients: ndarray, deviations: ndarray, bary) ndarray[source]¶
The ratio of the volume element of curved 10-node tetrahedra to that of their straight ones at points of barycentric coordinates
bary(points x 4): elements x points. The curved element is the straight one moved bysum_k N_k(L) d_k, withN_k = 4 L_i L_jthe function of the mid-edge node of the edge (i, j) andd_kits departure: the ratio isdet(I + sum_k d_k (x) grad N_k).
- morphogen.mesh.tetra.element_volumes(nodes: ndarray, elements: ndarray) ndarray[source]¶
Signed volumes of the elements: of the tetrahedra of their corners, or, for 10-node elements with curved edges, the integral of their Jacobian (a polynomial of degree 3 in the barycentric coordinates, by a rule exact for it).
- morphogen.mesh.tetra.tet_quality(nodes: ndarray, elements: ndarray) ndarray[source]¶
Mean-ratio-like quality: 1 for a regular tetrahedron, 0 for a flat one.
q = 6 sqrt(2) V / l_rms^3withl_rmsthe root mean square edge length.
- class morphogen.mesh.tetra.TetMesh(nodes: ndarray, elements: ndarray, phase: ndarray, lower: ndarray, upper: ndarray, periodic: bool = False, metadata: dict = <factory>, cell: ndarray | None = None, orientations: ndarray | None = None, whole: bool = False, outer: ndarray | None = None, side: ndarray | None = None, sharp: ndarray | None = None, sharp_pieces: ndarray | None = None)[source]¶
Bases:
objectTetrahedral mesh of the box
[lower, upper]with a phase per element.periodictells whether the meshed microstructure is periodic (periodic boundary conditions are then meaningful); the opposite faces need not have matching nodes. Meshes of polycrystals also give the cell (grain) of each element,cell, and the crystal orientation of each cell,orientations(Bunge Euler angles in degrees). The crack meshes of a morphology (morphogen.fracture.lefm.crack_mesh()), whose phases are those of its materials, give the side of the crack of each element,side(0 or 1).- outer: ndarray | None = None¶
which faces of each element (
TET_FACESorder) bound the volume element; by default, the free faces of the mesh (all the cells meshed)- Type:
whole periodic cells
- side: ndarray | None = None¶
the side of the crack of each element (0 or 1)
- Type:
crack meshes of a morphology
- sharp: ndarray | None = None¶
these edges (pairs of corner nodes), and the two pieces of the structure that meet along each (
implicit_pieces())- Type:
meshes that follow the sharp edges of the phases
- property order: int¶
- property n_nodes: int¶
- property n_elements: int¶
- property size: ndarray¶
- property box_volume: float¶
- volumes() ndarray[source]¶
Signed volumes of the elements (those of curved 10-node elements exactly).
- deviations() ndarray | None[source]¶
The departures (elements x 6 x 3) of the mid-edge nodes of a 10-node mesh from the middles of their straight edges (zero where the elements are straight); None for a 4-node mesh.
- property curved: bool¶
Whether some 10-node elements have curved edges (mid-edge nodes off the middles of their edges, beyond the round-off of coordinates read from a file).
- min_jacobian() float[source]¶
The smallest ratio of the volume element of the 10-node elements to that of their straight tetrahedra, over their ten nodes and their four integration points (1 for a straight mesh; positive for valid elements).
- phase_fractions() dict[int, float][source]¶
Volume of each phase over the volume of the box (missing phases: voids).
- face_nodes(axis: int, side: int) ndarray[source]¶
Nodes on the face of the box normal to
axis(side0: lower, 1: upper).
- boundary_nodes() ndarray[source]¶
Nodes on the boundary of the volume element: the faces of the box, or the outer boundary of whole periodic cells.
- free_faces() ndarray[source]¶
Element faces belonging to a single element: (k, 3) corners or (k, 6) for P2 (corners then mid-edge nodes), oriented with outward normals.
- outer_faces() ndarray[source]¶
Faces bounding the volume element, with outward normals: those on the faces of the box, or the
outerfaces of whole periodic cells.
- periodic_links() tuple[ndarray, ndarray, ndarray][source]¶
Nodes of the boundary that are translates of others by the periods of the box:
(slave, master, shift)withx_slave = x_master + shift * size(shift in periods), each slave linked to the first node of its class.
- boundary_faces(axis: int, side: int) ndarray[source]¶
Element faces lying on a face of the box: (k, 3) corners or (k, 6) for P2 (corners then mid-edge nodes), oriented with outward normals.
- periodic_pairs(axis: int) ndarray[source]¶
Pairs (node on the lower face, node on the upper face) at the same position across the box along
axis(all face nodes for matching faces).
- matching_faces() bool[source]¶
Whether every node of a face has an image on the opposite face. Whole periodic cells: whether the faces bounding them come in translated pairs (in a mesh of some of the cells, the faces facing the others have none).
- quadratic() TetMesh[source]¶
The same mesh with 10-node elements (mid-edge nodes on straight edges).
- straight() TetMesh[source]¶
The same 10-node mesh with straight edges (its mid-edge nodes at the middles of their edges); the mesh itself if it has no curved edge.