Package: microstructpy
RepositoryDocumentationPyPIMicroStructPy is a microstructure mesh generator written in Python.
Features of MicroStructPy include:2D and 3D microstructuresGrain size, shape, orientation, and position controlPolycrystals, amorphous phases, and voidsUnstructured and raster meshesMesh verificationVisualizationsOutput to common file formatsCustomizable workflowThe 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 & InstallationTo install MicroStructPy, download it from PyPI using:pip install microstructpyIf there is an error with the install, trypip install pybind11first,
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 programmicrostructpyand
the Python packagemicrostructpy.
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 DemoMicroStructPy includes several demo and example files to help new users get
started with the program.
A full list of examples is available online athttps://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.xmlAlternatively, you can copy the text to a file such asmy_input.xmland runmicrostructpy my_input.xml.The same output can be obtained from using the package in a script:importmatplotlib.pyplotaspltimportmicrostructpyasmspphase={'shape':'circle','size':0.15}domain=msp.geometry.Square()# Unpositioned list of seedsseeds=msp.seeding.SeedList.from_info(phase,domain.area)# Position seeds in domainseeds.position(domain)# Create polygonal meshpolygon_mesh=msp.meshing.PolyMesh.from_seeds(seeds,domain)# Create triangular meshtriangle_mesh=msp.meshing.TriMesh.from_polymesh(polygon_mesh)# Plot outputsforoutputin[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()DocumentationMicroStructPy documentation is available online athttps://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 docsOnce built, the documentation will be indocs/build/.PublicationsIf 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 articleAE 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.ContributingContributions to the project are welcome.
Please use the GitHub pull request and issue submission features.
See theContributing Guidelinesfor more details.License and AttributionsMicroStructPy 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.