morphogen.homogenization.mfront¶
MFront behaviours (TFEL, https://thelfer.github.io/tfel) in the solvers of morphoGen, through MGIS (MFrontGenericInterfaceSupport).
A material whose mfront names a behaviour (MFrontBehaviour: a library
compiled with the generic interface, or a .mfront source that morphoGen compiles
with mfront --obuild --interface=generic and caches) has its integration points
integrated by MGIS along loading paths, by finite elements and on voxels, in small and
finite strains: the stresses, the internal state variables and the consistent tangent of
every point, the rest of the solvers unchanged (the periodic element, Newton’s method,
the outputs). Its elastic constants (young and poisson, or a crystal stiffness)
remain those of the reference medium of the FFT solver and of the linear problems.
Conventions. MGIS stores symmetric tensors in the order of TFEL, (11, 22, 33, 12, 13, 23)
(that of Cast3M, Code_Aster and Abaqus, not the usual order of Voigt, (11, 22, 33, 23,
13, 12)), with a factor sqrt(2) on their shear components (Mandel’s normalization; the
tangents likewise), and the deformation gradient and the first Piola-Kirchhoff stress in
the order (11, 22, 33, 12, 21, 13, 31, 23, 32). morphoGen keeps the usual order (11, 22,
33, 23, 31, 12) with engineering shear strains, and tensors of 9 components row by row:
the components are converted at the calls of MGIS only. Finite strain
behaviours are loaded for the first Piola-Kirchhoff stress and its derivative with
respect to the deformation gradient. The gradients of the points of a crystal go to the
axes of its lattice (the orientation of its grain), the stresses and the tangents come
back to the axes of the sample. The tangents are symmetrized for the conjugate gradients
of the solvers whose laws all have symmetric tangents, and passed whole to GMRES
otherwise (and to Newton’s method at a material point): a behaviour has a symmetric
tangent when it declares one (@ProvidesSymmetricTangentOperator, which MFront writes
in the traits of the behaviour, isConsistentTangentOperatorSymmetric, in the header
that it generates next to the library: declared_symmetric(); the generic
interface does not export it).
State. The internal state variables of MGIS live in morphoGen’s arrays of the internal
variables of the points, after the change of temperature, the gradients and the
thermodynamic forces at the end of the step (the start of the next one); tensors of 9
components there hold their difference to the identity, so that the natural state is
zero. Every integration starts from them, so that divided steps and the iterations of
Newton’s method need no special care. The cumulated plastic strain of the outputs is the
internal variable plastic_strain (by default EquivalentPlasticStrain or
EquivalentViscoplasticStrain when the behaviour has one), and the plastic strain
tensor, in small strains, the strain minus ElasticStrain.
The parameters of a behaviour (parameters) are global to its library in the process:
materials that share a behaviour share them.
MGIS and MFront are not on PyPI: conda install -c conda-forge mgis mfront (a C++
compiler, such as cxx-compiler, builds the behaviours).
- morphogen.homogenization.mfront.available() bool[source]¶
Whether MGIS can be imported (MFront behaviours can be integrated).
- morphogen.homogenization.mfront.info() dict[source]¶
MGIS and the MFront code generator (the version of TFEL), or why MFront behaviours are not available.
- class morphogen.homogenization.mfront.MFrontBehaviour(library: str | None = None, source: str | None = None, behaviour: str | None = None, material_properties: tuple = (), parameters: tuple = (), external_state_variables: tuple = (), temperature: float = 293.15, plastic_strain: str | None = None)[source]¶
Bases:
objectAn MFront behaviour of a material:
library(compiled with thegenericinterface) orsource(a.mfrontfile, compiled on first use bycompile_mfront()),behaviour(its name; by default the stem of the source), the values of itsmaterial_propertiesandparameters, itsexternal_state_variablesother than the temperature (constants), the absolutetemperatureof the natural state (the changes of temperature of the loading paths add to it) and the internal variable that gives the cumulated plastic strain of the outputs (plastic_strain).- classmethod from_config(spec) MFrontBehaviour[source]¶
A mapping with
libraryorsource, and optionallybehaviour,material_properties,parameters,external_state_variables(mappings of names to values),temperatureandplastic_strain.
- morphogen.homogenization.mfront.compile_mfront(source, *, directory=None) Path[source]¶
The library (
genericinterface) of an MFront source, built bymfront --obuild --interface=genericin a cache directory named after its stem and the hash of its contents (directory; by defaultMORPHOGEN_MFRONT_CACHEor~/.cache/morphogen/mfront), and reused while the source does not change.
- class morphogen.homogenization.mfront.MFrontLaw(spec: MFrontBehaviour, behaviour: object, finite: bool, n_grad: int, n_force: int, n_isv: int, identity: ndarray = <factory>, p_offset: int | None = None, elastic_offset: int | None = None, orthotropic: bool = False, symmetric: bool = False)[source]¶
Bases:
objectA behaviour loaded by MGIS for the integration points of a material: its sizes, the offsets of its internal state variables of 9 components (stored minus the identity) and of the variables of the outputs, whether it is orthotropic (its points are turned to the axes of their grains) and whether its consistent tangent is symmetric (
declared_symmetric()).- property width: int¶
Internal variables of a point in morphoGen’s arrays.
- morphogen.homogenization.mfront.declared_symmetric(library, behaviour: str) bool | None[source]¶
Whether the behaviour
behaviourof the MFrontlibrarydeclares a symmetric consistent tangent (@ProvidesSymmetricTangentOperator): the traitisConsistentTangentOperatorSymmetricof its tridimensional hypothesis in the headerinclude/TFEL/Material/<behaviour>.hxxthatmfront --obuildwrites beside the directory of the library (that ofcompile_mfront()); None without that header.
- morphogen.homogenization.mfront.load_behaviour(spec: MFrontBehaviour, *, finite: bool) MFrontLaw[source]¶
The behaviour of
specloaded by MGIS for three-dimensional points (finite strains: for the first Piola-Kirchhoff stress and its derivative with respect to F), checked against the kinematics of the solver, its material properties and parameters set.
- class morphogen.homogenization.mfront.MFrontPoints(laws, kind, pmat, point_mat, rotations, finite: bool, threads=None, symmetric: bool = True)[source]¶
Bases:
objectThe integration points of the materials with an MFront behaviour, integrated by MGIS: one manager of the data of the points per material, the rotations of the points of crystals, a pool of threads.
kind,pmatandpoint_matare those of the points of a solver,rotationsthe orientation matrix of each of its materials (crystal = g @ sample);symmetric: the tangents symmetrized (for the conjugate gradients), or passed whole (for GMRES and at a material point).