Skip to main content

Microstructure modeling, mesh generation, analysis, and visualization.

Project description

Travis CI License DOI

GitHub Repository ReadTheDocs Documentation PyPI PyPI

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

  • 2D and 3D microstructures

  • Grain size, shape, orientation, and position control

  • Polycrystals, amorphous phases, and voids

  • 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.

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/.

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.

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

microstructpy-1.2.1.macosx-10.9-x86_64.tar.gz (205.7 kB view details)

Uploaded Source

Built Distribution

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

microstructpy-1.2.1-py2.py3-none-any.whl (116.5 kB view details)

Uploaded Python 2Python 3

File details

Details for the file microstructpy-1.2.1.macosx-10.9-x86_64.tar.gz.

File metadata

  • Download URL: microstructpy-1.2.1.macosx-10.9-x86_64.tar.gz
  • Upload date:
  • Size: 205.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.6

File hashes

Hashes for microstructpy-1.2.1.macosx-10.9-x86_64.tar.gz
Algorithm Hash digest
SHA256 df454b33a9deb7e9d63eeb6d3576263cb47235aadd0c6fb13f4e77e0f65e8ba4
MD5 b2d95b6a2338e2e7887daa66e0f21cd5
BLAKE2b-256 4fd060bf0241095ef15496a6b7e59c4705435e2de27484446e35d4037cea16ba

See more details on using hashes here.

File details

Details for the file microstructpy-1.2.1-py2.py3-none-any.whl.

File metadata

  • Download URL: microstructpy-1.2.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 116.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.6.6

File hashes

Hashes for microstructpy-1.2.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 f0a35c2f7c80d1ce2e0cdd506e59a16c148b34f66a53e84592f4419cf1278988
MD5 a3d2bfb2738629d450c00319ea7bc030
BLAKE2b-256 7056f1b0cf14277bbd0a2d7ddfff1052859b3b709c70569d3d20b145077b0c8b

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