This paper was converted on www.awesomepapers.org from LaTeX by an anonymous user.
Want to know more? Visit the Converter page.

\Author

[1]SayanSen \Author[1][[email protected]]Scott K.Hansen

1]Zuckerberg Institute for Water Research, Ben-Gurion University of the Negev, Midreshet Ben-Gurion, Israel

\pubdiscuss\published

PyDDC: An Eulerian-Lagrangian simulator for density driven convection of CO2\mathrm{CO_{2}}–-brine systems in saturated porous media

Abstract

PyDDC is a particle tracking reservoir simulator capable of solving non-linear density driven convection of single phase carbon-dioxide (CO2\mathrm{CO_{2}})–brine fluid mixture in saturated porous media at the continuum scale. In contrast to the sate-of-the-art Eulerian models, PyDDC uses a Lagrangian approach to simulate the Fickian transport of single phase solute mixtures. This introduces additional flexibility of incorporating anisotropic dispersion and benefits from having no numerical artifacts in its implementation. It also includes CO2\mathrm{CO_{2}}–brine phase equilibrium models, developed by other researchers, to study the overall dynamics in the presence of electrolyte brine at different pressure and temperatures above the critical point of CO2\mathrm{CO_{2}}. We demonstrate the implementation procedure in depth, outlining the overall structure of the numerical solver and its different attributes that can be used for solving specific tasks.

\introduction

Simulating fluid flow and transport in saturated porous media has gained considerable attention over the past few decades owing to its different industrial applications, predominantly in the field of geological carbon storage (Riaz and Cinar, 2014; Meng and Jiang, 2014; Chen et al., 2023), subsurface energy transport (Provost and Voss, 2019; Karvounis and Jenny, 2011; Soboleva, 2018) and salt-water intrusion (Seng et al., 2021; Kalakan and Motz, 2018; Smith, 2004). Qualitative analyses of geological storage process is challenging as the overall flow dynamics is highly non-linear and requires sophisticated numerical methods to be invoked that are capable of capturing the complexities associated with most flows in natural aquifers. In the context of CO2\mathrm{CO_{2}}-sequestration, the important quantitative aspects analyzed are the onset of convection, mixing or dissolution rate and regime transitions marked by evolution of high density fingering structures. Practically all numerical solvers developed in this regard are fully Eulerian. Both solute transport software like GEOSX (Settgast et al., 2018), DuMux3 (Koch et al., 2021), PFLOTRAN (Lichtner et al., 2015), MT3D-USGS (Bedekar et al., 2016), Hydrus-2D/3D (Varvaris et al., 2021) and high-performance open-source general purpose multi-physics software like FEniCS (Logg et al., 2012), COMSOL (Liu and Yao, 2023), OpenFOAM (Chu and Laurien, 2016) have been used for solving fluid mechanics problems in porous media with GEOSX being dedicated primarily to CO2\mathrm{CO_{2}} storage projects. Other works include direct numerical simulation (DNS) approaches employing full scale Eulerian solvers and perturbation based Linear Stability Analysis models (Hansen et al., 2023; Soltanian et al., 2016; Tsinober et al., 2022; Michel-Meyer et al., 2020; Kong and Saar, 2013; Hidalgo and Carrera, 2009; Farajzadeh et al., 2010; De Paoli, 2021; Hewitt et al., 2013; Emami-Meybodi et al., 2015; Green and Ennis-King, 2018; Hassanzadeh et al., 2007; Riaz et al., 2006; Emami-Meybodi, 2017) to understand the processes responsible for generating instability and characterize the flow dynamics of CO2\mathrm{CO_{2}}–brine mixtures in porous media at different reservoir heterogeneities. These studies, along with many others, have been pivotal in developing our knowledge about CO2\mathrm{CO_{2}} plume behaviour in the subsurface. Although Eulerian flow solvers have been used extensively, they have inherent problems with handling flows having high advective velocities and sharp fronts. A naive implementation in such case results in strong dispersive effects giving rise to un-physical oscillations in the target field variable. For handling numerical dispersion higher order Eulerian schemes like TVD (Total Variation Diminishing) (Darwish and Moukalled, 2003) and WENO (Weighted Essentially Non-Oscillatory) schemes (Capdeville, 2008) have been developed, but those methods are computationally-demanding when it comes to solving large scale flow and transport problems.

Lagrangian approaches offer greater flexibility when it comes to simulating transport phenomena. Van Sebille et al. (2018) presents a thorough review about the different types of particle based methods that are used for capturing sub-scale diffusion and unresolved physics. These techniques, in general, have particularly proved it worth for modelling heterogeneous flow systems pertaining to both Fickian and non-Fickian physics (Kitanidis, 1994; Fernàndez-Garcia et al., 2005; Delay et al., 2005; Srinivasan et al., 2010; Hansen et al., 2018). Inherently, particle based methods are by nature free of numerical artifacts like spurious dispersion and are more efficient than Eulerian methods for capturing sharp concentration gradients and sub-scale transport behaviour. Particle trackers have seen use for subsurface transport in linear systems where the flow regime does not depend on transport properties. Aurora (Hansen and Berkowitz, 2020) and EcoSLIM (Maxwell et al., 2019) are two examples of particle tracking software that are used in solute transport applications for linear flow problems. In the context of CO2\mathrm{CO_{2}} sequestration, which features density-driven flow and thus bi-directional coupling between flow and transport, there have been no such particle based techniques reported that has been used to simulate CO2\mathrm{CO_{2}} transport behaviour in the subsurface. Problems involving bi-directional coupling requires the flow field and the scalar concentration to be computed at each simulation step giving rise to a combined Euler-Lagrange scheme, in contrast to the straightforward Lagrangian trackers that involve only one-way coupling.

In Euler-Lagrange (EL) method, where there is a feedback between flow and transport solver, a particle to grid projection operation and vice versa is required to establish the two-way coupling. Kernel based methods used for these projection operations allow one to carry out different levels of spatial interpolation by using different types of interpolating kernels (Bagtzoglou et al., 1992). The transport part in EL methods can either be solved using tracer based model, where the advective transport is solved using particle based method while the diffusive or dispersive transport is solved on a discretized grid using the Eulerian approach, or using the stochastic model, where advective and dispersive terms are not decoupled but are included together in a single equation called the stochastic differential equation (SDE) and is solved using the method of random walk particle tracking (RWPT). Neuman and Sorek (1982) also discussed different EL schemes explaining their applicability for advection-dominated and dispersion-dominated scenarios. Maljaars et al. (2021) recently developed a tracer based Euler-Lagrange method to solve general-purpose Rayleigh-Taylor instability problems enforcing mass conservation by using a PDE-constrained optimization procedure. However, their approach is not readily adapted for CO2\mathrm{CO_{2}}–brine systems. For simulating coastal dispersion, Suh (2006) combined both EL and RWPT approaches to reduce the computational complexity arising from the implementation of only the random walk methods. Stochastic model is the preferred choice in our case because of the ease of RWPT scheme to enforce conservation properties and handle steep concentration gradients compared to the tracer based model. The particle tracking based transport solver that we develop is novel in this regard as it integrates a Eulerian flow solver with a Lagrangian based transport module in a computationally efficient manner that can be used to solve density-driven convection and understand instabilities originating from CO2\mathrm{CO_{2}}–brine miscible displacement.

1 Theory

Supercritical CO2\mathrm{CO_{2}} (Sc-CO2\mathrm{CO_{2}}) upon injection into the deep saline aquifer is less dense than the ambient brine and due to the effect of buoyancy it rises and accumulates at a stratigraphically higher level when it encounters a geological barrier. Over time the CO2\mathrm{CO_{2}} diffuses into the underlying brine and gives rise to a CO2\mathrm{CO_{2}}–brine diffusive layer that has a characteristic density larger than the density of the underlying brine. This results in an unstable configuration having a density stratification with a denser medium overlying a less dense one. Subsequently variations in the flow field introduced by the medium heterogeneity gives rise to small scale perturbations in the diffusive layer and as a response to those perturbations the diffusive layer breaks down in the form of dense fingers which propagates downwards at advective rates.

For density-driven convection in porous media, the coupled non-linear flow and transport equations for single-phase miscible fluids are given by:

q=k(x)μ(c)(P+ρ(c)gez)\displaystyle\vec{q}=-\frac{k(x)}{\mu(c)}(\nabla P+\rho(c)g\vec{e}_{z}) (1)
q=0\displaystyle\nabla\cdot{\vec{q}}=0 (2)
ct=qϕc+(Dc)\displaystyle\frac{\partial c}{\partial t}=-\frac{\vec{q}}{\phi}\cdot\nabla c+\nabla\cdot(D\nabla c) (3)

where q\vec{q} is the Darcy flux, k(x)k(x) is the log normally distributed random permeability field, μ(c)\mu(c), ρ(c)\rho(c) is the concentration dependent viscosity and density of the miscible phase respectively, P\nabla P represents the pressure gradient, gg is the acceleration due to gravity, ez\vec{e}_{z} is a unit-vector pointing in the direction of positive y-axis, cc is the CO2\mathrm{CO_{2}} concentration, ϕ\phi is the local porosity and DD is the hydrodynamic dispersion tensor represented as (Bear, 2013):

D=(αT|q|+Dm)δ+(αLαT)qqT|q|\displaystyle D=(\alpha_{T}|q|+D_{m})\delta+(\alpha_{L}-\alpha_{T})\frac{qq^{T}}{|q|} (4)

αL\alpha_{L}, αT\alpha_{T} are the longitudinal and transverse dispersivities respectively, DmD_{m} is the mass diffusion coefficient and δ\delta is the Kronecker Delta represented by an identity matrix.

Here we consider the simplified form of the continuity equation, represented in equation 2, after applying the Boussinesq approximation, which takes into account only the influence of the specific weight of the fluid. Equation 3, commonly known as the advection-dispersion equation (Van Wijngaarden et al., 2016), represents the transport of a passive scalar quantity under the influence of an ambient flow field. The non-linearity is imparted by the dependence of the Darcy flux on the local solute concentration as shown in equation 1.

Our flow and transport solver incorporates all necessary attributes that are essential for modelling the above process. We adopt an operator splitting procedure to linearize the problem and use two distinct methods — an Eulerian approach based on Finite Volume Method (FVM) to solve the flow field and a Lagrangian random walk particle tracking method (RWPT) to solve for the transport of the CO2\mathrm{CO_{2}}–brine solute mixture. The linearization approach works in two steps — solving for the Darcy flux to obtain the pore-water velocity and using this velocity field to advect particles subsequently. Overall, the module structure of PyDDC comprises of three major blocks that efficiently interacts to solve the coupled flow and transport problem and are described below:

  • Flow module - Solves the non-linear Darcy flux in a 2D Cartesian grid using FVM.

  • Phase module - Computes the different thermodynamic properties like CO2\mathrm{CO_{2}} solubility, density, viscosity and diffusion coefficient of the CO2\mathrm{CO_{2}}–brine mixture at a specified temperature and pressure.

  • Transport module - Solves the Lagrangian particle dynamics using RWPT approach and estimates concentration required by the flow module at specific set of points through a mapping between the Lagrangian point masses and Eulerian set of nodes.

Refer to caption
Figure 1: 2D computational domain indicating scalar and vector quadrature points or nodes where discrete values of those variables are computed and stored. Quadrilateral cells are of 3 types, blue — interior cells (domain of interest), orange and red — ghost cells (introduced to enforce boundary conditions, as described in the text). Blue dots represent nodes where all scalar fields along with phase attributes are stored — pressure, kϕk-\phi field, density, concentration, viscosity, diffusion coefficient. Black arrows at facets indicate nodes where all vector quantities are stores, namely the flux and scalar field gradients.

Currently PyDDC only supports orthogonal structured meshes and has the capability to handle unidirectional grid refinement along the vertical axis as demonstrated in Fig. 2. This can be considered to be adequate as the primary objective behind refinement is to capture the transition from diffusive to advective scales, i.e. the onset of convection, with reasonable accuracy. In Fig. 1 we introduce the computational domain used by PyDDC to solve for the pressure field and Darcy flux. Here we adopt a staggered grid arrangement owing to its better conservation properties and its natural ability to directly enforce pressure-velocity coupling (Piller and Stalio, 2004). This approach also allows for the direct enforcement of free slip conditions on the fluxes at the boundaries of the domain. Two different types of ghost cells are indicated for their different usage. The red ghost cells at the top and bottom corresponds to impermeable layers, with the former being also used for applying constant concentration boundary condition. The left and right ghost cells, marked with orange, are used for applying the pressure boundary conditions to get a prescribed background flow.

1.1 Flow Solver

As shown in Fig. 1 the entire domain, Ω\mathrm{\Omega}, is discretized into a finite number of cells, Nx\mathrm{N_{x}} and Ny\mathrm{N_{y}}, in both x and y directions. Considering non-uniformity of the grid, a generic representation of cell centered co-ordinate, xcx_{c}, ycy_{c}, is given as:

xc=xi+1+xi2(i=0,..,Nx)\displaystyle x_{c}=\frac{x_{i+1}+{x_{i}}}{2}(i=\mathrm{0,..,N_{x}}) (5)
yc=yj+1+yj2(j=0,..,Ny)\displaystyle y_{c}=\frac{y_{j+1}+{y_{j}}}{2}(j=\mathrm{0,..,N_{y}})

with xisx_{i}\mathrm{{}^{\prime}s} and yjsy_{j}\mathrm{{}^{\prime}s} representing the cell boundaries and Δxi=xi+1xi\Delta x_{i}=x_{i+1}-{x_{i}} and Δyj=yj+1yj\Delta y_{j}=y_{j+1}-{y_{j}} representing the cell widths.

The GSTools library developed by Müller et al. (2022) is used here to generate spatial random permeability fields with a specified covariance matrix, mean permeability, log-variance and axial correlation lengths. This package is employed into our flow module to obtain the Darcy flux and pressure field for a heterogeneous domain with a given set of user defined meta-parameters. The porosity field is determined from the permeability field via the Kozeny-Carman relation (Pape et al., 2000) k(x)=ϕ(x)3c(1ϕ(x))2S2k(x)=\frac{\phi(x)^{3}}{c(1-\phi(x))^{2}S^{2}}, where ϕ(x)\phi(x) is the porosity field, cc is the Kozeny constant and SS is a parameter depending on the grain size of the media. The realization of the random porosity-permeability (kϕk-\phi) field along with their respective distributions are shown in Fig. 3.

For the FVM implementation, the discretized equations subjected to necessary boundary conditions are formulated as:

ui+1/2,j\displaystyle\vec{u}_{i+1/2,j} =ki+1/2,jμi+1/2,jPi+1/2,jx\displaystyle=-\frac{k_{i+1/2,j}}{\mu_{i+1/2,j}}\frac{\partial P_{i+1/2,j}}{\partial x} inΩ\displaystyle\mathrm{in}\hskip 7.11317pt\Omega (6)
vi,j+1/2\displaystyle\vec{v}_{i,j+1/2} =ki,j+1/2μi,j+1/2(Pi,j+1/2y+ρi,j+1/2gez)\displaystyle=-\frac{k_{i,j+1/2}}{\mu_{i,j+1/2}}(\frac{\partial P_{i,j+1/2}}{\partial y}+\rho_{i,j+1/2}g\vec{e}_{z}) inΩ\displaystyle\mathrm{in}\hskip 7.11317pt\Omega
ux+vy\displaystyle\frac{\partial u}{\partial x}+\frac{\partial v}{\partial y} =0\displaystyle=0 inΩ\displaystyle\mathrm{in}\hskip 7.11317pt\Omega
vi,Hn\displaystyle\vec{v}_{i,\mathrm{H}}\cdot n =0\displaystyle=0 onδΩN\displaystyle\mathrm{on}\hskip 7.11317pt\delta\Omega_{N}
vi,0n\displaystyle\vec{v}_{i,\mathrm{0}}\cdot n =0\displaystyle=0 onδΩN\displaystyle\mathrm{on}\hskip 7.11317pt\delta\Omega_{N}
Pi1/2,j\displaystyle P_{i-1/2,j} =(Ptop+Pil)ρi,jgyc\displaystyle=(\mathrm{P_{top}}+\mathrm{P_{il}})\rho_{i,j}gy_{c} onδΩD\displaystyle\mathrm{on}\hskip 7.11317pt\delta\Omega_{D}
Pi+1/2,j\displaystyle P_{i+1/2,j} =(Ptop+Pir)ρi,jgyc\displaystyle=(\mathrm{P_{top}}+\mathrm{P_{ir}})\rho_{i,j}gy_{c} onδΩD\displaystyle\mathrm{on}\hskip 7.11317pt\delta\Omega_{D}

As the Darcy flux is entirely dictated by the pressure gradient and density term, we first solve for the pressure Poisson equation and use this computed pressure field to solve for the flux. Substituting equation 2 in equation 1 and integrating over the domain, we get:

Ωq𝑑V\displaystyle\int_{\Omega}\nabla\cdot\vec{q}dV =Ω(k(x)μ(c)(P+ρ(c)gez))𝑑V=Sk(x)μ(c)(P+ρ(c)gez)ndS=0\displaystyle=\int_{\Omega}\nabla\cdot(-\frac{k(x)}{\mu(c)}(\nabla P+\rho(c)g\vec{e}_{z}))dV=\int_{S}{-\frac{k(x)}{\mu(c)}(\nabla P+\rho(c)g\vec{e}_{z})}\cdot ndS=0 (7)

where the above transformation from volume integral to surface integral is attained with the help of Green-Gauss theorem. This equation can be discretized as summing over all the facet elements belonging to each cell:

Σfkμ(P+ρgez)|fnfΔS=0\displaystyle\Sigma_{f}-\frac{k}{\mu}(\nabla P+\rho g\vec{e}_{z})|_{f}\cdot n_{f}\Delta S=0 (8)

The boundary conditions on the pressure and the fluxes are represented in equation 6, where the subscript DD refers to Dirichlet boundary and subscript NN denotes Neumann boundary. The computational domain along with the different boundary conditions are highlighted in Fig. 3. Currently we only support imposition of one type of boundary condition, which is considered to be the most natural case for this simulation. Free slip boundary conditions are imposed on the Darcy flux at the top and bottom boundaries, and the pressure is taken to be hydro-static at the left and right boundaries. We consider the most common form of pressure gradient in an aquifer, represented as P=Pt+ρghP=\mathrm{P_{t}}+\rho gh, where ρgh\rho gh corresponds to the hydrostatic term and ptp_{t} being the pressure at the top of the aquifer. The background flow into the domain can be introduced by providing an increment of pressure (Pil\mathrm{P_{il}} or Pir\mathrm{P_{ir}}) at any boundary on ΩD\Omega_{D}.

Refer to caption
Figure 2: Grid refinement supported by PyDDC showing the unrefined regular mesh (top) and refined mesh (bottom).

These two fields can either be specified by the user prior to model execution or can be initialized by the inbuilt random field generator. After obtaining the random kϕk-\phi field and knowing the value of the viscosity and density (obtained either from phase module or from predefined user specified values), the flow equation can be solved to obtain the pressure and Darcy flux.

Refer to caption
Figure 3: Distribution of log normal permeability and porosity fields and their corresponding density plots showing the distribution around mean.
Refer to caption
Figure 4: Domain representation showing different boundary conditions. Yellow line at the top indicates the equilibrium concentration corresponding to the solubility of CO2\mathrm{CO_{2}} at the interface, the length of which corresponds to the lateral extent of source. Vertical red lines at both ends represents the hydrostatic pressure boundary condition. Boundary constraints on the velocity and the concentration are marked at the top and bottom. n+n^{+} and nn^{-} represents the normal components perpendicular to the top and bottom surface pointing outwards. qyn=0q_{y}\cdot n=0 and cn=0\nabla c\cdot n=0 indicates zero fluxes for both the scalar as well as the vector fields across the boundary surface.

To construct the global linear system from equation 7 for both uniform and non-uniform grids, we adopt the 2nd order accurate scheme (Scheme-II of Wang et al. (2011)). We introduce new indexing notation based on the five point stencil, where we denote the center cell ijij by cc and the neighbouring cells as nn, ee, ss, ww corresponding to (i,j+1i,j+1), (i+1,ji+1,j), (i,j1i,j-1), (i1,ji-1,j) cell indices. We define weights, ww’s, used for linear interpolation from cell-centers to cell-interfaces which are given by the volume ratio between the current cell and the neighbouring cells according to:

wn\displaystyle w_{n} =ΔVi,jΔVi,j+1+ΔVi,j\displaystyle=\frac{\Delta V_{i,j}}{\Delta V_{i,j+1}+\Delta V_{i,j}} (9)
ws\displaystyle w_{s} =ΔVi,jΔVi,j1+ΔVi,j\displaystyle=\frac{\Delta V_{i,j}}{\Delta V_{i,j-1}+\Delta V_{i,j}}
we\displaystyle w_{e} =ΔVi,jΔVi+1,j+ΔVi,j\displaystyle=\frac{\Delta V_{i,j}}{\Delta V_{i+1,j}+\Delta V_{i,j}}
ww\displaystyle w_{w} =ΔVi,jΔVi1,j+ΔVi,j\displaystyle=\frac{\Delta V_{i,j}}{\Delta V_{i-1,j}+\Delta V_{i,j}}

Following this and assembling the terms on the left and right hand side, we get the final form of our pressure equation:

(LnPn+LcPc+LsPs)+(LePe+LcPc+LwPw)\displaystyle(L_{n}P_{n}+L_{c}P_{c}+L_{s}P_{s})+(L_{e}P_{e}+L_{c}P_{c}+L_{w}P_{w}) =Rsρs+Rcρc+Rnρn\displaystyle=R_{s}\rho_{s}+R_{c}\rho_{c}+R_{n}\rho_{n} (10)

where,

Rs\displaystyle R_{s} =ki,j1/2wsgΔxi,j\displaystyle=k_{i,j-1/2}w_{s}g\Delta x_{i,j} (11)
Rc\displaystyle R_{c} =(ki,j1/2(1ws)ki,j+1/2(1wn))gΔxi,j\displaystyle=(k_{i,j-1/2}(1-w_{s})-k_{i,j+1/2}(1-w_{n}))g\Delta x_{i,j}
Rn\displaystyle R_{n} =ki,j+1/2wngΔxi,j\displaystyle=-k_{i,j+1/2}w_{n}g\Delta x_{i,j}
Lc\displaystyle L_{c} =LnLs+LeLw\displaystyle=L_{n}-L_{s}+L_{e}-L_{w}
Ln\displaystyle L_{n} =Δxi,jΔyi,j+Δyi,j+1[Δyi,jΔyi,j+1wn(Δyi,jΔyi,j+1Δyi,j+1Δyi,j)]ki,j+1/2\displaystyle=\frac{\Delta x_{i,j}}{\Delta y_{i,j}+\Delta y_{i,j+1}}\biggl{[}\frac{\Delta y_{i,j}}{\Delta y_{i,j+1}}-w_{n}\left(\frac{\Delta y_{i,j}}{\Delta y_{i,j+1}}-\frac{\Delta y_{i,j+1}}{\Delta y_{i,j}}\right)\biggr{]}k_{i,j+1/2}
Ls\displaystyle L_{s} =Δxi,jΔyi,j+Δyi,j1[Δyi,jΔyi,j1ws(Δyi,jΔyi,j1Δyi,j1Δyi,j)]ki,j1/2\displaystyle=\frac{\Delta x_{i,j}}{\Delta y_{i,j}+\Delta y_{i,j-1}}\biggl{[}\frac{\Delta y_{i,j}}{\Delta y_{i,j-1}}-w_{s}\left(\frac{\Delta y_{i,j}}{\Delta y_{i,j-1}}-\frac{\Delta y_{i,j-1}}{\Delta y_{i,j}}\right)\biggr{]}k_{i,j-1/2}
Le\displaystyle L_{e} =Δyi,jΔxi,j+Δxi+1,j[Δxi,jΔxi+1,jwe(Δxi,jΔxi+1,jΔxi+1,jΔxi,j)]ki+1/2,j\displaystyle=\frac{\Delta y_{i,j}}{\Delta x_{i,j}+\Delta x_{i+1,j}}\biggl{[}\frac{\Delta x_{i,j}}{\Delta x_{i+1,j}}-w_{e}\left(\frac{\Delta x_{i,j}}{\Delta x_{i+1,j}}-\frac{\Delta x_{i+1,j}}{\Delta x_{i,j}}\right)\biggr{]}k_{i+1/2,j}
Lw\displaystyle L_{w} =Δyi,jΔxi,j+Δxi1,j[Δxi,jΔxi1,jww(Δxi,jΔxi1,jΔxi1,jΔxi,j)]ki1/2,j\displaystyle=\frac{\Delta y_{i,j}}{\Delta x_{i,j}+\Delta x_{i-1,j}}\biggl{[}\frac{\Delta x_{i,j}}{\Delta x_{i-1,j}}-w_{w}\left(\frac{\Delta x_{i,j}}{\Delta x_{i-1,j}}-\frac{\Delta x_{i-1,j}}{\Delta x_{i,j}}\right)\biggr{]}k_{i-1/2,j}

The PP’s are the unknown pressure terms and ρ\rho is the density of the mixture which is a function of the local concentration.

Refer to caption
Figure 5: Initial condition configured from a predefined global temperature and pressure values.

Assembling equation 9 results in the linear system of equations in the form:

Ax=bA\vec{x}=\vec{b}

where, AA is the coefficient matrix, xx is the vector of unknowns and bb is the vector of known coefficients. For optimization purpose, we take special care of solving the linear system of equations. If the fluid viscosity is constant, the pressure coefficient matrix AA is invariant. So, we perform a LU decomposition on A and precompute its inverse, A1=(LU)1A^{-1}=(LU)^{-1}, only once at the start of the simulation to be used at successive iterations. On the other hand, if the viscosity is concentration dependent, then the pressure coefficient matrix cannot be precomputed. Hence, in this case, we use a sparse linear solver using the previous iteration pressure values as the initial guess for faster convergence. This approach proves to be really effective even if we are dealing with very high medium heterogeneity.

To solve the non-linear Darcy equation (1) requires us to know the density field locally, i.e. cellwise. To estimate any phase attribute at any point in space, we should know the pressure and temperature value associated with that point. For our case we have an isothermal model with a global predefined temperature and pressure which is insufficient to get a density field. So we configure an initial condition for our problem assuming the local pressure everywhere to be same as the pressure at the top and based on this we can get the density field which can then be used to solve for the pressure field which in turn can be used in successive iterations. Figure 5 shows one such generated initial condition from a predefined global pressure of 3030 MPa and temperature of 5050 0C.

1.2 Phase Equilibrium Model

In order to solve the flow and transport equations, it is imperative to estimate the phase attributes of the CO2\mathrm{CO_{2}}–brine mixture, namely the solubility, density, viscosity and CO2\mathrm{CO_{2}} diffusivity at the ambient pressure and temperature. This is done with the help of the thermodynamic models that are developed extensively over the past years in the context of CO2\mathrm{CO_{2}} storage at geological conditions. The associated complexity of estimating all the four above mentioned phase parameters demands a detailed description of each individually.

1.2.1 Solubility Model

We use the model of Sun et al. (2021) for estimating CO2\mathrm{CO_{2}} solubility in brine in a non-iterative manner. Although their model is capable of estimating water content in the CO2\mathrm{CO_{2}} rich phase, for our case we neglect it and only focus on the solubility of CO2\mathrm{CO_{2}} in the aqueous phase. We refer to the procedure as presented in Sun et al. (2021) where first the CO2\mathrm{CO_{2}} solubility in pure water is computed and then the necessary changes for the presence of electrolyte are taken into account in the activity coefficient. This model is hence faster and more computationally efficient compared to other popular thermodynamic models like the Spycher EoS (Hassanzadeh et al., 2008).

1.2.2 Density Model

The density model for ternary CO2\mathrm{CO_{2}}-H2O\mathrm{H_{2}O}-NaCl system, developed by Duan et al. (2008), is given as:

ρ\displaystyle\rho =x1M1+x2M2+x3M3V\displaystyle=\frac{x_{1}M_{1}+x_{2}M_{2}+x_{3}M_{3}}{V} (12)
V\displaystyle V =x1V1+x2Vϕ,2B+x3Vϕ,3B\displaystyle=x_{1}V_{1}+x_{2}V^{B}_{\phi,2}+x_{3}V^{B}_{\phi,3} (13)

where ρ\rho is the solution density, VV is the solution volume, x1x_{1},x2x_{2}, x3x_{3} are the mole fractions of H2O\mathrm{H_{2}O}, NaCl and CO2\mathrm{CO_{2}}, with M1M_{1}, M3M_{3}, M3M_{3} being the corresponding molecular weights. V1V_{1} is the molar volume of H2O\mathrm{H_{2}O}, and Vϕ,2BV^{B}_{\phi,2}, Vϕ,3BV^{B}_{\phi,3} represents the apparent molar volume of electrolyte and CO2\mathrm{CO_{2}} in H2O\mathrm{H_{2}O} respectively. The apparent molar volume of CO2\mathrm{CO_{2}} in H2O\mathrm{H_{2}O} and brine is considered to be equivalent due to the very low solubility of CO2\mathrm{CO_{2}} in brine at geological storage conditions. We use the empirical model of Hu et al. (2007) to compute the molar volume of H2O\mathrm{H_{2}O}. We use the well known Pitzer model (Rogers and Pitzer, 1982) to first compute the apparent molar volume of electrolyte, given by the relation:

Vϕ=Vϕ0+ν|zMzX|Avh(I(m))+2νMνXRT(mBMXV+m2vMzMCMXV)\displaystyle V_{\phi}=V_{\phi}^{0}+\nu|z_{M}z_{X}|A_{v}h(I(m))+2\nu_{M}\nu_{X}RT(mB^{V}_{MX}+m^{2}v_{M}z_{M}C^{V}_{MX}) (14)

where subscripts MM, NN indicates the cation and anion species respectively, νM\nu_{M}, νN\nu_{N} refers to the stoichiometric proportion of the respective ionic species, zMz_{M}, zNz_{N} are their corresponding ionic charges, RR is the molar gas constant, TT is the temperature and h(I(m))h(I(m)) is a parameter depending on the ionic strength, I(m)I(m), at a specified molality (mm) and BMXVB^{V}_{MX} and CMXVC^{V}_{MX} are empirical parameters fitted to the model based on existing volumetric data. VϕV_{\phi} and Vϕ0V_{\phi}^{0} indicates the apparent molar volume and apparent molar volume at infinite dilution respectively. The apparent molar volume at infinite dilution is obtained from the same equation corresponding to the reference molality, mrm_{r}. From the relation between solution volume, V(m)V(m), and apparent molar volume, VϕV_{\phi}, given as:

Vϕ=V(m)1000ρH2OmV_{\phi}=\frac{V(m)-\frac{1000}{\rho_{H_{2}O}}}{m}

at the reference molality, we get the expression for Vϕ0V^{0}_{\phi}:

Vϕ0=V(mr)mr+1000mrρH2O+ν|zMzX|Avh(I(mr))+2νMνXRT(mrBMXV+mr2vMzMCMXV)\displaystyle V_{\phi}^{0}=\frac{V(m_{r})}{m_{r}}+\frac{1000}{m_{r}\rho_{H_{2}O}}+\nu|z_{M}z_{X}|A_{v}h(I(m_{r}))+2\nu_{M}\nu_{X}RT(m_{r}B^{V}_{MX}+m_{r}^{2}v_{M}z_{M}C^{V}_{MX}) (15)

where V(mr)V(m_{r}) is also a fitted empirical parameter and ρH2O\rho_{H_{2}O} is the density of water computed from the IAPWS-97 model of Wagner and Kretzschmar (2008). After computing Vϕ0V^{0}_{\phi}, we substitute it in equation 14 to compute the apparent molar volume of the electrolyte brine binary mixture.

This forms the basis of the density model which we invoke at each iteration to compute the density field of CO2\mathrm{CO_{2}}–brine mixture based on the local variations of concentration and pressure. Previous studies have mainly relied on a linear variation of density with concentration considering the field to be monotonous, given by the simple relation:

ρ(c)=ρw+Δρcc0\displaystyle\rho(c)=\rho_{w}+\Delta\rho\frac{c}{c^{0}} (16)

where Δρ=ρsρw\Delta\rho=\rho_{s}-\rho_{w} is the density difference between the CO2\mathrm{CO_{2}} saturated brine (ρs\rho_{s}) and pure brine (ρw\rho_{w}), cc is the local concentration and c0c^{0} is the saturated concentration at the boundary. As can be seen, instead of computing the local density based on the proposed model, we can also compute the end member densities and use the above linear expression to find the values globally at any point. In fact we decide to keep both options available for the user to decide.

1.2.3 Viscosity Model

Sun et al. (2022) extended the Goldsack-Franchetto model to incorporate CO2\mathrm{CO_{2}} as an additional electrolyte species based on the temperature and individual mole fractions, which is employed here to solve for the viscosity of mixture . For a mixed electrolyte system, comprising here of the two species NaCl and CO2\mathrm{CO_{2}}, the relative viscosity is computed as:

ηr=exp(Σi=1nXiEi)/(1+Σi=1nXiVi)\displaystyle\eta_{r}=\exp(\Sigma_{i=1}^{n}X_{i}E_{i})/(1+\Sigma_{i=1}^{n}X_{i}V_{i}) (17)

where, EiE_{i} and ViV_{i} are temperature dependent empirical parameters given by:

Ei\displaystyle E_{i} =C1T\displaystyle=\vec{C_{1}}\cdot\vec{T}
Vi\displaystyle V_{i} =C2T\displaystyle=\vec{C_{2}}\cdot\vec{T}

where C1C_{1}, C2C_{2} are vector of coefficients derived from model fitting and TT is the vector of polynomials represented as T=[1,T,T2]\vec{T}=[1,T,T^{2}]. XiX_{i} is the mole fraction of species ii.

Xi=mi/(55.51+Σi=1nνimi)\displaystyle X_{i}=m_{i}/(55.51+\Sigma_{i=1}^{n}\nu_{i}m_{i}) (18)

where νi\nu_{i} are the stoichiometric coefficients of the ions and mim_{i} are their respective ionic molalities. For NaCl we consider complete dissociation to its respective ions, Na+Na^{+} and ClCl^{-} leaving with νi\nu_{i} and mim_{i} of 1 each. For CO2\mathrm{CO_{2}}, we consider weak dissociation, CO2H++HCO3CO_{2}\rightarrow H^{+}+HCO_{3}^{-}, corresponding to a weak degree of ionization, giving a νi\nu_{i} and mim_{i} also equal to 1. If the end member values of the viscosities are known the viscosity variation with concentration can be represented by an exponential relation in the form (Chen et al., 2023):

μ=μ0eR(cc0)\displaystyle\mu=\mu_{0}e^{R(c-c_{0})} (19)

where μ\mu is the dynamic viscosity, μ0\mu_{0} is the dynamic viscosity at saturated concentration, cc is the local concentration, c0c_{0} is the concentration of CO2\mathrm{CO_{2}} at the Sc-CO2\mathrm{CO_{2}}–brine interface and R=log(μCO2brμbr)R=\log(\frac{\mu_{CO2-br}}{\mu_{br}}) is the mobility ratio with μCO2br\mu_{CO2-br} and μbr\mu_{br} being the end-member dynamic viscosities. Whether to use this or the Goldsack-Franchetto model lies entirely in the discretion of the user.

1.2.4 Diffusivity Model

From molecular dynamics simulation studies, Omrani et al. (2022) proposed a generalized model for estimating CO2\mathrm{CO_{2}} diffusivity into brine based on temperature and salinity. Their model involves no pressure terms as the effect temperature and salinity are found to be more profound compared to pressure. We use their empirical relation:

D=18.1579e0.0574C+0.0687T0.0004C0.8206T1.4633\displaystyle D=-18.1579e^{-0.0574\hskip 2.27626ptC}+0.0687\hskip 2.27626ptT-0.0004\hskip 2.27626ptC^{0.8206}\hskip 2.27626ptT^{1.4633} (20)

where DD is the diffusion coefficient of CO2\mathrm{CO_{2}} in m2\mathrm{m^{2}}, CC is the concentration of electrolyte represented on the molarity scale (mol/litre\mathrm{mol/litre}) and T is the temperature in K0{}^{0}\mathrm{K}. All the coefficients in equation 18 are rounded to four decimal places.

Each individual model is applicable over a wide range of temperature and pressure covering the whole range of CO2\mathrm{CO_{2}} sequestration regime up to an electrolyte molality of 6 mol/kg. Although we have incorporated the CO2\mathrm{CO_{2}}-H2O\mathrm{H_{2}O}-NaCl thermodynamic model, we keep the option available for the user to not use our phase module. In this case the user needs to feed the values of the phase parameters to the flow solver at each iteration which would then be used to run the simulation.

1.3 Lagrangian Particle Tracker

A particle tracker, as its name implies, is a Lagrangian approach that inherently tracks discrete particles representing some physical quantity. For our case that physical quantity being tracked is the CO2\mathrm{CO_{2}}–brine mixture concentration. The tracks of those individual particles are stochastic in nature and are governed by the generalized stochastic differential equation (GSDE) as given by the integration scheme (Salamon et al., 2006):

Xp(t+Δt)=Xp(t)+1ϕA(Xp,t)Δt+B(Xp,t)ζ(t)Δt\displaystyle X_{p}(t+\Delta t)=X_{p}(t)+\frac{1}{\phi}A(X_{p},t)\Delta t+B(X_{p},t)\cdot\zeta(t)\sqrt{\Delta t} (21)

where dX=Xp(t+Δt)Xp(t)dX=X_{p}(t+\Delta t)-X_{p}(t) represents the displacement of the particle in an interval Δt\Delta t, A(Xp,t)=v(Xp,t)A(X_{p},t)=v(X_{p},t) is the deterministic drift vector, B(Xp,t)B(X_{p},t) is the displacement matrix and ζ(t)𝒩(0,1)\zeta(t)\sim\mathcal{N}(0,1) is a white noise parameter. The only caveat is that equation 21 solves the Fokker-Planck equation and not the advection-dispersion equation (ADE) represented in equation 3. The equivalence between the ADE and Fokker-Planck lies in rearranging the terms in ADE such that we end up with an augmented drift vector A(Xp,t)=(v+ϕD+1ϕDϕ)(Xp,t)A(X_{p},t)=(v+\phi\nabla\cdot D+\frac{1}{\phi}D\cdot\nabla\phi)(X_{p},t) for a heterogeneous case (Henri and Diamantopoulos, 2022). For a homogeneous case we drop the tailing term and end up with the two leading terms vv and D\nabla\cdot D. For an isotropic case in 2D, the displacement matrix, B(Xp,t)B(X_{p},t), is represented as (Salamon et al., 2006):

B(Xp,t)\displaystyle B(X_{p},t) =[ux|u|2αL|u|uy|u|2αL|u|uy|u|2αL|u|ux|u|2αL|u|]\displaystyle=\begin{bmatrix}\frac{u_{x}}{|u|}\sqrt{2\alpha_{L}|u|}&-\frac{u_{y}}{|u|}\sqrt{2\alpha_{L}|u|}\\ \frac{u_{y}}{|u|}\sqrt{2\alpha_{L}|u|}&-\frac{u_{x}}{|u|}\sqrt{2\alpha_{L}|u|}\\ \end{bmatrix} (22)

where αL\alpha_{L} is the longitudinal dispersion coefficient, uxu_{x} and uyu_{y} are the horizontal and vertical velocity components respectively and |u||u| is the Euclidean norm of the vector field uu. This aforementioned scheme is also popularly known as random walk particle tracking (RWPT). Although RWPT methods are easier to implement to track individual particle trajectories, additional care must me taken such that the estimated density respects mass conservation and boundary conditions. As the particles we consider are point masses that are dispersed in the continuum, it does not possess a metric to compute field values like concentration. This makes the concentration estimated from particle locations to be a delta function at the Lagrangian node where the particle resides and is given as:

c(x,t)=ΣpNpmp(t)δ(xXp(t))\displaystyle c(x,t)=\Sigma_{p\in N_{p}}m_{p}(t)\delta(x-X_{p}(t)) (23)

where c(x,t)c(x,t) is the spatially varying concentration field, xx is any point within the domain. But to solve the non-linear problem we need to estimate the concentration values at the nodes where the flow velocity is estimated and therefore an accurate mapping from Lagrangian nodes to Eulerian nodes is required. For this reason, the metric to be estimated, i.e. the mass of the particles, are considered to be distributed symmetrically or asymmetrically around each particle giving rise to a particle support volume. This is facilitated by using a projection function in the form of a kernel that acts as an operator to estimate the concentration at any point in the domain and is represented as (Bagtzoglou et al., 1992):

c~(x,t)=Ωc^(x,t)W(xx)𝑑x=1ϕ(x)ΣpNpmp(t)W(xXp(t))\displaystyle\tilde{c}(x,t)=\int_{\Omega}\hat{c}(x^{\prime},t)W(x-x^{\prime})dx^{\prime}=\frac{1}{\phi(x)}\Sigma_{p\in N_{p}}m_{p}(t)W(x-X_{p}(t)) (24)

where W(xXp(t))W(x-X_{p}(t)) is the kernel having a support volume whose evaluation is a function of the position of the particle, XpX_{p} and the point of estimation, xx, within a predefined interval governed by the kernel bandwidth. This method is also popularly known as kernel smoothing as we find a smoothed continuous distribution of a field from its discrete representation. The kernel contains a bandwidth parameter, hh, responsible for the quality of density estimation and can be either considered to be a globally uniform value or a locally adaptive one (Sole-Mari and Fernàndez-Garcia, 2018). In order to be a valid approximation of the true concentration field and ensure mass conservation, the kernel function should satisfy the condition that ΩW(xXp(t))𝑑x=1\int_{\Omega}W(x-X_{p}(t))dx=1, where Ω\Omega is the domain of interest. For simplicity and computational efficiency we choose the standard simple binning method with the support volume being the dimensions of the grid cells. This makes the estimated concentration, c^=NpϕΔV\hat{c}=\frac{N_{p}}{\phi\Delta V} which is basically the number of particle in each grid cell divided by the available cell volume (Wright et al., 2018).

Refer to caption
Figure 6: Fingering stage for a heterogeneous case at t=53t=53 years for an ionic molality of 0.1mol/kg0.1\mathrm{mol/kg} showing the concentration field, density field, particle configuration and velocity field (from top to bottom).

In addition to this, we also need to model the particle influx from the top boundary where we have a constant CO2\mathrm{CO_{2}} solubility computed at each iteration from the solubility model. It is important to note here that as the kernel is also locally conservative, we can enforce the Dirichlet boundary condition simply by reverse engineering. We divide the reservoir into discrete grid cells that acts as mirror reflections of the interior cells. After the binned concentration is computed at each step, based on the CO2\mathrm{CO_{2}} solubility at the boundary, we can define the reservoir concentration such that the boundary conditions are strictly satisfied. After estimating the concentration values, we create particle clouds inside each reservoir control volume which is basically the grid to particle projection, contrary to the particle to grid projection that we described previously. Now once we have those particle clouds created, we apply the simple Fickian diffusion physics to diffuse particle inside domain with a characteristic diffusion coefficient, DD. The top boundary which the reservoir shares with the computational domain is held symmetric w.r.t diffusion in order to properly impose the diffusive physics, which means that we increase particle count as more particles diffuses from the reservoir to the domain and at the same time delete particles that leave the domain from the top boundary. But this boundary is closed w.r.t dispersion. As we have different boundary conditions for the diffusive and dispersive physics, we decompose the random walk algorithm by first diffusing particles, correcting particle count by applying diffusion boundary conditions and then apply the 2D random walk represented by equation 21 respecting the dispersion boundary conditions.

Figure 6 shows the plume structure as represented by particle cloud and the corresponding density and concentration fields obtained after an elapsed simulation time of around 53 years. Addition to estimating concentration, density, pressure and velocity fields which are stored in binary format, HDF5, to be accessed and used by the user for different post-processing applications, we also store another important attribute, the vorticity field. In 2D, vorticity represents the magnitude of convection which can be used to understand the circulation inside an enclosed domain. For a 2-component vector field q=[u,v]\vec{q}=[u,v], vorticity, ω\omega, is given by the relation:

ω\displaystyle\omega =×q=vxuy\displaystyle=\curl\vec{q}=\frac{\partial v}{\partial x}-\frac{\partial u}{\partial y} (25)

For our case,

×q\displaystyle\curl\vec{q} =×kμ(P+ρgez)=kμρxg\displaystyle=\curl-\frac{k}{\mu}(\nabla P+\rho g\vec{e_{z}})=-\frac{k}{\mu}\frac{\partial\rho}{\partial x}g (26)

From the above expression it can be seen that once the fingers starts propagating, the convection cells starts to develop due to the horizontal density gradients between the fingers and its magnitude increases with increasing density finger propagation. The convective cells are indicated by the velocity plot in Fig. 6 showing the magnitude that advective velocities attain during convection.

2 Using the software

2.1 Parameter specification through JSON file

Refer to caption
Figure 7: Internal structure of the JSON file showing the different input parameters and their corresponding units. The overall content is arranged in a hierarchical manner with different attributes grouped under their corresponding types for better readability. The Python files V.py and TH.py inherits parameters from the JSON file and converts them into Python objects to be accessed everywhere inside the software

The user input to the model is accepted through a JSON file present at the top level of the working directory, that holds the physical attributes required for the simulation. A JSON file represents structured data as key value pairs, with the keys holding the attributes names and the values being their corresponding quantification. Figure 7 gives the detailed insight into the JSON file with the physical parameters along with their units. All the physical parameters are grouped under four categories depending on the parameter type. domain_params groups all the parameters required for defining the computational domain. Grid refinement is achieved by two input parameters — refine_levels, which takes into account the total number of cells from the top where refinement has to be applied and res_levels, which holds the factor by which the initial resolution in the y-direction should be increased for cells affected by refinement. Transition zones due to refinement are handled internally in order to avoid considerable jumps in the cell aspect ratios between the refined and unrefined zones. kfield_params holds the necessary meta-parameters, mean_k, var and corr_length, required to create the heterogeneous random permeability field. This field, kf, is created by invoking the Field class function Field.KField(x, y, mean_k, var, corr_length) where x and y represents the spatial coordinates. For simulations requiring heterogeneous porosity fields, the Field class attribute Field.PHIField(kf) is used. boundary_params contains the dirichlet pressure boundary conditions required for solving the Darcy flux. reservoir_params contains the lateral extent of the Sc-CO2\mathrm{CO_{2}} source, horizontal_extent and molesperparticle, which is a quantity carried by individual particles. The user-defined phase attributes for the model are stored in phase_params, which contains the salinity (NaCl), saturated concentration (CO2SaturatedConcentration), CO2\mathrm{CO_{2}} diffusion coefficient in brine (DiffusionCoefficient) and end-member viscosity (CO2SaturatedBrineViscosity, BrineViscosity) and density (CO2SaturatedBrineDensity, BrineDensity). All user-specified attributes in the JSON file are converted to Python objects and are initialized in the Python file V.py. File TH.py holds the features required for computing phase attributes if the inbuilt phase module is used. These files are declared in the formulate module and can be accessed, modified and used internally whenever required.

2.2 Workflow

Refer to caption
Figure 8: Flowchart showing the flow of control for the entire simulation process including the different module interactions.

The components of the numerical software along with their contents are shown in Fig. 9. Proper execution of the numerical solver requires that the different software components interact efficiently with one another. This is leveraged by the systematic coupling of the different parts of the module as shown in Fig. 8. The Simulate class handles the simulation process and is designed to establish the overall flow of control. To create a Simulate object, the user should pass the arguments — filename, the JSON file which contains the physical parameters used in the simulation, UsePhaseModule, a boolean variable indicating whether to use the inbuilt phase module, datafile, having the name of the binary HDF5 file to store output results and the user supplied permeability and porosity field values, kf and phif, if the inbuilt random field module is not used. Internally it passes the filename to the initialization class as IP.ModelInitialization(filename) creating the attribute repository file V.py which contains domain information along with all other necessary physical parameters. This class also initializes a dictionary, Simulate.attr used for storing the values of concentration, density, viscosity and diffusion coefficient computed at each iteration and making it available to the user for access. If the boolean variable UsePhaseModule corresponds to false, the Simulate class checks for the end-member values of viscosity and density from V.py and based on local concentration, c, declares interpolation functions, Simulate.mu_func(c) and Simulate.rho_func(c), to get local cell-wise values. Conversely, if UsePhaseModule is true, the Simulate.attr dictionary is initialized with attributes computed from the inbuilt phase module. The Simulate class also initializes the random fields either supplied by the user as its arguments, or generated from the inbuilt field class, Field, as described in the previous section. It also links to another class SpeciesInfo which contains information about the solubility of CO2\mathrm{CO_{2}} and mole fraction of different species in the brine. To start the simulation, the user should call the class function ParticleTracker(steps,realizations,intervals,params) in Simulate, where the arguments respectively are number of simulation steps, spatio-temporal evolution of plume dynamics for a single kϕk-\phi field, alternate periods where the user wants to store the data in years and user-specified thermodynamic parameters belonging to Simulate.attr list which is computed form phase equilibrium models other than the one used here. The initial condition is configured by calling the _configure_init_condition() function at the start of every simulation each time the ParticleTracker function is invoked. The initial condition computes the flow field for the Lagrangian particle simulation to work. Solving the flow field is handled by the FlowSolver(field) class which takes in the random permeability field as the only argument and contains the attributes — pressure, vorticity and horizontal and vertical flux components. Simulations pertaining to constant viscosity coefficients and variable viscosity coefficients are handled separately. Functions _AssemblePressureCoefficientMatrix_cv() and _AssembleCoefficientMatrix_rhs(r, PL, PR) are designed to handle cases arising from constant CO2\mathrm{CO_{2}}–brine viscosity. The former assembles the left hand side of the pressure coefficient matrix and the later assembles the right hand side depending on the density, r and surface pressure values at the boundary, PL and PR. The left hand side of the pressure coefficient matrix, for a constant permeability and viscosity field, is invariant and assembled only once and inverted at the start of the simulation. This inversion is carried out by a LU-decomposition technique as discussed earlier. For a variable viscosity case, the pressure coefficient matrix can no longer be precomputed and hence has to be iteratively solved at each step. This is carried out by the function _GlobalCoefficientMatrix_vv(). The solve(r, mu) method is invoked by passing in arguments density, r and viscosity, mu, to solve for the pressure field and Darcy flux. At every step the particle tracker defines a particle reservoir, uses the flow field to advect the particle cloud according to the random walk method described before, computes the local concentration by binning and re-computes the flow field for the successive iterations. The RWPT(c) class is responsible for solving the transport equation, where the argument c represents the concentration field. Advection of the particles requires the knowledge of local dispersion tensor, which is computed inside CellwiseDispersion() function present inside FlowSolver(field) class. To disperse particle cloud as per equation 16, the disperse(Dxx, Dxy, Dyx, Dyy, phi, vx, vy, plst) function is invoked which solves the SDE by taking into account the cell-wise disperson tensor (Dxx, Dxy, Dyx, Dyy), local Darcy flux (vx, vy) and porosity (phi) values interpolated at particle locations (plst).

Refer to caption
Figure 9: PyDDC software structure showing the module arrangements and contents with the arrows indicating the hierarchy levels.

At each iteration or specified intervals, the simulation results are exported in binary format and stored in the memory. As indicated in figure 8, these datasets are divided into two categories – temporally variable, consisting mainly of computed scalar and vector fields like concentration, density, pressure, velocity, vorticity and particle plume configuration that changes at each simulation step and temporally invariable attributes like the domain information consisting of Eulerian nodes and the random kϕk-\phi field that are initialized only once at the start of the simulation.

3 Summary and Conclusion

To our knowledge this is the first particle tracking flow solver solely dedicated for usage in the context of deep carbon sequestration and storage. It incorporates the recent thermodynamics models based on CO2\mathrm{CO_{2}}-H2O\mathrm{H_{2}O}-NaCl\mathrm{NaCl} systems to compute different phase parameters and couples it in a computationally efficient way with a flow and transport solver. The overall module is customizable and can be used my experimentalists and modellers alike for benchmarking and can also be tailored to solve specific problems. It can efficiently perform large scale simulations of subsurface flow and transport of CO2\mathrm{CO_{2}}–brine mixture at reservoir conditions.

\codeavailability

PyDDC numerical software is a part of an open-source project developed solely in Python. The code can be either downloaded from https://github.com/TectoArc/PyDDC.git or from https://doi.org/10.5281/zenodo.11114009 and its dependencies can be directly found in the README.md file. It requires a Python version of at least 3.11.0 and can run on any platform for which its package dependencies are available, including Windows, Linux and macOS.

\authorcontribution

The first author, Sayan Sen, took the lead role in this project by developing the numerical software, collecting resources and writing the original draft. The corresponding author, Dr. Scott K. Hansen is the project administrator who handled conceptualization, supervision, writing review and also assisted with the methodology.

\competinginterests

The authors declare that they have no conflict of interest.

Acknowledgements.
SKH holds the Helen Unger Career Development Chair in Desert Hydrogeology. This project is partially supported by the Israel Science Foundation (ISF), grant number - 1872/19.

References

  • Bagtzoglou et al. (1992) Bagtzoglou, A. C., Tompson, A. F., and Dougherty, D. E.: Projection functions for particle-grid methods, Numerical Methods for Partial Differential Equations, 8, 325–340, 1992.
  • Bear (2013) Bear, J.: Dynamics of fluids in porous media, Courier Corporation, 2013.
  • Bedekar et al. (2016) Bedekar, V., Morway, E. D., Langevin, C. D., and Tonkin, M. J.: MT3D-USGS version 1: A US Geological Survey release of MT3DMS updated with new and expanded transport capabilities for use with MODFLOW, Tech. rep., US Geological Survey, 2016.
  • Capdeville (2008) Capdeville, G.: A central WENO scheme for solving hyperbolic conservation laws on non-uniform meshes, Journal of Computational Physics, 227, 2977–3014, 2008.
  • Chen et al. (2023) Chen, Y., Chen, S., Li, D., and Jiang, X.: Density-Driven Convection for CO2 Solubility Trapping in Saline Aquifers: Modeling and Influencing Factors, Geotechnics, 3, 70–103, 2023.
  • Chu and Laurien (2016) Chu, X. and Laurien, E.: Investigation of convective heat transfer to supercritical carbon dioxide with direct numerical simulation, in: High Performance Computing in Science and Engineering’15: Transactions of the High Performance Computing Center, Stuttgart (HLRS) 2015, pp. 315–331, Springer, 2016.
  • Darwish and Moukalled (2003) Darwish, M. and Moukalled, F.: TVD schemes for unstructured grids, International Journal of Heat and Mass Transfer, 46, 599–611, 2003.
  • De Paoli (2021) De Paoli, M.: Influence of reservoir properties on the dynamics of a migrating current of carbon dioxide, Physics of Fluids, 33, 2021.
  • Delay et al. (2005) Delay, F., Ackerer, P., and Danquigny, C.: Simulating solute transport in porous or fractured formations using random walk particle tracking: A review, Vadose Zone Journal, 4, 360–379, 2005.
  • Duan et al. (2008) Duan, Z., Hu, J., Li, D., and Mao, S.: Densities of the CO2–H2O and CO2–H2O–NaCl systems up to 647 K and 100 MPa, Energy & Fuels, 22, 1666–1674, 2008.
  • Emami-Meybodi (2017) Emami-Meybodi, H.: Stability analysis of dissolution-driven convection in porous media, Physics of Fluids, 29, 2017.
  • Emami-Meybodi et al. (2015) Emami-Meybodi, H., Hassanzadeh, H., Green, C. P., and Ennis-King, J.: Convective dissolution of CO2 in saline aquifers: Progress in modeling and experiments, International Journal of Greenhouse Gas Control, 40, 238–266, 2015.
  • Farajzadeh et al. (2010) Farajzadeh, R., Ranganathan, P., Zitha, P., and Bruining, J.: The effect of heterogeneity on the character of density-driven natural convection of CO2 overlying a brine layer, in: SPE Canada Unconventional Resources Conference?, pp. SPE–138 168, SPE, 2010.
  • Fernàndez-Garcia et al. (2005) Fernàndez-Garcia, D., Illangasekare, T. H., and Rajaram, H.: Differences in the scale-dependence of dispersivity estimated from temporal and spatial moments in chemically and physically heterogeneous porous media, Advances in Water Resources, 28, 745–759, 2005.
  • Green and Ennis-King (2018) Green, C. P. and Ennis-King, J.: Steady flux regime during convective mixing in three-dimensional heterogeneous porous media, Fluids, 3, 58, 2018.
  • Hansen and Berkowitz (2020) Hansen, S. K. and Berkowitz, B.: Aurora: A non-Fickian (and Fickian) particle tracking package for modeling groundwater contaminant transport with MODFLOW, Environmental Modelling & Software, 134, 104 871, 2020.
  • Hansen et al. (2018) Hansen, S. K., Haslauer, C. P., Cirpka, O. A., and Vesselinov, V. V.: Direct breakthrough curve prediction from statistics of heterogeneous conductivity fields, Water Resources Research, 54, 271–285, 2018.
  • Hansen et al. (2023) Hansen, S. K., Tao, Y., and Karra, S.: Impacts of permeability heterogeneity and background flow on supercritical CO2 dissolution in the deep subsurface, Water Resources Research, 59, e2023WR035 394, 2023.
  • Hassanzadeh et al. (2007) Hassanzadeh, H., Pooladi-Darvish, M., and Keith, D. W.: Scaling behavior of convective mixing, with application to geological storage of CO2, American Institute of Chemical Engineers journal, 53, 1121–1131, 2007.
  • Hassanzadeh et al. (2008) Hassanzadeh, H., Pooladi-Darvish, M., Elsharkawy, A. M., Keith, D. W., and Leonenko, Y.: Predicting PVT data for CO2–brine mixtures for black-oil simulation of CO2 geological storage, International Journal of Greenhouse Gas Control, 2, 65–77, 2008.
  • Henri and Diamantopoulos (2022) Henri, C. V. and Diamantopoulos, E.: Unsaturated Transport Modeling: Random-Walk Particle-Tracking as a Numerical-Dispersion Free and Efficient Alternative to Eulerian Methods, Journal of Advances in Modeling Earth Systems, 14, e2021MS002 812, 2022.
  • Hewitt et al. (2013) Hewitt, D. R., Neufeld, J. A., and Lister, J. R.: Convective shutdown in a porous medium at high Rayleigh number, Journal of Fluid Mechanics, 719, 551–586, 2013.
  • Hidalgo and Carrera (2009) Hidalgo, J. J. and Carrera, J.: Effect of dispersion on the onset of convection during CO2 sequestration, Journal of Fluid Mechanics, 640, 441–452, 2009.
  • Hu et al. (2007) Hu, J., Duan, Z., Zhu, C., and Chou, I.-M.: PVTx properties of the CO2–H2O and CO2–H2O–NaCl systems below 647 K: Assessment of experimental data and thermodynamic models, Chemical Geology, 238, 249–267, 2007.
  • Kalakan and Motz (2018) Kalakan, C. and Motz, L. H.: Saltwater Intrusion and Recirculation of Seawater in Isotropic and Anisotropic Coastal Aquifers, Journal of Hydrologic Engineering, 23, 04018 049, 2018.
  • Karvounis and Jenny (2011) Karvounis, D. and Jenny, P.: Modeling of flow and transport in enhanced geothermal systems, in: Thirty-Sixth Workshop on Geothermal Reservoir Engineering, Stanford University, California, 2011.
  • Kitanidis (1994) Kitanidis, P. K.: Particle-tracking equations for the solution of the advection-dispersion equation with variable coefficients, Water Resources Research, 30, 3225–3227, 1994.
  • Koch et al. (2021) Koch, T., Gläser, D., Weishaupt, K., Ackermann, S., Beck, M., Becker, B., Burbulla, S., Class, H., Coltman, E., Emmert, S., et al.: DuMux 3–an open-source simulator for solving flow and transport problems in porous media with a focus on model coupling, Computers & Mathematics with Applications, 81, 423–443, 2021.
  • Kong and Saar (2013) Kong, X.-Z. and Saar, M. O.: Numerical study of the effects of permeability heterogeneity on density-driven convective mixing during CO2 dissolution storage, International Journal of Greenhouse Gas Control, 19, 160–173, 2013.
  • Lichtner et al. (2015) Lichtner, P. C., Hammond, G. E., Lu, C., Karra, S., Bisht, G., Andre, B., Mills, R., and Kumar, J.: PFLOTRAN user manual: A massively parallel reactive flow and transport model for describing surface and subsurface processes, Tech. rep., Los Alamos National Lab.(LANL), Los Alamos, NM (United States); Sandia, 2015.
  • Liu and Yao (2023) Liu, B. and Yao, J.: Numerical study on density-driven convection of CO2-H2S mixture in fractured and sequential saline aquifers, Frontiers in Energy Research, 11, 1241 672, 2023.
  • Logg et al. (2012) Logg, A., Mardal, K.-A., and Wells, G.: Automated solution of differential equations by the finite element method: The FEniCS book, vol. 84, Springer Science & Business Media, 2012.
  • Maljaars et al. (2021) Maljaars, J. M., Richardson, C. N., and Sime, N.: LEoPart: A particle library for FEniCS, Computers & Mathematics with Applications, 81, 289–315, 2021.
  • Maxwell et al. (2019) Maxwell, R. M., Condon, L. E., Danesh-Yazdi, M., and Bearup, L. A.: Exploring source water mixing and transient residence time distributions of outflow and evapotranspiration with an integrated hydrologic model and Lagrangian particle tracking approach, Ecohydrology, 12, e2042, 2019.
  • Meng and Jiang (2014) Meng, Q. and Jiang, X.: Numerical analyses of the solubility trapping of CO2 storage in geological formations, Applied energy, 130, 581–591, 2014.
  • Michel-Meyer et al. (2020) Michel-Meyer, I., Shavit, U., Tsinober, A., and Rosenzweig, R.: The role of water flow and dispersive fluxes in the dissolution of CO2 in deep saline aquifers, Water Resources Research, 56, e2020WR028 184, 2020.
  • Müller et al. (2022) Müller, S., Schüler, L., Zech, A., and Heße, F.: GSTools v1. 3: a toolbox for geostatistical modelling in Python, Geoscientific Model Development, 15, 3161–3182, 2022.
  • Neuman and Sorek (1982) Neuman, S. P. and Sorek, S.: Eulerian-Lagrangian methods for advection-dispersion, in: Finite Elements in Water Resources: Proceedings of the 4th International Conference, Hannover, Germany, June 1982, pp. 849–876, Springer, 1982.
  • Omrani et al. (2022) Omrani, S., Ghasemi, M., Mahmoodpour, S., Shafiei, A., and Rostami, B.: Insights from molecular dynamics on CO2 diffusion coefficient in saline water over a wide range of temperatures, pressures, and salinity: CO2 geological storage implications, Journal of Molecular Liquids, 345, 117 868, 2022.
  • Pape et al. (2000) Pape, H., Clauser, C., and Iffland, J.: Variation of permeability with porosity in sandstone diagenesis interpreted with a fractal pore space model, Fractals and Dynamic Systems in Geoscience, pp. 603–619, 2000.
  • Piller and Stalio (2004) Piller, M. and Stalio, E.: Finite-volume compact schemes on staggered grids, Journal of Computational Physics, 197, 299–340, 2004.
  • Provost and Voss (2019) Provost, A. M. and Voss, C. I.: SUTRA, a model for saturated-unsaturated, variable-density groundwater flow with solute or energy transport—Documentation of generalized boundary conditions, a modified implementation of specified pressures and concentrations or temperatures, and the lake capability, Tech. rep., US Geological Survey, 2019.
  • Riaz and Cinar (2014) Riaz, A. and Cinar, Y.: Carbon dioxide sequestration in saline formations: Part I—Review of the modeling of solubility trapping, Journal of Petroleum Science and Engineering, 124, 367–380, 2014.
  • Riaz et al. (2006) Riaz, A., Hesse, M., Tchelepi, H., and Orr, F.: Onset of convection in a gravitationally unstable diffusive boundary layer in porous media, Journal of Fluid Mechanics, 548, 87–111, 2006.
  • Rogers and Pitzer (1982) Rogers, P. and Pitzer, K. S.: Volumetric properties of aqueous sodium chloride solutions, Journal of Physical and Chemical Reference Data, 11, 15–81, 1982.
  • Salamon et al. (2006) Salamon, P., Fernàndez-Garcia, D., and Gómez-Hernández, J. J.: A review and numerical assessment of the random walk particle tracking method, Journal of Contaminant Hydrology, 87, 277–305, 2006.
  • Seng et al. (2021) Seng, T., Takeuchi, J., and Fujihara, M.: Impacts of density-driven fluctuations on groundwater caused by saltwater intrusion, GEOMATE Journal, 20, 22–27, 2021.
  • Settgast et al. (2018) Settgast, R. R., White, J. A., Corbett, B. C., Vargas, A., Sherman, C., Fu, P., and Annavarapu, C.: GEOSX Simulation Framework, Version 00, 2018.
  • Smith (2004) Smith, A. J.: Mixed convection and density-dependent seawater circulation in coastal aquifers, Water Resources Research, 40, 2004.
  • Soboleva (2018) Soboleva, E.: Density-driven convection in an inhomogeneous geothermal reservoir, International Journal of Heat and Mass Transfer, 127, 784–798, 2018.
  • Sole-Mari and Fernàndez-Garcia (2018) Sole-Mari, G. and Fernàndez-Garcia, D.: Lagrangian modeling of reactive transport in heterogeneous porous media with an automatic locally adaptive particle support volume, Water Resources Research, 54, 8309–8331, 2018.
  • Soltanian et al. (2016) Soltanian, M. R., Amooie, M. A., Dai, Z., Cole, D., and Moortgat, J.: Critical dynamics of gravito-convective mixing in geological carbon sequestration, Scientific reports, 6, 35 921, 2016.
  • Srinivasan et al. (2010) Srinivasan, G., Tartakovsky, D. M., Dentz, M., Viswanathan, H., Berkowitz, B., and Robinson, B. A.: Random walk particle tracking simulations of non-Fickian transport in heterogeneous media, Journal of Computational Physics, 229, 4304–4314, 2010.
  • Suh (2006) Suh, S.-W.: A hybrid approach to particle tracking and Eulerian–Lagrangian models in the simulation of coastal dispersion, Environmental Modelling & Software, 21, 234–242, 2006.
  • Sun et al. (2022) Sun, R., Niu, Z., and Lai, S.: Modeling dynamic viscosities of multi-component aqueous electrolyte solutions containing Li+, Na+, K+, Mg2+, Ca2+, Cl-, SO42- and dissolved CO2 under conditions of CO2 sequestration, Applied Geochemistry, 142, 105 347, 2022.
  • Sun et al. (2021) Sun, X., Wang, Z., Li, H., He, H., and Sun, B.: A simple model for the prediction of mutual solubility in CO2-brine system at geological conditions, Desalination, 504, 114 972, 2021.
  • Tsinober et al. (2022) Tsinober, A., Rosenzweig, R., Class, H., Helmig, R., and Shavit, U.: The role of mixed convection and hydrodynamic dispersion during CO2 dissolution in saline aquifers: A numerical study, Water Resources Research, 58, e2021WR030 494, 2022.
  • Van Sebille et al. (2018) Van Sebille, E., Griffies, S. M., Abernathey, R., Adams, T. P., Berloff, P., Biastoch, A., Blanke, B., Chassignet, E. P., Cheng, Y., Cotter, C. J., et al.: Lagrangian ocean analysis: Fundamentals and practices, Ocean Modelling, 121, 49–75, 2018.
  • Van Wijngaarden et al. (2016) Van Wijngaarden, W., Van Paassen, L., Vermolen, F., Van Meurs, G., and Vuik, C.: Simulation of front instabilities in density-driven flow, using a reactive transport model for biogrout combined with a randomly distributed permeability field, Transport in Porous Media, 112, 333–359, 2016.
  • Varvaris et al. (2021) Varvaris, I., Pittaki-Chrysodonta, Z., Duus Børgesen, C., and Iversen, B. V.: Parameterization of two-dimensional approaches in HYDRUS-2D: Part 1. Simulating water flow dynamics at the field scale, Soil Science Society of America Journal, 85, 1578–1599, 2021.
  • Wagner and Kretzschmar (2008) Wagner, W. and Kretzschmar, H.-J.: IAPWS industrial formulation 1997 for the thermodynamic properties of water and steam, International Steam Tables: Properties of Water and Steam Based on the Industrial Formulation IAPWS-IF97, pp. 7–150, 2008.
  • Wang et al. (2011) Wang, H., Pope, S. B., and Caughey, D. A.: Central-difference schemes on non-uniform grids and their applications in large-eddy simulations of turbulent jets and jet flames, Journal of Computational Physics, 2011.
  • Wright et al. (2018) Wright, E. E., Sund, N. L., Richter, D. H., Porta, G. M., and Bolster, D.: Upscaling mixing in highly heterogeneous porous media via a spatial Markov model, Water, 11, 53, 2018.