Upload
others
View
8
Download
0
Embed Size (px)
Citation preview
University of Calgary
PRISM: University of Calgary's Digital Repository
Graduate Studies The Vault: Electronic Theses and Dissertations
2014-01-30
Measurement of Relative Permeabilities at Low
Saturation using a Multi-step Drainage Process
Wang, Shengdong
Wang, S. (2014). Measurement of Relative Permeabilities at Low Saturation using a Multi-step
Drainage Process (Unpublished doctoral thesis). University of Calgary, Calgary, AB.
doi:10.11575/PRISM/26848
http://hdl.handle.net/11023/1336
doctoral thesis
University of Calgary graduate students retain copyright ownership and moral rights for their
thesis. You may use this material in any way that is permitted by the Copyright Act or through
licensing that has been assigned to the document. For uses that are not allowable under
copyright legislation or licensing, you are required to seek permission.
Downloaded from PRISM: https://prism.ucalgary.ca
UNIVERSITY OF CALGARY
Measurement of Relative Permeabilities at Low Saturation using a Multi-step Drainage
Process
by
Wang Shengdong
A THESIS
SUBMITTED TO THE FACULTY OF GRADUATE STUDIES
IN PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR THE
DEGREE OF DOCTOR OF PHILOSOPHY
DEPARTMENT OF CHEMICAL AND PETROLEUM ENGINEERING
CALGARY, ALBERTA
JANUARY, 2014
© Wang Shengdong 2014
ii
ABSTRACT
The gravity drainage mechanism is important for both maximization of storage capacity of
gas and depletion of oil from oil reservoirs. A sensitivity analysis based on numerical
simulation of CO2 storage confirms that the liquid(s) relative permeabilities at low liquid
saturations and the end points are important for both reservoir simulation and volumetric
modeling of these processes.
This thesis employs the multi-step drainage process to determine the wetting phase
permeabilities close to the end points. In this process, the wetting phase production history
was modeled with fully-coupled capillary pressure, by numerical, analytical and pore-scale
modelling methods. These models leads to corresponding relative permeability calculation
methods, including numerical modeling with automatic history matching, direct estimation
using analytical modelling, and an interactive tube-bundle model correlating the pore
structure and the relative permeabilities.
The first step was to program a simulator in order to mimic the multi-step drainage process.
A group of equations were employed to model the one dimensional multi-step drainage
process according to Darcy's Law and the mass conservation equations. The equations
were solved numerically using PcSim, a program coded using the C++. This program was
used as a benchmark to all other models developed in this thesis. Using the program,
automatic history matching was introduced as a conventional method to determine the
relative permeabilities from the multi-step drainage process. Guo Tao genetic algorithm
iii
(GTGA) was successfully applied to history match the two-phase flow in a porous medium.
The results indicate the application of the GTGA is faster and more reliable than the
conventional genetic algorithm. It was also found that at low wetting phase saturation, the
permeabilities of the wetting phase dominate the production history. Following that, an
analytical method was developed to directly estimate the relative permeabilities of the
wetting phase. The newly developed analytical method simplifies the calculation of the
relative permeabilities close to the end points to a level as easy as calculation of absolute
permeability using Darcy's Equation. In addition, an interactive tube-bundle model
conceptually validated the findings and models developed in this thesis. Further
development of this model could potentially be used to history match the experimental data.
Finally, experiments carried out with both sandpacks and core samples indicate that these
methods can be applied to measure the relative permeabilities close to the end points using
a multi-step drainage process for gas/water, oil/water and gas/oil/water systems.
iv
ACKNOWLEDGMENTS
I would like to express my sincere thanks to my supervisor, Dr. Mingzhe Dong, for his
continuous guidance, encouragement and comment during this work. I have learnt a lot
from him both personally and academically throughout my studies in Canada.
I also wish to express the special thanks and appreciation to my colleagues and friends, Dr.
Jinxun Wang, Dr. Zhaowen Li and other colleagues for the helpful discussions and
suggestions concerning this work and the great helps in my life. I would like to thank Mr.
Bernie Then for the assistance in the experimental designing and manufacturing.
The financial support provided by the Department of Chemical and Petroleum Engineering
at the University of Calgary, Petroleum Technology Research Centre, and the Natural
Resource Canada are gratefully acknowledged.
Thanks for the American Chemical Society for granting free use of the copyright of the
paper “A model for direct estimation of wetting phase relative permeabilities using a multi-
step drainage process”, DOI: 10.1021/ie300638t, 2012.
v
To my dear parents, Fengyi Wang and Cuizhen Dai, for their tens of years love and support.
To my family, Lina Wu and Andrew Wang, for their love and understanding with each
ohter. To remember my grandma with a late greeting from the eastern beach of the Pacific
Ocean.
此文献给我的父母,王丰义与戴翠珍,以感谢他们几十年来的养育与支持;献给我
的家人,吴丽娜与王昊宇,以感谢对彼此的爱与理解;纪念我的奶奶,送去这份远
在大洋彼岸的迟到的祝福。
vi
TABLE OF CONTENTS
Abstract........................................................................................................................................ii
Acknowledgments ..................................................................................................................... iv
Table of Contents ....................................................................................................................... vi
List of Tables............................................................................................................................xiv
List of Figures ........................................................................................................................ xvii
Nomenclatures ........................................................................................................................ xxv
Chapter 1: Introduction .......................................................................................................... 1
1.1 Introduction .................................................................................................................. 1
1.2 Mechanisms of Gas Drainage ..................................................................................... 7
1.2.1 Gravity Drainage and Film Flow ........................................................................ 7
1.2.2 Interfacial Tension Reduction ............................................................................. 8
1.2.3 CO2/Oil Phase Behavior ...................................................................................... 8
1.2.4 Multiple-Contact-Miscible .................................................................................. 9
vii
1.2.5 Swelling Effect ..................................................................................................... 9
1.2.6 Viscosity Reduction ........................................................................................... 11
1.2.7 Blow-Down Recovery ....................................................................................... 11
1.2.8 Capillary Pressure .............................................................................................. 12
1.2.9 Irreducible Wetting-phase Saturations ............................................................. 13
1.2.10 Film Flow and Liquid Mobility at Low Saturation.......................................... 15
1.3 Sensitivity Study on CO2 Storage ............................................................................. 15
1.4 Method for Determination of Flow Functions ......................................................... 16
1.4.1 Measurement of Relative Permeabilities .......................................................... 17
1.4.2 Measurement of Capillary Pressure .................................................................. 18
1.5 Objectives and Roadmap........................................................................................... 21
Chapter 2: Numerical Modeling .......................................................................................... 23
2.1 Introduction ................................................................................................................ 23
2.2 Model Assumptions ................................................................................................... 23
2.3 Mathematical Model.................................................................................................. 25
viii
2.4 Boundary Conditions and Initial Conditions ........................................................... 26
2.5 Flow Function Representation .................................................................................. 28
2.5.1 Global Power Function Form ............................................................................ 28
2.5.2 Discrete Spline Function Form ......................................................................... 29
2.6 Description of Finite-Difference Model................................................................... 30
2.6.1 Grid System ........................................................................................................ 30
2.6.2 Inter-Block Transmissibility Calculations........................................................ 30
2.6.3 Improved IMPES Method ................................................................................. 31
2.7 Validation ................................................................................................................... 36
2.7.1 Pseudo-single-phase Flow ................................................................................. 37
2.7.2 Two-phase Flow ................................................................................................. 40
2.8 Sensitivity Analysis ................................................................................................... 43
2.8.1 Discretization ..................................................................................................... 43
2.8.2 Viscosities/Mobilities ........................................................................................ 45
2.8.3 Membrane ........................................................................................................... 46
ix
2.8.4 Saturation Profiles .............................................................................................. 49
2.9 Summary .................................................................................................................... 50
Chapter 3: History Matching using Genetic Algorithm ..................................................... 52
3.1 Introduction ................................................................................................................ 52
3.2 Methodology .............................................................................................................. 55
3.2.1 Numerical Model ............................................................................................... 55
3.2.2 Guo Tao Genetic Algorithm .............................................................................. 59
3.3 Hypothetical Test ....................................................................................................... 64
3.3.1 Comparisons of GTGA and Conventional GA ................................................ 64
3.3.2 Experimental Uncertainties ............................................................................... 68
3.3.3 Impacts of the Nonwetting Phase...................................................................... 71
3.4 Summary .................................................................................................................... 75
Chapter 4: Analytical Modelling and Direct Estimation of Relative Permeabilities ....... 77
4.1 Introduction ................................................................................................................ 77
4.2 Theoretical Development .......................................................................................... 81
x
4.2.1 Membrane Resistance Negligible ..................................................................... 83
4.2.2 Membrane Resistance Considered .................................................................... 91
4.3 Applications of Analytical Models ........................................................................... 97
4.4 Validation of Assumptions........................................................................................ 99
4.4.1 Gas phase Flow Resistance ............................................................................. 101
4.4.2 Membrane Resistance ...................................................................................... 104
4.4.3 Flow Functions ................................................................................................. 105
4.5 Computational Tests ................................................................................................ 108
4.6 Experimental Validation ......................................................................................... 112
4.7 Summary .................................................................................................................. 115
Chapter 5: Interactive Tube-Bundle Modelling................................................................ 117
5.1 Introduction .............................................................................................................. 117
5.2 Numerical Modeling Results .................................................................................. 120
5.2.1 Saturation Profiles ............................................................................................ 120
5.2.2 Production History ........................................................................................... 121
xi
5.3 Three-Tube Interactive Capillary Model ............................................................... 124
5.4 Extending to an Interacting Tube-Bundle Model .................................................. 134
5.5 Modeling of the Drainage Process.......................................................................... 139
5.5.1 Modeling of Saturation Profiles ...................................................................... 140
5.5.2 Modeling of Drainage History ........................................................................ 141
5.5.3 Modeling of Multi-step Drainage Process...................................................... 145
5.6 Conclusions .............................................................................................................. 151
Chapter 6: Experimental Validation .................................................................................. 153
6.1 Introduction .............................................................................................................. 153
6.2 Apparatus ................................................................................................................. 153
6.2.1 Multi-step Drainage Process using a Sandpack ............................................. 154
6.2.2 Multi-step Drainage Process using a Core Sample ........................................ 155
6.3 Measurement of Resistance/Permeability .............................................................. 156
6.3.1 Procedures ........................................................................................................ 158
6.3.2 Calculation of Resistance/Permeability .......................................................... 159
xii
6.4 Gas Leakage due to Gas Diffusion ......................................................................... 161
6.5 Multi-step Drainage Process using a Sandpack ..................................................... 164
6.5.1 Procedures ........................................................................................................ 164
6.5.2 Calculation of the Basic Parameters ............................................................... 165
6.5.3 Gas/Water System ............................................................................................ 167
6.5.4 Oil/Water System ............................................................................................. 171
6.5.5 Results and Discussions................................................................................... 173
6.6 Multi-step Drainage Process using Core Sample .................................................. 181
6.6.1 Procedure .......................................................................................................... 181
6.6.2 Calculation of the Basic Parameters ............................................................... 182
6.6.3 Gas/Water System ............................................................................................ 184
6.6.4 Oil/Water System ............................................................................................. 189
6.6.5 Gas/Oil/Water System ..................................................................................... 197
6.6.6 Results and Discussions................................................................................... 201
6.7 Summary .................................................................................................................. 210
xiii
6.7.1 Sandpack and Core Sample ............................................................................. 210
6.7.2 Simulation and Analytical ............................................................................... 210
6.7.3 Limitations........................................................................................................ 211
Chapter 7: Conclusions and Recommendations ............................................................... 212
7.1 Summary of Conclusions ........................................................................................ 212
7.2 Recommendations ................................................................................................... 216
Reference ................................................................................................................................. 217
Appendix ................................................................................................................................. 232
A-1 Copyright Permission ............................................................................................... 232
A-2 Interfaces of the Application for History Matching and Visualization ............ 233
A-3 Class for Numerical Simulation of Multistep Drainage Process ....................... 236
A-4 Class for Genetic Algorithm .................................................................................... 250
A-5 Class for Tube-bundle Modeling ............................................................................ 270
xiv
LIST OF TABLES
Table 1.1: Oil recoveries for the primary, secondary and tertiary recovery ........................... 4
Table 1.2: Oil recoveries for varous tertiary recovery methods .............................................. 5
Table 2.1: Core sample parameters used at simulator validation test ................................... 36
Table 3.1: Properties of the core sample and fluids in the numerical experiments .............. 65
Table 3.2: Descriptions of the four runs with an oil/water system, considering experimental
uncertainty ................................................................................................................................. 69
Table 3.3: Descriptions of the four cases the with air/water system considering
experimental uncertainty .......................................................................................................... 73
Table 4.1: Coefficients used in Corey‟s equation to calculate the relative permeability
curves ....................................................................................................................................... 100
Table 4.2: Properties of the core sample and the fluids used in numerical simulation ...... 101
Table 5.1: A comparison of the results calculated from the analytical model and the results
calculated from the interacting tube-bundle model .............................................................. 149
Table 6.1: Basic properties of the oil-wetting and the water-wetting membranes. ............ 155
Table 6.2: Parameters used for hypothetical gas diffusion calculation ............................... 163
xv
Table 6.3: Basic parameters of the sandpack used at the drainage experiment .................. 168
Table 6.4: Measurement of porosity and residual water saturation – Test 1 (Sandpack,
Gas/water System) .................................................................................................................. 169
Table 6.5: Measurement of porosity and residual water saturation – Test 2 (Sandpack,
Gas/water System) .................................................................................................................. 170
Table 6.6: Results of the resistance tests for the sandpack systems .................................... 171
Table 6.7: Measurement of porosity and the residual water saturation (Sandpack, Oil/Water
System) .................................................................................................................................... 172
Table 6.8: Basic parameters of the cores samples ................................................................ 183
Table 6.9: Basic resistance and permeability measured by resistance tests ........................ 184
Table 6.10: The permeabilities and capillary pressures calculated by the numerical
simulation and the analytical model – Gas/Water System. .................................................. 205
Table 6.11: The permeabilities and capillary pressures calculated by the numerical
simulation and the analytical model – Oil/Water System (1). ............................................. 206
Table 6.12: The permeabilities and capillary pressures calculated by the numerical
simulation and the analytical model – Oil/Water System (2). ............................................. 207
Table 6.13: The permeabilities and capillary pressures calculated by the numerical
simulation and the analytical model – Gas/Oil/Water System. ........................................... 208
xvi
xvii
LIST OF FIGURES
Figure 1.1: Phase diagram for a binary mixture system of CO2 and Wasson oil ................. 10
Figure 1.2: Schematic diagram of porous plate method to measure capillary pressure. ...... 20
Figure 1.3: Main structure of the thesis. .................................................................................. 22
Figure 2.1: Cylindrical core sample and membrane configuration. ...................................... 24
Figure 2.2: Differential model for the numerical simulations. .............................................. 32
Figure 2.3: Capillary pressure and relative permeability curves for single-phase flow tests
.................................................................................................................................................... 38
Figure 2.4: Comparison of PcSim and CMG-IMEX 2008 for pseudo-single-phase flow. .. 39
Figure 2.5: Capillary pressure and relative permeability curves for two-phase flow tests .. 41
Figure 2.6: Comparison of PcSim and CMG-IMEX 2008 for two-phase flow. ................... 42
Figure 2.7: Comparison of the wetting phase production histories of the four cases
simulated using different time step. ......................................................................................... 44
Figure 2.8: Comparison of the wetting phase production histories of the four cases
simulated using different block numbers. ............................................................................... 45
xviii
Figure 2.9: Comparison of the wetting phase production histories of the four cases
simulated using different wetting phase viscosities................................................................ 47
Figure 2.10: Comparison of the wetting phase production histories of the four cases
simulated using different nonwetting phase viscosities. ........................................................ 48
Figure 2.11: Comparison of the wetting phase production histories of the five cases
simulated using different membrane/core conductivity ratio................................................. 49
Figure 2.12: The wetting phase (1.0cp) saturation profile along the core sample for
different non-wetting phase viscosities. .................................................................................. 51
Figure 3.1: Conceptual model for multi-step drainage experiment. ...................................... 56
Figure 3.2: Flow chart of GTGA. M individuals are selected as parents. Crossover and
mutation are combined using crossover coefficients ( 5.15.0 i ). .................................. 61
Figure 3.3: Permeability and capillary pressure curves used in the hypothetical experiments.
.................................................................................................................................................... 66
Figure 3.4: Matched permeabilities of the non-wetting phase and the wetting phase, using
conventional GA, in three different runs. ................................................................................ 67
Figure 3.5: Matched results for the hypothetical experiment using GTGA and the spline
function form............................................................................................................................. 68
xix
Figure 3.6: Relative permeabilities retrieved by GTGA with an oil/water system and
experimental measurement uncertainties. ............................................................................... 71
Figure 3.7: Relative permeabilities retrieved by GTGA with an air/water system .............. 74
Figure 4.1: Cylindrical core sample and membrane configuration. ...................................... 82
Figure 4.2: Cylindrical porous medium and the membrane configuration. The porous
medium is sealed by resin to ensure fluids flow in one direction. ......................................... 84
Figure 4.3: Capillary pressure considered as a linear function of the wetting phase
saturation in one drainage step. ................................................................................................ 87
Figure 4.4: Graphic demonstration for the solutions for the eigenvalues ......................... 95
Figure 4.5: The capillary pressure curve and the relative permeability curves calculated
using Corey‟s equation. .......................................................................................................... 100
Figure 4.6: Comparisons of the wetting phase recovery history of the hypothetical model,
the full analytical model and the one term approximation model. ...................................... 103
Figure 4.7: Comparison of the wetting phase recovery history of the hypothetical model
with the membrane resistance, the one term approximation model and the complementary
model. ...................................................................................................................................... 106
Figure 4.8: The linear relationship between the dimensionless time and logarithm of the
dimensionless average saturation for the analytical model and numerical models. ........... 107
xx
Figure 4.9: Linear relationship between the dimensionless time and logarithm of the
dimensionless average saturation for the analytical model and numerical models ............ 109
Figure 4.10: Comparison of the results estimated directly using the analytical model and
the original hypothetical values without the membrane resistance. .................................... 110
Figure 4.11: Comparison of the original hypothetical values and the results estimated
directly using the analytical model with and without membrane resistance revising. ....... 111
Figure 4.12: Capillary pressure measured in Jennings‟ experiment. ................................... 113
Figure 4.13: Capillary pressure measured in Jennings‟ experiment: (a) step one; (b) step
two; (c) step three; (d) step four. ............................................................................................ 114
Figure 4.14: Comparisons of the results obtained using Jennings‟ automatic history
matching method and the directly estimation methods presented in this study. ................. 115
Figure 5.1: Schematic saturation profiles in a drainage process with membrane selective
sealing effect. .......................................................................................................................... 122
Figure 5.2: Schematic of the wetting phase production history in a 4-step drainage process
with the membrane selective sealing effect........................................................................... 124
Figure 5.3: Schematic of the three-tube interacting capillary model: pressure and fluid
distribution. ............................................................................................................................. 125
xxi
Figure 5.4: Schematic of the three-tube interacting capillary model: fluid interaction in the
three-tube interacting capillary model. .................................................................................. 127
Figure 5.5: Pressure profiles in the three-tube interacting capillary model. ....................... 131
Figure 5.6: Results of the sample calculations with the three-tube interacting capillary
model. ...................................................................................................................................... 133
Figure 5.7: Schematic of an interacting tube-bundle model. ............................................... 135
Figure 5.8: Tube radius distribution satisfying truncated Weibull distribution. ................. 139
Figure 5.9: Wetting phase saturation profiles in the interacting tube-bundle model. ........ 142
Figure 5.10: Wetting phase production history of the interacting tube-bundle model with
different numbers of capillary tubes. ..................................................................................... 143
Figure 5.11: Relationship of R 1ln and time calculated using the interacting tube-
bundle model with different numbers of capillary tubes. ..................................................... 144
Figure 5.12: Capillary pressure curve calculated from the pore size distribution and the
drainage pressures used in the 5-step drainage experiment. ................................................ 145
Figure 5.13: Cumulative wetting phase production history in the 5-step drainage process
modeled by the interacting tube-bundle model. .................................................................... 146
Figure 5.14: Cumulative wetting phase production history in the 5-step drainage process
modeled by the interacting tube-bundle model. .................................................................... 147
xxii
Figure 5.15: Wetting phase recovery histories at each drainage step in the 5-step drainage
process. .................................................................................................................................... 147
Figure 5.16: Calculated relative permeabilities of water from the analytical model and the
interactive tube bundle model. ............................................................................................... 150
Figure 6.1: Schematic diagram for the multi-step drainage process using a sandpack. ..... 154
Figure 6.2: Schematic diagram of the multi-step drainage system using a core sample. ... 156
Figure 6.3: A photo of the apparatus for the multi-step drainage process using core sample.
.................................................................................................................................................. 157
Figure 6.4: An example for the permeability/resistance test data processing. .................... 158
Figure 6.5: Linear regression to calculate conductivity of target flow system. .................. 161
Figure 6.6: Schematic of the gas diffusion model through the membrane. ........................ 164
Figure 6.7: The experimental and the calibrated cumulative water production histories. . 174
Figure 6.8: The experimental cumulative water production histories and history matching
results of oil/water system in sandpack. ................................................................................ 175
Figure 6.9: History matching results of gas/water system in sandpack. ............................. 176
Figure 6.10: Calculation of the relative permeabilities to water for the gas/water system in
sandpack. ................................................................................................................................. 177
xxiii
Figure 6.11: Calculation of the relative permeabilities to water for an oil/water system in
sandpack. ................................................................................................................................. 178
Figure 6.12: Capillary pressure measurement in the sandpack............................................ 179
Figure 6.13: Comparisons of the relative permeabilities of the wetting phase in the
sandpack obtained from simulation and analytical equation. .............................................. 180
Figure 6.14: Water production history at a three step gas/water system. ............................ 185
Figure 6.15: Gas diffusion rate measured in a multi-step drainage experiment with
gas/water. ................................................................................................................................. 186
Figure 6.16: Water production history of the gas/water system and the results of history
matching. ................................................................................................................................. 187
Figure 6.17: Calculations of the relative permeabilities to water using the analytical method
for the gas/water system. ........................................................................................................ 188
Figure 6.18: Cumulative water production history in a four-step drainage process using
oil/water (1) system. ............................................................................................................... 190
Figure 6.19: Cumulative water production history in a five-step drainage process using
oil/water system. ..................................................................................................................... 191
Figure 6.20: Water production history and the results of history matching....................... 192
Figure 6.21: Water production history and the results of history matching........................ 193
xxiv
Figure 6.22: Comparison of history matched results using Corey‟s equation and monotone
cublic spline functions. ........................................................................................................... 194
Figure 6.23: The calculations of the relative permeabilities to water using the analytical
method for the water/oil (1) system. ...................................................................................... 195
Figure 6.24: Calculations of the relative permeabilities to water using the analytical
method for the water/oil (2) system. ...................................................................................... 196
Figure 6.25: Cumulative kerosene production history in a four-step drainage process. ... 198
Figure 6.26: Diffusion of air through the membrane in kerosene. ..................................... 199
Figure 6.27: Kerosene production history and the results of history matching .................. 200
Figure 6.28: The calculations of the relative permeabilities to water using the analytical
method for the gas/water/oil system. ..................................................................................... 201
Figure 6.29: Comparisons of the capillary pressure curves measured for different fluid
systems. ................................................................................................................................... 203
Figure 6.30: Comparisons of the relative permeabilities calculated from numerical
simulation for different systems............................................................................................. 204
Figure 6.31: Comparisons of the relative permeabilities of the wetting phase obtained from
simulation and analytical equation. ....................................................................................... 209
xxv
NOMENCLATURES
English Letters
A Cross-sectional area of the core sample/sandpack
kA Cross-sectional area of the thk tube in ITBM
c Gravity to capillary pressure factor
1e Inlet boundary of the core sample/sandpack
2e Outlet boundary of the core sample/sandpack
F Fitness of an individual in genetic algorithm
k Slope of the fitted straight line in the analytical model
K Permeability of the core sample/sandpack
mK
Permeability of the membrane
rnK
Relative permeabilities of the nonwetting phase
rwK
Relative permeabilities of the wetting phase
L Length of the core sample/sandpack
mL
Length of the membrane
klL , Length of different section at the left side of the ITBM
krL , Length of different section at the right side of the ITBM
xxvi
kl Length of different sections in the 3 tube interactive model
nN
Exponent of the nonwetting phase relative permeability in Corey's Equation
wN
Exponent of the wetting phase relative permeability in Corey's Equation
pcN
Exponent of the capillary pressure in Corey's Equation
N Total number of tubes displaced by the nonwetting phase in one drainage step
gN
Total number of tubes initially filled with the nonwetting phase
wN
Total number of tubes initially filled with the wetting phase
LeftN
Total number of tubes broken through at the left side
RightN
Total number of tubes broken through at the right side
kP
Pressure at different location of the 3 tube interactive capillary model
nP
Pressure of the non-wetting phase
wP
Pressure of the wetting phase
inP
Non-wetting phase pressure at the inlet
outP
Wetting phase pressure at the outlet
'outP
Wetting phase pressure at the interface of the membrane and the core
sample/Sandpack
cP
Capillary pressure
max
cP
Capillary pressure at wrS
xxvii
mP
Pressure drop along the membrane
kcP , Capillary pressure in different tubes of ITBM
klP , Pressure at different tubes at the left side of ITBM
krP , Pressure at different tubes at the right side of ITBM
PV Pore volume of the core sample/sandpack
wq
Wetting phase flow rate
nq
Non-wetting phase flow rate
wmq
Wetting phase flow rate in the membrane
Q Total flow rate in the 3 tube interactive capillary model
simQ
Cumulative wetting phase production from simulation model
expQ
Cumulative wetting phase production from experiments
R Oil recovery in an imbibition process
*R Normalized oil recovery
0R
Maximum oil recovery
pvR
Recovery in the units of pore volume
kR
Radius of different tubes in the three tube interactive model
NR
Radius of the smallest tube which will be broken though in this drainage step
1wR
Radius of the largest tube which will not be broken though in this drainage step
xxviii
nS
Saturation of the non-wetting phase
wS
Saturation of the wetting phase
gS
Saturation of the gas phase
wrS Wetting phase saturation at
max
cP
nrS
Non-wetting phase residual saturation
wiS
Initial wetting phase saturation at the beginning of one drainage step
wfS
Water saturation behind an imbibition front
wDS
Normalized saturation of the wetting phase
wDS Normalized average saturation of the wetting phase
t Drainage/imbibition time
Dkt
Normalized drainage time without the relative permeability to the wetting phase
Dt Normalized drainage/imbibition time
T Total number of experiment records
wT
Transmissibility of the wetting phase
nT
Transmissibility of the non-wetting phase
wV
Cumulative volume the wetting phase
tV
Total cumulative produced volume of the wetting phase in one single drainage step
x Coordinate along the core sample/sandpack
xxix
Dx Normalized coordinate along the core sample
x Block size of the 1-demension simulator
Greek Symbols
Interfacial tension between gas and water
ji
Mobility index, i is the index of the tubes; j is the phase index for gas or water
w Mobility of the wetting phase
n Mobility of the non-wetting phase
m Hydraulic conductivity of the membrane
n Viscosity of the non-wetting phase
w Viscosity of the wetting phase
g Viscosity of the gas phase
Porosity of the core sample/sandpack
Conductivity ratio of the core sample/sandpack to the membrane
1
CHAPTER 1: INTRODUCTION
1.1 Introduction
The gas drainage process, a process whereby a non-wetting phase displaces a wetting
phase, is a common process in petroleum engineering, for applications such as the gas
flood, NCG(non-condensable gas) injection, CO2 storage and thermal SAGD (steam
assisted gravity drainage) process. The relative permeabilities at low wetting phase
saturation and the end psoints are important to both the oil recovery and gas storage
capacity.
In recent decades, global warming, characterized by the continuous increase in the average
atmospheric temperature at the earth surface since the mid-twentieth century, is generally
believed to be caused by increasing concentrations of greenhouse gases, which result from
human activities such as the burning of fossil fuel and deforestation. CO2 is one of the
leading members of the greenhouse gas club. With the development of economy and
industry, the amount of CO2 emitted by the human activities will rapidly increase.
According to the International Energy Outlook reference case in 2007, the world CO2
emission is expected to rise from 26.9 billion metric tons in 2004 to 33.9 billion metric
tons in 2015 and 42.9 billion metric tons in 2030. To control the emission of CO2, the
2
Kyoto Protocol aiming to reduce the concentration of greenhouse gases that cause global
warming was signed in Kyoto, Japan in December 1997.
According to the Organization of Economic Cooperation and Development statistics,
Canada is the third-worst of 30 countries when it comes to CO2 emissions per capita and
ninth-worst on emissions on a GDP basis. The Kyoto Protocol set targets for reducing
greenhouse gas emissions starting in 2008. Canada agreed to cut its emissions by six
percent below the level in 1990 by 2012. In order to realize this target, one of the most
promising options is to capture, inject and store CO2 in underground geological formations.
Oil fields, gas fields, saline formations, unminable coal seams, and saline-filled basalt
formations have been suggested as sequestration sites. Among these candidate geological
formations for CO2 sequestration, depleted oil reservoirs are the most appealing option for
the following reasons (Wang et al., 2009). First, depleted oil reservoirs have been
extensively investigated during the oil exploitation stage. To sequester CO2 safely in
geological time requires a clear understanding about the geological structure of the
sequestration site. Second, the underground and the surface infrastructure (wells,
equipment, and pipelines) are already available and could be modified and used for CO2
injection. Third, injection of large amounts of CO2 can potentially increase oil recovery.
By increasing oil recovery, injection of CO2 in depleted oil reservoirs can effectively offset
the expenditures of the sequestration.
Canada, as a major petroleum production country, has great potential to sequester CO2 in
depleted oil reservoirs. Oil pools in Alberta have been characterized and evaluated for
CO2-EOR and CO2 sequestration by several researchers (Bachu and Steward, 2002; Bachu
3
and Shaw, 2002; Bachu, 2002; Bachu and Shaw, 2003). Based on their results, there are
9,128 pools in total in Alberta, including light, medium and heavy oil pools in 2001. Of
these, CO2 sequestration capacity for 8,159 pools was estimated and 929 pools were
considered unsuitable for CO2 sequestration due to data loss, steam injection and the
commingled of pools (Bachu and Steward, 2002). The total capacity of these oil pools is
2,857×106 ton, with 2,468×10
6 ton in light and medium oil pools and 389×10
6 ton in heavy
oil pools.
Although CO2 sequestration in depleted oil reservoirs, as a post-EOR process, provides an
appealing option to sequester green house gas in the atmosphere, there are also some
challenges (Dong et al., 2008). These challenges all require the investigation of fluid flow
abilities during gas storage at low liquid saturations.
First, the ultimate oil recovery of non-wetting gas flooding requires investigating the fluid
flow mechanisms at low liquid saturations. The ultimate oil recoveries of most recovery
methods are summarized in Table 1.1 and Table 1.2 (Schumacher, 1980; Brock and Bryan,
1989; Green and Willhite, 1998; Kon Wyatt et al., 2002). There is still more than 30% oil
left in the oil reservoirs after most tertiary oil recovery methods. The remaining oil after
CO2 sequestration is one of the obstacles to employ depleted oil reservoirs as sequestration
sites. Therefore, before we put sequestration projects into practice, we must have a clear
understanding about what residual oil saturation can be achieved in the reservoirs after
sequestration. From another aspect, if a large amount of CO2 is injected into the reservoirs
and sequestered over geological time, will the remaining oil flow to the bottom of the
reservoir in long time run and be recovered in the future? Moreover, the evacuation of oil
4
could provide more available space, thus enhancing the sequestration capacity of the
selected reservoirs and lowering monitoring and management costs. Therefore, reducing of
oil saturation requires studying the fluid flow mechanism during CO2 sequestration.
Table 1.1: Oil recoveries for the primary, secondary and tertiary recovery
Methods Recovery
Primary 5%-20%
Water Flooding 30%-45%
Tertiary recovery 30%-75%
Second, to enhance CO2 storage capacity requires a clear understanding of the fluid flow
mechanisms at low liquid saturations. Depleted oil reservoirs usually have undergone
primary, secondary (waterflooding) and enhanced (such as chemical or CO2 flooding) oil
recovery processes. In both the secondary and enhanced oil recovery processes, a
considerable amount of water is injected into the reservoirs to displace oil, maintain
reservoir pressure, or improve sweep efficiency (in water-alternating-gas, miscible and
immiscible process). As most oil reservoir formations are water wet, the retention of a
large portion of the injected water in the reservoirs is a common consequence of secondary
and enhanced oil recovery processes. The available space in most depleted oil reservoirs
for storing CO2 is quite limited because a large portion of the reservoir is occupied by the
5
injected water, edge water and bottom water. The available space for CO2 in free
supercritical gas phase is significantly reduced. CO2 storage capacity of depleted oil
reservoirs is remarkably reduced if CO2 is just sequestered as solution gas in brine.
Therefore, it is very significant to remove remaining water from depleted oil reservoirs to
achieve a maximum storage capacity.
Table 1.2: Oil recoveries for varous tertiary recovery methods
Methods Recovery
Immiscible gas drive CO2 40-60%
Miscible gas flooding
CO2 40-65%
Enriched Gas 40-65%
Chemical
Polymer 50-70%
Alkali 45 to 70%
ASP 45 to 75%
Finally, study of fluid flow mechanisms of CO2 sequestration is of significance to evaluate
the risk of CO2 sequestration project. In geologic time frame, CO2 will never keep as a
stationary fluid in the reservoir. Micro scale film flow, mass transfer and capillary
phenomena, together with macro scale gravity differentiation, macro convection, and fluid
6
migration may decrease the safety of CO2 sequestration project. tTese processes all involve
fluid flow at low liquid saturations.
In summary, to reduce the concentration of CO2 in the atmosphere, and thus reduce the
global green house effect, requires the study of CO2 sequestration technology in depleted
oil reservoirs. To decrease costs, reduce risks, and enhance the capacity of CO2
sequestration in depleted oil reservoirs require an accurate understanding of fluid flow
mechanisms at low liquid saturations during CO2 sequestration processes.
Although there are many methods available to measure the capillary pressure, none are
currently used directly under high pressure. Meanwhile, the drainage process is also a
dynamic process involving multiphase fluid flow in porous media. No method has been
mentioned till now to obtain relative permeability curves during capillary test.
The above challenges require investigating the fluid flow mechanism at low liquid
saturations during CO2 sequestration. Capillary pressure and relative permeabilities are
crucial properties to multi-phase statics and dynamics of fluids in porous media. When a
considerable amount CO2 is injected in a reservoir, the reservoir fluids will flow at
relatively low liquid phase saturations, at which, the liquid phase relative permeability is
relatively low while the capillary pressure is relatively high. The gravity-assisted-film flow
will also help to improve the mobility of liquid phases at low saturation. Although the
mechanism of CO2 enhanced oil recovery has been studied for decades, it is still very
difficult to use conventional core flood method to measure the relative permeabilities at
low liquid saturations.
7
Gas drainage processes are very popular in both petroleum engineering such as CO2
storage, gas flood, steam assisted gravity drainage, NCG injection, and environment
engineering such as gas invaded into a vague zone. In this chapter, literature review was
conducted on the mechanisms of gas drainage process. The dominant factors for a gas
drainage process were analyzed using numerical simulation and the flow functions
(capillary pressure and relative permeability) measurement methods was then listed and
compared with each other.
1.2 Mechanisms of Gas Drainage
Among all gas drainage process, CO2 injection may be considered as one of the most
complex processes. CO2 flooding, as one of the most important enhanced oil recovery
methods, has already been studied for decades. The mechanisms of CO2 enhanced oil
recovery are discussed as belows.
1.2.1 Gravity Drainage and Film Flow
Lab experiments with high-pressure visualization micromodels were used to investigate the
recovery mechanisms of CO2 flood in the past decade (Sohrabi et al., 2000; Sohrabi et al.,
2008). Sohrabi et al. (2008) conducted experiments at conditions of very low gas–oil
interfacial tension, negligible gravity forces, and a water-wet porous medium. The
visualizations of pore-scale fluid distribution and displacement mechanisms during the
recovery of residual oil by near-miscible hydrocarbon gas and simultaneous water and gas
injection (SWAG) were presented. They demonstrated that a significant amount of residual
8
oil left behind after waterflood can be recovered by both near-miscible gas and SWAG
injection. In particular, they showed that in both processes, the recovery of the contacted
residual oil continues behind the main gas front and ultimately all of the oil that can be
contacted by the gas will be recovered. Combined with gravity drainage, the mechanism
should be more effective.
1.2.2 Interfacial Tension Reduction
Reduction of interfacial tension between oil and water by the solution of CO2 was observed
by several researchers (Farouq, 1985; Camal, 1986). Camal observed that for heavy oil
with dissolved CO2 of 50-100 m3/m
3, a 30% reduction of interfacial tension can be
expected. For water-wetting reservoirs, reduction of interfacial tension enhances the
mobility of the oil, reduces the residual oil saturation and improves final oil recovery.
1.2.3 CO2/Oil Phase Behavior
PVT tests show that CO2 is not as miscible with most crude oils as hydrocarbon solvents,
but it is soluble with crude oil and water at reservoir temperature and pressure. Figure 1.1
presented the phase diagram of CO2 mixed with Wasson oil containing dissolved gas at 32 ℃
(Orr et al., 1982). The original oil without CO2 is a liquid at pressures above 900 psi and
splits into liquid and gas below this pressure. A mixture containing 40 mol percentage CO2
forms a single liquid phase at pressures above 1,350 psi and a liquid phase and a gas phase
at lower pressures. At high CO2 concentrations, the phase behaviour is more complex. At
low pressures, liquid and gas phases form. With the increase of pressure, the gas phase,
9
which contains CO2 and light hydrocarbon gases, condenses into a second liquid phase.
There is a narrow pressure range over which two liquids and a vapour coexists. Above
these pressures, two liquids form, a CO2-rich liquid and an oil-rich liquid. At higher
temperatures, the two-phase region has the same general shape, but three-phase region will
not show up. Instead, the CO2-rich phase is a low-density gas at low pressures and a dense
supercritical phase at high pressures. From the phase diagram, it can be seen that when the
mole percent of CO2 is larger than 70%, there will be two phases, either a system with
liquid/vapour or a system with liquid/liquid.
1.2.4 Multiple-Contact-Miscible
The swelling factor for oil is relatively small. If swelling factor alone accounted for the
recovery of oil in CO2 flooding, the incremental recovery of oil would be relatively low.
However, under the right circumstances, CO2 can be multiple-contact-miscible with oil
(Hutchinson and Braun, 1961). In a multiple-contact-miscible, CO2 mixes with oil
continuously and the mixing process is repeated until the critical tie line is reached and
there will be two-phase region showing up. But if the oil composition or PVT conditions
are different, multiple-contact-miscible cannot be developed.
1.2.5 Swelling Effect
CO2 is a quite soluble gas in crude oil at typical reservoir pressure, but not miscible in all
proportions at any pressure. When CO2 is mixed with oil, at the very beginning it just
simply dissolves in the oil phase as solution gas. The solution of CO2 in the oil phase
10
results in expansion in the volume of oil/gas mixture. Simon (1965) introduced generalized
correlations for the CO2 solubility and swelling effect. Basically, at low CO2 mole fraction,
the dissolving effect happens, the volume of the binary mixture increases and the oil
expands as an additional CO2 solution. As CO2 mole fraction increases, a second CO2-rich
phase shows up and this phase extracts light hydrocarbons from the oil and causes the oil
phase to become denser and more viscous.
Figure 1.1: Phase diagram for a binary mixture system of CO2 and Wasson oil at 32 ℃ (Orr,
1982).
0
1000
2000
3000
4000
5000
6000
0 20 40 60 80 100
Mole Percent CO2, %
Pre
ss
ure
, p
si
Liquid Phase
(CO2 Dissoved in Oil)
Two Liquid Phases
(CO2 and Oil
in Each Phase)
Two Liquid + Vapor
Liquid (Oil + CO2)
+ Vapor (CO2 + Light Component)
11
1.2.6 Viscosity Reduction
The dissolved CO2 can decrease the viscosity of oil phase before the appearance of the CO2
rich phase. When two phases form, the CO2 rich phase extracts light component from oil,
which makes oil rich phase more vicious the it otherwise would be. Although the viscosity
of the mixture of oil and dissolved CO2 is lower than that of the original oil, unfortunately,
the viscosity of the CO2-oil mixture is still much higher that of the CO2 rich phase.
Therefore, the performance of a CO2 flood on a reservoir scale is also influenced by the
macroscopic behaviour of the displacement regions occur as CO2 pushes oil. The sharp
viscosity fingering effect is the main problem in CO2 flooding process.
1.2.7 Blow-Down Recovery
The energy stored by CO2 when it goes into solution with an increase in pressure is
released when the pressure is decreased after flooding and continues to drive the oil to the
well bore (Kamal, 1986). The blow-down recovery following an immiscible CO2 flood is
very effective in recovering additional oil during the later stage of an oil reservoir life. The
solution gas drive mechanism is involved in this process. However, this mechanism is not
relevant for a gas storage process when pressure is maintained.
CO2 sequestration is a post-EOR process. There are some significant differences between
CO2 EOR and CO2 sequestration (Wang et al., 2009): (1) the target of CO2 sequestration is
to store as much CO2 as possible safely in a long period, while EOR process requires
12
minimizing the usage of CO2 but recovering more oil. (2) CO2 sequestration is a process
involving great amount of non-wetting gas injection, which will result in the reservoir
fluids flow at high capillary pressures and low liquid phase relative permeabilities. (3) CO2
sequestration is a slow and long-term process. The roles of gravity drainage and film flow
become dominant over a long period of time.
The maximization of CO2 storage capacity and benefits in the underground formations
have attracted more and more attention in recent decade (Vidiuk and Cunha 2007; Wang et
al., 2009; Jahangiri, 2010). Gas injection into underground formations is usually a process
that non-wetting phase displaces wetting phase(s). At low wetting phase saturation, the
capillary pressure becomes essentially high and the relative permeability of wetting phase
becomes relative low. Capillary pressure and relative permeability are dominating
functions required to model the fluid flow and distribution in porous media. Accurate
capillary pressure and relative permeabilities data are thereby required for a successful
simulation to maximize the CO2 storage capacity and benefits in these underground
formations.
1.2.8 Capillary Pressure
Most of the potential sequestration sites, such as depleted gas reservoirs, depleted oil
reservoirs, and especially underground aquifer formation, have great percentage of brine.
These brines mainly come from injected water in the improved oil recovery period, the
connate water, and edge or bottom water supplement. When CO2 is injected into depleted
oil reservoirs or underground aquifer formations, a drainage process that non-wetting phase
13
displace wetting phase happens. As the decrease of liquid saturation, the capillary pressure
became relative high and the relative permeabilities of the liquid phase(s) become
essentially low. Reservoir simulation showed that the capillary pressure magnitude directly
influence the CO2 storage capacity in these underground formations (Wang et al., 2009;
Wang and Dong, 2011). Macroscopically speaking, these flow functions affect the fluid
distributions and fluids motilities. Microscopically speaking, the capillary pressure can
hold the brine and oil in the corner of the pore structure. Therefore, the magnitude of
capillary pressure has very important influence on the storage capacity.
1.2.9 Irreducible Wetting-phase Saturations
Typically drainage capillary pressure curves indicate an irreducible saturation. It is
assumed that wetting phase loses the hydraulic continuity and has no conductivity below
this situation. It is generally believed that water can only flow above this saturation.
However, experiments researching on the residual wetting phase in porous media which
have been carried out since 1970s show that there should be no specific irreducible wetting
phase saturation for most real porous media. The preferentially wetting phase in porous
media is always continuous and conductive along the pore edges and grooves, even at very
low saturation. The existence of the residual liquids was discussed and modelled by Bryant
and Johnson (2001). There is no remarkable irreducible wetting phase saturation for most
real porous media. The existence of sub-irreducible water saturation in some natural gas
reservoirs or even without water indicates the possibility that the CO2 reservoirs with sub-
irreducible liquid saturations can exist stably for geologic time. Specific additional
14
documentation on sub-irreducible water saturation reservoirs is provided by Katz et
al.(1982). The reasons for these sub-irreducible water saturations are believed to be a
combined effect of dehydration, desiccation, compaction, mixed wettability, gravity
drainage, and diagenetic effects occurring during geologic time (Gupta, 2009).
Morrow(1970; 1971) studied systematically the residual wetting phase in porous media by
experiments using packing of clean sands and microspheres, investigating the influence of
interfacial tension, viscosity, fluid density, viscoelasticity, contact angle, mix wettability,
particle shape, pore shape, permeability, porosity and particle size distribution on the
magnitude of irreducible wetting phase saturation. He concluded that all the above factors
have very minor impact on the residual wetting phase saturations. The magnitude of
irreducible wetting phase saturations is dominated by heterogeneity of pore structure. The
irreducible wetting phase saturations in the sphere packing are in the range of 6% to 10%,
much lower than the connate water saturations commonly observed in practice. The later
experimental works by Dullien et al.(1986; 1989) provided evidence that wetting phase has
the hydraulic continuity along the edges and grooves in porous media even at very low
saturation. They conducted experiments based on sandstone samples and etched glass bead.
The residual wetting phase saturation can reach as low as 1% in the etched glass bead
packs. The residual wetting saturation in Berea sandstone reached 10% by the application
of capillary pressure of about 1 atm. Raising the capillary pressure to 27 atm, the wetting
saturation was reduced to 5%. The lowest value of residual oil saturation was 0.8%.
15
1.2.10 Film Flow and Liquid Mobility at Low Saturation
The extra low liquid saturations in Dullien et al.‟s (1986; 1989) experiments indicates that
even below residual saturation measured in the lab, the liquid(s) still can have mobility.
This mobility is believed to be caused by film flow. As the saturation decreases, the fluid
flow in a porous media takes place in two steps, bulk liquids flow below the gas/liquid
interface and film flow above the interface. Chatzis (1988) did micromodel study and
found that both flow mechanisms are influenced by the wetting film left behind the
gas/liquid interface. Stead-state flow has already studied by several researchers. Ransohoff
and Radke (1988) numerically solved the steady-state corner flow problem and defined
resistance factors to the flow for various corner configurations. Patzek and Kristensen
(2001) took the contact angle into consideration and proposed a universal curve for the
corner flow in arbitrary angular tube. Unsteady-state flow was first proposed by Bird et
al.(1960) by providing a solution for thin-film 2D flow using analytical approaches. Dong
et al.(Dong et al.1994; Dong, 1995) used finite element method to solve oil film flow over
water film problem in angular cross-section. Xu (2008) combined bulk flow and film flow
together and examined effect of the capillary pressure at the bottom interface.
1.3 Sensitivity Study on CO2 Storage
Some preliminary studies regarding how to maximize the CO2 storage capacity have
already been done in 2009 (Wang et al., 2009). Core flooding tests and core-scale
16
simulations were conducted to evaluate influencing parameters on core scale storage
capacity during CO2 sequestration. It has been concluded that:
(1) The gravity drainage effect plays a significant role in any gas storage/drainage process
in thick reservoirs and reservoirs with dip angles. A vertical displacing direction pattern is
recommended for well pattern design.
(2) It is confirmed that the irreducible water saturation varies under different core flood
inclination angles and the endpoint of the relative permeability curve varies with the fluid
flow direction and the injection rate. Conventional core flood tests are not reliable to
measure the end points.
(3) Orthogonal experiment results show that capillary pressure/relative permeabilities, fluid
flow direction and average pressure are the top three factors that have impacts on gas
saturation. For any gas drainage process, the flow functions, especially the capillary
pressure and relative permeabilities directly determine the gas storage capacity and oil
displacement efficiency.
(4) More studies about the measurement of the relative permeability close to the irreducible
water saturation are necessary.
1.4 Method for Determination of Flow Functions
Since 1950, there are several different methods for determinations of the relative
permeabilities and the capillary pressure reported in the literature. Generally, capillary
17
pressure and relative permeabilities are measured independently. According to the
apparatus and corresponding mechanisms, the measurement of relative permeabilities was
categorized under two types as forward and reverse methods, while capillary pressure
measurements generally include five catalogues: porous plate method, mercury injection
method, centrifuge method, dynamic method and vapour pressure method.
1.4.1 Measurement of Relative Permeabilities
Forward methods are the methods by which relative permeabilities can be obtained directly
from the coreflood test results, either steady-state experiments or unsteady-state
experiments. The steady-state method is the most direct way to measure the relative
permeabilities from coreflood tests (Marle, 1981). In order to obtain a complete set of
relative permeabilities, the fluid mixture is injected under different flow fractions. The
relative permeabilities are calculated by pressure drops and corresponding flow rates till
the production flow rates is identical as that at the inlet. This method is simple but very
time-consuming. The unsteady-state methods, such as JBN method (Johnson, et al., 1959),
have been widely used and well developed because the unsteady-state methods is time-
effective and can be finished very quickly, although it is more rigorous compared to the
steady-state methods. However, most forward methods require applying some
experimental conditions ignore capillary pressure such as Penn-State method (MacAllister
et al., 1990), high rate methods (Maini et al., 1989), stationary-liquid method (Ning and
Holditch, 1990) or an ancillary capillary curve measure in another experimental run.
18
However, if the capillary pressure is high, these experimental conditions are not easy to be
applied.
Reverse methods by automatic history matching the coreflood production data make
simultaneous determination of capillary pressure and relative permeability possible
(Richmond and Watson, 1990; Oak, 1990). These methods require measuring the pressure
drop and production history in coreflood experiments. One dimensional simulator
combined with a non-linear regression algorithm is used to extract the observed parameters
by history matching the experimental results. Many researchers (Dane et al., 1998; Ucan,
et al., 1998; Watson et al., 1998a; Watson et al., 1998b; Esam, 2002a; Esam, 2002b) did
experiments based on relative permeabilities test and meanwhile the capillary pressure
curves are tested simultaneous. Among them, Ayub et al.(2001) provided a set of complex
system and systematic methodology to measure capillary pressure and relative
permeabilities at the same time. Relative permeabilities measurements recently have
achieved great improvement.
1.4.2 Measurement of Capillary Pressure
The porous plate method (Bruce and Welge, 1947) is one of the conventional methods to
measure the capillary pressure of porous media. As shown Figure 1.2, the wetting fluid is
forced out of the sample through the porous plate and collected in the U-tube in the
drainage curve and imbibes into the core and displaces the non-wetting fluid by decreasing
the capillary pressure. The main disadvantage of this method is very time consuming.
Similarly, Kalaydjian (1992) conducted a horizontal three-phase capillary pressure curves
19
measurement in both drainage and imbibition on an outcrop water wet sample and on
unconsolidated water wet cores. The two ends of the coreholder were equipped with semi-
permeable membranes. The gas phase was injected through the lateral surface using two
inlets. His measurements results shown that both drainage and imbibition capillary
pressures are the function of the three saturations. The spreading coefficient effects on both
drainage and imbibition capillary pressure curves are quantified.
Mercury injection method was first adapted by Purcell (1949). In the test, mercury was
injected into the dry and evacuated porous media as a drainage process, while the
withdrawal of mercury presents the imbibition process. The measurement of capillary
pressure by mercury injection is fast and can be applied to irregularly shaped rock sample.
But the disposal of mercury and damage of the sample limit the application of this method
to some extent. Centrifuge method appeared in 1951, the centrifugal force due to the
revolving of the device produce the pressure difference to conduct imbibition and drainage
processes. The capillary data get from the centrifugal method is relatively accurate and
quick, but complex analysis required can lead to calculation errors and the experimental
device is relatively expensive. The vapour pressure method was presented by Melrose,
(1990) and Melrose et al. (1991).
20
Brine
Oil
Nitrogen Pressure
Spring
Core
Seal Oil
Ruler
Figure 1.2: Schematic diagram of porous plate method to measure capillary pressure.
21
1.5 Objectives and Roadmap
The PhD. thesis focuses on the variant modelling methods of the multi-step drainage
process. Using the models developed in the dissertation, the relative permeability can be
estimated when measuring capillary pressure in a multi-step drainage process. The details
topics include, as shown in Figure 1.3:
(1) Develop a numerical program to simulate the multi-step drainage process. The purpose
of the program is (a) virtual numerical experiments (b) automatic history matching (c)
benchmark the analytical model and the pore scale model.
(2) Apply the reversed method using automatic history matching and genetic algorithm to
simultaneously obtain relative permeabilities when measuring the capillary pressure using
multi-step drainage process.
(3) Derive analytical model to directly estimate the relative permeabilities using the data
from multi-step drainage process.
(4) Build pore-scale/tube-bundle models to investigate the fluid flow mechanisms in the
multi-step drainage process.
(5) Carry out laboratory experiments to measure the capillary pressures and relative
permeabilities at low liquid phase saturations especially near and below the conventional
residual oil saturation and irreducible water saturation.
22
Figure 1.3: Main structure of the thesis.
23
CHAPTER 2: NUMERICAL MODELING
2.1 Introduction
This chapter presents the mathematical equations describing unsteady state two-phase flow
in porous media during the multi-step drainage process. The basic assumptions are
introduced to model the multi-step drainage process and build the mathematical model.
The general mass conservation equations and its boundary conditions and initial conditions
are then listed in details. The detailed numerical solution procedure for the two phase flow
drainage model considering the membrane sealing effect is presented. The grid system,
inter-block transmissibility treatments, and solving methods are introduced and a one
dimension numerical simulator, PcSim, was developed using C++. Commercial simulation
packages were used to validate the accuracy of the simulator. In order to choose
appropriate parameters for the further investigations, sensitivity analyses about grid system,
relative permeabilities and membrane hydraulic conductivity were carried out.
2.2 Model Assumptions
As shown in Figure 2.1, the geometry of the experimental model used for the multi-step
drainage process is a thin cylindrical core sample whose rim is sealed by resin. The outlet
of the core sample connects to a thin plastic membrane. Within the breakthrough pressure
24
of the membrane, only wetting phase is allowed to flow through the membrane. Gas is
injected into the sample from the inlet and the wetting phase is expelled from the outlet by
the injected gas. A multi-step drainage process consists of several single drainage steps. In
each step, the wetting phase saturation starts from equilibrium status, then the gas phase
pressure is increased to a new level and the wetting phase recovery history are recorded.
)(WaterOutlet
imper
mea
ble
imperm
eable
membrane
)(GasInlet
Figure 2.1: Cylindrical core sample and membrane configuration. Core sample is sealed by
resin to keep the fluid flow in vertical direction.
25
Since the saturation variation is small within one drainage step and the porous plate is
relative thin, the following assumptions are made to develop the model:
(1) Fluid flows satisfy Darcy‟s law and there is no fluid flow in horizontal direction;
(2) The core sample and the membrane are homogeneous;
(3) Liquid phases are saturated by gas and the solubility of the gas in the liquids phase is
unchanged in the capillary test pressure changing range;
(5) Gravity is neligible comparing to capillary pressure;
(6) There is no flow in the membrane for the non-wetting gas phase;
(7) The breakthrough pressure of the membrane is not exceeded;
(8) There is no chemical reaction, dispersion, or adsorption.
2.3 Mathematical Model
The mathematic model a multistep drainage process can be described as a two-phase
incompressible flow in one dimension governed by the following mass balance equations
(Gottfried et al., 1966):
t
SqP
KK n
nn
n
rn
...................................... (2-1)
26
t
SqP
KK w
ww
w
rw
..................................... (2-2)
Two auxiliary equations are:
wnc PPP ..................................................... (2-3)
1 nw SS ...................................................... (2-4)
where K is the permeability of the core sample; rnK and rwK are relative permeabilities
for non-wetting phase and wetting phase; n and w are viscosities for non-wetting phase
and wetting phase; is the porosity of the core sample; nS and wS are saturations of non-
wetting phase and wetting phase; nP and wP are pressures of non-wetting phase and
wetting phase.
2.4 Boundary Conditions and Initial Conditions
For one drainage step, the following equations are used as initial conditions and boundary
conditions. When 0t , the initial wetting phase saturation in the core sample is wiS and
wetting phase pressure equals to the pressure at the outlet outP . Therefore, the initial
conditions are written as follows:
witw SS 0| ...................................................... (2-5)
27
outtw PP 0| ..................................................... (2-6)
where wiS is the initial wetting phase saturation and
outP is the wetting phase pressure at
the outlet. At the inlet, the boundary conditions are written as:
01
ewq ........................................................ (2-7)
inen PP 1
....................................................... (2-8)
where, wq is the wetting phase flow rate. inP is the pressure at the inlet. At the outlet, the
boundary conditions are different from conventional coreflood test model. The boundary
conditions are written as:
02
enq ........................................................ (2-9)
'2 outew PP ................................................... (2-10)
mwewoutout qPP 2
' ........................................... (2-11)
where 1e and 2e represent inlet boundary and outlet boundary, respectively; inP is the non-
wetting phase pressure at the inlet; 'outP is the wetting phase pressure at the interface of the
membrane and the core sample; m is the hydraulic conductivity of the porous membrane
and pipeline system, which was measured before the multi-step drainage test and is defined
as:
28
ww
mm
q
P
.................................................... (2-12)
where mP is the viscous pressure drop to generate a flow rate of
wq , which both are
function of time.
2.5 Flow Function Representation
2.5.1 Global Power Function Form
There exist several global functional representations for the relative permeability and the
capillary pressure as functions of wetting phase saturation. Siddiqui et al. (1999)
summarized and compared twelve models by experimental, semi-analytical and numerical
approaches and found that every model had its own advantages and limitations. However,
the most commonly employed global functional representation is to describe the relative
permeabilities and the capillary pressure as power functions of the normalized wetting
phase saturation, which are written as follows,
nN
wrnr
wnr
wrrnrnSS
SSSKK
1
1 .................................. (2-13)
wN
wrnr
wrwnrrwrw
SS
SSSKK
1 .................................. (2-14)
29
pcN
wrnr
wrw
ccSS
SSPP
1
max ...................................... (2-15)
where wrrn SK is the relative permeability of the non-wetting phase at the initial wetting
phase saturation wrS ; nrrw SK is the relative permeability of the wetting phase at the
residual non-wetting phase saturation nrS ;
max
cP is the capillary pressure value at wrS .nN ,
wN and pcN are exponents of the non-wetting phase relative permeability, the wetting
phase relative permeability and the capillary pressure equations, respectively.
In this study, discrete capillary pressure data can be obtained directly from the multi-step
drainage experiments. The magnitude of capillary pressure at a given saturation can be
calculated by monotone cubic spline interpolation using the discrete capillary pressure data.
Only parameters wiro SK , wiS , nN , and wN were considered for history matching the
production data.
2.5.2 Discrete Spline Function Form
It was pointed out that the global functional representation for flow functions cannot reach
better matching results than the discrete spline function form (Ucan, et al., 1997). It is also
expected that it is not reasonable to express a flow function in a global function form
because these global equations are only empirical regressions. In addition, a specific
discrete spline function with favourable control point values can completely replace a
global function. Therefore, the spline functional representations such as linear
interpolation, cubic spline interpolation, B spline interpolation and monotone cubic spline
30
interpolation were extensively investigated in this study. These four numerical
interpolation methods were applied to interpolate a capillary pressure system with five
discrete points. Linear interpolation can keep the monotonicity of capillary pressure but the
curve is not smooth, while cubic spline method and B spline method have monotonicity
problem in spite of smooth interpolation curve. Only monotone cubic interpolation can not
only keep the monotonicity but also the smoothness of the original capillary pressure
function. Therefore, the monotone cubic interpolation method was used to interpolate the
discrete capillary pressure data in this study to insure a reasonable fluid flow in the core
sample.
2.6 Description of Finite-Difference Model
2.6.1 Grid System
If one dimension block-centered grid system was adopted to differentiate the differential
equations group presented in above chapter. Block-centered was chosen because it is easier
to control the volumetric equivalence. The grid system is described in Figure 2.2. For the
first and last blocks in the grid system, volumetric modification factors equal to 0.5 were
considered to decrease the error caused by the boundary conditions and the block-centered
grid system.
2.6.2 Inter-Block Transmissibility Calculations
The mobilities of the wetting phase and the non-wetting phase at block n were defined as:
31
n
rn
n
nKKn
............................................... (2-16)
w
rw
w
nKKn
............................................... (2-17)
Considering the block dimension, we defined the dynamic transmissibility as
12
1
2
1
nxnx
nnT o
o
..................................... (2-18)
12
1
2
1
nxnx
nnT w
w
..................................... (2-19)
2.6.3 Improved IMPES Method
The IMPES method was employed to solve the partial differential equations, which was
first proposed by Sheldon et al. (1959) and Stone and Garder (1961). This method is to
create a single pressure equation by a combination of ancillary equation of saturation. The
pressure equation was solved implicitly and the saturation equation is solved explicitly.
Chen et al. (2004) presented an improved IMPES method to solve the partial differential
equations. This method differentiates one large pressure time step into small saturation
steps using an adaptive control strategy. Their study showed that this method is effective
and efficient for the numerical simulation of two-phase flow and it is strong capabilities to
32
solve two-phase coning problems. In this study, as it is similar to a two-phase gas coning
problem, the simulation algorithm has the same convergent issue, although there is no non-
wetting phase production at the outlet of the system. The improved IMPES prese Chen et
al. (2004) presented was successfully used to improve the simulation stability and save
computation time.
0nP 1NPn
0wP 1NPwinQ outQ
nPn
nPw
L
Figure 2.2: Differential model for the numerical simulations. It is a one-dimension model
with N blocks; L is the length of the core sample; Q s are the flow rates from the inlet
and outlet; the last block N is the single phase resistance block considering the porous
membrane and pipe line system.
To apply improved IMPES method, we add Eq. (2-1) to Eq. (2-2):
t
S
t
SqqP
KKP
KK wn
wnw
w
rw
n
n
rn
Substituting (2-3), the following equation is obtained:
33
0
wnw
w
rw
n
n
rn qqPKK
PKK
..................... (2-20)
Similar to conventional IMPES method, the improved IMPES method is expected to have
a linear equation system after differentiation written as,
1
2
1
0
2
1
11
222
111
00
N
N
w
N
n
NN
NNN
d
d
d
d
q
P
P
q
ac
bac
bac
ba
..................... (2-21)
For the 0th
block, Equation (2-20) is differentiated as follows:
12
10
2
1
100
12
10
2
1
100
xx
PP
xx
PPq ww
w
oo
o
100100 wwwooo PPTPPTq
110010 cocoinwooino PPPPTPPTq
1000100 ccwoinowo PPTPTPTTq ............... (2-22)
The coefficients in the first row of (2-21) are as follows:
10 a
00 Tb
00 c
10000 ccwoin PPTPTd
34
For the 1st block, Equation (2-20) is differentiated as:
22
11
2
1
211
22
11
2
1
211
12
10
2
1
100
12
10
2
1
100
xx
PP
xx
PP
xx
PP
xx
PP ww
w
oo
o
ww
w
oo
o
211211100100 wwwooowwwooo PPTPPTPPTPPT
22111211
1100010
cocowooo
cocowooino
PPPPTPPT
PPPPTPPT
22111211
110010
cocowooo
cocoinwooino
PPPPTPPT
PPPPTPPT
1002110
21101
ccwccwoin
oo
PPTPPTPT
PTPTT
. (2-23)
The coefficients in the second row of the coefficient matrix in Eq. (2-21) are as follows:
011 TTa
11 Tb
01 c
10021101 ccwccwoin PPTPPTPTd
For the other blocks in the system, the flow equation can be differentiated as:
12
1
2
1
1
12
1
2
1
1
2
11
2
1
11
2
11
2
1
11
nxnx
nPnPn
nxnx
nPnPn
nxnx
nPnPn
nxnx
nPnPn
ww
w
oo
o
ww
w
oo
o
111
11111
nPnPnPnPnTnPnPnT
nPnPnPnPnTnPnPnT
cwcwwooo
cocowooo
35
111
111
nPnPnTnPnPnT
nPnTnPnTnTnPnT
ccwccw
ooo ........................... (2-24)
Correspondingly, the coefficients are:
nTnTan 1
nTbn
1 nTcn
111 nPnPnTnPnPnTd ccwccwn
For the block 2N :
12
12
2
1
122
12
12
2
1
122
22
13
2
1
233
22
13
2
1
233
NxNx
NPNPN
NxNx
NPNPN
NxNx
NPNPN
NxNx
NPNPN
ww
w
oo
o
ww
w
oo
o
22122233
22333
NPNTNPNTPNTNPNPNT
NPNTNTNPNT
cwcowoutccw
oo
............................................................ (2-25)
For block 1N :
12
12
2
1
122
12
12
2
1
122
NxNx
NPNPN
NxNx
NPNPNq ww
w
oo
o
36
122122 NPNPNTNPNPNTq wwwooo
1222
1122
NPNPNPNT
NPNPNPNTq
wcow
cwoo ......... (2-26)
For the membrane block N , according to Darcy‟s Law:
m
outw
w L
PNPKq
1
.......................................... (2-27)
2.7 Validation
In order to validate the simulation results of PcSim, numerical simulations were run based
on the model defined by the parameters listed in Table 2.1.
Table 2.1: Core sample parameters used at simulator validation test
Parameters Value
Length 10 cm
Permeability 1 Darcy
Pressure Drop 0.1 atm
Viscosity 1 cp
Cross Area 16 cm
37
Two groups of flow functions with different relative permeability curves and capillary
pressure curve were employed, which were plotted in Figure 2.3 and Figure 2.5,
respectively. Figure 2.3 shows completely misible two phases flow to mimik pseudo-
single-phase flow that can be modelled by Darcy's Equation. Capillary pressure between
two phases is zero. Figure 2.5 presents a typical two phase flow with two relative
permeability curves and a capillary pressure difined according to Corey's Equation.
2.7.1 Pseudo-single-phase Flow
The model was first examined by comparing with analytical solutions calculated using
Darcy‟s Law. in order to satisfy the assumptions of Darcy‟s Law, the following
assumptions were applied: (1) the interfacial tension between the non-wetting phase and
the wetting phase is negligible and there is no capillary pressure; (2) viscosities of the
nonwetting phase and the wetting phase are assumed to be identical; (3) as shown in Figure
2.3, the relative permeabilities of the two phases are straight line, their summation is equal
to 1 and the total mobility does not vary with saturation. Two cases were tested as follows.
(1) The hydrodynamic conductivity of the membrane was assumed to be infinite. Darcy‟s
Law was applied to the core sample directly and the flow rate was calculated as 0.16 cm3/s,
which is exactly the same as the value calculated by PcSim. This case is also simulated by
CMG-IMEX. As shown in Figure 2.4 (a) and (b), both the saturation profile and the
production history are completely identical.
38
(2) The hydrodynamic conductivity was assumed to be 1.0×10-5
Darcy/cm, which is far
smaller than that of the core sample. Consequently, the pressure drop between the inlet and
outlet is mainly applied to drive the fluid flowing through the membrane. The PcSim also
obtained exactly the same results as these calculated from Darcy‟s Law.
Figure 2.3: Capillary pressure and relative permeability curves for single-phase flow tests.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Kr
Sw
Kro
Krw
39
(a)
(b)
Figure 2.4: Comparison of PcSim and CMG-IMEX 2008 for pseudo-single-phase flow. (a)
Saturation profile at 5 minutes along the x direction; (b) Cumulative production history.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
0 2 4 6 8 10
Satu
rati
on
Position,cm
PcSim
CMG
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
5
0 2 4 6
Cu
m. O
il, c
m3
Time,min
PcSim
CMG
40
2.7.2 Two-phase Flow
If the interfacial tension between the non-wetting phase and the wetting phase were
considered, as shown in Figure 2.5, typical water-wetting relative permeability curves and
capillary pressure curves were employed. No direct analytical solution is available to the
model this process with a remark capillary pressure impact. Theforefore, in order to
benchmark the simulator developed in the work, a commercial software package CMG-
IMEX 2008 was employed to validate PcSim. However, IMEX 2008 fails to model the
single phase flow in the membrane, because zero non-wetting phase permeability is not
allowed in the simulator. Only the saturation profiles and the cumulative production curve
before the displacement front reaches the membrane was used to compare the results. The
results are plotted in Figure 2.6. It can be seen that both the saturation profile and the
cumulative production curve before the displacement front reaches the membane from
IMEX and PcSim are exactly the same. These comparions confirm that the PcSim is
reliable to simulate a two phase flow process.
41
Figure 2.5: Capillary pressure and relative permeability curves for two-phase flow tests.
0
0.5
1
1.5
2
2.5
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Pc
, atm
Kr
Sw
Kro
Krw
Pc
42
(a)
(b)
Figure 2.6: Comparison of PcSim and CMG-IMEX 2008 for two-phase flow. (a)
Saturation profile at 5 minutes along the X direction; (b) Cumulative production history.
0
0.05
0.1
0.15
0.2
0.25
0.3
0.35
0.4
0.45
0 2 4 6 8 10
Satu
rati
on
Position, cm
PcSim
CMG
0
0.5
1
1.5
2
2.5
3
0 1 2 3 4 5
Cu
m. P
rod
ucti
on
, cm
3
Time, min
PcSim
CMG
43
2.8 Sensitivity Analysis
2.8.1 Discretization
When a differential equations is solved using a numerical method, there are always some
concerns about the discretazation error. For this study, the discretization errors are mainly
caused by discretization of the length and discretization of time. In order to select
appropriate parameters for fast but relatively accurate calculation results, the sensitivity
analysis regarding time step and block number were carried out.
Four cases using different time steps were run and as depicted in Figure 2.7, the results of
the wetting phase recovery histories for all four cases are the same. It indicates that if the
algorithm is able to converge, the largest time step is recommended during the simulations.
Four cases with different block numbers were run and the wetting phase production history
for all cases are drawn in Figure 2.8. It can be seen that although the production histories
are not exactly the same, the results calculated with ten blocks is acceptable. Compared to
the cases with different viscosity in the following section, the discretization error can
caused by block number is negligible. Therefore, in all simulation cases in this study, the
block number is 10.
44
Figure 2.7: Comparison of the wetting phase production histories of the four cases
simulated using different time step. The time steps in the four cases are 0.1 s, 0.01 s, 0.001
s and 0.0001 s, respectively.
0
0.5
1
1.5
2
2.5
3
3.5
1 10 100 1000 10000
Cu
m. L
iqu
id, c
m3
Drainage Time, s
Δt=0.1
Δt=0.01
Δt=0.001
Δt=0.0001
45
Figure 2.8: Comparison of the wetting phase production histories of the four cases
simulated using different block numbers. The block numbers in the four cases are 5, 10, 20
and 1000, respectively.
2.8.2 Viscosities/Mobilities
The objective of this study is to measure the relative permeabilities according to the
wetting phase production history. Therefore, the production history must be sensitive to the
relative permeabilities so that the relative permeabilities can be determined with a
0
0.5
1
1.5
2
2.5
3
3.5
1 10 100 1000 10000
Cu
m.
Liq
uid
, c
m3
Drainage Time, s
Block Number=5
Block Number=10
Block Number=20
Block Number=1000
46
confidence. The relative permeability may vary during the drainage process and the
permeability of the core sample simultaneously changes the mobility of the wetting phase
and the non-wetting phase. Therefore, viscositiy variation also reflects the variation of the
the relative permeabilities. In the test run, the wetting phase and the non-wetting phase
permeabilities are identical and hold a consant during the simulation. As shown in Figure
2.9, the production histories are greatly affected by the viscosity of the wetting phase. The
wetting phase production rate decreases with increasing viscosity of the wetting phase. The
offsetting of the wetting phase cumulative production rate show an exponential relationship
to the variation of the wetting phase viscosity. However, Figure 2.10 indicated that the
wetting phase production history is not sensitive to the non-wetting phase viscosity. When
the non-wetting phase viscosity goes to zero, the production curve should be able to
converge to a curve completely controlled by the wetting phase mobility.
2.8.3 Membrane
The resistance of the membrane, including the pumpline system, was tested in this section.
The difference between drainage process and free imbibitions process is that one puts a
porous membrane or plate to stop non-wetting phase from breaking through. This plate has
higher capillary threshold pressure and the resistance should not be ignored. Therefore, the
conductivity ratio of the membrane to the core sample varies from 1, 0.1, 0.01 and 0.001.
The wetting phase production histories are depicted in Figure 2.11. It can be seen that the
resistance of the membrane has a very large effect on the wetting phase production history.
In every experiment, the resistance of the membrane should be measured carefully because
47
the packing of the system with different vertical forces changes the thickness and
permeability.
Figure 2.9: Comparison of the wetting phase production histories of the four cases
simulated using different wetting phase viscosities. The viscosities of the wetting phase in
the four cases are 0.5 cp, 1.0 cp, 2.0 cp and 4 cp, respectively.
0
0.5
1
1.5
2
2.5
3
3.5
1 10 100 1000 10000
Cu
m. L
iqu
id, c
m3
Drainage Time, s
Visw=0.5 cp
Visw=1.0 cp
Visw=2.0 cp
Visw=4.0 cp
48
Figure 2.10: Comparison of the wetting phase production histories of the four cases
simulated using different nonwetting phase viscosities. The viscosities of the nonwetting
phase in the four cases are 0.01 cp, 0.04 cp, 0.07 cp and 0.10 cp, respectively.
0
0.5
1
1.5
2
2.5
3
3.5
1 10 100 1000 10000
Cu
m. L
iqu
id, c
m3
Drainage Time, s
Visn=0.01 cp
Visn=0.04 cp
Visn=0.07 cp
Visn=0.10 cp
49
Figure 2.11: Comparison of the wetting phase production histories of the five cases
simulated using different membrane/core conductivity ratio. The conductivity ratios of the
membrane to the core sample in the five cases are infinity, 1, 0.1, 0.01 and 0.001,
respectively.
2.8.4 Saturation Profiles
Figure 2.12 shows typical saturation profiles of the wetting phase in a single-step drainage
process for different fluid system. Figure 2.12 (a) shows the saturation profile with a
system where the nonwetting phase viscositiy is significant higher than that of the wetting
phase, such as mercury/air system. The fluid flow directions of the nonwetting phase and
the direction that the wetting phase saturation decreasing are the same, thus the process is
0
0.5
1
1.5
2
2.5
3
3.5
1 10 100 1000 10000
Cu
m. L
iqu
id, c
m3
Drainage Time, s
No Membrane
Cond. Ratio=1
Cond. Ratio=0.1
Cond. Ratio=0.01
Cond. Ratio=0.001
50
called “forward flooding”; Figure 2.12 (c) shows the saturation profile with a system where
the non-wetting phase viscosity is significant lower than that of the wetting phase. The
saturation of the wetting phase drops from the outlet, thus this process is called “reverse
flooding”; For a system that the viscosity of the non-wetting phase is comparable to the
viscosity of the wetting phase, as shown in Figure 2.12 (b), the saturation of the wetting
phase drops from both ends of the porous medium. The drainage process is then called
“bidirectional flooding”.
2.9 Summary
A program, PcSim, was developed using Visual C++ 6.0 to solve the above numerical
model. The equations were solved using IMPES (Implicit Pressure Explicit Saturation)
method and a one dimensional model with the 9-27 grid blocks. The simulation was run at
a desktop computer with 2.0 GHz CPU and 4 GB memory for couples of minutes. To
benchmark results of the C++ program, saturation and pressure profiles in the core sample
before the non-wetting phase front reaches the membrane were examined by using a
commercial simulation package (CMG-IMEX). Sensivity analysis was run regarding grid
size, time size, viscosities, membrane resistance, and saturation profiles were carried out.
51
(a)
(b)
(c)
Figure 2.12: The wetting phase (1.0cp) saturation profile along the core sample for
different non-wetting phase viscosities. (a) 10 cp; (b) 0.5 cp; (c) 0.01 cp.
0.5
0.52
0.54
0.56
0.58
0.6
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Satu
ratio
n
Position, cm
1s 3s 13s 55s 144s
0.5
0.52
0.54
0.56
0.58
0.6
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Satu
ratio
n
Position, cm
1s 3s 13s 55s 144s
0.5
0.52
0.54
0.56
0.58
0.6
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Satu
ratio
n
Position, cm
1s 3s 13s 55s 144s
52
CHAPTER 3: HISTORY MATCHING USING GENETIC
ALGORITHM
3.1 Introduction
A clear understanding of the mechanisms in a gas/liquid drainage process is important for
both gas flooding and gas storage. In recent years, CO2 storage in underground formations
has provided an attractive option to mitigate the concentration of the greenhouse gas
(Bachu,2002). Although there have been many studies focusing on how to maximize the
gas storage capacity in underground formations (Jahangiri and Zhang, 2010),
determination of the relative permeabilities at high capillary pressures and low liquid(s)
saturation is important for maximizing gas storage capacity in underground formations
(Richmond and Watson, 1990; Akin and Demiral, 1998).
One of the most conventional ways to measure the capillary pressures and the relative
permeabilities is a coreflood test. In this process, one/two phase(s) is/are injected from one
end of a core sample or a sandpack and both phases are produced from the other end. The
production data are collected and used to calculate the relative permeabilities. These
measurements can be categorized as steady-state method and unsteady-state method. The
steady-state methods are time-consuming, while the measurement using an unsteady-state
methods, such as the JBN method (Johnson et al., 1959), requires applying some
53
experimental conditions to make capillary pressure negligible, conducting an ancillary
capillary measurement or automatic history matching the coreflood production data to
simultaneously determine the capillary pressures and the relative permeabilities (Kerig and
Watson, 1986; Watson et al.,1988; Richmond and Watson, 1990; Ucan et al, 1997; Watson
et al., 1998). However, at low wetting phase saturation, high capillary pressure and fairly
low relative permeability to the wetting phase make the measurement of the relative
permeability more and more difficult using a conventional coreflood test.
The multi-step drainage process provides another way to determine the relative
permeabilities when measuring the capillary pressure. The most commonly used method is
the inverse method, which involves history matching the production data during the
drainage process. Jennings (1983; 1988) used a gradient-based optimization algorithm for
automatic history matching and to calculate the relative permeabilities in an air/kerosene
drainage process. A similar methodology has also been applied by soil science researchers
(Eching et al., 1993; Eching et al., 1994; Liu et al., 1998; Chen et al., 1999). Although
reduced by Eching (1994) through incorporating the measurement of the pressure at the
middle point of the soil column, the non-uniqueness issue is always a concern for these
inverse methods. The causes for the non-uniqueness issue of an inverse method can be
summarized as: (1) instinct non-uniqueness (2) algorithm non-uniqueness; (3) sensitivity
non-uniqueness. The instinct non-uniqueness is the non-uniqueness caused by the problem
itself, such as a linear equation with two unknowns. The algorithm non-uniqueness is
defined as the non-uniqueness caused by the optimization method, which easily converges
to a local optimum value and lead to multiple solutions. The sensitivity non-uniqueness is
54
caused by the sensitivity of the output to the input. If output is not sensitive to certain input
parameters, any experimental error, or even the some numerical truncated errors will
change the estimated value. Although the authors of the above publications believed that
the results calculated from the automatic history-matching were unique, it was also pointed
out that, for a general two-phase coreflood test, using only external production data and
pressure drop data cannot guarantee the uniqueness of the estimated flow functions (Ucan
et al., 1997). Therefore, the uniqueness of the solution and the reliability of the results by
history matching a multi-step drainage process require examination.
Due to concerns that the conventional gradient-based optimized methods cannot guarantee
that the calculation converges to the global optimum solutions and that they cause the
algorithm non-uniqueness, the conventianal Genetic Algorithm (GA) was applied as an
alternative for automatic history matching coreflood tests (Ucan et al., 1997; Sun and
Mohanty, 2003; Tokuda et al., 2004). Although conventional GA has many advantages,
such as global optimization and no Jacobian matrix or other gradient calculations, it is
either possible to converge to a local optimum solution (namely premature convergence)
due to inappropriate parameter selection (Reed and Minsker, 2000), or to have relatively
low efficiency for converging to the optimum solution. Therefore, various improved
conventional GAs have been proposed and have shown remarkable improvement to the
conventional GA. Guo (Guo et al., 1999) presented the Guo Tao genetic algorithm
(GTGA), a simple, robust and accurate algorithm, which can be used for inverse problems.
Wu (2004) indicated that the GTGA has a good tolerability when dealing with the
uncertainty of the observed experimental data.
55
This thesis applies genetic algorithm to analyze the uniqueness of estimation of the relative
permeability in a multi-step drainage experiment. A C++ program is coded to simulate the
two-phase flow in the multi-step drainage process, taking the membrane resistance into
consideration. The GTGA is used to reduce the algorithm non-uniqueness of the history
matching. Systematic examinations regarding the non-uniqueness issue when estimating
the relative permeabilities from the production history of a multi-step drainage process are
carried out based on the hypothetical numerical simulation. The real experimental data is
then used to validate the conclusions.
3.2 Methodology
3.2.1 Numerical Model
A schematic diagram of the apparatus used in a multi-step drainage process is shown in
Figure 3.1. To ensure the fluids flow in one direction, the edge of the thin core sample is
coated with epoxy before the experiment. The core sample is partially saturated with water
which is the wetting phase. A membrane is positioned at the bottom and is in capillary
contact with the core sample. The non-wetting phase (air) is injected from the top of the
core sample and only the wetting phase is produced from the bottom, due to the membrane.
A typical multi-step drainage process consists of several single drainage steps. Each single
drainage step starts from the equilibrium saturation distribution of the previous drainage
step. The non-wetting phase pressure suddenly increases to a higher level, the wetting
phase is produced from the core sample and its production history is recorded. In order to
56
develop the one-dimensional flow model to simulate this process, the following
assumptions are made: (1) fluid flows satisfy Darcy‟s law; (2) fluids flow in one direction;
(3) the core sample and membrane are homogeneous; (4) gravity is negligible due to the
minimal thickness of the core sample.
)(WaterOutlet
imper
mea
ble
imperm
eable
membrane
)(GasInlet
Figure 3.1: Conceptual model for multi-step drainage experiment.
The mathematic model is governed by the following mass balance equations:
t
SqP
KK nw
nwn
nw
rnw
................................... (3-1)
t
SqP
KK w
ww
w
rw
.................................... (3-2)
57
where K is the absolute permeability of the core sample; rnwK and
rwK are the relative
permeabilities for the non-wetting phase and the wetting phase; nw and
w are the
viscosities for the non-wetting phase and the wetting phase; is the porosity of the core
sample; nwS and
wS are the saturations of the non-wetting phase and the wetting phase;
nwP and wP are the pressures of the non-wetting phase and the wetting phase.
In order to solve the partial differential equations above, another two equations are
required as follows:
wnwc PPP ................................................... (3-3)
1 nww SS .................................................... (3-4)
where cP is the capillary pressure. To solve the equations, the following initial condition
and boundary conditions are considered:
When 0t , the wetting phase saturation in the core sample is wiS and the wetting phase
pressure is equal to the pressure at the outlet, outP . Therefore, the initial conditions are
written as follows:
witw SS 0| ..................................................... (3-5)
where wiS is the initial wetting phase saturation the beginning of one drainage step and
outP is the wetting phase pressure at the outlet. At the inlet, there is no flow for the wetting
58
phase and the non-wetting phase pressure is equal to the inlet pressure; the boundary
conditions are the written as:
01
ewq ....................................................... (3-6)
inen PP 1
...................................................... (3-7)
At the bottom of the core sample, there is no non-wetting phase flow, thus:
02
enq ....................................................... (3-8)
'2 outew PP ..................................................... (3-9)
mwewoutout qPP 2
' ........................................... (3-10)
where 1e and 2e represent the inlet and outlet boundaries, respectively; inP is the non-
wetting phase pressure at the inlet; 'outP is the wetting phase pressure at the interface
between the membrane and the core sample;m is the hydraulic conductivity, which is
defined as:
ww
m
mq
P
.................................................... (3-11)
where mP is the viscous pressure drop to yield a flow rate of
wq in the membrane. In a
real experimental process, this hydraulic conductivity includes the membrane, the tubings
and the valves in a multi-step drainage experiment. Before the core sample is mounted in
59
the capillary cell, several tests are run to measure the hydraulic conductivity, m , of the
experimental system.
In this model, both relative permeabilities and capillary pressure are considered as
functions of saturation. The representations of relative permeabilities and capillary pressure
are generally categorized into two types: the global functional form and the discrete spline
function form. Corey‟s functions (Corey and Rethjens, 1956) of the normalized wetting
phase saturation are widely accepted and extensively used to express the relative
permeabilities and the capillary pressures due to their simplicity and remarkable physical
significance of each term in the equations. Later studies showed that these equations were
not sufficient to represent the fluid flow (Kerig and Watson, 1987). It was pointed out
(Ucan et al, 1997) that the global functional representation could not reach better matching
results than a discrete spline function form, such as linear interpolation, cubic spline and B
spline. In these interpolation methods, linear interpolation is simple and can keep the
monotonicity, but it may lose the smoothness. Other functions can obtain a good
smoothness, but they cannot keep the monotonicity when the number of discrete points is
limited. A monotone cubic spline method presented by Fritsch and Carlson (1980), can
keep both smoothness and monotonicity; thus, it is used in this study to interpolate the
permeability and capillary pressure as a function of saturation.
3.2.2 Guo Tao Genetic Algorithm
The conventional GA that mimics biological evolution is claimed to be a global
optimization method. However, it easily converges to local minimum value due to
60
inappropriate parameter selection or fitness function definition. Many changes have been
proposed to improve its robustness and reliability, including either improving the evolution
strategy or the fitness calculation. GTGA changes the concept of generation-by-generation
evolution to individual-by-individual evolution. It randomly, or using certain strategies,
picks several parents from the population space to generate one new individual. If the
fitness of the new individual is bigger than the fitness of the worst individual in the
population, the worst individual is then replaced by the new individual. The flow chart of
GTGA is shown in Figure 3.2.
The detailed process of this algorithm is summarized as follows:
(1) Initialize the population space P with N individuals.
(2) Select M individuals randomly, or using certain strategies, from current population
space P .
(3) Determine a new individual. The calculation uses a linear combination of the M
parental individuals with random weighting factors, i , ranging from -0.5 to 1.5. The
application of weighting factors considers the crossover effect, as well as the mutation
effect, among the parental individual.
(4) If a new individual is better than the worst individual, update the population space by
replacing the worst individual with the new individual.
61
GTGA is a method in which all individuals “climb” to the optimum value together. The
advantage of this method is the best individual will always be kept in the population space.
To accelerate the convergence speed, it is recommended that the individuals with higher
fitness are used as the parents.
Initialize first generation space P(0)
Calculate its fitness
Select M individuals as parents for the new generation
(Randomly or according to fitness)
Crossover
M
i
ijiNj ChromChrom0
,1, 5.15.0 i
Is the new individual is
better than the worst one?
Replace the worst individual by the
new individual
The best individual
satisfies the end condition? End
Start
Yes
No
Yes
No
Figure 3.2: Flow chart of GTGA. M individuals are selected as parents. Crossover and
mutation are combined using crossover coefficients ( 5.15.0 i ).
62
Chromosomes Coding
In the multi-step drainage process, discrete capillary pressure data are directly measured in
a multi-step drainage process. The capillary pressure at any water saturation is calculated
by monotone cubic spline interpolation using the discrete capillary pressure data. Only the
relative permeabilities of each phase are unknowns and need to be calculated by automatic
history matching. Therefore, the chromosome coded with a series of genes, real numbers,
represents a group of relative permeability curves, either as Corey‟s form or the monotone
cubic spline-function form. For the global function form, the chromosomes of each
individual consisted of six pieces of genes, which represent wiS , nwrS , wn , nwn , wirnw SK ,
nwrrw SK . Divided by 10max n , the parameters wn and nwn were converted to a real
number between 0 and 1. For discrete interpolation functional forms, the gene chain of
each individual is composed of )1(2 N genes, where N is the number of drainage
experiment steps. Each gene represents a relative permeability datum. The first 1N
chromosomes are used for storing the relative permeability data of the non-wetting phase,
while the following 1N chromosomes are used to store the relative permeability data of
the wetting phase. Based on the assumption that relative permeability is a number between
zero and one, all genes are bounded from zero to one.
Fitness Definition
Automatic history matching of a coreflood experiment is a non-linear, least-square
optimization problem (Sigmund and McCallery, 1979). The relative permeabilities and
capillary pressure were calculated by minimizing the following objective function:
63
T
t
N
n
simS
T
t
simQ
T
t
simP SSQQPPF0 0
2
exp
0
2
exp
0
2
exp .... (3-12)
where subscripts sim and exp represent simulation and experimental data, respectively.
P , Q , and S are the weighting factors for pressure drop, cumulative production and
internal saturation. T and N are time step number and block number in the simulation.
At every step during the multi-step drainage experiment, the non-wetting phase pressure at
the inlet and the wetting phase pressure at the outlet are known parameters. Meanwhile, the
saturation profile in the core sample is hard to measure accurately, due to the limited core
sample thickness. Therefore, only the single phase production history was taken into
consideration as the objective function. The fitness function is then simplified as:
T
t
sim QQF0
2
exp ............................................ (3-13)
Considering the pore volume and experimental data number, the fitness is normalized to:
T
PV
F
T
t
sim
0
2
exp
.......................................... (3-14)
where PV is the total volume of drained water for the core sample in one drainage step. T
is the total number of the sampling points in one drainage step.
64
3.3 Hypothetical Test
Hypothetical numerical experiments were carried out using the known capillary pressures
and relative permeabilities, which are plotted in Figure 3.3. The properties of the core
sample and the fluids used in the simulation are listed in Table 3.3. Water and kerosene,
whose viscosities are 1.00 cp and 0.70 cp, were used as the wetting phase and the non-
wetting phase, respectively. At the beginning of the hypothetical test, a numerical
simulation was run based on the known capillary pressures and relative permeabilities to
generate the production history of water as the target for history matching. Then, automatic
history matching was carried out using conventional GA or GTGA to tune the relative
permeabilities and match the water production history. By comparing the input and output
relative permeabilities, the effectiveness of the optimization method, the uniqueness of the
estimated relative permeabilities and the effect of the non-wetting phase in the drainage
process can are evaluated.
3.3.1 Comparisons of GTGA and Conventional GA
Both conventional GA and GTGA were applied as the automatic optimization algorithm in
order to estimate the relative permeabilities. For conventional GA, the population size was
100, the crossover rate was 0.70, the mutation rate was 0.01 and the maximum generation
was 1,000. For the GTGA, the population size was 100, the mating pool size M was 20
and the maximum number of calculation was 10,000.
65
Table 3.1: Properties of the core sample and fluids in the numerical experiments
Parameter Hypothetical Value
Core sample length 1.00 cm
Core sample cross-sectional area 20.00 cm2
Core sample porosity 20 %
Core sample permeability 100 md
Wetting phase viscosity 1.00 cp
Non-wetting phase viscosity 0.70 cp
Three conventional GA runs were carried out and the calculated relative permeabilities for
these runs are plotted in Figure 3.4. The lines represent the hypothetical relative
permeabilities, while the points are the calculated values by automatic history matching. It
can be seen that all three cases failed to converge to the hypothetical values within 1,000
generations, with the total number of calculation being 100,000. The best matching values
were found at generations 132, 495, and 124, respectively. The corresponding fitness was
26.4, 42.8 and 23.1. It can be demonstrated that conventional GA efficiently locates the
domain of an optimum value, but has some difficulties converging to the global optimum
value effectively. Compared to conventional GA, as shown by circles and squares in Figure
3.5, GTGA presented a high calculation effectiveness and the solution converges to the
hypothetical values within 10,000 generations, the number of total calculations being
29,564. To achieve the same fitness as the second case using conventional GA, GTGA
66
consumed only 946 generations and 3,893 calculations. Therefore, the GTGA is not only
efficient when it comes to locating the domain of a global optimum, but it is also able to
effectively converge to the optimum value. With a properly designed optimization
algorithm, the relative permeabilities of both the wetting phase and the non-wetting phase
can be estimated by only matching the wetting phase production history. In other words,
the history matched solution is unique. However, note that the wetting phase production
data are from a hypothetical simulation output is ideal and relative uncertainties are below
1×10-8
.
Figure 3.3: Permeability and capillary pressure curves used in the hypothetical
experiments. The relative permeability data was calculated using the Corey model with the
following parameters: nwrS =0.2; wiS =0.15; nwn =2; wn =2; wirnw SK =0.9; nwrrw SK =0.4.
0
0.2
0.4
0.6
0.8
1
1.2
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Ca
pilla
ry p
res
su
re, a
tm
Re
lati
ve
Pe
rme
ab
ilit
y
Wetting Phase Saturation
Krn
Krw
Pc
67
Figure 3.4: Matched permeabilities of the non-wetting phase and the wetting phase, using
conventional GA, in three different runs. Lines represent the known relative permeabilities,
while squares and circles represent the estimated values.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.5 1
Kr
Sw
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.5 1
Kr
Sw
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.5 1
Kr
Sw
68
Figure 3.5: Matched results for the hypothetical experiment using GTGA and the spline
function form. Solid lines represent the hypothetical relative permeabilities, while circles
and squares represent the estimated values.
3.3.2 Experimental Uncertainties
The water production data in the above section is ideal numbers with an unreasonably
small measurement uncertainty, which is not true in reality. In order to simulate the
uncertainties, the production data was multiplied by a random factor from 98% to 102%
and rounded to 0.001 cc or 0.01 cc for different uncertainty levels. Spline function form or
global function form is used as a different interpolation method for the relative
permeabilities. Combining these methods and different levels of measurement uncertainties,
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Kr
Sw
Krn, Hypothetical
Krn, MPGA, 3893 calculations
Krn, MPGA Final
Krw, Hypothetical
Krw, MPGA, 3893 calculations
Krw, MPGA Final
69
four cases were carried out; the detailed descriptions of these four runs are listed in Table
3.2.
Table 3.2: Descriptions of the four runs with an oil/water system, considering experimental
uncertainty
ID Flow Function Matched
Permeability Uncertainty Results
1 Spline Function Oil and water 0.001cc/0.005 CP Figure 3.6-A
2 Spline Function Oil and water 0.01cc/0.05 CP Figure 3.6-B
3 Corey‟s Equation Oil and water 0.001cc/0.005 CP Figure 3.6-C
4 Corey‟s Equation Oil and water 0.01cc/0.05 CP Figure 3.6-D
CP: the final cumulative production of the wetting phase at each drainage step.
By applying GTGA to history match the four cases, the matched results are shown in
Figure 3.6. As can be seen from Figure 3.6–A and Figure 3.6–B, the matched results for
the relative permeabilities of the wetting phase are acceptable, but for the non-wetting
phase if the uncertainty is higher than 0.01 cc (5% total production), the results are not
acceptable. In order to indicate that the result we obtained is not a local optimum value, the
hypothetical relative permeabilities were also employed as an individual at the beginning
of GTGA calculation. Due to the characteristic of GTGA, the hypothetical value will
70
always stay in the population if it is an optimum value. However, it was found that the
optimum solutions did not stay at the hypothetical relative permeability, but shifted away
slowly to the real optimum values corresponding to the production data with uncertainty.
Therefore, for a hypothetical real case with limited measurement precision and random
experimental error, it is not reliable to obtain two-phase relative permeabilities
simultaneously by matching only the wetting phase production history. It was also noticed
that the low permeabilities, for either the non-wetting phase or the wetting phase, were
easy to match and converge earlier to the hypothetical values, which means that the phase
with lower mobility dominates the wetting phase recovery.
The global function representation was also employed to retrieve the relative permeabilities.
The results are depicted in Figure 3.6-C and Figure 3.6-D. The overall results are better
than the cases with spline function representation. For the 0.005 PV case, the Corey‟s
model is accurate enough to obtain the hypothetical value. For the 0.05 PV case, although
the wetting phase permeability is matched very well, for the non-wetting phase the results
are not acceptable. The difference between hypothetical values to the matched value
increases as the wetting phase saturation decreases. If the relative permeabilities were
governed by Corey‟s equation, 5% uncertainty is accurate enough to retrieve the relative
permeability.
71
Figure 3.6: Relative permeabilities retrieved by GTGA with an oil/water system and
experimental measurement uncertainties.
3.3.3 Impacts of the Nonwetting Phase
The above discussion indicates that the water production is more sensitive to the phase
with lower mobility. For a gas/water system, since the mobility of gas is much higher than
that of water, the contribution of gas to the production of water may be negligible. To
verify this hypothesis, the viscosity of the non-wetting phase was reduced from 0.70 cp to
0.02 cp and another four runs were carried out; the details are listed in Table 3.3. Spline
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Kr
Sw
A
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Kr
Sw
B
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Kr
Sw
C
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Kr
Sw
D
72
function form was used to represent the relative permeabilities in all cases. In the last two
cases, the relative permeabilities of gas were taken as a constant one and only the relative
permeabilities of water were tuned to match the production history.
The relative permeabilities obtained in the four cases were plotted in Figure 3.7. It can be
seen from Figure 3.7-A that with an air/water system, although the relative permeabilities
of water can be estimated successfully, the relative permeabilities of gas are not acceptable.
Moreover, as shown in Figure 3.7-B, when experiment uncertainty is considered, the
estimated relative permeabilities of gas phase is completely wrong. On the other hand, the
water production can be matched with arbitrary gas phase permeability. The relative
permeabilities of water can be estimated independently without considering permeabilities
of gas. The gas relative permeabilities were taken as a constant one in Test 7 and 8 in order
to make the effect of gas phase negligible. As depicted by Figure 3.7-C and Figure 3.7-D,
all permeabilities of the wetting phase were successfully retrieved. Hence, the water phase
permeabilities are unique if the relative permeability of gas phase was negligible and even
the experimental uncertainty was considered.
73
Table 3.3: Descriptions of the four cases the with air/water system considering
experimental uncertainty
ID Flow Function Matched
Permeabilities Accuracy Results
5 Spline Function Gas and water No uncertainty Figure 3.7-A
6 Spline Function Gas and water 0.01cc/0.05 CP Figure 3.7-B
7 Spline Function Water only, Krg=1 No uncertainty Figure 3.7-C
8 Spline Function Water only, Krg=1 0.01cc/0.05 CP Figure 3.7-D
CP: the final cumulative production of the wetting phase at each drainage step.
74
Figure 3.7: Relative permeabilities retrieved by GTGA with an air/water system: (A)
accurate recovery data and relative permeabilities of both water and air were matched; (B)
limited accurate recovery data with experimental error and relative permeabilities of both
water and air were matched; (C) accurate recovery data, only relative permeabilities of
water was matched and relative permeability of air was taken as one; (D) limited accurate
recovery data with experimental error, only relative permeabilities of water was matched
and relative permeability of air was taken as one.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Kr
Sw
A
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Kr
Sw
B
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Kr
Sw
C
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Kr
Sw
D
75
3.4 Summary
In this chapter, GTGA is successfully applied to estimate the relative permeabilities by
automatic history matching the production history in a multi-step drainage process with
ideal data. Taking the experimental uncertainty into considerations, the uniqueness of the
solution is analyzed by hypothetical numerical model and a lab experimental study.
Our investigations indicate that GTGA is much more effective than conventional GA.
GTGA could successfully find and escape from the local maximum values and finally
converge to the global maximum value. Both the global function form (Corey‟s model) and
the local spline function form (monotone cubic interpolation) can be used to represent the
flow functions. The global function form converges more easily, while the monotone cubic
interpolation is more realistic. Considering the uncertainty of real lab experiments, it is
considered to be impossible to obtain reliable results for the relative permeabilities of the
highly mobile phase. An experimental study with kerosene/water system confirmed that
this method is of high reliability for low mobility phase.
Using GTGA and history matching of the wetting phase production history during a multi-
step drainage process, the relative permeabilities of the non-wetting phase and the wetting
phase are only simultaneously retrievable when (1) the mobilities of the non-wetting phase
and the wetting phase are comparable and (2) the experimental uncertainty and precision is
controlled within certain level; the relative permeability of the non-wetting phase can be
taken as arbitrary number and the unique relative permeabilities of the wetting phase can
76
be obtained, when (1) the wetting phase saturation of the system is low or (2) the viscosity
ratio of the non-wetting to the wetting phase is small, such as an air/water system.
77
CHAPTER 4: ANALYTICAL MODELLING AND DIRECT
ESTIMATION OF RELATIVE PERMEABILITIES
4.1 Introduction
CO2 sequestration (Bachu, 2002) in geological formations provides an appealing option to
reduce CO2 concentration in the atmosphere, and thereby mitigates the impacts of the
greenhouse gas. The sequestration injection of CO2 gas into the geological formation is a
process where the non-wetting gas phase displaces the wetting liquid phase(s). Near the
end of this process, the capillary pressure of the two phases becomes comparatively high
and the relative permeability of the wetting phase becomes very low. A clear
understanding concerning the capillary pressure and the relative permeabilities at low
wetting phase saturation can assist to maximize CO2 sequestration capacity in geological
formations.
The porous plate method (Bruce, 1947), which is referred to the multi-step drainage
process in this thesis, is one of the conventional methods used to measure the drainage-type
capillary pressure versus liquid saturation relationship of a porous medium. In this process,
the wetting phase recovery history is determined by the capillary pressure, and the relative
permeabilities, simultaneously. The capillary pressure versus saturation curve is
78
determined by displacing the wetting fluid point by point, at each of which, pressure
equilibrium is established. The challenge is how to determine the relative permeabilities in
this process.
One-step drainage experiments were conducted using an air–wetting soil column system,
combined with a parameter optimization algorithm to simultaneously estimate the capillary
pressures and the relative permeabilities (Parker and Welge, 1985). A gradient-based
automatic history matching method was used by Jennings (Jennings, 1983; Jennings et. al,
1988) with a one-dimensional (1-D) numerical simulator to obtain the wetting phase
relative permeabilities in a core sample. Chen et al. (Chen et. al, 1999) considered oil-water
flow in a multi-step drainage process and obtained the relative permeabilities to both oil
and water simultaneously by numerical simulation and history matching. However, all the
above inverse methods using history matching require an accurate simulator and an
effective history matching algorithm. Moreover, the main concern associated with the
inverse function estimation method is that the result of history matching is not unique.
Although said concern was more or less mitigated by simultaneously measuring internal
capillary pressure (Eching and Hopmans, 1993) and extending the one-step drainage
process to a multi-step drainage process (Van Dam, 1994), the uniqueness of the matched
results still requires systemic examination. Eching et al. (1994) and Liu et al. (1998) used
the wetting phase production data at the time periods immediately following an increase in
non-wetting phase pressure to estimate permeability functions (Eching et al, 1994; Liu et
al., 1998). However, the flow rate changes rapidly at the beginning of a drainage process.
If simple analytical equations can be developed to match the entire recovery history, not
79
only will there be no further concern about the uniqueness of the results, but the relative
permeabilities of the wetting phase can be directly estimated.
As early as the 1950s, some models for calculating the relative permeabilities using a
capillary pressure curve were developed for imbibition-type displacement based on the
assumption that the wetting phase and the non-wetting phase flow independently in the
small pores and the large pores, respectively (Wyllie and Spangler, 1952; Wyllie and
Gardner, 1958). This assumption may not always be valid because, at low wetting phase
saturation, the wetting phase stays at the corner of the large pore structure and starts
contributing to the flow rate. For imbibition, analytical or empirical equations modeling the
volume variation of an imbibed wetting phase into a non-wetting-phase-saturated core
sample have been presented since 1950s. Handy‟s equation (Handy, 1960) is usually used
to describe the variations of the volume of imbibed wetting phase as a function of the
imbibition time:
tSKKP
AVw
wfrwc
w
222
.......................................... (4-1)
where A is the cross-section area of the core sample; wV is the volume of water imbibed
into the core sample; and w are the porosity of the core sample and the viscosity of
water, respectively. t is the imbibition time; wfS is the water saturation behind the
imbibition front; rwK and cP are the relative permeability of water and the capillary pressure
at wfS . It should be noted that the imbibition volume of the wetting phase cannot go to
infinity when the time goes to infinity (Li and Horne, 2001). Other models describing the
80
process of spontaneous water imbibition into water-wet rocks have been suggested. The
first model was presented by Aronofskyn et al.(1958). The variation of oil recovery as a
function of time is governed by:
teRR 10.................................................. (4-2)
where R is the oil recovery, 0R is the limit toward which the recovery converges, is a
constant giving the rate of convergence, and t is the imbibition time. This model was
based on the following two empirical assumptions: 1) cumulative oil recovery from a small
volume of core converges to a finite limit; and 2) the convergence rate and the convergence
limit do not change during the imbibition process. Based on Aronofsky‟s model, several
modifications or derivations of the parameter were later reported (Mattax and Kyte,
1962; Lefebvre, 1978; Reis, 1992; Ma et al., 1997). Recently, Li and Horne (Li and Horne,
2006) developed the following model to describe the relationship between the water
recovery history and imbibition time in a free imbibition process where water imbibed into
a gas-saturated core sample.
DtR eeR
**1 ................................................ (4-3)
where, *R is the normalized recovery (pvcRR * );
pvR is the recovery in the units of pore
volume and c is a parameter associated with the ratio of gravity to capillary pressure.
However, all of these models are used for a one-step imbibition process. Multi-step
displacement experiments, either imbibitions process or drainage process, require a porous
plate or a thin membrane to control the pressure for each saturation point. There is no
81
analytical model for the multi-step drainage process, especially when considering the
resistance of the porous plate or the membrane.
This chapter presents a new analytical model, which describes the wetting phase recovery
history in a multi-step drainage process. From the regression of the wetting phase recovery
curve at each pressure step, the wetting phase permeabilities at that saturation point can be
determined. In order to examine the model and its assumptions, numerical simulations are
conducted for one-dimensional two-phase drainage-type displacement. Additionally,
hypothetical experiments are carried out to test and validate the analytical model. Finally,
the experimental data reported by Jennings are used to further validate this method.
Comparisons of the results of the model in this chapter and the results presented in
Jennings‟ work point to the effectiveness and validity of the model proposed in this chapter.
4.2 Theoretical Development
As shown in Figure 4.1, the model for the multi-step drainage process is a cylindrical core
sample, with its side surface sealed. The outlet of the core sample connects to a thin semi-
permeable membrane. Within the breakthrough pressure of the membrane for the gas phase
(non-wetting phase), only the wetting phase is allowed to flow through the membrane. Gas
is injected into the sample through the top surface and the wetting phase is expelled from
the lower side. An entire multi-step drainage process consists of several single drainage
steps. In each step, the wetting phase saturation starts from the previous equilibrium state,
82
the gas phase pressure at the outlet increases to a new level, and the wetting phase recovery
history is recorded.
)(WaterOutlet
imper
mea
ble
imperm
eable
membrane
)(GasInlet
Figure 4.1: Cylindrical core sample and membrane configuration.
Since the saturation variation is small within a drainage step and the porous disc is relative
thin, the following assumptions are made in developing the analytical model:
(1) The porous medium is homogeneous;
(2) The effect of gravity is negligible compared to the capillary forces, due to the thinness
of the core sample;
(3) The flow of fluids in the core sample is governed by Darcy‟s law;
(4) At the end of each drainage step, the saturation of the wetting phase reaches an
equilibrium state;
83
(5) The pressure drop of gas phase along the drainage direction within the porous sample is
negligible, due to high gas mobility;
(6) Wetting phase relative permeability within a drainage step is considered as a constant;
Within a drainage step, the capillary pressure is linearly dependent on the wetting phase
saturation.
Assumptions (1)-(4) are reasonable for any Darcy‟s flow in a porous medium, while
rationales of assumptions (5)-(6) are based on the numerical analysis in the later sections of
this chapter and will be discussed then.
4.2.1 Membrane Resistance Negligible
If it is assumed that the hydraulic resistance of the membrane is negligible, an analytical
model which describes the correlation of the wetting phase recovery and the drainage time
can be derived. As shown in Figure 4.2, the length of the core sample is L , the thickness
of the membrane is mL , inP is the non-wetting (gas) phase pressure at the inlet and outP is
the wetting phase pressure at the outlet.
84
inn PPInlet ,
outPOutlet ,x
L
0x
imper
mea
ble
im
perm
eable
membranemL
Figure 4.2: Cylindrical porous medium and the membrane configuration. The porous
medium is sealed by resin to ensure fluids flow in one direction. Pn is the inlet pressure of
the nonwetting phase; Pout is the outlet pressure of the wetting phase.
The ith step drainage process starts from the initial equilibrium water saturation
iwS . The
gas phase pressure has sudden increase from i
inP to 1i
inP at the beginning of the ith
drainage process. The wetting phase saturation correspondingly decreases, and finally
reaches 1i
wS at the end of the ith drainage process.
For one-dimension two-phase flow in a homogeneous core sample, combining the material
balance equation and the Darcy‟s equation gives the following continuity equation for the
wetting phase:
85
t
S
x
PKK
x
ww
w
rw
....................................... (4-4)
where t
is the drainage time, x is the coordinate along the core sample, K and are the
instinct permeability and porosity of the core sample, respectively, w is the viscosity of
the wetting phase, rwK , wP and wS are the relative permeability, the pressure and the
saturation of the wetting phase in the core sample, respectively, at time, t , and position, x .
If w
rw
w
KK
is defined as the wetting phase mobility and w is assumed be a constant
within a single drainage step, the following equation can be obtained:
t
S
x
P ww
w
2
2
................................................ (4-5)
The initial conditions for the pressure and saturation of the wetting phase are:
outw PtxP 0, ................................................ (4-6)
and
)(0,
i
ww StxS ............................................... (4-7)
where outP is the wetting phase pressure at the outlet and i
wS the initial equilibrium water
saturation at the beginning of this drainage step. As there is no wetting phase flowing into
the core sample at the inlet, the boundary conditions for the wetting phase are written as:
86
0,0
tx
x
Pw ................................................ (4-8)
At the outlet of the core sample, if the resistance of the membrane is ignored, the boundary
condition is written as:
outw PtLxP , ................................................ (4-9)
As shown in Figure 4.3, the capillary pressure is assumed to vary linearly as saturation
changes within a single drainage step, and the wetting phase saturation decreases from
)(i
wS to )1( i
wS during one drainage step.
The capillary pressure increase and the wetting phase saturation decrease in a drainage step
are represented by, respectively:
i
c
i
cc PPP 1
............................................. (4-10)
1
i
w
i
ww SSS ............................................ (4-11)
If the resistance to gas phase flow is negligible, the pressure in the gas could be considered
as a constant, that is:
inn PP ...................................................... (4-12)
The capillary pressure at x is equal to the pressure difference between the gas phase and
the liquid phase. Therefore:
87
txPPtxP cnw ,, ........................................... (4-13)
wS
cP 11
, i
c
i
w PS
i
c
i
w PS ,
StepOne
Figure 4.3: Capillary pressure considered as a linear function of the wetting phase
saturation in one drainage step.
As shown in Figure 4.3, the capillary pressure at any time t and any location x has the
following relationship to the wetting phase saturation:
1
1
1
1,,
i
wwi
w
i
w
i
c
i
ci
cc StxSSS
PPPtxP ...................... (4-14)
Substituting Eq.s (4-10) to (4-13) into Eq. (4-14) gives:
88
11,,
i
ww
w
ci
cinw StxSS
PPPtxP .................... (4-15)
Substituting Eq. (4-15) into Eq. (4-5) gives:
t
S
x
S
S
P ww
w
cw
2
2
....................................... (4-16-1)
Substituting Eq. (4-15) into Eq. (4-8) gives:
0,0
tx
x
Sw ........................................... (4-16-2)
Substituting Eq. (4-15) into Eq. (4-9) and considering:
outin
i
c PPP 1
The first boundary condition changes to:
1,
i
ww StLxS ......................................... (4-16-3)
Similarly, substituting Eq. (4-15) into Eq. (4-10) the initial condition changes to:
)(0,
i
ww StxS .......................................... (4-16-4)
Eq. (4-16-1) to Eq. (4-16-4) can be normalized by defining the following dimensionless
variables:
89
w
i
wwwD
S
SSS
1
............................................. (4-17)
L
xxD ...................................................... (4-18)
and
tSL
Pt
w
cw
D
2
................................................ (4-19)
Substituting the following expressions for water saturation, distance and time into Eq.
(4-16),
1
i
wwwDw SSSS
Lxx D
D
cw
w tP
SLt
2
Eq. (4-16-1) then changes to:
D
cw
w
i
wwwD
D
i
wwwD
w
cw
tP
SL
SSS
Lx
SSS
S
P
2
1
2
12
)(
or
90
D
wD
D
wD
t
S
x
S
2
2
............................................. (4-20-1)
Boundary conditions of Eq. (4-16-2) and Eq. (4-16-3) are:
0
,,1
1
1
i
w
i
w
i
ww
DDwDSS
StLxStxS ....................... (4-20-2)
0
,0,0
1
1
i
w
i
w
i
wwDD
D
wD
SS
StxS
L
xtx
x
S ................ (4-20-3)
The initial condition of Eq. (4-16-4) becomes:
1
0,0,
1
1
i
w
i
w
i
ww
DDwDSS
StxStxS ....................... (4-20-4)
In order to obtain an analytical solution to Eq. (4-20-1) to Eq. (4-20-4), the separation of
variables method is applied and the solution is expressed as:
0
2
cos2
,n
t
Dn
n
DDwDDnextxS
, where ,....1,0,2
12
n
nn .... (4-21)
The average saturation in the core sample can be expressed as:
02
1
00
22 2cos
2
n
t
n
D
n
t
Dn
n
wDDnDn edxexS
.................... (4-22)
where,
91
47.22
2
2
0
21.222
32
2
1
69.612
52
2
2
The solution of Eq. (4-22) can be approximated by taking the first term,
D
D
tt
wD eeS
2
20 2
22
0
2
22
.................................. (4-23)
Taking logarithm of the both sides of the above equation gives:
8ln
4ln
22 DwD tS ....................................... (4-24)
4.2.2 Membrane Resistance Considered
If the resistance of the membrane at the outlet boundary is not negligible compared to that
of the core sample, the boundary condition at the lower end of the core sample (the
interface between the core sample and the membrane) will change. At this interface, the
wetting phase flow rate in the core sample is governed by Darcy‟s Law (Darcy, 1856) as:
92
tLxx
PKKtLxq w
w
rw
w ,,
................................ (4-25)
If the membrane is considered as a homogeneous porous medium, the wetting phase flow
rate in the membrane is expressed as:
m
outw
w
m
wmL
PtLxPKq
,
...................................... (4-26)
where, tLxPw , is the wetting phase pressure at the interface of the core sample and the
membrane. wmq is the wetting phase flow rate in the membrane. From material balance:
wmw qtLxq , ............................................... (4-27)
The boundary condition at the interface is, therefore, written as:
tLxx
PKK
L
PtLxPK w
w
rw
m
outw
w
m ,,
....................... (4-28)
Eq. (4-28) is further simplified by applying Eq. (4-15) at the boundary. When Lx , Eq.
(4-15) can be rearranged as:
w
i
ww
c
i
cinwS
StLSPPPtLP
1
1 ,,
Considering the definition of wDS :
DDwDc
i
cinw txSPPPtLP ,1,)1(
........................... (4-29)
93
DDwDcoutw txSPPtLP ,1, ................................. (4-30)
Substituting Eq. (4-30) into Eq. (4-28):
DD
D
wDc
rwDDwDc
m
m txx
SP
L
KKtxSP
L
K,1,1
DD
D
wDrw
m
m
DDwD txx
SK
LK
LK
txS ,1,1
..................... (4-31)
If a dimensionless parameter , which essentially means the conductivity ratio of the core
sample to the membrane, is defined as:
m
m
LK
LK
.................................................. (4-32)
The new boundary condition is written as:
DD
D
wD
rwDDwD txx
SKtxS ,1,1
........................... (4-33)
The partial differential equation and its boundaries conditions are summarized as:
D
wD
D
wD
t
S
x
S
2
2
.............................................. (4-34-1)
94
DD
D
wD
rwDDwD txx
SKtxS ,1,1
........................ (4-34-2)
0,0
DD
D
wD txx
S ......................................... (4-34-3)
10, DDwD txS ........................................... (4-34-4)
The solution for Eq. (4-34-1) is in the form of:
Dt
DDDDwD exBxAtxS2
sincos,
........................... (4-35)
Applying boundary condition (4-34-3) to Eq. (4-35):
00cos0sin2
DteBA ............................ (4-36)
B has to be zero to make Eq. (4-36) satisfied for every , Eq. (4-35) is thus changed to:
Dt
DDDwD exAtxS2
cos,
...................................... (4-37)
Applying boundary condition ((4-34-3) to Eq. (4-37) gives:
DD t
Drw
t
D exAKexA22
sincos
That is:
rwKctg .................................................. (4-38)
95
Eq. (4-38) is a non-linear equation, whose solution can be obtained numerically. Figure
4.4(a) depicts the solutions of Eq. (4-38) schematically, which are the cross-points of the
straight line rwKy and the curves ctgy .
(a) (b)
Figure 4.4: Graphic demonstration for the solutions for the eigenvalues in Eq. (4-38)
: (a) the first three solutions; (b) the first solution in domain 2/,4/ .
The general solution to Eq. (5-37) can be expressed as:
0
2
cos2
,n
t
Dn
n
DDwDDnextxS
................................ (4-39)
-10
-8
-6
-4
-2
0
2
4
6
8
10
0 3.14 6.28 9.42
96
where n is the thn solution of Eq. (4-38).
The average wetting phase saturation over the entire core sample is:
02
1
00
22 2cos
2
n
t
n
D
n
t
Dn
n
wDDnDn edxexS
.................... (4-40)
Similar to Eq. (4-22), the solution of Eq. (4-40) can also be approximated by taking the
first term. However, there is no direct analytical solution for the first eigenvalue 0 . Here,
an approximation method to calculate 0 is provided. Noticing that the conductivity of the
core sample is usually smaller than the membrane and rwK is always less than one, we can
say that 1rwK . If 1rwK at the domain of
2,
4
, as shown Figure 4.4-(b), the
function 0ctg is approximated as:
002
ctg ................................................. (4-41)
Substituting Eq. (4-41)into Eq. (4-38), we get:
rwK
1
1
20
................................................ (4-42)
Eq. ((4-40) changes to:
D
rwD
tKrwt
wD eK
eS2
2
20 14
2
2
2
0
182
......................... (4-43)
97
Taking logarithm of the both sides of the above equation gives:
2
2
2
2
18ln
14ln
rw
D
rw
wD
Kt
KS
......................... (4-44)
4.3 Applications of Analytical Models
Eqs ((4-22) and ((4-40) presented in the previous sections are models with and without
considering the membrane resistance effect, respectively. By taking the first term as an
approximation, both models change to linear equations, Eq.s (4-24) and (4-44). It is also
noticed that when rwK
approaches zero, Eq. (4-44) converges to Eq. (4-24), which means
that, if the resistance of the membrane is negligible, these two equations are consistent with
each other.
For the application of this model, at each drainage step we define another dimensionless
time, Dkt , as:
tSL
PKt
ww
c
Dk
2
2
2 ......................................... (4-45)
The dimensionless wetting phase saturation wDS is defined as:
twwD VVS 1 ................................................. (4-46)
98
where wV is cumulative produced volume of the wetting phase and
tV is the total volume
expelled by the non-wetting phase at the end of this drainage step. Eq. (4-24) and Eq. (4-44)
then become, respectively:
8lnln
2DkrwwD tKS ..................................... (4-47)
and
22
12
4674.2ln
1ln
rw
Dk
rw
rwwD
Kt
K
KS
......................... (4-48)
The slopes of the linear regression are dominated by the permeability of the wetting phase
at this step. In order to estimate the relative permeability, Dkt and wDS are plotted as a
semi-log graph. The slope of the curve k is determined by linear regression of the
experiment points. To estimate the effect of the membrane, a dimensionless parameter is
calculated:
k
LK
LK
k
m
m
................................................ (4-49)
If k is small enough, k can be directly used as an estimation of the wetting phase relative
permeability. Otherwise, the following equation is required to revise the permeability to
the wetting phase:
99
21 kkK rw ................................................ (4-50)
4.4 Validation of Assumptions
A program was developed using Visual C++ 6.0 to solve the above numerical model. The
equations were solved using IMPES (Implicit Pressure Explicit Saturation) method and a
one dimensional model with the 27 grid blocks. The simulation was run at a desktop
computer with 2.0 GHz CPU and 4 GB memory for couples of minutes. To benchmark
results of the C++ program, saturation and pressure profiles in the core sample before the
non-wetting phase front reaches the membrane were examined by using a commercial
simulation package (CMG-IMEX). In order to confirm the validity of the analytical model
and the rationality of its assumptions, numerical simulations for a single drainage step were
carried out. At the beginning of this drainage step, the system was assumed to have reached
an equilibrium state, and the average saturation of the wetting phase was 0.40. To start the
drainage process, the non-wetting phase pressure at the outlet was increased from 0.20 atm
to 0.32 atm. The wetting phase saturation was, consequently, reduced from 0.40 to 0.36
during the drainage process, and the recovery history was recorded.
As depicted in Figure 4.5, the capillary pressure curve and the relative permeability curves
were calculated using Corey‟s equations (Corey, 1954). The coefficients used in Corey‟s
equations are listed in Table 4.1. Other properties of the core sample and the fluids adopted
in the numerical simulations are listed in Table 4.2.
100
Table 4.1: Coefficients used in Corey‟s equation to calculate the relative permeability
curves
Coefficients used in Corey‟s equation Value
Snr - Non-wetting phase residual saturation 0.2
Swr - Wetting phase residual saturation 0.15
Nn - Exponent of non-wetting phase 2.0
Nw - Exponent of wetting phase 2.0
Krnmax - Non-wetting phase maximum relative permeability 0.9
Krwmax - Wetting phase maximum relative permeability 0.4
Figure 4.5: The capillary pressure curve and the relative permeability curves calculated
using Corey‟s equation.
0
0.2
0.4
0.6
0.8
1
1.2
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
0 0.2 0.4 0.6 0.8 1
Cap
illa
ry p
ressu
re,
atm
Rela
tive P
erm
eab
ilit
y
Wetting Phase Saturation
Krn
Krw
Pc
101
Table 4.2: Properties of the core sample and the fluids used in numerical simulation
Parameter Hypothetical Value
Core sample length 1.00 cm
Core sample cross-sectional area 16.00 cm2
Core sample porosity 20 %
Core sample permeability 100 md
Wetting phase viscosity 1.00 cp
Non-wetting phase viscosity 0.02 cp
Membrane Conductivity 60 d/cm
4.4.1 Gas phase Flow Resistance
In order to investigate the impacts of the non-wetting phase resistance, the viscosity of air
at standard conditions was used as the non-wetting phase viscosity. The viscosity of the
non-wetting phase was then taken as 0.02 cp, and its relative permeabilities are shown in
Figure 4.5. The wetting phase permeability was taken as a constant, while the membrane
hydraulic conductivity was assigned a large number to make the resistance of the
membrane negligible. The cumulative production volume of the wetting phase obtained
from simulation is plotted as circles in Figure 4.6-(a). For comparisons, the calculated
cumulative production volume of the wetting phase using the full analytical solution, Eq.
102
(4-22) and the one term approximation solution, Eq. (4-24) were also plotted. These results
were shown as a dash line and solid line, respectively.
It can be seen that the cumulative production volume of the wetting phase obtained from
numerical simulation considering the non-wetting phase resistance, and the curve using
analytical model without considering the non-wetting phase resistance, are almost identical.
This implies that the wetting phase recovery history is not sensitive to the non-wetting
phase if its mobility is large enough, and thus confirms the assumption in developing the
analytical model that the non-wetting phase resistance is negligible. Furthermore, the
results of the one-term approximation model shows a little difference at the very beginning
of the process, but at later stages, the approximation model shows the same results as the
numerical solution and the full analytical model. The one term approximation model is a
reasonable approximation of the full analytical model. Moreover, when both the
cumulative production volume of the wetting phase and time in Figure 4.6(a) are
normalized and re-plotted as DwSln versus Dt graph in Figure 4.6(b), a perfect linear
relationship between these two variables shows up. As we discussed in the above section,
the slope of the straight line is determined by the wetting phase relative permeability.
103
(a)
(b)
Figure 4.6: Comparisons of the wetting phase recovery history of the hypothetical model,
the full analytical model and the one term approximation model.
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
1 10 100
Cu
mu
lati
ve V
olu
me (cc)
Time (s)
Numerical Simulation
Analytical Solution
One Term Approximation
0
2
4
6
8
10
12
0 1 2 3 4
-Ln
Sw
D
tD
Numerical Simulation
Analytical Solution
One Term Approximation
104
4.4.2 Membrane Resistance
In the conventional porous plate method, the porous plate is used to prevent the non-
wetting phase from breaking through and being produced from the outlet. This porous plate
usually has high gas entry pressure and low permeability. Although Jennings (Jennings,
1983) replaced the porous plate with a plastic membrane and reduced the experimental
time to some extent, the resistance of the membrane may still not be negligible. Therefore,
so as to investigate the impacts of the membrane, the membrane hydraulic conductivity
was taken as reasonable number (60 md/cm) in the numerical simulations. The cumulative
production volume of the wetting phase obtained from numerical simulation is plotted as
circles in Figure 4.7(a). For comparisons, the cumulative production volume of the wetting
phase calculated using the analytical solution neglecting membrane, Eq. (4-22) and the
analytical solution considering membrane, Eq. (4-40), are plotted together as a dash line
and solid line, respectively. Both the cumulative production volume of the wetting phase
and drainage time are normalized and plotted as DwSln versus Dt graph in Figure 4.7(b).
It can be seen from Figure 4.7(a) that, if the resistance of the membrane is neglected, the
wetting phase is recovered faster and the slope of the straight line in Figure 4.7(b) is bigger.
Hence without considering the resistance of the membrane, using Eq. (4-22), the relative
permeability of the wetting phase is under-estimated from the wetting phase recovery
history. The estimated permeability combines the resistance of the core sample and the
membrane together. However, when the membrane resistance is considered, using Eq.
(4-40), the results of the analytical model are consistent with the numerical model. In the
105
case when the resistance of the membrane is not negligible, the model with the membrane
should be used to revise the results.
4.4.3 Flow Functions
The real capillary pressure is not linearly dependent on the wetting phase saturation and the
real relative permeabilities of the wetting phase also vary at different saturations. In the
numerical simulations, the relative permeabilities of the wetting phase and the capillary
pressure were calculated using monotone cubic spline interpolation (Fritsch and Carlson,
1980). The monotone cubic spline interpolation remains the monotonicity and smoothness
of the flow functions, simultaneously. Four simulations were run for four single drainage
steps and the corresponding saturation ranges were 0.45-0.40, 0.40-0.35, 0.35-0.30 and
0.30-0.25, respectively. For the analytical model, the arithmetic mean of the wetting phase
permeabilities was used as the constant relative permeabilities, rwK . The capillary pressure
gradient was calculated by the ratio of the capillary pressure change to the saturation
change in the corresponding drainage step.
106
(a)
(b)
Figure 4.7: Comparison of the wetting phase recovery history of the hypothetical model
with the membrane resistance, the one term approximation model and the complementary
model.
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
1 10 100
Cu
mu
lati
ve V
olu
me (cc)
Time (s)
Numerical Solution with Membrane
Analytical Model without Membrane
Analytical Model with Membrane
0
2
4
6
8
10
12
0 1 2 3 4
-Ln
Sw
D
tD
Numerical Solution with Membrane
Analytical Model without Membrane
Analytical Model with Membrane
107
The results from simulations and from the analytical model are shown in Figure 4.8, which
depicts the relationship of the logarithm of the dimensionless average saturation versus the
dimensionless time. It can be seen that both the simulation results and the analytical results
show a straight line relationship, but the curves for the analytical model do not match with
the curves of the simulation model. This means the slopes of these straight lines are not
good approximations of the arithmetic mean of the wetting phase relative permeabilities in
the corresponding drainage step.
Figure 4.8: The linear relationship between the dimensionless time and logarithm of the
dimensionless average saturation for the analytical model and numerical models. From the
left to the right, the curves are wetting phase recovery for the drainage steps with the
wetting phase saturation ranges for 0.45-0.4, 0.4-0.35, 0.35-0.3 and 0.3-0.25.
0
2
4
6
8
10
12
14
16
0 50 100 150 200 250 300 350 400 450
-Ln
(Sw
D)
tD
Simulation : Krw is a function of Sw
Analytical Solution: Krw is the average relative permeability over a single drainage step
108
From Figure 4.8, it can be noted that the linear relationship shows up at the later stage of a
drainage process. Using the average saturation and the capillary gradient mounted on the
entire saturation range may not be reasonable. Therefore, the wetting phase permeabilities
and the capillary pressure gradient at the ending saturation were used in the analytical
model. The results were re-plotted in Figure 4.9. The simulation results do not match the
analytical results, but the slopes of the curves, directly determined by the relative
permeability, are consistent. The fitted results are shown as the linear equations in Figure
4.9. The slopes of these equations are the estimated relative permeabilities and the
corresponding relative permeabilities used to generate these results in the simulation are
0.059, 0.038, 0.021, and 0.009. All relative errors are smaller than 0.5%.
4.5 Computational Tests
To further validate the effectiveness of the analytical model, a virtual numerical multi-step
drainage experiment was carried out using the numerical model developed above. The
hypothetical multi-step drainage experiment consists of 10 drainage steps, and the initial
wetting phase saturation is 0.7. The hydraulic conductivity of the membrane is 1.0
Darcy/cm. The maximumrwK is 0.025. Since
rwK is less than 0.1, the relative
permeabilities were estimated using the no-membrane model.
109
Figure 4.9: Linear relationship between the dimensionless time and logarithm of the
dimensionless average saturation for the analytical model and numerical models From the
left to the right, the curves are for the drainage steps with wetting phase saturation of 0.45-
0.4, 0.4-0.35, 0.35-0.3 and 0.3-0.25.
The hypothetical relative permeabilities used as input in the simulations, and the estimated
relative permeabilities obtained by analytical model, are both plotted in Figure 4.10. The
hypothetical values are plotted as a solid line, while the estimated values are plotted as
circles. It can be seen that, using the direct estimation method, the relative permeabilities
obtained are consistent with the hypothetical values. However, as rwK increases, the no-
membrane model without the membrane resistance may underestimate the relative
permeabilities.
-LnSwD = 0.058tD - 0.377-LnSwD = 0.037tD + 0.282
-LnSwD = 0.021tD + 0.523
-LnSwD = 0.009tD + 0.379
0
2
4
6
8
10
12
14
16
0 100 200 300 400 500 600
-Ln
(Sw
D)
tD
Simulation : Krw is a function of Sw
Analytical Solution: Krw is the relative permeability at the ending saturaion of a single drainage step
110
Figure 4.10: Comparison of the results estimated directly using the analytical model and
the original hypothetical values without the membrane resistance.(1) Solid line: the
hypothetical relative permeability curve used in the numerical simulation; (2) Circles:
estimated relative permeabilities at each drainage step.
In the second hypothetical experiment, the conductivity of the membrane was reduced to
0.1 Darcy/cm. The corresponding maximum rwK is 0.25, which is larger than 0.1.
Another 10-step hypothetical drainage experiment was conducted, and the wetting phase
relative permeabilities were calculated using the membrane model. Figure 4.11 shows that,
at the relative permeability range less than 0.35, the values estimated by both the model
neglecting the membrane and the model considering the membrane are consistent with the
0
0.05
0.1
0.15
0.2
0.25
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Krw
Sw
Hypothetical
Estimated
111
hypothetical values. But, as the relative permeabilities increase, the error caused by the
resistance of the membrane is more and more significant. However, with the model
considering the membrane resistance, the relative permeabilities are almost the same as the
inputted hypothetical values.
Figure 4.11: Comparison of the original hypothetical values and the results estimated
directly using the analytical model with and without membrane resistance revising. (1)
Solid line: the hypothetical relative permeability curve used in the numerical simulation;
(2) Circles: estimated relative permeabilities at each drainage step without membrane
resistance; (3) Rectangles: estimated relative permeabilities at each drainage step
considering membrane resistance.
0
0.05
0.1
0.15
0.2
0.25
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7
Krw
Sw
Hypothetical
Neglecting membrane
Considering membrane
112
Several hypothetical experiments were then run, and the results indicated that an estimated
rwK value can be used to determine which model should be used to estimate the relative
permeability. If the estimated rwK is less than 0.05, the model neglecting membrane is
reliable enough to estimate the relative permeability. If the estimated rwK is larger than
0.05, the model considering membrane is required to estimate the wetting phase relative
permeabilities from the wetting phase recovery data.
4.6 Experimental Validation
In order to further validate the effectiveness of the model, Jennings‟ experimental data
(Jennings, 1983) were used to calculate the wetting phase relative permeabilities, using the
model developed in this study. The capillary pressure curves measured in Jennings‟
experiment are shown in Figure 4.12. In his study, a 4-step drainage experiment was
carried out and the relative permeabilities to water were obtained by automatic history
matching.
In order to calculate the relative permeabilities to water, a graph of DwSln versus t was
plotted for each step, as shown in Figure 4.13. It can be seen that in each step, the curve
has a linear part, except for step 2. It is shown that, the drainage time for step 2 is shorter
than the other three steps, thus the valid period of the model developed in this study has not
been reached yet. If the drainage time was longer, the linear relationship should be more
established. Using the slopes at each plot and both the model neglecting membrane and the
model considering membrane, the relative permeabilities to water were calculated.
113
Figure 4.12: Capillary pressure measured in Jennings‟ experiment.
The results are plotted in Figure 4.14. The consistent results showed with the numerical
hypothetical test: at low saturation range, the three relative curves have the same value;
while at high water saturation range, the results considering membrane resistance have a
better result. If we assume that Jennings‟ simulation results can represent the true values of
the relative permeabilities to water, it is indicated that the direct estimation method
presented in this thesis is valid and effective, because neither simulation nor automatic
history matching are required.
0
0.05
0.1
0.15
0.2
0.25
0.3
0 0.2 0.4 0.6 0.8 1
Pc,
atm
Sw
114
(a) (b)
(c) (d)
Figure 4.13: Capillary pressure measured in Jennings‟ experiment: (a) step one; (b) step
two; (c) step three; (d) step four.
y = 0.00149x + 1.32729
R² = 0.99463
0
0.5
1
1.5
2
2.5
3
3.5
0 500 1000 1500
-Ln
(Sw
D)
Time, s
Experimental Data
Regression
y = 0.00340x + 1.82990
R² = 0.95373
0
0.5
1
1.5
2
2.5
3
3.5
4
0 200 400 600
-Ln
(Sw
D)
Time, s
Experimental Data
Regression
y = 0.00132x + 0.82863
R² = 0.99325
0
1
2
3
4
5
6
0 1000 2000 3000 4000
-Ln
(Sw
D)
Time, s
Experimental Data
Regression
y = 0.00047x + 0.58818
R² = 0.99724
0
1
2
3
4
5
6
0 2000 4000 6000 8000 10000
-Ln
(Sw
D)
Time, s
Experimental Data
Regression
115
Figure 4.14: Comparisons of the results obtained using Jennings‟ automatic history
matching method and the directly estimation methods presented in this study.
4.7 Summary
An analytical model to describe the wetting phase recovery history in the multi-step
drainage process was developed in this study. This model can be used to directly estimate
the wetting permeabilities by linear regression of the wetting phase recovery history in
each single step. The results of the model are consistent with the results of the one-
dimensional numerical simulations. Comparisons of the analytical model and numerical
simulation indicate that:
0.00001
0.0001
0.001
0.01
0.1
1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8
Krw
Sw
Jennings' Simulation Results
Neglecting Membrane
Considering Membrane
116
(1) The resistance of the non-wetting phase is negligible when estimating the relative
permeability of the wetting phase at low wetting phase saturation;
(2) The capillary pressure gradient around the ending saturation should be used, and the
estimated relative permeability of the wetting phase is the permeability at the ending
saturation;
(3) A dimensionless parameter was created to determine if the resistance of the membrane
is negligible. If it is not, a complementary model is developed to modify the wetting phase
permeabilities and get better results.
(4) Numerical hypothetical tests and laboratory experimental data verification
demonstrated that this method is effective for the direct estimation of the wetting phase
relative permeability.
117
CHAPTER 5: INTERACTIVE TUBE-BUNDLE
MODELLING
5.1 Introduction
The tube-bundle model, with various sizes of cylindrical tubes, was developed in the 1940s
and 1950s to simulate the pore size distribution of a real porous medium (Purcell, 1949;
Yuster, 1951; Scheidegger, 1953). In this model, the radius of one tube at the axial
direction of the model is kept identical, which made it particularly useful in the
interpretation of pore size distribution from the mercury injection capillary pressure test.
This model was then extensively studied, most notably by Scheidegger (1953), who
examined varying the radius of each tube along the length which was referred to as a
serial-type model, and by Payatakes et al.(1973), who looked at periodically constricted
tubes. More recent applications of this model presented by Bartley and Ruth (1999, 2001,
2002) and Dahle et al.(2005) indicate that this model is still the most successful model
used to simulate the porous media. However, as shown in later sections of this chapter, due
to the selective sealing effect of the membrane for the non-wetting phase, for a drainage-
type process with an air/water system in which the wetting phase (water) has lower
mobility, the wetting phase saturation drops from both ends of a one-dimensional core
118
sample. The conventional tube-bundle model has some difficulties in modeling this process
properly.
Based on the observation of multiphase flow in real porous media, Dong et al.(1998, 2005,
2006) pointed out that the most common and important feature of the conventional tube-
bundle model was that no interaction between the fluids in different tubes was considered.
Noting this, they introduced a new interacting tube-bundle model, which allowed for
interaction between the fluids flowing in different tubes. The advance of the oil/water
meniscus in a waterflood in an imbibition process and a Buckley–Leverett type front, at
higher injection rates, was successfully predicted using this model. The concept of the
interacting tube-bundle model was then experimentally validated by Unsal et al.(2007a,
2007b, 2009), who conducted extensive experimental studies in a model containing two
non-circular tubes, with connections between them through the gap between the rod and
the plate. Wang et al.(2008) presented detailed studies of fluid transfer between tubes in
interacting tube-bundle models, and it was concluded that the fluid transfer takes place in
close vicinity of the oil/water meniscus, under very small pressure drops. Interacting
capillary models were also constructed by Wang and Dong (2011) using triangular tubes,
in which the wetting phase was allowed to reside in the edges of the noncircular tubes.
Trapping of the nonwetting phase in imbibition processes was studied in an interacting-
serial type tube-bundle model.
The porous plate method (Bruce and Welge, 1947), which is referred to as the multi-step
drainage process in this thesis, is one of the conventional methods used to measure the
capillary pressure versus liquid saturation relationship of a porous medium. In this process,
119
a thin porous plate is used to prevent the nonwetting phase from breaking through within
its entry pressure, which is referred to as the selective sealing effect in this thesis. In order
to mitigate the effect of its resistance, the porous plate is replaced by a plastic membrane
(Jenning, 1983). In order to easily model this process either by analytical derivation or
numerical simulation, one-dimensional fluid flow geometry is required. Consequently, the
side surface of the porous medium is sealed either by resin, for porous medium (Jenning,
1983), or a wall of a coreholder for a soil column (Parker et al., 1985). In the multi-step
drainage process, the wetting phase production history is determined by the capillary
pressure and the relative permeabilities, simultaneously. While the capillary pressure can
be measured directly, many studies have been conducted to determine the relative
permeabilities in terms of wetting phase production history (Eching and Hopmans, 1993;
Liu et al., 1998; Chen et al.1999; Wang et al.2012). All of these studies considered
capillary pressure and the relative permeabilities as independent functions, but, in fact, they
impact each other to some extent (Wyllie, 1952, 1958). The tube-bundle models provide a
bridge to connect these two functions and help understand the fluid flow mechanisms in
porous media.
In order to model the multi-step drainage process, the effects of the membrane should be
handled properly. Due to the thinness of the membrane, its resistance can be negligible, but
the selective sealing effect on the nonwetting phase not only prevents the nonwetting phase
from breaking through, but, for a one-dimensional geometry, causes the saturation of the
wetting phase decreases from both ends of the porous medium; at the inlet, the wetting
phase was displaced by the nonwetting phase and, at the outlet, the wetting phase is
120
discharged from the system and leaves the nonwetting phase accumulating, thereby
reducing the wetting phase saturation. Simulation results indicate that for a gas/water
system at low water (the wetting phase) saturation, a decrease in the water at the outlet
dominates the water production history. Without considering the interaction between the
capillary tubes, conventional tube-bundle models cannot properly model the saturation
drop at the outlet. Dong‟s interactive tube-bundle model, which considers the interaction
among tubes in an imbibition process, cannot properly handle the membrane selective
sealing effect in drainage process. An extended interactive tube bundle model should be
considered to model this process in the right manner.
In this thesis, a numerical simulation model was developed to benchmark the entire
modeling process. A new interacting capillary model with three tubes was developed based
on Dong‟s interactive two-tube model (Dong et al., 1998), so as to qualitatively model the
selective sealing effect of the membrane. The three-tube model was then extended to an
interactive tube-bundle model with hundreds of tubes. With this model, the saturation
profiles along the porous medium, the wetting phase production history, and the multi-step
drainage process were successfully modeled.
5.2 Numerical Modeling Results
5.2.1 Saturation Profiles
Simulation results showed that a typical saturation profile of the wetting phase in a single-
step drainage process, with the membrane selective sealing effect, shown schematically in
121
Figure 5.1(b), consists of three regions: (1) a transition region of length 1l , due to the
invasion of the nonwetting phase; (2) a region of uniform saturation of the wetting phase of
length 2l ; (3) another transition region of length 3l , due to the discharge of the wetting
phase and the accumulation of the nonwetting phase. According to the ratios of the
viscosities, and of the relative permeabilities of the nonwetting phase to the wetting phase,
as shown in Figure 5.1(a) and Figure 5.1(c), Region 1 or Region 2 may not show up
significantly in a drainage process. If Region 1 does not show up, the nonwetting phase is
injected from the inlet, and the wetting phase saturation decreases from the outlet, the
displacement process is referred to as “reverse flooding”. If Region 2 does not show up,
and the directions of the nonwetting phase injection and the wetting phase saturation
decreasing are the same, the process is called “forward flooding”. If both regions show up,
significantly, the drainage process is called “bidirectional flooding”.
5.2.2 Production History
A multi-step drainage process was simulated, using the program developed in Chapeter 2,
at different capillary pressures and different relative permeabilities; the wetting phase
production histories are plotted in Figure 5.2, where it can be seen that all wetting phase
recovery curves converge to one and, as saturation decreases, the production rate slows.
122
wS
x
1wS
2wS
2l1l
(a)
wS
x
1wS
2wS
2l1l 3l
(b)
wS
x
1wS
2wS
2l 3l
(c)
Figure 5.1: Schematic saturation profiles in a drainage process with membrane selective
sealing effect. (a) Forward flooding; (b) Bidirectional flooding; (c) Reverse flooding.
123
Simulation results (Wang et al.2012), also shown in Chaphter 3, indicate that for an
air/water system, where water has lower mobility than that of gas, the production of water
is determined by the mobility of water. Wang et al. (2012) presented an analytical model,
based on a drainage process with an air/water system to describe the relationship between
the normalized saturation of water and drainage time, which is written as:
8ln
2ln
2
2
2
t
SL
PKKS
ww
crw
wD ............................... (5-1)
where,
twwD VVS 1 ................................................... (5-2)
In Eq. (5-1) and (5-2), wV is the cumulative wetting phase recovery and
tV is the total
volume expelled by the nonwetting phase at the end of this drainage step; K and are the
absolute permeability and the porosity of the core sample, respectively; L is the length of
the core sample; rwK is the relative permeability to water; w is the viscosity of water at
the experiment condition; wc SP is the gradient of the capillary pressure at the
corresponding saturation. The agreement of the analytical model and the above numerical
simulation model indicate that the analytical model is reliable and reasonable. The slope
term of Eq. (5-1) which can be used to calculate the relative permeability of water, rwK , at
the corresponding saturation, is defined as:
124
ww
crw
SL
PKKk
2
2
2 .............................................. (5-3)
Figure 5.2: Schematic of the wetting phase production history in a 4-step drainage process
with the membrane selective sealing effect.
5.3 Three-Tube Interactive Capillary Model
For the conventional tube-bundle model, which can only allow the nonwetting phase
discharging from the inlet and does not account for interactions between tubes, it is
125
considered hard to model “bi-directional” and “reverse flooding”, which mostly happened
in the gas drainage process. In order to model these phenomena, a conceptual interacting
capillary model with three tubes was developed. As shown in Figure 5.3, the model
consists of three capillary tubes, 1, 2 and 3, of different radii, 1R ,
2R and 3R , respectively,
where 321 RRR , and all are of equal length, L . The corresponding capillary pressures
are 1Pc ,
2Pc and 3Pc , where 321 PcPcPc . Gas is used as the nonwetting phase and
water is used as the wetting phase.
Tube1
Tube3
Tube2
1l 2l 3l
Inlet Outlet
Pc Pc
Gas
Water
outPinP
1P 2P
Figure 5.3: Schematic of the three-tube interacting capillary model: pressure and fluid
distribution.
In a drainage process, only the largest pores in a porous medium are broken through by gas,
at first. To account for this, initially the largest tube, Tube 1, is filled with gas and the other
two smaller tubes are filled with water. A capillary equilibrium was maintained by an
external pressure drop at the two ends of the model, which is equal to 2/21 PcPc . In
126
addition, it is assumed that there is a water-wet membrane at the outlet end of the model, in
order to prevent gas from breaking through, and that the membrane is thin enough that its
resistance is negligible.
At t = 0, the inlet of the model is exposed to the gas phase and the pressure of the gas
suddenly increases to 2/32 PcPc . Consequently, Tube 2 is broken through by the gas
phase. Following the assumptions of the two tube interactive capillary model (Dong et al.,
1998), the following criteria are applied: (1) for the same phase, the pressures in different
tubes, but at the same position (x), are the same; (2) if two conjunct tubes are filled with
different fluid, there is no fluid exchange between gas and water along the tube; (3) Fluid
exchange happens at any gas/water meniscus.
This model differs from Dong‟s model (Dong et al., 1995) in that Tube 2 is broken through
at any location and at any time, so long as the pressure difference between gas and water is
greater than 2Pc , instead of only at the inlet. As shown in Figure 5.3 and Figure 5.4, it is
assumed in this model that over the length, 1l , the water pressure is the same in Tube 3 at
any x, and that the gas pressure in Tube 1 and Tube 2 varies linearly. Over the length, 3l ,
the gas pressure is the same in Tube 1 and Tube 2 at any x, and the water pressure in Tube
3 varies linearly. In the middle zone of length 2l , both the gas pressure and the water
pressure, in all tubes, vary linearly. There are two menisci in Tube 2 and, at both menisci,
the gas pressure is larger than the water pressure by the value of capillary pressure 2Pc .
The gas pressure at Meniscus 1 is 1P and the water pressure at Meniscus 2 is 2P . Assuming
127
the total fluid rate is Q , the viscous pressure drops across different sections of the model
during the drainage process can be obtained by applying the Hagen-Poiseuille equation.
1l 2l 3l
Inlet Outlet
11Q
12Q
13Q
21Q 31Q
22Q
23Q
32Q
33Q
A B
Figure 5.4: Schematic of the three-tube interacting capillary model: fluid interaction in the
three-tube interacting capillary model.
Because there is only gas flow in Tube 1 and Tube 2 in Section 1l , the Hagen- Poiseuille
equation is written as:
1
1
4
2
4
1
88 l
PPRRQ in
gg
......................................... (5-4)
For Section 2l , Tube 1 contains gas, Tube 2 and Tube 3 are filled with water. Thus:
2
21
4
3
2
21
4
2
2
21
4
1
888 l
PPPR
l
PPPR
l
PPPRQ c
w
c
w
c
g
128
2
21
4
3
4
2
4
1
888 l
PPPRRRQ c
wwg
............................... (5-5)
For Section 3l , there is only water flow in Tube 3. Thus:
3
2
4
3
8 l
PPRQ out
w
.............................................. (5-6)
The linear Eq. (5-4), (5-5) and (5-6) can be solved, simultaneously, for Q , 1P , and
2P ,with
known 1l and 3l . The pressure profiles in the three tubes are plotted in Figure 5.5. At the
next time step, 1l and 3l can be calculated explicitly according to the flow rate in each tube.
As shown in Figure 5.4, 1l and 2l can be determined by the movement of the two
meniscuses, A and B. For Meniscus B, because there is no fluid exchanging between tubes
which contain different fluids (gas and water) and there is no gas flow in Section 3l , the
gas flow, 21Q , will flow into Tube 2 at Point B and move Meniscus B leftwards. This
means that the flow rate 21Q decides the movement of interface B.
21QQB ........................................................ (5-7)
For Meniscus A, because the total gas rate flowing into the whole system is
232221 QQQQ , and the flow exchange only occurs at point A and point B, the flow
rate determining the movement of interface A is 232221 QQQQQA , or at the
interface A, gas invades in a flow rate of 1211 QQ , and part of this rate flows into Tube 1
at a rate of 21Q , and the left part of the this rate is used to move the interface A. Therefore:
129
2322211211 QQQQQQA ..................................... (5-8)
The ratio of the movements of the two capillary interfaces can be used to describe the
relative movement of these two interfaces, which are defined as:
2322
21
Q
Q
Q
A
B
.................................................. (5-9)
Considering,
2
21
4
121
8 l
PPPRQ c
g
......................................... (5-10)
2
21
4
222
8 l
PPPRQ c
w
........................................ (5-11)
2
21
4
323
8 l
PPPRQ c
w
........................................ (5-12)
Eq. (5-9) can be derived as,
4
3
4
2
4
1
RR
R
Q
Q
g
w
A
B
............................................. (5-13)
130
When gw , AB QQ , Meniscus B moves faster than A. When gw ,
AB QQ ,
meniscus A moves faster than B. The other term, 4
3
4
2
4
1
RR
R
, essentially represents the
relative permeability ratio of gas to water.
By defining,
j
i
ji
R
8
4
..................................................... (5-14)
where, i is the index of the tubes; j is the phase index for gas and water. Eq. (5-4), (5-5)
and (5-6) can be derived as:
1211 PPQl ingg ..................................... (5-15-1)
2132131 PPPllLQ cwwg .................... (4-15-2)
outw PPQl 233 ......................................... (4-15-3)
To build a transient model, first we take 1l and 3l as zero, and calculate 1P and 2P explicitly.
Then, the increment of 1l and 3l at each time step, t , can be calculated using:
tl
PPP
R
RtVl c
g
B
2
21
2
2
4
13
8 ......................... (4-15-4)
131
tl
PPP
R
R
R
RtVl c
ww
A
2
21
2
2
4
3
2
2
4
21
88 ................ (4-15-5)
The calculation will stop when 02 l , which means the two meniscuses merge and the
drainage process is completed.
Figure 5.5: Pressure profiles in the three-tube interacting capillary model.
132
To examine the three-tube interacting capillary model, a sample calculation is carried out.
In the sample calculation, the radii of the three tubes are assumed to be 1.0 μm, 2.0 μm and
3.0 μm, respectively. The viscosity of water is 1.0 cp, and the viscosi ty of the nonwetting
phase varies, 50 cp, 5 cp and 0.5 cp. The pressure of the nonwetting phase before the
drainage process is 28 kPa, and it increases to 41 kPa after the drainage process starts. The
positions of the two meniscuses, A and B, for the three cases with different viscosities, are
drawn in Figure 5.6. It can be seen that with the same tube size and, thus, the same relative
permeabilities for the nonwetting phase and the wetting phase, the viscosity ratio
determines the movement of the two meniscuses. When the viscosity ratio of the
nonwetting phase to the wetting phase is large enough, e.g. a mercury/air system, the
movement of Meniscus A is much faster, “forward flooding” shows up and the cumulative
production of water is decided by the nonwetting phase and its relative permeability. When
the viscosity ratio is small enough, e.g. an air/water system, the movement of the Meniscus
B is faster, “reverse flooding” appears and the cumulative production of the wetting phase
is mainly contributed by the wetting phase and its relative permeability. When the viscosity
ratio is comparable, e.g. a kerosene/water system, “bidirectional flooding” happens, and
the production of water is determined by both the nonwetting phase and the wetting phase.
This confirms that when gas is used as the nonwetting phase and water is the wetting phase,
the cumulative wetting phase production is determined by the viscosity and the relative
permeability of the wetting phase (Wang et al.2012).
133
t=1 sec
t=10 sec
t=25 sec
(a)
t=1 sec
t=5 sec
t=15 sec
(b)
t=1 sec
t=5 sec
t=15 sec
(c)
Figure 5.6: Results of the sample calculations with the three-tube interacting capillary
model. Wetting phase viscosity is 1 cp and nonwetting phase viscosities are: (a) 50 cp;
(b) 5 cp; (c) 0.5 cp.
134
5.4 Extending to an Interacting Tube-Bundle Model
The above three-tube interacting capillary model only can be used for qualitative analysis
of the drainage process with the membrane selective sealing effect. In this section, the
above model is extended to an interacting tube-bundle model, which consists of M
cylindrical capillary tubes of different radii, iR ( MRRRR 321 ), and all of the
same length, L .
The schematic of the interacting capillary bundle model is shown in Figure 5.7. Similar to
the three-tube interacting capillary model, it is assumed that, initially, the larger tubes
( MSRRR S 1,, 21 ) are filled with gas (the nonwetting phase) while the other smaller
tubes ( NSRRR MSS 1,, 21 ) are filled with water (the wetting phase). The left hand
end of the model is connected to a container to supply gas at a constant pressure, and the
right hand end of the model is connected to water. What should be emphasized here is that
it is assumed there is a water-wet membrane at the right hand end of the model to prevent
gas from breaking through.
135
Gas
Water
ZoneTrans .
Tube1g
TubeNg
Tube1
TubeN
Tube1w
TubeNw
1,lL
nleftlL ,nrightrL ,
2,rL1,rL
1cP 1cP
2cP 2cP
3cP
Figure 5.7: Schematic of an interacting tube-bundle model.
Unlike the conventional non-interacting tube-bundle model, the positions of oil–water
menisci in the capillaries of the interacting tube-bundle model are dependent on each other
because of pressure equilibration (Dong et al., 2005). Gas cannot flow out of the system,
due to a membrane selective sealing effect.
As with the three-tube interacting capillary model, gas is assumed to break through from
any location, as long as the pressure difference reaches the breakthough pressure of a
certain tube. Therefore, as shown in Figure 5.7, this modified model consists of three zones:
the Gas Zone ( Ng tubes), which represents the largest tubes having been broken through
136
by gas in the previous drainage step; the Transaction Zone( N tubes), which represents the
tubes being broken through at current drainage step; the Water Zone ( Nw tubes), which
represents the tubes that will not be broken through at current drainage step. It should be
noted that NwNNgM , where M is the total number of tubes in the model. There
are LeftN sections at the left hand of the model and RightN sections at the right hand of the
model. For the Gas Zone, the hydraulic conductivity is defined as:
Ng
i g
i
g
RM
1
4
8
............................................... (5-16)
where iR is the i th tube in the Gas Zone. For the Water Zone, the hydraulic conductivity is
defined as:
Nw
i w
i
w
RM
1
4
8
............................................... (5-17)
where iR is the i th tube in the Water Zone. According to the Hagen-Poiseuille equation, as
shown in Figure 5.7, the first section on the left part of the tube-bundle model is written as:
1,
1,
1
4
8 l
linnLeft
i g
ig
L
PPRMQ
.................................. (5-18)
For the second section:
137
1,2,
22,11,
4
1,2,
2,1,1
1
4
8
8
ll
clcl
w
N
nLefti w
i
ll
llnLeft
i g
i
g
LL
PPPPM
R
LL
PPRMQ
............... (5-19)
Similarly, for the thj section:
1,,
,,1,1,
2
4
1,,
,1,1
1
4
8
8
jljl
jcjljcjl
w
N
jnLefti w
i
jljl
jljljnLeft
i g
ig
LL
PPPPM
R
LL
PPRMQ
......... (5-20)
For the section in the middle, 1 LeftNj :
m
nRightrnLeftl
w
N
i w
i
m
nRightrnLeftl
gL
PPM
R
L
PPMQ
,,
1
4,,
8
........... (5-21)
For the thj sections counted from the left hand, when kNNj RightLeft 2 , where k
varies from RightN to 2:
1,,
1,1,,,
2
4
1,,
1,,1
1
4
8
8
krkr
kckrkckr
w
N
knRighti w
i
krkr
krkrknRight
i g
i
g
LL
PPPPM
R
LL
PPRMQ
.......... (5-22)
For the last section at the right hand, 1 RightLeft NNj :
138
1,
1,1,
1
4
8 r
outcr
w
N
nRighti w
i
L
PPPM
RQ
.......................... (5-23)
The equation group can be simplified as:
1,1,1, lingl PPMQL ........................................... (5-24)
jcjljcjljwjljljgjljl PPPPMPPMQLL ,,1,1,,,1,,1,, ....... (5-25)
nRightrnLeftlnLeftwnRightrnLeftlnLeftgm PPMPPMQL ,,1,,,1, .............. (5-26)
1,1,,,,1,,,1,, kckrkckrjwkrkrjgkrkr PPPPMPPMQLL ...... (5-27)
outcrnRightnLeftwr PPPMQL 1,1,1,1, ................................ (5-28)
The array P is gas pressure and the meniscus positions L represent the saturation
distribution along the tube. Therefore, like the traditional IMPES method, these equations
can also be solved implicitly for pressure and explicitly for meniscus positions. From the
pressure distribution, the flow rate at each section, for both gas and water, can be
calculated. Assuming that the flow rate of gas is nRightnLeft to1 iQoi, the velocity of
the movement of the meniscus can be calculated by:
k
oioi
ikA
QQV 1
................................................. (5-29)
where, kA is the cross-sectional area of the thk tube. Positions of all meniscus at the next
time step is updated explicitly by applying the position increment to each meniscus.
139
5.5 Modeling of the Drainage Process
In order to validate the extended interacting tube-bundle model, a model with hypothetical
parameters was built. Then simulations were carried out in order to model the typical
behavior of the drainage process in a porous medium with the membrane sealing effect.
The length of the interacting tube-bundle model is 1.00 cm; the tube size distribution
satisfies truncated Weibull distribution, as shown in Figure 5.8, with mRaverage 0.6 ,
mR 30max and mR 0.1min ; the interfacial tension is 72.60 dyne/cm, the tubes are
strong water wetted and the contact angle is assumed to be 0. Water is used as the wetting
phase and its viscosity is 1.00 cp at the simulation conditions.
Figure 5.8: Tube radius distribution satisfying truncated Weibull distribution.
140
5.5.1 Modeling of Saturation Profiles
The three-tube capillary model can only qualitatively model the “reverse flood” and
“bidirectional flood”. In this section, the interactive tube-bundle model, which consists of
50 tubes, was used to model the saturation profiles in a porous medium. Radii distribution
of these 50 tubes satisfies truncated Weibull distribution. The nonwetting phase pressure
increases from the previous 25kPa to a new level of 52kPa. Correspondingly, the tubes are
broken through from the 13th
to the 41st tube.
Figure 5.9 shows the wetting phase saturation profiles along the model, at selected
drainage times, for three cases with different nonwetting phase viscosities: 500 cp, 5 cp
and 0.05 cp, respectively. Correspondingly, the viscosity ratios of the nonwetting to
wetting phase are 100, 1, and 0.01. Note, at a very high nonwetting phase viscosity, as
shown in Figure 5.9(a), the saturation of the wetting phase drops from the inlet end of the
model. This is generally consistent with the results of a conventional coreflood test.
Conversely, at a very low nonwetting phase viscosity, as shown in Figure 5.9(c), the
wetting phase saturation drops from the outlet end of the model. As the process progresses,
the decreased saturation spread to the inlet end of the model and the “reverse flood” shows
up. At an intermediate nonwetting phase viscosity, wetting phase saturation decreases from
both the inlet and outlet of the model, as shown in Figure 5.9(b). It can also be noticed that,
early on, the saturation at the inlet decreases faster and, later, the saturation at the outlet
decreases faster. The reason for this is that the decreasing of wetting phase saturation
reduces its relative permeability, and the lowered relative permeability of the wetting phase
141
gradually converts the “forward flooding” to “reverse flooding”. This is completely
consistent with the results from the numerical simulation.
5.5.2 Modeling of Drainage History
The wetting phase production in the three-tube capillary model stops once the two menisci
in the middle tube merge and the middle tube is filled with the nonwetting phase. However,
the wetting phase production does not have such an end point in a real drainage process.
This artificial end pont could be caused by the limited number of the tubes used in the
three-tube capillary model. In this section, the total number of the tubes in the model is
increased from 3 to 9, 27, 81 and 243, and correspondingly, the number of the tubes broken
through in the drainage process increases from 1 to 3, 9, 27, and 81. All tubes are assumed
to have the same wettability. The viscosities of the nonwetting phase and the wetting phase
are identical and both equal to 1.0 cp. At the beginning of the drainage process, the
pressure of the nonwetting phase at the inlet is calculated using the following equation:
1
4'
wN
inRR
P
................................................. (5-30)
where NR is the smallest tube which will be broken though in this drainage step and 1wR is
the largest tube which will not be broken though in this drainage step.
142
(a)
(b)
(c)
Figure 5.9: Wetting phase saturation profiles in the interacting tube-bundle
model.Nonwetting phase viscosities are: (a) 500 cp; (b) 5 cp; (c) 0.05 cp, respectively.
143
The wetting phase production history is plotted in Figure 5.10. M is the total number of
tubes in the model, N is the number of the tubes broken through in the drainage step.
From Figure 5.10, it can be seen that the wetting phase production, calculated by the three-
tube capillary model, stops when the two menisci in the middle tube merge. However, as
the tube number increases, time required to fill all tubes in the drainage process increases.
It is reasonable to expect that when the total number of the tubes, N , goes to infinity, the
curve will converge to the production curve in a real drainage process.
Figure 5.10: Wetting phase production history of the interacting tube-bundle model with
different numbers of capillary tubes. M is the number of all tubes, N is the number of the
tubes broken through in the drainage step.
The analytical equation (Wang et al., 2012) shows that there is a linear relationship
between wDSln and t , where wDS is the normalized saturation of the wetting phase at
144
one drainage step defined by Eq. (5-2) and t is the drainage time. The relationship of
wDSln and t was plotted in Figure 5.11. All curves have a linear section at the beginning,
and then rapidly increase towards the end. This rapid increase in each curve is because, at
that time, only one or two tubes are contributing to the drainage process. All other tubes
have already been filled with the nonwetting phase. All models are downgraded to a three-
tube model. However, it is reasonable to expect that, as the number of the tubes in the
model increases, the length of the straight line section will be extended, and the curve will
eventually converge to a straight line when the number of tubes, N , goes to infinity.
Figure 5.11: Relationship of R 1ln and time calculated using the interacting tube-
bundle model with different numbers of capillary tubes. M is the number of all tubes; N is
the number of the tubes broken through in the drainage process.
145
5.5.3 Modeling of Multi-step Drainage Process
In order to model the multi-step drainage process for a gas/water system, the extended
interacting tube-bundle model is expanded to a model that consists of 243 tubes. The
viscosity of water (the wetting phase) is 1.0 cp, while the viscosity of gas (the nonwetting
phase) is 0.1 cp. The capillary pressure curve of gas/water for this model, which is plotted
in Figure 5.12, is calculated from the pore size distribution defined in Figure 5.8.
Figure 5.12: Capillary pressure curve calculated from the pore size distribution and the
drainage pressures used in the 5-step drainage experiment.
A hypothetical 5-step drainage experiment was carried out based on this model. The
drainage pressures used in the hypothetical experiments are represented by circles in
Figure 5.12. The corresponding saturation changes of each drainage step are 0.7-0.4, 0.4-
0.2, 0.2-0.1, 0.1-0.04, and 0.04-0.005, respectively. In each drainage step, around 30 tubes
146
were broken through by gas, and the cumulative water production history was recorded and
depicted in Figure 5.13. The normalized water recovery histories at each step were
calculated and plotted in Figure 5.14. It can be seen that all production curves have the
same shape as the experimental and simulation results in previous publications (Jennings,
1983; Eching and Hopmans, 1993; Liu et al., 1998; Chen et al.1999; Wang et al., 2012).
Figure 5.13: Cumulative wetting phase production history in the 5-step drainage process
modeled by the interacting tube-bundle model.
147
Figure 5.14: Cumulative wetting phase production history in the 5-step drainage process
modeled by the interacting tube-bundle model.
Figure 5.15: Wetting phase recovery histories at each drainage step in the 5-step drainage
process.
148
Moreover, as shown in Figure 5.15, all curves for the relation of wDSln versus time, t ,
have a linear section, which is consistent with Eq. (5-1). The slopes of the linear sections
can be calculated by linear regression and the results are listed in the forth column of Table
5.1.
The following group of equations (Wang, 2010) is applied to calculate the absolute
permeability, the water saturation and the relative permeabilities of each phase in the
interacting tube-bundle model, consisting of N tubes, of which k tubes are filled with gas
and the others filled with water. The absolute permeability of the model can be calculated
using:
ARKN
i
i 81
4
............................................... (5-31)
where iR is the radius of the thi tube and A is the cross-sectional area of the model. The
water saturation in the model is calculated by:
N
i
i
N
ki
iw RRS1
2
1
2............................................. (5-32)
where iR is the radius of the thi tube and rgK and rwK are the relative permeabilities of
gas and water, respectively. By applying the following equations, the relative
permeabilities of gas and water can also be calculated:
N
i
i
k
i
irg RRK1
4
1
4 ............................................ (5-33)
149
N
i
i
N
ki
irw RRK1
4
1
4 ............................................ (5-34)
Table 5.1: A comparison of the results calculated from the analytical model and the results
calculated from the interacting tube-bundle model
Water
Saturation
(Sw)
Capillary
Pressure
(Pc)
Pc Gradient
(∆Pc/∆Sw)
Regressed
Slope
(k)
Analytical
Calculated
Permeability
Relative
Permeability
(Krw)
0.005 0.5558 31.15 0.2256 0.000235 0.000231
0.040 0.3316 2.593 0.3247 0.004060 0.003990
0.100 0.2595 0.7354 0.4656 0.02052 0.01950
0.200 0.2115 0.3563 0.5670 0.05160 0.05190
0.400 0.1664 0.1700 0.8500 0.1621 0.1610
Using Eq. (5-31), the absolute permeability of the model in the hypothetical test is
calculated as 12.5 Darcies; From the capillary curve in Figure 5.12, the capillary gradient
at the tested saturation, ∆Pc/∆Sw, can also be calculated and listed in the third column of
Table 5.1. By applying Eq. (5-13), the relative permeabilities of water for the model are
calculated and listed in the fifth column of Table 5.1. From the other aspect, the relative
permeabilities of water at the corresponding saturations of each drainage step are also
calculated by Eq. (5-34). These values are listed in the last column of Table 5.1. As shown
150
in Figure 5.16, the relative permeabilities calculated by the analytical model. Based on the
simulation results using the interacting tube-bundle model, are identical to the results
calculated directly from the tube-bundle model. In other words, for a porous medium like a
bundle of tubes, the modeling method is accurate and the interactive tube-bundle model
completely replicates the multi-step drainage process. This indicates that the modeling
method is reasonable, and the interacting tube-bundle model is more applicable when
modeling the multiphase fluid in porous media. However, most porous media are not as
simple as a bundle of tubes. It is believed that by further incorporating the serial-type
model and the triangle tubes to simulate water trapping mechanisms, this model should be
able to be applied for history matching of the multi-step drainage process.
Figure 5.16: Calculated relative permeabilities of water from the analytical model and the
interactive tube bundle model.
0.0001
0.001
0.01
0.1
1
0.0001 0.001 0.01 0.1 1
Krw
Cal
cula
ted
fro
m A
nal
ytic
al M
od
elin
g
Krw Calculated from Pore Size Distribution
151
5.6 Conclusions
The porous plate method is one of the most conventional ways to measure the capillary
pressure in a porous medium. The relative permeabilities can also be estimated by
analyzing the wetting phase production histories at each step. The distinct feature of this
method is the application of a porous plate, or membrane, to prevent the nonwetting phase
from being discharged from the porous medium, which is referred to as the selective
sealing effect in this chapter. Although the conventional tube-bundle model can
successfully model the capillary phenomenon, it has some difficulties when it comes to
properly modeling the wetting phase production history, because, in a drainage-type
process, the sealing effect of the membrane significantly changes the multiphase flow
pattern. In this chapter, an extended interactive tube-bundle model was developed and
applied to model this process. First, in order to qualitatively model this process, a new
three-tube interacting capillary model was developed and the “reverse flood” and
“bidirectional flood” were conceptually modeled. It also explains in concept why, in this
process, the phase with lower mobility determines the wetting phase production history.
After that, the three-tube interacting capillary model was extended to a complex interactive
tube-bundle model, consisting of hundreds of tubes. The saturation profiles along the
porous medium, the wetting phase production curves, and the multi-step drainage process
were all successfully modeled. The application of the interactive tube-bundle model
indicates that it can better represent the pore structure of a porous medium than the
conventional non-interactive tube-bundle models.
152
The multi-step drainage process used to simultaneously measure the capillary pressure and
relative permeabilities is modeled by the extended interacting tube-bundle model
developed in this chapter. All phenomena in this process, such as “reverse flooding”,
“bidirectional flooding”, the relationship between wDSln and time t , and the multi-step
drainage process can be successfully modeled. It is proved that the interacting tube-bundle
model more accurately represents the pore structure and fluid flow dynamics in a porous
medium. By incorporating the serial-type model and the triangle tubes to simulate water
trapping mechanisms, this model should be able to history match the multi-step drainage
experiments and build the relation between the capillary pressures and the relative
permeability curves.
The interacting tube-bundle model provides another way to model the one-dimensional
multiphase flow. The advantage of the interacting tube-bundle model is that it is able to
obtain an accurate displacement front and saturation profile along the model. However, the
disadvantage is that this method considers the porous medium as a tube-bundle with a
limited number of tubes. This is the reason for the 100% wetting phase recovery in a
drainage process and 100% water cut in the waterfood simulation within limited time
(Dong et al., 2005). To solve this problem, a dynamic tube-bundle model, which can
dynamically rearrange the number and size of the tubes according to capillary pressure
curve in a displacement process, is suggested.
153
CHAPTER 6: EXPERIMENTAL VALIDATION
6.1 Introduction
Three different models to describe the multi-step drainage process were developed and
extensively discussed in the above chapters, including: numerical modeling, analytical
modeling and interactive tube-bundle modeling. In addition, a method using automatic
history matching with a Guo Tao genetic algorithm and direct estimation using analytical
modelling were developed to estimate the relative permeabilities of the wetting phase by
matching the production data in a multi-step drainage process. In this chapter, the multi-
step drainage experiments in the lab were carried out using both sandpacks and core
samples to validate the effectiveness of these methods. The multi-step drainage
experiments were carried out using oil/water, gas/water and gas/oil/water systems to
investigate the practical application of the different methods on different fluid systems.
6.2 Apparatus
Multi-step drainage process can be carried out using both sandpack and core sample. The
apparatus and schematic diagram are shown in the following section.
154
6.2.1 Multi-step Drainage Process using a Sandpack
The schematic diagram of the experimental apparatus for the multi-step drainage process
using a sandpack is shown in Figure 6.1. The entire system consists of a coreholder, a
ruler, a nylon tube with a valve and a computer controlled high accurate balance.
Membrane
Distributor
Sandpack
Figure 6.1: Schematic diagram for the multi-step drainage process using a sandpack.
A fabric membrane was positioned between the metal distributor and the sandpack. The
basic properties of the membrane are listed in Table 6.1. The sandpack was positioned
horizontally to make the gravity effect negligible. The pressure difference between the two
ends of the sandpack was generated by the hydraulic pressure in the nylon tube connected
to the outlet of the sandpack.
155
Table 6.1: Basic properties of the oil-wetting and the water-wetting membranes.
Oil-wetting Water-wetting
Pore Size (µm) 0.22 0.10
Water Flow Rate(cm3/min/cm
2) 6.7 2.5
Thickness (µm) 125 125
Porosity (%) 70 70
Threshold Pressure (atm) 3.45 4.8
6.2.2 Multi-step Drainage Process using a Core Sample
As shown in Figure 6.2 and Figure 6.3, the entire system for a multi-step drainage process
using core sample consists of a capillary pressure cell, a pressure gauge, a buffering
cylinder, a tubing pump and a digital balance. Air/kerosene was used as the non-wetting
phase and water as the wetting phase. The pressure of the non-wetting phase was
controlled by pumping air into a buffering cylinder using a tubing pump and monitored by
a pressure gauge. The produced water was collected in the buffering cylinder at the
ambient condition and the production history was recorded by a computer-controlled
digital balance, which was covered by a plastic box to reduce the impacts of the indoor air
flow. The readability of the balance is 0.01g and the data was collected every 6 seconds.
156
Capillary pressure cell
Computer Controlled Balance
P
Pressure Gauge
Tubing Pump
Cylinder
V-1
V-2
V-3
E-1
Figure 6.2: Schematic diagram of the multi-step drainage system using a core sample.
6.3 Measurement of Resistance/Permeability
Before beginning the multi-step drainage experiment, it is necessary to measure the
resistance/permeability of the following three systems:
(1) The system with the plastic tubing, the valves, and the core holder;
(2a) System (1) + membrane, sandpack case;
(2b) System (1) + core sample, core sample case;
157
(3) System (1) + membrane + sandpack/core sample;
With the above measurements, the resistance of the experimental system and the
membrane can be calculated. The permeability of porous medium, being the sandpack or
the core sample, can be calculated as well. The calculated resistance/permeability will be
incorporated in both automatic history matching and analytical modeling.
Figure 6.3: A photo of the apparatus for the multi-step drainage process using core sample.
158
6.3.1 Procedures
The experiment procedures and calculations are shown as follows:
1. Assemble the system without the membrane and the porous medium;
2. Pump water at different rates and record the cumulative water flow through the system,
as shown in Figure 6.4. Record the pressure difference at the corresponding rate using the
pressure gauge connected to a computer. This process is referred to as a multi-rate flow test
in this work.
Figure 6.4: An example for the permeability/resistance test data processing.
0
10
20
30
40
50
60
70
80
90
0 200 400 600 800 1000
Cu
m. V
olu
me,
cm
3
Time, s
159
3. For the system (2a), assemble the system (1) with the membrane and perform a multi -
rate flow test. For the system (2b), assemble the core sample with system (1) and perform
the multi-rate flow test.
4. Assemble the entire system including the plastic tubing, the valves, the core holder and
the porous medium. Carry out the multi-rate flow test. Record the pressure and cumulative
water production volume.
6.3.2 Calculation of Resistance/Permeability
For Darcy‟s flow, flow rate Q in a porous medium is proportional to the pressure
difference ΔP, which is expressed as:
QRP h ...................................................... (6-1)
where hR is the hydrodynamic resistance, which is defined as the pressure difference
applied at two ends of a porous medium to generate a unit rate of flow. For one
dimensional flow in a system consisting of N segments:
N
iih
N
i
itotal RQPP11
......................................... (6-2)
The system in this work consists of the pipeline, the membrane, and the porous medium:
umporousmedihmembranehpipehtotal RRRQP ___ ........................ (6-3)
For Darcy's equation in a porous medium:
160
L
PA
KQ
w
................................................... (6-4)
combined with Eq. (6-3):
umporousmedih
w
AR
LK
_
............................................... (6-5)
pipehR_
, membranehR _ , and umporousmedihR _ can all be measured step by step using the procedures
described in Section 6.3. The absolute permeability can be calculated using Eq. (6-5).
As shown in Figure 6.4, each linear portion in the cumulative production data recorded by
the computer controlled balance represents a constant rate flow with a certain pressure
difference. The slope of a linear portion is the flow rate under the corresponding pressure.
All slopes are then plotted together, as shown in Figure 6.5. Linear regression gives the
resistance of the corresponding system. By considering the viscosity of water and the
geometry of the system, the permeabilities of the porous media and the equivalence
permeabilities of the pipeline and membrane, the equivalence to the same diameter as the
porous media, can be calculated.
161
Figure 6.5: Linear regression to calculate conductivity of target flow system.
6.4 Gas Leakage due to Gas Diffusion
Figure 6.7 shows a typical water production history in a multi-step drainage process in an
air/water system. The expectation was that water production would stop increasing once
the system reached capillary equivalence. However, as can be seen, the cumulative
production of water continues to increase at the last drainage step. Initially, this was
believed to be caused by gas leakage in the system. Efforts to prevent the leakage were
taken, but did not completely mitigate it.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0 0.05 0.1 0.15 0.2
ΔP
, atm
Flow Rate, cm3/s
162
Coming back to the fundamentals of model, this part of the cumulative production is
actually caused by the diffusion of air in water: the gas going through the membrane due to
diffusion occupies some space under the membrane and expels some water. Consequently,
the water production increases. At the beginning of this process, the impact of gas
diffusion will not be observed, when the pressure difference is low. Later, when the
capillary pressure is high, the pressure difference leading to gas diffusion increases.
Meanwhile, the water production rate decreases. The impact of the gas diffusion on the
water production becomes non-negligible. The following shows an example to indicate the
magnitude of the gas diffusion by assuming the parameters listed in Table 6.2.
As shown in Figure 6.6, according to Fick‟s Law, the diffusion equation through a porous
medium can be calculated by the following equation:
l
CDAqdiff
.................................................. (6-6)
where diffq is the air flow rate due to diffusion; D is air diffusion coefficient in water; A is
the cross sectional area of the porous medium; is porosity; is density of gas; is
tortuosity; C is the concentration of gas in water; l is the length of the porous medium.
From the above equation, the calculated gas diffusion rate (0.288cm3/hour) has a similar
magnitude as the water volume produced in the drainage process. However, unlike the
water volume produced in the drainage process, the gas diffusion rate is constant for a
certain pressure difference. There are two ways to handle this issue: (1) include the
constant gas diffusion rate into history matching or (2) subtract the linear part of the
163
cumulative production curve to extract the cumulative water production due to the gas
drainage. In order to apply the analytical method, the systems using gas as the non-wetting
phase were calibrated using the second approach to handle the impacts of the gas diffusion
effects.
Table 6.2: Parameters used for hypothetical gas diffusion calculation
Parameter Value
Room Temperature, T 25 ℃
Thickness, b mm1.0 ( m4101 )
Area, A 216cm (241016 m )
Solubility of air in water at 1 atm, 1C 0.023 kg/m
3
Solubility of air in water at 2 atm, 2C 0.045 kg/m3
Diffusion coefficient of gas in water, D sm /102.3 29
Porosity, 0.2
Tortuosity, w 1.5
Density, 1.1839 kg/m3
164
batm2
atm1
membrane saturatedWater
Figure 6.6: Schematic of the gas diffusion model through the membrane.
6.5 Multi-step Drainage Process using a Sandpack
6.5.1 Procedures
The procedure for a multi-step drainage experiment with a sandpack using gas/water and
oil/water systems is described in this section. Before the multi-step drainage experiment,
the basic parameters, such as permeability, porosity, geometry, and the resistivity of the
membrane and pipeline were measured. The step-by-step workflow is summarized as:
(1) Measure the weight of the empty core holder, chm .
(2) Assemble the system without packing the sand and measure the resistances of the
pipeline without membrane and with membrane, respectively.
(3) Wet-pack the core holder with water and sand.
(4) Vibrate the core holder for 2 hours to ensure the sandpack is tightly packed.
165
(5) Measure the weight of the core holder and the saturated sandpack as spm .
(6) Assemble the core holder into the system and measure hydrodynamic resistance of the
sandpack.
(7) Carry out the multi-step drainage experiment. The pressure is controlled by lowering
the outlet of the nylon tube gradually. For a gas/water system, the inlet end of the core
holder is connected to the free atmosphere. For an oil/water system, the inlet end of the
core holder is connected to a beaker full of kerosene.
(8) After the drainage experiment, the majority of the wet sand is dug out and its weight is
measured as 1wm .
(9) The wet sand is dried for 12 hours by hot air from a hair dryer until no weight variation
is observed. The weight of the dry sand is measured as 1dm .
(10) The remaining wet sand adhering to the core holder is washed, collected, dried and its
weight is measured as 2dm .
6.5.2 Calculation of the Basic Parameters
Porosity
The porosity of the sandpack is calculated in terms of the mass difference between the
water saturated sandpack and the dry sandpack. The mass of the water saturated sandpack
166
is chspw mmm . The mass of the dry sandpack is 21 ddd mmm . Porosity is therefore
calculated by:
chw
dw
V
mm
.................................................. (6-7)
where chV is the volume of the core holder, which equals the bulk volume of the sandpack.
w is the density of water at experimental conditions.
Water Saturation
For the gas/water system, the remaining water in the sandpack after the drainage process is
calculated by measuring the remaining water in the first part of the wet sand. The
remaining water in the first part of the sand is 111 dwrw mmm . The remaining water in the
entire sandpack can be calculated by:
1
1
21 d
rw
dd
rw
m
m
mm
m
............................................... (6-8)
By multiplying both sides by 21 dd mm :
21
1
1dd
d
rwrw mm
m
mm ........................................... (6-9)
The remaining water saturation is calculated by:
167
dw
rwrw
mm
mS
................................................ (6-10)
then:
211
211
ddwd
ddrw
rwmmmm
mmmS
...................................... (6-11)
For a system with air as a non-wetting phase, the volume of the remaining water will be
calibrated by the total produced water for mass balance. For an oil/water system, it is
difficult to measure the remaining water in the sandpack using the mass difference method,
but both the volume of cumulative produced water and the cumulative injected oil can be
measured. The average value calculated from these two methods is used to estimate the
water saturation.
6.5.3 Gas/Water System
Initially, air and water were used as the non-wetting phase and the wetting phase,
respectively. Prior to the experiment, the dimensions and the weight of the core holder
were measured. The basic parameters of the sandpack are listed in Table 6.3. The sandpack
is 7.00 cm in length and 4.10 cm in diameter. Its cross-sectional area and its volume is
calculated as 13.20 m2 and 92.37 m
3, respectively. The dead volume in the distributor is
estimated to be 1.0 cm3.
168
Table 6.3: Basic parameters of the sandpack used at the drainage experiment
Parameter Value Unit
Length 7.00 cm
Diameter 4.10 cm
Area 13.20 cm2
Volume 92.37 cm3
As listed in Table 6.4 and Table 6.5, the porosity of the sandpack was measured as 0.370
based on masses difference; the viscosity of water is 1.0 cp at laboratory conditions and the
viscosity of kerosene was measured as 0.80 cp. From the data listed in Table 6.6, the
absolute permeability of the sandpack was calculated as 2.50 Darcies and the hydraulic
conductivity of the pipeline and the membrane was calculated as 66.1 md/cm. A four-step
drainage experiment was carried out with a gas/water system using the sandpack and the
water production history was recorded and plotted as blue circles in Figure 6.7. Gas
diffusion effect discussed in the above section was considered to correct the cumulative
production of water. After substracting the water volume produced due to gas diffusion, the
corrected cumulative production was plotted as red circles in Figure 6.7.
169
Table 6.4: Measurement of porosity and residual water saturation – Test 1 (Sandpack,
Gas/water System)
Test one Value Unit
Coreholder Weight 2095.48 g
Coreholder & Wet Sand 2319.03 g
Dead Volume 1.00 cm3
Wet Sand Weight 222.55 g
DrySand & Beaker 403.49 g
Beaker 215.09 g
DrySand Weight 188.40 g
Water in place 34.15 g
Porosity 0.370
170
Table 6.5: Measurement of porosity and residual water saturation – Test 2 (Sandpack,
Gas/water System)
Test Two Value Unit
Highest pressure 0.182 atm
Beaker weight 118.24 g
Beaker&Half-wet Sand 302.12 g
Beaker&Dry Sand 297.55 g
Liquid Left 4.57 g
Dry Sand 179.31 g
Liquid Left 2 4.80 g
Final Water Saturation 0.141 g
171
Table 6.6: Results of the resistance tests for the sandpack systems
System Unit Test G/W Test O/W
Pipeline atm/(cm3/s) 0.1308 0.1368
Membrane atm/(cm3/s) 0.7734 0.7134
Sand atm/(cm3/s) 0.1915 0.1968
Permeability Darcy 2.50 2.77
6.5.4 Oil/Water System
The oil/water system was also used in order to validate the applicability of the methods
presented in the thesis. As listed in Table 6.3, the same core holder as the gas/water system
was used with a thickness of 7.00 cm and a diameter of 4.10 cm; the porosity of the
sandpack was measured as 0.368; the viscosity of water is 1.0 cp at laboratory conditions
and the viscosity of kerosene was measured as 0.80 cp. From the data listed in Table 6.6,
the absolute permeability of the sandpack was calculated as 2.77 Darcies and the hydraulic
conductivity of the pipeline and the membrane was calculated as 80.0 mD/cm. A four-step
drainage experiment was carried out based on the oil/water system and the water
production history was recorded and plotted as squares in Figure 6.8. For oil/water system,
the diffusion effect is negligible.
172
Table 6.7: Measurement of porosity and the residual water saturation (Sandpack, Oil/Water
System)
Porosity & Residual Liquid Calculation
Porosity
Coreholder Weight 2096.20 g
CH & Wet Sand 2321.12 g
Dead Volume 1.00 cm3
Wet Sand Weight 223.92 g
DrySand & Beaker 405.20 g
Beaker 215.30 g
DrySand Weight 189.90 g
Water in place 34.02 g
Porosity 0.368
Final Saturation
Cumulative Water 28.80 cm3
Cumulative Oil 29.40 cm3
Saturation 0.145
173
6.5.5 Results and Discussions
Figure 6.7 shows the measured cumulative water production and the calibrated cumulative
water production, considering the gas diffusion and the residual water saturation in the
sandpack. As can be seen from Figure 6.7, about 2.0 cm3 volume difference is observed
between measured water production and the calibrated water production, which is
essentially caused by the gas diffusion. The last step on the measured curve in the drainage
process is a straight line with a constant slope where the cumulative production is
dominated by the gas diffusion. In this step, the multi-step drainage process using sandpack
and gas/water system has significant measurement uncertainty caused by the gas diffusion.
However, as shown in Figure 6.8, for the water/oil system neglecting the diffusion of oil in
water, the curves are much smoother and no significant impacts of diffusion or leakage are
indicated at the last step. Moreover, it is also seen that the residual water saturation in the
oil/water system is very close to the calibrated residual water saturation in the gas/water
system. Because the density of kerosene and water are very close, the residual water
saturation was only calculated from the cumulative production of water and the cumulative
injection of kerosene.
The automatic history match method is used to estimate the relative permeabilities of water
considering the resistance of the membrane. The history matched results of the wetting
phase production for gas/water and oil/water systems are plotted in Figure 6.8 and Figure
6.9, respectively. Using automatic history matching, the production histories for both
gas/water and oil/water systems were matched very well.
174
Figure 6.7: The experimental and the calibrated cumulative water production histories. The
calibrated the data considers gas diffustion volume and the residual saturation at the core
sample.
0
5
10
15
20
25
30
35
0 2 4 6 8 10 12
Cu
mu
lati
ve W
ate
r, c
m3
Time, hour
Calibrated Data (Diffusion, Residual Saturation)
Experimental
175
Figure 6.8: The experimental cumulative water production histories and history matching
results of oil/water system in sandpack.
0
5
10
15
20
25
30
35
0 5 10 15 20
Cu
mu
lati
ve W
ate
r, c
m3
Time, hour
Experimental Data
History Match Results
176
Figure 6.9: History matching results of gas/water system in sandpack.
0
5
10
15
20
25
30
35
0 2 4 6 8 10 12
Cu
mu
lati
ve W
ate
r, c
m3
Time, hour
Experimental Data
History Match Results
177
Analytical method was also used to calculate the relative permeabilities to water for
different liquid systems. As shown in Figure 6.10, given enough time, the first 3 steps in
the gas/water system all exhibit linear sections. For the last step of the gas/water system,
there are not enough valid data points to plot a straight line, thus it is not considered in the
analytical model. For oil/water system, as plotted in Figure 6.11, linear relationship is
observed for all four steps. The relative permeabilities to water were then calculated from
the slopes of these straight lines for different systems.
Figure 6.10: Calculation of the relative permeabilities to water for the gas/water system in
sandpack.
y = 1.4187E-01x + 9.1049E-01R² = 9.9696E-01
0
0.5
1
1.5
2
2.5
3
3.5
0 5 10 15 20
-Ln
(Sw
D)
Td
Step 1
y = 1.5531E-02x + 2.5106E-01R² = 9.9713E-01
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
0 50 100 150 200 250
-Ln
(Sw
D)
Td
Step 2
y = 1.0236E-03x + 4.0918E-01R² = 9.9630E-01
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
0 500 1000 1500
-Ln
(Sw
D)
Td
Step 3
178
Figure 6.11: Calculation of the relative permeabilities to water for an oil/water system in
sandpack.
The capillary pressures measured for both oil/water and gas/water systems are plotted
together in Figure 6.12. The capillary pressure for the oil/water system is slightly lower
than that for the gas/water system; this is due to the different interfacial tension and contact
angle of the systems. However, the residual water saturations at the end of the drainage
experiments are very close. The relative permeabilities calculated from the numerical
method and the analytical methods are shown in Figure 6.13. There is a very good
consistency between these two methods; however, the closed-form analytical method is
much easier to apply to the relative permeabilities calculation.
y = 9.0404E-02x + 3.8125E-01R² = 9.9696E-01
0
0.5
1
1.5
2
2.5
3
3.5
0 5 10 15 20 25 30 35
-Ln
(Sw
D)
Td
Step 1
y = 7.3161E-03x + 4.4570E-01R² = 9.9314E-01
0
0.5
1
1.5
2
2.5
0 50 100 150 200 250 300
-Ln
(Sw
D)
Td
Step 2
y = 2.0894E-03x + 5.4568E-02R² = 9.9661E-01
0
0.5
1
1.5
2
2.5
3
0 200 400 600 800 1000 1200
-Ln
(Sw
D)
Td
Step 3
y = 6.4086E-04x - 2.0105E-01R² = 9.8259E-01
0
0.5
1
1.5
2
2.5
3
0 1000 2000 3000 4000 5000
-Ln
(Sw
D)
Td
Step 4
179
Figure 6.12: Capillary pressure measurement in the sandpack.
0
0.02
0.04
0.06
0.08
0.1
0.12
0.14
0.16
0.18
0.2
0 0.2 0.4 0.6 0.8 1
Cap
illa
ry P
ressu
re,
atm
Water Saturation, Frac
G/W
O/W
180
Figure 6.13: Comparisons of the relative permeabilities of the wetting phase in the
sandpack obtained from simulation and analytical equation.
0.00001
0.0001
0.001
0.01
0.1
1
0.00001 0.0001 0.001 0.01 0.1 1
Krw
, An
alyt
ical
Krw Simulation
O/W G/W
181
6.6 Multi-step Drainage Process using Core Sample
The above sections illustrate the successful application of measurements of the relative
permeabilities of water using the multi-step drainage process in the sandpack. A similar
apparatus and procedure was designed to apply the multi-step drainage process on core
samples. The detailed experiment procedures are listed as follows.
6.6.1 Procedure
For the multi-step drainage process applied on core samples, fluids systems using
gas/water, oil/water and gas/oil/water were all tested. Generally, the detailed procedures
for these three different fluids system are very similar and summarized as follows:
(1) Measure the viscosities of kerosene and water; viscosity of air is assumed negligible;
(2) Measure the basic geometry dimensions of the core sample;
(3) Dehydrate the core sample using hot air for about 24 hours and measure its dry weight
(4) Saturate the core with water and measure its wet weight.
(5) Calculate the porosity using the mass difference between the wet weight and the dry
weight of the core sample.
(6) Run a multi-rate flow test to measure the resistivity and the permeabilities.
182
(7) In order to build the capillary equilibrium in the core sample and displace the free water
in the capillary cell, inject the non-wetting phase (air/kerosene) into the system at a
pressure slightly higher than the ambient pressure for several hours, until no water
production is observed at the outlet.
(8) The multi-step drainage starts from the above system. At the very beginning of a
drainage step, increase the injection pressure to the design value, and record the water
production at the outlet of the system with the digital balance every 6 seconds until no
more wetting production is observed within half an hour.
(9) Increase the injection pressure step by step, and record the water production history at
each step every 6 seconds.
(10) For the experiments using gas/water system, take the core sample out of the core
holder after the last-step. Measure the weight of core sample in order to check the residual
water saturation for mass balance.
6.6.2 Calculation of the Basic Parameters
Before all the experiments, the dimensions of all core samples were measured. Following
that, the porosity of each core sample was measured using the same mass difference
methods used for the sandpack. The measured length, diameters and the porosity are listed
in Table 6.8. The porosities measured are all very close to 0.2.
183
Before any drainage experiments, the multi-rate flow test was run to measure the
permeability and the resistance of the system. As listed in Table 6.9, the permeability of
the core sample varies from 72 mD to 103 mD. The resistance of the membrane is 5-6
times higher than that of the core sample itself, resulting in high uncertainty for the
measurement of the relative permeability curve at high water saturation. However, the
normalized parameters can be calculated using Eq. (4-32) and Eq. (4-49). Therefore, as
long as the measured relative permeabilities are lower than 0.1, there is no need to calibrate
the regressed results using the analytical model. However, the resistance of the membrane
and the pipeline has been considered when calculating the relative permeabilities to water
using the automatic history match method.
Table 6.8: Basic parameters of the cores samples
Gas/Water Oil/Water Oil/Water Gas/Oil/Water
Diameter, cm 4.570 4.600 4.600 4.650
Thickness, cm 0.770 0.800 0.800 0.800
Bulk Volume, cm3 12.630 13.295 13.295 13.585
Area, cm2 16.395 16.611 16.611 16.974
Pore Volume, cm3 2.470 2.632 2.632 2.630
Porosity 0.196 0.198 0.198 0.194
184
Table 6.9: Basic resistance and permeability measured by resistance tests
Resistance/Permeability Gas/Water Oil/Water Oil/Water Gas/Oil/Water
Pipeline, atm/(cm3/s) 0.074 0.079 0.083 0.079
Membrane, atm/(cm3/s) 2.751 3.681 3.800 2.600
Resistance, atm/(cm3/s) 2.825 3.761 3.883 2.679
Core Sample, atm/(cm3/s) 0.424 0.568 0.577 0.650
Permeability, Darcy 0.101 0.085 0.083 0.072
6.6.3 Gas/Water System
One set of the multi-step drainage experiments was run with a gas/water system using core
sample. As listed in Table 6.8, the porosity of the core sample was measured as 0.196; the
thickness was 0.77 cm and the diameter was 4.91 cm; the viscosity of water was 1.0 cp at
lab conditions and the viscosity of kerosene was measured as 0.80 cp. From the data listed
in Table 6.9, the absolute permeability of the core sample was calculated as 101 mD and
the hydraulic conductivity of the pipeline and the membrane was calculated as 32.7 mD/cm.
A four-step drainage experiment was carried out and the water production history was
recorded and plotted as circles in Figure 6.14.
185
Figure 6.14: Water production history at a three step gas/water system.
From the last two steps of Figure 6.14, there is continuous gas production showing up, as a
result of the air diffusion through water-saturated membrane. If assuming that under certain
pressure difference, the air diffusion rate is a constant, the slope of the linear portion could
be used to calculate the gas diffusion rate. The calculated gas diffusion rates at pressure
differences of each step were plotted in Figure 6.15. As can be seen, the gas diffusion rate
is linearly dependent on the pressure difference. The regressed linear equation was then
used to calculate the gas diffusion rate at different pressure and correct the water
production history.
0
0.2
0.4
0.6
0.8
1
1.2
1.4
0 5000 10000 15000 20000 25000 30000 35000 40000
Cu
mu
lati
ve V
olu
me, cm
3
Time, s
186
Figure 6.15: Gas diffusion rate measured in a multi-step drainage experiment with
gas/water.
After calibration considering the gas diffusion, the production data resulting exclusively
from the drainage process was plotted as circles in Figure 6.16. Two sets of automatic
history matching were run using the methods developed in the above section in terms of
two different relative permeabilities function representations, respectively: Corey‟s
equations and the monotone cubic spline function. The water recovery history data and the
matched value obtained from these two history matching runs are all shown in Figure 6.16.
0
0.000005
0.00001
0.000015
0.00002
0.000025
0 0.2 0.4 0.6 0.8 1 1.2
Dif
fusio
n R
ate
, cm
3/s
Pressure, atm
Diffusion Rate(cm3/s)
187
It can be seen that both Corey‟s equation and the monotone cubic spline function obtained
reasonable matching results. The analytical method was also employed to estimate the
relative permeabilities to water from the results of the drainage process as shown in Figure
6.17. Finally, the calculated permeabilities using analytical method are plotted in Figure
6.30 together with the permeabilities measured with the other fluid systems.
Figure 6.16: Water production history of the gas/water system and the results of history
matching.
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0 5000 10000 15000 20000 25000 30000 35000 40000
Cu
mu
lati
ve P
rod
ucti
on
, cm
3
Time, s
Experiment
HM Corey's Equations
HM Monocubic
188
Figure 6.17: Calculations of the relative permeabilities to water using the analytical method
for the gas/water system.
y = 2.1415E-04x + 2.8238E-01R² = 9.9866E-01
0
0.5
1
1.5
2
2.5
3
3.5
0 2000 4000 6000 8000 10000 12000 14000
-Ln
(Sw
D)
Td
Step 1
y = 5.1209E-05x + 2.3097E-01R² = 9.9987E-01
0
0.5
1
1.5
2
2.5
3
3.5
0 10000 20000 30000 40000 50000 60000 70000
-Ln
(Sw
D)
Td
Step 2
y = 2.3294E-05x - 1.1075E+00R² = 9.9805E-01
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
0 50000 100000 150000 200000 250000
-Ln
(Sw
D)
Td
Step 3
189
6.6.4 Oil/Water System
Two sets of the multi-step drainage experiments were carried out using water/oil systems
with the same core sample. As listed in Table 6.8, the porosity of the core sample was
measured as 0.198; the thickness was 0.80 cm and the diameter was 4.6 cm; the viscosity
of water is 1.0 cp at lab conditions and the viscosity of kerosene was measured as 0.80 cp.
From the data listed in Table 6.9, the permeability of the core sample was calculated as 83
mD and 85 mD from two different runs. A four-step and a five-step drainage experiment
were carried out and the water production history was recorded and plotted as circles in
Figure 6.18 and Figure 6.19, respectively.
Based on the first set of experiments, two history matching runs were carried out using
GTGA with two different relative permeability function representations, respectively:
Corey‟s equations and the monotone cubic spline function. The water production data from
the experiment, as well as the matched values calculated from these two history matching
runs, are all plotted in Figure 6.20 and Figure 6.21. It can be seen that both Corey‟s
equation and the monotone cubic spline function obtained reasonable well matching results.
However, as plotted in Figure 6.22, the calculated relative permeabilities to kerosene (the
non-wetting phase) using the monotone cubic spline function and Corey‟s Equation are
significantly different from each other, which means any curve between these two curves
would get similar matching results. The conclusion drawn in the above chapters, that
permeabilities for the non-wetting phase are non-unique, or at least of high uncertainty.
When the water saturation is less than 0.4, the relative permeabilities of water are almost
the same using these two function representations. It is confirmed that considering
190
laboratory measurement uncertainty, the relative permeabilities of the wetting phase
measured in a multi-step drainage experiment at low saturation is reliable and unique.
Figure 6.18: Cumulative water production history in a four-step drainage process using
oil/water (1) system.
0
0.2
0.4
0.6
0.8
1
1.2
1.4
0 5000 10000 15000 20000 25000 30000
Cu
mu
lati
ve V
olu
me, cm
3
Time, s
Cum. Vol.
191
Figure 6.19: Cumulative water production history in a five-step drainage process using
oil/water system.
0
0.2
0.4
0.6
0.8
1
1.2
0 5000 10000 15000 20000 25000 30000
Cu
mu
lati
ve V
olu
me, cm
3
Time, s
192
Figure 6.20: Water production history and the results of history matching.
0
0.2
0.4
0.6
0.8
1
1.2
0 5000 10000 15000 20000 25000 30000
Cu
mu
lati
ve P
rod
ucti
on
, cm
3
Time, s
HM Monocubic
HM Corey's Equations
Experiment
193
Figure 6.21: Water production history and the results of history matching.
0
0.2
0.4
0.6
0.8
1
1.2
0 5000 10000 15000 20000 25000
Cu
mu
lati
ve P
rod
ucti
on
, cm
3
Time, s
HM Monocubic
HM Corey's Equations
Experiment
194
Figure 6.22: Comparison of history matched results using Corey‟s equation and monotone
cublic spline functions.
The analytical method was also used to estimate the relative permeabilities for these two
set of experiments. The results are shown in Figure 6.23 and Figure 6.24, respectively. All
steps in both experiments show a perfectly straight line section, given enough time. Finally,
the calculated permeabilities for these two sets of experiments using the analytical method
are plotted in Figure 6.30 together with the permeabilities measured from other fluid
systems.
195
Figure 6.23: The calculations of the relative permeabilities to water using the analytical
method for the water/oil (1) system.
y = 6.2261E-04x + 2.7266E-01R² = 9.9918E-01
0
0.5
1
1.5
2
2.5
3
3.5
0 1000 2000 3000 4000 5000
-Ln
(Sw
D)
Td
Step 1
y = 1.0740E-04x + 1.1649E-01R² = 9.9932E-01
0
0.5
1
1.5
2
2.5
3
3.5
0 5000 10000 15000 20000 25000 30000
-Ln
(Sw
D)
Td
Step 2
y = 3.5721E-05x + 2.6436E-01R² = 9.9879E-01
0
0.5
1
1.5
2
2.5
0 10000 20000 30000 40000 50000 60000
-Ln
(Sw
D)
Td
Step 3
y = 1.3400E-05x + 2.6737E-01R² = 9.9633E-01
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
1.8
2
0 20000 40000 60000 80000 100000 120000
-Ln
(Sw
D)
Td
Step 4
196
Figure 6.24: Calculations of the relative permeabilities to water using the analytical
method for the water/oil (2) system.
y = 1.7079E-03x + 8.9756E-02R² = 9.9768E-01
0
0.5
1
1.5
2
2.5
3
3.5
0 500 1000 1500 2000
-Ln
(Sw
D)
Td
Step 1
y = 4.4212E-04x + 4.6615E-01R² = 9.9841E-01
0
0.5
1
1.5
2
2.5
3
0 1000 2000 3000 4000 5000 6000
-Ln
(Sw
D)
Td
Step 2
y = 8.7228E-05x + 6.5303E-01R² = 9.9145E-01
0
0.5
1
1.5
2
2.5
3
3.5
0 5000 10000 15000 20000 25000 30000
-Ln
(Sw
D)
Td
Step 3
y = 6.4762E-05x + 1.9691E-01R² = 9.9976E-01
0
0.5
1
1.5
2
2.5
3
0 10000 20000 30000 40000
-Ln
(Sw
D)
Td
Step 4
y = 2.0363E-05x + 1.9459E-01R² = 9.9979E-01
0
0.5
1
1.5
2
2.5
0 20000 40000 60000 80000 100000
-Ln
(Sw
D)
Td
Step 5
197
6.6.5 Gas/Oil/Water System
Multi-step drainage experiments using three-phase systems were carried out with
gas/oil/water system. Air was used as the gas phase, kerosene was used as the oil phase and
water was used as the water phase. The core sample was first saturated with water, and
then the system was equipped with an oil-wet membrane saturated by oil, which only
allows oil to flow through at the experimental conditions. The core holder was positioned
upside down, and then kerosene was injected to displace water. The produced water was
carefully collected and used to calculate the remaining water in the sample. The core
holder was then positioned right side up and a multi-step drainage process similar to that
employed for the gas/water system was carried out on an gas/oil/water system.
One set of multi-step drainage experiments was carried out for validation with an
gas/oil/water system. As listed in Table 6.8, the porosity of the core sample was measured
as 0.194; the thickness was 0.80 cm and the diameter was 4.65 cm; the viscosity of water is
1.0 cp at lab conditions and the viscosity of kerosene was measured as 0.80 cp. From the
data listed in Table 6.9, the absolute permeability of the core sample was measured as 72
mD and the hydraulic conductivity of the pipeline and the membrane was calculated as
30.6 mD/cm. A four-step drainage experiment was carried out and the kerosene production
history was recorded and plotted as circles in Figure 6.25.
198
Figure 6.25: Cumulative kerosene production history in a four-step drainage process.
From the last two steps of Figure 6.25, as has been observed in the gas/water system
drainage process, there are significant gas diffusion effects, due to the air diffusion through
the kerosene-saturated membrane. As was done for the gas/water system, the linear portion
was considered as a diffusion effect. The gas diffusion rates at different pressure
differences were plotted at Figure 6.26. The gas diffusion rate is linearly dependent on the
pressure difference. The regressed linear equation was then used to correct the liquid
production history. The corrected production data due to the drainage process was plotted
as circles in Figure 6.27.
0
0.2
0.4
0.6
0.8
1
1.2
1.4
1.6
0 2000 4000 6000 8000 10000 12000 14000 16000 18000 20000
Cu
mu
lati
ve V
olu
me, cm
3
Time, s
199
Figure 6.26: Diffusion of air through the membrane in kerosene.
Automatic history matching, using GTGA, was used to calculate the relative permeabilities.
Mono cubic spine function was used to represent the relative permeabilities in the
automatic history matching to estimate the relative permeabilities, which is shown as the
purple line in Figure 6.27. Figure 6.28 shows the regression results using the analytical
methods for each step. All four steps show a linear relationship between given enough time.
Finally, the calculated permeabilities using the analytical method are plotted in Figure 6.30
together with the permeabilities measured from other fluid systems.
0
0.000005
0.00001
0.000015
0.00002
0.000025
0.00003
0.000035
0.00004
0.000045
0.00005
0 0.2 0.4 0.6 0.8 1 1.2 1.4
Dif
fusio
n R
ate
, cm
3/s
Pressure, atm
Diffusion Rate(cc/s)
200
Figure 6.27: Kerosene production history and the results of history matching
201
Figure 6.28: The calculations of the relative permeabilities to water using the analytical
method for the gas/water/oil system.
6.6.6 Results and Discussions
The designed multi-step drainage experiments can be run with both sandpacks and core
samples with different fluids systems, including water/oil, gas/water and gas/water/oil.
The relative permeabilities were calculated using both the automatic history matching
method and analytical model developed in this work.
y = 6.5554E-03x + 3.1678E-01R² = 9.9802E-01
0
0.5
1
1.5
2
2.5
3
3.5
0 100 200 300 400 500
-Ln
(Sw
D)
Td
Step 1
y = 8.2013E-04x + 6.5837E-01R² = 9.9720E-01
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
0 1000 2000 3000 4000 5000
-Ln
(Sw
D)
Td
Step 2
y = 1.9657E-04x + 4.1558E-01R² = 9.9827E-01
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
0 5000 10000 15000 20000
-Ln
(Sw
D)
Td
Step 3
y = 3.4832E-05x + 4.4808E-01R² = 9.9669E-01
0
0.5
1
1.5
2
2.5
3
3.5
4
0 20000 40000 60000 80000 100000
-Ln
(Sw
D)
Td
Step 4
202
The measured capillary curves are plotted together for different systems as shown in Figure
6.29. Although, the interfacial tension and contact angle might be different for different
systems, generally the two-phases-systems have very similar capillary pressure curves,
except the entrance pressure is different. The three-phase-system has slightly higher
residual liquids saturation because the residual liquid consists of both residual water and
residual oil. It is expected that with spreading oil, the residual liquid saturation should be
much lower than measured in the experiment. As shown in Figure 6.29, the slope of the
low saturation range for the core sample is not as steep as that of the sandpack, because the
core sample has a more uniform pore size distribution than the sandpack. Due to a higher
contact of the grains in the core sample, the residual water saturation is slightly lower than
that of the sandpack.
All the relative permeabilities measured in the system were plotted together as shown in
Figure 6.30. It can be seen that the relationship between the logarithm of the relative
permeabilities and the wetting phase saturation is generally linear. For all systems using
water as the wetting phase, the slope of the curve is very similar. This indicates that the
relative permeability of the wetting phase only depends on the water phase itself. The slope
of the water/oil (2) system is slightly offset from the gas/water system and the water/oil (1)
system, this could be due to the uncertainty of the measurement. For the gas/oil/water
system, the slope of the curve is steeper, which indicates a faster drop of the relative
permeabilities and a faster drainage of the middle phase, which is oil. As can be seen from
Figure 6.30, the extrapolation of the straight line indicates the residual water saturation in
the core sample can potentially drops to a level of 5% or even lower.
203
Figure 6.29: Comparisons of the capillary pressure curves measured for different fluid
systems.
0.000
0.200
0.400
0.600
0.800
1.000
1.200
1.400
1.600
1.800
0.000 0.200 0.400 0.600 0.800 1.000
Cap
illa
ry P
ressu
re,
atm
Wetting Phase Saturation
Gas/Water
Water/Oil (1)
Water/Oil (2)
Gas/Oil/Water
204
Figure 6.30: Comparisons of the relative permeabilities calculated from numerical
simulation for different systems.
Table 6.10 to Table 6.13, and Figure 6.31 show the comparison of the relative
permeabilities of the wetting phase calculated from automatic history matching using
simulation and the analytical method developed in this work. For different experiments
using a sandpack or core samples in different fluid systems, the analytical method
developed in this work has good consistency with the results of numerical simulation. The
analytical method developed in this work can be used directly to calculate the
1.000E-06
1.000E-05
1.000E-04
1.000E-03
1.000E-02
1.000E-01
0.000 0.100 0.200 0.300 0.400 0.500 0.600 0.700 0.800
Rela
tive P
erm
eab
ilit
y
Wetting Phase Saturation
Gas/Water
Water/Oil (1)
Water/Oil (2)
Gas/Oil/Water
205
permeabilities with linear regression, which allows more flexibility and reliability to
measure the permeabilities at low and ultra-low saturations.
Table 6.10: The permeabilities and capillary pressures calculated by the numerical
simulation and the analytical model – Gas/Water System.
Gas/Water
Sw Krnw Krw Pc Analytical
0.150 - 2.330×10-5
1.000 2.329×10-5
0.214 - 4.355×10-5
0.500 5.175×10-5
0.295 - 2.052×10-4
0.300 2.141×10-4
0.442 - 7.435×10-4
0.200 -
1.000 - - 0.150 -
206
Table 6.11: The permeabilities and capillary pressures calculated by the numerical
simulation and the analytical model – Oil/Water System (1).
Oil/Water (1)
Sw Krw Pc Analytical
0.123 1.956×10-5
1.500 1.340×10-5
0.188 5.602×10-5
0.700 3.572×10-5
0.249 1.345×10-4
0.350 1.074×10-4
0.340 4.692×10-4
0.202 6.226×10-4
0.564 1.205×10-2
0.102 -
1.000 - 0.082 -
207
Table 6.12: The permeabilities and capillary pressures calculated by the numerical
simulation and the analytical model – Oil/Water System (2).
Oil/Water (2)
Sw Krw Pc Analytical
0.118 1.670×10-5
1.600 2.084×10-5
0.172 5.402×10-5
1.000 6.476×10-5
0.217 1.027×10-4
0.600 8.723×10-5
0.297 3.967×10-4
0.300 4.421×10-4
0.415 2.315×10-3
0.150 1.708×10-3
0.540 3.464×10-3
0.100 -
1.000 - 0.080 -
208
Table 6.13: The permeabilities and capillary pressures calculated by the numerical
simulation and the analytical model – Gas/Oil/Water System.
Gas/Oil/Water
Sl So Krw Pc Analytical
0.245 0.112 2.900×10-5
1.200 4.517×10-5
0.293 0.168 1.750×10-4
0.500 1.894×10-4
0.360 0.247 8.200×10-4
0.250 7.844×10-4
0.440 0.341 4.580×10-3
0.150 6.944×10-3
0.680 0.624 2.571×10-2
0.090 -
1.000 1.000 - 0.060 -
209
The minimum value of the estimated permeabilities using the current design apparatus can
be at an order of 10-5
.With a specially designed more accurate apparatus, this method can
measure the permeabilities to a magnitude of 10-6
. Theoretically, as long as the capillary
pressure can be measured, the relative permeability can be calculated.
Figure 6.31: Comparisons of the relative permeabilities of the wetting phase obtained from
simulation and analytical equation.
0.000001
0.00001
0.0001
0.001
0.01
0.1
0.000001 0.00001 0.0001 0.001 0.01 0.1
Krw
, A
naly
tical
Krw, Simulation
Water/Oil (1) Water/Oil (2)
Gas/Oil/Water Gas/Water
210
6.7 Summary
6.7.1 Sandpack and Core Sample
The multi-step drainage experiment works suceeded both a sandpack and a core sample.
Generally, all multi-step drainage experiments using core samples have much smoother
production curves than those using sandpacks. The main reason for this is that the
sandpack has higher heterogeneity and longer length. The horizontally positioned sandpack
cannot generate a uniform saturation profile along the sample. Meanwhile, the gap between
the core holder and the sandpack leads to a highly permeable channel. This does not affect
the calculation of the relative permeabilities to the wetting phase at a low saturation range.
However, because the sandpack is made up of highly uniform sands, the capillary curve is
much steeper than that of the core sample over the low saturation range. The steep slope
makes it difficult to reliably measure the saturation changes in the low range.
6.7.2 Simulation and Analytical
Reverse methods using automatic history matching and the analytical method developed in
this work were successfully used for estimation of the relative permeabilities of the low
mobile phase and had consistent results. Reverse methods using automatic history
matching can be used for uncertainty analysis using the properties of the Guo Tao genetic
algorithm, whereas the closed form analytical method is more easily applied in the
estimation of the relative permeabilities of the wetting phase directly. Linear regression can
significantly reduce uncertainty caused by the measurement.
211
6.7.3 Limitations
Due to gas diffusion, as can be seen from the experiment, without further modification, the
designed experiment cannot be directly used to measure the permeabilities of a CO2/oil
system. Due to the high solubility of CO2 in oil and high diffusivity of CO2, the volume
produced due to gas diffusion will be hundreds of times higher than the volume produced
by the drainage process. In order to improve that, new methods should either be used to
eliminate the gas diffusion or accurately measure the gas volume due to diffusion.
212
CHAPTER 7: CONCLUSIONS AND RECOMMENDATIONS
7.1 Summary of Conclusions
In this work, the multi-step drainage process was extensively modeled using numerical
simulation, analytical modeling, and pore scale modeling using an interactive tube-bundle
model. Two methods were developed to estimate the relative permeability of water. A
Guo Tao genetic algorithm was used to estimate the relative permeabilities by automatic
history matching. An analytical model was also developed to directly estimate the relative
permeabilities of the wetting phase. Both numerical simulation and experimental validation
indicates that the results of these two methods agree with each other. The new development
tube bundle model was successfully applied to qualitatively model the drainage process,
the saturation profile and production history of a multi-step drainage process was
successfully modeled. The major conclusions from this work are listed below:
(1) A program was developed using Visual C++ 6.0 to model a multi-step drainage process.
The program was used for the further analysis, history matching and analytical model
benchmark. Sensitivity analysis and benchmark using commercial software indicate that:
The program developed with the scope of this work is suffiently accurate to
represent the multi-step drainage process.
213
Implicitly processing of the membrane, significantly increased calculation speed
and the accuracy.
The improved IMPES method is good enough to solve the equation numerically
within one minute and an acceptable numerical error.
(2) GTGA is successfully applied to estimate the relative permeabilities and its uncertainty
by automatic history matching the production history in a multi-step drainage process. The
study indicates that:
GTGA is much more effective than conventional GA in searching for the global
optimum value. GTGA is also can be used for the uncertainty analysis.
Considering the uncertainty of real lab experiments, it is considered to be
impossible to obtain reliable results for the relative permeabilities of the highly mobile
phase.
Using GTGA and history matching of the wetting phase production history during a
multi-step drainage process, the relative permeabilities of the non-wetting phase and the
wetting phase are only simultaneously retrievable when (1) the mobilities of the non-
wetting phase and the wetting phase are comparable and (2) the experimental uncertainty
and precision is controlled within certain level.
The relative permeability of the non-wetting phase can be taken as arbitrary number
and the unique relative permeabilities of the wetting phase can be obtained, when (1) the
wetting phase saturation of the system is low or (2) the viscosity ratio of the non-wetting to
the wetting phase is small, such as an gas/water system.
214
(3) An analytical model to describe the wetting phase recovery history in the multi-step
drainage process was developed in this study. A closed form equation was developed to
directly estimate the wetting phase relative permeabilities. A dimensionless parameter was
created to determine if the resistance of the membrane is negligible. If it is not, a
complementary model is developed to modify the wetting phase permeabilities and get
better resultsThe development and comparisons of the analytical model and numerical
simulation indicate that:
The resistance of the non-wetting phase is negligible when estimating the relative
permeability of the wetting phase at low wetting phase saturation;
The capillary pressure gradient around the ending saturation should be used, and
the estimated relative permeability of the wetting phase is the permeability at the ending
saturation;
Numerical hypothetical tests and laboratory experimental data verification
demonstrated that this method is effective for the direct estimation of the wetting phase
relative permeability.
(4) The inactive-tube-bundle model was used to model the multi-step drainage process as
well. The modeling process indicates that:
All phenomena in this process, such as “reverse flooding”, “bidirectional flooding”,
the relationship between wDSln and time t , and the multi-step drainage process can be
successfully modeled.
215
It is proved that the interacting tube-bundle model more accurately represents the
pore structure and fluid flow dynamics in a porous medium.
By incorporating the serial-type model and the triangle tubes to simulate water
trapping mechanisms, this model can potentially history match the multi-step drainage
experiments and build the relation between the capillary pressures and the relative
permeability curves.
(5) The laboratory experiments were used for validate the models and methods developed
in above sections:
The multi-step drainage experiment succeeded for both sandpacks and core samples.
It also succeeded for gas/water, oil/water and gas/oil/water system.
Both reverse method using automatic history matching and analytical method
developed in this work were successfully used for estimation of the relative permeabilities
of the low mobile phase and obtained very consistent results.
The reverse method can be used for uncertainty analysis using the properties of the
Guo Tao genetic algorithm. However, the closed form analytical method is much more
easy to use for direct estimation of the relative permeabilities of the wetting phase. Linear
regression can significantly reduce uncertainty caused by the measurement.
Due to the gas diffusivity, as can be seen from the experiment, without further
modification, the designed experiment cannot be directly used to measure the
permeabilities of CO2/Oil system.
216
7.2 Recommendations
(1) Core sample heterogeneity should be considered in the future study.
(2) On the experimental design side, a special apparatus design should be carried out to
properly handle the diffused gas volume. Multistep drainage experiments at high
pressure/temperature should be carried out with a more safely designed system with more
accurate collection of the produced liquid.
(3) With more detailed considerations of a real core sample, it is recommended to test the
interactive tube-bundle model for the estimatation of the relative permeabilities by history
matching of a multi-step drainage process.
217
REFERENCE
Akin S. and Demiral B., Genetic algorithm for estimating multiphase flow functions
from unsteady-state displacement experiments, Computers and Geosciences, vol.
24, no. 3, pp. 251-258, 1998.
Aronofsky, J. S., Masse, L. and Natanson, S. G., A model for the mechanism of oil
recovery from the porous matrix due to wetting phase invasion in fractured
reservoirs, Trans. AIME., vol. 213, pp. 17-19, 1958.
Ayub M. and Bentsen R.G., An apparatus for simultaneous measurement of relative
permeability and dynamic capillary pressure, Petroleum Science and Technology,
vol .19(9&10), pp. 1129–1154, 2001.
Bachu S. and Shaw J., Evaluation of the CO2 sequestration capacity in Alberta‟s oil and
gas reservoirs at depletion and the effect of underlying aquifers, Journal of
Canadian Petroleum Technology, vol. 42 (9), pp. 51–61, 2003.
Bachu S. and Shaw J., Screening, evaluation and ranking of oil reservoirs suitable for
CO2-flood EOR and carbon dioxide sequestration. Journal of Canadian Petroleum
Technology, vol. 41 (9), pp. 51–58, 2002.
Bachu S. and Steward S., Geological sequestration of anthropogenic carbon dioxide in
the Western Canada Sedimentary Basin: suitability analysis, Journal of Canadian
Petroleum Technology, vol. 41(2), pp. 32-40, 2002.
Bachu S., Sequestration of CO2 in geological media in response of climate change: road
218
map for site selection using the transform of the geological space into the CO2
phase space, Energy Conversion and Management, Vol. 43, pp. 87–102, 2002.
Bangla V., Yau F. and Hendricks. G., Reservoir performance of a gravity-stables,
vertical CO2 miscible flood: Wolfcamp Reef reservoir, Wellman Unit, SPE
Reservoir Engineering, vol. 30, pp. 261–269, 1993.
Bartley, J. T. and Ruth, D. W., Relative permeability analysis of tube-bundle models,
Transport in Porous Medium, vol. 36, pp. 161–187, 1999.
Bartley, J. T. and Ruth, D. W., Relative permeability analysis of tube-bundle models,
including capillary pressure. Transport in Porous Medium, vol. 45, pp. 447–480,
2001.
Bird, B., Stewart, W., and Lightfoot, E., Transport phenomena, New York: John Wiley
& Sons, Inc., 1960.
Brock, W. R and Bryan, L. A., Summary of results of CO2 EOR field test, proceedings
of the Low Permeability Reservoirs Symposium held in Denver, Colorado, USA,
March 6-8, 1989.
Bruce, W. A. and Welge H. J., Restored-state method for determination of oil in place
and connate wetting phase, Oil and Gas Journal, vol. 46, pp. 223-238, 1947.
Bryant S. and Johnson A., Wetting phase connectivity and irreducible saturation in
simple granular media, Journal of Colloid and Interface Science, vol. 263, pp. 572–
579, 2003.
Chatzis, I., Kantzas, A., and Dullien, F. A. L., The investigation of gravity-assisted inert
219
gas injection using micromodels, long Berea sandstone cores, and computer-
assisted tomography, paper presented at the 63rd Annual Technical Conference and
Exhibition of the Society of Petroleum Engineers held in Houston, TX, USA,
October 2–5, 1988.
Chen Z., Huan G. and Li B., An improved IMPES method for two-phase flow in porous
media, Transport in Porous Media, vol. 54, pp. 361-376, 2004.
Chen, J. Y., Hopmans, J. W. and Grismer, M. E. Parameter estimation of two-fluid
capillary pressure–saturation and permeability functions. Advanced Water
Resources, vol. 22(5), pp. 479-493, 1999.
Corey A. T., and Rethjens C. H., Effect of stratification on relative permeability,
Transactions of AIME, vol. 207, pp. 358-360, 1956.
Corey, A. T. The interrelation between gas and oil relative permeabilities. Prod.
Monthly, vol. 19 (1), pp. 38-41, 1954.
Dahle, H. K., Celia, M. A., and Hassanizadeh, S. M. Bundle-of-tubes model for
calculating dynamic effects in the capillary-pressure–saturation relationship,
Transport in Porous Medium, vol. 58, pp. 5-22, 2005.
Dane J. H., Hofstee C. and Corey A. T., Simultaneous measurement of capillary
pressure, saturation, and effective permeability of immiscible liquids in porous
Media, Water Resources Research, vol. 34(12), pp. 3687-3692, 1998.
Darcy, H. Les Fontaines Publiques de la Ville de Dijon, Dalmont, Paris, pp. 647, 1856.
Dong M., Huang S. and Srivastava R., Coreflood studies of tertiary CO2 flood in
220
naturally fractured midale formation in Southeast Saskatchewan, Journal of
Canadian Petroleum Technology, Vol. 41(2), pp. 41-45, 2002.
Dong, M., A study of film transport in capillaries with an angular cross-section.
Chemical Engineering, University of Waterloo, PhD thesis, 1995.
Dong, M., Dullien, F. A. L., and Chatzis, Imbibition of oil in film form over water
present in edges of capillaries with an angular cross-section, Journal of Colloid and
Interface Science, vol. 172, pp. 21-36, 1994.
Dong, M., Dullien, F.A.L., Dai, L., and Li, D., Immiscible displacement in the
interacting capillary bundle model. Part II. Applications of model and comparison
of interacting and non-interacting capillary bundle models, Transport in Porous
Media, vol. 63, pp. 289-304, 2006.
Dong, M., Dullien, F.A.L., Dai, L., and Li, D., Immiscible displacement in the
interacting capillary bundle model, Part I. Development of interacting capillary
bundle model, Transport in Porous Media, vol. 59, pp. 1–18, 2005.
Dong, M., Dullien, F.A.L., Zhou, J., Characterization of waterflood saturation profile
histories by the „complete‟ capillary number. Transport in Porous Media, vol. 31,
pp. 213–237, 1998.
Dong, M., Wang, S., Wang J., Li, Z., Final report of enhancing the capacity of CO2
storage by removing the remaining water in depleted oil reservoirs for PRTC and
EnCana, April, 2008.
Dullien, F. A. L., Lai, F. S. Y., and Macdonald, I. F., Hydraulic continuity of residual
wetting phase in porous Media, Journal of Colloid Interface Science, vol. 109, pp.
221
201-218, 1986.
Dullien, F. A. L., Zarcone, C., and Macdonald, I. F. Collins A., Bochard D. E., The
effects of surface roughness on the capillary pressure curves and the heights of
capillary rise in glass bead packs, Journal of Colloid Interface Science, vol. 127, pp.
362-372, 1989.
Dullien, F.A.L., Porous media: Fluid Transport and pore structure, Second Ed.,
Academic Press, San Diego, 1992.
Eching, S. O., Hopmans, J. W., Optimization of hydraulic functions from transient
outflow and soil wetting phase pressure data. Soil Science Society of America
Journal, vol. 57, pp. 1167-1175, 1993.
Eching, S. O., Hopmans, J. W., Wendroth, O., Unsaturated hydraulic permeability from
transient multi-step outflow and soil wetting phase pressure data. Soil Science
Society of America Journal, vol. 58, pp. 687–695, 1994.
Esam Dana, S., Experimental study of two-phase flow in three sandstones: II. Capillary
pressure curve measurement and relative permeability pore space capillary models,
International Journal of Multiphase Flow, vol. 28, pp. 1965–1981, 2002b.
Esam Dana, S., Experimental study of two-phase flow in three sandstones: I. Measuring
relative permeabilities during two-Phase steady-state experiments, International
Journal of Multiphase Flow, vol. 28, pp. 1719-1736, 2002a.
Farouq Ali, S.M. and Roja, G., Current technology of heavy oil recovery by immiscible
carbon dioxide and waterflooding, paper presented at the Third UNITAR/UNDP
International Conference on Heavy Crude and Tar Sands, Long Beach, Canada,
222
July 22 – 31, 1985.
Fritsch, F. N., Carlson, R. E., Monotone piecewise cubic interpolation, SIAM J.
Numerical Analysis, vol. 17, pp. 238-246. 1980.
Gottfried, B. S., Guilinger, W. H. and Snyder, R. W., Numerical solutions of the
equations for one-dimensional multi-phase flow in porous media, SPE Journal, vol.
6(1), pp. 62-72, 1966.
Green, Don W. and Willhite, G. Paul, Enhanced oil recovery, Henry L. Doherty
Memorial Fund of AIME, Society of Petroleum Engineers (U.S.), 1998.
Grunde R. B., Competition of gravity, capillary and viscous forces during drainage in a
two-dimensional porous medium, a pore scale study, energy, vol. 30, pp. 861–872,
2004.
Guo T., Kang L., and Li Y., A new algorithm for solving function optimization problems
with inequality constrains, Journal of Wuhan University, Natural Science Edition.,
vol. 45, no. 5b, pp.771-775, 1999.
Gupta D.V.S., Unconventional fracturing fluids for tight gas reservoirs, preceding of the
2009 SPE Hydraulic Fracturing Technology Conference, held in Woodlands,
Texas, USA. January 19–21, 2009.
Handy, L. L. Determination of effective capillary pressures for porous media from
imbibition data. Trans. AIME, vol. 219, pp. 75-82. 1960.
Hutchinson C. A., JR. and Braun P. H., Phase relations of miscible displacement in oil
recovery, AICHE Journal, vol. 7(64), pp. missing, 1961.
223
Jahangiri H. R. and Zhang D., Optimization of carbon dioxide sequestration and
enhanced oil recovery in oil reservoir, in Proceeding of SPE Western North
America Regional Meeting, Anaheim, California, USA, May 2010.
Jennings, J. W., A method for measuring capillary pressure and relative permeabilities
based upon a transient analysis of a rapid restored-state experiment, PhD
dissertation, Texas A&M University, 1983.
Jennings, J. W., McGregor, D. S., Morse, R. A., Simultaneous determination of capillary
pressure and relative permeability by automatic history matching. SPE Formation
Evaluation, vol. 3(2), pp. 322-328, 1988.
Johnson E. F., Bossler D. P., and Naumann V. O., Calculation of relative permeability
from displacement experiments, transactions of AIME, vol. 216, pp. 370-372, 1959.
Kalaydjian, F.J.M., Performance and analysis of three-phase capillary pressure curves
for drainage and imbibition in porous media, paper presented at SPE the Annual
Technical Conference and Exhibition, Washington, D.C., U.S., October 4-7, 1992.
Kamal, N. Jha., A laboratory study of heavy oil recovery with carbon dioxide, Journal of
Canadian Petroleum Technology, vol. 25(2), pp. 54-63, 1986.
Katz D. L. and Lundy C. L., Absence of connate water in Michigan reef gas reservoirs,
an analysis, AAPG Bulletin, vol. 66(1), pp. 91-, 1982.
Kerig P. D., and Watson A. T., A New algorithm for estimating relative permeabilities
from displacement experiments, SPE Reservoir Engineering, vol. 2, pp.103-113,
1987.
224
Kerig P. D., Watson A. T., Relative-permeability estimation from displacement
experiments: an error analysis, SPE Reservoir Engineering, vol. 1, no. 2,1986.
Kon Wyatt, Malcolm J. Pitts, and Harry Surkalo, Mature waterfloods renew oil
production by alkaline-surfactant-polymer flooding, proceeding of the SPE Eastern
Regional meeting held in Lexington, Kentucky, October 23-26, 2002.
Lefebvre Du Prey, E., Gravity and capillary effects on imbibition in porous media. SPE
Journal, vol. 18 (June), pp. 195-206. 1978.
Li, K., Horne, R. N. Generalized scaling approach for spontaneous imbibition: an
analytical model, SPE Reservoir Engineering, vol. missing, pp. 251-258. 2006.
Li, K., Horne, R. N., Characterization of spontaneous wetting phase imbibition into gas-
saturated rocks. SPE Journal, vol. 6(4), pp. 375, 2001.
Liu, Y. P., Hopmans, J. W., Grismer, M. E. and Chen J. Y. Direct estimation of air–oil
and oil–wetting phase capillary pressure and permeability relations from multi-step
outflow experiments, Journal of Contaminant Hydrology, vol. 32, pp. 223-245,
1998.
Ma, S., Morrow, N. R., Zhang, X. Generalized scaling of spontaneous imbibition data
for strongly water-wet systems, Journal of Petroleum Science and Engineering,
vol. 18 (3/4), pp. 165-178, 1997.
MacAllister, D. J., Miller, K. C., Graham, S. K. and Yang, C-T., Application of x-ray CT
scanning to the determinations of gas-water relative permeabilities, paper presented
at the Annual Technical Conference and Exhibition, New Orleans, USA, September
225
23-26, 1990.
Maini, B. B., Kokal, S. and Jha, K., Measurements and correlations of three-phase
relative permeability at elevated temperatures and pressures, paper presented at the
SPE Annual Technical Conference and Exhibition, San Antonio, Texas, USA,
October 8-11, 1989.
Marle, C.M., Multiphase flow in porous media, Gulf Publishing Co. Houston, 1981.
Mattax, C. C., Kyte, J. R., Imbibitions oil recovery from fractured water-drive reservoirs.
Trans. AIME, vol. 255(June), pp. 177-184, 1962.
Melrose, J. C., Valid capillary pressure data at low wetting-phase saturations, SPE
Reservoir Engineering, vol. 5(1), pp. 95-99, 1990.
Melrose, J.C., Dixon, J.R., and Mallinson, J.E., Comparison of different method for Pc
data at low wetting saturation region, SPE Formation Evaluation, vol. 9(3), pp. 185-
192, 1994.
Morrow N. R., Irreducible wetting-phase saturation in porous media, Chemical
Engineering Science, vol. 25, pp. 1799-1815, 1970.
Morrow, N. R., The retention of connate water in hydrocarbon reservoir, Journal of
Canadian Petroleum Technology, vol. 10, pp. 38-55, 1971.
Ning, X. and Holditch, S.A., The measurement of gas relative permeability for low
permeability cores using a pressure transient method, paper presented at the Fourth
Annual SCA Technical Conference, Dallas, Texas, USA, August 15-16, 1990.
Oak, M. J., Baker, L. E., Thomas, D. C., Three-phase relative permeability of Berea
226
sandstone, Journal of Petroleum Technology, vol. 42(8), pp. 1054-1061, 1990.
Orr F. M., Heller J. P. and Taber J. J., Carbon dioxide flooding for enhanced oil
recovery: promise and problems. Proceeding of the 73rd Annual Meeting of the
American Oil Chemists‟ Society held in Toronto, Canada, May 2-6, 1982.
Parker, J. C., Kool, J. B., Van Genuchten, M. T. Determining soil hydraulic properties
from one-step outflow experiments by parameter estimation: II. Experimental
studies. Soil Science Society of America Journal, vol. 49, pp. 1354-1359. 1985.
Patzek, T. and Kristensen, J., Shape factor correlations of hydraulic conductance in
noncircular capillaries, II. two-phase creeping flow, Journal of Colloid and
Interface Science, vol. 236, pp. 305–317, 2001.
Payatakes, A.C., Tien, C., Turian, R. M.: A new model for granular porous media: Part I.
model formulation, AIChE Journal, vol. 19, pp. 58–67, 1973.
Purcell, W. R., Capillary pressure - their measurements using mercury and the
calculation of permeability therefrom, AIME Petroleum Transaction, vol. 186, pp.
39-48, 1949.
Ransohoff, T. and Radke, C., Laminar flow of a wetting liquid along the corners of a
predominantly gas-occupied noncircular pore, Journal of Colloid and Interface
Science, vol. 121, pp. 392–401, 1988.
Reed P. and B. Minsker, Designing a competent simple genetic algorithm for search and
optimization, Water Resources Research, vol. 36, no. 12, pp. 3757-3761, 2000.
Reis, J. C. An analysis of oil expulsion mechanisms from matrix blocks during steam
227
injection in the naturally fractured reservoir, In-Situ, vol. 16(1), pp. 43-73, 1992.
Richmond P. C. and Watson A. T., Comparison of implicit and explicit methods for
interpreting displacement data, SPE Reservoir Engineering, vol. 5, no. 3, pp. 389-
392, 1990.
Ruth, D. W., Bartley, J. T.: A perfect-cross-flow model for two phase flow in porous
media. Preceding of international Symposium of the Society of Core Analysts,
Monterey, California, USA, 2002.
Scheidegger, A. E., Theoretical model of porous matter, Production Monthly, vol. 10,
pp. 17–23, 1953.
Schumacher, M. M., Enhanced recovery of residual and heavy oils, second edition, Park
Ridge, Noyes Data Corporation, 1980.
Sheldon, J. W., Zondek, B. and Cardwell, W. T., One dimensional, incompressible, non-
capillary, two phase fluid flow in porous medium, Trans. SPE of AIME, vol. 216,
pp. 290-296, 1959.
Sigmund P. M., and F. G. McCallery, An improved unsteady-state procedure for
determining the relative permeability characteristics of heterogeneous porous
media, SPE Journal, vol. 19, pp. 15-28, 1979.
Simon, R and Graue, D. J., Generalized correlations for predicting solubility swelling
and viscosity behaviour of CO2-crude oil systems, Journal of Petroleum
Technology, vol. 17(1), pp. 102-106, 1965.
Sohrabi M., Danesh A., Jamiolahmady M., Visualisation of residual oil recovery by
228
near-miscible gas and SWAG injection using high-pressure micromodels, Transport
in Porous Media, vol. 74, pp. 239–257, 2008.
Sohrabi, M. Henderson, G. D., Tehrani, D. H, and Danesh, A., Visualisation of oil
recovery by water alternating gas (WAG) injection using high pressure
micromodels: water-wet system, paper presented at the SPE Annual Technical
Conference and Exhibition, Dallas, Taxes, US, October 1-4, 2000.
Srivastava R. K., Huang S. S. and Dong M., Laboratory investigation of Weyburn CO2
miscible flooding, Journal of Canadian Petroleum Technology, vol. 39(2), pp. 41-
51, 2000.
Stone, H.L. and Garder, A. O., Jr., Analysis of gas-cap or dissolved-gas reservoirs,
Trans. SPE of AIME, vol. 222, pp. 92-104, 1961.
Sun X., and Mohanty K. K., Estimation of flow functions during drainage using genetic
algorithm, in Processing of SPE ATCE, Denver, Colorado, USA, October 2003.
Terwilliger P. L., An experimental and theoretical investigation of gravity drainage
performance, Petroleum Transaction, AIME, vol. missing, pp. 192, 1951.
Tokuda N., S. Takahashi, and M. Watanabe, Application of genetic algorithm to history
matching for core flooding, in proceeding of SPE APOGCE, Perth, Australia,
October 2004.
Ucan S., Civan F., and Evans R. D., Uniqueness and simultaneous predictability of
relative permeability and capillary pressure by discrete and continuous means,
Journal of Canadian Petroleum Technology, vol. 36, no. 4, pp. missing, 1997.
229
Unsal, E., Mason, G., Morrow, N. R., Ruth, D. W., Bubble snap-off and capillary-back
pressure during counter-current spontaneous imbibition into model pores,
Langmuir, vol. 25, pp. 3387–3395, 2009.
Unsal, E., Mason, G., Morrow, N.R., Ruth, D.W.: Co-current and counter- current
imbibition in independent tubes of non-axisymmetric geometry. Journal of Colloid
Interface Science, vol. 306, pp.105–117, 2007.
Unsal, E., Mason, G., Ruth, D.W., Morrow, N.R.: Co- and counter-current spontaneous
imbibition into groups of capillary tubes with lateral connections permitting cross-
flow. Journal Colloid Interface Science. vol. 315, pp. 200–209, 2007.
Van Dam, J. C., Stricker, J. N. M., Droogers, P. Inverse method to determine soil
hydraulic functions from multi-step outflow experiments. Soil Science Society of
America Journal, vol. 58, pp. 647-652, 1994.
Wang, J. and Dong, M., Trapping of nonwetting phase in an interacting triangular tube-
bundle model, Chemical Engineering Science, vol. 66(3), pp. 250–259, 2011.
Wang, J. Experimental and numerical study of enhanced heavy oil recovery by chemical
flooding. PhD dissertation. University of Calgary, Calgary, Canada, 2010.
Wang, J., Dullien, F.A.L., and Dong, M., Fluid Transfer between tubes in interacting
capillary bundle models, Transport in Porous Media, vol. 71(1) pp. 115–131, 2008.
Wang, S., Dong M., Yao J.: A model for direct estimation of wetting phase relative
permeabilities using a multi-step drainage process, Industrial & Engineering
Chemistry Research, DOI: 10.1021/ie300638t, 2012.
230
Wang, S., Dong, M., and Li, Z., Parameter evaluation of CO2 sequestration capacity in
depleted oil reservoirs - coreflood tests and numerical simulations, proceedings of
the 10th Canadian International Petroleum Conference held in Calgary, Canada,
June 16–18, 2009.
Wang, S., Dong, M., Modeling of Multistep Drainage Process using Extended
Interactive Tube Bundle Model, Manuscript: JPM-10202, submitted to Journal of
Porous Media.
Wang, S., Dong, M. Automatic History Matching and Uncertainty Analysis of Multistep
Drainage Process Using Multi-Parents Genetic Algorithm, Manuscript: 13-029,
submitted to Canadian Energy Technology & Innovation Journal.
Watson A. T., Kulkarni R., Nordtvedt J., Sylte A., and Urkedal H., Estimation of porous
media flow functions, Measurement Science and Technology, vol. 9, pp. 898-905,
1998.
Watson A. T., P. C. Richmond, P. D. Kerig, and T. M. Tao, A regression-based method
for estimating relative permeabilities from displacement experiments, SPE
Reservoir Engineering, vol.3, no. 3, pp. 953-958, 1988.
Wo S. and Yin P., Simulation evaluation of gravity stable CO2 flooding in the muddy
reservoir at Grieve Field, Wyoming, 2008.
Wu Z., Tang Z., Zou J., Kang L., and Li M., An evolutionary algorithm for solving
parameter identification problems in elliptic systems, Evolutionary Computation,
vol. 1, pp. 803-808, 2004.
231
Wyllie, M. R. J., and Gardner, G. H. F.: The generalized Kozeny-Carmen equation - its
Application to problems of multi-phase flow in porous Media, World Oil, vol. 146,
pp. 121-146, 1958.
Wyllie, M. R. J., Spangler, M. B. The application of electrical resistivity measurements
to the problem of fluid flow in porous media. Bulletin of the A.A.P.G. vol. 36(2),
pp. 359-403, 1952.
Xu, J. Q., Modeling unsteady-state gravity-driven flow in porous media, Journal of
Petroleum Science and Engineering, vol. 62(3&4), pp. 80-86, 2008.
Yuster, S. T., Theoretical considerations of multiphase flow in idealized capillary
systems. 3rd World Petroleum Congress, Section II, the Hague, the Netherlands,
May 1951.
232
APPENDIX
A-1 Copyright Permission
233
A-2 Interfaces of the Application for History Matching and Visualization
Main Interface:
Menus:
Results
Viewer
Genetic
Output
Itineration
output
234
Input Dialogs:
235
236
A-3 Class for Numerical Simulation of Multistep Drainage Process
// RpExperiment.h: interface for the CRpExperiment class.
//
#if !defined(AFX_RPEXPERIMENT_H__C806CD38_D6FB_4C4D_B486_8DEBED1F00AD__INCLUDE
D_)
#define AFX_RPEXPERIMENT_H__C806CD38_D6FB_4C4D_B486_8DEBED1F00AD__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "RpDataBody.h"
class CRpExperiment : public CRpDataBody
{
public:
CRpExperiment();
virtual ~CRpExperiment();
public:
void ObtainExpData(CRpDataBody * pRpData); //get data from rp databody
void ObtainMatchingData(double * chromArray);//get data from ga chain
double GetFitness(); //read fitness
void RunCpTest(); //Run Test
void SetRunningMode(int nRunningMode);
private:
double m_dFitness;
double *sw;
double *po; double *pw;
double *su,*sy,*Tw,*To,*Tt,*pc,*a,*b,*c,*d,*x, *dx;
SRpData m_tbRpData[NUM_KR_EXP_TABLE]; //table rp data
double krsw[NUM_KR_CAL_TABLE], krkro[NUM_KR_CAL_TABLE];
double krkrw[NUM_KR_CAL_TABLE], krpc[NUM_KR_CAL_TABLE]; //relative
permeability used for calculation
int m_nRunningMode;
private:
BOOL VerifyData();
void InitKrTable();
void InitCPTest();
void CPTestWithMembrane();
void CalRpDataAtSingleSw(double sw, double &kro,double &krw,double &pc);
public:
int IndexLookup(double arr[],int n,double val);
static void CubicSpline(int nInArrNum, int nOutArrNum,double x[],double y[],double
xx[],double yy[]); static void MonoCubicInterpolator(int nInArrNum, int nOutArrNum, double x[],double y[],
double xx[], double yy[]);
void TriSolver(double *sa,double *sb,double *sc,double *sd,double *sx,int sn);
};
#endif
// !defined(AFX_RPEXPERIMENT_H__C806CD38_D6FB_4C4D_B486_8DEBED1F00AD__INCLUDED
_)
237
// RpExperiment.cpp: implementation of the CRpExperiment class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "RpExperiment.h"
#include "ResLM.h" #include "math.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CRpExperiment::CRpExperiment()
{
po=sw=pw=a=b=c=d=x=Tt=Tw=To=pc=su=sy=dx=NULL;
m_nRunningMode=RM_GA_RUN;
}
CRpExperiment::~CRpExperiment()
{ if (po!=NULL) delete[] po;
if (sw!=NULL) delete[] sw;
if (pw!=NULL) delete[] pw;
if (a!=NULL) delete[] a;
if (b!=NULL) delete[] b;
if (c!=NULL) delete[] c;
if (d!=NULL) delete[] d;
if (x!=NULL) delete[] x;
if (Tt!=NULL) delete[] Tt;
if (Tw!=NULL) delete[] Tw;
if (To!=NULL) delete[] To;
if (pc!=NULL) delete[] pc;
if (su!=NULL) delete[] su;
if (sy!=NULL) delete[] sy;
if (dx!=NULL) delete[] dx;
}
void CRpExperiment::ObtainExpData(CRpDataBody * pRpData)
{
int i;
// core and liquid data
m_core=pRpData->m_core;
m_liqWater=pRpData->m_liqWater;
m_liqOil=pRpData->m_liqOil;
//time control
m_tMax=pRpData->m_tMax;
m_tStep=pRpData->m_tStep;
m_nBlock=pRpData->m_nBlock;
m_SwChange=pRpData->m_SwChange;
238
m_TimeRate=pRpData->m_TimeRate;
m_nRpInteType=pRpData->m_nRpInteType;
//relative perm data
m_nRpCount=pRpData->m_nRpCount;
for(i=0;i<NUM_EXPCURVE_MAX+1;i++)
m_RpData[i]=pRpData->m_RpData[i]; //history data;
m_nHisNum=pRpData->m_nHisNum;
for(i=0;i<NUM_HISDATA_MAX;i++)
m_sHisData[i]=pRpData->m_sHisData[i];
//corey coef.
for(i=0;i<NUM_COREY_VAR;i++)
m_fRpCoreyCtrl[i]=pRpData->m_fRpCoreyCtrl[i];
}
void CRpExperiment::RunCpTest()
{
if (VerifyData())
{
InitKrTable();
InitCPTest(); CPTestWithMembrane();
}
}
void CRpExperiment::InitCPTest()
{
po=new double[m_nBlock];
pw=new double[m_nBlock];
sw=new double[m_nBlock];
dx=new double[m_nBlock];
Tw=new double[m_nBlock];
To=new double[m_nBlock];
Tt=new double[m_nBlock];
pc=new double[m_nBlock];
a=new double[m_nBlock+1];
b=new double[m_nBlock+1];
c=new double[m_nBlock+1]; d=new double[m_nBlock+1];
x=new double[m_nBlock+1];
sy=new double[m_nBlock+1];
su=new double[m_nBlock+1];
int i;
double swi=m_RpData[m_nRpCount-1].sw;
double inPres=m_RpData[m_nRpCount-2].pc;
for (i=0; i<m_nBlock; i++)
{
sw[i]=swi;
po[i]=inPres;
pw[i]=0;
239
dx[i]=m_core.m_fLength/(m_nBlock-1);
}
}
void CRpExperiment::InitKrTable()
{
int i,j; double dsw=(m_RpData[m_nRpCount-1].sw-m_RpData[0].sw)/(NUM_KR_CAL_TABLE-1);
double isw=m_RpData[0].sw;
double ssw;
//
switch (m_nRpInteType)
{
case KR_TYPE_LINEAR: //linear;
{
double dsw=(m_RpData[m_nRpCount-1].sw-
m_RpData[0].sw)/(NUM_KR_CAL_TABLE-1);
double isw=m_RpData[0].sw;
double ssw;
for (i=0;i<NUM_KR_CAL_TABLE;i++)
{
ssw=dsw*i+isw;
for (j=0;j<m_nRpCount-1;j++) {
if (ssw>=m_RpData[j].sw && ssw<m_RpData[j+1].sw)
{
krkro[i]= m_RpData[j].kro+
(m_RpData[j+1].kro-
m_RpData[j].kro)/
(m_RpData[j+1].sw-
m_RpData[j].sw)*(ssw-m_RpData[j].sw);
krkrw[i]= m_RpData[j].krw+
(m_RpData[j+1].krw-
m_RpData[j].krw)/
(m_RpData[j+1].sw-
m_RpData[j].sw)*(ssw-m_RpData[j].sw);
krpc[i]= m_RpData[j].pc+
(m_RpData[j+1].pc-
m_RpData[j].pc)/
(m_RpData[j+1].sw-m_RpData[j].sw)*(ssw-m_RpData[j].sw);
krsw[i]=ssw;
break;
}
}
}
krsw [NUM_KR_CAL_TABLE-1]=m_RpData[m_nRpCount-1].sw;
krkro[NUM_KR_CAL_TABLE-1]=m_RpData[m_nRpCount-1].kro;
krkrw[NUM_KR_CAL_TABLE-1]=m_RpData[m_nRpCount-1].krw;
krpc [NUM_KR_CAL_TABLE-1]=m_RpData[m_nRpCount-1].pc;
break;
}
case KR_TYPE_CUBIC: //cubic
240
{
double dsw=(m_RpData[m_nRpCount-1].sw-
m_RpData[0].sw)/(NUM_KR_CAL_TABLE-1);
double isw=m_RpData[0].sw;
double ssw;
for (i=0;i<NUM_KR_CAL_TABLE;i++) {
ssw=dsw*i+isw;
krsw[i]=ssw;
}
double *csw,*ckro,*ckrw,*cpc;
csw=new double[m_nRpCount];
ckro=new double[m_nRpCount];
ckrw=new double[m_nRpCount];
cpc=new double[m_nRpCount];
for (i=0;i<m_nRpCount;i++)
{
csw[i]=m_RpData[i].sw;
ckrw[i]=m_RpData[i].krw;
ckro[i]=m_RpData[i].kro; cpc[i]=m_RpData[i].pc;
}
CubicSpline(m_nRpCount,NUM_KR_CAL_TABLE,csw,ckrw,krsw,krkrw);
CubicSpline(m_nRpCount,NUM_KR_CAL_TABLE,csw,ckro,krsw,krkro);
CubicSpline(m_nRpCount,NUM_KR_CAL_TABLE,csw,cpc,krsw,krpc);
delete [] csw;
delete [] ckro;
delete [] ckrw;
delete [] cpc;
}
break;
case KR_TYPE_MONOCUBIC: //cubic
{
double dsw=(m_RpData[m_nRpCount-1].sw-
m_RpData[0].sw)/(NUM_KR_CAL_TABLE-1);
double isw=m_RpData[0].sw;
double ssw;
for (i=0;i<NUM_KR_CAL_TABLE;i++)
{
ssw=dsw*i+isw;
krsw[i]=ssw;
}
double *csw,*ckro,*ckrw,*cpc;
csw=new double[m_nRpCount];
241
ckro=new double[m_nRpCount];
ckrw=new double[m_nRpCount];
cpc=new double[m_nRpCount];
for (i=0;i<m_nRpCount;i++)
{
csw[i]=m_RpData[i].sw; ckrw[i]=m_RpData[i].krw;
ckro[i]=m_RpData[i].kro;
cpc[i]=m_RpData[i].pc;
}
MonoCubicInterpolator(m_nRpCount,NUM_KR_CAL_TABLE,csw,ckrw,krsw,krkrw);
MonoCubicInterpolator(m_nRpCount,NUM_KR_CAL_TABLE,csw,ckro,krsw,krkro);
MonoCubicInterpolator(m_nRpCount,NUM_KR_CAL_TABLE,csw,cpc,krsw,krpc);
/* FILE *pf=fopen("c:\\out.txt","w");
for (int kk=0;kk<NUM_KR_CAL_TABLE;kk++)
fprintf(pf,"%g\t%g\t%g\t%g\n",krsw[kk],krkrw[kk],krkro[kk],krpc[kk]);
fclose(pf);*/
delete [] csw;
delete [] ckro;
delete [] ckrw;
delete [] cpc;
}
break;
case KR_TYPE_COREY: //power law;
{
double fCoreyCtrl[NUM_COREY_VAR];
for (i=0;i<NUM_COREY_VAR;i++)
{
fCoreyCtrl[i]=m_fRpCoreyCtrl[i];
}
fCoreyCtrl[0]=m_fRpCoreyCtrl[0]*(1-m_RpData[m_nRpCount-1].sw);
fCoreyCtrl[1]=m_fRpCoreyCtrl[1]*(m_RpData[0].sw);
fCoreyCtrl[2]=(POW_MAX)*m_fRpCoreyCtrl[2]; fCoreyCtrl[3]=(POW_MAX)*m_fRpCoreyCtrl[3];
double dsw=(m_RpData[m_nRpCount-1].sw-
m_RpData[0].sw)/(NUM_KR_CAL_TABLE-1);
double isw=m_RpData[0].sw;
double rw,ro;
for (i=0;i<NUM_KR_CAL_TABLE;i++)
{
ssw=dsw*i+isw;
rw=(ssw-fCoreyCtrl[1])/(1-fCoreyCtrl[1]-fCoreyCtrl[0]);
ro=(1-ssw-fCoreyCtrl[0])/(1-fCoreyCtrl[1]-fCoreyCtrl[0]);
krsw[i]=ssw;
if(ro>=0)
krkro[i]=fCoreyCtrl[4]*powf(ro,fCoreyCtrl[2]);
242
else
krkro[i]=0;
//krkro[i]=1;
if(rw>=0)
krkrw[i]=fCoreyCtrl[5]*powf(rw,fCoreyCtrl[3]);
else
krkrw[i]=0; }
double *csw,*cpc;
csw=new double[m_nRpCount];
cpc=new double[m_nRpCount];
for (i=0;i<m_nRpCount;i++)
{
csw[i]=m_RpData[i].sw;
cpc[i]=m_RpData[i].pc;
}
MonoCubicInterpolator(m_nRpCount,NUM_KR_CAL_TABLE,csw,cpc,krsw,krpc);
delete [] csw;
delete [] cpc;
}
break;
default:
break; }
}
void CRpExperiment::CPTestWithMembrane()
{
int t, i;
int nCell=m_nBlock;
double Po=m_core.m_fPore;
double cA=m_core.m_fArea;
double qc=0;
int nStep=0;
double sumt=0;
double sumq=0;
int kk=0;//
int tsIdx=1;
double ts=0; double sumr=0;
int nt=1;
double skro,skrw,spc;//temperary relative permeablity data buffer
//membrane calculation
if (m_core.m_memCond>=1e20)
qc=0;
else
qc=m_liqWater.m_visc/(m_core.m_memCond);
for (t=0; tsIdx < m_nHisNum/*t<1*/; t++)
243
{
//obtain time step and cumulative time;
double dt=m_tStep;
bool bRcStep=FALSE;
if(sumt+dt>=m_sHisData[tsIdx].m_time)
{ dt=m_sHisData[tsIdx].m_time-sumt;
bRcStep=TRUE;
tsIdx++;
}
sumt+=dt;
//Capillary pressure && calculate transferability
for (i=0; i<nCell; i++)
{
CalRpDataAtSingleSw(sw[i], skro,skrw, spc);
pc[i] = spc;
Tw[i] = m_core.m_fPerm * skrw / m_liqWater.m_visc / (0.5*dx[i]+0.5*dx[i+1]);
To[i] = m_core.m_fPerm * skro / m_liqOil.m_visc /(0.5*dx[i]+0.5*dx[i+1]);
Tt[i] = Tw[i] + To[i];
}
//
pc[0]=pc[0]*4/3-pc[1]/3; pc[nCell-1]=pc[nCell-1]*4/3-pc[nCell-2]/3;
//pressure boundary
double inPres=m_sHisData[tsIdx-1].m_pres;
double outPres=0;
//Build Linear Equations
//first block
b[0] = Tt[0];
a[0] = 1;
c[0] = 0;
d[0] = Tt[0]*inPres - Tw[0]*(pc[0]-pc[1]);
//second block
b[1] = -Tt[1];
c[1] = 0;
a[1] = Tt[1] + Tt[0]; d[1] = Tt[0]*inPres+Tw[1]*(pc[1]-pc[2]) -Tw[0]*(pc[0]-pc[1]);
//other point
for (i=2; i<m_nBlock-1; i++)
{
b[i] = Tt[i];
c[i] = Tt[i-1];
a[i] = -b[i] - c[i];
d[i] = Tw[i-1]*(pc[i-1]-pc[i])-Tw[i]*(pc[i]-pc[i+1]);
}
//last point
244
b[m_nBlock-1] = 1;
a[m_nBlock-1] = Tt[m_nBlock-2];
c[m_nBlock-1] = - Tt[m_nBlock-2];
d[m_nBlock-1]= -Tw[m_nBlock-2]*pc[m_nBlock-2]+Tw[m_nBlock-2]*pc[m_nBlock-1];
//membrane
b[m_nBlock] = 0; a[m_nBlock] = -qc;
c[m_nBlock] = 1;
d[m_nBlock] =pc[m_nBlock-1] + outPres;
//solver equation
TriSolver(a, b, c, d, x, m_nBlock+1);
for (i=1; i<m_nBlock; i++)
{
po[i] = x[i];
pw[i] = po[i] - pc[i];
}
po[0]=inPres;
pw[0]=inPres-pc[0];
double qo=x[0]*cA; double qw=-x[m_nBlock]*cA;
//sw
sw[0] = sw[0] - (Tw[0] * cA * (pw[0] - pw[1]) * dt) / (Po * dx [0]*0.5 * cA);
for (i=1; i<m_nBlock-1; i++)
sw[i] = sw[i]
+ (Tw[i] * cA * (pw[i + 1]- pw[i]) * dt ) / (Po * dx[i] * cA)
- (Tw[i - 1] * cA * (pw[i]- pw[i - 1])* dt)/ (Po * dx[i] * cA);
sw[m_nBlock-1] = sw[m_nBlock-1]
+ qw * dt / ( Po * cA * dx[m_nBlock-1] *0.5)
+ (Tw[m_nBlock-2] * cA * (pw[m_nBlock-2] - pw[m_nBlock-1]) * dt) / (Po *
dx[m_nBlock-1] *0.5 * cA);
sumq+=-dt*qw;
if (bRcStep) {
if(m_nRunningMode==RM_SINGLE_RUN) LMOUTPUT(LM_TOPVIEW,
"%g\t%g\t%g\t%g\r\n",sumt,inPres,sumq,qo);
sumr+=(sumq-m_sHisData[tsIdx-1].m_liquid)*(sumq-m_sHisData[tsIdx-
1].m_liquid);
if(m_nRunningMode==RM_SINGLE_RUN)
{
LMOUTPUT(LM_BOTTOMVIEW, "Time Step : %g\r\n", sumt);
}
}
}
m_dFitness=1/sqrt(sumr);
245
}
void CRpExperiment::TriSolver(double *sa,double *sb,double *sc,double *sd,double *sx,int sn)
{
double li = sa[0];
int i; sy[0] = sd[0] / li;
for (i = 1; i<sn; i++)
{
su[i-1] = sb[i - 1] / li;
li = sa[i] - sc[i] * su[i - 1];
sy[i] = (sd[i] - sc[i] * sy[i - 1]) / li;
}
sx[sn-1] = sy[sn-1];
for ( i = 1; i<sn; i++)
{
int j = sn - i - 1;
sx[j] = sy[j] - su[j] * sx[j + 1];
}
}
void CRpExperiment::CalRpDataAtSingleSw(double sw, double &kro,double &krw, double &pc)
{ //linear intepolation method to calculate the rp values for single point
int i;
if (sw<krsw[0])
{
kro=krkro[0];krw=krkrw[0];pc=krpc[0];
}
else if (sw>krsw[NUM_KR_CAL_TABLE-1])
{
kro=krkro[NUM_KR_CAL_TABLE-1];krw=krkrw[NUM_KR_CAL_TABLE-
1];pc=krpc[NUM_KR_CAL_TABLE-1];
}
else
{
i=IndexLookup(krsw,NUM_KR_CAL_TABLE,sw);
kro= krkro[i]+(krkro[i+1]-krkro[i])/(krsw[i+1]-krsw[i])*(sw-krsw[i]);
krw= krkrw[i]+(krkrw[i+1]-krkrw[i])/(krsw[i+1]-krsw[i])*(sw-krsw[i]);
pc= krpc[i]+(krpc[i+1]-krpc[i])/(krsw[i+1]-krsw[i])*(sw-krsw[i]); }
}
double CRpExperiment::GetFitness()
{
return m_dFitness;
}
void CRpExperiment::ObtainMatchingData(double *rpArray)
{
int i;
if(m_nRpInteType==KR_TYPE_COREY)
{
246
for (i=0;i<NUM_COREY_VAR;i++)
{
m_fRpCoreyCtrl[i]=rpArray[i];
}
}
else {
for (i=0;i<m_nRpCount;i++)
{
m_RpData[i].kro=rpArray[i];
//m_RpData[i].kro=m_RpData[i].kro;
//m_RpData[i].kro=1;
m_RpData[i].krw=rpArray[i+m_nRpCount];
//m_RpData[i].krw=m_RpData[i].krw;
}
}
}
BOOL CRpExperiment::VerifyData()
{
BOOL bResult=TRUE;
if (m_nRpCount<=0)
{ LMOUTPUT(LM_TOPVIEW, "No Relative Permeability Data\r\n");
return FALSE;
}
return bResult;
}
void CRpExperiment::MonoCubicInterpolator(int nInArrNum, int nOutArrNum, double * x,double *y,
double *xx, double *yy)
{
int i,j;
double t,h;
double * m = new double[nInArrNum];
//calculate simple m;
m[0]= (y[1]-y[0])/(x[1]-x[0]);
m[nInArrNum-1]=(y[nInArrNum-1]-y[nInArrNum-2])/(x[nInArrNum-1]-x[nInArrNum-2]);
for (i=1;i<nInArrNum-1;i++)
m[i]=((y[i]-y[i-1])/(x[i]-x[i-1])+(y[i+1]-y[i])/(x[i+1]-x[i]))/2;
//modify m for monotone
for (i=0;i<nInArrNum-1;i++)
{
double delta = (y[i+1]-y[i])/(x[i+1]-x[i]);
if (delta==0)
{
m[i]=0;
m[i+1]=0;
247
}
else
{
double alpha = m[i] / delta;
double beta = m[i+1] / delta;
if ((alpha*alpha + beta*beta) > 9)
{
double tau = 3/sqrt(alpha*alpha + beta*beta);
m[i] = tau*alpha*delta;
m[i+1] = tau*beta*delta;
}
}
}
//find xx[i] and calculate yy[i]
for (j=0;j<nOutArrNum;j++)
{
//overshoot
int ii=0;
if (xx[j]<=x[0]) ii=0;
else if (xx[j]>=x[nInArrNum-1]) ii=nInArrNum-2;
else
{
for (i=0;i<nInArrNum-1;i++)
{
double multx=(xx[j]-x[i])*(xx[j]-x[i+1]);
if(multx<=0)
ii=i;
else
continue;
}
}
h=x[ii+1]-x[ii];
t=(xx[j]-x[ii])/h; yy[j] = y[ii] * (2*t*t*t - 3*t*t + 1)
+ m[ii] * h * (t*t*t - 2*t*t + t)
+ y[ii+1] * (-2*t*t*t + 3*t*t)
+ m[ii+1]*h * (t*t*t - t*t);
}
delete [] m;
}
void CRpExperiment::CubicSpline(int nInArrNum,int nOutArrNum,double x[],double y[],double
xx[],double yy[])
{
248
int i,k;
double p1,p2,p3,p4;
double P0=0,Pn=0;
int N=nInArrNum-1;
int R=nOutArrNum-1;
double *h=new double[N];
double *a=new double[N+1];
double *c=new double[N];
double *g=new double[N+1];
double *af=new double[N+1];
double *ba=new double[N];
double *m=new double[N+1];
/*First Step calculate the coefs of Linear equation system*/
for(k=0;k<N;k++)
h[k]=x[k+1]-x[k];
for(k=1;k<N;k++)
a[k]=h[k]/(h[k]+h[k-1]);
for(k=1;k<N;k++)
c[k]=1-a[k];
for(k=1;k<N;k++) g[k]=3*(c[k]*(y[k+1]-y[k])/h[k]+a[k]*(y[k]-y[k-1])/h[k-1]);
c[0]=a[N]=1;
g[0]=3*(y[1]-y[0])/h[0]-P0*h[0]/2;
g[N]=3*(y[N]-y[N-1])/h[N-1]+Pn*h[N-1]/2;
/*Solve the equation*/
ba[0]=c[0]/2;
g[0]=g[0]/2;
for(i=1;i<N;i++)
{
af[i]=2-a[i]*ba[i-1];
g[i]=(g[i]-a[i]*g[i-1])/af[i];
ba[i]=c[i]/af[i];
}
af[N]=2-a[N]*ba[N-1];
g[N]=(g[N]-a[N]*g[N-1])/af[N];
m[N]=g[N];
for(i=N-1;i>=0;i--)
m[i]=g[i]-ba[i]*m[i+1];
/*Calculate values*/
for(i=0;i<=R;i++)
{
if(xx[i]<x[0])
yy[i]=x[0];
else if (xx[i]>x[N])
yy[i]=x[N];
else
{
249
k=0;
while(xx[i]>x[k+1])
k++;
p1=(h[k]+2*(xx[i]-x[k]))*pow((xx[i]-x[k+1]),2)*y[k]/pow(h[k],3);
p2=(h[k]-2*(xx[i]-x[k+1]))*pow((xx[i]-x[k]),2)*y[k+1]/pow(h[k],3);
p3=(xx[i]-x[k])*pow((xx[i]-x[k+1]),2)*m[k]/pow(h[k],2);
p4=(xx[i]-x[k+1])*pow((xx[i]-x[k]),2)*m[k+1]/pow(h[k],2); yy[i]=p1+p2+p3+p4;
}
}
/*Release buffer*/
delete [] h;
delete [] a;
delete [] c;
delete [] g;
delete [] af;
delete [] ba;
delete [] m;
}
void CRpExperiment::SetRunningMode(int nRunningMode)
{ m_nRunningMode=nRunningMode;
}
int CRpExperiment::IndexLookup(double arr[],int n,double val)
{
int i=0;
int j=n-1;
int k=n/2;
while(i<=j)
{
k=(i+j)/2;
if(arr[k]==val)
return k;
else if(arr[k]>val)
j=k-1; else if(arr[k]<val)
i=k+1;
}
return i-1;
}
250
A-4 Class for Genetic Algorithm
// GACalculator.h: interface for the CGACalculator class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_GACALCULATOR_H__2EEA45E1_DF8C_4768_8FC2_39617EA96556__INCLUDED
_)
#define AFX_GACALCULATOR_H__2EEA45E1_DF8C_4768_8FC2_39617EA96556__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "ResLM.h" #include "individual.h"
#include "RpDataBody.h"
#include "RpExperiment.h"
class CGACalculator;
struct sGAData
{
int idx;
double fitness;
CGACalculator * pGA;
};
class CGACalculator
{
public:
CGACalculator(); virtual ~CGACalculator();
//static varables and functions
public:
static HANDLE hMutex;
//Mute value for paralell calculation
static double RandVal(double dBegin=0.0, double dEnd=1.0); //Random value generator
static DWORD WINAPI CalSingleIndividual(LPVOID lpParam); //Child thread for
SingleIndividual calculation
//SGA Calculations///////////////////////////////////////////
public:
void SGACalculation();
private:
void SGAInitPopulation();
int SGACrossOver(CHTYPE *parent1,CHTYPE *parent2,CHTYPE *child1,CHTYPE *child2);
void SGAMutation(CHTYPE *child); void SGAGeneration();
void SGASumfit();
int SGASelection();
void SGACreateTmpDataFiles();
int m_nLenChrom;
int m_nSGAPopSize;
int m_nSGAMaxGen;
251
double m_sumfitness;
bool bSpeedUp;
FILE *fpout;
std::vector <CIndividual> newpop;
//MPGA Calculations///////////////////////////////////////////
public:
void MPGACalculation();
//Multiple-parent Genetic Algorithm function
void GetImportedData(FILE *fp); //Import
restart file
void Serialize(CArchive & ar);
//Serialize file for storage
void SetCurWorkPath(CString strPath);
private:
void MPGAInitPopulation();
//Initialize population space;
void RearrangeChrom(double *val); //For interpolation
method to rearrange Kr in monotonous order
void MPGACrossOver();
//MPG crossover, mutation included
void CreateTmpDataFiles(); //Create Temporary data file for GA
//GA Control/////////////////////////////////////////////////////
public:
int m_nMaxGen; //Maximum generations number (100-10000)
int m_nPopSize; //Individual number in one generation (60-200)
int m_nChromSize; //The number of chromosome; every chromosome is a
0 to 1 random number;
int m_nPoolNum; //cross over pool
int m_nEliteNum; //elite individual number
double m_fOffset;
double m_pmutation;
double m_pcross;
CIndividual m_indBestFit; //Best individual
CIndividual m_indAimed; //Matched target
private:
int m_nCurGen; //Current control
int m_nCurCalNum; //Current Calculation
Number
std::vector <CIndividual> m_popSpace; //Population Space
double m_fAverFit; //Average fitness
int m_nGACalType;
//other properities/////////////////////////////////////////////
public:
void SpeedUp();
void GAInitialization();
252
void SGARearrange(CIndividual *critter);
void RunGACalculation();
void SetGACalType(int nGACalType) { m_nGACalType=nGACalType;}
CString m_strCurPath;
CRpDataBody * m_RpDataBody;
void DrawGraph(CDC *pDC, CRect rc);
};
#endif
// !defined(AFX_GACALCULATOR_H__2EEA45E1_DF8C_4768_8FC2_39617EA96556__INCLUDED_)
// GACalculator.cpp: implementation of the CGACalculator class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "reslm.h"
#include "GACalculator.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
/********************************************************************
created: 2009/03/09
author: Shengdong Wang
purpose: Multiple-parent genetic algorithm
description: This is the main model of class multiple-parent genetic algorithm
*********************************************************************/
CGACalculator::CGACalculator()
{
m_nPopSize=100;
m_nChromSize = 0;
m_nMaxGen=2000;
m_nPoolNum=3; m_nEliteNum=1;
m_fOffset=0.5f;
m_nGACalType=1;
m_nSGAPopSize=100;
m_nSGAMaxGen =10000;
m_pcross=0.7;
m_pmutation=0.03;
bSpeedUp=FALSE;
}
CGACalculator::~CGACalculator()
{
253
}
//////////////////////////////////////////////////////////////////////////
/********************************************************************
Created: 2009/12/03
Author: Shengdong Wang
Purpose:
Description: Mult-parent GA Calculation main function
*********************************************************************/
void CGACalculator::MPGACalculation()
{
int i,gen;
sGAData *pGAData;
HANDLE *hThread;
CTime tTime;
CString strTime;
hMutex= CreateMutex(NULL, FALSE, NULL);
pGAData= new sGAData [m_nPopSize];
hThread= new HANDLE [m_nPopSize];
// output basic information
tTime=CTime::GetCurrentTime();
strTime=tTime.Format("%Y-%m-%d %H:%M:%S");
LMOUTPUT(LM_TOPVIEW,"--- Multi-parent Crossover Genetic Algorithm ---\r\n");
LMOUTPUT(LM_TOPVIEW,"Time: %s\r\n",strTime);
LMOUTPUT(LM_TOPVIEW,"Total Population: %d\r\n",m_nPopSize);
LMOUTPUT(LM_TOPVIEW,"Total Generation: %d\r\n\r\n",m_nMaxGen);
LMOUTPUT(LM_TOPVIEW,"Initializing First Generation\r\n");
// output file;
fprintf(fpout,"--- Multi-parent Crossover Genetic Algorithm ---\n");
fprintf(fpout,"Time: %s\n",strTime);
fprintf(fpout,"Total Population: %d\n",m_nPopSize);
fprintf(fpout,"Total Generation: %d\n",m_nMaxGen);
fprintf(fpout,"------------------------------------------------\n");
//using mult-thread to calculate the first generation
for (i=0;i<m_nPopSize;i++)
{
pGAData[i].idx =i;
pGAData[i].pGA=this;
hThread[i] = CreateThread(NULL, 0, CalSingleIndividual, &pGAData[i],
CREATE_SUSPENDED, NULL);
SetThreadPriority(hThread[i], THREAD_PRIORITY_BELOW_NORMAL);
ResumeThread(hThread[i]);
}
//wait for multi-thread over;
254
int tempNumThreads = m_nPopSize;
int tempMax = 0;
while(tempNumThreads >= MAXIMUM_WAIT_OBJECTS )
{
tempNumThreads -= MAXIMUM_WAIT_OBJECTS;
WaitForMultipleObjects( MAXIMUM_WAIT_OBJECTS, &hThread[tempMax], TRUE,
INFINITE); tempMax += MAXIMUM_WAIT_OBJECTS;
}
WaitForMultipleObjects(tempNumThreads, &hThread[tempMax], TRUE, INFINITE);
//close objects
for (i=0;i<m_nPopSize;i++)
{
CloseHandle(hThread[i]);
m_popSpace[i].fitness=pGAData[i].fitness;
}
delete [] pGAData;
delete [] hThread;
LMOUTPUT(LM_TOPVIEW,"First Generation Initialization Done\r\n");
//Mult-parent GA Calculation
for (gen=0;gen<m_nMaxGen;gen++) {
MPGACrossOver();
double sumfit=0;
for (i=0;i<m_nPopSize;i++)
{
sumfit+=m_popSpace[i].fitness;
if (m_indBestFit.fitness<m_popSpace[i].fitness)
{
int k;
m_indBestFit=m_popSpace[i];
m_indBestFit.gen=gen+1;
LMOUTPUT(LM_TOPVIEW,"\r\nFitness : %g\r\n",m_indBestFit.fitness);
LMOUTPUT(LM_TOPVIEW,"Chromosome Data:\r\n");
fprintf(fpout,"\nFitness : %g\n",m_indBestFit.fitness); fprintf(fpout,"Chromosome Data:\n");
for(k =0;k<m_nChromSize;k++)
{
LMOUTPUT(LM_TOPVIEW,"%20g\t%20g\r\n",m_indBestFit.dblChrom[k],m_indAimed.dblChro
m[k]);
fprintf(fpout,"%20g\t%20g\n",m_indBestFit.dblChrom[k],m_indAimed.dblChrom[k]);
}
fprintf(fpout,"CRDATA %d\n",m_nChromSize);
for(k=0;k<m_nPopSize;k++)
255
{
int j;
for(j=0;j<m_nChromSize;j++)
{
fprintf (fpout,"%lf\t",m_popSpace[k].dblChrom[j]);
}
fprintf (fpout,"\n"); }
}
}
m_nCurGen=gen+1;
m_fAverFit= sumfit/m_nPopSize;
LMOUTPUT(LM_BOTTOMVIEW,"Gn: %d\tCn: %d\tFn: %g\r\n",m_nCurGen,m_nCurCalNum,m
_fAverFit);
fprintf(fpout,"****** Gn: %d\tCn: %d\tFn: %g
***********\n",m_nCurGen,m_nCurCalNum,m_fAverFit);
}
//Calculation over, print results;
tTime=CTime::GetCurrentTime();
strTime=tTime.Format("%Y-%m-%d %H:%M:%S");
LMOUTPUT(LM_TOPVIEW,"\r\n--- Genetic Algorithm Done! ---\r\n"); LMOUTPUT(LM_TOPVIEW,"Time: %s\r\n",strTime);
}
void CGACalculator::SGAInitPopulation() //population initialization
{
int i,j,k = 0;
m_nLenChrom=8*sizeof(CHTYPE)*m_nChromSize;
CHTYPE mask = 1;
m_popSpace/**/.resize(m_nSGAPopSize);
newpop.resize(m_nSGAPopSize);
// chromosome initialization
for (i=0; i<m_nSGAPopSize; i++)
{
CIndividual newIndividual;
for (j=0; j<m_nChromSize; j++)
{ CHTYPE newChrom=0;
int stop=8*sizeof(CHTYPE);
for (k=0; k<stop; k++)
{
newChrom=newChrom<<1;
if (RandVal()<=0.5)
{
newChrom=newChrom|mask;
}
}
newIndividual.byteChrom[j]=newChrom;
}
256
//rearrange chromsome
newIndividual.parent[0]=0; //parents index
newIndividual.parent[1]=0;
newIndividual.fitness=0;
m_popSpace/**/[i]=newIndividual;
//m_popSpace/**/[i]=newIndividual;
}
}
void CGACalculator::MPGAInitPopulation() //population space initialization
{
int i,j;
// population space initialization
m_nCurGen=0;
m_nCurCalNum=0;
m_indBestFit.fitness = 0.0f;
m_fAverFit=0.0f;
m_popSpace.clear();
m_popSpace.resize(m_nPopSize);
for (i=0; i<m_nPopSize; i++) {
CIndividual newIndividual;
//Create random chromosome
for (j=0; j<m_nChromSize; j++)
newIndividual.dblChrom[j]=RandVal(0,1);
RearrangeChrom(newIndividual.dblChrom);
newIndividual.fitness=0;
newIndividual.gen=0;
m_popSpace[i]=newIndividual;
}
}
void CGACalculator::MPGACrossOver()
{
int i,j;
int * pMatePoolIdx;
double * pMateParam;
double sumA,tmpMax,tmpMin,MaxA,MinA;
bool bValidChild;
int mini=0;
int EliteNum=0;
if(m_nPoolNum>m_nPopSize) m_nPoolNum=m_nPopSize;
257
if(m_nEliteNum>m_nPoolNum) m_nEliteNum=m_nPoolNum;
if (bSpeedUp)
{
EliteNum=m_nPoolNum;
}
else EliteNum=m_nEliteNum;
pMateParam= new double[m_nPoolNum];
pMatePoolIdx = new int[m_nPoolNum];
bValidChild=false;
while(!bValidChild)
{
double minfit=1e300;
double maxfit=-1e300;
//look up smallest one;
for (i=0;i<m_nPopSize;i++)
{
if (minfit>m_popSpace[i].fitness)
{
minfit=m_popSpace[i].fitness;
mini=i; }
}
//look up elites
for (j=0;j<EliteNum;j++)
{
maxfit=-1e300;
for (i=0;i<m_nPopSize;i++)
{
int k;
bool bOut=false;
for (k=0;k<j;k++)
{
if (i==pMatePoolIdx[k]){bOut=true;break;}
}
if (bOut) continue;
if (maxfit<m_popSpace[i].fitness)
{ maxfit=m_popSpace[i].fitness;
pMatePoolIdx[j]=i;
}
}
}
// Select other crossover pool individuals
for(i=EliteNum;i<m_nPoolNum;i++)
pMatePoolIdx[i]=int(RandVal()*m_nPopSize-0.5);
// calculate pMateparam
sumA=0.0;
tmpMin=MinA=0-m_fOffset;
258
tmpMax=MaxA=1+m_fOffset;
for(i=0;i<m_nPoolNum-1;i++)
{
pMateParam[i]=(tmpMax-tmpMin)*RandVal()+MinA;
sumA+=pMateParam[i];
tmpMax=min(MaxA,MaxA-sumA); tmpMin=max(MinA,MinA-sumA);
}
pMateParam[m_nPoolNum-1]=1-sumA;
//Create new individual
CIndividual newind;
for(i=0;i<m_nChromSize;i++)
{
double val=0;
for(j=0;j<m_nPoolNum;j++)
{
val+=m_popSpace[pMatePoolIdx[j]].dblChrom[i]*pMateParam[j];
}
if(RandVal()<m_pmutation)
val=val+0.01*(0.5-RandVal());
val=max(0,val); val=min(1,val);
newind.dblChrom[i]=val;
}
RearrangeChrom(newind.dblChrom);
//calculate fitness of the new individual
CRpExperiment exp;
exp.ObtainExpData(m_RpDataBody);
exp.ObtainMatchingData(newind.dblChrom);
exp.RunCpTest();
newind.fitness=exp.GetFitness();
if (newind.fitness>minfit)
{
m_popSpace[mini]=newind;
CreateTmpDataFiles();
bValidChild=true;
}
m_nCurCalNum++; }
for (i=0;i<m_nPopSize;i++)
{
// m_popSpace[i].dblChrom[m_nChromSize-1]=1;
// m_popSpace[i].dblChrom[m_nChromSize/2-1]=0;
//
}
delete [] pMatePoolIdx;
delete [] pMateParam;
}
/////////////////////////////////////////////////////////////
259
/////Random value generator////////////////////////
double CGACalculator::RandVal(double dBegin, double dEnd)
{
double d01, rslt;
d01 = ((double)rand())/RAND_MAX; rslt=dBegin+d01*(dEnd-dBegin);
return rslt;
}
void CGACalculator::Serialize(CArchive & ar)
{
m_RpDataBody->Serialize(ar);
if(ar.IsStoring())
{
ar<<m_nMaxGen<<0.2<<0.2<<m_nPopSize<<m_nPoolNum<<m_nEliteNum<<m_fOffset;
}
else
{
double tmp;
ar>>m_nMaxGen>>tmp>>tmp>>m_nPopSize>>m_nPoolNum>>m_nEliteNum>>m_fOffset; }
}
DWORD WINAPI CGACalculator::CalSingleIndividual(LPVOID lpParam)
{
WaitForSingleObject(hMutex,INFINITE);
sGAData *pGAData=(sGAData *)lpParam;
int idx= pGAData->idx;
LMOUTPUT(LM_BOTTOMVIEW,"\t$ Create Individual %d\r\n",idx+1);
CRpExperiment exp;
exp.ObtainExpData(pGAData->pGA->m_RpDataBody);
exp.ObtainMatchingData(pGAData->pGA->m_popSpace[idx].dblChrom);
ReleaseMutex(hMutex);
exp.RunCpTest();
WaitForSingleObject(hMutex,INFINITE);
pGAData->fitness=exp.GetFitness();
LMOUTPUT(LM_BOTTOMVIEW,"\t$ Individual %d fitness : %g\r\n",idx+1,pGAData-
>fitness);
ReleaseMutex(hMutex);
return 0;
}
void CGACalculator::CreateTmpDataFiles()
{
int i,j;
FILE *fp;
260
//create temporary file
CString curKrdDir=m_strCurPath+".lmrst"; //create restart file
//rel perm data
fp=fopen(curKrdDir,"w");
fprintf(fp,"CRLENGTH %d\n",m_nChromSize);
for(i=0;i<m_nPopSize;i++)
{ for(j=0;j<m_nChromSize;j++)
{
fprintf (fp,"%lf\t",m_popSpace[i].dblChrom[j]);
}
fprintf (fp,"\n");
}
fclose(fp);
}
void CGACalculator::GetImportedData(FILE *fp)
{
}
void CGACalculator::RearrangeChrom(double *var)
{
if(m_RpDataBody->m_nRpInteType==KR_TYPE_COREY) return; int i,j;
double tmp;
for ( i=0; i<m_nChromSize/2; i++)
{
for ( j=i; j<m_nChromSize/2; j++)
{
if (var[j]>var[i])
{
tmp=var[i];
var[i]=var[j];
var[j]=tmp;
}
}
//var[i]=1;
}
// var[m_nChromSize/2-1]=0; for (i=m_nChromSize/2; i<m_nChromSize; i++)
{
for ( j=i; j<m_nChromSize; j++)
{
if (var[j]<var[i])
{
tmp=var[i];
var[i]=var[j];
var[j]=tmp;
}
}
}
261
}
void CGACalculator::SetCurWorkPath(CString strPath) {
int pos=strPath.ReverseFind('.');
if(pos>0)
m_strCurPath=strPath.Left(pos);
else
m_strCurPath="";
}
void CGACalculator::DrawGraph(CDC *pDC, CRect rc)
{
CRect rcPlot=rc;
rcPlot.DeflateRect(10,10);
pDC->Rectangle(rcPlot);
//draw best;
int i=0,j=0;
double wid,hig;
wid=rcPlot.Width(); hig=rcPlot.Height();
int ptsize=3;
int ptsize2=5;
CPen pen_red,pen_blue,pen_green,pen_back,*pOld;
pen_red.CreatePen(PS_SOLID, 2, RGB(255, 0, 0));
pen_blue.CreatePen(PS_SOLID, 1, RGB(0, 0, 255));
pen_green.CreatePen(PS_SOLID, 1, RGB(0, 255, 0));
pen_back.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
// all ones;
CIndividual *tmp=&m_indBestFit;
pOld=pDC->SelectObject(&pen_green);
double dx=wid/m_nChromSize;
for (j=0;j<m_nPopSize;j++)
{
tmp=&m_popSpace[j]; for (i=0;i<m_nChromSize;i++)
{
CRect rcPt;
rcPt.top=rcPlot.bottom-tmp->dblChrom[i]*hig-ptsize-1;
rcPt.bottom=rcPlot.bottom-tmp->dblChrom[i]*hig+ptsize;
rcPt.left=rcPlot.left+dx*(i+0.5)-ptsize;
rcPt.right=rcPlot.left+dx*(i+0.5)+ptsize;
pDC->Ellipse(rcPt);
}
}
pDC->SelectObject(&pen_red);
//original one
262
for (i=0;i<m_nChromSize;i++)
{
double xl,xr,y;
y=rcPlot.bottom-m_indAimed.dblChrom[i]*hig;
xl=rcPlot.left+dx*(i+0.5)-ptsize2;
xr=rcPlot.left+dx*(i+0.5)+ptsize2; pDC->MoveTo(xl,y);
pDC->LineTo(xr,y);
}
// best one;
pDC->SelectObject(&pen_blue);
for (i=0;i<m_nChromSize;i++)
{
CRect rcPt;
rcPt.top=rcPlot.bottom-m_indBestFit.dblChrom[i]*hig-ptsize2;
rcPt.bottom=rcPlot.bottom-m_indBestFit.dblChrom[i]*hig+ptsize2;
rcPt.left=rcPlot.left+dx*(i+0.5)-ptsize2;
rcPt.right=rcPlot.left+dx*(i+0.5)+ptsize2;
pDC->MoveTo(rcPt.TopLeft());
pDC->LineTo(rcPt.BottomRight()); CPoint pt1=rcPt.TopLeft();
pt1.Offset(rcPt.Width(),0);
CPoint pt2=rcPt.BottomRight();
pt2.Offset(-rcPt.Width(),0);
pDC->MoveTo(pt1);
pDC->LineTo(pt2);
}
pDC->SelectObject(pOld);
}
HANDLE CGACalculator::hMutex=NULL;
void CGACalculator::RunGACalculation()
{ GAInitialization();
switch (m_nGACalType)
{
case 0:
SGAInitPopulation();
SGACreateTmpDataFiles();
SGACalculation();
break;
case 1:
default:
MPGAInitPopulation(); // initial population;
CreateTmpDataFiles(); // create temporary file;
MPGACalculation();
263
}
}
void CGACalculator::SGACalculation()
{
int i,j;
sGAData *pGAData;
pGAData= new sGAData[m_nSGAPopSize];
hMutex=CreateMutex(NULL, FALSE, NULL);
CTime time;
CString strTime;
time=CTime::GetCurrentTime();
strTime=time.Format("%Y-%m-%d %H:%M:%S");
((CResLMApp*)AfxGetApp())->AddStringFmt(LM_TOPVIEW,"--- Simple Genetic Algorithm
Begins ---\r\n at %s\r\n",strTime);
((CResLMApp*)AfxGetApp())->AddStringFmt(LM_TOPVIEW,"Total
Population: %d\r\n",m_nSGAPopSize);
((CResLMApp*)AfxGetApp())->AddStringFmt(LM_TOPVIEW,"Total
Generation: %d\r\n\r\n",m_nSGAMaxGen);
((CResLMApp*)AfxGetApp())->AddStringFmt(LM_TOPVIEW,"Crossover
rate: %g\r\n\r\n",m_pcross);
((CResLMApp*)AfxGetApp())->AddStringFmt(LM_TOPVIEW,"Mutation rate: %g\r\n\r\n",m_pmutation);
fprintf(fpout,"--- Simple Genetic Algorithm Begins ---\r\n at %s\r\n",strTime);
fprintf(fpout,"Total Population: %d\r\n",m_nSGAPopSize);
fprintf(fpout,"Total Generation: %d\r\n\r\n",m_nSGAMaxGen);
fprintf(fpout,"Crossover rate: %g\r\n\r\n",m_pcross);
fprintf(fpout,"Mutation rate: %g\r\n\r\n",m_pmutation);
HANDLE *hThread;
hThread=new HANDLE[m_nSGAPopSize];
for (j=0;j<m_nSGAMaxGen;j++)
{
// LMOUTPUT(LM_TOPVIEW,"Generation %d\r\n",j+1);
for (i=0;i<m_nSGAPopSize;i++)
{ pGAData[i].idx =i;
pGAData[i].pGA=this;
SGARearrange(&m_popSpace[i]);
hThread[i] = CreateThread(NULL, 0, CalSingleIndividual, &pGAData[i],
CREATE_SUSPENDED , NULL);
SetThreadPriority(hThread[i], THREAD_PRIORITY_BELOW_NORMAL);
ResumeThread(hThread[i]);
}
//wait for multithread over;
int tempNumThreads = m_nSGAPopSize;
int tempMax = 0;
while( tempNumThreads >= MAXIMUM_WAIT_OBJECTS )
264
{
tempNumThreads -= MAXIMUM_WAIT_OBJECTS;
WaitForMultipleObjects(MAXIMUM_WAIT_OBJECTS, &hThread[tempMax],
TRUE, INFINITE);
tempMax += MAXIMUM_WAIT_OBJECTS;
}
WaitForMultipleObjects(tempNumThreads, &hThread[tempMax], TRUE, INFINITE); double fit=0;
for (i=0;i<m_nSGAPopSize;i++)
{
CloseHandle(hThread[i]);
m_popSpace/**/[i].fitness=pGAData[i].fitness;
fit+=m_popSpace/**/[i].fitness;
if (m_indBestFit.fitness<m_popSpace/**/[i].fitness)
{
m_indBestFit=m_popSpace/**/[i];
m_indBestFit.gen=j+1;
}
}
((CResLMApp*)AfxGetApp())->AddStringFmt(LM_TOPVIEW,"Best Result: %lf\r\n",
m_indBestFit.fitness);
((CResLMApp*)AfxGetApp())->AddStringFmt(LM_TOPVIEW,"The best individual found : %d
generation %lf\r\n",m_indBestFit.gen, m_indBestFit.fitness);
((CResLMApp*)AfxGetApp())->AddStringFmt(LM_TOPVIEW,"Average : %lf \r\n", fit/m_nSGAPopSize);
fprintf(fpout,"Best Result: %lf\r\n", m_indBestFit.fitness);
fprintf(fpout,"The best individual found : %d generation %lf\r\n",m_indBestFit.gen,
m_indBestFit.fitness);
fprintf(fpout,"Average : %lf \r\n", fit/m_nSGAPopSize);
for(int m =0;m<m_nChromSize/2;m++)
{
SRpData rpd;
double maxx=powl(2.0,sizeof(CHTYPE)*8);
rpd.sw=m_RpDataBody->m_RpData[m].sw;
rpd.pc=m_RpDataBody->m_RpData[m].pc;
/*rpd.kro=1;rpd.krw=1;
for (int k=0;k<m+1;k++)
{ rpd.kro*=bestfit.chrom[k]/maxx;
}
for (k=m;k<m_nChromSize/2;k++)
{
rpd.krw*=bestfit.chrom[k+m_nChromSize/2]/maxx;
}*/
rpd.kro=m_indBestFit.byteChrom[m]/maxx;
rpd.krw=m_indBestFit.byteChrom[m+m_nChromSize/2]/maxx;
((CResLMApp*)AfxGetApp())-
>AddStringFmt(LM_TOPVIEW,"%lf\t%lf\t%lf\t%lf\r\n",rpd.sw,rpd.kro,
rpd.krw,rpd.pc);
fprintf(fpout,"%lf\t%lf\t%lf\t%lf\r\n",rpd.sw,rpd.kro,
265
rpd.krw,rpd.pc);
}
SGAGeneration();
for (i=0; i<m_nSGAPopSize; i++) {
m_popSpace/**/[i]=newpop[i];
}
SGACreateTmpDataFiles();
}
fprintf(fpout,"Genetic Algorithm Done!\r\n");
time=CTime::GetCurrentTime();
strTime=time.Format("%Y-%m-%d %H:%M:%S");
fprintf(fpout,"\r\n--- Genetic Algorithm Done! ---\r\n at %s\r\n",strTime);
delete [] pGAData;
delete [] hThread;
}
void CGACalculator::SGAGeneration() {
int mate1,mate2,jcross,j=0;
SGASumfit();
do
{
mate1=SGASelection();
mate2=SGASelection();
jcross=SGACrossOver(m_popSpace/**/[mate1].byteChrom,m_popSpace/**/[mate2].byteChrom,newpop[j].
byteChrom,newpop[j+1].byteChrom);
SGAMutation(newpop[j].byteChrom);
SGAMutation(newpop[j+1].byteChrom);
newpop[j].parent[0]=mate1+1;
newpop[j].parent[1]=mate2+1;
newpop[j+1].parent[0]=mate1+1;
newpop[j+1].parent[1]=mate2+1;
newpop[j+1].gen=newpop[j].gen=m_nCurGen; j=j+2;
}
while (j<(m_nSGAPopSize-1));
}
int CGACalculator::SGASelection() //иöÌåÑ¡Ôñ³ÌÐò
{
double sum,pick;
int i;
pick=RandVal();
sum=0;
if (m_sumfitness!=0)
{
266
for (i=0; (sum<pick)&&(i<m_nSGAPopSize); i++)
{
sum+=m_popSpace/**/[i].fitness/m_sumfitness;
}
}
else
{ i=int(RandVal()*double(m_nSGAPopSize));
}
return(i-1);
}
//ÓÉÁ½¸ö¸¸¸öÌå²úÉúÁ½¸ö×Ó¸öÌå
int CGACalculator::SGACrossOver(CHTYPE *parent1, CHTYPE *parent2,CHTYPE *child1,CHTYPE
*child2)
{
int j,k;
CHTYPE jcross;
CHTYPE mask,temp;
if (RandVal()<=m_pcross) //
{
jcross=RandVal(1,m_nLenChrom-1); //
{ if (jcross>=(k*(8*sizeof(CHTYPE))))
{
child1[k-1]=parent1[k-1];
child2[k-1]=parent2[k-1];
}
else
{
if ((jcross<(k*8*sizeof(CHTYPE)))&&(jcross>((k-1)*8*sizeof(CHTYPE))))
{
mask=1;
for (j=1; j<=(int)(jcross-1-(k-1)*(8*sizeof(CHTYPE))); j++)
{
temp=1;
mask=mask<<1;
mask=mask|temp;
}
child1[k-1]=((parent1[k-1])&mask)|((parent2[k-1])&(~mask)); child2[k-1]=((parent1[k-1])&(~mask))|((parent2[k-1])&mask);
}
else
{
child1[k-1]=parent2[k-1];
child2[k-1]=parent1[k-1];
}
}
}
}
else
{
for (k=0; k<m_nChromSize; k++)
267
{
child1[k]=parent1[k];
child2[k]=parent2[k];
}
jcross=0;
}
return(jcross); }
void CGACalculator::SGAMutation(CHTYPE* child) //
{
int j,k,stop;
CHTYPE mask,temp=1;
for (k=0; k<m_nChromSize; k++)
{
mask=0;
if (k==m_nChromSize-1)
{
stop=m_nLenChrom-(k*(8*sizeof(CHTYPE)));
}
else
{
stop=8*sizeof(CHTYPE);
} for (j=0; j<stop; j++)
{
if (RandVal()<=m_pmutation)
{
mask=mask|(temp<<j);
child[k]=(child[k])^(mask);
}
}
}
}
void CGACalculator::SGASumfit()
{
int j=0;
m_sumfitness=0;
for (j=0; j<m_nSGAPopSize; j++)
{
m_sumfitness=m_sumfitness+m_popSpace/**/[j].fitness; }
}
void CGACalculator::SGACreateTmpDataFiles()
{
FILE * fp;
int i,j;
double maxx=powl(2.0,sizeof(CHTYPE)*8)-1;
//create temporary file
char curDir[MAX_PATH];
strcpy(curDir,m_strCurPath);
strcat(curDir,".lmrst");
fp=fopen(curDir,"w");
268
// m_RpData.OutData(fp);
//rel perm data
fprintf(fp,"KRD %d\n",m_nChromSize/2);
for(i=0;i<m_nSGAPopSize;i++)
{
for(j=0;j<m_nChromSize/2;j++) {
SRpData rpd;
rpd.sw=m_RpDataBody->m_RpData[j].sw;
rpd.pc=m_RpDataBody->m_RpData[j].pc;
rpd.kro=m_popSpace/**/[i].byteChrom[j]/maxx;
rpd.krw=m_popSpace/**/[i].byteChrom[j+m_nChromSize/2]/maxx;
fprintf (fp,"%lf\t%lf\t%lf\t%lf\n",rpd.sw,rpd.kro, rpd.krw,rpd.pc);
}
}
fclose(fp);
}
void CGACalculator::SGARearrange(CIndividual *critter)
{
CHTYPE *var=critter->byteChrom;
int i; for (i=0; i<m_nChromSize/2; i++)
{
CHTYPE tmp;
for (int j=i; j<m_nChromSize/2; j++)
{
if (var[j]>var[i])
{
tmp=var[i];
var[i]=var[j];
var[j]=tmp;
}
}
}
for (i=m_nChromSize/2; i<m_nChromSize; i++)
{
CHTYPE tmp; for (int j=i; j<m_nChromSize; j++)
{
if (var[j]<var[i])
{
tmp=var[i];
var[i]=var[j];
var[j]=tmp;
}
}
}
double maxx=powl(2.0,sizeof(CHTYPE)*8)-1;
for (i=0;i<m_nChromSize;i++)
269
{
critter->dblChrom[i]=critter->byteChrom[i]/maxx;
}
}
void CGACalculator::GAInitialization()
{ int i;
LMOUTPUTCLEAR(LM_TOPVIEW);
LMOUTPUTCLEAR(LM_BOTTOMVIEW);
srand((long)time(NULL)); // change randomize seed;
// Calculation of Chromosome Size
if(m_RpDataBody->m_nRpInteType==KR_TYPE_COREY)
{
m_nChromSize=NUM_COREY_VAR;
for (i=0;i<m_nChromSize;i++)
m_indAimed.dblChrom[i]=m_RpDataBody->m_fRpCoreyCtrl[i];
}
else
{
m_nChromSize = m_RpDataBody->m_nRpCount*2;
for (i=0;i<m_nChromSize/2;i++) {
m_indAimed.dblChrom[i]=m_RpDataBody->m_RpData[i].kro;
m_indAimed.dblChrom[i+m_nChromSize/2]=m_RpDataBody-
>m_RpData[i].krw;
}
}
// outputfile
CString curOutDir=m_strCurPath+".lmout"; //create restart file
//rel perm data
fpout=fopen(curOutDir,"w");
}
void CGACalculator::SpeedUp()
{
bSpeedUp=!bSpeedUp;
}
270
A-5 Class for Tube-bundle Modeling
// DITBM.h: interface for the CDITBM class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DITBM_H__679659F8_770C_4CB0_A192_26E1AFBD76DA__INCLUDED_)
#define AFX_DITBM_H__679659F8_770C_4CB0_A192_26E1AFBD76DA__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#include "math.h"
#define PI 3.1415926
class CDITBM
{
public:
CDITBM();
virtual ~CDITBM();
public:
int nTotal; //Total Tube Number
double dLength; //Tube Length
int iStart, iEnd; //Starting and Ending Tube Index;
double dt; //Time Step
double dInitStep; //Initial positioning step
int tMax;
long nTimeStep; int nTimeTotal;
double fQTotal;
FILE * fout_His;
FILE * fout_Tubes;
double coef_x;
double sigma; //Interface Tension
double visw; //Wetting phase viscosity
double viso; //Nonwetting phase viscosity
double pin,pinl, pout; //Inlet and outlet pressure
double *dRadius; //Pointer to tube radius
double *pc; //Pointer to capillary pressure
double *lenLeft;
double *lenRight;//Left and right interface positions
int pw; //Debugging parameter
public:
void CreateTubeRadius(int iType, double * r, double parameter[]);
void start(); //Start Simulation
void initialization(); //initialization
void iteration(int iBegin, int nLeft, int nRight, double * lenLeft, double * lenRight);//calculation
void GaussJ(double *a, int n, double *b);
271
};
#endif // !defined(AFX_DITBM_H__679659F8_770C_4CB0_A192_26E1AFBD76DA__INCLUDED_)//
DITBM.cpp: implementation of the CDITBM class.
// Shengdong Wang
// Implementation of Tube bundle model // Limitation: Solve Saturation Explicitly Cause Lots of Convergence Problem
// The model should be change to full implicite model.
// All units are international standard
////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "ditbm.h"
#include "stdarg.h"
#include "limits.H"
#include "string.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
char fn[30]="S3_30";
CDITBM::CDITBM() {
// Numerical parameters
dt=0.0001;
tMax=LONG_MAX;
nTimeTotal=0;
nTimeStep=long(1.0/dt+1);
pin=13781;
pinl=6898;
pout=0;
fQTotal=0;
// Tube Configuration
nTotal=100;
pw=4;
sigma=0.004184285; // kerosene visw=1.77e-3;
viso=1e-3;
dLength=0.01;
dInitStep=0;
//member variance initialization
dRadius=new double [nTotal];
pc= new double [nTotal];
lenLeft = new double [nTotal];
lenRight = new double [nTotal];
}
272
CDITBM::~CDITBM()
{
delete [] dRadius;
delete [] pc;
delete [] lenRight;
delete [] lenLeft;
}
void CDITBM::start()
{
// initialization
initialization();
// open files
if((fout_Tubes=fopen(strcat(fn,"_Tubes.txt"),"w"))==NULL)
printf("Output File open failed!\n");
if((fout_His=fopen(strcat(fn,"_His.txt"),"w"))==NULL)
printf("Output File open failed!\n");
/*
// print to screen
printf("Modeling of multistep drainage using interactive tube bundle model:\n\n");
printf("Total tubes: %d\n", nTotal);
printf("IFT: %g\n",sigma); printf("Inlet Pressure: from %g to %g\n",pinl,pin);
printf("Outlet Pressure: %g\n",pout);
printf("Tube invaded: from %d to %d\n", iStart+1,iEnd+1);
printf("\n");
*/
// print to file out_tubes.txt
fprintf(fout_Tubes,"%d\t:Tubes\n", nTotal);
fprintf(fout_Tubes,"%g\t:IFT\n",sigma);
fprintf(fout_Tubes,"%g\t:Original Inlet Pressure\n",pinl);
fprintf(fout_Tubes,"%g\t:New Inlet Pressure\n",pin);
fprintf(fout_Tubes,"%g\t:Outlet Pressure\n",pout);
fprintf(fout_Tubes,"%d\t:Tube invaded from\n", iStart+1);
fprintf(fout_Tubes,"%d\t:Tube invaded to\n", iEnd+1);
fprintf(fout_Tubes,"\n");
fprintf(fout_Tubes,"%-10s\t%-10s\t%-10s\n","ID", "Radius","Pc");
for (int i=0;i<nTotal;i++) {
fprintf(fout_Tubes,"%-10d\t%-10g\t%-10g\n",i+1,dRadius[i],pc[i]);
}
fprintf(fout_Tubes,"\n");
fflush(fout_Tubes);
// iteration, calculation, this is the main function
iteration(iStart, 1, 1, lenLeft, lenRight);
// output and close files
fprintf(fout_Tubes,"Calculation done\n");
fclose(fout_His);
fclose(fout_Tubes);
273
}
void CDITBM::initialization()
{
iEnd =0;
iStart =nTotal;
nTimeTotal=0; //nCount, dmax,dmin,daver
double p[]={8e-6,1e-6,30e-6};
//CreateTubeRadius(2,dRadius,p);
//CreateTubeRadius(1,dRadius,p);
CreateTubeRadius(4,dRadius,p);
for (int i=0;i<nTotal;i++)
{
pc[i]=sigma*2/dRadius[i];
if(pinl-pout>pc[i]) iStart=i+1;
if(pin-pout>pc[i]) iEnd=i;
}
lenLeft [0] = dInitStep;
lenRight [0] = dInitStep;
}
void CDITBM::iteration(int iBtTube, int nLeft, int nRight, double * lenLeft, double * lenRight)
{ int nEq;
int i,j;
double * R1,* R2;
double * pcTube;
double * qo;
double * aa;
double * ax;
double * xx;
nEq=nLeft+nRight+1;
R1= new double[nEq];
R2= new double[nEq];
pcTube = new double [nEq-1];
xx = new double [nEq];
qo= new double [nEq]; aa= new double [nEq*nEq+nEq];
ax= new double [nEq*nEq+nEq];
//coeffiect
for (i=0;i<nLeft+1;i++)
{
double sum=0;
for (j=0;j<iBtTube+nLeft-i;j++) {
sum+= pow(dRadius[j],pw)/viso*PI/8;
}
R1[i]=sum;
274
sum=0;
for (j=nTotal-1;j>=iBtTube+nLeft-i;j--)
{
sum+=pow(dRadius[j],pw)/visw*PI/8;
}
R2[i]=sum;
}
for (i=0;i<nRight;i++)
{
double sum=0;
for (j=0;j<iBtTube+nRight-i;j++)
{
sum+=pow(dRadius[j],pw)/viso*PI/8;
}
R1[nEq- i -1]=sum;
sum=0;
for (j=nTotal-1;j>=iBtTube+nRight-i;j--)
{
sum+=pow(dRadius[j],pw)/visw*PI/8;
}
R2[nEq- i -1]=sum; }
// PC
for (i=0;i<nLeft;i++)
pcTube[i]=pc[iBtTube+nLeft-i-1];
for (i=0;i<nRight;i++)
pcTube[i+nLeft]=pc[iBtTube+i];
memset(aa,0,(nEq+1)*nEq*sizeof(double));
*(aa+nEq)=pin*R1[0];
for (i=1;i<nLeft+nRight;i++)
*(aa+(nEq+1)*(i+1)-1) = -(pcTube[i-1]-pcTube[i])*R2[i];
*(aa+nEq*nEq+nEq-1)=-(pout+pcTube[nEq-2])*R2[nEq-1];
//////////////////////////////////////////////////////////////////////////
*aa=R1[0];
for (i=1;i<nEq-1;i++)
{
*(aa+i*(nEq+1)+i-1)=-(R1[i]+R2[i]);
*(aa+i*(nEq+1)+i)=(R1[i]+R2[i]);
}
*(aa+nEq*nEq+nEq-3)=- R2[nEq-1];
for (int t=0;t<tMax;t++)
275
{
//////////////////////////////////////////////////////////////////////////
// coefficients
//////////////////////////////////////////////////////////////////////////
*(aa+nEq-1) = lenLeft[0];
for (i=1;i<nLeft;i++)
*(aa+(nEq+1)*(i+1)-2)=lenLeft[i]-lenLeft[i-1];
*(aa+(nLeft+1)*(nEq+1)-2) = dLength - lenLeft[nLeft-1]-lenRight[nRight-1];
for (i=1;i<nRight;i++)
*(aa+(nEq+1)*(i+nLeft+1)-2)=lenRight[nRight-i]-lenRight[nRight-i-1];
*(aa+nEq*nEq+nEq-2) = lenRight[0];
// ax
memcpy(ax,aa,nEq*(nEq+1)*sizeof(double));
//xx
GaussJ(ax,nEq,xx);
//////////////////////////////////////////////////////////////////////////
qo[0]=xx[nEq-1];
for (i=1;i<nEq-1;i++)
{
qo[i]=(xx[i-1]-xx[i])*R1[i]/(*(aa+(nEq+1)*(i+1)-2));
}
qo[nEq-1]=0;
for (i=0;i<nLeft;i++)
{
lenLeft[i]=lenLeft[i]+(qo[i]-qo[i+1])/pow(dRadius[iBtTube+nLeft-i-1],2)/PI*dt;
}
for (i=0;i<nRight;i++)
{
lenRight[i]=lenRight[i]+(qo[nEq-i-2]-qo[nEq-i-
1])/pow(dRadius[iBtTube+nRight-i-1],2)/PI*dt;
}
if(t%nTimeStep==0)
{
bool bOut=false;
printf("TIME:\t%g\t%g\t%g\n",(nTimeTotal)*dt,qo[0],fQTotal);
fprintf(fout_His,"TIME:\t%g\t%g\t%g\n",(nTimeTotal)*dt,qo[0],fQTotal);
fprintf(fout_Tubes,"%d\t%d\t",iBtTube,nLeft);
for (i=0;i<nLeft;i++)
{
fprintf(fout_Tubes,"%g\t",lenLeft[nLeft-i-1]);
if (lenLeft[nLeft-i-1]<0) bOut=true;
}
fprintf(fout_Tubes,"\n");
276
fprintf(fout_Tubes,"%d\t%d\t",iBtTube,nRight);
for (i=0;i<nRight;i++)
{
fprintf(fout_Tubes,"%g\t",lenRight[nRight-i-1]); if (lenRight[nRight-i-1]<0) bOut=true;
}
fprintf(fout_Tubes,"\n");
if (bOut)
{
fprintf(fout_Tubes,"Error!\n");
printf("Error!\n");
}
}
nTimeTotal++;
fQTotal+=qo[0]*dt;
int iUnThrough = iBtTube+nLeft;
int iThrough = iUnThrough-1;
if (pc[iUnThrough]-pc[iThrough]<pin-xx[0])
{
char pos[]="left";
fprintf(fout_Tubes,"Oil break through at %g\t",nTimeTotal*dt);
fprintf(fout_Tubes,"Section: %s\t",pos);
fprintf(fout_Tubes,"Tube Index: %d\n", iUnThrough);
for (i=nLeft;i>0;i--)
lenLeft[i]=lenLeft[i-1];
lenLeft[0]=dInitStep;
nLeft++;
iteration( iBtTube, nLeft, nRight, lenLeft, lenRight);
break;
}
//right
iUnThrough=iBtTube+nRight;
iThrough=iUnThrough-1;
if (pc[iUnThrough]<xx[nEq-2]-pout)
{
char pos[]="right";
fprintf(fout_Tubes,"Oil break through at %g s\t",nTimeTotal*dt);
fprintf(fout_Tubes,"Section: %s\t",pos);
fprintf(fout_Tubes,"Tube Index: %d\n", iUnThrough);
for (i=nRight;i>0;i--)
277
lenRight[i]=lenRight[i-1];
lenRight[0]=dInitStep;
nRight++;
iteration( iBtTube, nLeft, nRight, lenLeft, lenRight);
break;
}
// merge
if (dLength-lenLeft[nLeft-1]-lenRight[nRight-1]<0)
{
fprintf(fout_Tubes,"tube %d merges at %g\n",iBtTube+1,nTimeTotal*dt);
if (iEnd-iBtTube==0) // last tube merges, calculation done!
break;
else{
iBtTube++; nLeft--;nRight--;
if (nLeft==0)
{
nLeft=1;
lenLeft[0]=dInitStep;
}
if (nRight==0)
{
nRight=1; lenRight[0]=dInitStep;
}
iteration( iBtTube, nLeft, nRight, lenLeft, lenRight);
break;
}
}
}
delete []R1;
delete []R2;
delete []pcTube;
delete []qo;
delete []aa;
delete []ax;
delete []xx;
};
void CDITBM::GaussJ(double *c, int n, double *x)
{
int i,j,t,k;
double p;
for( i=0;i<=n-2;i++)
{
k=i;
for(j=i+1;j<=n-1;j++)
if(fabs(*(c+j*(n+1)+i))>(fabs(*(c+k*(n+1)+i))))
k=j;
278
if(k!=i)
for( j=i;j<=n;j++ )
{
p=*(c+i*(n+1)+j);
*(c+i*(n+1)+j)=*(c+k*(n+1)+j);
*(c+k*(n+1)+j)=p;
} for( j=i+1;j<=n-1;j++ )
{
p=(*(c+j*(n+1)+i))/(*(c+i*(n+1)+i));
for( t=i;t<=n;t++ )
*(c+j*(n+1)+t)-=p*(*(c+i*(n+1)+t));
}
}
for( i=n-1;i>=0;i--)
{
for(j=n-1;j>=i+1;j--)
(*(c+i*(n+1)+n))-=x[j]*(*(c+i*(n+1)+j));
x[i]=*(c+i*(n+1)+n)/(*(c+i*(n+1)+i));
}
}
void CDITBM::CreateTubeRadius(int iType, double * r, double para[]) {
int i;
double daver = para[0];
double dmin= para[1];
double dmax= para[2];
switch(iType)
{
case 1: //dmin dmax 0-1
{
for (i=0;i<nTotal;i++)
{ r[i]=dmax-(dmax-dmin)/(nTotal-1)*(i);
}
break;
}
case 2: //truncated weibull
{
double Fxmax =1-exp(-pow((dmax-dmin)/(daver-dmin),2));
double dx=Fxmax/nTotal;
for (i=0;i<nTotal;i++)
{
double Fx=dx/2+i*dx;
r[nTotal-i-1]=dmin+(daver-dmin)*sqrt(-log(1-Fx));
}
279
break;
}
case 3: //weibull
{
double dx=1.0/nTotal; for (i=0;i<nTotal;i++)
{
double Fx=dx/2+i*dx;
r[nTotal-i-1]=daver*sqrt(-log(1-Fx))+1;
}
break;
}
case 4: //self-defined
{
FILE *fp = fopen(strcat(fn,".txt"),"r");
fscanf(fp,"%d",&nTotal);
for (i=0;i<nTotal;i++)
{
fscanf(fp,"%lf",&r[i]);
printf("%g\n",r[i]); }
fclose(fp);
}
}
}