Extending the persistent primary variable algorithm to simulate nonisothermal twophase twocomponent flow with phase change phenomena
 Yonghui Huang†^{1, 2},
 Olaf Kolditz^{1, 2} and
 Haibing Shao†^{1, 3}Email author
DOI: 10.1186/s4051701500308
© Huang et al. 2015
Received: 17 December 2014
Accepted: 7 May 2015
Published: 9 July 2015
Abstract
In highenthalpy geothermal reservoirs and many other geotechnical applications, coupled nonisothermal 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 nonisothermal 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 nonisothermal multiphase flow of heatpipe problem. The OpenGeoSys simulation results have been successfully verified by closely fitting results from other codes and also against analytical solution.
Keywords
Nonisothermal multiphase flow Geothermal reservoir modeling Phase change OpenGeoSysBackground
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 NonAqueous 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 coexist. 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 socalled 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 nondifferentiable 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 nonisothermal 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 threecomponent threephase scenario. As the negative saturation value does not have a physical meaning, further extension of this approach to general multiphase multicomponent 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 nonwetting 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 nonwetting 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 multiphases (≥3) multicomponents (≥3) system.
In this work, as the first step of building a multicomponent multiphase reactive transport model for geothermal reservoir simulation, we extend Marchand’s componentbased multiphase flow approach (Marchand et al. 2013) to the nonisothermal 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 heatpipe 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 nonlinear 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.
Method
Governing equations
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.
Nonisothermal persistent primary variable approach

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} $$(9)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 chooseIn Benchmark II (‘Benchmark II: heat pipe problem’ section), we choose$$\gamma(S)=0 $$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.$$\gamma(S)=S^{2} $$$$ P_{L}=P\gamma(S) P_{c}(S) $$(10)$$ P_{G}=P+(1\gamma(S)) P_{c}(S) $$(11)

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}}+(1S)N_{L}{X_{L}^{h}}}{{SN}_{G}+(1S)N_{L}} $$(12)
In a hydrogenwater 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 twophase twocomponent system are then written as$$\begin{array}{@{}rcl@{}} &&\frac{\Phi \partial ((SN_{G}+(1S)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} $$(13)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)}. $$(14) 
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(1S_{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} $$(15)
List of secondary variables and their dependency on the primary variables
Parameters  Symbol  Unit 

Gas phase saturation  S(P,X)  [] 
Molar density of phase α  N _{ α }(P,X,T)  [mol m ^{−3}] 
Molar fraction of component i in phase α  \(X_{\alpha }^{(i)}(P,X,T)\)  [] 
Capillary pressure  P _{ c }(S)  [ Pa] 
Relative permeability of phase α  K _{ r α }(S)  [] 
Specific internal energy of phase α  u _{ α }(P,X,T)  [J mol ^{−1}] 
Specific enthalpy of phase α  H _{ α }(P,X,T)  [J mol ^{−1}] 
Heat conduction coefficient  λ _{ pm }(P,X,S,T)  [W m ^{−1} K ^{−1}] 
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
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 temperaturedependent function in nonisothermal scenarios.

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 nonlinear system.$$ {X_{L}^{h}}=X_{m}(P,S,T_{0}) $$(33)$$ {X_{G}^{h}}=X_{M}(P,S,T_{0}) $$(34)$$ N_{G}=\frac{P_{G}(P,S\,)}{RT_{0}} $$(35)$$ N_{L}=\frac{N_{L}^{std}}{1{X_{L}^{h}}} $$(36)$$ \frac{SN_{G}(X{X_{G}^{h}})+(1S\,)N_{L}(X{X_{L}^{h}})}{SN_{G}+(1S\,)N_{L}} = 0 $$(37) 
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 $$(38)$$ N_{L}=\frac{N_{L}^{std}}{1X} $$(39) 
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 nonisothermal systems
As the energy balance of Eq. 6 has to be taken into account under the nonisothermal 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 nonisothermal transport, high nonlinearity 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 nonisothermal multiphase 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.
with A, B, and C as the empirical parameters. Details regarding this formulation can be found in Class et al. (2002).
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).
with T the temperature value in °C.
where \(\phi _{\alpha }^{(i)}\) is the respective fugacity coefficient of component.
Numerical scheme
Numerical solution of EOS
Physical constraints of EOS
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 TrustRegion method are very robust in solving such a local problem, but the calculation time will be considerably longer, compared to the Newtonbased iteration method.
Numerical solution of the global equation system
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
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 nonisothermal 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 nonisothermal 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 semianalytical solution from Udell and Fitch (1985). This semianalytical 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 twodimensional 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

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

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
Fluid and porous medium properties applied in the H_{2} migration benchmark
Parameters  Symbol  Value  Unit 

Intrinsic permeability  K  5×10^{−20}  [m ^{2}] 
Porosity  Φ  0.15  [] 
Residual saturation of liquid phase  S _{ lr }  0.4  [] 
Residual saturation of gas phase  S _{ gr }  0  [] 
Viscosity of liquid  μ _{ l }  10^{−3}  [ Pa·s] 
Viscosity of gas  μ _{ g }  9×10^{−6}  [ Pa·s] 
van Genuchten parameter  P _{ r }  2×10^{6}  [ Pa] 
van Genuchten parameter  n  1.49  [] 
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 10^{4} centuries were simulated. The entire execution time is around 3.241×10^{4}s.
Results and analysis
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×10^{6} [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
Parameters applied in the heat pipe problem
Parameters name  Symbol  Value  Unit 

Permeability  K  10^{−12}  [m ^{2}] 
Porosity  Φ  0.4  [] 
Residual liquid phase saturation  S _{ lr }  0.4  [] 
Heat conductivity of fully saturated porous medium  \(\lambda _{\textit {pm}}^{S_{w}=1}\)  1.13  [W m ^{−1} K ^{−1}] 
Heat conductivity of dry porous medium  \(\lambda _{\textit {pm}}^{S_{w}=0}\)  0.582  [W m ^{−1} K ^{−1}] 
Heat capacity of the soil grains  c _{ s }  700  [ J kg ^{−1} K ^{−1}] 
Density of the soil grain  ρ _{ s }  2600  [ kg m ^{−3}] 
Density of the water  ρ _{ w }  1000  [ kg m ^{−3}] 
Density of the air  ρ  0.08  [ kg m ^{−3}] 
Dynamic viscosity of water  μ _{ w }  2.938×10^{−4}  [ Pa·s] 
Dynamic viscosity of air  \({\mu _{g}^{a}}\)  2.08×10^{−5}  [ Pa·s] 
Dynamic viscosity of steam  \({\mu _{g}^{w}}\)  1.20×10^{−5}  [ Pa·s] 
Diffusion coefficient of air  \({D_{g}^{a}}\)  2.6×10^{−5}  [ m ^{2} s ^{−1}] 
van Genuchten parameter  P _{ r }  1×10^{4}  [ Pa] 
van Genuchten parameter  n  5  [] 
Physical scenario

P(t=0)=1×10^{5} [Pa], S _{ L }(t=0)=0.7, T(t=0)=70 [°C] on the entire domain.

q ^{ w }·ν=q ^{ h }·ν=0 on Γ _{ imp }.

q ^{ w }·ν=q ^{ h }·ν=0, q ^{ T }·ν=Q _{ T } on Γ _{ in }.

P=1×10^{5} [Pa], S _{ L }=0.7, T=70 [°C] on Γ _{ out }.
Model parameters and numerical settings
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 10^{4} day were simulated.
Results
Discussion
Analysis of the differences in benchmark II
Here \(\bar {P}_{c}(S)\) indicates the modified van Genuchtem model, and \(P^{\prime }_{c}(S_{\textit {lr}})\) represents the slope of PcS 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 semianalytical solution. This is considered to be the reason why the quasi steadystate 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 noncontinuity 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.
Conclusions

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 nonisothermal benchmark, we simulated the heat pipe problem and verified our result against the semianalytical 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 massbalance 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 temperaturedependent reactive transport system will be the topic of a separate work in the near future.
Nomenclature
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 icomponent in α phase.  [Pa]  
Φ  Porosity.  []  
\(\phi _{\alpha }^{i}\)  fugacity coefficient of icomponent in α phase.  []  
\(\rho _{\alpha }^{i}\)  Mass density of icomponent in α phase.  [ K g m ^{−3}]  
Operators  
∧  Logical " a n d "  
∥∥_{2}  Euclidean norm  
Ψ(a,b)  Minimum function  
Roman symbols  
g  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 icomponent in phase α.  [ m ^{2} s ^{−1}]  
F ^{ i }  Mass source/sink term for icomponent.  [ K g m ^{−3} s ^{−1}]  
\(f_{\alpha }^{i}\)  Fugacity of icomponent in α phase.  [Pa]  
\({H_{W}^{h}}\)  Henry coefficient.  [ m o l P a ^{−1} m ^{−3}]  
h _{ α }  Specific enthalpy.  [ J K g ^{−1}]  
\(j_{\alpha }^{i}\)  Diffusive mass flux of icomponent in α phase.  [ m o l m ^{−2} s ^{−1}]  
K  Intrinsic Permeability.  [ m ^{2}]  
N _{ α }  Molar density in α phase.  [ m o l m ^{−3}]  
P _{ α }  Pressure in α phase.  [Pa]  
\(P_{\textit {Gvapor}}^{w}\)  Vapor pressure of pure water.  [Pa]  
Pc  Capillary pressure.  [Pa]  
Q _{ T }  Heat source/sink term.  [ W s ^{−2}]  
R  Universal Gas Constant.  [ J m o l ^{−1} K ^{−1}]  
S _{ α r }  Residual saturation in α phase.  []  
S _{ α }  Saturation in α phase.  []  
S _{ le }  Effective saturation.  []  
T  Temperature.  [K]  
u _{ α }  Specific internal energy.  [ J K g ^{−1}]  
V _{ α }  Volume in α phase.  [ m ^{3}]  
v _{ α }  Darcy velocity in α phase.  [ m s ^{−1}]  
X  Total molar fraction of light component in two phases.  []  
\(X_{\alpha }^{i}\)  Molar Fraction of icomponent in α phase.  [] 
Declarations
Acknowledgements
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 IIIR41 ‘Geothermal Energy Systems’. The first author would also like to acknowledge the financial support from Chinese Scholarship Council (CSC).
Authors’ Affiliations
References
 Abadpour, A, Panfilov M (2009) Method of negative saturations for modeling twophase compositional flow with oversaturated zones. Transp Porous Media 79(2): 197–214.View ArticleGoogle 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.View ArticleGoogle Scholar
 Ben Gharbia, I, Jaffré J (2014) Gas phase appearance and disappearance as a problem with complementarity constraints. Math Comput Simul 99: 28–36.View ArticleGoogle Scholar
 Bourgeat, A, Jurak M, Smaï F (2009) Twophase, partially miscible flow and transport modeling in porous media; application to gas migration in a nuclear waste repository. Comput Geosci 13(1): 29–42.View ArticleGoogle 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.View ArticleGoogle Scholar
 Çengel, YA, Boles MA (1994) Thermodynamics: an engineering approach. Property Tables, Figures and Charts to Accompany. McGrawHill Ryerson, Limited, Singapore. https://books.google.de/books?id=u2SAAAACAAJ.
 Class, H, Helmig R, Bastian P (2002) Numerical simulation of nonisothermal multiphase multicomponent processes in porous media: 1. an efficient solution technique. Adv Water Resour 25(5): 533–550.View ArticleGoogle Scholar
 Ern, A, Mozolevski I (2012) Discontinuous galerkin method for twocomponent liquid–gas porous media flows. Comput Geosci 16(3): 677–690.View ArticleGoogle 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.View ArticleGoogle Scholar
 Gawin, D, Baggio P, Schrefler BA (1995) Coupled heat, water and gas flow in deformable porous media. Int J Numer Methods Fluids 20(89): 969–987. doi:10.1002/fld.1650200817.View ArticleGoogle Scholar
 Hassanizadeh, M, Gray WG (1980) General conservation equations for multiphase systems: 3. constitutive theory for porous media flow. Adv Water Resour 3(1): 25–40.View ArticleGoogle Scholar
 Helmig, R (1997) Multiphase flow and transport processes in the subsurface: a contribution to the modeling of hydrosystems. Springer, Berlin.View ArticleGoogle Scholar
 Kanzow, C (2004) Inexact semismooth newton methods for largescale complementarity problems. Optimization Methods Softw 19(34): 309–325.View ArticleGoogle Scholar
 Kolditz, O, De Jonge J (2004) Nonisothermal twophase flow in lowpermeable porous media. Comput Mech 33(5): 345–364.View ArticleGoogle 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 opensource initiative for numerical simulation of thermohydromechanical/chemical (THM/C) processes in porous media. Environ Earth Sci 67(2): 589–599. doi:10.1007/s126650121546x.
 Kräutle, S (2011) The semismooth newton method for multicomponent reactive transport with minerals. Adv Water Resour 34(1): 137–151.View ArticleGoogle 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 hybridmixed finite element approximation of twophase twocomponent flow in porous media. part ii: numerical scheme and numerical results. Comput Geosci 16(3): 691–708.View ArticleGoogle Scholar
 Marchand, E, Müller T, Knabner P (2013) Fully coupled generalized hybridmixed finite element approximation of twophase twocomponent flow in porous media. part i: formulation and properties of the mathematical model. Comput Geosci 17(2): 431–442.View ArticleGoogle 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.View ArticleGoogle Scholar
 Neumann, R, Bastian P, Ippisch O (2013) Modeling and simulation of twophase twocomponent flow with disappearing nonwetting phase. Comput Geosci 17(1): 139–149.View ArticleGoogle Scholar
 Olivella, S, Gens A (2000) Vapour transport in low permeability unsaturated soils with capillary effects. Transp Porous Media 40(2): 219–241.View ArticleGoogle 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: Hydromechanical analysis of mechanical failure. Energy Procedia 4: 3691–3698.View ArticleGoogle Scholar
 Panfilov, M, Panfilova I (2014) Method of negative saturations for flow with variable number of phases in porous media: extension to threephase multicomponent case. Comput Geosci: 1–15.
 Park, CH, Böttcher N, Wang W, Kolditz O (2011) Are upwind techniques in multiphase flow models necessary?. J Comput Phys 230(22): 8304–8312.View ArticleGoogle 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.View ArticleGoogle Scholar
 Peng, DY, Robinson DB (1976) A new twoconstant equation of state. Ind Eng Chem Fundam 15(1): 59–64.View ArticleGoogle Scholar
 Salimi, H, Wolf KH, Bruining J (2012) Negative saturation approach for nonisothermal compositional twophase flow simulations. Transp Porous Media 91(2): 391–422.View ArticleGoogle 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.View ArticleGoogle Scholar
 Singh, A, Delfs JO, Böttcher N, Taron J, Wang W, Görke UJ, Kolditz O (2013a) A benchmark study on nonisothermal 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 noncondensible gas effects In: 23rd ASME/AIChE National Heat Transfer Conference, Denver, CO, 103–110.
 Van Genuchten, MT (1980) A closedform equation for predicting the hydraulic conductivity of unsaturated soils. Soil Sci Soc Am J 44(5): 892–898.View ArticleGoogle 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.View ArticleGoogle Scholar
Copyright
This is an Open Access article distributed under the terms of the Creative Commons Attribution License (http://creativecommons.org/licenses/by/4.0), which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.