This repository provides a workflow to perform computational fluid dynamics (CFD) simulations in microsystems. Given an image of a microsystem and an input text file with few parameters, then the pymm executable process the image and builds the grid using Gmsh and runs the CFD simulations using OpenFOAM.
You will first need to install
- OpenFOAM (https://www.openfoam.com) (tested with OpenFOAM-11)
- Gmsh (https://gmsh.info) (tested with Gmsh 4.8.4)
You will also need to install some Python packages, see requirements.txt
for a complete list. You can install all the required Python packages in a virtual environment with the following commands:
# Clone the repo
git clone https://github.com/cssr-tools/pymm.git
# Get inside the folder
cd pymm
# Create virtual environment
python3 -m venv vpymm
# Activate virtual environment
source vpymm/bin/activate
# Upgrade pip, setuptools, and wheel
pip install --upgrade pip setuptools wheel
# Install the pymm package (in editable mode for contributions/modifications; otherwise, pip install .)
pip install -e .
# For contributions/testing/linting, install the dev-requirements
pip install -r dev-requirements.txt
Depending on the location where OpenFOAM is installed, then before running pymm (inside the vpymm Python environment), you need to enter the OpenFOAM environment:
# Check where openFOAM is installed
echo $WM_PROJECT_DIR
# The return value was /opt/openfoam11, then we activate the environment
source /opt/openfoam11/etc/bashrc
# Then, if everything went fine, typing
gmshToFoam
# should print the argument flags for that OpenFOAM executable.
You can run pymm as a single command line:
pymm -i some_input_image.png -p some_input_parameters.txt -o some_output_folder
Run pymm --help
to see all possible command line argument options. Inside the some_input_parameters.txt
file you provide the framework parameters such as the dimensions of the microsystem, mesh size, inlet pressure, and more. See the .txt files in the examples folder.
See the documentation.
The following is a list of journal papers in which pymm is used:
- Liu, N., Haugen, M., Benali, B., Landa-Marbán, D., Fernø, M.A., 2023. Pore-scale spatiotemporal dynamics of microbial-induced calcium carbonate growth and distribution in porous media. Int. J. Greenh. Gas Control 125, 103885. https://doi.org/10.1016/j.ijggc.2023.103885
- Liu, N., Haugen, M., Benali, B., Landa-Marbán, D., Fernø, M.A., 2023. Pore-scale kinetics of calcium dissolution and secondary precipitation during geological carbon storage. Chem. Geol. 641, 121782. https://doi.org/10.1016/j.chemgeo.2023.121782.
The image-based Python package for computational fluid dynamics pymm is funded by Center for Sustainable Subsurface Resources [project no. 331841] and NORCE Norwegian Research Centre As [project number 101070].
Contributions are more than welcome using the fork and pull request approach.