morphogen.homogenization.fe

Finite elements on conforming tetrahedral meshes (4-node and 10-node tetrahedra).

The unknown is the fluctuation w of u = E x + w (T = G . x + w in conduction), constrained by the boundary conditions of morphogen.homogenization.core:

kubc

w = 0 at the nodes of the faces of the box;

mixed

the normal (or the prescribed shear) components of w vanish on the faces concerned (Dirrenberger et al. 2014);

subc

tractions Sigma n (heat flux Q . n) on the faces of the box, rigid motions removed by 3-2-1 supports;

periodic

w takes the same value at a node of an upper face and at its image on the lower face. morphogen.mesh.conforming.conforming_mesh() gives opposite faces matching nodes for periodic microstructures, and the conditions are then exact. On meshes with non-matching faces, the image value is interpolated with the shape functions of the face element that contains it: an approximation (the patch test is not passed exactly), reported in the log. On porous meshes whose opposite faces differ (voxel meshes of a pore phase), a node whose image falls in a pore of the opposite face lies on a free surface, and stays free.

Meshes of whole periodic cells (polycrystals, mesh.whole) are bounded by pairs of translated facets instead of the faces of the box: w takes the same value at the translates of a node (mesh.periodic_links()), and the kinematic and static conditions apply on that boundary (mesh.outer_faces(), with their own normals); mixed conditions, defined on the faces of the box, need a mesh of the box.

Porous media are meshed without their pores (or their pore elements are discarded when the pore phase is a void): averages are taken over the box with zero stress in the pores, as for the FFT solver. Elements are integrated exactly: one point for 4-node elements, four points for 10-node elements with straight edges.

The 10-node elements are isoparametric: a mid-edge node may leave the middle of its edge (morphogen.mesh.curved.curved_mesh() puts those of the interfaces on the implicit surfaces of the phases). Such an element is its straight tetrahedron moved by sum_k N_k d_k, with N_k the function of a mid-edge node and d_k its departure from the middle of its edge: at an integration point, the gradients of the shape functions are those of the straight element times the inverse of F = I + sum_k d_k (x) grad N_k, and the volume element is multiplied by det F. Linear fields are in the space of the elements whatever the departures (the elements pass the patch test up to the four-point rule, exact for straight elements only).

morphogen.homogenization.fe.INTEGRATIONS = ('full', 'bbar')

every point, or the volume change of each element as its mean (10-node tetrahedra; morphogen.homogenization.dilatation)

Type:

The integrations of the elastic problems

morphogen.homogenization.fe.NEARLY_INCOMPRESSIBLE = 0.49

Poisson’s ratio from which a phase is nearly incompressible (a warning with full)

morphogen.homogenization.fe.integration_of(value) → str[source]

The name of an integration: "full", or "bbar" (also written "reduced", "selective", "b-bar", "f-bar").

morphogen.homogenization.fe.nearly_incompressible(materials, phases, limit: float = 0.49) → list[int][source]

The phases whose Poisson’s ratio is at least limit (isotropic elastic materials): those that lock the elements integrated at every point.

morphogen.homogenization.fe.node_pattern(elements: ndarray, n_nodes: int) → tuple[ndarray, ndarray][source]

Node-level CSR pattern (row pointers, sorted column indices) of a mesh.

morphogen.homogenization.fe.CHUNKS = 64

this many at most (their work arrays are allocated once for each, before the loops)

Type:

The elements of a colour are shared between the threads by chunks

morphogen.homogenization.fe.chunk_slots(colours)[source]

The offsets of the chunks of each colour (CHUNKS at most, one element at least) in the list of all the chunks: the place of the sums of each chunk, added in this order whatever the number of threads.

morphogen.homogenization.fe.element_colours(elements: ndarray, n_nodes: int) → tuple[ndarray, ndarray][source]

The elements of a mesh sorted by colour, and the offsets of the colours in that list: two elements of a colour have no node in common. The loops that add the contributions of the elements at their nodes (a stiffness, nodal forces) take the elements of a colour in parallel, without two threads writing at one place, and each place receives the contributions of its elements colour by colour: the same sums for any number of threads.

morphogen.homogenization.fe.assemble(mesh: TetMesh, nd: int, mat, matrices, integration: str = 'full') → csr_matrix[source]

Global matrix (all nodes and components) of a tetrahedral mesh: element e has the elasticity matrix (nd = 3) or conductivity tensor (nd = 1) matrices[mat[e]]. integration: "bbar" takes the volume change of each 10-node tetrahedron as its mean (elasticity; INTEGRATIONS).

class morphogen.homogenization.fe.Reduction(t: csr_matrix, indptr: ndarray, indices: ndarray)[source]

Bases: object

The reduced matrices T^T K T of the matrices K of one pattern, for a reduction T that has one stored value per row at most (periodic faces that match, kinematic conditions): each stored value of K goes to one place of the reduced matrix, found once (_places()), and each place sums the values that go there (_gather(), on several threads). The tangent of a loading path is reduced at each linearization; the two products of sparse matrices and their conversions take much longer. The reduced matrices share the arrays of their pattern. of() returns none for a T whose rows interpolate several unknowns (periodic faces that do not match).

morphogen.homogenization.fe.periodic_map(mesh: TetMesh) → tuple[csr_matrix, ndarray, dict][source]

Matrix T (nodes x masters) with w = T w_masters for periodic fluctuations.

Nodes of the upper faces are slaves. A slave with an image node on the lower face takes its value; the others are interpolated in the lower face element containing their image. A node whose image lies off the elements of the lower face, farther than a quarter of the longest edge of the nearest of them, is on a free surface: the material of the cell meets a pore of the next one there (porous voxel meshes whose opposite faces differ), and it stays free, unless another node lies at its place modulo the periods (an image through an edge or a corner of the box), whose class it joins. Returns T, the master nodes and the counts matched and interpolated of slave nodes, outside: interpolated nodes found just outside the lower face (the nearest element is used), and free: the nodes of the upper faces left free. Whole periodic cells: the translates of a node take its value.

morphogen.homogenization.fe.linear_interpolation(mesh: TetMesh) → tuple[csr_matrix, ndarray][source]

Interpolation (nodes x corner nodes) of the 4-node element functions of a 10-node mesh into its 10-node functions, and the corner nodes.

class morphogen.homogenization.fe.FEElasticProblem(mesh: TetMesh, materials: dict[int, Material], bc: str = 'kubc', *, solver: str = 'auto', tol: float = 1e-08, maxiter: int | None = None, regularization: float = 1e-12, physics: str | None = None, integration: str = 'full')[source]

Bases: _FEProblem

Linear (thermo-)elasticity on a tetrahedral mesh (small strains); crystals are turned by the orientations of the grains of polycrystal meshes.

class morphogen.homogenization.fe.FEThermalProblem(mesh: TetMesh, materials: dict[int, Material], bc: str = 'kubc', *, solver: str = 'auto', tol: float = 1e-08, maxiter: int | None = None, regularization: float = 1e-12, physics: str | None = None, integration: str = 'full')[source]

Bases: _FEProblem

Steady linear heat conduction on a tetrahedral mesh, or with physics any other transport phenomenon of a scalar potential (TRANSPORT: "electrical", "dielectric", "magnetic", "diffusion"), with the coefficient of the materials for it; the phases whose coefficient is zero (insulators) are left out as pores.