Skip to main content

MicroStructPy - Microstructure Mesh Generation in Python

Continuous Integration License Python Versions

CMAME DOI SoftwareX DOI

GitHub Repository ReadTheDocs Documentation PyPI PyPI

MicroStructPy is a microstructure mesh generator written in Python. Features of MicroStructPy include:

  • 2D and 3D microstructures

  • Periodic microstructures

  • Grain size, shape, orientation, and position control

  • Polycrystals, amorphous phases, and voids

  • Unstructured and raster meshes

  • Mesh verification

  • Visualizations

  • Output to common file formats

  • Customizable workflow

Banner image showing the three steps for creating microstructure.

The three steps to creating a microstructure are: 1) seed the domain with particles, 2) create a Voronoi power diagram, and 3) convert the diagram into an unstructured mesh.

Download & Installation

To install MicroStructPy, download it from PyPI using:

pip install microstructpy

If there is an error with the install, try pip install pybind11 first, then install MicroStructPy. When upgrading from an earlier version, run pip uninstall pyvoro-mmalahe first: MicroStructPy now uses pyvoro-rimoli, which installs the same pyvoro module.

MicroStructPy can also be installed from source:

git clone https://github.com/kip-hart/MicroStructPy.git
pip install -e MicroStructPy/

Installing MicroStructPy creates the command line program microstructpy and the Python package microstructpy. The command line program executes a standard workflow on XML input files, while the package exposes classes and functions for a customized workflow.

Run a Demo

MicroStructPy includes several demo and example files to help new users get started with the program. A full list of examples is available online at https://docs.microstructpy.org/examples.html.

Here is minimal example input file:

<?xml version="1.0" encoding="UTF-8"?>
<input>
    <material>
        <shape> circle </shape>
        <size> 0.15 </size>
    </material>

    <domain>
        <shape> square </shape>
    </domain>
</input>

This example can be run from the command line by excuting:

microstructpy --demo=minimal.xml

Alternatively, you can copy the text to a file such as my_input.xml and run microstructpy my_input.xml.

The same output can be obtained from using the package in a script:

import matplotlib.pyplot as plt
import microstructpy as msp


phase = {'shape': 'circle', 'size': 0.15}
domain = msp.geometry.Square()

# Unpositioned list of seeds
seeds = msp.seeding.SeedList.from_info(phase, domain.area)

# Position seeds in domain
seeds.position(domain)

# Create polygonal mesh
polygon_mesh = msp.meshing.PolyMesh.from_seeds(seeds, domain)

# Create triangular mesh
triangle_mesh = msp.meshing.TriMesh.from_polymesh(polygon_mesh)

# Plot outputs
for output in [seeds, polygon_mesh, triangle_mesh]:
    plt.figure()
    output.plot(edgecolor='k')
    plt.axis('image')
    plt.axis([-0.5, 0.5, -0.5, 0.5])
    plt.show()

Documentation

MicroStructPy documentation is available online at https://docs.microstructpy.org.

To build a local copy of the documentation, execute the following from the top-level directory of the MicroStructPy repository:

pip install tox
tox -e docs

Once built, the documentation will be in docs/build/.

Publications

If you use MicroStructPy in you work, please consider including these citations in your bibliography:

K. A. Hart and J. J. Rimoli, Generation of statistically representative microstructures with direct grain geometry control, Computer Methods in Applied Mechanics and Engineering, 370 (2020), 113242. (BibTeX) (DOI)

K. A. Hart and J. J. Rimoli, MicroStructPy: A statistical microstructure mesh generator in Python, SoftwareX, 12 (2020), 100595. (BibTeX) (DOI)

The news article AE Doctoral Student Kenneth A. Hart Presents MicroStructPy to the World, written by the School of Aerospace Engineering at Georgia Tech, describes MicroStructPy for a general audience.

Contributing

Contributions to the project are welcome. Please use the GitHub pull request and issue submission features. See the Contributing Guidelines for more details.

License and Attributions

MicroStructPy is open source and freely available. Copyright for MicroStructPy is held by Georgia Tech Research Corporation. MicroStructPy is a major part of Kenneth (Kip) Hart’s doctoral thesis, advised by Prof. Julian Rimoli.

Metadata

Release files for microstructpy 1.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for microstructpy 1.6.1
File Size Uploaded Provenance Actions
microstructpy-1.6.1.tar.gz 1.3 MB Without provenance Details for microstructpy-1.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for microstructpy 1.6.1
File Interpreter ABI Platform Actions
microstructpy-1.6.1-py2.py3-none-any.whl Python 2, Python 3 none any Details for microstructpy-1.6.1-py2.py3-none-any.whl

Total release size: 1.5 MB

Release files / microstructpy-1.6.1.tar.gz

Download URL microstructpy-1.6.1.tar.gz
Size 1.3 MB
Tags Source
SHA-256 checksum
How to use checksums
514c34c7b94c105c81302b2607a632edbecd44c75b8f0c6a3d96a33e80f12d98
BLAKE2b-256 checksum
How to use checksums
12824ac8ba7b4735c08fbe98ed1d6f5406526bd69524969dba62bc6a5aa1df9a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / microstructpy-1.6.1-py2.py3-none-any.whl

Download URL microstructpy-1.6.1-py2.py3-none-any.whl
Size 182.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
6c9d1dcc22c9caf861950105333e9d4ccdb4b9b101d922a8093ffb15626158f4
BLAKE2b-256 checksum
How to use checksums
3b3dd821f66d7c4af39647c37d56af4142975eb150438ab357a07b69619e0593
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for microstructpy 1.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.6.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page