Skip to main content

Science – Society – Technology

Extending the persistent primary variable algorithm to simulate non-isothermal two-phase two-component flow with phase change phenomena


In high-enthalpy geothermal reservoirs and many other geo-technical applications, coupled non-isothermal multiphase flow is considered to be the underlying governing process that controls the system behavior. Under the high temperature and high pressure environment, the phase change phenomena such as evaporation and condensation have a great impact on the heat distribution, as well as the pattern of fluid flow. In this work, we have extended the persistent primary variable algorithm proposed by (Marchand et al. Comput Geosci 17(2):431–442) to the non-isothermal conditions. The extended method has been implemented into the OpenGeoSys code, which allows the numerical simulation of multiphase flow processes with phase change phenomena. This new feature has been verified by two benchmark cases. The first one simulates the isothermal migration of H 2 through the bentonite formation in a waste repository. The second one models the non-isothermal multiphase flow of heat-pipe problem. The OpenGeoSys simulation results have been successfully verified by closely fitting results from other codes and also against analytical solution.


In deep geothermal reservoirs, surface water seepages through fractures in the rock and moves downwards. At a certain depth, under the high temperature and pressure condition, water vaporizes from liquid to gas phase. Driven by the density difference, the gas steam then migrates upwards. Along with its path, it will condensate back into the liquid form and release its energy in the form of latent heat. Often, this multiphase flow process with phase transition controls the heat convection in deep geothermal reservoirs. Besides, such multiphase flow and heat transport are considered to be the underlying processes in a wide variety of applications, such as in geological waste repositories, soil vapor extraction of Non-Aqueous Phase Liquid (NAPL) contaminants (Forsyth and Shao 1991), and C O 2 capture and storage (Park et al. 2011; Singh et al. 2012). Throughout the process, different phase zones may exist under different temperature and pressure conditions. At lower temperatures, water flows in the form of liquid. With the rise of temperature, gas and liquid phases may co-exist. At higher temperature, water is then mainly transported in the form of gas/vapor. Since the physical behaviors of these phase zones are different, they are mathematically described by different governing equations. When simulating the geothermal convection with phase change phenomena, this imposes challenges to the numerical models. To numerically model the above phase change behavior, there exist several different algorithms so far. The most popular one is the so-called primary variable switching method proposed by Wu and Forsyth (2001). In Wu’s method, the primary variables are switched according to different phase states. For instance, in the two phase region, liquid phase pressure and saturation are commonly chosen as the primary variables; whereas in the single gas or liquid phase region, the saturation of the missing phase will be substituted by the concentration or mass fraction of one light component. This approach has already been adopted by the multiphase simulation code such as TOUGH (Pruess 2008) and MUFTE (Class et al. 2002). Nevertheless, the governing equations deduced from the varying primary variables are intrinsically non-differentiable and often lead to numerical difficulties. To handle this, Abadpour and Panfilov (2009) proposed the negative saturation method, in which saturation values less than zero and bigger than one are used to store extra information of the phase transition. Salimi et al. (2012) later extended this method to the non-isothermal condition, and also taking into account the diffusion and capillary forces. By their efforts, the primary variable switching has been successfully avoided. Recently, Panfilov and Panfilova (2014) has further extended the negative saturation method to the three-component three-phase scenario. As the negative saturation value does not have a physical meaning, further extension of this approach to general multi-phase multi-component system would be difficult. For deep geothermal reservoirs, it requires the primary variables of the governing equation to be persistent throughout the entire spatial and temporal domain of the model. Following this idea, Neumann et al. (2013) chose the pressure of non-wetting phase and capillary pressure as primary variables. The two variables are continuous over different material layers, which make it possible to deal with heterogeneous material properties. The drawback of Neumann’s approach is that it can only handle the disappearance of the non-wetting phase, not its appearance. As a supplement, Marchand et al. (2013) suggested to use mean pressure and molar fraction of the light component as primary variables. This allows both of the primary variables to be constructed independently of the phase status and allows the appearance and disappearance of any of the two phases. Furthermore, this algorithm could be easy to be extended to multi-phases (≥3) multi-components (≥3) system.

In this work, as the first step of building a multi-component multi-phase reactive transport model for geothermal reservoir simulation, we extend Marchand’s component-based multi-phase flow approach (Marchand et al. 2013) to the non-isothermal condition. The extended governing equations (‘Governing equations’ section), together with the Equation of State (EOS) (‘Constitutive laws’ section), were solved by nested Newton iterations (‘Numerical solution of the global equation system’ section). This extended model has been implemented into the OpenGeoSys software. To verify the numerical code, two benchmark cases were presented here. The first one simulates the migration of H 2 gas produced in a waste repository (‘Benchmark I: isothermal injection of H 2 gas’ section). The second benchmark simulates the classical heat-pipe problem, where a thermal convection process gradually develops itself and eventually reaches equilibrium (‘Benchmark II: heat pipe problem’ section). The numerical results produced by OpenGeoSys were verified against analytical solution and also against results from other numerical codes (Marchand et al. 2012). Furthermore, details of numerical techniques regarding how to solve the non-linear EOS system were discussed (‘Numerical solution of EOS’ section). In the end, general ideas regarding how to include chemical reactions into the current form of governing equations are introduced.


Governing equations

Following Hassanizadeh and Gray (1980), we write instead the mass balance equations of each chemical component by summing up their quantities over every phase. According to Gibbs Phase Rule (Landau and Lifshitz 1980), a simplest multiphase system can be established with two phases and two components. Considering a system with water and hydrogen as constitutive components (with superscript h and w), they distribute in liquid and gas phase, with the subscript αL,G. The component-based mass balance equations can be formulated as

$$ \Phi\frac{\partial (S_{L}{\rho_{L}^{w}} +S_{G}{\rho_{G}^{w}}\,)}{\partial t}+\nabla({\rho_{L}^{w}}v_{L}+{\rho_{G}^{w}}v_{G})+\nabla({j_{L}^{w}}+{j_{G}^{w}})=F^{w} $$
$$ \Phi\frac{\partial (S_{L}{\rho_{L}^{h}}+S_{G}{\rho_{G}^{h}})}{\partial t}+\nabla({\rho_{L}^{h}}v_{L}+{\rho_{G}^{h}}v_{G})+\nabla({j_{L}^{h}}+{j_{G}^{h}})=F^{h}, $$

where S L and S G indicate the saturation in each phase. \(\rho ^{i}_{\alpha }~(i\in \{h,w\}, {\alpha } \in \{L,G\})\) represents the mass density of i-component in α phase. Φ refers to the porosity. F h and F w are the source and sink terms. The Darcy velocity v L and v G for each fluid phase are regulated by the general Darcy Law

$$ v_{L}=-\frac{KK_{rL}}{\mu_{L}}(\nabla P_{L}-\rho_{L}\boldsymbol{g}) $$
$$ v_{G}=-\frac{KK_{rG}}{\mu_{G}}(\nabla P_{G}-\rho_{G}\boldsymbol{g}). $$

Here, K is the intrinsic permeability, and g refers to the vector for gravitational force. The terms \(j_{L}^{w}, j_{L}^{h}, j_{G}^{w}\), and \(j_{G}^{h}\) represent the diffusive mass fluxes of each component in different phases, which are given by Fick’s Law as

$$ j_{\alpha}^{(i)}=-\Phi S_{\alpha}\rho_{\alpha}D_{\alpha}^{(i)}\nabla C_{\alpha}^{(i)}. $$

Here \(D_{\alpha }^{(i)}\) is the diffusion coefficient, and \(C_{\alpha }^{(i)}\) the mass fraction. When the non-isothermal condition is considered, a heat balance equation is added, with the assumption that gas and liquid phases have reached local thermal equilibrium and share the same temperature.

$$\begin{array}{@{}rcl@{}} \frac{\Phi\partial[(1-S_{G})\rho_{L}u_{L}+S_{G}\rho_{G}u_{G}]}{\partial t}+\frac{(1-\Phi)\partial(\rho_{S}c_{S}T)}{\partial t}\\ +\nabla[\!\rho_{G}h_{G}v_{G}]+\nabla[\!\rho_{L}h_{L}v_{L}]-\nabla(\lambda_{T}\nabla T)\\ =Q_{T}+\Delta h_{vap}\left(\Phi \frac{\partial ({\rho_{L}} S_{L})}{\partial t}-\nabla (\rho_{L}v_{L})\right) \end{array} $$

In the above equation, the phase density ρ G , ρ L , the specific internal energy in different phase u L , u G and specific enthalpy in different phase h L and h G are all temperature and pressure dependent. While ρ S and c S are the density and specific heat capacity of the soil grain, λ T refers to the heat conductivity, and Q T is source term, \(\Delta h_{\textit {vap}}(\Phi \frac {\partial ({\rho _{L}}S_{L})}{\partial t}-\nabla (\rho _{L}v_{L}))\) represents the latent heat term according to (Gawin et al. 1995). Generally, the specific enthalpy in Eq. 6 can be described as follows

$$ h_{\alpha}=c_{\textit{p}\alpha}\textit{T}. $$

Here c p α is the specific heat capacity of phase α at given pressure. At the same time, relationship between internal energy and enthalpy can be described as

$$ h_{\alpha}=u_{\alpha}+ P_{\alpha}V_{\alpha}, $$

where P α and V α are the pressures and volumes of phase α. Since we consider the liquid phase is incompressible, its volume change can be ignored, i.e. h=u.

Non-isothermal persistent primary variable approach

Here in this work, we follow the idea of Marchand et al. (2013), where the ‘Persistent Primary Variable’ concept were adopted. A new choice of primary variables consists of:

  • P [Pa] is the weighted mean pressure of gas and liquid phase, with each phase volume as the weighting factor. It depends mainly on the liquid saturation S.

    $$ P=\gamma(S)P_{G}+(1-\gamma(S))P_{L} $$

    Here γ(S) stands for a monotonic function of saturation S, with γ(S)[0,1],γ(0)=0,γ(1)=1. In Benchmark I (‘Benchmark I: isothermal injection of H 2 gas’ section), we choose

    $$\gamma(S)=0 $$

    In Benchmark II (‘Benchmark II: heat pipe problem’ section), we choose

    $$\gamma(S)=S^{2} $$

    When one phase disappears, its volume converges to zero, making the P value equal to the pressure of the remaining phase. If we assume the local capillary equilibrium, the gas and liquid phase pressure can both be derived based on the capillary pressure P c , that is also a function of saturation S.

    $$ P_{L}=P-\gamma(S) P_{c}(S) $$
    $$ P_{G}=P+(1-\gamma(S)) P_{c}(S) $$
  • X [-] refers to the total molar fraction of the light component in both fluid phases. Similar to the mean pressure P, it is also a continuous function throughout the phase transition zones. We formulate it as

    $$ X=\frac{{SN}_{G}{X_{G}^{h}}+(1-S)N_{L}{X_{L}^{h}}}{{SN}_{G}+(1-S)N_{L}} $$

    In a hydrogen-water system, \({X_{L}^{h}}\) and \({X_{G}^{h}}\) refer to the molar fraction of the hydrogen in the two phases, and N L and N G are the respective molar densities [mol m −3].

    Based on the choice of new primary variables, the mass conservation Eqs. 1 and 2 can be transformed to the molar mass conservation. The governing equations of the two-phase two-component system are then written as

    $$\begin{array}{@{}rcl@{}} &&\frac{\Phi \partial ((SN_{G}+(1-S)N_{L})X^{\,(i)})}{\partial t}\\ \qquad\quad&&+\nabla\left(N_{L}X_{L}^{(i)}v_{L}+N_{G}X_{G}^{(i)}v_{G}\right)+\nabla\left(N_{L}S_{L}W_{L}^{(i)}+N_{G}S_{G}W_{G}^{(i)}\right)=F^{(i)} \end{array} $$

    with i(h,w) and the flow velocity v regulated by the generalized Darcy’s law, referred to Eqs. 3 and 4.

    The molar diffusive flux can be calculated following Fick’s law

    $$ W_{\alpha}^{i}=-D_{\alpha}^{(i)}\Phi\nabla X_{\alpha}^{(i)}. $$
  • T [K] refers to the Temperature. If we consider the temperature T as the third primary variable, the energy balance equation can then be included.

    $$\begin{array}{@{}rcl@{}} \frac{\Phi\partial\left[\left(1-S_{G}\right)N_{L}\left(\sum X_{L}^{(i)}M^{(i)}\right)u_{L}+S_{G}N_{G}\left(\sum X_{G}^{(i)}M^{(i)}\right)u_{G}\right]}{\partial t}\\ +\frac{(1-\Phi)\partial(\rho_{S}c_{S}T)}{\partial t} -\nabla\left[N_{G}\left(\sum X_{G}^{(i)}M^{(i)}\right)h_{G}v_{G}\right]\\ -\nabla\left[N_{L}\left(\sum X_{L}^{(i)}M^{(i)}\right)h_{L}v_{L}\right] -\nabla\left(\lambda_{T}\nabla T\right)=Q_{T} \end{array} $$

The non-isothermal system can thus be simulated by the solution of combined Eqs. 13 and 15, with P, X, and T as primary variables. Once these three primary variables are determined, the other physical quantities are then constrained by them and can be obtained by the solution of EOS system. These secondary variables were listed in Table 1. Compared to the primary variable switching (Wu and Forsyth 2001) and the negative saturation (Abadpour and Panfilov 2009) approach, the choice of P and X as primary variables fully covers all three possible phase states, i.e., the single-phase gas, two-phase, and single-phase liquid regions. It also allows the appearance or disappearance of any of the two phases. Instead of switching the primary variable, the non-linearity of phase change behavior was removed from the global partial differential equations and was embedded into the solution of EOS.

Table 1 List of secondary variables and their dependency on the primary variables

Closure relationships

Mathematically, the solution for any linear system of equations is unique if and only if the rank of the equation system equals the number of unknowns. In this work, the combined mass conservation of Eqs. 1, 2, and the energy balance Eq. 6 must be determined by three primary variables. Other variables are dependent on them and considered to be secondary. Such nonlinear dependencies form the necessary closure relationships.

Constitutive laws

Dalton’s Law regulates that the total pressure of a gas phase is equal to the sum of partial pressures of its constitutive non-reacting chemical component. In our case, a gas phase with two components, i.e., water and hydrogen is considered. Then the gas phase pressure P G writes as

$$ P_{G}={P_{G}^{h}}+{P_{G}^{w}}. $$

Ideal Gas Law In our model, the ideal gas law is assumed, where the response of gas phase pressure and volume to temperature is regulated as

$$ P_{G}=\frac{nRT}{V}, $$

where R is the Universal Gas Constant (8.314 J mol −1 K −1), V is the volume of the gas and n stands for the mole number gas. Reorganizing the above equation gives the molar density of gas phase N G

$$ N_{G}=\frac{n}{V}=\frac{P_{G}}{RT}. $$

Combining Dalton’s Law of Eq. 16, we have

$$ {N_{G}^{h}}=\frac{{P_{G}^{h}}}{RT}, {N_{G}^{w}}=\frac{{P_{G}^{w}}}{RT}. $$

Furthermore, the molar fraction of component i can be obtained by normalizing its partial pressure with the total gas phase pressure,

$$ {X_{G}^{i}}=\frac{{P_{G}^{i}}}{P_{G}}. $$

Incompressible Fluid Unlike the gas phase, the liquid phase in our model is considered to be incompressible, i.e., the density of the fluid is linearly dependent on the molar amount of the constitutive chemical component. By assuming standard water molar density \(N_{L}^{std}=\frac {\rho _{w}^{std}}{M^{w}}\), with \(\rho _{w}^{std}\) refers to the standard water mass density (1000 kg m −3 in our model), the in-compressibility of the liquid phase writes as

$$ N_{L}=\frac{N_{L}^{std}}{1-{X_{L}^{h}}}. $$

Henry’ Law We assume that the distribution of light component (hydrogen in our case) can be regulated by the Henry’s coefficient \({H_{W}^{h}}(T)\), which is a temperature-dependent parameter.

$$ {P_{G}^{h}}{H_{W}^{h}}(T)=N_{L}{X_{L}^{h}} $$

Raoult’s Law For the heavy component (water), we apply Raoult’s Law that the partial pressure of the water component in the gas phase changes linearly with its molar fraction in the liquid.

$$ {P_{G}^{w}}={X_{L}^{w}}P_{Gvapor}^{w}(T) $$

Here \({X_{L}^{w}}\) is the molar fraction of the water component in the liquid phase. \(P_{\textit {Gvapor}}^{w}(T)\) is the vapor pressure of pure water, and it is a temperature-dependent function in non-isothermal scenarios.

EOS for isothermal systems Based on the constitutive laws discussed in the ‘Constitutive laws’ section, we have:

$$ \frac{{X_{L}^{\,h}}N_{L}^{\,std}}{{X_{L}^{w}}{H_{W}^{h}}(T)} + {X_{L}^{w}}P_{Gvapor}^{w}(T) = P_{G} $$
$$ P_{G} {X_{G}^{h}}=\frac{N_{L}^{\,std}}{{H_{W}^{h}}(T\,)}\frac{{X_{L}^{\,h}}}{{X_{L}^{w}}} $$

According to Eqs. 24 and 25, \({X_{L}^{h}}\) and \({X_{G}^{h}}\) can be calculated explicitly, under the condition:

$$ G(T)=\frac{{H_{W}^{h}}(T\,)P_{Gvapor}^{w}(T\,)}{N_{L}^{\,std}}<\frac{1}{4} $$

which is obviously satisfied in water-air and water-hydrogen system, i.e., under the condition that the temperature T is 25 °C, with \({H_{W}^{\,h}}(T)=7.8 \times 10^{-6} \mathrm {[mol~m^{-3}~Pa^{-1}]}\), \(P_{\textit {Gvapor}}^{w}(T)=3173.07 [\text {Pa}]\), then we could have \(G(T)=4.54 \times 10^{-7} \ll \frac {1}{4}\). Here, if we only consider isothermal condition, the temperature is assumed to be fixed with T 0. In summary, \({X_{L}^{h}}\) and \({X_{G}^{h}}\) could be expressed as:

$$\begin{array}{@{}rcl@{}} {X_{L}^{h}}=X_{m}(P_{L},S,T_{0})=\frac{N_{L}^{std} + (P_{L}+P_{c}){H_{W}^{h}}(T_{0}) }{2{H_{W}^{h}}(T_{0})P_{Gvapor}^{w}(T_{0})}\\ +\frac{\left(\sqrt{(N_{L}^{std}+(P_{L}+P_{c}){H_{W}^{h}}(T_{0}))^{2} - 4 (P_{L}+P_{c}){H_{W}^{h}}(T_{0})N_{L}^{std}P_{Gvapor}^{w}(T_{0}) }\right)}{2{H_{W}^{h}}(T_{0})P_{Gvapor}^{w}(T_{0})} \end{array} $$
$$ {X_{G}^{h}}=X_{M}(P_{G},S,T_{0})=\frac{{X_{L}^{h}}N_{L}^{std}}{{H_{W}^{h}}(T_{0})P_{G}(1- {X_{L}^{h}})} $$

Where S is the saturation of light component, and P c represents the capillary pressure. The above equations are the most general way of calculating the distribution of molar fraction. In Benchmark I (‘Benchmark I: isothermal injection of H 2 gas’ section), we follow Marchand’s idea (Marchand and Knabner 2014), by assuming there is no water vaporization and the gas phase contains only hydrogen, which indicate \(P_{G} \equiv {P_{G}^{h}} \) and \({X_{G}^{h}} \equiv 1\). Therefore Eqs. 27 and 28 could be reformulated as:

$$ {X_{L}^{h}}=X_{m}(P_{L},S,T_{0})=\frac{(P_{L}+{P_{c}}){H_{W}^{h}}(T_{0})}{(P_{L}+{P_{c}}){H_{W}^{h}}(T_{0})+N_{L}^{std}} $$
$$ {X_{G}^{h}} \equiv 1 $$

Here, for simplification purpose, if we combined with Eqs. 10 and 11, \({X_{L}^{h}}\) and \({X_{G}^{h}}\) could be expressed as functions of mean pressure P and gas phase saturation S, and the above formulation can be transformed to

$$ {X_{L}^{h}}=X_{m}(P_{L}(P,S(P,X\,)),S(P,X),T_{0}\;\!\!)=X_{m}(P,S,T_{0}) $$
$$ {X_{G}^{h}}=X_{M}(P_{G}(P,S(P,X\,)),S(P,X\,),T_{0})=X_{M}(P,S,T_{0}). $$

Assuming the local thermal equilibrium of the multi-phase system is reached, then the Equations of State (EOS) are formulated accordingly based on the three different phase states.

  • In two phase region

    Molar fraction of hydrogen (\({X_{L}^{h}}\) and \({X_{G}^{h}}\)) and molar density in each phase (N G and N L ) are all secondary variables that are dependent on the change of pressure and saturation. They can be determined by solving the following non-linear system.

    $$ {X_{L}^{h}}=X_{m}(P,S,T_{0}) $$
    $$ {X_{G}^{h}}=X_{M}(P,S,T_{0}) $$
    $$ N_{G}=\frac{P_{G}(P,S\,)}{RT_{0}} $$
    $$ N_{L}=\frac{N_{L}^{std}}{1-{X_{L}^{h}}} $$
    $$ \frac{SN_{G}(X-{X_{G}^{h}})+(1-S\,)N_{L}(X-{X_{L}^{h}})}{SN_{G}+(1-S\,)N_{L}} = 0 $$
  • In the single liquid phase region

    In a single liquid phase scenario, the gas phase does not exist, i.e., the gas phase saturation S always equals to zero. Meanwhile, the molar fraction of light component in the gas phase \({X_{G}^{h}}\) can be any value, as it will be multiplied with the zero saturation (see Eqs. 13 to 14) and vanish in the governing equation. This also applies to the gas phase molar density N G , whereas the two parameters can be arbitrarily given, and have no physical impact. So to determine the EOS, we only need to solve for the liquid phase molar fraction and density.

    $$ {X_{L}^{h}}=X $$
    $$ N_{L}=\frac{N_{L}^{std}}{1-X} $$
  • In the single gas phase region

    Similarly, in a single gas phase scenario, the liquid phase does not exist, i.e., the gas phase saturation S always equals to 1, whereas the liquid phase saturation remains zero. Meanwhile, the molar fraction of light component in the liquid phase \({X_{L}^{h}}\) can be any value, as it will be multiplied with the zero liquid phase saturation (see Eqs. 13 to 14) and vanish in the governing equation. This also applies to the liquid phase molar density N G , whereas the two parameters can be arbitrarily given, and have no physical meaning. So to determine the EOS, we only need to solve for the gas phase molar fraction and density.

    $${X_{G}^{h}}=X $$
    $$N_{G}=\frac{P}{RT_{0}} $$

EOS for non-isothermal systems

As the energy balance of Eq. 6 has to be taken into account under the non-isothermal condition, all the secondary variables not only are dependent on the pressure P but also rely on the temperature T. Except for the parameters mentioned above, several other physical properties are also regulated by the T/P dependency. Furthermore, in a non-isothermal transport, high non-linearity of the model exists in the complex variational relationships between secondary variables and primary variables. Therefore, how to set up an EOS system for each fluid is a big challenge for the non-isothermal multi-phase modeling. In the literature, (Class et al. 2002; Olivella and Gens 2000; Peng and Robinson 1976; Singh et al. 2013a, and Singh et al. 2013b) have given detailed procedures of solving EOS to predicting the gas and liquid thermodynamic and their transport properties. Here in our model, we follow the idea by Kolditz and De Jonge (2004). Detailed procedure regarding how to calculate the EOS system is discussed in the following.

Vapor pressure As we discussed in the ‘Constitutive laws’ section, vapor pressure is a key parameter for determining the molar fractions of different components in each phase. The equilibrium restriction on vapor pressure of pure water is given by Clausius-Clapeyron equation (Çengel and Boles 1994).

$$ P_{Gvapor}^{w}(T\,)=P_{0} \exp\left[\left(\frac{1}{T_{0}}-\frac{1}{T}\right)\frac{{h_{G}^{w}}M^{\,w}}{R}\right] $$

where \({h_{G}^{w}}\) is enthalpy of vaporization, M w is molar mass of water. P 0 represents the vapor pressure of pure water at the specific Temperature T 0. In our model, we choose T 0=373K,P 0=101,325Pa. An alternative method is using the Antoine equation, written as

$$ log_{10}(P_{Gvapor}^{w}(T\,))=A-\frac{B}{C+T} $$

with A, B, and C as the empirical parameters. Details regarding this formulation can be found in Class et al. (2002).

Specific enthalpy Specific enthalpy h α [ J mol −1] is the enthalpy per unit mass. According to Eq. 6, we need to know the specific enthalpy of a certain phase. In particular, since component-based mass balance is considered, we calculate the phase enthalpy as the sum of mole (mass) specific enthalpy of each component in this phase. Here we assume that the energy of mixing is ignored. For instance, the water-air system applied in the second benchmark is formulated as

$$ h_{G}= h_{G}^{air}X_{G}^{air}+ h_{G}^{w_{vap}}X_{G}^{w_{vap}} $$
$$ h_{L}= h_{L}^{air}X_{L}^{air}+ h_{L}^{w_{liq}}X_{L}^{w_{liq}} $$

Here \(h_{G}^{air}\) is the specific enthalpy of air in gas phase, \({h_{G}^{w_{\textit {vap}}}}\) is specific enthalpy of vapor water in gas phase, \(h_{L}^{air}\) represents the specific enthalpy of the air dissolved in the liquid phase, while \(h_{L}^{w_{\textit {liq}}}\) donates the specific enthalpy of the liquid water in liquid phase. While \(X_{G}^{air}\), \(X_{G}^{w_{\textit {vap}}}\), \(X_{L}^{air}\) and \(X_{L}^{w_{\textit {liq}}}\) represent molar fraction [-] of each component (air and water) in the corresponding phase (gas and liquid).

Henry coefficient We assume Henry’s Law is valid under the non-isothermal condition. Therefore Henry coefficient is a secondary variable. In the water-air system, it can be defined as (Kolditz and De Jonge 2004)

$$ {H_{W}^{h}}(T)=(0.8942+1.47\exp(-0.04394T))\times 10^{-10} $$

with T the temperature value in °C.

Heat conductivity Since the local thermal equilibrium is assumed, the heat conductivity λ pm [W m −1 K −1] of the fluid-containing porous media is averaged from the heat conductivities of the fluid phases and the solid matrix. Thus, it is a function of saturation only.

$$ \lambda_{pm}=\lambda_{pm}^{S_{L}=S_{G}=0}+\sqrt{S_{L}}(\lambda_{pm}^{S_{L}=1}-\lambda_{pm}^{S_{L}=0})+\sqrt{S_{G}}(\lambda_{pm}^{S_{G}=1}-\lambda_{pm}^{S_{G}=0}) $$

Fugacity When the thermal equilibrium is reached, the chemical potentials of component i in gas and liquid phase equal with each other. This equilibrium relationship can be formulated as the equation of chemical potential ν

$$\nu_{G}^{(i)} (P_{G},X_{L}^{(i)},X_{G}^{(i)},T) =\nu_{L}^{(i)} \left(P_{L},X_{L}^{(i)},X_{G}^{(i)},T\right) $$

In our model, the fugacity was applied instead of chemical potential. The above relationship is then transformed to the equivalence of component fugacities, where

$$f_{G}^{(i)}=f_{L}^{(i)} $$

holds for each component i in each phase. In order to compute the fugacity of a component in a particular phase, the following formulation is used

$$ f_{\alpha}^{(i)}=P_{\alpha}X_{\alpha}^{(i)}\phi_{\alpha}^{(i)} $$

where \(\phi _{\alpha }^{(i)}\) is the respective fugacity coefficient of component.

Numerical scheme

Numerical solution of EOS

Physical constraints of EOS

Since the pore space should be fully occupied by either or both the gas and liquid phases, the sum of phase saturation should equal to one. By definition, the saturation for each phase should be no less than zero and no larger than one. This constraint is summarized as

$$ \sum\limits_{\alpha} S_{\alpha}=1~\land~S_{\alpha}>0~~(\alpha \in{G, L}) $$

Similarly, the sum of the molar fraction for all components in a single phase should also be in unity, and this second constraint can be formulated as

$$ \sum\limits_{i} X_{G}^{(i)}=1~\land~\sum\limits_{i} X_{L}^{(i)}=1~~\text{with}~~X_{G}^{(i)}>0~\land~X_{L}^{(i)}>0~~(i \in{h, w}) $$

Combining these constraints, we have

$$ S=0 \land {X_{L}^{h}} \le X_{m}(P,0,T) $$
$$ 0 \le S \le 1 \land X_{m}(P,S,T)-{X_{L}^{h}}=0,{X_{G}^{h}}-X_{M}(P,S,T)=0 $$
$$ S=1 \land {X_{G}^{h}} \ge X_{M}(P,1,T) $$

For the Eqs. 49 to 51, they contain both equality and inequality relationships, which impose challenges for the numerical solution. In order to solve it numerically, we introduce a minimum function (Kanzow 2004; Kräutle 2011), to transform the inequalities. It is defined as

$$ \varPsi(a,b):=min \{a,b\} $$

Combined with Eqs. 49 to 51, they can be transformed to

$$ \Psi(S,X_{m}(P,S,T)-{X_{L}^{h}})=0 $$
$$ \Psi(1-S,{X_{G}^{h}}-X_{M}(P,S,T))=0 $$
$$ \frac{SN_{G}(X-{X_{G}^{h}})+(1-S)N_{L}(X-{X_{L}^{h}})}{SN_{G}+(1-S)N_{L}} =0 $$

Then Eqs. 53 to 55 formulates the EOS system, which needs to be solved on each mesh node of the model domain.

Numerical scheme of solving EOS

For the EOS, the primary variables P and X are input parameters and act as the external constraint. The saturation S, gas and liquid phase molar fraction of the light component \({X_{G}^{h}}\) and \({X_{L}^{h}}\) are then the unknowns to be solved. Once they have been determined, other secondary variables can be derived from them. When saturation is less than zero or bigger than one, the second argument of the minimization function in Eq. 53 will be chosen. Then it effectively prevents the saturation value from moving into unphysical value. This transformation will result in a local Jacobian matrix that might be singular. Therefore, a pivoting action has to be performed before the Jacobian matrix is decomposed to calculating the Newton step. An alternative approach to handle this singularity is to treat the EOS system as a nonlinear optimization problem with the inequality constraints. Our tests showed that the optimization algorithms such as Trust-Region method are very robust in solving such a local problem, but the calculation time will be considerably longer, compared to the Newton-based iteration method.

Numerical solution of the global equation system

In this work, we solve the global governing equation Eqs. 13 to 15 with all the closure relationships simultaneously satisfied. To handle the non-linearities, a nested Newton scheme was implemented (see the flow chart in Fig. 1). All the derivatives in the EOS system Eqs. 53 to 55 are computed exactly and the local Jacobian matrix is constructed in an analytical way, while the global Jacobian matrix is numerically evaluated based on the finite difference method. For the global equations, the time was discretized with the backward Euler scheme, and the spatial discretization was performed with the Galerkin Finite Element method. In each global Newton iteration, the updated global variables P, X, and T from the previous iteration were passed to the EOS system, and acted as constraints to solve for secondary variables. The solution of Eqs. 53 to 55 was performed one after the other on each mesh node of the model domain.

Fig. 1
figure 1

Scheme of the algorithm for global equation system

For Newton iterations, the following convergence criteria was applied.

$$ \left\Vert Residual(Step(k))\right\Vert_{2} \leq \epsilon $$

where 2 denotes the Euclidean norm. A tolerance value ε=1×10−14 were adopted for the EOS and 1×10−9 for the global Newton iterations.

Handling unphysical values during the global iteration

In the ‘Numerical scheme of solving EOS’ section, we have discussed the procedure of handling physical constraint of the EOS system. However, during the global iterations, if the initial value of X is small enough, it may happen that X≤0 can appear. Since the negative value of X would cause failures of further iteration, it is necessary to force the non-negativity constraint on X. To achieve this, a widely used method is extending the definition of the physical variables such as N G , N L for X<0, as was done in (Marchand et al. 2013), (Marchand and Knabner (2014), and (Abadpour and Panfilov 2009). In our implementation, we chose an alternative and more straightforward method, which is adding a damping factor in each global Newton iteration when updating the unknown vector. The damping factor δ are chosen as follows,

$$ \frac{1}{\delta}=\max \{1, 2*\frac{\Delta P(j)}{P(j)},2*\frac{\Delta X(j)}{X(j)}, 2*\frac{\Delta T(j)}{T(j)}\} $$

where P(j), X(j) and T(j) denote pressure/molar fraction/temperature at node j.

Results and Discussions

In our work, the model verification was carried out in two separate cases, one under isothermal and the other under non-isothermal conditions. In the first case, a simple benchmark case was proposed by GNR MoMaS (Bourgeat et al. 2009). We simulated the same H 2 injection process with the extended OpenGeoSys code (Kolditz et al. 2012), and compared our results against those from other code (Marchand and Knabner 2014). For the non-isothermal case, there exists no analytical solution, which explicitly involves the phase transition phenomenon. Therefore, we compared our simulation result of the classical heat pipe problem to the semi-analytical solution from Udell and Fitch (1985). This semi-analytical solution was developed for the steady state condition without the consideration of phase change phenomena. Despite of this discrepancy, the OpenGeoSys code delivered very close profile as by the analytical approach.

Benchmark I: isothermal injection of H 2 gas

The background of this benchmark is the production of hydrogen gas due to the corrosion of the metallic container in the nuclear waste repository. Numerical model is built to illustrate such gas appearance phenomenon. The model domain is a two-dimensional horizontal column representing the bentonite backfill in the repository tunnel, with hydrogen gas injected on the left boundary. This benchmark was proposed in the GNR MoMaS project by French National Radioactive Waste Management Agency. Several research groups has made contributions to test the benchmark and provided their reference solutions (Ben Gharbia and Jaffré 2014; Bourgeat et al. 2009; Marchand and Knabner 2014; Neumann et al. 2013). Here we adopted the results proposed in Marchand’s paper Marchand and Knabner 2014 for comparison.

Physical scenario

Here a 2D rectangular domain Ω=[0,200]×[−10,10] m (see Fig. 2) was considered with an impervious boundary at Γ imp =[0,200]×[−10,10] m, an inflow boundary at Γ in ={0}×[−10,10] m, and an outflow boundary at Γ out ={200}×[−10,10] m. The domain was initially saturated with water, hydrogen gas was injected on the left-hand-side boundary within a certain time span ([0,5×104century]). After that the hydrogen injection stopped and no flux came into the system. The right-hand-side boundary is kept open throughout the simulation. The initial condition and boundary conditions were summarized as

  • \(X(t=0)=10^{-5} \quad \text {and} \quad P_{L}(t=0)=P_{L}^{out}=10^{6} \, \mathrm {[Pa]}\) on Ω.

    Fig. 2
    figure 2

    Geometry and boundary condition for the H 2 injection benchmark

  • q w·ν=q h·ν=0 on Γ imp .

  • \(q^{w} \cdot \nu = 0,q^{h} \cdot \nu ={Q_{d}^{h}}=0.2785 ~~\mathrm {[mol~century^{-1}m^{-2}]} \) on Γ in .

  • X=0 and \(P_{l}=P_{L}^{out}=10^{6} \, \mathrm {[Pa]}\) on Γ out .

Model parameters and numerical settings

The capillary pressure P c and relative permeability functions are given by the van-Genuchten model (Van Genuchten 1980).

$$P_{c}=P_{r}\left(S_{le}^{-\frac{1}{m}}-1\right)^{\frac{1}{n}} $$
$$K_{r_{L}}=\sqrt{S_{le}}\left(1-\left(1-S_{le}^{\frac{1}{m}}\right)^{m} \right)^{2} $$
$$K_{r_{G}}=\sqrt{1-S_{le}}\left(1-S_{le}^{\frac{1}{m}}\right)^{2m} $$

where \(m=1-\frac {1}{n}\), P r and n are van-Genuchten model parameters and the effective saturation S le is given by

$$ S_{le}=\frac{1-S_{g}-S_{lr}}{1-S_{lr}-S_{gr}} $$

here S lr and S gr indicate the residual saturation in liquid and gas phases, respectively. Values of parameters applied in this model are summarized in Table 2.

Table 2 Fluid and porous medium properties applied in the H2 migration benchmark

We created a 2D triangular mesh here with 963 nodes and 1758 elements. The mesh element size varies between 1m and 5m. A fixed time step size of 1 century is applied. The entire simulated time from 0 to 104 centuries were simulated. The entire execution time is around 3.241×104s.

Results and analysis

The results of this benchmark are depicted in Fig. 3. The evolution of gas phase saturation and the gas/liquid phase pressure at the inflow boundary Γ in over the entire time span are shown. In additional, we compare results from our model against those given in Marchand’s paper (Marchand and Knabner 2014). In Fig. 3, solid lines are our simulation results while the symbols are the results from Marchand et al. It can be seen that a good agreement has been achieved. Furthermore, the evolution profile of the gas phase saturation S g , the liquid phase pressure P L , and the total molar fraction of hydrogen X are plotted at different time (t=150,1×103,5×103,6×103 centuries) in Fig. 4 ac, respectively.

Fig. 3
figure 3

Evolution of pressure and saturation over time

Fig. 4
figure 4

Evolution of (a) gas phase saturation, (b) liquid phase pressure, and (c) total hydrogen molar fraction over the whole domain at different time

By observing the simulated saturation and pressure profile, the complete physical process of H 2 injection can be categorized into five subsequent stages.

1) The dissolution stage: After the injection of hydrogen at the inflow boundary, the gas first dissolved in the water. This was reflected by the increasing concentration of hydrogen in Fig. 4 c. Meanwhile, the phase pressure did not vary much and was kept almost constant (see Fig. 4 b).

2) Capillary stage: Given a constant temperature, the maximal soluble amount of H 2 in the water liquid is a function of pressure. In this MoMaS benchmark case, our simulation showed that this threshold value was about 1×10−3 mol H 2 per mol of water at a pressure of 1×106 [Pa]. Once this pressure was reached, the gas will emerge and formed a continuous phase. As shown in Fig. 4 a, at approximately 150 centuries, the first phase transition happens. Beyond this point, the gas and liquid phase pressure quickly increase, while hydrogen gas is transported towards the right boundary driven by the pressure and concentration gradient. In the meantime, the location of this phase transition point also slowly shifted towards the middle of the domain.

3) Gas migration stage: The hydrogen injection process continued until the 5000th century. Although the gas saturation continues to increase, pressures in both phases begin to decline due to the existence of the liquid phase gradient. Eventually, the whole system will reach steady state with no liquid phase gradient.

4) Recovery stage: After hydrogen injection was stopped at the 5000th century, the water came back from the outflow boundary towards the left, which was driven by the capillary effect to occupy the space left by the disappearing gas phase. During this stage, the gas phase saturation begins to decline, and both phase pressures drop even below the initial pressure. The whole process will not stop until the gas phase completely disappeared.

5) Equilibrium stage: After the complete disappearance of the gas phase, the saturation comes to zero again, and the whole system will reach steady state, with pressure and saturation values same as the ones given in the initial condition.

Benchmark II: heat pipe problem

To verify our model under the non-isothermal condition, we adopted the heat pipe problem proposed by Udell and Fitch (1985). They have provided a semi-analytical solution for a non-isothermal water-gas system in porous media, where heat convection, heat conduction as well as capillary forces were considered. A heater installed on the right-hand-side of the domain generated constant flux of heat, and it was then transferred through the porous media by conduction, as well as the enthalpy transport of the fluids. The semi-analytical solution was developed for the steady state condition, and the liquid phase flowed in the opposite direction to the gas phase. If gravity was neglected, the system can be simplified to a system of six ordinary differential equations (ODE), the solution of which was then be obtained in the form of semi-analytical solution. Detailed derivation procedure is available in (Helmig 1997), and the parameters used in our comparison are listed in Table 3. Interested readers may also refer to the supplementary material regarding how this solution was deducted (see Additional file 1-6).

Table 3 Parameters applied in the heat pipe problem

Physical scenario

As shown in Fig. 5, the heat pipe was represented by a 2D horizontal column (2.25 m in length and 0.2 m in diameter) of porous media, which was partially saturated with a liquid phase saturation value of 0.7 at the beginning. A constant heat flux (Q T =100 [W m −2]) was imposed on the right-hand-side boundary Γ in , representing the continuously operating heating element. At the left-hand-side boundary Γ out , Dirichlet boundary conditions were imposed for Temperature T=70 °C, liquid phase pressure P G =1×105 [Pa], effective liquid phase saturation S le =1, and air molar fraction in the gas phase \({X_{G}^{a}}=0.71\). Detailed initial and boundary condition are summarized as follows.

  • P(t=0)=1×105 [Pa], S L (t=0)=0.7, T(t=0)=70 [°C] on the entire domain.

    Fig. 5
    figure 5

    Geometry of the heat pipe problem

  • q w·ν=q h·ν=0 on Γ imp .

  • q w·ν=q h·ν=0, q T·ν=Q T on Γ in .

  • P=1×105 [Pa], S L =0.7, T=70 [°C] on Γ out .

Model parameters and numerical settings

For the capillary pressure −saturation relationship, van Genuchten model was applied. The parameters used in the van Genuchten model are listed in Table 3. The water −air relative permeability relationships were described by the Fatt and Klikoffv formulations (Fatt and Klikoff Jr 1959).

$$ K_{rG}=(1-S_{le})^{3} $$
$$ K_{rL}=S_{le}^{3} $$

where S le is the effective liquid phase saturation, referred to Eq. 58.

We created a 2D triangular mesh here with 206 nodes and 326 elements. The averaged mesh element size is around 6m. A fixed size time stepping scheme has been adopted, with a constant time step size of 0.01 day. The entire simulated time from 0 to 104 day were simulated.


The results of our simulation were plotted along the central horizontal profile over the model domain at y = 0.1 m, and compared against semi-analytical solution. Temperature and saturation profiles at day 1, 10, 100, 1000 are depicted in Fig. 6 a, b respectively. As the heat flux was imposed on the right-hand-side boundary, the temperature kept rising there. After 1 day, the boundary temperature already exceeded 100 °C, and the water in the soil started to boil. Together with the appearance of steam, water saturation on the right-hand-side began to decrease. After 10 days, the boiling point has almost moved to the middle of the column. Meanwhile, the steam front kept boiling and shifted to the left-hand-side, whereas liquid water was drawn back to the right. After about 1000 days, the system reached a quasi-steady state, where the single phase gas, two phase and single phase liquid regions co-exist and can be distinguished. A pure gas phase region can be observed on the right and liquid phase region dominates the left side.

Fig. 6
figure 6

Evolution of (a) temperature and (b) liquid phase saturation over the whole domain at different time


Analysis of the differences in benchmark II

From Fig. 6 a, b, some differences can still be observed in comparison to the semi-analytical solution. Our hypothesis is this difference originates from the capillary pressure −saturation relationship adopted in our numerical implementation. In the original formulation of Udell and Fitch (1985), the Leverett model was applied to produce the semi-analytical solution. It is assumed that the liquid and gas are immiscible and thus there is no gas component dissolved in the liquid phase, and vice versa. In our work, we cannot precisely follow the same assumption, since the dissolution of chemical component in both phases is a requirement for the calculation of phase equilibrium. When considering phase change, we need to allow the saturation S to drop below the residual saturation, so that the evaporation as well as the condensation process can occur. In the traditional van Genuchten model, infinite value of capillary pressure may occur in the lower residual saturation region. Therefore we have made regularization that allows water saturation to fall below the residual saturation, as demonstrated in Fig. 7. Every time the capillary pressure needs to be evaluated, an if-else judgment is performed.

Fig. 7
figure 7

The regularization of the van Genuchten model

Here \(\bar {P}_{c}(S)\) indicates the modified van Genuchtem model, and \(P^{\prime }_{c}(S_{\textit {lr}})\) represents the slope of Pc-S curve at the point of residual water phase saturation. The above modified van Genuchten model approximates the same behavior as the original Leverett one in majority part of the saturation region (see Fig. 7), yet still allowing the phase change behavior. However, it is not exactly same as the one in the semi-analytical solution. This is considered to be the reason why the quasi steady-state profile by our numerical model (Fig. 6) deviates from the analytical one.

Continuity of the global system and convergence of the iteration

In this work, we have only considered the homogeneous medium, where the primary variables of P and X are always continuous over the entire domain. For some primary variables, their derivatives in the governing Eqs. (13) −(15) are discontinuous at locations where the phase transition happens, i.e., X=X m (P,S=0,T) and X=X M (P,S=1,T). For instance, \(\frac {\partial S}{\partial X}\) and \(\frac {\partial S}{\partial P}\) might produce singularities at S=0 and S=1, and they can cause trouble on the conditioning of the global Jacobian matrix. In our simulation, a damped Newton iterations with line search has been adopted (see the ‘Handling unphysical values during the global iteration’ section). We observed that such derivative terms will result in an increased number of global Newton iterations, and the linear iteration number to solve the Newton step as well. It does not alter the convergence of the Newton scheme, as long as the function is Lipschitz continuous.

We are aware of the fact that this issue may be more difficult to handle for the heterogeneous media, where the primary variable P and X could not be directly applied any more because of the non-continuity over the heterogeneous interface (Park et al. 2011). In that case, choosing the primary variables which are continuous over any interface of the medium is a better option. Based on the analysis by Ern and Mozolevski (2012), if we assume Henry’s law is valid, concentration, or in another word, the molar or mass fraction of the hydrogen in the liquid phase \({\rho _{L}^{h}}\) (\({X_{L}^{h}}\)), gas/liquid phase pressure P G / P L , as well as the capillary pressure are all continuous over the interface. Therefore, they are the potential choices of primary variable which can be applied in the heterogeneous media (see (Angelini et al. 2011); (Neumann et al. 2013), and (Bourgeat et al. 2013)). We are currently investigating these options and will report on the results in subsequent work.


In this work, based on the persistent primary variable algorithm proposed by Marchand et al. (2013), we extended the isothermal multi-phase flow formulation to the non-isothermal condition. The extended governing equation is based on the mass balance of each chemical component and is nonlinearly coupled with the non-isothermal EOS. The numerical scheme has been implemented into the open source code OpenGeoSys. The verification of our model were carried out in two benchmark cases.

  • For the GNR MoMaS (Bourgeat et al. 2009) benchmark (‘Benchmark I: isothermal injection of H 2 gas’ section), the extended model is capable of simulating the migration of H 2 gas including its dissolution in aqueous phase. The simulated results fitted well with those from other codes (Marchand et al. 2013; Marchand and Knabner 2014).

  • For the non-isothermal benchmark, we simulated the heat pipe problem and verified our result against the semi-analytical solution (‘Benchmark II: heat pipe problem’ section). Furthermore, our numerical model extended the original heat pipe problem to include the phase change behavior.

Currently, we are working on the incorporation of equilibrium reactions, such as the mineral dissolution and precipitation, into the EOS system. As our global mass-balance equations are already component based, one governing equation can be written for each basis component. Pressure, temperature, and molar fraction of the chemical components can be chosen as primary variables. Inside the EOS problem, the amount of secondary chemical components can be calculated based on the result of basis, which can further lead to the phase properties as density and viscosity. The full extension of including temperature-dependent reactive transport system will be the topic of a separate work in the near future.


Greek symbols



Tolerance value for Newton iteration.



λ T

Heat Conductivity.


[ W m −1 K −1]

μ α

Viscosity in α phase.


[Pa · s]

\(\nu _{\alpha }^{i}\)

Chemical potential of i-component in α phase.







\(\phi _{\alpha }^{i}\)

fugacity coefficient of i-component in α phase.



\(\rho _{\alpha }^{i}\)

Mass density of i-component in α phase.


[ K g m −3]



Logical " a n d "



Euclidean norm



Minimum function


Roman symbols



Vector for gravitational force.


[ m s −2]

c p α

Specific heat capacity in phase α at given pressure.


[ J K g −1 K −1]

c S

Specific heat capacity of soil grain.


[ J K g −1 K −1]

\(D_{\alpha }^{i}\)

Diffusion coefficient of i-component in phase α.


[ m 2 s −1]

F i

Mass source/sink term for i-component.


[ K g m −3 s −1]

\(f_{\alpha }^{i}\)

Fugacity of i-component in α phase.




Henry coefficient.


[ m o l P a −1 m −3]

h α

Specific enthalpy.


[ J K g −1]

\(j_{\alpha }^{i}\)

Diffusive mass flux of i-component in α phase.


[ m o l m −2 s −1]


Intrinsic Permeability.


[ m 2]

N α

Molar density in α phase.


[ m o l m −3]

P α

Pressure in α phase.



\(P_{\textit {Gvapor}}^{w}\)

Vapor pressure of pure water.




Capillary pressure.




Heat source/sink term.


[ W s −2]


Universal Gas Constant.


[ J m o l −1 K −1]

S α r

Residual saturation in α phase.



S α

Saturation in α phase.



S le

Effective saturation.







u α

Specific internal energy.


[ J K g −1]

V α

Volume in α phase.


[ m 3]

v α

Darcy velocity in α phase.


[ m s −1]


Total molar fraction of light component in two phases.



\(X_{\alpha }^{i}\)

Molar Fraction of i-component in α phase.




  • Abadpour, A, Panfilov M (2009) Method of negative saturations for modeling two-phase compositional flow with oversaturated zones. Transp Porous Media 79(2): 197–214.

    Article  Google Scholar 

  • Angelini, O, Chavant C, Chénier E, Eymard R, Granet S (2011) Finite volume approximation of a diffusion–dissolution model and application to nuclear waste storage. Math Comput Simul 81(10): 2001–2017.

    Article  Google Scholar 

  • Ben Gharbia, I, Jaffré J (2014) Gas phase appearance and disappearance as a problem with complementarity constraints. Math Comput Simul 99: 28–36.

    Article  Google Scholar 

  • Bourgeat, A, Jurak M, Smaï F (2009) Two-phase, partially miscible flow and transport modeling in porous media; application to gas migration in a nuclear waste repository. Comput Geosci 13(1): 29–42.

    Article  Google Scholar 

  • Bourgeat, A, Jurak M, Smaï F (2013) On persistent primary variables for numerical modeling of gas migration in a nuclear waste repository. Comput Geosci 17(2): 287–305.

    Article  Google Scholar 

  • Çengel, YA, Boles MA (1994) Thermodynamics: an engineering approach. Property Tables, Figures and Charts to Accompany. McGraw-Hill Ryerson, Limited, Singapore.

  • Class, H, Helmig R, Bastian P (2002) Numerical simulation of non-isothermal multiphase multicomponent processes in porous media: 1. an efficient solution technique. Adv Water Resour 25(5): 533–550.

    Article  Google Scholar 

  • Ern, A, Mozolevski I (2012) Discontinuous galerkin method for two-component liquid–gas porous media flows. Comput Geosci 16(3): 677–690.

    Article  Google Scholar 

  • Fatt, I, Klikoff Jr WA (1959) Effect of fractional wettability on multiphase flow through porous media. Trans., AIME (Am. Inst. Min. Metall. Eng.),216: 426–432.

    Google Scholar 

  • Forsyth, P, Shao B (1991) Numerical simulation of gas venting for NAPL site remediation. Adv Water Resour 14(6): 354–367.

    Article  Google Scholar 

  • Gawin, D, Baggio P, Schrefler BA (1995) Coupled heat, water and gas flow in deformable porous media. Int J Numer Methods Fluids 20(8-9): 969–987. doi:10.1002/fld.1650200817.

    Article  Google Scholar 

  • Hassanizadeh, M, Gray WG (1980) General conservation equations for multi-phase systems: 3. constitutive theory for porous media flow. Adv Water Resour 3(1): 25–40.

    Article  Google Scholar 

  • Helmig, R (1997) Multiphase flow and transport processes in the subsurface: a contribution to the modeling of hydrosystems. Springer, Berlin.

    Book  Google Scholar 

  • Kanzow, C (2004) Inexact semismooth newton methods for large-scale complementarity problems. Optimization Methods Softw 19(3-4): 309–325.

    Article  Google Scholar 

  • Kolditz, O, De Jonge J (2004) Non-isothermal two-phase flow in low-permeable porous media. Comput Mech 33(5): 345–364.

    Article  Google Scholar 

  • Kolditz, O, Bauer S, Bilke L, Böttcher N, Delfs JO, Fischer T, Görke UJ, Kalbacher T, Kosakowski G, McDermott CI, Park CH, Radu F, Rink K, Shao H, Shao HB, Sun F, Sun YY, Singh AK, Taron J, Walther M, Wang W, Watanabe N, Wu Y, Xie M, Xu W, Zehner B (2012) Opengeosys: an open-source initiative for numerical simulation of thermo-hydro-mechanical/chemical (THM/C) processes in porous media. Environ Earth Sci 67(2): 589–599. doi:10.1007/s12665-012-1546-x.

  • Kräutle, S (2011) The semismooth newton method for multicomponent reactive transport with minerals. Adv Water Resour 34(1): 137–151.

    Article  Google Scholar 

  • Landau, L, Lifshitz E (1980) Statistical physics, part i. Course Theoretical Phys 5: 468.

    Google Scholar 

  • Marchand, E, Müller T, Knabner P (2012) Fully coupled generalised hybrid-mixed finite element approximation of two-phase two-component flow in porous media. part ii: numerical scheme and numerical results. Comput Geosci 16(3): 691–708.

    Article  Google Scholar 

  • Marchand, E, Müller T, Knabner P (2013) Fully coupled generalized hybrid-mixed finite element approximation of two-phase two-component flow in porous media. part i: formulation and properties of the mathematical model. Comput Geosci 17(2): 431–442.

    Article  Google Scholar 

  • Marchand, E, Knabner P (2014) Results of the momas benchmark for gas phase appearance and disappearance using generalized mhfe. Adv Water Resour 73: 74–96.

    Article  Google Scholar 

  • Neumann, R, Bastian P, Ippisch O (2013) Modeling and simulation of two-phase two-component flow with disappearing nonwetting phase. Comput Geosci 17(1): 139–149.

    Article  Google Scholar 

  • Olivella, S, Gens A (2000) Vapour transport in low permeability unsaturated soils with capillary effects. Transp Porous Media 40(2): 219–241.

    Article  Google Scholar 

  • Park, CH, Taron J, Görke UJ, Singh AK, Kolditz O (2011) The fluidal interface is where the action is in C O 2 sequestration and storage: Hydro-mechanical analysis of mechanical failure. Energy Procedia 4: 3691–3698.

    Article  Google Scholar 

  • Panfilov, M, Panfilova I (2014) Method of negative saturations for flow with variable number of phases in porous media: extension to three-phase multi-component case. Comput Geosci: 1–15.

  • Park, CH, Böttcher N, Wang W, Kolditz O (2011) Are upwind techniques in multi-phase flow models necessary?. J Comput Phys 230(22): 8304–8312.

    Article  Google Scholar 

  • Pruess, K (2008) On production behavior of enhanced geothermal systems with C O 2 as working fluid. Energy Convers Manag 49(6): 1446–1454.

    Article  Google Scholar 

  • Peng, DY, Robinson DB (1976) A new two-constant equation of state. Ind Eng Chem Fundam 15(1): 59–64.

    Article  Google Scholar 

  • Salimi, H, Wolf KH, Bruining J (2012) Negative saturation approach for non-isothermal compositional two-phase flow simulations. Transp Porous Media 91(2): 391–422.

    Article  Google Scholar 

  • Singh, A, Baumann G, Henninges J, Görke UJ, Kolditz O (2012) Numerical analysis of thermal effects during carbon dioxide injection with enhanced gas recovery: a theoretical case study for the altmark gas field. Environ Earth Sci 67(2): 497–509.

    Article  Google Scholar 

  • Singh, A, Delfs JO, Böttcher N, Taron J, Wang W, Görke UJ, Kolditz O (2013a) A benchmark study on non-isothermal compositional fluid flow. Energy Procedia 37: 3901–3910.

  • Singh, A, Delfs JO, Shao H, Kolditz O (2013b) Characterization of co2 leakage into the freshwater body In: EGU General Assembly Conference Abstracts, 11474.

  • Udell, K, Fitch J (1985) Heat and mass transfer in capillary porous media considering evaporation, condensation, and non-condensible gas effects In: 23rd ASME/AIChE National Heat Transfer Conference, Denver, CO, 103–110.

  • Van Genuchten, MT (1980) A closed-form equation for predicting the hydraulic conductivity of unsaturated soils. Soil Sci Soc Am J 44(5): 892–898.

    Article  Google Scholar 

  • Wu, YS, Forsyth PA (2001) On the selection of primary variables in numerical formulation for modeling multiphase flow in porous media. J Contam Hydrol 48(3): 277–304.

    Article  Google Scholar 

Download references


We would thank to Dr. Norihito Watanabe for his thoughtful scientific suggestions and comments on this paper. This work has been funded by the Helmholtz Association through the program POF III-R41 ‘Geothermal Energy Systems’. The first author would also like to acknowledge the financial support from Chinese Scholarship Council (CSC).

Author information

Authors and Affiliations


Corresponding author

Correspondence to Haibing Shao.

Additional information

Competing interests

The authors declare that they have no competing interests.

Authors’ contributions

YH implemented the extended method into the OpenGeoSys software, produced simulation results of the two benchmarks, and also drafted this manuscript. HS designed the numerical algorithm of solving the coupled PDEs, and also contributed to the code implementation. OK coordinated the development of OpenGeoSys, and contributed to the manuscript writing. All authors read and approved the final manuscript.

Additional files

Additional file 1

This document introduces how this analytical solution is deducted.

Additional file 2

This is the main matlab script file, which will be executed to produce the analytical solution.

Additional file 3

This file constructs the four coupled differential equations.

Additional file 4

This file calculates the relative permeability of gas phase.

Additional file 5

This file calculates the relative permeability of liquid phase.

Additional file 6

This file calculates the capillary pressure, with water saturation as the input parameter.

Rights and permissions

Open Access  This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made.

The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder.

To view a copy of this licence, visit

Reprints and permissions

About this article

Check for updates. Verify currency and authenticity via CrossMark

Cite this article

Huang, Y., Kolditz, O. & Shao, H. Extending the persistent primary variable algorithm to simulate non-isothermal two-phase two-component flow with phase change phenomena. Geotherm Energy 3, 13 (2015).

Download citation

  • Received:

  • Accepted:

  • Published:

  • DOI: