microgen
Microstructure generation and periodic meshing for the mechanics of architectured materials.
microgen generates triply periodic minimal surfaces, strut lattices, Voronoi polycrystals and composite inclusions as implicit fields or CAD solids, and meshes them with conforming, periodic tetrahedral meshes ready for homogenization with fedoo and simcoon.
What you can build
Gyroid, Schwarz, Schoen, Neovius, Fischer-Koch and more, as sheets or skeletals, at a prescribed density.
Density and cell-size gradients, morphing between TPMS families, cylindrical, spherical and swept frames.
Periodic Gaussian random fields at a prescribed density, isotropic, columnar or lamellar.
Twelve preset lattices, custom and auxetic cells, octet-truss and honeycomb.
Neper tessellations as polyhedral grains, alone or intersected with a TPMS.
Random, non-overlapping spheres and short fibres with their periodic images.
Conforming tetrahedral meshes with matching nodes on opposite faces (gmsh), remeshing with mmg.
Every shape is a signed field: union, intersection, difference and smooth blends are instant, robust and need no CAD kernel.
15 000 fibres rebuilt from a tomography analysis of a short fibre composite.
Hello, gyroid
from microgen import Phase, Tpms, surface_functions
gyroid = Tpms(surface_function=surface_functions.gyroid, offset=0.3)
phase = Phase.from_shape(gyroid, resolution=80)
phase.surface_mesh().save("gyroid.stl") # marching cubes from the field
print(f"COM = {phase.center_of_mass}, pieces = {len(phase.pieces)}")
A Phase built with from_shape()
carries the implicit field: marching cubes, connected components and moments
are computed from the field, without the CAD backend. The CAD representation
(STEP export, periodic gmsh meshes) is built on demand and needs the
[cad] extra.
Install
pip install microgen # implicit fields and surface meshes
pip install "microgen[cad]" # + OCCT: CAD export, periodic meshes
conda install -c conda-forge microgen # core
conda install -c conda-forge microgen ocp # core + CAD
See Install for the details of each mode.
The 3MAH ecosystem
Geometry and periodic meshes of microstructures.
Nonlinear finite elements and periodic homogenization.
Constitutive laws and mean-field micromechanics.
Cite microgen
If you use microgen in academic work, please cite the concept DOI 10.5281/zenodo.6793573, which always resolves to the latest release. microgen is developed by the 3MAH group and external collaborators, under the GPL-3.0 license.