morphogen.mesh.curved¶
Quadratic tetrahedra whose nodes lie on the interfaces of the phases.
A conforming mesh (morphogen.mesh.conforming.conforming_mesh()) follows the
interfaces with flat triangles, whose corners lie on the level set as the background
mesh interpolates it: the phases of the mesh are polyhedra, which lose the volume
between the chords and the interface (a few percent of an inclusion meshed with a few
elements per radius). Ten-node tetrahedra made of them by adding the middles of their
edges (quadratic()) keep that geometry: their
quadratic displacements are then more accurate than the domain they are computed on.
curved_mesh() puts the nodes of the interfaces on the implicit surfaces of the
microstructure (phase_level_set()), the
corner nodes and the mid-edge nodes: each face of an interface becomes the quadratic
patch through six points of the surface, and the elements on both sides isoparametric
elements with curved edges (the other edges stay straight). The distance of the mesh to
the interface then falls as the cube of the size of the elements instead of its square,
and the volumes of the phases as its fourth power.
The surface between the phases a and b is the zero of φ_a - φ_b, as for the
mesher; the wall of a pore left out of the mesh, that of the function of its solid. The
structures that give the functions of their phases at any point
(phase_level_sets_at(): the unions of spheres
and of segments and their coatings, the fields, the leaves, the cells, the combinations of
these…) have their nodes put on their surfaces exactly; the functions of the others are
sampled on a grid finer than the elements and interpolated by cubic splines (which round
the folds of these functions over a cell or two: a layer thinner than a few cells loses or
gains some volume). This is the one curvature of the 10-node elements, of the meshes made
on a grid and of the exact ones (morphogen.mesh.exact) alike. A node is moved to
the zero along the gradient (Newton’s method), within the
faces of the box for the nodes that lie on them (so that the faces stay plane, and
opposite faces keep matching nodes). Nodes where more than two phases meet stay where
they are, as do the nodes of whole periodic cells of polycrystals, whose faces are
plane. A move is bounded by a share of the edges around the node, and reduced where it
would flatten an element (the straight tetrahedra after the moves of the corners) or
where the volume element of a curved one would fall below a share of that of its
straight tetrahedron: the node of the element that moves most gives half of its move
away, until the element holds; the corner nodes held back start again from where they
are, in three steps at most.
Sharp edges. A mesh that follows the sharp edges of its phases (the grooves where the
spheres or segments of a union overlap; sharp_edges of
conforming_mesh()) has edges along them
(sharp), and knows the two smooth pieces of the
structure that meet along each (morphogen.models.pieces). The nodes of these
edges, corners and middles, are put where the surfaces of the two pieces meet — the
smallest move that brings them on both, by Newton’s method — and on the three surfaces
where three sharp edges join: the curved edges of the elements follow the sharp edge.
What the curved elements do not mend is what the mesher did not resolve: the sharp edges
of the structures that do not give their smooth pieces are rounded over about an
element, as in the mesh of 4-node elements, and the gaps and layers thinner than the
grid of the mesher (background) are bridged or pinched. The nodes there stay off
their surfaces (mesh.metadata["curved"] counts those that lie on them).
- morphogen.mesh.curved.SAMPLES_PER_ELEMENT = 8¶
Cells of the grid of the implicit functions per size of the elements, the cells added around the box for the splines, and the largest number of nodes of the grid along an axis (a coarser sampling beyond it)
- morphogen.mesh.curved.curved_mesh(mesh: TetMesh, micro, *, sampling: float | None = None, corners: bool = True, max_move: float = 0.3, min_jacobian: float = 0.3) TetMesh[source]¶
The 10-node mesh of
mesh(4 or 10 nodes) whose nodes on the interfaces of the phases lie on the implicit surfaces of the microstructuremicro: isoparametric elements with curved edges along the interfaces (see the module).The mesh of a microstructure without curved interfaces (polycrystals meshed by their cells) comes back with straight edges.
mesh.metadata["curved"]counts the nodes of the interfaces and those that lie on their surfaces in the end (nodes), and gives the largest departure of a mid-edge node from the middle of its edge. The nodes that stay off their surfaces are those of the lines where three phases meet, and those that an element holds back: at the sharp edges of a phase (the grooves where two overlapping spheres meet), which the mesher rounds, and in the gaps and layers that the grid of the mesher does not resolve (background).- Parameters:
sampling – Spacing of the grid on which the implicit functions are sampled, for the structures that do not give them at any point (by default an eighth of the size of the elements, coarser for very fine meshes of large boxes).
corners – Move the corner nodes of the interfaces to the surfaces too (default); false moves only the mid-edge nodes.
max_move – The largest move of a node, as a share of the shortest edge around it (corner nodes, in each of their three steps at most) or of its edge (mid-edge nodes).
min_jacobian – The smallest ratio allowed between the volume element of a curved element (at its nodes and integration points) and that of its straight tetrahedron; the most bent edge of an element below it is straightened by half, until it holds.