https://github.com/insigneo/microfe
https://github.com/insigneo/microfe
finite-elements mesh-generation
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/insigneo/microfe
- Owner: INSIGNEO
- License: other
- Created: 2017-07-10T13:24:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-08-16T10:29:11.000Z (over 7 years ago)
- Last Synced: 2025-03-02T04:35:30.408Z (12 months ago)
- Topics: finite-elements, mesh-generation
- Language: Jupyter Notebook
- Homepage:
- Size: 6.18 MB
- Stars: 2
- Watchers: 5
- Forks: 2
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# microFE
[](https://www.sheffield.ac.uk)
[](https://insigneo.org/)
[](http://www.compbiomed.eu/)
[](https://opensource.org/licenses/Apache-2.0)
## Installation (ShARC)
Log in and create conda environment
```bash
$ qrshx
$ module load apps/python/conda
$ cd /microFE/
$ conda env create -f environment.yml
```
Compile matlab code as
```bash
$ cd m_files/
$ module load apps/matlab/R2016a
$ ./compile.sh
```
In case you want to run the workflow in Windows, compile `m_files/main_win.m` file.
## Usage
The entire pipeline is run by
```bash
$ python microFE.py -c config.ini
```
where `config.ini` is a generic configuration file. Meshing and FE solver are run by submitting a batch job. See `microFE.sh` for an example file which you can run as `qsub microFE.sh` in ShARC. All the parameters are specified in the `.ini` configuration file.
### Configuration file
The meshing process requires the definition of a number of paths and variables. These are defined in a `.ini` configuration file
```
[directories]
CT_IMAGE_FOLDER =
OUTPUT_DIR =
MESHER_SRC =
LD_LIB_PATH =
[images]
img_name =
[mesher]
threshold =
resolution =
[fem]
boundary_condition = <`displacement` or `load`>
units = <`mm` or `percent` for `displacement`, `N` for `load`>
direction = <`x`, `y`, or `z`>
sign = <`positive` or `negative`>
amount =
constrain = <`full` or `free`>
E =
yield_stress =
Et =
[job]
name =
np =
```
The element used in ANSYS APDL is the 8-nodes [SOLID185](https://www.sharcnet.ca/Software/Ansys/16.2.3/en-us/help/ans_elem/Hlp_E_SOLID185.html)
By specifying only the Young's modulus `E`, the analysis will be [linear elastic](https://www.sharcnet.ca/Software/Ansys/16.2.3/en-us/help/ans_mat/ann8sq39eldm.html#ELlinmatstressstrain), whereas including also `yield_stress` and `Et` (the tangent Young's modulus) the analysis will be [elastic-perfectly-plastic](https://www.sharcnet.ca/Software/Ansys/16.2.3/en-us/help/ans_mat/amp8sq21dldm.html#miso).
## Matlab mesher
In `m_files\` there is the code for generating FE models with cartesian mesh and homogeneous material properties. The original mesher code is in `/m_files/mesher.m`.
The following inputs are required:
- greyscale images (`.tiff` format);
- voxel size (`Image_Resolution`);
- threshold for defining bone tissue;
The `m_files/main.m` file executes the mesher.
The script in `m_files/compile.sh` compiles the matlab scripts with the matlab compiler. Compiled files can be run with the matlab runtime environment.
## Outputs
After executing microFE.py, the results will be saved in `OUTPUT_DIR/` folder as specified in the `.ini` configuration file. The folder structure will be
```
/
|- elementdata.txt (mesh elements list)
|- nodedata.txt (mesh nodes list)
|- fe_model.txt (Ansys model script)
|- microFE.py.log (log file)
|- Binary/ (Binary slices from microCT image)
| |- binary0001.tif
| |- binary0002.tif
| |- ...
|- tiff/ (microCT slices converted to tiff from DICOM)
| |- _0001.tif
| |- _0002.tif
| |- ...
|- NodalDisplacements.txt (nodal displacement from FEM solution as: node, x, y, z)
|- .db (Ansys output files)
|- .err
|- .esav
|- .log
|- .mntr
|- .PCS
|- .rst
|- .stat
```
## Citation
The Matlab code was developed by Y. Chen as part of his PhD project:
- _Chen Y, Pani M, Taddei F, Mazzà C, Li X, Viceconti M. [Large-scale finite element analysis of human cancellous bone tissue micro computer tomography data: a convergence study](http://biomechanical.asmedigitalcollection.asme.org/article.aspx?articleid=1892759). Journal of biomechanical engineering. 2014 Oct 1;136(10):101013._
- _Chen Y, Dall'Ara E, Sales E, Manda K, Wallace R, Pankaj P, Viceconti M. [Micro-CT based finite element models of cancellous bone predict accurately displacement once the boundary condition is well replicated: A validation study](http://www.sciencedirect.com/science/article/pii/S1751616116303204). Journal of the mechanical behavior of biomedical materials. 2017 Jan 31;65:644-51._