MULTIPHASE EQUILIBRIUM CALCULATIONS WITH GAS SOLUBILITY IN WATER FOR ENHANCED OIL RECOVERY

Similar documents
UNIVERSITY OF CALGARY. Modelling Water-Hydrocarbon Mutual Solubility in Multiphase Equilibrium Calculations. Hongbo Yu A THESIS

PVTpetro: A COMPUTATIONAL TOOL FOR ISOTHERM TWO- PHASE PT-FLASH CALCULATION IN OIL-GAS SYSTEMS

CALCULATION OF THE COMPRESSIBILITY FACTOR AND FUGACITY IN OIL-GAS SYSTEMS USING CUBIC EQUATIONS OF STATE

On Two Flash Methods for Compositional Reservoir Simulations: Table Look-up and Reduced Variables

18 a 21 de novembro de 2014, Caldas Novas - Goiás THERMODYNAMIC MODELING OF VAPOR-LIQUID EQUILIBRIUM FOR PETROLEUM FLUIDS

PETE 310 Lectures # 36 to 37

TIE-LINE BASED PARAMETERIZATION FOR THERMAL COMPOSITIONAL RESERVOIR SIMULATION

Accuracy of vapour ^ liquid critical points computed from cubic equations of state

Overall: 75 ECTS: 7.0

P1: IML/FFX P2: IML/FFX QC: IML/FFX T1: IML AT029-FM AT029-Manual AT029-Manual-v8.cls December 11, :59. Contents

TIE-SIMPLEX METHOD FOR THERMAL-COMPOSITIONAL SIMULATION

A generalized set of correlations for plus fraction characterization

ELEMENT-BASED FORMULATIONS FOR COUPLED FLOW, TRANSPORT, AND CHEMICAL REACTIONS

Thermophysical Properties of Ethane from Cubic Equations of State

"Energy Applications: Impact of Data and Models"

UNIVERSITY OF CALGARY. Development of a Four-Phase Compositional Simulator Using Equations of State. Yizheng Wei A THESIS

On the Boyle temperature

EOS Higher Oil School 2017/5/26

Phase Diagrams: Conditions for Equilibrium (CfE)

Modelling the Solubility of Solid Aromatic Compounds in Supercritical Fluids

Predictive Equation of State

, b = 0. (2) 1 2 The eigenvectors of A corresponding to the eigenvalues λ 1 = 1, λ 2 = 3 are

ChBE BIBLE. Robert A. Pinnick. 28 April 2006

Review of Chemical Equilibrium Introduction

arxiv: v1 [cond-mat.soft] 20 Apr 2015

Review of Chemical Equilibrium Introduction

PREDICTION OF SATURATED LIQUID VOLUMES FROM A MODIFIED VAN DER WAALS EQUATION. By Charles R. Koppany

Chemical Engineering Thermodynamics

Preliminary Evaluation of the SPUNG Equation of State for Modelling the Thermodynamic Properties of CO 2 Water Mixtures

Equations of State. Equations of State (EoS)

Solubility of solids in supercritical fluids using equations of state - excess Gibbs free energy models.

Scientific Computing: An Introductory Survey

A modification of Wong-Sandler mixing rule for the prediction of vapor-liquid equilibria in binary asymmetric systems

Lecture 6. NONELECTROLYTE SOLUTONS

DEVELOPMENT OF A COMPOSITIONAL RESERVOIR SIMULATOR FOR ASPHALTENE PRECIPITATION BASED ON A THERMODYNAMICALLY CONSISTENT MODEL.

MODELING THE PHASE EQUILIBRIUM OF THE CLOVE OIL + CO 2 SYSTEM

Thermodynamic Properties of Refrigerant R116 from Cubic Equations of State

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 5. Nonlinear Equations

MODELING OF PHASE EQUILIBRIA FOR BINARY AND TERNARY MIXTURES OF CARBON DIOXIDE, HYDROGEN AND METHANOL

COMPOSITIONAL SPACE PARAMETERIZATION METHODS FOR THERMAL-COMPOSITIONAL SIMULATION

Outline. Scientific Computing: An Introductory Survey. Nonlinear Equations. Nonlinear Equations. Examples: Nonlinear Equations

Vapor liquid equilibria of carbon dioxide with diethyl oxalate, ethyl laurate, and dibutyl phthalate binary mixtures at elevated pressures

Equation of state. Contents. Overview. Historical. Boyle's law (1662)


CS 450 Numerical Analysis. Chapter 5: Nonlinear Equations

CHEMISTRY Topic #2: Thermochemistry and Electrochemistry What Makes Reactions Go? Fall 2018 Dr. Susan Findlay See Exercises in Topic 8

CS 542G: Robustifying Newton, Constraints, Nonlinear Least Squares

Modeling and Computation of Phase Equilibrium. Using Interval Methods. Department of Chemical and Biomolecular Engineering, University of Notre Dame

Simulating Condensation in a Supercritical Gas Jet

Comparison of the GERG-2008 and Peng-Robinson Equations of State for Natural Gas Mixtures

NAME: NITROMETHANE CHEMISTRY 443, Fall, 2015(15F) Section Number: 10 Final Examination, December 18, 2015

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

Hydrocarbon Reservoirs and Production: Thermodynamics and Rheology

Aspen Dr. Ziad Abuelrub

5.60 Thermodynamics & Kinetics Spring 2008

10.34: Numerical Methods Applied to Chemical Engineering. Lecture 7: Solutions of nonlinear equations Newton-Raphson method

CHEMICAL THERMODYNAMICS

Course Name: Thermodynamics for Chemical Engineers

PVT Course for Oil and Gas Professionals

Rigorous calculation of LNG flow reliefs using the GERG-2004 equation of state

Numerical Methods I Solving Nonlinear Equations

Line Search Methods for Unconstrained Optimisation

Applied Computational Economics Workshop. Part 3: Nonlinear Equations

Phase equilibria for the oxygen water system up to elevated temperatures and pressures

Chapter 6 The States of Matter. Examples of Physical Properties of Three States of Matter

Chemical and Engineering Thermodynamics

Pressure Volume Temperature Relationship of Pure Fluids

CHAPTER SIX THERMODYNAMICS Vapor-Liquid Equilibrium in a Binary System 6.2. Investigation of the Thermodynamic Properties of Pure Water

8 Numerical methods for unconstrained problems

Reliable Prediction of Phase Stability Using an Interval Newton Method

EAD 115. Numerical Solution of Engineering and Scientific Problems. David M. Rocke Department of Applied Science

Lecture Notes: Geometric Considerations in Unconstrained Optimization

New correlation for hydrogen-natural gas mixture compressibility factor

CHEMISTRY 443, Fall, 2014 (14F) Section Number: 10 Examination 2, November 5, 2014

MSE 201A Thermodynamics and Phase Transformations Fall, 2008 Problem Set No. 8. Given Gibbs generals condition of equilibrium as derived in the notes,

Peng-Robinson Equation of State Predictions for Gas Condensate Before and After Lumping

Cohesion Factor Relations for Cubic Equations of State: Soave-Redlich-Kwong Equation of State

School of Chemical & Biological Engineering, Konkuk University

Stochastic Analogues to Deterministic Optimizers

THERMODYNAMIC CONSISTENCY TESTS FOR PHASE EQUILIBRIUM IN LIQUID SOLUTE+SUPERCRITICAL SOLVENT MIXTURES

THE PROPERTIES OF GASES AND LIQUIDS

ATMOSPHERIC THERMODYNAMICS

CHAPTER 4 ROOTS OF EQUATIONS

INFORMATION APPROACH FOR CHANGE POINT DETECTION OF WEIBULL MODELS WITH APPLICATIONS. Tao Jiang. A Thesis

Unconstrained optimization

Fluid Phase Equilibria

5.4 Liquid Mixtures. G i. + n B. = n A. )+ n B. + RT ln x A. + RT ln x B. G = nrt ( x A. ln x A. Δ mix. + x B S = nr( x A

Chapter 2: The Physical Properties of Pure Compounds

Chapter 11 Review Packet

MITOCW watch?v=vu_of9tcjaa

PREDICTION OF VAPOR PRESSURES AND MIXTURE VLE FROM A SECOND MODIFICATION OF THE VAN DER WAALS EQUATION. Part 3

This paper was prepared for presentation at the Unconventional Resources Technology Conference held in Denver, Colorado, USA, August 2014.

COMPARATIVE ANALYSIS OF ORTHOGONAL MATCHING PURSUIT AND LEAST ANGLE REGRESSION

Hamdi Tchelepi (Principal advisor)

Adam G. Hawley Darin L. George. Southwest Research Institute 6220 Culebra Road San Antonio, TX 78238

Chapter 11. Properties of Solutions

ADSORPTION IN MICROPOROUS MATERIALS: ANALYTICAL EQUATIONS FOR TYPE I ISOTHERMS AT HIGH PRESSURE

Status and results of group contribution methods

Line Search Methods. Shefali Kulkarni-Thaker

Enhanced Oil Recovery with CO2 Injection

Transcription:

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 (CO 2 ) sequestration. Given that water exists abundantly in the reservoir, multiphase equilibrium calculations with gas solubility in water are an important part of compositional 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 injection (especially CO 2 ) 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 efficient 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 Newton 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 CO 2 and water existence, then we compared our results with WinProp in CMG. This comparison shows that results are very close and the differences 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 equilibrium 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 Acknowledgments iv 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[h 2 O] = 0.99...... 55 4.6 Phase diagrams of four different overall water fractions: (a) z[h 2 O] = 0.9; (b) z[h 2 O] = 0.5; (c) z[h 2 O] = 0.1; (d) z[h 2 O] = 0.01...... 56 4.7 Phase diagram of pressure and injection at z[h 2 O] = 0.99...... 58 4.8 Phase diagrams of four different water overall fractions: (a) z[h 2 O] = 0.9; (b) z[h 2 O] = 0.5; (c) z[h 2 O] = 0.1; (d) z[h 2 O] = 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 CO 2 raises increasing concerns, using CO 2 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 hydrocarbon 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 observed 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, CO 2 is the only component that could dissolve in water and these studies did not consider the water component existing in the hydrocarbonrich 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 composition 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 combinations [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 difficult regions include critical points for multiphase flash calculations, convergence locus for negative flash [49], and the stability test limit locus [49, 14, 33]. The computation 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 problems [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 multiphase 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 hydrocarbon 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 CO 2 injection 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 discussion of the theoretical basis. It discusses Henry s law, fugacity computations for different phases, stability analysis and phase split calculations. Numerical implementations 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 hydrocarbons and carbon dioxide dissolving in the aqueous phase. Cubic equations of state have been applied extensively to model the gas phase in phase equilibrium computations. 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. Furthermore, 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 determine 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 semiempirical correction, which does not require density or fugacity evaluations. ln H i = ln H s i + 1 RT P P s H 2 O v i dp. (2.1) where H i is the Henry s law constant for component i at pressure P and temperature T. In this equation, Hi s is the Henry s law constant at water saturation pressure PH s 2 O, R is gas constant, and v i is partial molar volume of component i in aqueous phase at T. The Henry s law constant at water saturation pressure Hi s is calculated as ln H s i = ln P s H 2 O + A(T r,h2 O) 1 + B(1 T r,h2 O) 0.355 (T r,h2 O) 1 + C[exp(1 T r,h2 O)](T r,h2 O) 0.41 (2.2) where T r,h2 O is reduced temperature of water, T r,h2 O = T/T c,h2 O, T c,h2 O 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 constants Gaseous Solute A B C CO 2-9.4234 4.0087 10.3199 N 2-11.6184 4.9266 13.3445 H 2 S -5.7131 5.3727 5.4227 CH 4-11.0094 4.8362 12.5220 C 2 H 6-19.7237 4.5051 20.6740 Water saturation pressure P s H 2 O is calculated by Saul and Wagner [45] ln P s H 2 O P c = T c T (a 1τ + a 2 τ 1.5 + a 3 τ 3 + a 4 τ 3.5 + a 5 τ 4 + a 6 τ 7.5 ) (2.3) where a 1 = 7.85823, a 2 = 1.83991, a 3 = 11.7811, a 4 = 22.6705, a 5 = 15.9393, a 6 =

CHAPTER 2. THEORETICAL BASIS 9 1.77516. τ is defined as τ = 1 T T c,h2 O. Water critical pressure P c,h 2 O is 22.064MP a, and water critical temperature T c,h2 O is 647.14K. Calculations of partial molar volume v i are performed using various correlations for different components: For CO 2, the correlation from Garcia [6] is used: v CO2 = 37.51 9.585 10 2 ˆT + 8.740 10 4 ˆT 2 5.044 10 7 ˆT 3 (2.4) For CH 4, the correlation is as follows [42]: v CH4 = exp(3.541 + 1.23 10 3 ˆT ) (2.5) where ˆT is temperature in C: ˆT = T (K) 273.15 For N 2, the correlation from Perez and Heidemann [37] is used: v N2 = exp(15.372 + 6.60 10 2 T ) (2.6) For H 2 S, the general approach given by Li and Nghiem [16] is used. v H2 S 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 temperature follows the equation ln H i = ln H 0 i + v i (P P 0 i ) RT (2.7)

CHAPTER 2. THEORETICAL BASIS 10 where H i is the Henry s law constant of component i in the aqueous phase, H 0 i Henry s law constant at the reference pressure P 0 i, and v i is the is the molar volume of component i at infinite dilution in the aqueous phase at T. The correlation can also be written as ln H i = ln Hi + v i P RT (2.8) where ln Hi = ln Hi 0 + v i Pi 0 RT (2.9) Hi is considered as the reference Henry s law constant. The molar volume at infinite dilution vi is computed from the correlation of Lyckman et al. [20] reported by Heidemann and Prausnitz (1977) [12]: P ci v i RT ci = 0.095 + 2.35( T P ci CT ci ) (2.10) where T ci is the critical temperature of component i, and P ci is the critical pressure of component i in the aqueous phase. C is the cohesive energy density of water, given by C = (h 0 w h s w Pwv s w s + RT )/vw s (2.11) where Pw s is the water saturation pressure at temperature T, vw s is the molar volume of water at Pw s and T, and h 0 w h s w is enthalpy departure of liquid water at Pw s 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]: h 0 w h s w = 7.0 + 4.5688[ ln(p w/p s c,w )] 0.333 T c,w 1.0 + 0.004[ln(Pw/P s c,w )] (2.12) where the unit of h 0 w h s w is cal/(g mol).

CHAPTER 2. THEORETICAL BASIS 11 Calculation of molar volume of water The molar volume v s w is estimated from a correlation given by Rowe and Chou [43]: ˆv w = A(T ) ˆP B(T ) ˆP 2 C(T ) (2.13) where the coefficients are as follows: A(T ) = 5.916365 0.01035794T +0.9270048 10 5 T 2 1127.522 T + 100674.1 T 2 (2.14) B(T ) =0.5204914 10 2 0.10482101 10 4 T + 0.8328532 10 8 T 2 1.1702939 T + 102.2783 T 2 (2.15) C(T ) = 0.118547 10 7 0.6599143 10 10 T (2.16) where ˆv w is specific volume of water with unit (cm 3 /g), and P is absolute pressure with unit (kg/cm 2 ). The molar volume of water (cm 3 /g) is then given: v w = ˆv w M w (2.17) where M w 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]: ln P s w = A + B T + C ln T + D P s w T 2 (2.18) D is related to the van der Waals constant a and also to the critical properties: D = a R 2 = 27T 2 c 64P c (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 ln P s w = B( 1 T r 1) + C ln T r + 27 64 [ 1 P c T 2 br 1] (2.21) B is found by applying the above equation at the normal boiling point (P = 1atm, T = T b ): B = ln P c + 2.67 ln T br + 27 64 [ 1 P ct 2 br 1] 1 1 T br 0.7816 ln T br (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 ln H i f s w = A + B( 103 T ) C 106 T 2 (2.23) where f s w 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 P f w = fw s exp( Pw s v w dp ) (2.24) RT

CHAPTER 2. THEORETICAL BASIS 13 Water saturation pressure P s w is calculated from Saul and Wagner in Eq.(2.21) [45], and molar volume of water v w 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: fw s Pw s 0.9958 + 9.68330 10 5 T 6.1750 10 7 T 2 3.08333 10 10 T 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( H salt,i H i ) = k salt,i m salt (2.26) Table 2.2: Coefficients of the aqueous Henry s law constant Gaseous Solute A B C CO 2 11.3021 10.6030 1.20696 N 2 10.7090 11.4793 1.16549 H 2 S 10.8393 9.8897 1.11984 CH 4 10.9554 11.3569 1.17105 C 2 H 6 13.9485 13.8254 1.66544 C 3 H 8 14.6331 14.4872 1.78068 nc 4 13.4248 13.8865 1.71879 nc 5 16.0045 16.2281 2.13123 nc 8 31.9431 28.6725 4.37707

CHAPTER 2. THEORETICAL BASIS 14 where H salt,i is the Henrys constant of component i in brine (salt solution), H i is the Henry s constant of component i at zero salinity, and m salt is the molarity of the dissolved salt (mol/kgh 2 O). For CO 2 and CH 4, Bakker gives the following correlations for the salting-out coefficients[3]: k salt,co2 = 0.11572 6.0293 10 4 ˆT + 3.5817 10 6 ˆT 2 3.7772 10 9 ˆT 3 (2.27) where ˆT is the temperature in degrees Celsius ( C). k salt,ch4 =3.38828 0.0318765T + 0.000122003T 2 2.31891 10 7 T 3 + 2.22938 10 10T 4 8.83764 10 14T 5 (2.28) where T is the temperature in degrees Kelvin (K). For N 2, Perez and Heidemann [37] give the following correlation for the salting-out coefficient: k salt,n2 = 3.1150 0.01690T + 2.4950 10 5 T 2 (2.29) where T is the temperature in degrees Kelvin (K). For H 2 S, Suleimenov and Krupp[47] give the following correlations for the salting-out coefficient: k salt,h2 S =8.37106265 10 2 5.135608863 10 4 ˆT + 6.387039005 10 6 2 ˆT 2.217360319 10 8 ˆT 3 5.069412169 10 11 ˆT 4 + 2.827486651 10 13 5 ˆT (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 V m b aα (2.31) Vm 2 + 2bV m b 2 where, a = 0.45724R2 T 2 c P c b = 0.07780RT c P c α = (1 + κ(1 T 0.5 r ))) 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 = P V RT can be calculated via the resulting equation: Z 3 (1 B)Z 2 + (A 2B 3B 2 )Z (AB B 2 B 3 ) = 0 (2.33) A and B are defined as A = aαp R 2 T 2 B = BP RT where ω is the acentric factor of the species, and R is the gas constant. mixture, the parameters a and b are defined using the following mixing rule: (2.34) For the a = x i S i S i = a i a j xj (1 k ij ) (2.35) b = x i b i

CHAPTER 2. THEORETICAL BASIS 16 where k ij is an empirically determined interaction coefficient. How to solve cubic equations is explained in Appendix A. The fugacity coefficient is derived as ln φ i = b i 1 A (Z 1) ln(z B) b δ 2 δ 1 B (2S i a b i b ) ln(z + δ 2B Z + δ 1 B ) (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 corresponding Henry s law constants. The fugacity of component i can be derived as ˆf i = x i H i (2.37) Given the definition of the fugacity coefficient, we get ˆφ i = ˆf i x i P (2.38) Thus, the fugacity coefficients of components in the aqueous phase are independent of their mole fractions. ˆφ i = H i 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 = ˆf w P (2.40)

CHAPTER 2. THEORETICAL BASIS 17 2.2 Stability Analysis For a mixture containing N c 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 N c component mixture, with component mole fractions (z 1, z 2,..., z Nc ). Chemical reactions are not considered. Assume that pressure, temperature and chemical potential are uniform throughout. The Gibbs free energy of the mixture is N c G 0 = n i µ 0 i (2.41) i=1 where µ 0 i 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 (y 1, y 2,...y Nc ). So the change in Gibbs free energy is G = G I + G II G 0 (2.42) where G I, G II are the Gibbs free energies of the N n ε and n ε portions. yields A Taylor series expansion of G I, ignoring second and higher order terms in n ε, N c G(N n ε ) = G(N) n ε y i ( G ) T,p,N (2.43) n i Given the relationship between partial derivatives of G and chemical potential, we get i=1 ( G n i ) T,p,N = µ i ( y) (2.44)

CHAPTER 2. THEORETICAL BASIS 18 The difference of Gibbs free energy can be expressed as N c G = n ε y i (µ i ( y) µ 0 i ) (2.45) i=1 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. N c F ( y) = y i (µ i ( y) µ 0 i ) 0 (2.46) i=1 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 (N c 1) independent mole fractions: µ i ( y) µ 0 i = k i = 1, 2,...N c (2.47) With the expression of chemical potential energy, we get µ i ( y, T, P ) = µ 0 i (T, P ) + RT ln ˆf i ( y, T, P ) f 0 i (T, P ) i = 1, 2,...N c (2.48) The stability analysis equation can be written as N c T P D( y) = F ( y)/rt = y i (ln y i + ln ˆφ i + h i ) 0 (2.49) i=1 where TPD is the tangent plane distance, ˆφ i is the fugacity coefficient of component i and h i = ln z i + ln ˆφ i ( z). The stationary criterion is ln y i + ln ˆφ i + h i = k, i = 1, 2,...N c (2.50) A set of variables Y can be defined as ln Y i = ln y i k, i = 1, 2,...N c (2.51) The criterion is transformed to ln Y i + ln ˆφ i ( y) h i = 0, i = 1, 2,...N c (2.52) The new independent variables Y i can be interpreted as mole numbers, and the relationship between y i and Y i is, y i = Y i / Y i. For the stable phase, all N c stationary i=1

CHAPTER 2. THEORETICAL BASIS 20 points with k 0 are corresponding to N c i=1 Y i 1. With the new variables Y i, the N c problem is transformed from a constrained optimization problem ( y i = 1), to an unconstrained problem, only Y i > 0 being required. Conversely for an unstable system, there must be at least one stationary point that N c satisfies the condition Y i > 1. Thus we can formulate a different but equivalent i=1 criterion based on the variables Y i : T P D ( Y N c ) = 1 + Y i (ln Y i + ln ˆφ i h i 1) 0 (2.53) i=1 The equivalence is shown as follows. Stationarity of T P D requires T P D = 0 (2.54) Y i which yields the same criterion of stability as T P D: i=1 ln Y i + ln ˆφ i h i = 0 (2.55) In summary, the phase stability is inferred by the conditions, which can be derived from the stationary point of T P D : N c i=1 N c i=1 Y i > 1 unstable Y i 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 L p 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, x ij, and the amounts of each phase F j given as the ratio of mole number in a phase to the total mole number of the mixture. In total, there are L p + L p N c 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 N c i=1 x ij = 1 j = 1, 2,..., L p (2.57)

CHAPTER 2. THEORETICAL BASIS 22 The phase distribution is constrained by L p j=1 F j = 1 (2.58) The overall composition can be derived as L p z i = x ij l j i = 1, 2,..., N c (2.59) j=1 These three constraints reduce the number of independent variables by L p 1, 1, and N c, respectively. The number of independent variables can be reduced to N c (L p 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 K j1 = x ij x i1 i = 1, 2,..., N c (2.60) There are N c (L p 1) equations, which can be used to calculate N c (L p 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: N c i=1 (x iv x il ) = i (K iv 1)z i F l + F v K iv + F w K i,w = 0 (2.61) N c i=1 (x iw x il ) = i (K iw 1)z i F l + F v K iv + F w K i,w = 0 (2.62) where F l, F v and F w 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: x iw = K iw z i F l + F v K iv + F w K i,w i = 1,..., N c (2.63) x iv = x il = K iv z i F l + F v K iv + F w K i,w i = 1,..., N c (2.64) z i F l + F v K iv + F w K i,w i = 1,..., N c (2.65) For the three phase equilibrium system, the fugacity of component i in each of the three phases must be equal: ˆf v i = ˆf l i i = 1,..., N c (2.66) ˆf w i = ˆf l i i = 1,..., N c (2.67) where ˆf j i 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: K iv = ˆφ l i ˆφ v i i = 1,..., N c (2.68) K iw = ˆφ l i ˆφ w i i = 1,..., N c (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: Nc G nrt = x i ln ˆf i (2.70) where x i is the mole fraction of component i in that phase. Considering the isothermal condition, we ignore nrt and consider Ḡ = Gibbs free energy of three phase system is i=1 G. The nrt Ḡ = Ḡl + Ḡv + G w N c = n l i ln ˆf N c i l + n v i ln f ˆ N c i v + n w i ln ˆ i=1 i=1 i=1 f w i (2.71) where n l i, n v i and n w i 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 N c i=1 N c i=1 N c n w i i=1 n l i = F l n v i = F v = F w (2.72) F l + F v + F w = 1 (2.73) z i = n l i + n v i + n w i i = 1, 2,..., N c (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 n v i and n w i as independent variables. Based on mass balance, the relation of mole numbers is n l i = z i n v i n w i i = 1, 2,..., N c (2.75) Differentiating Eq.(2.71) on the independent mole numbers gives gv i = Ḡ n v i gw i = Ḡ n v i N c = ln f ˆ k v n v k n v i k=1 k=1 N c + ln ˆf k l n l k n v i k=1 N c + k=1 N c = ln f ˆ k v n v k n w i N c + ln ˆf k l k=1 n l k n w i N c + N c + k=1 k=1 n v k n l k ln ˆf l k n v i N c + k=1 n v k n l k ln ˆf l k n w i Considering the independent variables ln ˆ f v k n v i N c + k=1 ln ˆ f v k n w i N c + k=1 ln ˆ f w k ln ˆ f w k n w k n v i n w k n w i N c + k=1 N c + k=1 n w k n w k ln ˆ f w k n v i ln ˆ f w k n w i (2.76) (2.77) n w k n v i = 0 n v k n w i = 0 i, k = 1, 2,..., N c (2.78) n l k n v i = δ ki n l k n w i = δ ki i, k = 1, 2,..., N c (2.79) n v k n v i = δ ki n w k n w i = δ ki i, k = 1, 2,..., N c (2.80) where δ ki is the Kronecker delta function. From the Gibbs-Duhem equation N c n p k k=1 ln ˆ f p k n q i = 0 p, q = 1, 2,..., L p (2.81)

CHAPTER 2. THEORETICAL BASIS 26 Substituting these results into Eq.(2.71), the first order derivative becomes g = [ gv, gw]: gv i = ln ˆf v i ln ˆf l i i = 1, 2,..., N c (2.82) gw i = ln ˆf w i ln ˆf l i i = 1, 2,..., N c (2.83) The elements of the Hessian matrix are the second order derivatives of Gibbs free energy. The Hessian matrix is Elements of H are H = g n = gv niv gv niw gw niv gw niw (2.84) gv i n v j = 1ˆ f ˆ i v f v i n v j + 1ˆf l i ˆf l i n l j i, j = 1, 2,..., N c gw i n v j gv i n w j = 1ˆf l i ˆf l i n l j = 1ˆf l i ˆf l i n l j i, j = 1, 2,..., N c i, j = 1, 2,..., N c (2.85) gw i n w j = 1ˆf w i ˆf w i n w j + 1ˆf l i ˆf l i n l j i, j = 1, 2,..., N c 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 n v i and n w i 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. implementation are provided in Chapter 3. Specific steps of the numerical

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 y trial i or more practically, the equilibrium ratios K iv and K iw. 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 estimates. For the system with only liquid and vapor phases, {Ki wilson } and {1/Ki wilson } often provide good initial guesses for stability analysis. The Wilson correlation is given as K W ilson i = P ci P exp[5.37(1 + ω i)(1 T ci )] (3.1) T where T ci, P ci, ω i are the critical temperature, critical pressure and acentric factor of component i. {K wilson i software. } and {1/K wilson } are usually applied in commercial simulation i However, when there is more than one liquid phase, {Ki wilson } and {1/Ki wilson } 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 (N c 1) components equally share the remaining 10 mol% in the trial phase [17]: K pure i K pure j = 0.9/z test i, = 0.1/[(N c 1)z test j ] (j i) (3.2) They also proposed initial estimates as { 3 K wilson i } and {1/ 3 K wilson } which can i

CHAPTER 3. NUMERICAL IMPLEMENTATION 30 increase the possibility of selecting appropriate initial K values. We tested various cases with CO 2 injection and gas solubility in water. We find that four sets of K values, {Kwater}, pure {K pure CO 2 }, {Ki wilson } and {1/Ki wilson }, 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 {K pure water} and {K pure CO 2 }, the mole fraction of water and CO 2 are 99 mol%, and the remaining components equally share 1 mol% In our method, for V L stability analysis, we only use {Ki wilson } and {1/Ki wilson } as our initial estimates. For L W and V W stability test, we test {K pure water}, {K pure CO 2 }, {Ki wilson } and {1/Ki wilson }. 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 iterations fast. However, SSI has a low speed of convergence (linear convergence) while getting close to the solution, compared to quadratic convergence methods. Therefore, 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: {K wilson i 2. Compute the composition of the trial phase: }, {1/Ki wilson }, {K pure CO 2 }, and {K pure H 2 O }. Y i = z i K i y i = Y i N c i=1 Y i (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: r i = ln Y i + ln ˆφ(y i ) h i (3.4) where h i = ln z i + ln ˆφ i ( z). Here Y i and ˆφ(y i ) 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: Y i = ˆφ(z i )Z i ˆφ(y i ) K i = ˆφ(z i ) ˆφ(y i ) (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: {Ki wilson }, {1/Ki wilson }. 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 equilibrium 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 {x i }, {y i }, {w i }, in Eq.(2.63), (2.64), and (2.65) 3. Calculate fugacity for each component in the aqueous phase with Henry s law: ˆf w i = H i w i i = 1, 2,..., N c (3.6) For components in the vapor and liquid phase, based on Eq.(2.36), the fugacity can be derived: ˆf i l = ˆφ l ix i P i = 1, 2,..., N c (3.7) ˆf i v = ˆφ v i y i P i = 1, 2,..., N c 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]. rv i = ˆf i v ˆf i l i = 1, 2,..., N c (3.8) rw i = ˆf i w ˆf i l i = 1, 2,..., N c 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. K v i K w i = ˆφ l i ˆφ v i = ˆφ l i ˆφ w i i = 1, 2,..., N c i = 1, 2,..., N c (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: x n+1 = x n f(x n) f (x n ) (3.10) where f (x n ) 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 {Y i }. 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: T P D = 1 + i Y i (ln Y i + ln ˆφ(y i ) h i 1) (3.11) where h i = ln z i + ln ˆφ i ( z). g i = T P D Y i = ln Y i + ln ˆφ(y i ) h i (3.12) 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 Y i g = δy H Y n+1 = Y n + δ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 n v i and n w i which are mole numbers in each phase: n v i = y i V n l i = x i L (3.15) n w i = w i W 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: where g = [ gv, gw] and d n = [d niv, d niw] 6. Update variables and go back to Step 3: g = Hd n (3.16) n v i = n v i + dn v i n w i = n w i + dn w i (3.17) n l i = z i n v i n w i

CHAPTER 3. NUMERICAL IMPLEMENTATION 39 n l i = L i i n v i = V n w i = W (3.18) i x i = nl i L y i = nv i V w i = nw i W (3.19) Fig.3.4 The workflow of Newton s method for phase split calculations is displayed in 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 energy, respectively [25]. Traditionally, the first-order method, the SSI method, is performed. 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 solution, 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(x k + s) = f(x k ) + f(x k ) T s + 1 2 st B k s (3.20) s.t. s k (3.21) where g k = f(x k ) is the gradient of f(x k ), and B k = 2 f(x k ) 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 H k = B k + λi. Using an approximation of the Hessian B k by H k, one gets min. f(x k + s) = f(x k ) + f(x k ) T s + 1 2 st H k s (3.22) Solving the TR subproblem means finding the minimum: min s k m k (s) = f(x k ) T s + 1 2 st H k s (3.23) which is equivalent to solving the problem for (B k + λi)s = g (3.24) λ( s ) = 0 (3.25) (B k + λ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 k, 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(x k) f(x k + s k ) m k (0) m k (s k ) (3.27) If ρ k < 0, this means that f(x k ) < f(x k + s k ), 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. k is the size of the trust region in kth step. 1. Give initial values of x 0, B 0 and initial the trust region size 0. 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, r 1 = 0.25, r 2 = 2 and γ [0, k 4 ) 2. Check convergence. If it is converged, the current point x k can be regarded as the solution. Otherwise, go to step 3. f(x k < ε (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, k+1 = k 4 If ρ k > 0.75, s k = k, expand the trust region size, k+1 = 2 k If ρ k > γ and λ < κ, update the solution x k+1 = x k + s k. 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 H k+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 H k s = g, where H k = B k + λ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 LDL T decomposition: H = LDL T (3.29) where L is the lower triangular matrix, and D is the diagonal matrix. L T 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 LL T decomposition. 4. Solve LL T s = g 5. If s : If s = or λ = 0, stop the TR method. The solution has been found. If s <, we compute the eigenvector u 1 corresponding to λ 1 (by QR decomposition). Find the root α of the equation s + αu 1 2 = which makes the model m(s) smallest. s = s + αu 1, and stop. The solution has been found. 6. If s 2 < κ, stop. 7. Solve Lω = s and update λ k+1 = λ k + ( s 2 )( s 2 2 ω 2 2 ). 8. H is corrected by H = H + λi, and factorize H = LL T 9. Solve LL T s = 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 Y i (ln Y i + ln ˆφ(y i ) h i 1) 0 (3.30) where h i = ln z i + ln ˆφ i ( z). Check convergence. g i = obj Y i (3.31) 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: Y new = Y old + d Y (3.33) 6. Calculate the new objective function. If obj new > obj old, cut the size of the trust region k. If obj new < obj old, 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 n l i ln ˆf l i + i n v i ln ˆ f v i + i n w i ln ˆ f w i (3.34) gv i = obj n v i (3.35) g = [ gv, gw] gw i = obj n w i (3.36) 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: niv new = niv old + dniv niw new = niw old + dniw (3.39) 6. Calculate the new objective function. nil new = z i niv new niw new If obj new > obj old, update the size of trust region: k+1 = k 4 (3.40) If obj new < obj old, 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 Calculations Given the global mole fractions z i, 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 calculation 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[h 2 O] : z[co 2 ]=0.5:0.5. Results from our model and from WinProp, in application of Harvey s method and Li and Nghiem s method, are displayed in Table 4.2 and Table 4.3 respectively. 49

CHAPTER 4. RESULTS AND ANALYSIS 50 Table 4.1: Properties of input components Component T c (K) P c (bar) ω MW (g/mol) H 2 O 647.3 220.4832 0.344 18.015 CH 4 190.6 46.00155 0.008 16.043 N 2 126.2 33.94388 0.04 28.013 CO 2 304.3 73.7646 0.225 44.01 Table 4.2: Results of two component system with Harvey s method Results Ours WinProp Component W V W V H 2 O 0.98395 0.01498 0.98360 0.01493 CO 2 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 method Results Ours WinProp Component W V W V H 2 O 0.98306 0.01499 0.98250 0.01498 CO 2 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: where x is the composition or phase fraction. Err = x ours x W inp rop x W inp rop (4.1) For Harvey s method, we can find out that the largest error is given by CO 2 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 CO 2 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[h 2 O] : z[ch 4 ] : z[n 2 ] : z[co 2 ]=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 method Results Ours WinProp Component W V W V H 2 O 0.99505 0.00326 0.99500 0.00325 CH 4 0.00027 0.33317 0.00027 0.33318 N 2 0.00014 0.33325 0.00014 0.33327 CO 2 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 method Results Ours WinProp Component W V W V H 2 O 0.99457 0.00326 0.99465 0.00325 CH 4 0.00028 0.33327 0.00027 0.33326 N 2 0.00015 0.33335 0.00015 0.33334 CO 2 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 CO 2 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 N 2 in the aqueous phase, and the error of CO 2 in the aqueous phase is 1.4234%. Considering we will apply the model for CO 2 injection for EOR, the accuracy of CO 2 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 CO 2. In the study of gas injection for EOR, it is necessary to study the phase behavior of the reservoir fluid in combination with CO 2. We generate the P x phase diagram, the axes of which are pressure and the fraction of injected CO 2. Pressure is varied from 2 bar to 250 bar, and CO 2 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 SPE5 Component Fraction T c (K) P c (bar) ω MW (g/mol) H 2 O 0.99 647.3 220.4832 0.344 18.015 CO 2 0.001 304.7 73.8680 0.225 44.01 CH 4 0.004 190.56 46.0522 0.013 16.043 C 3 H 8 0.0003 369.83 42.5058 0.1524 44.097 C 6 0.0007 507.44 30.1341 0.3007 86.18 C 10 0.002 617.67 20.9641 0.4885 149.29 C 15 0.0015 705.56 13.7903 0.65 206 C 20 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 CO 2 compared to the total fluids.

CHAPTER 4. RESULTS AND ANALYSIS 55 Figure 4.5: Phase diagram of pressure and injection at z[h 2 O] = 0.99 First, we look into the situation where there is a significant amount of injected CO 2, 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 relatively 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, components, 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 CO 2 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 CO 2 is decreased. When there is only a small quantity of injected CO 2, 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[h 2 O] = 0.9; (b) z[h 2 O] = 0.5; (c) z[h 2 O] = 0.1; (d) z[h 2 O] = 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 SPE3 Component Fraction T c (K) P c (bar) ω MW (g/mol) H 2 O 0.99 647.3 220.4832 0.344 18.015 CO 2 0.001344 304.7 73.8680 0.225 44.01 N 2 0.002156 126.2 33.9456 0.04 28.013 CH 4 0.062211 190.6 46.0409 0.013 16.043 C 2 H 6 0.009656 305.43 48.83673 0.0986 30.07 C 3 H 8 0.006567 369.8 42.65743 0.1524 44.097 C 4 6 0.010744 448.08 35.50565 0.21575 66.86942 C 7+1 0.005272 465.62 28.32348 0.3123 107.77943 C 7+2 0.001683 587.8 17.06905 0.5567 198.56203 C 7+3 0.000367 717.72 11.06196 0.91692 335.1979 in Figure 4.7. First, we look into the situation where the injected CO 2 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 CO 2 present, the dew point pressure is low and the system becomes a L W two phase system. As the amount of injected CO 2 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[h 2 O] = 0.99 containing CH 4, C 2 H 6 and C 3 H 8 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% CO 2 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 CO 2 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[h 2 O] = 0.9; (b) z[h 2 O] = 0.5; (c) z[h 2 O] = 0.1; (d) z[h 2 O] = 0.01