🚀 This is a Fenicsx python project using finite element method (FEM) to compute effective stiffness tensor of cells.
The following equation is what this program solves and used to compute effective stiffness tensor:
Where
and :
Also,
and then use this to compute the effective stiffness tensor (But we will not use this method in this program):
Note a equivalent solution is using the following equation to solve
Please cite this software using the following BibTeX entry (also available in CITATION.cff) when using this in academic research.
@software{fenicsx_cell_homogenization,
author = {Parrot, Fried},
title = {{FEniCSx Cell Homogenization Solver}},
month = {8},
year = {2025},
publisher = {GitHub},
version = {1.0.0},
url = {https://github.com/FRIEDparrot/fenicsx_cell_homogenization},
note = {Software for computational homogenization with FEniCSx}
}
Closely related work has done by Dong et al using voxel-based homogenization. (2019), who provided a concise Matlab implementation for homogenization in lattice structures. You can refer to their work here:
And this repo and found at https://github.com/GuoyingDong/homogenization
This program runs by Fenicsx, which can be installed by instructions here, or by following command:
conda create -n fenicsx-env
conda activate fenicsx-env
conda install -n fenicsx-env -c conda-forge libopenblas # this might be necessary
ls $CONDA_PREFIX/lib/libopenblas.so* # validate
conda install -c conda-forge fenics-dolfinx mpich pyvista # install main dependencies
```=
[Gmsh](https://gmsh.info/) library is also required to generate cell mesh, you can install it by:
```shell
pip install --upgrade gmsh
# pygmsh
# pip install --upgrade pygmsh
pip install meshio
gmsh # start GUI interface
I recommend you use pycharm professional to run this project.
git clone https://github.com/FRIEDparrot/fenicsx_cell_homogenization.git
cd fenicsx_cell_homogenization # set working directory
Run tests/cell_generation.py
to generate cell mesh of all cells in cells directory under the test folder.
# ADD THE PROJECT PATH TO TEMPORARY PYTHONPATH WHEN RUN
conda run -n fenicsx-env PYTHONPATH=. python -m tests.cell_generation
Run tests/cell_homogenization_tests.py
to compute effective stiffness tensor for all cells and visualize the results.
# ADD THE PROJECT PATH TO TEMPORARY PYTHONPATH WHEN RUN
conda run -n fenicsx-env PYTHONPATH=. python -m tests.cell_homogenization_tests
this will calculate and show all result pictures (close it to make program run and show next), this is the example picture (first shown)
If you want calculate faster, you can change V = functionspace(self.domain, ("CG", 2, (self.dim,)))
to 1-degree element, which will also cause result to be less accurate.
You may carefully adjust the mesh size of cells when calculating.
- Cube cell
Cell mesh:
result for directional young modulus:
- Octet cell
cell mesh:
result for directional young modulus:
- Face center cubic cell
cell mesh:
result for directional young modulus:
- Tesseract cell
cell mesh:
result for directional young modulus:
- Vintiles cell
cell mesh:
result for directional young modulus:
[!bug]
tetrahedron cell mesh would fail to be read mesh because of problem of multi-elements auto generated by gmsh.