morphogen.homogenization.core¶
Types shared by the solvers: boundary conditions, loadings, solutions.
- morphogen.homogenization.core.boundary_condition(name: str) str[source]¶
Canonical name of a boundary condition (accepts aliases such as ‘pbc’, ‘utg’).
- morphogen.homogenization.core.VOIGT_NAMES = ('11', '22', '33', '23', '31', '12')¶
Names of the Voigt components (elasticity) and of the vector components (conduction).
- class morphogen.homogenization.core.Loading(kind: str, value: tuple[float, ...], controls: tuple[bool, ...] | None = None, temperature: float = 0.0, physics: str | None = None)[source]¶
Bases:
objectMacroscopic loading.
kindisstrainorstress(6 Voigt components, order 11 22 33 23 31 12, engineering shear strains) for elasticity,gradientorflux(3 components) for the transport phenomena of a scalar potential (heat or electrical conduction, dielectric or magnetic polarization, diffusion), ormixed: componentiis a strain (gradient) wherecontrols[i]is true, a stress (flux) where it is false. The components of the macroscopic strain are then unknowns of the problem, dual to those of the macroscopic stress (their reactions areV Sigma), as the degrees of freedom of the periodic element of Z-set (seesuperpose()).temperatureis a uniform change of temperature from the stress-free state (elasticity: thermal strains of the materials that expand).physics:"elastic"for the loadings of 6 components; for those of 3, the transport phenomenon they load (TRANSPORT,"thermal"by default): a problem takes the gradients and fluxes of any of them, andhomogenize()solves each named loading with the problem of its physics.- classmethod strain(value, *, temperature: float = 0.0) Loading[source]¶
Imposed strain: a 3 x 3 tensor or 6 Voigt components (engineering shears).
- classmethod gradient(value, *, physics: str = 'thermal') Loading[source]¶
Imposed gradient of the potential of a transport phenomenon (3 components).
- classmethod flux(value, *, physics: str = 'thermal') Loading[source]¶
Imposed flux of a transport phenomenon (3 components;
flux = -K gradient).
- classmethod mixed(strain=None, stress=None, *, gradient=None, flux=None, temperature: float = 0.0, physics: str | None = None) Loading[source]¶
Strain prescribed on some components, stress on the others (or gradient and flux): each as a mapping (
{"11": 0.01, "23": 0}; conduction{"1": ...}) or a sequence withNonewhere the other one is prescribed. Every component must be prescribed exactly once. Example, uniaxial tension along 1 with free lateral contraction:Loading.mixed(strain={"11": 0.01}, stress={"22": 0, "33": 0, "23": 0, "31": 0, "12": 0}).
- classmethod uniaxial(axis: int, *, strain=None, stress=None, temperature: float = 0.0)[source]¶
Tension along
axis: its strain (or stress) prescribed, the other stress components zero (free lateral contraction).
- classmethod from_spec(spec) Loading[source]¶
Loading of a configuration mapping:
strainand/orstress(elasticity) orgradientand/orflux(a transport phenomenon:physics, thermal by default), each a mapping of components or a full list, andtemperature. Components not given are free: zero stress (flux).{"strain": {"11": 0.01}}is a uniaxial tension,{"temperature": 1}a free thermal expansion,{"physics": "electrical", "gradient": {"1": 1}}a potential gradient along x, the currents across it free.
- classmethod parse(text: str) Loading[source]¶
Loading of a compact text:
E11=0.01 S22=0 dT=10(strainE, stressS),G1=1 Q2=0(gradient, flux; of the transport phenomenonphysics=electrical, thermal by default); components not given are free.
- property array: ndarray¶
- property strain_controlled: ndarray¶
Components prescribed as strains (gradients); the others are stresses (fluxes).
- morphogen.homogenization.core.superpose(problem, loading: Loading) tuple[ndarray, ndarray, SolveInfo][source]¶
Solution of a loading that mixes the components a boundary condition prescribes (
problem.native: strains, or stresses for static conditions) with their duals.The macroscopic native components are the extra unknowns of the problem, dual to the others: their reactions are the volume times the averages of the dual field,
R = V Sigmafor strain components. A linear problem condenses them exactly: the responses to unit native loadings (problem._unit(j), cached) and to a unit change of temperature give the matrixM(the apparent stiffness, or compliance) and the vectorrofdual = M x + r dT; the unknown components ofxsolve the prescribed rows, and the field is the sum of the unit fields. Returnsx, the field and the work done.
- class morphogen.homogenization.core.PhaseStatistics(phase: int, fraction: float, mean: dict[str, ndarray], std: dict[str, ndarray])[source]¶
Bases:
objectVolume fraction, means and standard deviations of the fields in one phase.
- class morphogen.homogenization.core.Solution(physics: str, bc: str, loading: Loading, strain: ndarray, stress: ndarray, energy: float, material_fraction: float, phases: list[PhaseStatistics], info: SolveInfo, fields: dict[str, ndarray] | None = None, support: object | None = None)[source]¶
Bases:
objectVolume averages over the box of one solved problem.
Elasticity:
strainis the macroscopic strainE(imposed, or the average strain under SUBC),stressthe average stressSigma(voids count as zero), both 3 x 3 tensors, andenergythe average ofsigma : eps(twice the elastic energy density). Conduction, and every transport phenomenon of a scalar potential (physics:TRANSPORT):strainis the macroscopic gradientG,stressthe average fluxQ(q = -k grad T) andenergythe average ofk grad T . grad T.- fields: dict[str, ndarray] | None = None¶
element means of strain and stress (or gradient and flux) and energy density, plus the nodal displacement (temperature) of finite element solutions
- Type:
local fields (with
fields=True)
- support: object | None = None¶
the mesh (TetMesh, porous phases removed) or image (VoxelImage) of the fields
- class morphogen.homogenization.core.MacroscopicLoadings[source]¶
Bases:
objectSolution of macroscopic loadings by a problem that solves for the components its boundary condition prescribes (
_field(x, dt)) and evaluates the averages of a field (_dual,_evaluate); other components are condensed bysuperpose().- property native: str¶
strains (gradients), or stresses (fluxes) for static conditions.
- Type:
What the boundary condition prescribes
- native_mask(loading: Loading) ndarray[source]¶
Components of a loading that the boundary condition prescribes directly.
- solve(loading: Loading, *, fields: bool = False) Solution[source]¶
Solve for a macroscopic loading: what the boundary condition prescribes (strains, or stresses under
subc), or any mix of strain and stress components underkubc,periodicandsubc, by condensation of the macroscopic unknowns (superpose()).