A MATLAB approach for developing digital rock models of heterogeneous limestones for reactive transport modeling


  • Atefeh Vafaie PhD student
  • Josep M. Soler Institute of Environmental Assessment and Water Research (IDAEA), CSIC
  • Jordi Cama Institute of Environmental Assessment and Water Research (IDAEA), CSIC
  • Iman R. Kivi Department of Earth Science and Engineering, Imperial College London
  • Victor Vilarrasa Global Change Research Group (GCRG), IMEDEA, CSIC-UIB




Computed tomography‎, Digital rock physics‎, Rock heterogeneity‎, Porosity reconstruction‎, Reactive transport modeling


Porosity is a key parameter controlling the physico-chemical behavior of porous rocks. Digital rock physics offers a unique technique for imaging the inherently heterogeneous rock microstructure at fine spatial resolutions and its computational reconstruction, through which a better understanding and prediction of the rock behavior can be achieved. In this study, we propose a simple but accurate method to build a 3D porosity map of centimeter-scale carbonate rock cores from X-ray Micro Computed Tomography (XMCT) imaging data. The method consists of 3 main steps: i) decomposition of 3D volumetric XMCT data into sub-volumes, ii) processing of equidistributed 2D cross-section images in each sub-volume and iii) 2D slice-by-slice calculation of porosity and its assembly to reconstruct a 3D continuum porosity map over the whole core domain using a MATLAB code. The proposed approach significantly conserves the required memory to manipulate large image datasets. The digitized porosity representations are used to build 3D permeability maps of the cores by applying an explicit permeability-porosity relationship. The permeability maps are used as input for numerical simulation of the rock response to the percolation of reactive fluids through which the general validity of the approach is verified. The developed digital rock model paves the way for an improved understanding of reactive transport in carbonate rocks.


Abdulrahman, A., Varol, S., 2020. A review of image segmentation using MATLAB environment. Beirut (Lebanon), 2020 8th International Symposium on Digital Forensics and Security (ISDFS), IEEE, 1-5. DOI: 10.1109/ISDFS49300.2020.9116191

Akin, S., Kovscek, A.R., 2003. Computed tomography in petroleum engineering research. London, The Geological Society, 215(1, Special Publications), 23-38. DOI: https://doi.org/10.1144/ GSL.SP.2003.215.01.03

Andrä, H., Combaret, N., Dvorkin, J., Glatt, E., Han, J., Kabel, M., Keehm, Y., Krzikalla, F., Lee, M., Madonna, C., Marsh, M., 2013. Digital rock physics benchmarks—Part I: Imaging and segmentation. Computers & Geosciences, 50, 25-32. DOI: https://doi.org/10.1016/j.cageo.2012.09.005

Berg, S., Saxena, N., Shaik, M., Pradhan, C., 2018. Generation of ground truth images to validate micro-CT image-processing pipelines. The Leading Edge, 37(6), 412-420. DOI: https://doi. org/10.1190/tle37060412.1

Dávila, G., Luquot, L., Soler, J.M., Cama, J., 2015. 2D reactive transport modeling of the interaction between a marl and a CO2-rich sulfate solution under supercritical CO2 conditions. International Journal of Greenhouse Gas Control, 54, 145-159. DOI: https://doi.org/10.1016/j.ijggc.2016.08.033

Dávila, G., Cama, J., Chaparro, M.C., Lothenbach, B., Schmitt, D.R., Soler, J.M., 2021. Interaction between CO2-rich acidic water, hydrated Portland cement and sedimentary rocks: Column experiments and reactive transport modeling. Chemical Geology, 572, 120122. DOI: https://doi.org/10.1016/j. chemgeo.2021.120122

De Paulo Ferreira, L., Surmas, R., Tonietto, S.N., Pereira da Silva, M.A., Pires Peçanha, R., 2020. Modeling reactive flow on carbonates with realistic porosity and permeability fields. Advances in water resources, 139, 103564. DOI: https://doi. org/10.1016/j.advwatres.2020.103564

Durán, E.L., Adam, L., Wallis, I.C., Barnhoorn, A., 2019. Mineral alteration and fracture influence on the elastic properties of volcaniclastic rocks. Journal of Geophysical Research: Solid Earth, 124(5), 4576-4600. DOI: https://doi. org/10.1029/2018JB016617

Eberli, G. P., Baechle, G. T., Anselmetti, F. S., Incze, M. L., 2003. Factors controlling elastic properties in carbonate sediments and rocks. The Leading Edge, 22(7), 654-660. DOI: https:// doi.org/10.1190/1.1599691

Ettemeyer, F., Lechner, P., Hofmann, T., Andrä, H., Schneider, M., Grund, D., Volk, W., Günther, D., 2020. Digital sand core physics: Predicting physical properties of sand cores by simulations on digital microstructures. International Journal of Solids and Structures, 188, 155-168. DOI: https://doi. org/10.1016/j.ijsolstr.2019.09.014

Fredrich, J.T., Menéndez, B., Wong, T.F., 1995. Imaging the pore structure of geomaterials. Science, 268(5208), 276-279. DOI: 10.1126/science.268.5208.276

Hao, Y., Smith, M., Sholokhova, Y., Carroll, S., 2013. CO2- induced dissolution of low permeability carbonates. Part II: Numerical modeling of experiments. Advances in water resources, 62, 388-408. DOI: https://doi.org/10.1016/j. advwatres.2013.09.009

Hao, Y., Smith, M.M., Carroll, S.A., 2019. Multiscale modeling of CO2-induced carbonate dissolution: From core to meter scale. International Journal of Greenhouse Gas Control, 88, 272-289. DOI: https://doi.org/10.1016/j.ijggc.2019.06.007

Hommel, J., Coltman, E., Class, H., 2018. Porosity–permeability relations for evolving pore space: a review with a focus on (bio-) geochemically altered porous media. Transport in Porous Media, 124(2), 589-629. DOI: https://doi. org/10.1007/s11242-018-1086-2

Jackson, S.J., Agada, S., Reynolds, C.A., Krevor, S., 2018. Characterizing drainage multiphase flow in heterogeneous sandstones. Water Resources Research, 54(4), 3139-3161. DOI: https://doi.org/10.1029/2019WR026396

Jackson, S.J., Lin, Q., Krevor, S., 2020. Representative elementary volumes, hysteresis, and heterogeneity in multiphase flow from the pore to continuum scale. Water Resources Research, 56(6), e2019WR026396. DOI: https://doi. org/10.1029/2019WR026396

Ju, Y., Zheng, J., Epstein, M., Sudak, L., Wang, J., Zhao, X., 2014. 3D numerical reconstruction of well-connected porous structure of rock using fractal algorithms. Computer Methods in Applied Mechanics and Engineering, 279, 212- 226. DOI: https://doi.org/10.1016/j.cma.2014.06.035

Kapur J.N., Sahoo, P.K., Wong, A.K.C., 1985. A new method for gray-level picture thresholding using the entropy of the histogram. Graphical Models and Image Processing, 29(3), 273-285. DOI: https://doi.org/10.1016/0734- 189X(85)90125-2

Kittler, J., Illingworth, J., 1985. On threshold selection using clustering criteria. IEEE transactions on systems, man, and cybernetics, SMC-15 (5), 652-655. DOI: 10.1109/ TSMC.1985.6313443

Li, B., Benson, S., 2015. Influence of small-scale heterogeneity on upward CO2 plume migration in storage aquifers. Advances in Water Resources, 83, 389-404. DOI: https://doi.org/10.1016/j. advwatres.2015.07.010

Lin, Q., Al-Khulaifi, Y., Blunt, M.J., Bijeljic, B., 2016. Quantification of sub-resolution porosity in carbonate rocks by applying high-salinity contrast brine using x-ray microtomography differential imaging. Advances in Water Resources, 96, 306- 322. DOI: 10.1016/j.advwatres.2016.08.002

Liu, N., Liu, M., 2016. Simulation and analysis of wormhole propagation by VES acid in carbonate acidizing. Journal of Petroleum Science and Engineering, 138, 57-65. DOI: https:// doi.org/10.1016/j.petrol.2015.12.011

Mayo, S., Josh, M., Nesterets, Y., Esteban, L., Pervukhina, M., Clennell, M.B., Maksimenko, A., Hall, C., 2015. Quantitative micro-porosity characterization using synchrotron micro-CT and xenon K-edge subtraction in sandstones, carbonates, shales and coal. Fuel, 154, 167-173. DOI: https://doi. org/10.1016/j.fuel.2015.03.046

Otsu, N., 1979. A threshold selection method from gray-level histograms. IEEE transactions on systems, man, and cybernetics, 9(1), 62-66. DOI: 10.1109/TSMC.1979.4310076

Panga, M.K., Ziauddin, M., Balakotaiah, V., 2005. Two‐scale continuum model for simulation of wormholes in carbonate acidization. AIChE journal, 51(12), 3231-3248. DOI: https:// doi.org/10.1002/aic.10574

Pini, R., Madonna, C., 2016. Moving across scales: a quantitative assessment of X-ray CT to measure the porosity of rocks. Journal of Porous Materials, 23, 325-338. DOI: https://doi. org/10.1007/s10934-015-0085-8

Rabbani, A., Jamshidi, S., 2014. Specific surface and porosity relationship for sandstones for prediction of permeability. International Journal of Rock Mechanics and Mining Sciences, 71, 25-32. DOI: https://doi.org/10.1016/j. ijrmms.2014.06.013

Rabbani, A., Ayatollahi, S., 2015. Comparing three image processing algorithms to estimate the grain-size distribution of porous rocks from binary 2D images and sensitivity analysis of the grain overlapping degree. Special Topics & Reviews in Porous Media: An International Journal, 6(1), 71-89. DOI: 10.1615/SpecialTopicsRevPorousMedia.v6.i1.60

Rabbani, A., Ayatollahi, S., Kharrat, R., Dashti, N., 2016. Estimation of 3D pore network coordination number of rocks from watershed segmentation of a single 2D image. Advances in Water Resources, 94, 264-277. DOI: https://doi. org/10.1016/j.advwatres.2016.05.020

Rabbani, A., Mostaghimi, P., Armstrong, R.T., 2019. Pore network extraction using geometrical domain decomposition. Advances in Water Resources, 123, 70-83. DOI: https://doi. org/10.1016/j.advwatres.2018.11.003

Ramandi, H.L., Mostaghimi, P., Armstrong, R.T., Saadatfar, M., Pinczewski, W.V., 2016. Porosity and permeability characterization of coal: a micro-computed tomography study. International Journal of Coal Geology, 154, 57-68. DOI: https://doi.org/10.1016/j.coal.2015.10.001

Rutqvist, J., Wu, Y. S., Tsang, C. F., Bodvarsson, G., 2002. A modeling approach for analysis of coupled multiphase fluid flow, heat transfer, and deformation in fractured porous rock. International Journal of Rock Mechanics and Mining Sciences, 39(4), 429- 442. DOI: https://doi.org/10.1016/S1365-1609(02)00022-9

Schneider, C.A., Rasband, W.S., Eliceiri, K.W., 2012. NIH Image to ImageJ: 25 years of image analysis. Nature Methods, 9(7), 671- 675. DOI: https://doi.org/10.1038/nmeth.2089

Smith, M.M., Hao, Y., Carroll, S.A., 2017. Development and calibration of a reactive transport model for carbonate reservoir porosity and permeability changes based on CO2 core-flood experiments. International Journal of Greenhouse Gas Control, 57, 73-88. DOI: https://doi.org/10.1016/j.ijggc.2016.12.004

Spanne, P., Thovert, J. F., Jacquin, C. J., Lindquist, W. B., Jones, K. W., Adler, P. M., 1994. Synchrotron computed microtomography of porous media: topology and transports. Physical review letters, 73(14), 2001. DOI: https://doi.org/10.1103/ PhysRevLett.73.2001

Steefel, C. I., Molins, S., 2016. CrunchFlow. Software for modeling multicomponent reactive flow and transport. User’s manual (2016). Berkeley, Lawrence Berkeley National Laboratory, 91pp.

Steefel, C. I., Appelo, C. A. J., Arora, B., Jacques, D., Kalbacher, T., Kolditz, O., Lagneau, V., Lichtner, P. C., Mayer, K. U., Meeussen, J. C. L., Molins, S., 2015. Reactive transport codes for subsurface environmental simulation. Computational Geosciences, 19, 445-478. DOI: https://doi.org/10.1007/s10596-014-9443-x

Sutera, S. P., Skalak, R., 1993. The history of Poiseuille’s law. Annual review of fluid mechanics, 25(1), 1-20.

Taron, J., Elsworth, D., 2009. Thermal–hydrologic–mechanical– chemical processes in the evolution of engineered geothermal reservoirs. International Journal of Rock Mechanics and Mining Sciences, 46(5), 855-864. DOI: https://doi.org/10.1016/j. ijrmms.2009.01.007

Tsai, W., 1985. Moment-preserving thresholding: a new approach. Computer Vision, Graphics, and Image Processing, 29(3), 377- 393. DOI: https://doi.org/10.1016/0734-189X(85)90133-1

Vafaie, A., Soler, J.m M., Cama, J., Kivi, I. R., Vilarrasa, V., 2022. [CODE] A MATLAB code for digitized reconstruction of the rock porosity distribution from Computed Tomography (CT) images. Digital CSIC Library. Last accessed: 05/2024. Website: http://hdl.handle.net/10261/284837

Vafaie, A., Cama, J., Soler, J. M., Grgic, D., Vilarrasa, V., 2023a. Chemo-hydro-mechanical effects of CO2 injection into a permeable limestone. International Journal of Coal Geology, 278, 104359. DOI: https://doi.org/10.1016/j.coal.2023.104359

Vafaie, A., Cama, J., Soler, J. M., Kivi, I. R., Vilarrasa, V., 2023b. Chemo-hydro-mechanical effects of CO2 injection on reservoir and seal rocks: A review on laboratory experiments. Renewable and Sustainable Energy Reviews, 178, 113270. DOI: https://doi.org/10.1016/j.rser.2023.113270

Vanorio, T., Mavko, G., 2011. Laboratory measurements of the acoustic and transport properties of carbonate rocks and their link with the amount of microcrystalline matrix. Geophysics, 76(4), E105-E115. DOI: https://doi.org/10.1190/1.3580632

Voltolini, M., Ajo-Franklin, J., 2019. The effect of CO2-induced dissolution on flow properties in Indiana limestone: An in situ synchrotron X-ray micro-tomography study. International Journal of Greenhouse Gas Control, 82, 38-47. DOI: https:// doi.org/10.1016/j.ijggc.2018.12.013

Volume Graphics GmbH (2016). A New, More Compatible Software Generation: VGStudio 3.0, VGMetrology 3.0, and myVGL 3.0. e-Journal of Nondestructive Testing. https:// www.ndt.net/?id=20203.

Wan, K., Xu, Q., 2014. Local porosity distribution of cement paste characterized by X-ray micro-tomography. Science China Technological Sciences, 57, 953-961. DOI: https://doi. org/10.1007/s11431-014-5513-5

Wenck, N., Jackson, S.J., Manoorkar, S., Muggeridge, A., Krevor, S., 2021. Simulating core floods in heterogeneous sandstone and carbonate rocks. Water Resources Research, 57(9), e2021WR030581. DOI: https://doi. org/10.1029/2021WR030581

Withjack, E. M., 1988. Computed tomography for rock-property determination and fluid-flow visualization. SPE formation evaluation, 3(04), 696-704. DOI: https://doi. org/10.2118/16951-PA

Wu, Y., Lin, C., Yan, W., Liu, Q., Zhao, P., Ren, L., 2020. Pore-scale simulations of electrical and elastic properties of shale samples based on multicomponent and multiscale digital rocks. Marine and Petroleum Geology, 117, 104369. DOI: https://doi.org/10.1016/j.marpetgeo.2020.104369

Yen, J.C., Chang, F.J., Chang, S., 1995. A new criterion for automatic multilevel thresholding. IEEE Transactions on Image Processing, 4(3), 370-378. DOI: 10.1109/83.366472

Zhang, T., Du, Y., Huang, T., Yang, J., Lu, F., Li, X., 2016. Reconstruction of porous media using ISOMAP-based MPS. Stochastic environmental research and risk assessment, 30, 395-412. DOI: https://doi.org/10.1007/s00477-015-1142-1