Overview¶
A python package for generating complex synthetic polycrystalline microstructures. The general implementation is done in Python with performance critical part implemented in C++. Python bindings for the code written in C++ is generated using the lightweight header-only library pybind11. The C++ part of the implementation utilizes the Eigen library for efficient linear algebra calculations.
Features¶
- User interface to kanapy through scripts are written in pure Python.
- Efficient collision handling through a two-layer collision detection method employing the Octree spatial data structure and the bounding sphere hierarchy.
- Efficient in-built hexahedral mesh generator for complex polycrystalline microstructures.
- Independent execution of individual modules through easy data storage and handling.
- Flexibility in the choice of particle packing time step to be sent for voxelization (meshing).
- Option to generate spherical particle position and radius files that can be read by voronoi tessellation software Neper.
- Option to generate input files for commercial finite-element software Abaqus.
- High-performance for the critical part of the code using Python-C++ bindings.
Installation¶
The preferred method to install kanapy is through Anaconda or Miniconda python distributions. Follow the anaconda or the miniconda documentation to install it.
Once done, create a virtual environment for installing python specific packages required for kanapy.
$ conda create -n myenv python=3.6
Note
myenv
can be replaced with any name for your environment.- This will install python 3.6 as the default python interpretor within this environment.
Tip
To learn more on managing environments see Anaconda documentation.
Activate the environment using:
$ conda activate myenv
Note
myenv
can be replaced with the name of your environment.
The sources for kanapy can be downloaded from the Github repo. You can clone the public repository into a desired location:
$ git clone git://github.com/mrgprasad/kanapy
Once you have a copy of the source, move into the cloned local repository and install the dependencies and kanapy using:
$ cd kanapy/
$ pip install -r requirements.txt
$ pip install .
Note
The requirements.txt
file contains all the dependencies of kanapy with their specific versions.
Dependencies¶
kanapy requires a working C/C++ compiler on your machine. On Linux/OS X
the gcc toolchain will work well. The lightweight header-only library pybind11
is used to create Python bindings for the code written in C++.
The C++ function kanapy.overlapDetect.collideDetect()
can be complied by linking the
Eigen library (present in the directory /kanapy/libs/
) using this command. From the kanapy main directory:
$ cd kanapy/
$ g++ -O3 -Wall -shared -std=c++11 -fPIC `python3 -m pybind11 --includes` -I ../libs/eigen_cpp/ overlapDetect.cpp -o overlapDetect`python3-config --extension-suffix`
Optional dependencies¶
- Matplotlib for plotting and visualizing.
- OVITO for visualizing simulation data.
Running tests¶
kanapy uses pytests to perform all its testing. From the kanapy main directory run the tests using pytest
:
$ py.test -v
Documentation¶
Documentation for kanapy is generated using Sphinx. The following command generates HTML-based reference documentation; for other formats please refer to the Sphinx manual. From the kanapy main directory:
$ cd docs/
$ make clean
$ make html
Note
The HTML documentation can be found at /kanapy/docs/_build/html/index.html
License¶
kanapy is made available under the MIT license
About¶
The name kanapy is derived from the sanskrit word káṇa meaning particle. It is primarily developed at the Interdisciplinary Center for Advanced Materials Simulation (ICAMS), Ruhr-University Bochum - Germany. Our goal is to build a complete synthetic microstructure generation tool for reasearch and industry use.