MULTIPHASE EQUILIBRIUM CALCULATIONS
WITH GAS SOLUBILITY
IN WATER FOR ENHANCED OIL RECOVERY
A THESIS
SUBMITTED TO THE DEPARTMENT OF
ENERGY RESOURCES ENGINEERING
OF STANFORD UNIVERSITY
IN PARTIAL FULFILLMENT OF THE REQUIREMENTS
FOR THE DEGREE OF
MASTER OF SCIENCE
Ruixiao Sun
August 2017
c© Copyright by Ruixiao Sun 2017
All Rights Reserved
ii
I certify that I have read this thesis and that in my opinion it is fully
adequate, in scope and quality, as partial fulfillment of the degree of
Master of Science in Petroleum Engineering.
(Hamdi Tchelepi) Principal Adviser
iii
Abstract
Gas injection is an important technique for enhanced oil recovery and carbon dioxide
(CO2) sequestration. Given that water exists abundantly in the reservoir, multiphase
equilibrium calculations with gas solubility in water are an important part of com-
positional reservoir simulation. In the work presented in this thesis, our goal is to
explore a phase-behavior model for three phase compositional simulation of gas injec-
tion (especially CO2) in the presence of water. In this work, Henry’s law is applied
to calculate component fugacities in the aqueous phase, while an equation of state
(EOS) is used for the hydrocarbon vapor and liquid phases.
We have developed a robust algorithm to determine the number of phases present
and their compositions. The basis of the algorithm is stability analysis in combination
with phase split calculations. The stability analysis and phase split kernels can be
framed as optimization problems. Specifically, stability analysis involves locating the
minimum of the tangent plane distance function. The phase split calculation seeks
to find the minimum Gibbs free energy of the system.
Different numerical methods were explored and applied to ensure robust and effi-
cient computations. In the algorithm we developed, first, the successive substitution
iteration (SSI) method is performed based on an appropriate initial guess. After
getting close enough to the solution, the algorithm switches to Newton’s method for
faster convergence. In most cases the algorithm works pretty well. However, if New-
ton’s method fails in some cases, for example, in the region near the critical point,
iv
the Trust Region (TR) method is applied.
To verify our algorithm, we first tested cases with two phases and three phases,
taking into account CO2 and water existence, then we compared our results with
WinProp in CMG. This comparison shows that results are very close and the differ-
ences are acceptable. Then, three phase cases, modified from SPE3 and SPE5, were
tested and P − x phase diagrams were generated, where P is reservoir pressure and
x is the fraction of the injected fluid. The tests demonstrate that the algorithm is
stable and produces physical, accurate and consistent results, even for complex cases
across a wide range of temperatures and pressures.
v
Acknowledgments
First and foremost, I would like to express my sincere appreciation to my advisor Prof.
Hamdi Tchelepi for his constant support, patience and encouragement in my academic
life. Thanks for his insightful suggestions, profound discussion and helpful advice,
especially his passion for petroleum engineering, I developed sufficient confidence and
motivations, and learned many skills for my academic research. I am so honored that
I can be in his group and continue my research under his guidance and supervision.
I would also like to express my gratitude to Dr. Huanquan Pan for providing
me with a comprehensive understanding of compositional model and phase equilib-
rium calculations. He is very patient and always gives me useful suggestions for my
research.
In addition, I am grateful to my workmate, Michael Connolly, for his generous
help, detailed advice and inspiring ideas in my research and coursework. I am really
grateful and moved by our teamwork and cooperation.
I would like to thank the affiliates of Stanford University Petroleum Research
Institute B (SUPRI-B) for the financial support. I also want to thank all the staff,
faculty and fellow students in the Department of Energy Resources Engineering for
their help in many aspects.
Additionally, I acknowledge my friends at Stanford. They enrich my life here. We
share happiness and sorrows, and they always encourage me when I meet obstacles.
Last but not least, I want to say thank you to my parents for their unconditional
vi
understanding and support, which give me courage and strength to move forward.
Thanks for their love in the past, present and future.
vii
Contents
Abstract iv
Acknowledgments vi
1 Introduction 1
2 Theoretical Basis 7
2.1 Henry’s Law . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.1.1 Harvey’s Method . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.1.2 Li and Nghiem’s Method . . . . . . . . . . . . . . . . . . . . . 9
2.1.3 Water component fugacity in the aqueous phase . . . . . . . . 12
2.1.4 Effect of salinity . . . . . . . . . . . . . . . . . . . . . . . . . . 13
2.1.5 Calculations of fugacity . . . . . . . . . . . . . . . . . . . . . . 15
2.2 Stability Analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
2.3 Phase Split Calculations . . . . . . . . . . . . . . . . . . . . . . . . . 21
2.3.1 Fugacity in Phase Equilibrium . . . . . . . . . . . . . . . . . . 21
2.3.2 Gibbs Free Energy Minimization . . . . . . . . . . . . . . . . 23
3 Numerical Implementation 28
3.1 Initial Guesses of K values . . . . . . . . . . . . . . . . . . . . . . . . 29
3.2 Successive Substitution Iteration Method . . . . . . . . . . . . . . . . 30
viii
3.2.1 SSI Method in Stability Analysis . . . . . . . . . . . . . . . . 30
3.2.2 SSI Method in Phase Split Calculations . . . . . . . . . . . . . 32
3.3 Newton’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
3.3.1 Newton’s Method for Stability Analysis . . . . . . . . . . . . . 36
3.3.2 Newton’s method for Phase Split Calculations . . . . . . . . . 37
3.4 Trust Region Method . . . . . . . . . . . . . . . . . . . . . . . . . . . 40
3.4.1 Introduction to Trust Region Method . . . . . . . . . . . . . . 40
3.4.2 Solutions to Trust Region Subproblems . . . . . . . . . . . . . 42
3.4.3 Trust Region Method for Stability Analysis . . . . . . . . . . 43
3.4.4 Trust Region Method for Phase Split Calculations . . . . . . . 44
3.5 Algorithm for Multiphase Equilibrium Calculations . . . . . . . . . . 46
4 Results and Analysis 49
4.1 Two Phase case studies . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4.2 Three Phase case studies . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.2.1 Cases from SPE5 . . . . . . . . . . . . . . . . . . . . . . . . . 54
4.2.2 Cases from SPE3 . . . . . . . . . . . . . . . . . . . . . . . . . 57
5 Conclusions 60
A Solutions of Cubic Equations 62
B Derivatives of the Fugacity Coefficient on Compositions 64
C Derivatives of Stability Analysis 67
D Derivatives of Phase Split Calculations 69
Nomenclature 72
ix
Bibliography 75
x
List of Figures
2.1 Molar Gibbs free energy surface and tangent plane distance F . . . . 18
3.1 Workflow of the SSI method for stability analysis . . . . . . . . . . . 33
3.2 Workflow of the SSI method for phase split calculations . . . . . . . . 35
3.3 Workflow of Newton’s method for stability analysis . . . . . . . . . . 37
3.4 Workflow of Newton’s method for phase split calculations . . . . . . . 39
3.5 Workflow of the TR method for stability analysis . . . . . . . . . . . 45
3.6 Workflow of the TR method for phase split calculations . . . . . . . . 47
3.7 Algorithm for multiphase equilibrium calculations . . . . . . . . . . . 48
4.1 Errors of the two component system from Harvey’s model . . . . . . . 51
4.2 Errors of the two component system from Li and Nghiem’s model . . 52
4.3 Errors of the four component system from Harvey’s model . . . . . . 53
4.4 Errors of the four component system from Li and Nighem’s model . . 53
4.5 Phase diagram of pressure and injection at z[H2O] = 0.99 . . . . . . 55
4.6 Phase diagrams of four different overall water fractions: (a) z[H2O] =
0.9; (b) z[H2O] = 0.5; (c) z[H2O] = 0.1; (d) z[H2O] = 0.01 . . . . . . 56
4.7 Phase diagram of pressure and injection at z[H2O] = 0.99 . . . . . . 58
4.8 Phase diagrams of four different water overall fractions: (a) z[H2O] =
0.9; (b) z[H2O] = 0.5; (c) z[H2O] = 0.1; (d) z[H2O] = 0.01 . . . . . . 59
xi
Chapter 1
Introduction
The multiphase equilibrium calculation, applied in compositional flow simulation, has
become increasingly important in a large number of problems in hydrocarbon energy
production. One important application is gas injection for enhanced oil recovery
(EOR). Given that the greenhouse effect caused by CO2 raises increasing concerns,
using CO2 as the injected gas is a good choice.
Most hydrocarbon reservoirs are found in sandstone and carbonate rocks [44]. For
this reason, water is an inseparable component in these reservoirs. However, most
researchers exclude water for multiphase equilibrium calculations. The exclusion of
water may cause inconsistent results because this exclusion does not account for the
dissolution of light hydrocarbon components in the aqueous phase. In addition, the
salinity of the aqueous phase needs to be taken into account because it has a strong
influence on gas solubility [16]. In the work presented here, we developed a robust and
efficient algorithm to perform multiphase equilibrium calculations with gas solubility
in water.
Currently, various cubic equations of state (EOS) are used to model hydrocar-
bon fluid phase behavior in phase equilibrium calculations. Several types of EOS are
extensively used, such as Peng-Robinson (PR EOS) [36], Redlich-Kwong (RK EOS)
1
CHAPTER 1. INTRODUCTION 2
[39] and Soave-Redlich-Kwong (SRK EOS) [46], and errors are in an acceptable range.
However, several researchers used an EOS to model aqueous phase behavior and ob-
served that accurate results are difficult to achieve [11, 35, 28]. Special modifications
of EOS were investigated by several authors, like using mixing-rules and changing
EOS parameters to improve accuracy [29, 41].
Another approach for modeling aqueous phase behavior was also explored by some
researchers [19, 23, 32, 16]. Flash calculations were performed for mixtures of crude
oil and water, with Henry’s law constants determined from experimental data [32].
However, in these studies, CO2 is the only component that could dissolve in water
and these studies did not consider the water component existing in the hydrocarbon-
rich vapor and liquid phases. In addition, the effect of salinity on gas solubility
was neglected. Subsequently, Li and Nghiem proposed more reliable correlations for
Henry’s law constants based on published experimental data, and they also considered
the influence of salinity on gas solubility by the use of scaled-particle theory[16]. As
for a larger temperature range, Harvey proposed the semi-empirical correlation for
the Henry’s law constant which can behave properly near the critical temperature.
Another advantage of Harvey’s method is that it is not restricted to a specific solvent
[8].
In the approach we have developed, we use Henry’s law to predict the behavior of
the aqueous phase. Not only Henry’s law is more appropriate because it was proposed
intrinsically to describe gas solubility, but Henry’s law constant only depends on
temperature and pressure, which makes phase equilibrium calculations more simple
and efficient. We calculate Henry’s law constant with Li and Nghiem’s and Harvey’s
methods, respectively.
For multiphase equilibrium calculations, determining how many phases are present
is a significant issue. The conventional approach was to first assume the number of
phases existing at equilibrium and then solve material balance equations, updating
CHAPTER 1. INTRODUCTION 3
equilibrium factors until obtaining convergence. If an unphysical solution is obtained,
for example, getting negative compositions, the phase split calculation is repeated
until the physical solution is found [13, 30]. Alternatively, the equilibrium could be
formulated by minimizing Gibbs free energy. Liquid and vapor phases could be added
as necessary during minimization [7].
However, these approaches require substantial computations and may fail if poor
initial estimates are used [24]. To overcome these difficulties, Michelsen presented an
explicit analysis for stability [24], which was closely related to the extensive proof of
the tangent plane criterion [2]. Michelsen’s method is to locate stationary points and
to infer stability by analyzing solutions of these points, which is an unconstrained
local minimization problem and requires multiple initial estimates to avoid missing
the instability [24]. Another method for stability analysis is direct global minimization
of the tangent plane distance (TPD) function [34].
One of the most difficult tasks in stability analysis is the initial estimate of phase
equilibrium ratios (K values). Early in this project, we used the traditional method,
which estimates K values using the Wilson correlation [50], to calculate the initial
K values. However, we discovered that the Wilson correlation could not guarantee
the detection of instability, especially for problems involving more than one liquid
phase. Based on Michelsen’s suggestion that the trial phase can be initially assumed
to be a pure substance [24], a new expression of K values initial guess was proposed
by Li and Firoozabadi [17]. They assumed that, in the trial phase, the initial mole
fraction of one component is 90% and the remaining components equally shares 10%.
In this work, we take a similar method to compute initial K value estimates and
assume an initial mole fraction of 99% for one component and 1% for the remaining
components. In the numerical implementation of stability analysis, the algorithm first
conducts the SSI method and then Newton’s method. The SSI method can provide
good initial estimates for Newton’s method which has quadratic convergence and is
CHAPTER 1. INTRODUCTION 4
more efficient. If both these methods fail to converge, the algorithm switches to the
TR method which guarantees convergent results.
Once mixture instability is detected, the phase split calculation, which is also
called the multiphase flash, should be performed to determine the amount and com-
position of each phase. Stability analysis can provide good initial estimates for phase
split calculations. In our algorithm, we first use the K values which correspond to the
smallest TPD value from stability analysis as initial estimates for flash calculations.
For the implementation for phase split calculations, the popular methods include SSI,
quasi-Newton, Newton, steepest-descent and their various modifications and combi-
nations [25, 27, 48, 18, 1]. Our algorithm combines the SSI method, Newton’s method
and the TR method. In the SSI step, the nonlinear Rachford-Rice (RR) equations
[38] must be solved using bisection [10] or Newton’s method [26]. In phase split
calculations, Newton’s method works well for most cases and converges to physical
solutions after a few iterations.
However, Newton’s method will fail to converge in some difficult regions of the
mixture phase envelope, which are in the vicinity of singularities [22]. These diffi-
cult regions include critical points for multiphase flash calculations, convergence locus
for negative flash [49], and the stability test limit locus [49, 14, 33]. The computa-
tion with the SSI method is very slow before switching to Newton’s method, and
Newton’s method sometimes may be divergent and fail, which creates the need for
the TR method. The TR method was initially proposed to solve least-square prob-
lems [15, 21]. Nghiem [31] was the first to introduce it into phase flash calculations.
Nghiem used the SSI method and switched to Powell’s method if poor convergence
was observed. Powell’s method is a combination of a Newton-like method and the
steepest descent method. Later, Powell’s method was extended by Mehra to mul-
tiphase equilibrium calculations in compositional simulation [23]. In our research,
the TR method is applied to stability analysis, the solution of the RR equations and
CHAPTER 1. INTRODUCTION 5
phase split calculations [5].
This thesis introduces a new algorithm we developed for multiphase equilibrium
calculations in the presence of water and gas solubility. Note that the liquid phase
(L) and the vapor phase (V ) may be permuted at any time, given that they use the
same EOS to predict phase behavior. In this algorithm, first, stability analysis of
the liquid (L) and the aqueous phase (W ) is conducted to test the instability of the
mixture, which is initially assumed to be single phase. If unstable, L−W phase flash
calculations are performed to predict amounts and compositions for the liquid and
the aqueous phases. Then the stability of the hydrocarbon liquid mixture is checked
without the aqueous phase to determine whether there are three phases. In doing so,
the stability of the two hydrocarbon phases-water phase system can be tested. On
condition that instability is detected, the three phase flash calculation is conducted
to compute amounts and compositions for three phases. If the three-phase flash fails,
we assume the failure is caused by inappropriate initial guesses for K values. In
such cases, the algorithm goes back to the stability analysis for the two hydrocar-
bon phases and tests other K values corresponding to negative TPD values. If there
are no valid K values from two hydrocarbon phase stability analysis, the algorithm
goes back to the stability analysis of the overall mixture to try K values with the
second smallest TPD. The algorithm continues until a physical solution is obtained.
To verify our method, we first tested two phase and three phase fluid systems, and
compared our results with WinProp. Then, various three phase cases with CO2 injec-
tion were checked across a wide range of pressures and compositions. Phase diagrams
were generated and analyzed. The computational speed of multiphase equilibrium
calculations turns out to be very fast, and there is no abnormal interruption. In the
generated phase diagrams, the phase boundaries are smooth and consistent, and the
phases transformations are physical. This algorithm is verified to be efficient, stable
and reasonable.
CHAPTER 1. INTRODUCTION 6
The remainder of this thesis is organized as follows. Chapter 2 provides a dis-
cussion of the theoretical basis. It discusses Henry’s law, fugacity computations for
different phases, stability analysis and phase split calculations. Numerical implemen-
tations are presented in Chapter 3, including details of the SSI method, Newton’s
method and the TR method. A thorough explanation of the algorithm including
numerical procedures is then given. In Chapter 4, tests of several cases are described,
and complicated phase envelopes are displayed and explained. Chapter 5 concludes
a summary of this thesis.
Chapter 2
Theoretical Basis
2.1 Henry’s Law
Water exists abundantly in hydrocarbon reservoirs, with a large amount of light hy-
drocarbons and carbon dioxide dissolving in the aqueous phase. Cubic equations of
state have been applied extensively to model the gas phase in phase equilibrium com-
putations. However, for the aqueous phase, accurate prediction is difficult to achieve
with an EOS. In our approach, we use Henry’s law to model gas solubility in the
aqueous phase, which is more appropriate to describe aqueous phase behavior. Fur-
thermore, the Henry’s law constant only depends on temperature and pressure, which
makes computations more efficient. There are two main models used to calculate the
Henry’s law constant, proposed by Harvey [8] and Li and Nghiem [16], respectively.
We apply both of these models in our algorithm, and leave it to researchers to deter-
mine which one is appropriate for use. These two models are described in detail in
the following subsections.
7
CHAPTER 2. THEORETICAL BASIS 8
2.1.1 Harvey’s Method
Harvey recast the Henry’s law constant in his previous work [9] and proposed a semi-
empirical correction, which does not require density or fugacity evaluations.
lnHi = lnHsi +
1
RT
∫ P
P sH2O
vi dP. (2.1)
where Hi is the Henry’s law constant for component i at pressure P and temperature
T . In this equation, Hsi is the Henry’s law constant at water saturation pressure
P sH2O
, R is gas constant, and vi is partial molar volume of component i in aqueous
phase at T .
The Henry’s law constant at water saturation pressure Hsi is calculated as
lnHsi = lnP s
H2O+ A(Tr,H2O)−1 +B(1− Tr,H2O)0.355(Tr,H2O)−1
+ C[exp(1− Tr,H2O)](Tr,H2O)−0.41(2.2)
where Tr,H2O is reduced temperature of water, Tr,H2O = T/Tc,H2O, Tc,H2O is the water
critical temperature. Table 2.1 shows coefficients for various gas components.
Table 2.1: Parameters of correlation for aqueous Henry’s law constantsGaseous Solute A B C
CO2 -9.4234 4.0087 10.3199N2 -11.6184 4.9266 13.3445H2S -5.7131 5.3727 5.4227CH4 -11.0094 4.8362 12.5220C2H6 -19.7237 4.5051 20.6740
Water saturation pressure P sH2O
is calculated by Saul and Wagner [45]
lnP sH2O
Pc=TcT
(a1τ + a2τ1.5 + a3τ
3 + a4τ3.5 + a5τ
4 + a6τ7.5) (2.3)
where a1 = −7.85823, a2 = 1.83991, a3 = −11.7811, a4 = 22.6705, a5 = −15.9393, a6 =
CHAPTER 2. THEORETICAL BASIS 9
1.77516. τ is defined as τ = 1− TTc,H2O
. Water critical pressure Pc,H2O is 22.064MPa,
and water critical temperature Tc,H2O is 647.14K.
Calculations of partial molar volume vi are performed using various correlations
for different components:
For CO2, the correlation from Garcia [6] is used:
vCO2 = 37.51− 9.585× 10−2T + 8.740× 10−4T 2 − 5.044× 10−7T 3 (2.4)
For CH4, the correlation is as follows [42]:
vCH4 = exp(3.541 + 1.23× 10−3T ) (2.5)
where T is temperature in ◦C: T = T (K)− 273.15
For N2, the correlation from Perez and Heidemann [37] is used:
vN2 = exp(15.372 + 6.60× 10−2T ) (2.6)
For H2S, the general approach given by Li and Nghiem [16] is used. vH2S is molar
volume of component i at infinite dilution in the aqueous phase, which is explained
below in the description of Li and Nghiem’s method.
2.1.2 Li and Nghiem’s Method
The correlation of Henry’s law constant with respect to given pressure and tempera-
ture follows the equation
lnHi = lnH0i +
v∞i (P − P 0i )
RT(2.7)
CHAPTER 2. THEORETICAL BASIS 10
where Hi is the Henry’s law constant of component i in the aqueous phase, H0i is the
Henry’s law constant at the reference pressure P 0i , and v∞i is the molar volume of
component i at infinite dilution in the aqueous phase at T . The correlation can also
be written as
lnHi = lnH∗i +v∞i P
RT(2.8)
where
lnH∗i = lnH0i +
v∞i P0i
RT(2.9)
H∗i is considered as the reference Henry’s law constant. The molar volume at
infinite dilution v∞i is computed from the correlation of Lyckman et al. [20] reported
by Heidemann and Prausnitz (1977) [12]:
Pciv∞i
RTci= 0.095 + 2.35(
TPciCTci
) (2.10)
where Tci is the critical temperature of component i, and Pci is the critical pressure of
component i in the aqueous phase. C is the cohesive energy density of water, given
by
C = (h0w − hsw − P swv
sw +RT )/vsw (2.11)
where P sw is the water saturation pressure at temperature T , vsw is the molar volume
of water at P sw and T , and h0w − hsw is enthalpy departure of liquid water at P s
w and
T .
The enthalpy departure of water at the saturation pressure is determined using
the Yen-Alexander correlation as reported in Reid et al. [40]:
h0w − hswTc,w
=7.0 + 4.5688[− ln(P s
w/Pc,w)]0.333
1.0 + 0.004[ln(P sw/Pc,w)]
(2.12)
where the unit of h0w − hsw is cal/(g ·mol).
CHAPTER 2. THEORETICAL BASIS 11
Calculation of molar volume of water
The molar volume vsw is estimated from a correlation given by Rowe and Chou [43]:
vw = A(T )− PB(T )− P 2C(T ) (2.13)
where the coefficients are as follows:
A(T ) = 5.916365−0.01035794T +0.9270048×10−5T 2− 1127.522
T+
100674.1
T 2(2.14)
B(T ) =0.5204914× 10−2 − 0.10482101× 10−4T + 0.8328532× 10−8T 2
− 1.1702939
T+
102.2783
T 2
(2.15)
C(T ) = 0.118547× 10−7 − 0.6599143× 10−10T (2.16)
where vw is specific volume of water with unit (cm3/g), and P is absolute pressure
with unit (kg/cm2). The molar volume of water (cm3/g) is then given:
vw = vwMw (2.17)
where Mw is the molecular weight of water equaling 18.015 (g/mol)
Calculation of water saturation pressure
Water saturation pressure can be calculated from the Frost-Kalkwarf-Thodos reported
in Reid et al. [40]:
lnP sw = A+
B
T+ C lnT +D
P sw
T 2(2.18)
D is related to the van der Waals constant a and also to the critical properties:
D =a
R2=
27T 2c
64Pc(2.19)
CHAPTER 2. THEORETICAL BASIS 12
For C, Thodos and coworkers examined the behavior of the equation in detail. They
proposed that
C = 0.7816B + 2.67 (2.20)
Then, the water saturation pressure equation can be transformed into
lnP sw = B(
1
Tr− 1) + C lnTr +
27
64[
1
PcT 2br
− 1] (2.21)
B is found by applying the above equation at the normal boiling point (P = 1atm, T =
Tb):
B =lnPc + 2.67 lnTbr + 27
64[ 1PcT 2
br− 1]
1− 1Tbr− 0.7816 lnTbr
(2.22)
The constants given by Harlacher and Braun are given in Reid et al.[40]. For water,
A = 55.336, B = -6869.50, C = -5.115, D = 1.05, with vapor pressure in millimeters
of mercury (mmHg) and temperature in Kelvin (K).
Calculation of reference Henry’s law constant
The reference Henry’s law constant is estimated from
lnH∗if sw
= −A+B(103
T)− C 106
T 2(2.23)
where f sw is the fugacity of saturated water, and coefficients from Li and Nghiem [16]
are displayed in Table 2.1.2:
2.1.3 Water component fugacity in the aqueous phase
Fugacity of pure water at P and T is calculated from
fw = f sw exp(
∫ P
P sw
vwRT
dP ) (2.24)
CHAPTER 2. THEORETICAL BASIS 13
Water saturation pressure P sw is calculated from Saul and Wagner in Eq.(2.21) [45],
and molar volume of water vw is given by Rowe and Chou in Eq.(2.17) [43].
Calculation of saturated water fugacity
The equation is applied to obtain saturated water fugacity, which is found matching
the data provided by Canjar and Manning [4] reasonably well:
f swP sw
=
0.9958 + 9.68330× 10−5T ′ − 6.1750× 10−7T ′2 − 3.08333× 10−10T ′3, T ′3 > 90◦F )
1 otherwise
(2.25)
2.1.4 Effect of salinity
Gas solubility depends on the salinity of the aqueous phase. Salting-out coefficient is
defined by the following relation between the Henry’s law constant in pure water and
the Henry’s law constant in brine.
ln(Hsalt,i
Hi
) = ksalt,imsalt (2.26)
Table 2.2: Coefficients of the aqueous Henry’s law constantGaseous Solute A B C
CO2 11.3021 10.6030 1.20696N2 10.7090 11.4793 1.16549H2S 10.8393 9.8897 1.11984CH4 10.9554 11.3569 1.17105C2H6 13.9485 13.8254 1.66544C3H8 14.6331 14.4872 1.78068nC4 13.4248 13.8865 1.71879nC5 16.0045 16.2281 2.13123nC8 31.9431 28.6725 4.37707
CHAPTER 2. THEORETICAL BASIS 14
where Hsalt,i is the Henrys constant of component i in brine (salt solution), Hi is
the Henry’s constant of component i at zero salinity, and msalt is the molarity of
the dissolved salt (mol/kgH2O). For CO2 and CH4, Bakker gives the following
correlations for the salting-out coefficients[3]:
ksalt,CO2 = 0.11572− 6.0293× 10−4T + 3.5817× 10−6T 2 − 3.7772× 10−9T 3 (2.27)
where T is the temperature in degrees Celsius (◦C).
ksalt,CH4 =3.38828− 0.0318765T + 0.000122003T 2 − 2.31891× 10−7T 3
+ 2.22938× 10−10T 4 − 8.83764× 10−14T 5(2.28)
where T is the temperature in degrees Kelvin (K).
For N2, Perez and Heidemann [37] give the following correlation for the salting-out
coefficient:
ksalt,N2 = 3.1150− 0.01690T + 2.4950× 10−5T 2 (2.29)
where T is the temperature in degrees Kelvin (K).
For H2S, Suleimenov and Krupp[47] give the following correlations for the salting-out
coefficient:
ksalt,H2S =8.37106265× 10−2− 5.135608863× 10−4T + 6.387039005× 10−6T 2
− 2.217360319× 10−8T 3 − 5.069412169× 10−11T 4 + 2.827486651× 10−13T 5
(2.30)
where T is the temperature in degrees Celsius (◦C).
CHAPTER 2. THEORETICAL BASIS 15
2.1.5 Calculations of fugacity
Liquid and vapor phases
To predict amounts and compositions for the liquid and vapor phases, we use the
Peng-Robinson EOS:
P =RT
Vm − b− aα
V 2m + 2bVm − b2
(2.31)
where,
a =0.45724R2T 2
c
Pc
b =0.07780RTc
Pc
α = (1 + κ(1− T 0.5r )))2
κ = 0.37464 + 1.54226ω − 0.26992ω2 ω < 0.5
κ = 0.3796 + 1.485ω − 0.1644ω2 + 0.01667ω3 ω ≥ 0.5
(2.32)
The compressibility factor Z = PVRT
can be calculated via the resulting equation:
Z3 − (1−B)Z2 + (A− 2B − 3B2)Z − (AB −B2 −B3) = 0 (2.33)
A and B are defined as
A =aαP
R2T 2
B =BP
RT
(2.34)
where ω is the acentric factor of the species, and R is the gas constant. For the
mixture, the parameters a and b are defined using the following mixing rule:
a =∑
xiSi
Si =√aiaj
∑xj(1− kij)
b =∑
xibi
(2.35)
CHAPTER 2. THEORETICAL BASIS 16
where kij is an empirically determined interaction coefficient. How to solve cubic
equations is explained in Appendix A. The fugacity coefficient is derived as
lnφi =bib
(Z − 1)− ln(Z −B)− 1
δ2 − δ1A
B(2Sia− bib
) ln(Z + δ2B
Z + δ1B) (2.36)
For Peng-Robinson EOS, δ1 = 1−√
2, δ1 = 1 +√
2.
Aqueous phase
For components in the aqueous phase other than water, we first calculate their cor-
responding Henry’s law constants. The fugacity of component i can be derived as
fi = xiHi (2.37)
Given the definition of the fugacity coefficient, we get
φi =fixiP
(2.38)
Thus, the fugacity coefficients of components in the aqueous phase are independent
of their mole fractions.
φi =Hi
P(2.39)
For the water component in the aqueous phase, there is no corresponding Henry’s
law constant. Instead, after calculating the water component fugacity (see Eq.2.24),
we can compute the fugacity coefficient of water component by
φw =fwP
(2.40)
CHAPTER 2. THEORETICAL BASIS 17
2.2 Stability Analysis
For a mixture containing Nc components at given temperature T and pressure P ,
stability analysis is needed not to determine the number of the equilibrium phases,
but to indicate whether the system is stable or not. The stability analysis is based
on the tangent plane criterion of Gibbs free energy, and for unstable systems, a new
phase can be split off to decrease the Gibbs free energy of the mixture [24].
We consider an isolated Nc component mixture, with component mole fractions
(z1, z2, ..., zNc). Chemical reactions are not considered. Assume that pressure, tem-
perature and chemical potential are uniform throughout. The Gibbs free energy of
the mixture is
G0 =Nc∑i=1
niµ0i (2.41)
where µ0i is the chemical potential of component i in the mixture. Assumed the
mixture is constructed by two phases with mole numbers N −nε and nε, respectively.
Let the mole fraction in the second infinitesimal phase be (y1, y2, ...yNc). So the change
in Gibbs free energy is
∆G = GI +GII −G0 (2.42)
where GI , GII are the Gibbs free energies of the N − nε and nε portions.
A Taylor series expansion of GI , ignoring second and higher order terms in nε,
yields
G(N − nε) = G(N)− nεNc∑i=1
yi(∂G
∂ni)T,p,N (2.43)
Given the relationship between partial derivatives of G and chemical potential, we
get
(∂G
∂ni)T,p,N = µi(~y) (2.44)
CHAPTER 2. THEORETICAL BASIS 18
The difference of Gibbs free energy can be expressed as
∆G = nε
Nc∑i=1
yi(µi(~y)− µ0i ) (2.45)
For a system to be stable, the Gibbs free energy must be at a global minimum. Hence,
a necessary condition for stability is that, for the trial phase with any composition
~y, the total Gibbs free energy of two phases must be larger than one single phase
system.
F (~y) =Nc∑i=1
yi(µi(~y)− µ0i ) ≥ 0 (2.46)
Here F (~y) is the vertical distance from the tangent hyperplane of the molar Gibbs
energy surface at composition ~z to the energy surface at composition ~y, which is
illustrated in Fig.2.1.
Figure 2.1: Molar Gibbs free energy surface and tangent plane distance F
For any composition in the trial phase, if the tangent hyperplane to the Gibbs
free energy surface neither intersects nor lies above the surface at any point, F (~y)
is non-negative for any composition, and the mixture is stable. All minimums of
F (~y) should be tested. The stationary conditions are derived from straightforward
CHAPTER 2. THEORETICAL BASIS 19
differentiation with respect to the (Nc − 1) independent mole fractions:
µi(~y)− µ0i = k i = 1, 2, ...Nc (2.47)
With the expression of chemical potential energy, we get
µi(~y, T, P ) = µ0i (T, P ) +RT ln
fi(~y, T, P )
f 0i (T, P )
i = 1, 2, ...Nc (2.48)
The stability analysis equation can be written as
TPD(~y) = F (~y)/RT =Nc∑i=1
yi(ln yi + ln φi + hi) ≥ 0 (2.49)
where TPD is the tangent plane distance, φi is the fugacity coefficient of component
i and hi = ln zi + ln φi(~z). The stationary criterion is
ln yi + ln φi + hi = k, i = 1, 2, ...Nc (2.50)
A set of variables ~Y can be defined as
lnYi = ln yi − k, i = 1, 2, ...Nc (2.51)
The criterion is transformed to
lnYi + ln φi(~y)− hi = 0, i = 1, 2, ...Nc (2.52)
The new independent variables Yi can be interpreted as mole numbers, and the re-
lationship between yi and Yi is, yi = Yi/Nc∑i=1
Yi. For the stable phase, all stationary
CHAPTER 2. THEORETICAL BASIS 20
points with k ≥ 0 are corresponding toNc∑i=1
Yi ≤ 1. With the new variables Yi, the
problem is transformed from a constrained optimization problem (Nc∑i=1
yi = 1), to an
unconstrained problem, only Yi > 0 being required.
Conversely for an unstable system, there must be at least one stationary point that
satisfies the conditionNc∑i=1
Yi > 1. Thus we can formulate a different but equivalent
criterion based on the variables Yi:
TPD?(~Y ) = 1 +Nc∑i=1
Yi(lnYi + ln φi − hi − 1) ≤ 0 (2.53)
The equivalence is shown as follows. Stationarity of TPD∗ requires
∂TPD∗
∂Yi= 0 (2.54)
which yields the same criterion of stability as TPD:
lnYi + ln φi − hi = 0 (2.55)
In summary, the phase stability is inferred by the conditions, which can be derived
from the stationary point of TPD∗ :
Nc∑i=1
Yi > 1→ unstable
Nc∑i=1
Yi ≤ 1→ stable
(2.56)
The stability criterion can be applied on an overall composition as a single phase
to test whether a second phase should be added to the system. It can also be used to
CHAPTER 2. THEORETICAL BASIS 21
test the stability of an equilibrium phase with composition computed by the phase
split equilibrium calculation. In this case, instead of overall composition, the test
composition is the phase composition. Through this method, for a two phase system,
stability analysis can indicate whether a third phase exists.
2.3 Phase Split Calculations
Phase split calculations are performed to determine the amount and composition
of each phase in a Lp phase system. In the case of specific T and P , the solution
corresponds to the global minimum of Gibbs free energy. The unknown variables are
the mole fraction of the component i in phase j, xij, and the amounts of each phase
Fj given as the ratio of mole number in a phase to the total mole number of the
mixture. In total, there are Lp + LpNc unknowns.
Two methods of phase split calculations are explained as follows. The first method
is based on fugacity equivalence, with the SSI method implemented, which is aimed
at providing good initial estimates for later calculations. After the SSI method,
Newton’s method is applied, with the purpose of finding the minimum of Gibbs free
energy of the system.
2.3.1 Fugacity in Phase Equilibrium
Considering the fact that there are some constraints of these unknown variables, we
need not calculate all the variables at the same time. As for each phase composition
Nc∑i=1
xij = 1 j = 1, 2, ..., Lp (2.57)
CHAPTER 2. THEORETICAL BASIS 22
The phase distribution is constrained by
Lp∑j=1
Fj = 1 (2.58)
The overall composition can be derived as
zi =
Lp∑j=1
xijlj i = 1, 2, ..., Nc (2.59)
These three constraints reduce the number of independent variables by Lp−1, 1, and
Nc, respectively. The number of independent variables can be reduced to Nc(Lp− 1).
The K value for component i is defined as the ratio of mole fraction of component i
in one phase to that in the reference phase
Kj1 =xijxi1
i = 1, 2, ..., Nc (2.60)
There are Nc(Lp−1) equations, which can be used to calculate Nc(Lp−1) independent
variables.
In the three phase system, we consider the liquid phase as the reference phase.
Referring to Eq.(2.57) and (2.60), the RR equations can be generated:
Nc∑i=1
(xiv − xil) =∑i
(Kiv − 1)ziFl + FvKiv + FwKi,w
= 0 (2.61)
Nc∑i=1
(xiw − xil) =∑i
(Kiw − 1)ziFl + FvKiv + FwKi,w
= 0 (2.62)
where Fl, Fv and Fw denote phase fractions for the liquid, vapor and aqueous phases,
respectively.
CHAPTER 2. THEORETICAL BASIS 23
Then we can calculate phase compositions with the following equations:
xiw =Kiwzi
Fl + FvKiv + FwKi,w
i = 1, ..., Nc (2.63)
xiv =Kivzi
Fl + FvKiv + FwKi,w
i = 1, ..., Nc (2.64)
xil =zi
Fl + FvKiv + FwKi,w
i = 1, ..., Nc (2.65)
For the three phase equilibrium system, the fugacity of component i in each of
the three phases must be equal:
f vi = f li i = 1, ..., Nc (2.66)
fwi = f li i = 1, ..., Nc (2.67)
where f ji represents the fugacity of component i in the j (L,W, V ) phase. To solve
the problem, K values will be updated by fugacity coefficients:
Kiv =φli
φvii = 1, ..., Nc (2.68)
Kiw =φli
φwii = 1, ..., Nc (2.69)
The constraint of fugacity equivalence is applied in our algorithm with the SSI
method, while minimization of Gibbs free energy is conducted and achieved with
Newton’s method and TR method .
2.3.2 Gibbs Free Energy Minimization
For Newton’s method and the TR method, the phase split calculation is considered as
an optimization problem: to achieve the minimum of Gibbs free energy of the system.
CHAPTER 2. THEORETICAL BASIS 24
It implies the system is most stable, which means it is in equilibrium.
The Gibbs free energy for one phase system can be calculated:
G
nRT=
Nc∑i=1
xi ln fi (2.70)
where xi is the mole fraction of component i in that phase.
Considering the isothermal condition, we ignore nRT and consider G = GnRT
. The
Gibbs free energy of three phase system is
G = Gl + Gv + Gw
=Nc∑i=1
nli ln fli +
Nc∑i=1
nvi ln f vi +Nc∑i=1
nwi ln fwi
(2.71)
where nli, nvi and nwi are mole numbers of components i in the liquid, vapor and
aqueous phase, respectively, with the total mole number being 1 mol, which leads to
Nc∑i=1
nli = Fl
Nc∑i=1
nvi = Fv
Nc∑i=1
nwi = Fw
(2.72)
Fl + Fv + Fw = 1 (2.73)
zi = nli + nvi + nwi i = 1, 2, ..., Nc (2.74)
At points corresponding to the local minimum, all the first partial derivatives of
Eq.(2.71) with respect to the independent mole numbers are zero, and the matrix of
second partial derivatives, or the Hessian matrix, is positive definite.
CHAPTER 2. THEORETICAL BASIS 25
Here we set nvi and nwi as independent variables. Based on mass balance, the
relation of mole numbers is
nli = zi − nvi − nwi i = 1, 2, ..., Nc (2.75)
Differentiating Eq.(2.71) on the independent mole numbers gives
gvi =∂G
∂nvi=
Nc∑k=1
ln f vk∂nvk∂nvi
+Nc∑k=1
nvk∂ ln f vk∂nvi
+Nc∑k=1
ln f lk∂nlk∂nvi
+Nc∑k=1
nlk∂ ln f lk∂nvi
+Nc∑k=1
ln fwk∂nwk∂nvi
+Nc∑k=1
nwk∂ ln fwk∂nvi
(2.76)
gwi =∂G
∂nvi=
Nc∑k=1
ln f vk∂nvk∂nwi
+Nc∑k=1
nvk∂ ln f vk∂nwi
+Nc∑k=1
ln f lk∂nlk∂nwi
+Nc∑k=1
nlk∂ ln f lk∂nwi
+Nc∑k=1
ln fwk∂nwk∂nwi
+Nc∑k=1
nwk∂ ln fwk∂nwi
(2.77)
Considering the independent variables
∂nwk∂nvi
= 0∂nvk∂nwi
= 0 i, k = 1, 2, ..., Nc (2.78)
∂nlk∂nvi
= −δki∂nlk∂nwi
= −δki i, k = 1, 2, ..., Nc (2.79)
∂nvk∂nvi
= δki∂nwk∂nwi
= δki i, k = 1, 2, ..., Nc (2.80)
where δki is the Kronecker delta function.
From the Gibbs-Duhem equation
Nc∑k=1
npk∂ ln fpk∂nqi
= 0 p, q = 1, 2, ..., Lp (2.81)
CHAPTER 2. THEORETICAL BASIS 26
Substituting these results into Eq.(2.71), the first order derivative becomes ~g =
[ ~gv, ~gw]:
gvi = ln f vi − ln f li i = 1, 2, ..., Nc (2.82)
gwi = ln fwi − ln f li i = 1, 2, ..., Nc (2.83)
The elements of the Hessian matrix are the second order derivatives of Gibbs free
energy. The Hessian matrix is
H =∂~g
∂~n=
∂−→gv∂−→niv
∂−→gw∂−→niv
∂−→gv∂−−→niw
∂−→gw∂−−→niw
(2.84)
Elements of H are
∂gvi∂nvj
=1
f vi
∂f vi∂nvj
+1
f li
∂f li∂nlj
i, j = 1, 2, ..., Nc
∂gwi∂nvj
=1
f li
∂f li∂nlj
i, j = 1, 2, ..., Nc
∂gvi∂nwj
=1
f li
∂f li∂nlj
i, j = 1, 2, ..., Nc
∂gwi∂nwj
=1
fwi
∂fwi∂nwj
+1
f li
∂f li∂nlj
i, j = 1, 2, ..., Nc
(2.85)
Detailed expressions of the first order and second order derivatives are provided in
Appendix D
In summary, the minimization of Gibbs free energy involves minimizing Eq.(2.71)
with mole numbers nvi and nwi as variables. A point is at least a local minimum if
the first derivative ~g, Eq.(2.82) and (2.83), is zero and the Hessian matrix Eq.(2.84)
is positive definite at the point.
The key constraint in phase split calculations with the SSI method is fugacity
equivalence. The algorithm then switches to an optimization approach to calculate
CHAPTER 2. THEORETICAL BASIS 27
the minimum of Gibbs free energy of the system. Specific steps of the numerical
implementation are provided in Chapter 3.
Chapter 3
Numerical Implementation
In our approach, both stability analysis and flash calculations are performed and
calculated using the SSI and Newton’s method. The Trust Region (TR) method is
used when needed. In the beginning of solving multiphase equilibrium equations,
the SSI method gives a fast speed of convergence and provides a correct direction,
which ensures robustness. However, the SSI method can become slow when close to
the solution. As for Newton’s method, it requires a good initial guess. However,
compared to the SSI method, the Newton’s method is more likely to fail. This is
especially the case in the region near the critical point. If Newton’s method fails, we
switch to the TR method, which is stable and robust, and can guarantee physical
results.
The combined SSI-Newton-TR approach that we have developed takes advantage
of the robustness of the SSI method and the fast convergence speed of Newton’s
method. Moreover, the SSI method provides a good initial guess for Newton’s method.
In this chapter, we explain how to estimate initial K values and discuss applications
of the SSI method, Newton’s method and the TR method. Then, our own combined
SSI-Newton-TR algorithm designed to determine the number of phases and phase
compositions in the equilibrium system will be illustrated.
28
CHAPTER 3. NUMERICAL IMPLEMENTATION 29
3.1 Initial Guesses of K values
In stability analysis, local minimization of the TPD function has a strong dependency
on the initial guess of the trial phase compositions ytriali or more practically, the
equilibrium ratios Kiv and Kiw. Improper initialization may miss some stationary
points and lead to failure in detecting instability. Moreover, in our algorithm, stability
analysis provides K values for initiation of the phase split calculations. Inappropriate
initial K values for stability test may result in failing to solve phase flash equations.
To overcome this intrinsic shortcoming, we need to use multiple initial K value es-
timates. For the system with only liquid and vapor phases, {Kwilsoni } and {1/Kwilson
i }
often provide good initial guesses for stability analysis. The Wilson correlation is
given as
KWilsoni =
PciP
exp[5.37(1 + ωi)(1−TciT
)] (3.1)
where Tci, Pci, ωi are the critical temperature, critical pressure and acentric factor of
component i. {Kwilsoni } and {1/Kwilson
i } are usually applied in commercial simulation
software.
However, when there is more than one liquid phase, {Kwilsoni } and {1/Kwilson
i }
become unreliable and may fail to detect instability. Michelsen suggested the trial
phase could be assumed to be a pure substance [24]. On the basis of Michelsen’s
suggestion, Li and Firoozabadi proposed that the initial fraction of one component
is 90 mol% and the other (Nc− 1) components equally share the remaining 10 mol%
in the trial phase [17]:
Kpurei = 0.9/ztesti ,
Kpurej = 0.1/[(Nc − 1)ztestj ] (j 6= i)
(3.2)
They also proposed initial estimates as { 3√Kwilsoni } and {1/ 3
√Kwilsoni } which can
CHAPTER 3. NUMERICAL IMPLEMENTATION 30
increase the possibility of selecting appropriate initial K values.
We tested various cases with CO2 injection and gas solubility in water. We find
that four sets of K values, {Kpurewater}, {K
pureCO2}, {Kwilson
i } and {1/Kwilsoni }, are enough
to provide us good estimates to detect the global minimum values. Other K values are
not used in our algorithm to increase efficiency. Here as for {Kpurewater} and {Kpure
CO2}, the
mole fraction of water and CO2 are 99 mol%, and the remaining components equally
share 1 mol%
In our method, for V −L stability analysis, we only use {Kwilsoni } and {1/Kwilson
i }
as our initial estimates. For L−W and V −W stability test, we test {Kpurewater}, {K
pureCO2},
{Kwilsoni } and {1/Kwilson
i }.
If for all tested K values, TPD values are positive at stationary points, we regard
the system as stable. Otherwise, if at least one TPD is negative, the system is
unstable. The K values corresponding to the smallest TPD are selected as initial
estimates for the phase split calculation.
3.2 Successive Substitution Iteration Method
The SSI method does not require the calculation of derivatives, making individual it-
erations fast. However, SSI has a low speed of convergence (linear convergence) while
getting close to the solution, compared to quadratic convergence methods. There-
fore, Newton’s method will be applied after the SSI method if the residual term is
smaller than the switching criterion. In this section, applications of the SSI method
in stability analysis and phase split calculations are illustrated.
3.2.1 SSI Method in Stability Analysis
In the subsection, we will introduce L −W and L − V stability analysis, where L
refers to the hydrocarbon oil phase, W represents the aqueous phase, and V is denotes
CHAPTER 3. NUMERICAL IMPLEMENTATION 31
the vapor phase. V −W stability analysis is exactly the same as L −W , because
components in L and V all use the same EOS to compute the fugacity coefficients.
After phase flash calculations, we will determine whether the non-aqueous phase is
liquid or vapor, based on its properties.
In stability test, firstly, we need to determine which phase is the trial phase. If the
feed mole fraction of the water component is larger than 50%, we consider the aqueous
phase as the reference phase and the liquid phase as the trial phase. Otherwise, if
the feed mole fraction is smaller than 50%, the aqueous phase is regarded as the trial
phase.
SSI for liquid and aqueous phases
Procedures are as follows:
1. Calculate initial K-values: {Kwilsoni }, {1/Kwilson
i }, {KpureCO2}, and {Kpure
H2O}.
2. Compute the composition of the trial phase:
Yi = ziKi
yi =YiNc∑i=1
Yi
(3.3)
3. Calculate fugacity coefficients of components in the aqueous and liquid phase with
Henry’s law and EOS, respectively, referred to the Eq.(2.39) and (2.36).
4. Calculate the residual term:
ri = lnYi + ln φ(yi)− hi (3.4)
where hi = ln zi + ln φi(~z). Here Yi and φ(yi) are related to the trial phase.
5. If norm of the residual vector is smaller than the criterion of switching the SSI
CHAPTER 3. NUMERICAL IMPLEMENTATION 32
method to Newton iterations, ||~r|| < ε1, we stop SSI and start Newton iterations;
Otherwise, we update variables and go back to Step 2:
Yi =φ(zi)Zi
φ(yi)
Ki =φ(zi)
φ(yi)
(3.5)
SSI Method for liquid and vapor phases
For stability analysis with liquid and vapor phase, procedures are as follows:
1. Calculate initial K values: {Kwilsoni }, {1/Kwilson
i }.
2. Compute the composition of the trial phase.
3. Calculate fugacity coefficients of components in the vapor and liquid phase with
EOS, referred to the Eq.(2.36).
4. Calculate the residual term, referred to Eq.(3.4).
5. If norm of the residual vector is smaller than the criterion of switching SSI to
Newton iterations, ||~r|| < ε1, we stop the SSI method and start Newton iterations;
Otherwise, update variables and go back to Step 4.
The workflow of the SSI method for stability analysis is displayed in Fig.3.1
3.2.2 SSI Method in Phase Split Calculations
There are two phase split and three phase split calculations, whose criteria of equilib-
rium are quite similar, both based on fugacity equivalence for every component. Here
we illustrate the procedures for three phase split calculations. Similar to stability
analysis, there is a criterion value for switching the SSI method to Newton’s method,
too. K values are from last stability analysis.
1. Solve the Rachford-Rice (RR) Equations (see Eq.(2.61) and (2.62)) to calculate
phase fractions V and W with initial K values from stability analysis.
CHAPTER 3. NUMERICAL IMPLEMENTATION 33
Figure 3.1: Workflow of the SSI method for stability analysis
CHAPTER 3. NUMERICAL IMPLEMENTATION 34
2. Calculate three phase compositions {xi}, {yi}, {wi}, in Eq.(2.63), (2.64), and
(2.65)
3. Calculate fugacity for each component in the aqueous phase with Henry’s law:
fwi = Hiwi i = 1, 2, ..., Nc (3.6)
For components in the vapor and liquid phase, based on Eq.(2.36), the fugacity can
be derived:
f li = φlixiP i = 1, 2, ..., Nc
f vi = φvi yiP i = 1, 2, ..., Nc
(3.7)
4. Calculate the residual vector and its Euclidean norm, and check whether it is
smaller than the switching criterion. The residual vector is composed of two parts:
the residual term of the aqueous phase and of the vapor phase, with the liquid as the
reference phase, ~r = [ ~rv, ~rw].
rvi = f vi − f li i = 1, 2, ..., Nc
rwi = fwi − f li i = 1, 2, ..., Nc
(3.8)
If it is larger than the switching criterion ||~r|| > ε1, we update variables and go back
to step 2. Otherwise, Newton’s method is started.
Kvi =
φli
φvii = 1, 2, ..., Nc
Kwi =
φli
φwii = 1, 2, ..., Nc
(3.9)
The workflow of the SSI method for phase split calculations is displayed in Fig.3.2
CHAPTER 3. NUMERICAL IMPLEMENTATION 35
Figure 3.2: Workflow of the SSI method for phase split calculations
3.3 Newton’s Method
In numerical analysis, Newton’s method, is a method for finding successively better
approximations with quadratic convergence. The solution is updated by the following
equation:
xn+1 = xn −f(xn)
f ′(xn)(3.10)
where f ′(xn) denotes the derivative of f(x), and x is the solution for f(x) = 0. In
the optimization problems, function f(x) is the derivative of the objective function,
for optimal value always at stationary points.
For Newton’s method, we must have good initial guesses to guarantee convergence.
Moreover, it requires to calculate derivatives directly, which may result in divergence
if the Hessian matrix of the objective function is ill-conditioned. In this case, the TR
method is applied to solve the optimization problem, which will be illustrated in the
CHAPTER 3. NUMERICAL IMPLEMENTATION 36
next section.
Minimization of the TPD function, and of Gibbs free energy are conducted by
Newton iterations for stability analysis and phase split calculations, respectively.
3.3.1 Newton’s Method for Stability Analysis
The optimization problem for stability analysis is to find the minimum of the TPD
function (Eq.(2.53). The stationarity of the TPD function can be calculated by the
first-order derivative equaling to zero (Eq.(2.55)), which is the residual term ~r. The
derivative of ~r are calculated based on variables {Yi}. Newton iterations will not be
stopped until convergence is achieved.
K values and initial variables for Newton’s method are from the previous SSI
method. Procedures are as follows:
1. Initialize K values and variables from the SSI method.
2. Compute the composition of the trial phase in Eq.(3.3)
3. Calculate fugacity coefficients of components in the aqueous phase and in the
liquid phase.
4. Calculate the TPD and the gradient ~g:
TPD = 1 +∑i
Yi(lnYi + ln φ(yi)− hi − 1) (3.11)
gi =∂TPD
∂Yi= lnYi + ln φ(yi)− hi (3.12)
where hi = ln zi + ln φi(~z).
5. If it is converged, ||~g|| < ε, we stop iterations. The minimum of the TPD function
CHAPTER 3. NUMERICAL IMPLEMENTATION 37
is found. Otherwise, we update variables and go back to Step 2:
H =∂~g
∂Yi
− ~g =−→δY ·H
−−→Yn+1 =
−→Yn +
−→δY
(3.13)
Calculations of derivatives for stability analysis are attached in Appendix C. The
workflow of Newton’s method for stability analysis is displayed in Fig.3.3
Figure 3.3: Workflow of Newton’s method for stability analysis
3.3.2 Newton’s method for Phase Split Calculations
For Newton’s method, we solve the problem of minimization of Gibbs free energy. The
residual vector is the first derivatives of Gibbs free energy ~g = [−→gv,−→gw] in Eq.(2.82)
CHAPTER 3. NUMERICAL IMPLEMENTATION 38
and (2.83), and the convergence is achieved if
||~g|| < ε (3.14)
The steps required are given by the following:
1. Initialize K values, phase fractions and composition from the previous SSI method.
2. Compute the independent variables nvi and nwi which are mole numbers in each
phase:
nvi = yi · V
nli = xi · L
nwi = wi ·W
(3.15)
3. Calculate the gradient vector ~g, the first-order derivative in Eq.(2.82) and (2.83),
and check whether the norm of the gradient vector is smaller than the convergence
criterion
4. If it is converged, we will examine whether the solution is physical and stop.
5. If it is not converged, its Hessian matrix H given in Eq.(2.84), will be calculated.
Solve the equations to get the step to update:
~g = −Hd−→n (3.16)
where ~g = [−→gv,−→gw] and d~n = [d−→niv, d
−−→niw]
6. Update variables and go back to Step 3:
nvi = nvi + dnvi
nwi = nwi + dnwi
nli = zi − nvi − nwi
(3.17)
CHAPTER 3. NUMERICAL IMPLEMENTATION 39
∑i
nli = L∑i
nvi = V∑i
nwi = W (3.18)
xi =nliL
yi =nviV
wi =nwiW
(3.19)
The workflow of Newton’s method for phase split calculations is displayed in
Fig.3.4
Figure 3.4: Workflow of Newton’s method for phase split calculations
CHAPTER 3. NUMERICAL IMPLEMENTATION 40
3.4 Trust Region Method
3.4.1 Introduction to Trust Region Method
The resolutions of phase stability analysis and the multiphase flash problem require
the minimization of the tangent plane distance (TPD) [24] and of the Gibbs free en-
ergy, respectively [25]. Traditionally, the first-order method, the SSI method, is per-
formed. After being able to provide good initial guesses, the SSI method is switched
to the second-order Newton’s method. In most cases, Newton’s method works very
well and converges to the solution after several iterations. However, in the vicinity of
singularities, the region near critical points for multiphase flash calculations, Newton
iterations become very slow and have difficulties to converge. The condition number
of the Hessian matrix is extremely high.
The Trust Region method firstly defines a region around the current best solu-
tion, in which a certain model (usually a quadratic model) can be the appropriate
representation of objective function. Then, it chooses a step forward to minimize the
model within the region. Unlike the line search methods, the Trust Region method
usually determines the step size before the descent direction.
The TR method approximates the objective function by a quadratic function,
based on Taylor’s expansion shown below:
min. f(xk + s) = f(xk) +5f(xk)Ts +1
2sTBks (3.20)
s.t. ||s|| ≤ 4k (3.21)
where gk = 5f(xk) is the gradient of f(xk), and Bk = 52f(xk) being the Hessian
matrix.
In the TR method, the trust region forms a finite closed set, specified by (3.21),
and the Hessian matrix is corrected to be positive definite by adding a diagonal
CHAPTER 3. NUMERICAL IMPLEMENTATION 41
element Hk = Bk + λI. Using an approximation of the Hessian Bk by Hk, one gets
min. f(xk + s) = f(xk) +5f(xk)Ts +1
2sTHks (3.22)
Solving the TR subproblem means finding the minimum:
min||s||≤4k
mk(s) = 5f(xk)Ts +1
2sTHks (3.23)
which is equivalent to solving the problem for
(Bk + λI)s = −g (3.24)
λ(4− ||s||) = 0 (3.25)
(Bk + λI) is positive semidefinite (3.26)
How to solve the TR subproblem is explained in the next subsection.
Another critical issue is to update the size of the trust region 4k, which depends
on the ratio between the actual reduction gained by true reduction in the original
objective function and the predicted reduction expected in the model function:
ρk =f(xk)− f(xk + sk)
mk(0)−mk(sk)(3.27)
If ρk < 0, this means that f(xk) < f(xk + sk), the step is rejected;
If ρk is small, this means that the size of the trust region should be decreased (the
model is quite different from reality);
If ρk nearly equals 1, the size of the trust region should be extended, since the model
matches the true function very well and better steps can be carried out.
CHAPTER 3. NUMERICAL IMPLEMENTATION 42
The algorithm of the TR method is summarized as follows. 4k is the size of the
trust region in kth step.
1. Give initial values of x0, B0 and initial the trust region size 40. Define the
threshold values for determining the size of the trust region in next step. A typical
size of values are η1 = 0.25, η2 = 0.75, r1 = 0.25, r2 = 2 and γ ∈ [0, 4k
4)
2. Check convergence. If it is converged, the current point xk can be regarded as the
solution. Otherwise, go to step 3.
|| 5 f(xk|| < ε (3.28)
3. Solve the TR subproblem to get ρk
4. Determine the trust region size:
If ρk < 0.25, shrink the trust region size, 4k+1 = 4k
4
If ρk > 0.75, ||sk|| = 4k, expand the trust region size, 4k+1 = 24k
If ρk > γ and λ < κ, update the solution xk+1 = xk + sk. When λ is too high,
the step will be a gradient descent which is smaller than that of an SSI iteration.
Therefore, if λ > κ and ρk < γ, an SSI iteration is performed.
5. Generate Hk+1, and set k = k + 1, go back to step 2
3.4.2 Solutions to Trust Region Subproblems
Several methods of solving the subproblem have been developed so far [5, 51]. In our
cases, calculating eigenvalues to solve the problem is very expensive. However, the
TR method is used infrequently, so efficiency is not very important. Let the equation
solve Hks = g, where Hk = Bk +λI. The procedure of the TR subproblem using the
smallest eigenvalue is described below.
1. Let κ ∈ (0, 1), where κ is the tolerance for the subproblem. Empirically, κ equals
0.1.
CHAPTER 3. NUMERICAL IMPLEMENTATION 43
2. Check whether the Hessian matrix is positive definite. Perform modified Cholesky
LDLT decomposition:
H = LDLT (3.29)
where L is the lower triangular matrix, and D is the diagonal matrix. LT is the
transpose matrix of L, which is an upper triangular matrix. The Hessian matrix is
positive definite if the non-zero elements (diagonal elements) of D are all positive.
If H is positive definite, then set the diagonal correction element λ = 0. Otherwise,
find the smallest eigenvalue λ1, λ = λ1 + ε
3. H = H + λI. Perform Cholesky LLT decomposition.
4. Solve LLTs = −g
5. If ||s|| ≤ 4:
If ||s|| = 4 or λ = 0, stop the TR method. The solution has been found.
If ||s|| < 4, we compute the eigenvector u1 corresponding to λ1 (by QR decomposi-
tion). Find the root α of the equation ||s+αu1||2 = 4 which makes the model m(s)
smallest. s = s + αu1, and stop. The solution has been found.
6. If |||s||2 −4| < κ4, stop.
7. Solve Lω = s and update λk+1 = λk + ( ||s||2−44 )(||s||22||ω||22
).
8. H is corrected by H = H + λI, and factorize H = LLT
9. Solve LLTs = −g and update ||s||2, go back to step 5.
Solving the TR subproblem is not always efficient. If we struggle converge in a
TR subproblem, we can exit and go back to the SSI iteration.
3.4.3 Trust Region Method for Stability Analysis
K values and initial variables for the TR method are from the last iteration of the
SSI method. Procedures are as follows:
CHAPTER 3. NUMERICAL IMPLEMENTATION 44
1. Initialize K values and variables from the SSI method.
2. If the number of iterations is smaller than the maximum number, calculate the
gradient of the objective function:
obj = 1 +∑i
Yi(lnYi + ln φ(yi)− hi − 1) ≤ 0 (3.30)
gi =∂obj
∂Yi(3.31)
where hi = ln zi + ln φi(~z). Check convergence.
If ||~g|| is smaller than the tolerance for convergence, stop the TR method.
3. Calculate the Hessian matrix H.
4. Solve the TR subproblem to update variables:
(H + λI)d~Y + ~g = 0 (3.32)
5. Update variables:
~Ynew = ~Yold + d~Y (3.33)
6. Calculate the new objective function. If objnew > objold, cut the size of the trust
region ∆k.
If objnew < objold, update the size of the trust region based on Eq.(3.27), and go back
to step 2. The workflow of the TR method for stability analysis is displayed in Fig.3.5
3.4.4 Trust Region Method for Phase Split Calculations
K values and initial variables for the TR method are from the last iteration of the
SSI method. Procedures are as follows:
1. Initialize K values and variables from the previous SSI method.
CHAPTER 3. NUMERICAL IMPLEMENTATION 45
Figure 3.5: Workflow of the TR method for stability analysis
2. If the number of iterations is smaller than the maximum number, calculate the
gradient of the objective function:
obj =∑i
nli ln fli +
∑i
nvi ln f vi +∑i
nwi ln fwi (3.34)
gvi =∂obj
∂nvi(3.35)
gwi =∂obj
∂nwi(3.36)
~g = [−→gv,−→gw] −−→nvw = [−→niv,−−→niw] (3.37)
Check convergence. If ||~g|| is smaller than the tolerance for convergence, stop.
3. Calculate the Hessian matrix H
CHAPTER 3. NUMERICAL IMPLEMENTATION 46
4. Solve the TR subproblem to update variables:
(H + λI)d−−→nvw + ~g = 0 (3.38)
5. Update variables:
nivnew = nivold + dniv
niwnew = niwold + dniw
nilnew = zi − nivnew − niwnew
(3.39)
6. Calculate the new objective function.
If objnew > objold, update the size of trust region:
∆k+1 =∆k
4(3.40)
If objnew < objold, update the size of the trust region based on Eq.(3.27), and go back
to step 2. The workflow of the TR method in phase split calculations is displayed in
Fig.3.6
3.5 Algorithm for Multiphase Equilibrium Calcu-
lations
Given the global mole fractions zi, the system can be either single-phase, two-phase
and even three-phase. Considering the fact that for the aqueous phase, we use Henry’s
law instead of an EOS to compute component fugacities.
In our algorithm, firstly we test the stability for the aqueous and the liquid phase.
Regarding the fact that we use the same EOS for vapor and liquid phases, L −W
and V −W stability test are same. Whether it is liquid or vapor will be clarified after
we get the final phase compositions and properties. If through stability analysis for
CHAPTER 3. NUMERICAL IMPLEMENTATION 47
Figure 3.6: Workflow of the TR method for phase split calculations
L −W , we find out the system is stable, it means that there is neither an aqueous
phase nor a liquid phase. If there is no aqueous phase, stability test is performed for
the L− V system with EOS. Otherwise, the system is single aqueous phase.
If we have detected the liquid and aqueous phases existing in the system, two
phase flash is conducted to calculate amounts and compositions of two phases. Then
with mole fractions of components in the liquid phase being the feed composition,
the existence of the vapor phase is checked by conducting stability analysis for the
liquid and the vapor phase. If it is stable, it means that there are two phases, the
liquid and the aqueous, in the system, as the specific pressure , temperature and feed
composition. Otherwise, it means that it is a three phase system, and the three phase
flash should be performed.
However, in our tested cases, we found out sometimes the three phase split calcula-
tion cannot get physical or reasonable results, which are caused by the inappropriate
CHAPTER 3. NUMERICAL IMPLEMENTATION 48
initial guess of K value estimates. As we mentioned before, good initial K values
can lead to convergence to the global minimum. In our cases, we always select the K
values corresponding to smallest TPD as our first choice. The failure in three phase
split calculations can imply two situations. The first one is that we choose the wrong
K values in the L−W stability analysis before the two phase L−W flash. The other
is that improper K values are selected in L − V stability test. As a result, if the
three phase flash fails, we need to go back to these two stability analyses and select
other K values with negative TPD. Usually we choose K values corresponding to the
second smallest TPD value. In a large amount of cases we tested, we find out that
in the first L −W stability analysis, different K values always make the algorithm
converge to the same TPD. So we firstly go back to the L− V stability test to select
other valid K values.
The workflow of our algorithm is illustrated in Figure 3.7
Figure 3.7: Algorithm for multiphase equilibrium calculations
Chapter 4
Results and Analysis
For any overall composition, there can exist a single phase (L, V,W ), two phases
(L−V, V −W,L−W ) or three phases (L−V −W ) in the system. Various cases have
been performed and analyzed to test the feasibility of our algorithm. First we tested a
two phase system with water and gas components to verify the Henry’s law model by
comparing the results with WinProp in CMG. Then we tested cases modified from
SPE3 and SPE5, with carbon dioxide injection and the water component present.
Phase diagrams are generated and analyzed.
4.1 Two Phase case studies
Two cases are tested for a two phase system, using Harvey’s model and Li and
Nghiem’s model. Properties of input components are displayed in Table 4.1, where
MW is molecular weight.
First we computed the case with two components at 366.483K(200F), 137.896bar(2000psi),
with overall composition z[H2O] : z[CO2]=0.5:0.5. Results from our model and from
WinProp, in application of Harvey’s method and Li and Nghiem’s method, are dis-
played in Table 4.2 and Table 4.3 respectively.
49
CHAPTER 4. RESULTS AND ANALYSIS 50
Table 4.1: Properties of input componentsComponent Tc(K) Pc(bar) ω MW (g/mol)
H2O 647.3 220.4832 0.344 18.015CH4 190.6 46.00155 0.008 16.043N2 126.2 33.94388 0.04 28.013CO2 304.3 73.7646 0.225 44.01
Table 4.2: Results of two component system with Harvey’s methodResults Ours WinProp
Component W V W VH2O 0.98395 0.01498 0.98360 0.01493CO2 0.01605 0.98502 0.01640 0.98507
V Fraction 0.499448 0.499244
Table 4.3: Results of two component system with Li and Nghiem’s methodResults Ours WinProp
Component W V W VH2O 0.98306 0.01499 0.98250 0.01498CO2 0.01694 0.98501 0.01750 0.98502
V Fraction 0.498993 0.498696
CHAPTER 4. RESULTS AND ANALYSIS 51
The error is calculated by:
Err =xours − xWinProp
xWinProp
(4.1)
where x is the composition or phase fraction.
For Harvey’s method, we can find out that the largest error is given by CO2 in
the aqueous phase, which equals 2.122%. Other composition errors are around 0.2%,
given in Figure 4.1. Actually the mole fraction of CO2 in the aqueous phase, being
0.0163968, is very small, and the difference of two results are 0.000348 which can be
neglected. We regard the Harvey’s method is acceptable.
Figure 4.1: Errors of the two component system from Harvey’s model
For Li and Nghiem’s method, the largest error is 3.2205%, and the errors for other
mole fractions are less than 0.07%, given in Figure 4.2. We can find out that results
from Harvey’s method have smaller errors.
In addition, we also tested the case with more components at 323.15 K, 50 bar,
with overall composition z[H2O] : z[CH4] : z[N2] : z[CO2]=0.4:0.2:0.2:0.2. Results
CHAPTER 4. RESULTS AND ANALYSIS 52
Figure 4.2: Errors of the two component system from Li and Nghiem’s model
are displayed in Table 4.4 and Table 4.5 respectively.
Table 4.4: Results of four component system with Harvey’s methodResults Ours WinProp
Component W V W VH2O 0.99505 0.00326 0.99500 0.00325CH4 0.00027 0.33317 0.00027 0.33318N2 0.00014 0.33325 0.00014 0.33327CO2 0.00454 0.33032 0.00459 0.33030
V Fraction 0.599976 0.599949
Table 4.5: Results of four component system with Li and Nghiem’s methodResults Ours WinProp
Component W V W VH2O 0.99457 0.00326 0.99465 0.00325CH4 0.00028 0.33327 0.00027 0.33326N2 0.00015 0.33335 0.00015 0.33334CO2 0.00500 0.33012 0.00493 0.33015
V Fraction 0.599783 0.599805
For Harvey’s method, we can find out that the largest error is given by CO2 in
CHAPTER 4. RESULTS AND ANALYSIS 53
the aqueous phase, which equals 1.042%. Errors for other components except water
are around 0.01%, referred to Fig. 4.3.
Figure 4.3: Errors of the four component system from Harvey’s model
For results from Li and Nghiem’s method, provided in Fig.4.4, the largest error
is 2.7502% given by N2 in the aqueous phase, and the error of CO2 in the aqueous
phase is 1.4234%. Considering we will apply the model for CO2 injection for EOR,
the accuracy of CO2 is the factor we should pay most attention to. Harvey’s method
is preferred.
Figure 4.4: Errors of the four component system from Li and Nighem’s model
CHAPTER 4. RESULTS AND ANALYSIS 54
4.2 Three Phase case studies
Cases we tested are modified from SPE3 and SPE5, adding the water component
and CO2. In the study of gas injection for EOR, it is necessary to study the phase
behavior of the reservoir fluid in combination with CO2. We generate the P −x phase
diagram, the axes of which are pressure and the fraction of injected CO2. Pressure
is varied from 2 bar to 250 bar, and CO2 injection fraction ranges from 1% to 99%.
We vary the mole fraction of the water component across a wide range. The
reservoir fluid is combined with water mole fractions of 5%, 10%, 50%, 90%, and
99%. Results are displayed and analyzed in the sections below.
4.2.1 Cases from SPE5
The temperature of tested cases is 344.44K. Components and their properties are
listed in Table 4.6, with the water component fraction being 99 mol% in the reservoir.
Table 4.6: Component properties for cases from SPE5Component Fraction Tc(K) Pc(bar) ω MW (g/mol)
H2O 0.99 647.3 220.4832 0.344 18.015CO2 0.001 304.7 73.8680 0.225 44.01CH4 0.004 190.56 46.0522 0.013 16.043C3H8 0.0003 369.83 42.5058 0.1524 44.097C6 0.0007 507.44 30.1341 0.3007 86.18C10 0.002 617.67 20.9641 0.4885 149.29C15 0.0015 705.56 13.7903 0.65 206C20 0.0005 766.67 11.1721 0.85 282
The phase diagram P − x of 99 mol% water component is shown in Figure 4.5,
where P is the reservoir pressure, and x is the mole fraction of injected CO2 compared
to the total fluids.
CHAPTER 4. RESULTS AND ANALYSIS 55
Figure 4.5: Phase diagram of pressure and injection at z[H2O] = 0.99
First, we look into the situation where there is a significant amount of injected
CO2, in the range from 90% to 99%, where the total amount of water (around 0.99%)
and heavy hydrocarbons (less than 0.01%) is extremely small. When pressure is rel-
atively small, from 2 bar to 50 bar, the system turns out to be V − L two phase.
In this scenario the water component exists in the vapor phase. As pressure rises,
the water component comes out from the vapor phase and forms the aqueous phase,
resulting in a L− V −W three phase system. As pressure continues to rise, compo-
nents, which were previously in the liquid phase, get dissolved in the aqueous phase,
creating a V −W system. Note that the amount of heavy hydrocarbon components
is very small, and it is possible for them to get dissolved in water. The V −W system
is transformed into a L −W system as pressure increases. Finally, two phases mix
together completely and form a single phase system when P is more than 200 bar.
If the fraction of injected CO2 is not very large (around 50 mol%), the effect of
the water component must be taken into consideration and the aqueous phase always
exists. As pressure is increased, components in the liquid phase are first dissolved in
the aqueous phase and the system is in V-W two phase. Then the vapor phase is
condensed and transforms into the liquid phase (L-W system). Considering the large
CHAPTER 4. RESULTS AND ANALYSIS 56
difference of polarity of water and hydrocarbon molecules, it is extremely difficult
to mix them to one phase. That’s why there is no one phase system in the phase
diagram as the amount of injected CO2 is decreased.
When there is only a small quantity of injected CO2, the composition is close to
that of the original reservoir fluid, which exists as a three phase system (V −L−W ).
As pressure rises, the components in the vapor phase are condensed to the liquid and
the system turns out to be two-phase (L −W ). We can find out if there is a small
peak for the three phase region. On either side of this peak, properties of the liquid
and vapor phases are very close.
(a) (b)
(c) (d)
Figure 4.6: Phase diagrams of four different overall water fractions: (a) z[H2O] = 0.9;(b) z[H2O] = 0.5; (c) z[H2O] = 0.1; (d) z[H2O] = 0.01
As water feed composition is decreased to 90%, 50%, 10% and 5%, the phase
diagram is shown in Fig.4.6. It demonstrates that the water component more easily
CHAPTER 4. RESULTS AND ANALYSIS 57
exists as vapor or liquid, thus the V − L region in the diagram becomes larger.
Moreover, as the amount of heavy hydrocarbon is increased and the fraction of water
is decreased, components mix more readily. For this reason, the single phase region
becomes larger, as shown by the blue area in Fig.4.6.
4.2.2 Cases from SPE3
The temperature of tested cases is 294.44K. Components and their properties are
listed in Table 4.7. Fractions in the table for the case of water component being
0.99. The phase diagram P − x with the water component fraction is 99% is shown
Table 4.7: Components properties for cases from SPE3Component Fraction Tc(K) Pc(bar) ω MW (g/mol)
H2O 0.99 647.3 220.4832 0.344 18.015CO2 0.001344 304.7 73.8680 0.225 44.01N2 0.002156 126.2 33.9456 0.04 28.013CH4 0.062211 190.6 46.0409 0.013 16.043C2H6 0.009656 305.43 48.83673 0.0986 30.07C3H8 0.006567 369.8 42.65743 0.1524 44.097C4−6 0.010744 448.08 35.50565 0.21575 66.86942C7+1 0.005272 465.62 28.32348 0.3123 107.77943C7+2 0.001683 587.8 17.06905 0.5567 198.56203C7+3 0.000367 717.72 11.06196 0.91692 335.1979
in Figure 4.7.
First, we look into the situation where the injected CO2 fraction is as large as 99
mol%. The system is three phase across a wide region of pressures, from 2 bar to
70 bar. As pressure is increased, components in the liquid phase come into aqueous
phase and the system contains V −W two phases. Considering the significant amount
of CO2 present, the dew point pressure is low and the system becomes a L−W two
phase system.
As the amount of injected CO2 is decreased, the amount of light hydrocarbon gas
CHAPTER 4. RESULTS AND ANALYSIS 58
Figure 4.7: Phase diagram of pressure and injection at z[H2O] = 0.99
containing CH4, C2H6 and C3H8 becomes larger. The system requires more energy
to change from V − L−W to L−W , which explains why the pressure boundary is
higher than in the case of 99 mol% CO2 injection.
Water feed fraction is decreased from 99 mol% to 90 mol%, 50 mol%, 10 mol%
and 5 mol%. Phase diagrams are displayed in Figure 4.8. These figures demonstrate
that as the injected fraction of CO2 is increased, the water component may exist
in the vapor or liquid phase. Thus, a yellow region appears, representing V − L
behavior. Furthermore, as the amount of heavy hydrocarbon is increased and water
is decreased, the single phase region (blue) appears and becomes larger.
In the cases analyzed above, we can find that the generated phase diagrams are
reasonable and physical. Furthermore, there are no inconsistent points. Moreover, in
our algorithm, the calculation runs properly and is stable even for cases with trace
components. This is evidence that our model is consistent and robust.
CHAPTER 4. RESULTS AND ANALYSIS 59
(a) (b)
(c) (d)
Figure 4.8: Phase diagrams of four different water overall fractions: (a) z[H2O] = 0.9;(b) z[H2O] = 0.5; (c) z[H2O] = 0.1; (d) z[H2O] = 0.01
Chapter 5
Conclusions
This thesis has presented a new robust algorithm for accurate stability analysis and
phase split calculations for CO2 injection and gas solution in water, which has a wide
application in the process of EOR. In this system, hydrocarbon phases are modeled
with the Peng-Robinson EOS, and the aqueous phase is modeled with Henry’s law.
Harvey’s method and Li and Nghiem’s method are used to calculate Henry’s law con-
stants for both CO2 and hydrocarbon components at any temperature and pressure.
In addition, several initial K value estimates were tested and selected to make the
algorithm robust and efficient.
The SSI-Newton-TR numerical method is implemented in our algorithm to ensure
fast convergence. The SSI method provides the correct convergence direction for
later quadratic convergence methods. Newton’s method is applied once the residual
calculated by the SSI method is smaller than the switching criterion. If Newton’s
method fails to converge or has extremely slow speed, the TR method is used. In
addition, in the three phase flash calculation, if the wrong initial K values are selected
and the three phase flash fails, the algorithm will go back to L− V stability analysis
results and choose new K values with negative TPD and perform the three phase flash
again. If all K values with negative TPD in L−V stability analysis are explored but
60
CHAPTER 5. CONCLUSIONS 61
no physical results of three phase flash are achieved, the algorithm will go back to
L−W stability analysis, select other K values and continue. If all feasible K values
are tested but no physical three phase state is realized, the system is two-phase.
To verify our algorithm, various cases were tested with different water fractions
and CO2 injection amounts. We first tested two phase cases and compared the results
with WinProp. Then, we tested modified cases from SPE3 and SPE5 and the phase
diagrams were presented in Chapter 4. The results of these tested cases demonstrate
that our algorithm is robust and accurate. The phase boundaries are smooth and con-
sistent, and there are no abnormal points in any phase or phase boundary. The phase
transitions are physical and reasonable. In addition, computations of our algorithm
are very efficient and stable, and there is no abnormal break during computations.
In this thesis, the tested cases demonstrate that multiphase equilibrium calcula-
tions with gas solubility in water are tractable by the algorithm we have presented
This robust algorithm performs efficiently and accurately and can be used in compu-
tational simulators for gas injection and EOR.
Appendix A
Solutions of Cubic Equations
Appendix A describes how we solve the cubic equation, which is used to the calcula-
tion compressibility factor in EOS.
Consider the following cubic equation:
y3 + py2 + qy + r = 0 (A.1)
It is reduced to
x3 + ax+ d = 0 (A.2)
via the substitution y = x− p/3.
Then the coefficients α and β are defined as
α =3q − p2
3β =
2p3 − 9pq + 27r
27(A.3)
Given A and B by
A = [−β2
+
√β2
4+α3
27]1/3 B = [
−β2−√β2
4+α3
27]1/3 (A.4)
62
APPENDIX A. SOLUTIONS OF CUBIC EQUATIONS 63
The roots are
x1 = A+B
x2 = −A+B
2+A−B
2
√−3
x3 = −A+B
2− A−B
2
√−3
(A.5)
Appendix B
Derivatives of the Fugacity
Coefficient on Compositions
The equation of fugacity coefficient for component i in the mixture is
ln φi =bib
(Z − 1)− ln(Z −B) +A
2√
2B(bib−
2nc∑j=1
yiaij
a) ln
Z + (√
2 + 1)B
Z − (√
2− 1)B(B.1)
with expressions:
aij = (1− kij)√aiaj i, j = 1, ..., nc (B.2)
ai = 0.45724Pr,iT 2r,i
[1 + κi(1− T 0.5r,i )]2 (B.3)
bi = 0.07780Pr,iTr,i
(B.4)
a =nc∑i=1
nc∑j=1
yiyjaij (B.5)
b =nc∑i=1
yibi (B.6)
64
APPENDIX B. DERIVATIVES OF THE FUGACITY COEFFICIENT ON COMPOSITIONS65
A =ap
R2T 2(B.7)
B =bp
RT(B.8)
From cubic equation,
Z3 − (1−B)Z2 + (A− 3B2 − 2B)Z − (AB −B2 −B3) = 0 (B.9)
from which we can derive ∂Z∂yi
, with ∂Z∂A
, ∂Z∂B
:
∂Z
∂yi=∂Z
∂A
∂A
∂yi+∂Z
∂B
∂B
∂yi(B.10)
∂A
∂yi=
2p
R2T 2Si
∂B
∂yi=
p
RTbi (B.11)
where Si =nc∑j=1
yjaij.
Let Sai =
nc∑j=1
yjaij
nc∑i=1
nc∑j=1
yiaij
and Sbi = binc∑i=1
yibi
Finally the expression of ∂ ln φi(~y)∂yk
can be written as
∂ ln φi(~y)
∂yk= D1 +D2 +D3 +D4 (B.12)
D1 = Sbi(∂Z
∂yk− Sbk(Z − 1))− (
∂Z
∂yk− ∂B
∂yk)/(Z −B) (B.13)
D2 =−1
2√
2B(∂A
∂yk− ∂B
∂yk
A
B)(
2Sai − Sbiln[(Z + (
√2 + 1)B)/(Z − (
√2− 1)B)]
) (B.14)
APPENDIX B. DERIVATIVES OF THE FUGACITY COEFFICIENT ON COMPOSITIONS66
D3 =−A
2√
2B(
2aiknc∑i=1
nc∑k=1
yiaki
− 4SaiSak + SbiSbk) ln[(Z + (√
2 + 1)B)/(Z − (√
2− 1)B)]
(B.15)
D4 =A
B(2SaiSbi)(
∂B
∂yk− B∂Z
∂yk)/(Z2 + 2ZB −B2) (B.16)
Appendix C
Derivatives of Stability Analysis
In stability analysis, minimum of TPD should be calculated to determine whether
the system is stable:
TPD(~Y ) = 1 +Nc∑i=1
Yi(lnYi + ln φ(yi)− hi − 1) ≤ 0 (C.1)
where hi = ln zi + ln φi(~z). At stationary points, the first order derivatives equal to
zero, which we can get the residual term as
gi =∂TPD
∂Yi= lnYi + ln φi(~y)− hi i = 1, 2, ...Nc (C.2)
The Jacobian matrix of residual vector, which is also the Hessian matrix for objective
function TPD, can be calculated as
J [i][i] =∂gi∂Yj
=δijY [i]
+∂ ln φi∂Yj
(C.3)
If the aqueous phase is the reference phase, the trial phase must be liquid or vapor
phase, which applies EOS to calculate fugacity coefficient. As we know the relation
67
APPENDIX C. DERIVATIVES OF STABILITY ANALYSIS 68
yi = Yi∑i=1
Yi, the derivative can be written as
∂ ln φi∂Yj
=
∂ ln φi∂yj−
Nc∑k=1
yk∂ ln φi∂yk
Nc∑i=1
Yi
(C.4)
where how to calculate ∂ ln φi∂yk
is explained in Appendix B
If liquid or vapor phase is the reference phase and aqueous phase is regarded as
trial phase, fugacity coefficient is calculated with Henry’s law. Considering the fact
that the Henry’s law constant is only dependent on temperature and pressure, the
derivatives on the mole fraction equal zero.
J [i][i] =∂gi∂Yj
=δijY [i]
(C.5)
Appendix D
Derivatives of Phase Split
Calculations
As we introduced in the chapter of theory basis, we apply two methods to perform
phase flash calculations. In the Newton’s method and TR method, phase flash is an
optimization problem, calculating the minimum of Gibbs free energy. The objective
function is G = GnRT
,
G =Nc∑i=1
nli ln fli +
Nc∑i=1
nvi ln f vi +Nc∑i=1
nwi ln fwi (D.1)
The first derivatives can be regarded as the residual vector in the Newton iteration:
gvi = ln f vi − ln f li (D.2)
gwi = ln fwi − ln f li (D.3)
where ~g = [ ~gv, ~gw].
The Jacobian matrix of the residual vector, which is the Hessian matrix for the
69
APPENDIX D. DERIVATIVES OF PHASE SPLIT CALCULATIONS 70
objective function:
H =∂~g
∂~n=
∂−→gv∂−→nv
∂−→gw∂−→nv
∂−→gv∂−→nw
∂−→gw∂−→nw
(D.4)
Elements of H are∂gvi∂nvj
=1
f vi
∂f vi∂nvj
+1
f li
∂f li∂nlj
∂gwi∂nvj
=1
f li
∂f li∂nlj
∂gvi∂nwj
=1
f li
∂f li∂nlj
∂gwi∂nwj
=1
fwi
∂fwi∂nwj
+1
f li
∂f li∂nlj
(D.5)
In above equations, the liquid phase is regarded as reference. For vapor and aqueous
phase, we use EOS and Henry’s law to calculate the fugacity, respectively. Primary
variables are nvi and nwi , and secondary variables nli = zi − nvi − nwi .
For components in vapor phase:
∂f vi∂nvj
=∂f vi∂yi
∂yi∂nvj
(D.6)
∂yi∂nvj
=δij − yiV
(D.7)
Considering the equation of fugacity f vi = yiφiP , we can derive
∂f vi∂yi
= φiP + yiφiP∂ ln φi∂yi
(D.8)
Thus we can derive the expression of fugacity derivatives:
∂f vi∂nvj
= [φiP + yiφiP∂ ln φi∂yi
−Nc∑k=1
yk(δikφiP + yiφiP∂ ln φi∂yk
)]1
V(D.9)
APPENDIX D. DERIVATIVES OF PHASE SPLIT CALCULATIONS 71
How to calculate ∂ ln φi∂yi
can be found in Appendix B
For components in aqueous phase:
∂fwi∂nwj
=∂fwi∂wi
∂wi∂nwj
(D.10)
∂wi∂nwj
=δij − wiW
(D.11)
Considering the equation of fugacity fwi = wiHi, we can derive
∂fwi∂wi
= Hi (D.12)
Thus we can derive the expression of fugacity derivatives:
∂fwi∂nwj
=(δij − wi)Hi
W(D.13)
Nomenclature
Abbreviations
EOR enhanced oil recovery
EOS equation of state
RR Rachford-Rice
SSI successive substitute iteration
TPD tangent plane distance
TR trust region
Variables
f li fugacity of component i in liquid phase
f vi fugacity of component i in vapor phase
fwi fugacity of component i in aqueous phase
G Gibbs free energy
~g derivative of objective function
H Hessian matrix
72
APPENDIX D. DERIVATIVES OF PHASE SPLIT CALCULATIONS 73
L liquid phase
Lp number of phases
Nc number of components
nli mole fraction of component i in liquid phase compared to total mole value in
the system
nvi mole fraction of component i in vapor phase compared to total mole value in
the system
nwi mole fraction of component i in aqueous phase compared to total mole value
in the system
P pressure
Pc critical pressure
P SH2O
water saturation pressure
Pr reduced pressure
T temperature
Tc critical temperature
Tr reduced temperature
V vapor phase
W aqueous phase
wi mole composition in aqueous phase
xi mole composition in liquid phase
APPENDIX D. DERIVATIVES OF PHASE SPLIT CALCULATIONS 74
yi mole composition in vapor phase
zi feed mole composition
Greek
δij Kronecker delta function
∆k size of trust region in kth step
ε convergence tolerance
φ fugacity coefficient
ω acentric factor
µ chemical potential
Bibliography
[1] MN Ammar and H Renon. The isothermal flash problem: new methods for phase
split calculations. AIChE journal, 33(6):926–939, 1987.
[2] Lee E Baker, Alan C Pierce, Kraemer D Luks, et al. Gibbs energy analysis of
phase equilibria. Society of Petroleum Engineers Journal, 22(05):731–742, 1982.
[3] Ronald J Bakker. Package fluids 1. computer programs for analysis of fluid inclu-
sion data and for modelling bulk fluid properties. Chemical Geology, 194(1):3–23,
2003.
[4] Lawrence Nicholas Canjar and Francis S Manning. Thermodynamic properties
and reduced correlations for gases. Gulf Pub Co, 1967.
[5] Andrew R Conn, Nicholas IM Gould, and Philippe L Toint. Trust region methods.
SIAM, 2000.
[6] Julio E Garcia. Density of aqueous solutions of co2. Lawrence Berkeley National
Laboratory, 2001.
[7] Rajeev Gautam and Warren D Seider. Computation of phase and chemical
equilibrium. AIChE Journal, 25(6):991–1015, 1979.
[8] Allan H Harvey. Semiempirical correlation for henry’s constants over large tem-
perature ranges. AIChE journal, 42(5):1491–1494, 1996.
75
BIBLIOGRAPHY 76
[9] Allan H Harvey and JMH Sengers. Correlation of aqueous henry’s constants
from 0 c to the critical point. AIChE journal, 36(4):539–546, 1990.
[10] Kjetil B Haugen, Abbas Firoozabadi, and Lixin Sun. Efficient and robust three-
phase split computations. AIChE Journal, 57(9):2555–2565, 2011.
[11] Robert A Heidemann. Three-phase equilibria using equations of state. AIChE
Journal, 20(5):847–855, 1974.
[12] Robert A Heidemann and John M Prausnitz. Equilibrium data for wet-air ox-
idation. water content and thermodynamic properties of saturated combustion
gases. Industrial & Engineering Chemistry Process Design and Development,
16(3):375–381, 1977.
[13] Ernest Justus Henley and Edward M Rosen. Material and energy balance com-
putations. John Wiley & Sons, 1969.
[14] Hussein Hoteit and Abbas Firoozabadi. Simple phase stability-testing algorithm
in the reduction method. AIChE journal, 52(8):2909–2920, 2006.
[15] Kenneth Levenberg. A method for the solution of certain non-linear problems in
least squares. Quarterly of applied mathematics, 2(2):164–168, 1944.
[16] Yau-Kun Li and Long X Nghiem. Phase equilibria of oil, gas and water/brine
mixtures from a cubic equation of state and henry’s law. The Canadian Journal
of Chemical Engineering, 64(3):486–496, 1986.
[17] Zhidong Li, Abbas Firoozabadi, et al. General strategy for stability testing and
phase-split calculation in two and three phases. SPE Journal, 17(04):1–096,
2012.
BIBLIOGRAPHY 77
[18] Angelo Lucia, DC Miller, and Ashwani Kumar. Thermodynamically consistent
quasi-newton formulae. AIChE journal, 31(8):1381–1388, 1985.
[19] Kraemer D Luks, Patrick D Fitzgibbon, and Julius T Banchero. Correlation of
the equilibrium moisture content of air and of mixtures of oxygen and nitrogen for
temperatures in the range of 230 to 600 k at pressures up to 200 atm. Industrial
& Engineering Chemistry Process Design and Development, 15(2):326–332, 1976.
[20] EW Lyckman, CA Eckert, and JM Prausnitz. Generalized reference fugacities for
phase equilibrium thermodynamics. Chemical Engineering Science, 20(7):685–
691, 1965.
[21] Donald W Marquardt. An algorithm for least-squares estimation of nonlin-
ear parameters. Journal of the society for Industrial and Applied Mathematics,
11(2):431–441, 1963.
[22] Petitfrere Martin. EOS based simulations of thermal and compositional flows in
porous media. PhD thesis, Pau, 2014.
[23] Rakesh K Mehra, Robert A Heidemann, Khalid Aziz, et al. Computation of mul-
tiphase equilibrium for compositional simulation. Society of Petroleum Engineers
Journal, 22(01):61–68, 1982.
[24] Michael L Michelsen. The isothermal flash problem. part i. stability. Fluid phase
equilibria, 9(1):1–19, 1982.
[25] Michael L Michelsen. The isothermal flash problem. part ii. phase-split calcula-
tion. Fluid Phase Equilibria, 9(1):21–40, 1982.
[26] Michael Locht Michelsen, Jørgen Mollerup, and Martin Peter Breil. Thermody-
namic models: Fundamental & computational aspects. 2008.
BIBLIOGRAPHY 78
[27] ML Michelsen. Phase equilibrium calculations. what is easy and what is difficult?
Computers & chemical engineering, 17(5-6):431–439, 1993.
[28] S Mokhatab. Three-phase flash calculation for hydrocarbon systems containing
water1. Theoretical Foundations of Chemical Engineering, 37(3):291–294, 2003.
[29] Kh Nasrifar and M Moshfeghian. Liquid–liquid equilibria of water–hydrocarbon
systems from cubic equations of state. Fluid phase equilibria, 193(1):261–275,
2002.
[30] J Neoschil, P Chambrette, et al. Converge pressure concept a key for high
pressure equilibria. 1978.
[31] Long X Nghiem, K Aziz, YK Li, et al. A robust iterative method for flash
calculations using the soave-redlich-kwong or the peng-robinson equation of state.
Society of Petroleum Engineers Journal, 23(03):521–530, 1983.
[32] LX Nghiem and RA Heidemann. General acceleration procedure for multiphase
flash calculation with application to oil-gas-water systems. In Proceedings of the
2nd European Symposium on Enhanced Oil Recovery, pages 303–316, 1982.
[33] Dan Vladimir Nichita, Daniel Broseta, and Francois Montel. Calculation of
convergence pressure/temperature and stability test limit loci of mixtures with
cubic equations of state. Fluid Phase Equilibria, 261(1):176–184, 2007.
[34] Dan Vladimir Nichita, Susana Gomez, and Eduardo Luna. Phase stability anal-
ysis with cubic equations of state by using a global optimization method. Fluid
Phase Equilibria, 194:411–437, 2002.
[35] D-Y Peng and DB Robinson. Two-and three-phase equilibrium calculations for
coal gasification and related processes. ACS Publications, 1980.
BIBLIOGRAPHY 79
[36] Ding-Yu Peng and Donald B Robinson. A new two-constant equation of state.
Industrial & Engineering Chemistry Fundamentals, 15(1):59–64, 1976.
[37] Renee J Perez and Robert A Heidemann. Coupling an equation of state and
henry’s law to model the phase equilibria of gases and brines: Examples in the
n2–h2o–nacl system. Journal of Geochemical Exploration, 89(1):331–334, 2006.
[38] HH Rachford Jr, JD Rice, et al. Procedure for use of electronic digital computers
in calculating flash vaporization hydrocarbon equilibrium. Journal of Petroleum
Technology, 4(10):19–3, 1952.
[39] Otto Redlich and Joseph NS Kwong. On the thermodynamics of solutions. v. an
equation of state. fugacities of gaseous solutions. Chemical reviews, 44(1):233–
244, 1949.
[40] RCj Reid and JM Prausnitz. The properties of gases and liquids, 1977.
[41] P Reshadi, Kh Nasrifar, and M Moshfeghian. Evaluating the phase equilibria
of liquid water+ natural gas mixtures using cubic equations of state with asym-
metric mixing rules. Fluid Phase Equilibria, 302(1):179–189, 2011.
[42] Timothy R Rettich, Y Paul Handa, Rubin Battino, and Emmerich Wilhelm.
Solubility of gases in liquids. 13. high-precision determination of henrys con-
stants for methane and ethane in liquid water at 275 to 328 k. J. Phys. Chem,
85(22):3230–3237, 1981.
[43] AM Rowe and James CS Chou. Pressure-volume-temperature-concentration re-
lation of aqueous nacl solutions. J. Chem. Eng. Data, 15(1):61–66, 1970.
[44] Nasser Sabet and Hamid Reza Erfani Gahrooei. A new robust stability algorithm
for three phase flash calculations in presence of water. Journal of Natural Gas
Science and Engineering, 35:382–391, 2016.
BIBLIOGRAPHY 80
[45] A Saul and Wolfgang Wagner. International equations for the saturation prop-
erties of ordinary water substance. Journal of Physical and Chemical Reference
Data, 16(4):893–901, 1987.
[46] Giorgio Soave. Equilibrium constants from a modified redlich-kwong equation of
state. Chemical Engineering Science, 27(6):1197–1203, 1972.
[47] OM Suleimenov and RE Krupp. Solubility of hydrogen sulfide in pure water and
in nacl solutions, from 20 to 320 c and at saturation pressures. Geochimica et
Cosmochimica Acta, 58(11):2433–2444, 1994.
[48] John A Trangenstein. Customized minimization techniques for phase equi-
librium computations in reservoir simulation. Chemical Engineering Science,
42(12):2847–2863, 1987.
[49] Curtis H Whitson and Michael L Michelsen. The negative flash. Fluid Phase
Equilibria, 53:51–71, 1989.
[50] G Wilson. A modified redlich–kwong eos, application to general physical data
calculations, paper no. 15c. In AIChE 65th National Meeting, 1968.
[51] Stephen Wright and Jorge Nocedal. Numerical optimization. Springer Science,
35:67–68, 1999.
Top Related