morphogen

morphoGen: morphological modelling and generation of virtual microstructures.

Typical use:

import morphogen as mg

model = mg.models.BooleanSpheres(radius=1.0, volume_fraction=0.3)
micro = model.generate(mg.Domain.cube(20.0), seed=1)   # explicit ("vector") geometry
image = micro.voxelize(shape=128)                        # phase image (uint8)
print(mg.analysis.volume_fraction(image), model.theory()["volume_fraction"])
mg.io.save_image(image, "spheres.vti")

mesh = mg.mesh.conforming_mesh(micro, size=0.5)         # conforming tetrahedra (MMG)
materials = {0: mg.homogenization.Material(young=1.0, poisson=0.3),
             1: mg.homogenization.Material(young=10.0, poisson=0.3)}
results = mg.homogenization.homogenize(mesh, materials, bcs=["kubc", "periodic"])

Public names

  • Domain — Axis-aligned box in which microstructures are generated.

  • Grid — Regular voxel grid over a domain (see the module docstring for conventions).

  • VoxelImage — 3D image of a microstructure.

  • export — Write obj to path in the format of its suffix (see the module); the options go to the writer.

  • get_model — The class of a registered model, by its name (list_models()).

  • list_models — The names of the registered models, sorted.

  • model_from_config — Build a model from a mapping {"type": name, **parameters}.

  • set_num_threads — Number of threads used by compiled kernels and SciPy (None: all cores).

Modules