Skip to main content

Microstructure generation and meshing

Project description

Microgen logo

microgen is a Python library designed to facilitate microstructure generation and meshing. Here are its core features:

  • Repeated cells: Generation of lattice structures such as octet trusses and honeycombs.
  • Triply Periodic Minimal Surfaces (TPMS): TPMS-based lattice generation known for favorable physical (mechanical, thermal, ...) properties like low density and large surface area.
  • Virtual composites microstructures: Generation of basic reinforcement geometries, including spheres, cylinders, ellipsoids, and more.
  • 3D Voronoi tessellation: Simulation of granular materials and polycrystalline metals.
  • Meshing: Regular and periodic meshing using Gmsh, remeshing using Mmg.

Generation of 3D objects is achievable through functions that utilize Open CASCADE (via cadquery-ocp-novtk, the direct OCCT Python binding) or VTK (using PyVista). Neper offers tools for 3D tessellation, while Gmsh handles the generation of both regular and periodic meshes, with Mmg handling remeshing tasks.

The CAD path (.generate_cad() on shapes, Phase, fuse_shapes, periodic split, lattice CAD) is optional — install with pip install 'microgen[cad]'. The default pip install microgen gives you mesh + implicit-field (F-rep) workflows only, which is sufficient for many applications and has a much lighter dependency footprint (no OCCT, no VTK version pin).

Gyroid TPMS

PyPI package PyPI
Conda forge package Conda
Documentation Documentation
Status Status
Citation DOI
License License
Website Website
Binder Binder

Installation

Core (mesh + implicit-field / F-rep, no CAD kernel) — lighter, works with VTK 9.4+:

pip install microgen

With CAD capabilities (OCCT via cadquery-ocp-novtk, enables .generate_cad(), Phase, fuse_shapes, periodic split, lattice CAD):

pip install 'microgen[cad]'

With conda:

conda install conda-forge::microgen          # core
conda install conda-forge::microgen ocp      # core + CAD

Python version notes: Python 3.10 to 3.14 is supported on Linux, macOS (Apple Silicon), and Windows, for both core and [cad], on both PyPI and conda-forge.

What you can do in each mode:

Core install [cad] install
Shape.generate_surface_mesh() (viz)
Implicit fields, TPMS F-rep, booleans
Shape.generate_cad() (OCCT BREP)
Phase, fuse_shapes, cut_*
Periodic split, lattice CAD export
VTK 9.4+

To modify the sources, clone this repository and install microgen:

git clone https://github.com/3MAH/microgen.git
cd microgen
pip install -e .[all]
pre-commit install

The -e or --editable option allows to modify the sources without having to reinstall the package and [all] installs the optional development dependencies.

Run tests with pytest:

pytest tests -n auto

Examples

Click on the image to be redirected to the corresponding example on microgen's documentation

Basic shapes

Repeated cells

Strut-based Lattices

Triply Periodic Minimal Surfaces (TPMS)

3D operations

Mesh

Citation

If you use microgen in academic work, please cite it using the concept DOI, which always resolves to the latest archived version on Zenodo:

10.5281/zenodo.6793573

A BibTeX entry suitable for the latest release:

@software{microgen,
  author    = {Marchais, Kevin and
               Chemisky, Yves and
               Legerstee, Yasmin and
               Guevara Garban, Manuel Ricardo},
  title     = {{microgen: microstructure generation and meshing}},
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.6793573},
  url       = {https://doi.org/10.5281/zenodo.6793573}
}

To cite a specific release instead of the concept, follow the concept DOI to its Zenodo page and pick the version DOI for the release you used. Machine-readable metadata is also available in CITATION.cff.

Authors and contributors

microgen is developed by the 3MAH group and external collaborators.

Authors

  • Kevin Marchais
  • Yves Chemisky
  • Yasmin Legerstee
  • Manuel Ricardo Guevara Garban

Contributors

  • Louise Le Barbenchon
  • Karim Haffar
  • Romain d'Esparbès
  • Sudeep Kumar Sahoo

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

microgen-2.0.0b1.tar.gz (126.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

microgen-2.0.0b1-py3-none-any.whl (132.2 kB view details)

Uploaded Python 3

File details

Details for the file microgen-2.0.0b1.tar.gz.

File metadata

  • Download URL: microgen-2.0.0b1.tar.gz
  • Upload date:
  • Size: 126.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for microgen-2.0.0b1.tar.gz
Algorithm Hash digest
SHA256 9c894ea753d173d44e68ab19e69f9c4bf90066a7b0a714831984cd479ea35e9b
MD5 700594257e901386b683c0cf2ff0a57f
BLAKE2b-256 c7272f47e23ad1049672a25211ef228cde83d978ab83488fbb2930481d61f565

See more details on using hashes here.

File details

Details for the file microgen-2.0.0b1-py3-none-any.whl.

File metadata

  • Download URL: microgen-2.0.0b1-py3-none-any.whl
  • Upload date:
  • Size: 132.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for microgen-2.0.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 4ec349b1f2285d8a334eed9c3f88e51a281b8a12222559de95892880d80b72aa
MD5 ff841ccdb74b05b458ccf11612fe2e50
BLAKE2b-256 2581429c80f93411b264b8be2a7397d7cfa411d04a8bd78f974517963bcfa6f0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page