morphogen.viz.workflow

Figures and videos of the realizations of a run (the visualization section of the configurations): the chain from the morphological model to its voxel image, its conforming mesh and the fields of its homogenization.

A view shows one object of each realization (of):

  • image: the voxel image; figures: its three middle sections (kind: sections) or the surface of a phase (surface, VTK); videos: the three sections moving together (orthoslices, the default, as in Avizo), a section sweeping along axis (sections) or the surface of a phase turning (surface);

  • labels: the cell labels of tessellations and grain structures (sections, orthoslices);

  • mesh: the conforming mesh coloured by phase (color: none: uniform); figures: a view; videos: a turntable (turntable) or a cross-section sweeping along axis (sweep);

  • a result of the homogenization, <property>.<bc> (bulk_modulus, shear_modulus, conductivity), <loading>.<bc> or <path>.<bc>: the field color (by default the von Mises stress, or the norm of the heat flux) on the mesh deformed by its displacement magnified magnification times (by default the largest displacement drawn as a tenth of the mesh, and the true deformation along loading paths in finite strains; part: fluctuation removes the macroscopic part E x), cut by the plane section: (axis, fraction); on the voxels of the FFT solver, the sections of the field. Videos of properties and loadings grow the load (wave: ramp) or make it oscillate (wave: sine); those of loading paths follow their steps from the natural state (frames: interpolated between the steps). Figures of loading paths draw their curves (kind: curves, the default) or their field at the end (kind: field).

The fields are named as in the files of the fields: von_mises, energy_density, stress_11 … stress_12 and strain_11 … (Voigt order 11, 22, 33, 23, 31, 12), displacement (its norm); flux, gradient (norms), flux_1 …, dissipation, temperature; along paths p (cumulated plastic strain) and plastic_strain_11 …

Files: <stem>_<name>.<format>, with the name given (name) or made of the object, the kind and the field: spheres_0000_image_orthoslices.mp4, spheres_0000_shear_modulus_periodic_von_mises.png.

morphogen.viz.workflow.FIELDS = {'elastic': ('von_mises', 'energy_density', 'displacement', 'stress_11', 'stress_22', 'stress_33', 'stress_23', 'stress_31', 'stress_12', 'strain_11', 'strain_22', 'strain_33', 'strain_23', 'strain_31', 'strain_12'), 'path': ('von_mises', 'p', 'displacement', 'stress_11', 'stress_22', 'stress_33', 'stress_23', 'stress_31', 'stress_12', 'strain_11', 'strain_22', 'strain_33', 'strain_23', 'strain_31', 'strain_12', 'plastic_strain_11', 'plastic_strain_22', 'plastic_strain_33', 'plastic_strain_23', 'plastic_strain_31', 'plastic_strain_12', 'twin_fraction', 'twin_reoriented', 'twin_misorientation', 'cleavage_opening', 'cleavage_damage', 'cleavage_microdamage', 'interface_damage', 'interface_opening', 'fatigue_utilization', 'fatigue_equivalent', 'fatigue_amplitude', 'fatigue_hydrostatic_max', 'beremin_stress'), 'thermal': ('flux', 'gradient', 'dissipation', 'temperature', 'flux_1', 'flux_2', 'flux_3', 'gradient_1', 'gradient_2', 'gradient_3')}

The fields colouring the views of the results, by kind of result

morphogen.viz.workflow.NODAL = ('displacement', 'temperature')

The fields of the nodes of finite element meshes (the displacement of the loading paths of the FFT solver is at the centres of the voxels)

morphogen.viz.workflow.KINDS = {'image': (('sections', 'surface'), ('orthoslices', 'sections', 'surface')), 'labels': (('sections',), ('orthoslices', 'sections')), 'mesh': (('view',), ('turntable', 'sweep')), 'path': (('curves', 'field'), ('field',)), 'result': (('field',), ('field',))}

The kinds of the figures and of the videos of each object, the first ones the defaults

morphogen.viz.workflow.von_mises(stress) → ndarray[source]

Von Mises stress of stresses in the Voigt order (last axis; tensor shears).

morphogen.viz.workflow.element_arrays(fields: dict, physics: str) → dict[str, ndarray][source]

The element fields of a solution (Solution.fields) by name: energy density, von Mises stress, stress and strain components; or dissipation, flux and gradient components.

morphogen.viz.workflow.solution_fields(solution) → dict[str, ndarray][source]

All the named fields of a solution kept with fields=True: those of element_arrays(), the nodal displacement or temperature of finite elements, and the flux and gradient vectors.

morphogen.viz.workflow.path_fields(arrays: dict) → dict[str, ndarray][source]

The named fields of a loading path at one time (PathResult.fields[t]).

morphogen.viz.workflow.field_values(named: dict, name: str) → ndarray[source]

The values of the field name among the named fields (vectors by their norm).

morphogen.viz.workflow.requirements(spec) → set[str][source]

What the views of a VisualizationSpec need: "vtk" (3D views), "ffmpeg" (.mp4), "matplotlib" (figures).

morphogen.viz.workflow.check(spec) → None[source]

Raise an error naming what the views need and is missing (before a run).

morphogen.viz.workflow.visualize(spec, stem: str, outdir, *, image=None, labels=None, mesh=None, results=None)[source]

Write the figures and videos of spec (a VisualizationSpec) for one realization: its voxel image, cell labels, conforming mesh and the results of its homogenization (kept with their fields); returns the paths written.