morphogen.pipeline

Execution of configurations: batches of realizations and RVE studies.

Outputs of a run (in outputs.directory):

  • <name>_<index>.<ext> files of each realization (geometry, images, voxel meshes…; conforming tetrahedral meshes are <name>_<index>_tet.<ext>, and local fields <name>_<index>_<property>_<bc>.vtu or .vti);

  • results.csv (results_task<i>of<n>.csv for split runs): one row per realization with its seed, measurements and apparent properties (columns <property>.<bc>; of a stiffness, the upper triangles of the stiffness stiffness.<bc>.C11 … C66 and of its compliance stiffness.<bc>.S11 … S66, in the notation that run.json states, beside its engineering constants), the solid fraction, and the relative, normalized (per unit of solid fraction) and specific values of the moduli and conductivities (morphogen.homogenization.postprocess);

  • homogenization.csv (homogenization_task<i>of<n>.csv): one row per realization, apparent property (or named loading or path) and boundary condition, with the macroscopic response, the energy estimate, the isotropy criterion and the solver data;

  • <name>_<index>_<path>_<bc>.csv: the macroscopic curves of each loading path (time, strain, stress, temperature, mean cumulated plastic strain, and the mean stress and plastic strain of each phase), and with fields the element fields at the end of each of its segments (..._<k>.vtu);

  • with outputs.tables, these tables also as .txt (tab-separated) or .xlsx;

  • with a visualization section, the figures and videos of the first realizations (<name>_<index>_<view>.<format>, see morphogen.viz.workflow): sections and orthoslices of the image, views of the mesh, fields on the deformed mesh, curves;

  • run.json: configuration, theoretical values, versions and timing (and the notation of the stiffness and compliance, stiffness_notation, when they are computed);

  • with outputs.database, the run is added to that database of the configurations tested (morphogen.results);

  • for RVE studies, rve_report.json / .md / .tex and figures (when matplotlib is installed): statistics, scaling-law fits and RVE sizes (see morphogen.rve); with the stiffness, per boundary condition and size the mean stiffness Cbar, its compliance S = Cbar^-1 and the standard deviation of each component, with the RVE size of each component (rve_stiffness.csv, rve_stiffness_<bc>.png; the conductivity tensor likewise, rve_conductivity_tensor.csv);

  • for window studies, results.csv has one row per window size (window_edge, volume, the number n of windows): the statistics of the volume fraction (mean, variance, relative_error) and, of each tensor of the windows (morphogen.rve.windows: the homogenization computing stiffness or conductivity_tensor by FFT), the components of their mean <tensor>.periodic.C11 …, of its inverse S11 … and their standard deviations C11_std …; run.json holds the apparent tensors of the whole realization (apparent). With rve.shifts (> 1), the tilings shifted around the periodic realization (morphogen.rve.scaling) add the column tilings after n, then the windows of one tiling: the means over all the windows, the variances pooled within the tilings, from the same solutions.

morphogen.pipeline.versions() → dict[source]

The versions of morphoGen, Python, NumPy, SciPy, Numba (and pymmg) and the platform, recorded with the results.

morphogen.pipeline.write_rows(path: Path, rows: list[dict]) → Path[source]

Rows (mappings) written as a CSV file, the union of their keys as columns in their order of appearance.

morphogen.pipeline.read_rows(path) → list[dict][source]

The rows of a CSV file as mappings, its numbers as floats.

morphogen.pipeline.write_path_fields(target: Path, support, arrays: dict) → Path[source]

Fields of a loading path at one time (PathResult.fields) on their support: .vtu of a mesh, the displacement of the nodes as point data, the other fields as cell data; .vti of an image, one array per component (stress_11 …, displacement_1 …, the displacement at the centres of the voxels). The suffix of target is replaced by that of the format; returns the path of the file written.

morphogen.pipeline.read_path_texture(path) → tuple[ndarray, ndarray][source]

The lattices of the crystals in a file of the fields of a loading path (write_path_fields(): a .vti of the voxels of an image, a .vtu of the elements of a mesh): their orientations (Bunge angles in degrees, m x 3) and their volumes (m; those of the elements, or one per voxel). The fields have these orientations for crystals in finite strains, or whose twins turn their lattices.

morphogen.pipeline.run(cfg: RunConfig, *, task_id: int = 0, n_tasks: int = 1, jobs: int = 1, resume: bool = False) → Path[source]

Execute a configuration; returns the output directory.

n_tasks > 1 runs the share task_id of the realizations (a task of a job array; morphogen.parallel.merge() gathers the tasks); jobs processes run them on this machine; resume skips the realizations already done (see morphogen.parallel). Scripts calling it with jobs > 1 must guard their main code with if __name__ == "__main__": (processes are started with spawn).

morphogen.pipeline.run_items(cfg: RunConfig, outdir: Path, task_id: int, n_tasks: int, *, jobs: int = 1, resume=False) → None[source]

Realizations of a batch or of an ensemble RVE study (the share of one task).

morphogen.pipeline.run_batch(cfg: RunConfig, outdir: Path, task_id: int, n_tasks: int) → None[source]

The items of a batch configuration that fall to a task (task_id among n_tasks) generated and processed, their outputs and records in outdir.

morphogen.pipeline.run_ensemble(cfg: RunConfig, outdir: Path, task_id: int, n_tasks: int) → None[source]

The realizations of an RVE study by the ensemble method that fall to a task (task_id among n_tasks) generated and processed, their outputs and records in outdir.

morphogen.pipeline.run_windows(cfg: RunConfig, outdir: Path) → None[source]

An RVE study by the window method: one realization of the size of the study, measured in windows of the sizes given, its statistics, results and report in outdir: of the volume fraction, and of the tensors of the windows when the homogenization computes them (morphogen.rve.window_tensors(): the realization solved once per unit load by the FFT solver, each window its mean mutual energies); with rve.shifts, over the tilings shifted around the periodic realization, from the same solutions.

morphogen.pipeline.study_options(spec: RVESpec) → StudyOptions[source]

The options of an RVE study (morphogen.rve.StudyOptions) from the section rve of a configuration.

morphogen.pipeline.build_report(rows: list[dict], spec: RVESpec, properties=None, theory=None, *, fe_rows: list[dict] | None = None, count=None, bound_values: dict | None = None, group_by: str | None = None) → StudyReport[source]

RVE report of results tables (wide rows; long fe_rows from homogenization), with the mean stiffness and compliance per volume of each boundary condition whose stiffness the rows hold (morphogen.rve.tensors_from_rows(); the conductivity tensor likewise): all of them when properties is None, else those it names (stiffness, stiffness.<bc>, conductivity_tensor…).

morphogen.pipeline.write_report(rows, outdir: Path, spec, cfg: RunConfig | None = None, properties=None, *, fe_rows=None) → StudyReport[source]

Write rve_report.json/.md/.tex (and plots) of a study.

morphogen.pipeline.report_markdown(report: StudyReport) → str[source]

The Markdown report of an RVE study (morphogen.rve.report.markdown()).

morphogen.pipeline.collect_results(paths, stem: str = 'results') → list[dict][source]

Rows of one or several results files (a directory: its <stem>.csv, or all its <stem>*.csv files of split runs that were not merged).

morphogen.pipeline.collect_homogenization(paths) → list[dict][source]

Rows of the homogenization files of result directories (empty if none).