morphogen.io.amitex¶
Runs of AMITEX_FFTP, the FFT solver of voxel microstructures of the CEA (https://amitexfftp.github.io/AMITEX), on morphoGen images, and their results.
write_amitex() writes the files of the runs of a voxel image of phases:
the material and zone numbers of the voxels (
<name>_materials.vtk,<name>_zones.vtk: legacy VTK with exactly ten header lines, then big-endian 32-bit integers, x varying fastest; numbers from 1). Each phase present is a material, in increasing order; the crystals of a phase turned by the orientations of their grains have one zone per grain, the other phases one zone;the material file (
<name>_material.xml): the native lawelasisofor isotropic phases (the Lamé coefficients; zero for voids) andelasanisofor crystals (the nine orthotropic constants C11, C12, C13, C22, C23, C33, C66, C55, C44 in the axes of the crystal, then the first two axes of the crystal, the first two rows of its orientation matrix, in the axes of the sample for each zone, in binary files of big-endian doubles); the reference medium of the solver is the mean of the extreme moduli, as in morphoGen’s FFT solver. The nonlinear materials (von Mises and crystal plasticity) are MFront laws (morphogen.io.mfront, inmfront/), compiled by the script with theumatinterface (mfront/src/libUmatBehaviour.so, the lawumat<behaviour>), with the coefficients that this interface imposes: YOUN, NU, RHO, ALPH (von Mises), or the nine orthotropic constants YG1, YG2, YG3, NU12, NU23, NU13, G12, G23, G13, the axes V1, V2 of the crystal in each zone (as those ofelasaniso), RHO, ALP1, ALP2, ALP3 (crystals); their internal variables start at zero;a loading file per run (
<name>_<run>.xml): the six unit strains of the stiffness tensor (one partial loading each; linear materials only), named macroscopic loadings, or loading paths (one partial loading per segment);the algorithm file (
<name>_algorithm.xml),<name>_run.sh, which compiles the MFront laws and runs them all with MPI, and<name>_amitex.json, the description of the export thatread_amitex_run()reads back with the results.
In finite strains (kinematics="finite": Small_Perturbations false, loading paths
of the nine components of the displacement gradient and of the nominal stress), every
phase but the voids is an MFront law, Hencky’s elasticity for the elastic ones (AMITEX’s
native laws in finite strains are not morphoGen’s): the laws of Hencky’s strain measure
(elasticity, von Mises) are the functions umat<behaviour>_malls of the interface,
which compute the logarithmic strain from the deformation gradients that AMITEX gives
them, those of the deformation gradient (crystals: morphoGen’s kernel) umat<behaviour>.
AMITEX orders the components of symmetric tensors (xx, yy, zz, xy, xz, yz), with engineering shear strains, and those of gradients (xx, yy, zz, xy, xz, yz, yx, zx, zy); morphoGen’s are (11, 22, 33, 23, 31, 12) and row by row.
read_amitex() reads the averages of a run over the unit cell (.std),
read_amitex_materials() and read_amitex_zones() those of its materials
(.mstd) and of the zones of a material (.zstd), and read_amitex_run() the
runs of an export, with the apparent stiffness of its unit strains;
morphogen.io.read_vtk() reads the fields of the runs (.vtk).
- morphogen.io.amitex.COMPONENTS = ('xx', 'yy', 'zz', 'yz', 'xz', 'xy')¶
AMITEX’s names of the components of symmetric tensors, in morphoGen’s Voigt order (11, 22, 33, 23, 31, 12); in finite strains, of the macroscopic components (11, 22, 33, 23, 13, 12) of gradients and nominal stresses
- morphogen.io.amitex.GRADIENT = ('xx', 'yy', 'zz', 'xy', 'xz', 'yz', 'yx', 'zx', 'zy')¶
AMITEX’s names of the nine components of gradients
- morphogen.io.amitex.LAWS = ('elasiso', 'elasaniso')¶
Laws of the material file
- morphogen.io.amitex.UMAT_LIBRARY = 'mfront/src/libUmatBehaviour.so'¶
The library of the MFront laws of the nonlinear materials, compiled by the script of an export with the umat interface (relative to its directory)
- morphogen.io.amitex.write_amitex_field(path, values, spacing, origin=(0.0, 0.0, 0.0), name: str = 'MaterialId')[source]¶
An integer field of the voxels as AMITEX_FFTP reads it: legacy VTK with exactly ten header lines (
DIMENSIONS: the numbers of voxels plus one, cell data), then big-endian 32-bit integers, x varying fastest.
- morphogen.io.amitex.write_amitex_loading(path, segments, *, kinematics: str = 'small', fields: bool = False)[source]¶
A loading file of AMITEX_FFTP:
segmentslists the partial loadings, each a tuple (final time, number of increments, the six components at its end, which are strains (controls)). Components are morphoGen’s: Voigt order with engineering shear strains in small strains, the macroscopic components (11, 22, 33, 23, 13, 12) of the gradient and of the nominal stress in finite strains, the gradient upper triangular (as morphoGen’s).fields: the stress and strain fields at every increment.
- class morphogen.io.amitex.AmitexExport(directory: Path, name: str, files: list[Path], runs: dict[str, dict])[source]¶
Bases:
objectThe files of the AMITEX runs of an image (
write_amitex()): the directory, the name of the files, and the run of each loading (its loading file and the root of its results, relative to the directory).
- morphogen.io.amitex.write_amitex(directory, image: VoxelImage, materials: dict, *, grains=None, orientations=None, loadings: dict | None = None, paths: dict | None = None, stiffness: bool | None = None, name: str = 'amitex', fields: bool = False, tolerance: float | None = None, library: str = '', processes: int = 4, elastic_only: bool = False, kinematics: str = 'small') AmitexExport[source]¶
The inputs of AMITEX_FFTP runs of a periodic voxel image of phases (see the module):
materials(phase ->Material), crystals turned by the orientations of their grains (grains: label of each voxel,orientations: Bunge angles of each label). The runs: the six unit strains of the apparent stiffness (stiffness; by default when no loading is given), the namedloadings(Loading) andpaths(LoadingPath).fields: stress and strain fields at every increment;tolerance: the convergence criterion of AMITEX (Default: 1e-4);library: the path oflibUmatAmitex.so(empty: the native laws found throughAMITEX_PATH);processes: MPI processes of the script. The nonlinear materials (von Mises and crystal plasticity) are MFront laws, which need loadings or paths (not the unit strains of the stiffness);elastic_onlyexports their elasticity instead.kinematics: small or finite strains (paths only; every phase but the voids an MFront law).
- class morphogen.io.amitex.AmitexResult(kinematics: str, times: ndarray, stress: ndarray, strain: ndarray, stress_std: ndarray, strain_std: ndarray, iterations: ndarray | None = None, cauchy: ndarray | None = None, green_lagrange: ndarray | None = None, pk1: ndarray | None = None, gradient: ndarray | None = None, extra: ndarray | None = None)[source]¶
Bases:
objectAverages over the unit cell, a material or a zone at the output increments of an AMITEX_FFTP run, in morphoGen’s orders. In small strains,
stressandstrain(Voigt 11, 22, 33, 23, 31, 12; engineering shear strains); in finite strains, the macroscopic components (11, 22, 33, 23, 13, 12) of the first Piola-Kirchhoff stress and of the displacement gradient, their nine components (row by row) inpk1andgradient, the Cauchy stress and the Green-Lagrange strain (Voigt).stress_std,strain_std: the standard deviations over the voxels;iterations: those of each increment (unit cell);extra: the other columns (the internal variables of the zones).
- morphogen.io.amitex.read_amitex(prefix, *, kinematics: str | None = None) AmitexResult[source]¶
The averages over the unit cell of an AMITEX_FFTP run (
<prefix>.std, the root of its results); small or finite strains are recognized from the header or the number of columns, unless given.
- morphogen.io.amitex.read_amitex_materials(prefix, *, kinematics: str | None = None) dict[int, AmitexResult][source]¶
The averages over each material (
<prefix>.mstd), by material number.
- morphogen.io.amitex.read_amitex_zones(prefix, material: int, *, kinematics: str | None = None)[source]¶
The averages over each zone of a material (
<prefix>_<material>.zstd), by zone number; their internal variables inextra.
- class morphogen.io.amitex.AmitexRun(manifest: dict, results: dict[str, ~morphogen.io.amitex.AmitexResult]=<factory>, stiffness: ndarray | None = None, properties: dict[str, float]=<factory>)[source]¶
Bases:
objectThe runs of an export (
write_amitex()) and their results: the description of the export, the averages of each run (results; runs without results are left out), the apparent stiffness of the unit strains and its properties.
- morphogen.io.amitex.amitex_stiffness(result: AmitexResult, times=(1.0, 2.0, 3.0, 4.0, 5.0, 6.0)) ndarray[source]¶
The apparent stiffness (Voigt, engineering shears) of a run of the six unit strains: its column k is the stress at the end of the partial loading k (
times).
- morphogen.io.amitex.read_amitex_run(directory, name: str | None = None) AmitexRun[source]¶
The results of the runs of an export (
<name>_amitex.jsonindirectory; the only one there by default): the averages of each run whose results exist, and for the unit strains the apparent stiffness, the bulk modulus (C_ijsummed over the normal components, over 9), the shear modulus (C66, plane 12), the moduli of its isotropic projection and its engineering constants.