Skip to content

Library for performing multiphase simulations (based on the Shan-Chen model) in complicated geometries (i.e. porous media 3D images)

License

Notifications You must be signed in to change notification settings

bmewang/LBM-MultiphasePorousMediaPalabos

 
 

Repository files navigation

Multiphase LBM Toolbox: Permeable media analysis using the Palabos library and in-house codes

This workflow calculates capillary pressure curves, relative permeability, tortuosity, contact angles, and the percolation pathway of grain packs/image slices. The direct fluid flow simulation is performed using Palabos v2.

This repository was created by Javier E. Santos and Abhishek Bihani in collaboration with Christopher Landry, Hugh Daigle, Masa Prodanovic, Wenhui Song, and Michael Pyrcz

Illustrations

alternate text

Non-wetting fluid (purple) traveling through a spherepack.


alternate text

Unsteady flow simulation showing a capillary pressure increment with different colors.


alternate text

Percolating path of a non-wetting fluid (rock and wetting fluid not shown).


alternate text

Velocity magnitude of a single phase flow simulation.

Overview

This library provides tools to interact with the palabos simulation engine. Its aim is to provide ready-to-go tools to compute relevant properties for permeable media. It includes scripts for creating efficient geometries for simulation, single and multiphase models with various boundary conditions, and extensive postprocesing tools. The Palabos backend makes the simulation engine flexible enought to be run on a single core of a personal computer or in hundreds of nodes of a supercomputer.

Requirements

  • Matlab or Octave (Python alternative coming soon)
  • Unix system (the Windows bash or the terminal in Mac)
  • GCC 7.2
  • OpenMPI 2.1.1 or MPICH2
  • Python 2.7.x (to complie Palabos)

Installation

./Install.sh

Running a simulation

Please refer to the unsteady state example for a complete workflow


  1. Pre-processing (Matlab/Octave):
  • To create the geometry for simulating with Palabos (.dat file),

    1. If the geometry is a 3D array, use pre-processing/create_geom_edist.m
    2. If the geometry is an image sequence, use pre-processing/createDAT.m
  1. Two-Phase LBM Simulation (cpp w/MPI using PALABOS):

  2. Post-processing (Matlab/Octave):

    • Read the generated files using post-porcessing/domains_4_kr.m

    (It will calculate the wetting saturation for all vtk files, will convert the fluid configurations (1 and 2) to .dat files for 1-phase LBM simulation and will find the vtk file where breakthrough occurs and the percolation path/tortuosity. You can choose if you want to generate fluid geometries or calculate percolation path at breakthrough)

  3. Single-Phase LBM Simulation (cpp w/MPI using PALABOS):

    • Update geometry and simulation parameters in input xml file

Optional: Run porethroat_dist.m to calculate pore and throat size distribution of geometry from vtk file created during 2-phase LBM simulation

Numerical validations

  • Young's equation
  • Young-Laplace
  • Washburn

Example description

  • Unsteady state
  • Steady state: an video example is shown in: youtube video

FAQ

Segmentation error: Image dimensions are not correct, try switching the dimensions.


Image is loaded properly but it doesn't look right: This is likely because Palabos engine switches the X and Z coordinates


SCons compilation error: create a conda enviroment with python2 (Palabos needs it):

conda create --name py2 python=2.7
./Install.sh

Another SCons compilation error: Because of the palabos source code.

"../MultiphasePorousMediaPalabos-0.1.0/src/palabos-v2.0r0/src/gridRefinement/couplingInterfaceGenerator3D.h" line 145, "return dataProcessors;" should be "return *dataProcessors;".

Why am I seeing the same line printed multiple times? / Why is the code so slow?: Probably MPI is not installed in your system, this could be solved by:

sudo apt-get install build-essential
sudo apt-get install gfortran
cd /tmp
wget https://www.mpich.org/static/downloads/1.4.1/mpich2-1.4.1.tar.gz
tar xzvf mpich2-1.4.1.tar.gz
cd mpich2-1.4.1/
./configure
make
sudo make install

Note that this process takes a few hours.


I am getting a Java Heap Memory error in Matlab? You need to change the JavaHeapMemory setting in Matlab:

If you're working on a remote system/cluster or supercomputer, the easiest way to do this is to find and change your matlab.prf file diretly.

You will find the matlab.prf in your user storage directory. It will be something like: `[user home]/.matlab/[Matlab version]/matlab.prf`

Once the file is open add the following line to the file: `JavaMemHeapMax = [Java Memory Code]` You will need to find the sepcific Java memory code that corresponds to the amount of RAM you need.

Or you can try this fix (If you are on a remote system, cluster, or supercomputer this may not work): https://www.mathworks.com/matlabcentral/answers/74296-change-java-heap-memory-settings-without-starting-matlab

Citing the workflow

If you use our workflow, please cite as:

Santos J., Bihani A., Landry C., Multi-Phase Porous Media for Palabos. Git code (2019). 10.5281/zenodo.3842279

Author's Publications

  1. Bihani A., Daigle H., Santos J., Landry C., Prodanović M., Milliken K. (2019). H44B-06: Insight into the Sealing Capacity of Mudrocks determined using a Digital Rock Physics Workflow. AGU Fall Meeting, 9-13 December, San Francisco, USA.
  2. Santos, J. E., Prodanovic, M., Landry, C. J., & Jo, H. (2018, August 9). Determining the Impact of Mineralogy Composition for Multiphase Flow Through Hydraulically Induced Fractures. Unconventional Resources Technology Conference. doi:10.15530/URTEC-2018-2902986
  3. Landry, C. J., Karpyn, Z. T., and Ayala, O. (2014), Relative permeability of homogenous‐wet and mixed‐wet porous media as determined by pore‐scale lattice Boltzmann modeling, Water Resour. Res., 50, 3672– 3689, doi:10.1002/2013WR015148.
  4. Santos, J. E., Xu, D., Jo, H., Landry, C. J., Prodanović, M., & Pyrcz, M. J. (2020). PoreFlow-Net: A 3D convolutional neural network to predict fluid flow through porous media. Advances in Water Resources, 138, 103539.

Bibliographic references

  1. Unsteady state simulation set-up: Pan, C., Hilpert, M., and Miller, C. T. ( 2004), Lattice‐Boltzmann simulation of two‐phase flow in porous media, Water Resour. Res., 40, W01501, https://doi.org/10.1029/2003WR002120.
  2. Contact angle approximation: Huang, H., Thorne, D. T., Schaap, M. G., & Sukop, M. C. (2007). Proposed approximation for contact angles in Shan-and-Chen-type multicomponent multiphase lattice Boltzmann models. Physical Review E - Statistical, Nonlinear, and Soft Matter Physics, 76(6), 1–6. https://doi.org/10.1103/PhysRevE.76.066701.
  3. Fluid flow model: Santos, J. E. (2018). Lattice-Boltzmann modeling of multiphase flow through rough heterogeneously wet fractures. University of Texas at Austin (Master thesis). https://repositories.lib.utexas.edu/handle/2152/69246.

Code references

  1. Absolute permeability code modified from Degruyter et al. - https://www.palabos.org/documentation/tutorial/permeability.html
  2. Skeletonization code modified from Kollmannsberger Philip- https://www.mathworks.com/matlabcentral/profile/authors/4556277-philip-kollmannsberger
  3. Dijkstra's algorithm code modified from Kirk Joseph- https://www.mathworks.com/matlabcentral/fileexchange/12850-dijkstra-s-shortest-path-algorithm

We welcome contributions

About

Library for performing multiphase simulations (based on the Shan-Chen model) in complicated geometries (i.e. porous media 3D images)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • MATLAB 65.5%
  • C 18.2%
  • C++ 13.6%
  • Makefile 2.3%
  • Other 0.4%