morphogen.config

Configuration files (YAML, JSON or TOML) describing generation runs and RVE studies.

A configuration has the sections model, domain, voxels (voxel images), mesh (conforming tetrahedral meshes), outputs, analysis, homogenization (apparent properties: finite elements on the meshes, or FFT on the voxel images), visualization (figures and videos of the images, meshes and fields of the first realizations) and, for RVE studies, rve (see docs/architecture.md and the templates).

morphogen.config.TABLE_FORMATS = ('csv', 'txt', 'xlsx')

Formats of the tables of a run besides .csv (outputs.tables), of the figures and the videos of the visualization section (the 3D views of VTK are bitmaps)

exception morphogen.config.ConfigError[source]

Bases: ValueError

Invalid configuration (the message names the faulty entry).

class morphogen.config.VoxelSpec(shape: 'int | tuple[int, int, int] | None' = None, voxel_size: 'float | None' = None, supersampling: 'int' = 1, section: 'int | None' = None)[source]

Bases: object

section: int | None = None

the axis (0, 1, 2) normal to which the image of a run is one layer of voxels through the middle of the realization (section: x, y or z): a planar study of a three-dimensional model

kwargs() → dict[source]
image(micro, supersampling: int = 1)[source]

The voxel image of a realization: its volume, or the layer of its section.

layer(image)[source]

The layer of the section of an image of the volume (the image itself without a section).

class morphogen.config.MeshSpec(size: float, min_size: float | None = None, hausdorff: float | None = None, gradation: float = 2.0, background: float | None = None, order: int | None = None, curved: bool | None = None, sharp_edges: bool | None = None, phases: str = 'auto', grains: bool | None = None, min_feature: float | None = None, cells: str = 'whole', method: str = 'auto')[source]

Bases: object

Conforming tetrahedral meshes of the realizations (see morphogen.mesh.conforming.conforming_mesh()). order: None in a configuration that does not give it, then 2 (10-node tetrahedra) when the mesh is analysed by finite elements and 1 (4-node) when it is only written (load_config()).

kwargs(porous=False) → dict[source]

Arguments of conforming_mesh; phases='auto' meshes only the solid phase of porous media (porous: the void phases, or True for a void phase 0): phase 1 when phase 0 is the void, phase 0 when the pores are phase 1.

class morphogen.config.OutputSpec(directory: 'Path' = PosixPath('morphogen_output'), name: 'str' = 'sample', geometry: 'list[str]' = <factory>, image: 'list[str]' = <factory>, labels: 'list[str]' = <factory>, level_set: 'list[str]' = <factory>, mesh: 'list[str]' = <factory>, mesh_phases: 'list[int] | None' = None, conforming_mesh: 'list[str]' = <factory>, periodic_pairs: 'bool' = False, periodic_equations: 'bool' = False, surface: 'list[str]' = <factory>, damask: 'bool' = False, neper: 'bool' = False, database: 'Path | None' = None, amitex: 'dict | None' = None, tables: 'list[str]' = <factory>)[source]

Bases: object

amitex: dict | None = None

AMITEX_FFTP runs of the image (the options of morphogen.io.write_amitex), or None

tables: list[str]

the tables of the run (results, homogenization, curves of the loading paths) in these formats too, besides .csv

property needs_voxels: bool
morphogen.config.AMITEX_OPTIONS = ('fields', 'tolerance', 'elastic_only', 'processes', 'library')

Options of outputs.amitex (those of morphogen.io.write_amitex)

morphogen.config.NONLINEAR_OPTIONS = {'contact': 'contact', 'integration': 'integration', 'interfaces': 'interfaces', 'kinematics': 'kinematics', 'max_cuts': 'max_cuts', 'max_iterations': 'max_newton', 'microdamage': 'microdamage', 'tangent': 'tangent', 'tolerance': 'newton_tol'}

Options of the nonlinear solver in configurations, and their names in the code

class morphogen.config.HomogenizationSpec(materials: dict[int, ~morphogen.homogenization.materials.Material], method: str = 'auto', boundary_conditions: list[str] = <factory>, properties: list[str] = <factory>, solver: str = 'auto', tolerance: float = 1e-08, max_iterations: int | None = None, fields: bool = False, loadings: dict = <factory>, paths: dict = <factory>, nonlinear: dict = <factory>, device: str = 'cpu', ntfa: dict = <factory>, mean_temperature: float = 300.0, frequencies: list[float] | None = None, wavelengths: list[float] | None = None, fracture: dict | None = None, fluid_bulk_modulus: float | None = None, integration: str | None = None, fatigue: dict | None = None, beremin: dict | None = None)[source]

Bases: object

Apparent properties computed on every realization: finite elements on its conforming mesh (method: fe) or FFT on its voxel image (method: fft); and loading paths followed in time with the nonlinear behaviours of the materials, by either method.

mean_temperature: float = 300.0

the mean absolute temperature of the thermoelectric coupling (K)

frequencies: list[float] | None = None

the angular frequencies of the harmonic properties, the wavelengths of the refractive index

fracture: dict | None = None

the brittle fracture of the loading paths by the phase-field method (the parameters of morphogen.fracture.phasefield.PhaseField, and of its solver)

fluid_bulk_modulus: float | None = None

the bulk modulus of the fluid of the pores, for the undrained response of the property ‘poroelastic’

integration: str | None = None

the volume change of each element as its mean (10-node tetrahedra: the elastic problems and the loading paths; voxels: the loading paths)

Type:

‘full’, or ‘bbar’

fatigue: dict | None = None

its path, the times of its cycle (None: the whole path) and the criteria of the phases (mappings for morphogen.homogenization.fatigue.criterion_from_config)

Type:

the fatigue of the points along a cycle of a loading path

beremin: dict | None = None

its path and its criterion (a mapping for morphogen.homogenization.beremin.Beremin)

Type:

the criterion of cleavage of Beremin along a loading path

property porous: bool
property void_phases: set[int]

The phases whose material is a void.

series() → list[str][source]

Names <property>.<bc> of the scalar apparent properties computed.

tensors() → list[str][source]

Names stiffness.<bc> of the stiffnesses computed (not under mixed conditions), whose mean and compliance per volume RVE studies give, then those conductivity_tensor.<bc> of the conductivities (their mean and resistivity) and of the tensors of the other transport phenomena (permittivity_tensor.<bc>…).

options() → dict[source]
class morphogen.config.RVESpec(method: 'str' = 'ensemble', sizes: 'list[float]' = <factory>, realizations: 'list[int]' = <factory>, size: 'float | None' = None, window_sizes: 'list[float]' = <factory>, properties: 'list[str]' = <factory>, relative_errors: 'list[float]' = <factory>, n_realizations: 'list[int]' = <factory>, gamma: 'float | None' = None, min_volume: 'float | None' = None, max_volume: 'float | None' = None, bootstrap: 'int' = 1000, weights: 'str' = 'none', shifts: 'int' = 1)[source]

Bases: object

shifts: int = 1

the tilings per axis, shifted around the periodic realization

Type:

the window method

class morphogen.config.DiffusionSpec(diffusivity: dict[int, float], solubility: dict[int, float], consumption: dict[int, float], exposed: tuple[str, ...] = ('x-', 'x+'), activity: float | tuple = 1.0, initial: float = 0.0, times: tuple[float, ...] = (), steps: int = 40, fields: bool = False)[source]

Bases: object

Transient diffusion in the voxel image of each realization (morphogen.coupling.diffusion.transient_diffusion()): diffusivity, solubility and consumption of each phase, the exposed faces held at the activity (a number, or a piecewise linear history (times, values)), the initial activity, the output times, the implicit Euler steps of each interval; fields: the concentration fields at the times.

boundary()[source]
class morphogen.config.ViewSpec(of: str, group: str, kind: str, formats: list[str], color: str | None = None, axis: int = 2, phase: int = 1, magnification: float | None = None, wave: str = 'ramp', section: tuple[int, float] | None = None, part: str = 'total', frames: int | None = None, mode: str = 'once', repeat: int = 1, fps: float | None = None, cmap: str | None = None, clim: tuple[float, float] | None = None, name: str | None = None, vtk: bool = False)[source]

Bases: object

A figure or a video of each realization (the visualization section): of what (image, labels, mesh, or a result <name>.<bc> of the homogenization, group “result” or “path”), its kind, the field colouring it (color) and the options of the views (see morphogen.viz.workflow).

vtk: bool = False

rendered by VTK (3D views)

property label: str

The name of its files, after the stem of the realization.

class morphogen.config.VisualizationSpec(figures: list[ViewSpec] = <factory>, videos: list[ViewSpec] = <factory>, realizations: int = 1, cmap: str = 'viridis', fps: float = 24.0, size: tuple[int, int]=(640, 480), dpi: int = 200, elevation: float = 25.0, azimuth: float = 30.0)[source]

Bases: object

Figures and videos of the first realizations of a run, in the colormap cmap, videos at fps frames per second, 3D views of size pixels seen from the elevation and azimuth of their camera (degrees), figures at dpi (see morphogen.viz.workflow).

property views: list[ViewSpec]
shows(*groups: str) → bool[source]
fields() → bool | str[source]

What the homogenization keeps for the views: the fields of the loading paths at each of their steps ("steps"), the fields (True), or nothing.

class morphogen.config.RunConfig(model: 'Model', domain: 'Domain', seed: 'int | None' = None, realizations: 'int' = 1, voxels: 'VoxelSpec | None' = None, mesh: 'MeshSpec | None' = None, outputs: 'OutputSpec' = <factory>, analysis: 'list[str]' = <factory>, rve: 'RVESpec | None' = None, homogenization: 'HomogenizationSpec | None' = None, diffusion: 'DiffusionSpec | None' = None, visualization: 'VisualizationSpec | None' = None, threads: 'int | None' = None, source: 'dict' = <factory>)[source]

Bases: object

morphogen.config.read_config_file(path) → dict[source]

The mapping of a configuration file (.yaml, .yml, .json or .toml); ConfigError if it cannot be read.

morphogen.config.FATIGUE_QUANTITIES = ('fatigue_utilization', 'fatigue_safety', 'fatigue_beyond')

The scalar results of the fatigue of a cycle (quantities of its loading path)

morphogen.config.path_quantities(names, homog: HomogenizationSpec | None) → list[PathQuantity][source]

The quantities of the loading paths of homog among the RVE properties names.

morphogen.config.property_entries(names, homog: HomogenizationSpec | None) → list[tuple[str, str]][source]

The scalar results (property, entry) of the strong couplings and of the harmonic properties of homog among the RVE properties names.

morphogen.config.load_config(source, *, base_dir=None) → RunConfig[source]

Validate a configuration given as a file path or a mapping.