<<

ACCELERATED PERTURBATION BOUNDARY ELEMENT MODEL FOR FLOW PROBLEMS IN HETEROGENEOUS RESERVOIRS

a dissertation submitted to the department of petroleum and the committee on graduate studies of stanford university in partial fulfillment of the requirements for the degree of doctor of philosophy

By Kozo Sato June 1992 c Copyright 1992 by Kozo Sato All Rights Reserved

ii I certify that I have read this thesis and that in my opin- ion it is fully adequate, in scope and in quality, as a dissertation for the degree of Doctor of Philosophy.

Roland N. Horne (Principal Adviser)

I certify that I have read this thesis and that in my opin- ion it is fully adequate, in scope and in quality, as a dissertation for the degree of Doctor of Philosophy.

Khalid Aziz

I certify that I have read this thesis and that in my opin- ion it is fully adequate, in scope and in quality, as a dissertation for the degree of Doctor of Philosophy.

Henry J. Ramey, Jr.

Approved for the University Committee on Graduate Studies:

Dean of Graduate Studies

iii Abstract

The boundary element method (BEM), successfully applied to fluid flow problems in porous media, owes its elegance, the computational efficiency and accuracy, to the existence of the fundamental solution (free-space Green’s function) for the governing equation. If there is no such solution in a closed form, the BEM cannot be applied, and, unfortunately, this is the case for flow problems in heterogeneous media. To overcome this difficulty, the governing equation is decomposed into various order perturbation equations, for which the free-space Green’s function can be found. At each level of perturbation, the solution is computed by the BEM and the sum- mation of various order perturbation solutions gives the complete solution for the original governing equation. The convergence of the perturbation series depends on the distance to the nearest singularity inherent in the equation. A greater magnitude of heterogeneity makes this distance shorter, and, hence, the rate of convergence becomes slower and eventually the series diverges. However, it is possible to elicit a significant amount of information from the perturbation series and to recover an accurate approximation to the exact solution. To this end, Pad´e approximants are employed to accelerate the rate of convergence of a slowly convergent series and to convert a divergent series into a convergent series. Two kinds of perturbation boundary element models are developed: one for steady-state flow problems, associated with the Laplace operator and the other for transient flow problems, associated with the modified Helmholtz operator in Laplace space. These models are verified against analytical solutions for simplified problems and are utilized to solve various application problems.

iv The perturbation BEM shows its utility in streamline tracking and well testing problems in heterogeneous media. The analytical nature of the solution is well pre- served through the free-space Green’s function methodologically and through the singularity programming technically. The durability of the model to rapid spatial variability in rock properties is established by using Pad´e approximants. Through the verification and application problems, it is observed that if the av- erage property value within a drainage area is not much different from the near-well property value, heterogeneity has little effect on pressure responses. The perturbation forms for steady-state and transient flow equations derived in this study should be of value in formulating any semi-analytical scheme.

v Acknowledgement

This dissertation leaves me greatly indebted to Professor Roland N. Horne, my prin- cipal advisor, for his advice, guidance, and encouragement during the course of this research. I wish to express my appreciation to Professor Khalid Aziz, my M.S. re- search supervisor, who encouraged me to come back to Stanford. Sincere thanks are due to Professor Henry J. Ramey, Jr., who served on the reading committee, and Professors Thomas A. Hewett and William E. Brigham, who participated in the examination committee. Appreciation is extended to Professor Joseph B. Keller of the Department of Mathematics who helped me to broaden my understanding of perturbation methods. I appreciate Dr. Michael F. Riley for sharing his insights and knowledge of per- turbation methods. Chick Wattenbarger, Santosh Verma, and Cesar Palagi helped me in preparing this dissertation. Many other colleagues were more helpful than they realized. Being a teaching assistant, I gained a flexible thinking about boundary element methods through their questions. Financial support for this work was provided by Teikoku Oil Company (TOC) and Japan National Oil Corporation. My special gratitude goes to my colleagues of TOC for helping me to get academic leave.

vi This dissertation is dedicated to my parents, Hisashi and Shizu Sato

vii Contents

Abstract iv

Acknowledgement vi

1 Introduction 1

2 Review of Literature 5 2.1 Boundary Element Method ...... 5 2.1.1 Indirect and Direct Methods ...... 6 2.1.2 Applications to Flow in Homogeneous Media ...... 7 2.1.3 Applications to Flow in Heterogeneous Media ...... 8 2.2 Perturbation Method ...... 10

3 Mathematical Preliminaries 12 3.1 Fluid Flow Equation ...... 12 3.1.1 Dimensionless Equations ...... 14 3.1.2 Laplace Space Formulation ...... 15 3.2 Green’s Function Method ...... 16 3.2.1 Laplace Operator ...... 17 3.2.2 Modified Helmholtz Operator ...... 19 3.3 Boundary Element Method ...... 21 3.3.1 Boundary Discretization ...... 22 3.3.2 Boundary Solutions ...... 25 3.3.3 Interior Solutions ...... 27

viii 3.4 Perturbation Method ...... 27 3.4.1 Steady-State Flow Problems ...... 29 3.4.2 Transient Flow Problems ...... 30 3.4.3 Convergence of Perturbation Series ...... 33 3.5 Improvement of Perturbation Series ...... 34 3.5.1 Analysis of Series ...... 34 3.5.2 Pad´e Approximants ...... 36

4 Development of a Steady-State Flow Model 40 4.1 Boundary Integral Equations ...... 40 4.2 Treatment of Wells ...... 43 4.2.1 Well Singularity ...... 43 4.2.2 Pressure Specified Wells ...... 44 4.3 Evaluation of Integrals ...... 45 4.3.1 Boundary Integrals ...... 45 4.3.2 Domain Integrals ...... 46 4.4 Evaluation of Pad´e Approximants ...... 50 4.5 Streamline Tracking ...... 51 4.5.1 Euler and Modified Euler Methods ...... 52 4.5.2 Displacement Performance ...... 54

5 Development of a Transient Flow Model 56 5.1 Boundary Integral Equations ...... 56 5.2 Treatment of Wells ...... 59 5.2.1 Well Singularity ...... 59 5.2.2 Pressure Specified Wells ...... 60 5.3 Evaluation of Integrals ...... 60 5.3.1 Boundary Integrals ...... 61 5.3.2 Domain Integrals ...... 63 5.4 Evaluation of Pad´e Approximants ...... 65 5.5 Transient Pressure Tests in Wells ...... 66 5.5.1 Well with Skin and Wellbore Storage ...... 66

ix 5.5.2 Pressure Derivatives ...... 68

6 Computational Procedures 69 6.1 Steady-State Flow Model ...... 70 6.2 Transient Flow Model ...... 75

7 Results and Discussion 81 7.1 Verification of the Steady-State Flow Model ...... 81 7.1.1 Effectiveness of Pad´e Approximants ...... 82 7.1.2 Reservoir of Harmonically Varying Permeability ...... 95 7.1.3 A Well in an Exponentially Heterogeneous Reservoir ..... 97 7.1.4 Effectiveness of Modified Euler Method ...... 104 7.2 Verification of the Transient Flow Model ...... 111 7.2.1 Optimal Number of Stehfest Sampling Times ...... 112 7.2.2 Reservoir of Harmonically Varying Permeability ...... 114 7.2.3 Reservoir of Varying ...... 118 7.2.4 Wells in an Exponentially Heterogeneous Reservoir ...... 118 7.2.5 Importance of Well-Singularity Treatment ...... 126 7.2.6 Effects of Skin and Wellbore Storage ...... 126 7.3 Application Problems ...... 131 7.3.1 Full-Field Problem ...... 131 7.3.2 Repeated Five-Spot Pattern ...... 138 7.3.3 Type Curves for Idealized Heterogeneities ...... 159

8 Conclusions and Recommendations 177

Nomenclature 181

Bibliography 185

A Dirac Delta Function 196

B Selected Theorems on Pad´e Approximants 200 B.1 Uniqueness Theorem ...... 200

x B.2 Invariance Theorems ...... 201

C Extra Evaluation of Influence Coefficients 204 C.1 Directional Derivatives ...... 204 C.2 Singular Integrals ...... 206

D Exact Solutions for Verification Problems 208 D.1 Wells in a Heterogeneous Reservoir ...... 208 D.1.1 Transient Pressure Solution ...... 208 D.1.2 Steady-State Pressure Solution ...... 212 D.2 Equidimensional Laplace-Space Equations ...... 212 D.2.1 Reservoir of Varying Permeability ...... 213 D.2.2 Reservoir of Varying Porosity ...... 214

E Multiple-Boundary Problems 216 E.1 Mathematical Considerations ...... 216 E.2 Results and Discussion ...... 218

F Input/Output Samples 230

G FORTRAN Code 244

xi List of Tables

7.1 Coefficients of Taylor series and perturbation series expansions. . . . 89 7.2 Comparison of perturbation BEM results and exact solutions for the flow problem in harmonically heterogeneous media...... 99 7.3 Boundary solutions for the right-angled wedge problem...... 107 7.4 Sensitivity of the perturbation BEM to the number of Stehfest sam- pling times...... 113 7.5 Comparison of pressure responses at (0.4,0.5) computed with and with- out the singularity programming...... 127 7.6 Comparison of pressure responses at (0.6,0.5) computed with and with- out the singularity programming...... 128 7.7 Parameters for the full-field problem...... 134 7.8 Comparison of well responses in a synthetic reservoir with and without variability in permeability...... 135 7.9 Parameters for the repeated five-spot pattern flooding...... 139

xii List of Figures

3.1 Local ξη coordinate system...... 24

4.1 Quadrature points and weights of four-point Gaussian quadrature. . . 48

6.1 Flow chart for the steady-state flow model...... 71 6.2 Flow chart for the transient flow model...... 76

7.1 Schematic configuration of the problems in Sections 7.1.1 and 7.2.1-3. 83 7.2 Comparison of perturbation BEM results and exact solutions for the

steady-state flow problems with k = exp(xD) and k = exp(3xD). . . . 84 7.3 Error profiles of 40- and 80-node discretizations for the steady-state

flow problem with k = exp(3xD)...... 85 7.4 Various order perturbation solutions for the steady-state flow problems

with k = exp(5xD) and k = exp(7xD)...... 87 7.5 Locations of the nearest singularities for the steady-state flow problems

with k = exp(5xD) and k = exp(7xD)...... 88 7.6 Comparison of perturbation BEM results and exact solutions for the

steady-state flow problems with k = exp(5xD) and k = exp(7xD). . . 91 7.7 Error profiles of 40- and 80-node discretizations for the steady-state

flow problem with k = exp(7xD)...... 92 7.8 Various order Pad´e approximant solutions for the steady-state flow

problems with k = exp(7xD), k = exp(11xD), k = exp(15xD), and

k = exp(19xD)...... 96 7.9 Permeability variation given by Eq. 7.18 with a =3,b = 2, and c =1. 98

xiii 7.10 Schematic configuration of the problems in Sections 7.1.3 and 7.2.4. . 100 7.11 Comparison of perturbation BEM results and exact solutions for the

steady-state flow problem with k = exp{3(xD − xwD)}...... 101 7.12 Comparison of perturbation BEM results and exact solutions for the

steady-state flow problem with k = exp{5(xD − xwD)}...... 102 7.13 Comparison of perturbation BEM results and exact solutions for the

steady-state flow problem with k = exp{7(xD − xwD)}...... 103 7.14 Schematic configuration of the right-angled wedge problem...... 106 7.15 Streamlines tracked with (a) regular elements and (b) singular elements for the right-angled wedge problem, the Euler method...... 108 7.16 Streamlines tracked with (a) regular elements and (b) singular elements for the right-angled wedge problem, the modified Euler method. . . . 109 7.17 Effects of Δθ on (a) computational effort and (b) computational accu- racy for the right-angled wedge problem...... 110 7.18 Comparison of BEM results and exact solutions for the one-dimension-

al transient flow problem with nst =8...... 115 7.19 Comparison of perturbation BEM results and exact solutions for the 2 transient flow problem with k =(1+xD) ...... 116 7.20 Comparison of perturbation BEM results and exact solutions for the 2 transient flow problem with k =(1+5xD) ...... 117 7.21 Comparison of perturbation BEM results and exact solutions for the −2 transient flow problem with φ =(1+xD) ...... 119 7.22 Comparison of BEM results and exact solutions for transient pressure responses at wells in a homogeneous reservoir...... 121 7.23 Comparison of perturbation BEM results and exact solutions for tran- sient pressure responses at wells in an exponentially heterogeneous reservoir...... 122 7.24 Comparison of BEM results and exact solutions for pressure derivatives at wells in a homogeneous reservoir...... 124 7.25 Comparison of perturbation BEM results and exact solutions for pres- sure derivatives at wells in an exponentially heterogeneous reservoir. . 125

xiv 7.26 Comparison of BEM results and exact solutions for transient pressure

responses at a well with S = 0 and various CD’s...... 129 7.27 Comparison of BEM results and exact solutions for transient pressure

responses at a well with S = 20 and various CD’s...... 130 7.28 Configuration of the full-field problem...... 133 7.29 Displacement profiles after 0.2 PV of injection with the permeability variation ignored (left) and honored (right)...... 136 7.30 Displacement profiles after 0.5 PV of injection with the permeability variation ignored (left) and honored (right)...... 137 7.31 Pressure responses at injection and production wells in a homogeneous repeated five-spot pattern...... 140 7.32 Streamlines and tracer fronts at breakthrough in a homogeneous re- peated five-spot pattern...... 143 7.33 Comparison of simulated tracer breakthrough curve and exact solution for a homogeneous repeated five-spot pattern...... 144 7.34 Tracer breakthrough curves simulated by ECLIPSE for a homogeneous repeated five-spot pattern...... 145 7.35 Permeability variation given by Eq. 7.47 with a = 22 and b =3.... 146 7.36 Streamlines and tracer fronts at breakthrough in a repeated five-spot pattern with the permeability variation given by Eq 7.47 with a =22 and b =3...... 147 7.37 Tracer breakthrough curve for a repeated five-spot pattern with the permeability variation given by Eq 7.47 with a = 22 and b =3..... 148 7.38 Pressure responses at injection and production wells in a repeated five- spot pattern with the permeability variation given by Eq 7.47 with a = 22 and b =3...... 150

7.39 Permeability variation given by k = exp(3xD)...... 152 7.40 Pressure responses at injection and production wells in a repeated five-

spot pattern with the permeability variation given by k = exp(3xD). . 153 7.41 Streamlines and tracer fronts at breakthrough in a repeated five-spot

pattern with the permeability variation given by k = exp(3xD). . . . 154

xv 7.42 Tracer breakthrough curve for a repeated five-spot pattern with the

permeability variation given by k = exp(3xD)...... 155

7.43 Permeability realization (No.1) for k50 = 10, σln(k) =0.7, and the range of300ft...... 157

7.44 Permeability realization (No.2) for k50 = 10, σln(k) =0.7, and the range of300ft...... 158 7.45 Pressure responses at injection and production wells in a repeated five- spot pattern with the permeability realization No.1...... 160 7.46 Pressure responses at injection and production wells in a repeated five- spot pattern with the permeability realization No.2...... 161 7.47 Streamlines and tracer fronts at breakthrough in a repeated five-spot pattern with the permeability realization No.1...... 162 7.48 Tracer breakthrough curve for a repeated five-spot pattern with the permeability realization No.1...... 163 7.49 Streamlines and tracer fronts at breakthrough in a repeated five-spot pattern with the permeability realization No.2...... 164 7.50 Tracer breakthrough curve for a repeated five-spot pattern with the permeability realization No.2...... 165 7.51 The linear variation in porosity (above) and the permeability variation given by the Kozeny-Carman equation (below)...... 167 7.52 Type curve for a single well in a square flow domain with the lin- ear variation in porosity and the permeability variation given by the Kozeny-Carman equation...... 168 7.53 The concave variation in porosity (above) and the permeability varia- tion given by the Kozeny-Carman equation (below)...... 169 7.54 Type curve for a single well in a square flow domain with the con- cave variation in porosity and the permeability variation given by the Kozeny-Carman equation...... 170 7.55 The convex variation in porosity (above) and the permeability variation given by the Kozeny-Carman equation (below)...... 172

xvi 7.56 Type curve for a single well in a square flow domain with the con- vex variation in porosity and the permeability variation given by the Kozeny-Carman equation...... 173 7.57 Type curve for a single well in a square flow domain with the concave variation in porosity...... 175 7.58 Type curve for a single well in a square flow domain with the permeabil- ity variation given by the Kozeny-Carman equation (for the concave variation in porosity)...... 176

A.1 δ sequence defined by Eq. A.6...... 197

D.1 Image-well location for a single well in the center of a square...... 211

E.1 Multiple-boundary system...... 217 E.2 Streamlines in a repeated five-spot pattern with an impermeable cen- tered circle...... 219 E.3 Streamlines in a repeated five-spot pattern with a constant-pressure centered circle...... 220 E.4 Streamlines in a repeated five-spot pattern with impermeable and constant-pressure circles...... 222 E.5 Streamlines in a repeated five-spot pattern with a N45W/S45E frac- ture, coarse discretization...... 223 E.6 Streamlines in a repeated five-spot pattern with a N/S fracture, coarse discretization...... 224 E.7 Dimensionless inward-flux distribution along the N/S fracture, coarse discretization...... 226 E.8 Dimensionless inward-flux distribution along the N/S fracture, fine dis- cretization...... 227 E.9 Streamlines in a repeated five-spot pattern with a N/S fracture, fine discretization...... 228 E.10 Streamlines in a repeated five-spot pattern with a N/S off-centered fracture...... 229

xvii Chapter 1

Introduction

Numerical techniques for solving partial differential equations describing various phys- ical processes can be categorized into two distinct classes: the domain methods and the boundary methods. Finite difference and finite element methods fall in the first class, and boundary element methods constitute the second. The domain meth- ods have enjoyed much popularity and have been extensively used in the realm of , as they have in many other disciplines. Although the bound- ary element method is being accepted as a promising rival of domain methods in some areas such as electrostatics and elastostatics, it has not received the attention it deserves in the petroleum industry. While there may be peripheral reasons for this, of interest here are purely method- ological reasons. The principal differences between these two types of numerical schemes can be illustrated by comparing their advantages and disadvantages mani- fested when applied to fluid flow problems. The domain methods require the domain subdivision to evaluate the solution at the nodes or grid points. The solutions between these network nodes are expressed in an interpolated form in terms of the values at the nodes. A system of linear algebraic equations is constructed by relating the solutions at nodal locations to the partial differential equation governing fluid flow. This process is not restricted by the nature of the governing equation, and flow problems with nonlinearity and/or heterogeneous domain properties are well handled by the domain methods. The resulting system

1 CHAPTER 1. INTRODUCTION 2

of equations is large but sparse (usually banded), and this special structure of the solution matrix makes the solution amenable to fast matrix inversion algorithms. When applied to fluid flow problems, the domain methods suffer from numerical dispersion and grid orientation effects (Aziz and Settari, 1979) due to the domain dis- cretizations. They cause serious problems in forecasting displacement performances, and several attempts to alleviate these unfavorable phenomena have been reported. Among these are the nine-point finite difference scheme by Yanosik and McCracken (1979), the two-point upstream weighting by Todd et al. (1972), the harmonic to- tal mobility method by Vinsome and Au (1981), the flux limiter method by Sweby (1984), the flux corrected transport by Zalesak (1979), the total variation diminish- ing mid-point scheme by Rubin and Blunt (1991), the uniform hexagonal gridding by Pruess and Bodvarsson (1983), the orthogonal curvilinear gridding by Hirasaki and O’Dell (1970), and the perpendicular bisectors by Heinemann et al. (1991). However, none of these modifications can overcome the problems entirely. Another shortcoming of the domain methods lies in the well treatment. The flowing bottom-hole pressure of a well is usually related to the pressure calculated for the block containing the well through well models. The most widely accepted well model in finite difference reservoir simulators is the type proposed by Peaceman (1978). In this model, the producing-block pressure is interpreted as a flowing pressure at an equivalent radius from the block center. Under the conditions of isotropic permeabilities, square gridblocks, steady-state flow, and a well in the center of an interior block, the equivalent radius is obtained as r0 =0.208Δx, where Δx is the length of the block edge. Several modifications to this well model have been conducted by Kuniansky and Hillestad (1980), Peaceman (1983), Abou-Kassem and Aziz (1985), Peaceman (1987), Babu and Odeh (1989), and Palagi and Aziz (1992) to relax the conditions made in the original model. These authors have successfully derived well models applicable (at least technically) to more than one centered or off-centered well in a rectangular gridblock with anisotropic permeability. However, the condition of steady-state (or pseudo-steady-state) flow has not been removed. When a high level of accuracy is required in modeling individual well behavior, for instance, in well testing problems, the domain methods would not give satisfactory results due to the CHAPTER 1. INTRODUCTION 3

mathematical weakness in well models. In the boundary element method, only the boundary is discretized into elements. If the fundamental solution (or the so-called free-space Green’s function) is found to the relevant partial differential equation in an infinite domain (or free space), a system of linear algebraic equations can be constructed by imposing that the prescribed conditions at boundary nodes are satisfied by a superposed form in terms of the free- space Green’s function. This process is contingent upon the existence of the free-space Green’s function, and cannot be applied directly to the problems for which such a function does not exist. In addition, since the concept of superposition is required, this formulation process is limited to linear partial differential equations. Although its applicability is somewhat limited, the boundary element method manifests several superiorities over the domain methods. The most notable advantage is the high degree of accuracy that results from its sound mathematical foundations. The flexibility in defining boundary geometries and conditions is another feature to be emphasized. From the computational point of view, a reduction in dimensionality of the problem leads to a populated but much smaller system of algebraic equations than the counterpart in the domain methods. Once these equations are solved, the solution at any interior point can be readily computed. When applied to fluid flow problems, the boundary element method overcomes the above-mentioned shortcomings inherent in the domain methods. As no domain discretization is required, flow is not restricted by the grid system but determined purely by the governing equation. Discretization errors are introduced only on the boundary, and, hence, numerical dispersion and grid orientation effects related to the domain discretization can be removed completely. As for the well treatment, since the analytical nature of the solution is preserved through the free-space Green’s function, there remains no difficulty in evaluating the flowing bottom-hole pressure without any prominent assumptions. Despite these substantial features, the boundary element method has not been appreciated among petroleum engineers. The main reason for this seems to lie in the fact that the two important aspects, heterogeneity and multiphase flow, are excluded from its range of applicability due to the requirements of free-space Green’s functions CHAPTER 1. INTRODUCTION 4

and the restrictions of linearity. This study was initiated to relax the first condition and develop a boundary ele- ment method applicable to fluid flow problems in heterogeneous media. To achieve this end, the governing equation is manipulated and decomposed into a series of perturbation equations, the solutions for which are amenable to boundary element methods. Following the review of literature (Chapter 2), Chapter 3 discusses the pre- liminary concepts utilized in the mathematical manipulations and the model devel- opment. In Chapters 4 and 5, steady-state and transient flow models are developed systematically, and their computational procedures are summarized in Chapter 6. Chapter 7 is devoted to the verification of the models and also to the illustration of their practical use. The contributions made and the findings obtained in the course of this study are summarized in Chapter 8. Related subjects are given in Appendices A through D, and multiple-boundary problems are briefly discussed in Appendix E. Appendices F and G provide Input/Output samples and the program listing. Chapter 2

Review of Literature

The first section discusses the literature on boundary element methods. While bound- ary element methods have been applied to several engineering fields, we limit our discussion to the references considered historically important or related to this study. In particular, emphasis is placed upon those references which simulate flow in hetero- geneous media. The second section discusses the literature on perturbation methods, which play a key role in this study.

2.1 Boundary Element Method

Although the boundary element method (BEM) has drawn attention only recently, its mathematical backbone, the method of integral equations, can be traced to pre- computer times. Kellogg (1929), for example, applied Fredholm integral equations to solve potential problems. The Fredholm integral equations follow from the represen- tation of harmonic potentials by single-layer or double-layer potentials and lead to the so-called indirect BEM. An alternative derivation of the integral equation can be performed through the application of the second form of Green’s theorem, in which a harmonic function is defined as the superposition of the single-layer and the double- layer potential. The so-called direct BEM takes its origin from this alternative. Analytical solutions for integral equations are obtained using the Green’s function for the geometry which satisfies the prescribed boundary conditions of the problem.

5 CHAPTER 2. REVIEW OF LITERATURE 6

The utility of the Green’s function method was discussed by Carslaw and Jaeger (1959) in heat conduction and by Gringarten and Ramey (1973) in petroleum engi- neering literature. However, the Green’s function is limited to very simple geometries, and for “real world” problems a numerical means, the BEM, must be introduced. Historically, the BEM has developed in two parallel ways. One of these is a physical approach and the other is a mathematical approach, which are discussed in the next section.

2.1.1 Indirect and Direct Methods

Basic principles of the present-day BEM were formed in the 1960s as a consequence of the emergence of powerful computers. Jaswon (1963) and Symm (1963) presented a numerical technique to solve boundary-value problems of potential theory formulated by the Fredholm integral equations. This technique can be classified as the indirect BEM, since the unknowns are not the physical variables of the problem but some weighting factors (source densities). After solving for source densities, unspecified boundary parameters are obtained in terms of these densities. Notable predecessors of this method in the same decade were Hess and Smith (1967), who developed powerful programs for the solution of boundary-value problems governed by elliptic partial differential equations, and Harrington et al. (1969), who applied the indirect BEM to solve electrical engineering problems with the Robin type boundary condition. The direct BEM, in which the intermediate step is eliminated by use of the second form of Green’s theorem (or other adequate fundamental integral theorems), was also originated in the work of Jaswon (1963) and Symm (1963), and the results using this method were reported by Jaswon and Ponter (1963). In elastostatics, Rizzo (1967) used the Somigliana identity to formulate the direct BEM, and Cruse and Rizzo (1968) extended the formulation to elastodynamics. The direct BEM seems more appealing to engineers than does the indirect method, since the unknowns bear some physical relation to the problem. Most of the boundary element methods found in the literature on flow take the direct formulation. CHAPTER 2. REVIEW OF LITERATURE 7

2.1.2 Applications to Flow in Homogeneous Media

Despite the close relationship between the potential theory and the fluid flow me- chanics, it appears fair from the engineering point of view to consider that Liggett and Liu were the first to use the BEM in solving flow problems in porous media. In 1977, Liggett (1977) and Liggett and Liu (1977) employed the BEM to study problems concerning seepage with a free surface, and Liu and Liggett (1977) solved two-dimensional unconfined flow problems in which the response of a water table to artificial recharge was simulated by the BEM. Liu and Liggett (1978) and Liu and Liggett (1979) extended the work done in 1977 and showed that the BEM is a numerical technique suitable to certain problems in flow mechanics. Following this breakthrough, special problems were addressed by several authors. Lennon et al. (1979) showed the formulation of axisymmetric flow problems and applied the BEM to evaluate the free surface in pumping wells. Lafe et al. (1980) discussed three types of singularities: corner flow, interzonal flow between zones of different permeabilities, and well singularities. The applicability of the BEM was extended to three-dimensional flow problems by Lennon et al. (1980), to nonlinear interfacial boundary conditions by Liu et al. (1981), and to complex (leaky, layered, confined, unconfined, and nonisotropic) by Lafe et al. (1981). The first paper discussing transient flow in porous media was presented by Liggett and Liu (1979). In this study, real-space and Laplace-space formulations were com- pared. Time-stepping schemes in a real-space formulation were later investigated by Taigbenu and Liggett (1986) and Aral and Tang (1988). The text by Liggett and Liu (1983) is a compilation of the above-mentioned papers. In the realm of petroleum engineering, Masukawa and Horne (1988) and Numbere and Tiab (1988) used the BEM for tracking streamlines, and Kikani and Horne (1988) solved well testing problems by the BEM. A version of the BEM was utilized in evaluating the pressure response of a vertical fracture by some authors (Gringarten et al., 1974: Cinco-Ley et al., 1978: Cinco-Ley and Meng, 1988: van Kruysdijk, 1988). The boundary conditions considered in the literature above were all assumed de- terministic. Cheng and Lafe (1991) claimed that hydrological events were better de- scribed as random phenomena and developed the BEM for the solutions of stochastic CHAPTER 2. REVIEW OF LITERATURE 8

groundwater flow problems. It was found that the direct BEM leads to a much length- ier formulation for the integral equations for covariances, and the indirect BEM was employed. Another interesting study to be covered is the formulation in terms of complex variables. Hunt and Isaacs (1981) utilized the Cauchy integral theorem to formulate the integral equation applicable to two-dimensional steady-state flow. The main advantages of this method are its compactness and the fact that the solution yields both the potential and the stream function. Hromadka and Lai (1987) discussed this formulation in detail.

2.1.3 Applications to Flow in Heterogeneous Media

The treatment of heterogeneity in the BEM was addressed by Lafe et al. (1981), who invoked the piecewise homogeneous assumption and used the zoning technique. In this technique, the flow domain is divided into piecewise zones each with a constant property. Interzonal compatibility relations are taken into account in forming a so- lution system. Kikani and Horne (1989) showed the zoning technique can be used to simulate the transient pressure behavior in sectionally homogeneous reservoirs, and Masukawa and Horne (1988) used the same concept on the moving fluid interface during an immiscible displacement process. The piecewise homogeneous assumption, however, does not always provide a good representation of an actual reservoir. In addition, when a large number of zones are required, the computational efficiency of the BEM is limited. The approaches presented by Clements (1980) and Cheng (1984) required no such assumption. When the formation property variation is represented by a certain function, the Green’s function can be derived such that the governing equation with a given variation is satisfied. As a popular permeability variation in the literature, the following function

was considered: k x α = 1+β (2.1) k0 d where k0 is the reference permeability at x =0,d the reference distance in the direction of the permeability variation, and α and β the parameters of curve fitting. CHAPTER 2. REVIEW OF LITERATURE 9

Clements (1980) gave the Green’s function in a double series truncated at a certain number of terms for α =2n (n =0, ±1, ±2, ···). Cheng (1984) considered the variation with α = 2 and two more harmonically varying permeabilities suitable to the transformation suggested by Georghitza (1969):

2 k βx = cos + α sin βxd (2.2) k0 d and 2 k βx = exp + α sinh βxd (2.3) k0 d This direct approach is very efficient and preserves all the advantages the BEM has for flow problems in homogeneous media. However, its applicability is limited to certain types of permeability variations as those investigated by the two authors. A more general approach was proposed by Lennon (1984), who treated the het- erogeneity in a domain integral. In this method, a one-dimensional discretization is issued on the boundary terms, while a two-dimensional finite element discretization is used on the domain term. The resultant solution system includes not only the boundary but also the interior unknowns. Lafe and Cheng (1987) pointed out that the approach proposed by Lennon (1984) was not strictly a boundary element procedure and proposed a boundary element code based on perturbation equations. In this method, the governing equation is decomposed into a Laplace equation and a sequence of Poisson equations with known right-hand sides, and a regular boundary element procedure is applied for their so- lutions. Three numerical examples were provided to demonstrate the applicability of the code to steady-state groundwater problems, and the convergence of the pertur- bation solution was discussed using a one-dimensional problem. This code was found to yield convergent solutions for problems with permeability varying less than one order of magnitude, and if a problem with more rapid permeability variation is to be solved, the zoning technique was recommended to limit the variation within each subzone to be the acceptable range. Another procedure closely related to the one developed in the present study is that of Lafe and Cheng (1987). In order to develop the boundary element model CHAPTER 2. REVIEW OF LITERATURE 10

applicable to flow problems in petroleum reservoirs, the inclusion of well singulari- ties, the capability of handling transient flow problems, and the durability to rapid property variations are the main subjects to be conquered. The last subject prompts us to look into the literature on perturbation methods.

2.2 Perturbation Method

There are several texts devoted solely to the subject of perturbation methods. Nayfeh (1973) and Kevorkian and Cole (1981) cover many problems in diversified engineering disciplines and are appreciated as standard texts of reference. Perturbation problems can take place in two varieties: those that ensure the uni- form validity of the asymptotic expansion of a solution function and those that involve regions of nonuniformity where the asymptotic expansion breaks down. Techniques applicable to the first class and to the second class are called regular perturbation methods and singular perturbation methods, respectively. Among the literature of singular perturbation methods are the texts by O’Malley (1974) and Lagerstrom (1988). Another useful source is the text by van Dyke (1975a), who used regular and singular perturbation techniques to solve classical problems in fluid mechanics. Be- sides the perturbation procedures, this book gives some information on analyzing the structure of a power series and improving the utility of a perturbation series. This process of analysis and improvement was presented in a series of papers (van Dyke, 1974, 1975b, 1976). The text by Aziz and Na (1984) provides an engineering oriented approach to per- turbation methods through practical problems in heat transfer. The authors extended the discussion to the analysis and improvement of a perturbation series. The main concern when dealing with a regular perturbation series is its conver- gence. As van Dyke (1975a) and Aziz and Na (1984) mentioned in their texts, there exist several techniques to improve a perturbation series. Bender and Orszag (1982) gave a good discussion on this subject, which includes the Shanks transformation, CHAPTER 2. REVIEW OF LITERATURE 11

the Richardson extrapolation, the asymptotic summation of a series, the Euler sum- mation, the Borel summation, and the Pad´e approximant. In particular, a good congeniality between the Pad´e approximant and a perturbation series was addressed. The use of the Pad´e approximant is detailed by Baker (1975) and Baker and Graves- Morris (1981), and its practical application to the series expansion encountered in the course of the study of critical phenomena is discussed by Baker (1990). The connecting relation between the Pad´e approximant and the continued fraction is also well discussed by these three references. Chapter 3

Mathematical Preliminaries

In this chapter, we first present the differential equation governing two-dimensional flow in heterogeneous media. Among the numerical solution techniques for solving differential equations, the boundary element method is employed in this study for several reasons as mentioned in the previous chapters, and is formulated here. Through the discussion of the Green’s function method, the free-space Green’s functions associated with the Laplace operator and the modified Helmholtz operator are derived, which are used as the fundamental solutions in the boundary element method. The equations governing steady-state and transient flow in heterogeneous media, however, do not include these operators, and thus their solutions are not amenable to the boundary element method. To overcome this problem, the flow equations are decomposed into a series of perturbation equations such that the free- space Green’s functions become valid. The improvement of perturbation solutions is also discussed in the last section.

3.1 Fluid Flow Equation

Focusing on the macroscopic behavior but not on the microscopic details, one can describe fluid flow problems in porous media with a fairly simple mathematical model based on the continuity equation. For single-phase fluid flow through a porous medium including ns sinks of strengthsq ˜l (mass per unit volume per unit time), the

12 CHAPTER 3. MATHEMATICAL PRELIMINARIES 13

continuity equation is ∂(φρ) ns −∇ · (ρ v)= + q˜l (3.1) ∂t l=1 As a relationship between the fluid velocity v and pressure gradient, Darcy’s law has been satisfactorily applied to laminar viscous flow at low Reynolds numbers (practi- cally lower than some value between 1 and 10): k v = − ∇p (3.2) μ in which fluid flow is assumed in a horizontal plane. Substituting Eq. 3.2 into Eq. 3.1 yields ρk ∂(φρ) ns ∇· ∇p = + q˜l (3.3) μ ∂t l=1 For liquid or highly pressurized gas flow, the fluid density ρ is

c(p−p0) ρ = ρ0e (3.4)

Under the assumptions of constant fluid viscosity, constant formation compressibility cf =(1/φ)∂φ/∂p, and small pressure gradients, Eq. 3.3 combined with Eq. 3.4 yields the pressure-diffusion equation: ∂p ns ∇·(k∇p)=φμct + μql (3.5) ∂t l=1 where ct = c + cf and ql =˜ql/ρ. Dividing Eq. 3.5 by permeability k and expanding the resulting equation gives

ns 2 φμct ∂p μ ∇ p = + ql −∇ln k ·∇p (3.6) k ∂t l=1 k To ensure the uniqueness of the solution for this partial differential equation, well-posed boundary conditions and also an initial condition must be prescribed. In this study, two typical boundary conditions, namely, Dirichlet and Neumann, and a homogeneous initial condition are considered:

p = H, Γ1 ∈ Γ (Dirichlet) (3.7) ∂p = Q, Γ2 ∈ Γ (Neumann) (3.8) ∂n p = pi,t= 0 (3.9) where Γ1 ∪ Γ2 = Γ and Γ1 ∩ Γ2 =Ø. CHAPTER 3. MATHEMATICAL PRELIMINARIES 14

3.1.1 Dimensionless Equations

The analytical solution for the partial differential equation derived in Section 3.1 can rarely be found due to geometric complexities and/or flow-domain heterogeneities, and some numerical technique must be applied. When solving Eq. 3.6 numerically, it is advisable to use normalized quantities out of regard for numerical stability. If the fluid flow problem of interest is in two dimensions, Eq. 3.6 can be normalized as

2 2 ∇2 ∂ pD ∂ pD pD = 2 + 2 ∂xD ∂yD ns 1+Φ ∂pD − − −∇ ·∇ = + qDlδ(xD xDl)δ(yD yDl) ln k pD (3.10) K ∂tDA l=1 in which Dirac delta functions were used to clarify the locations of sinks, and the following normalized (dimensionless) properties were introduced:

pi − p pD = (3.11) p0

√x √y xD = ,yD = (3.12) A A − μA qDl = ql (3.13) klp0 k0t tDA = (3.14) φ0μctA

In the definition of the dimensionless time tDA, since permeability k and porosity φ may not be constant but functions of space, constant reference values of permeability k0 and porosity φ0 were used. The time-derivative term was divided by k K = (3.15) k0 and multiplied by φ 1+Φ= (3.16) φ0 where K and Φ are dimensionless permeability and porosity, respectively. In Section 3.4, it will be explained why K and Φ are defined in different forms. The correspond- CHAPTER 3. MATHEMATICAL PRELIMINARIES 15

ing normalized boundary and initial conditions are

pD = HD, Γ1 ∈ Γ (3.17) ∂pD = QD, Γ2 ∈ Γ (3.18) ∂nD pD =0,tDA = 0 (3.19)

If the fluid is incompressible, there follows the steady-state flow equation:

ns ∇2 − − −∇ ·∇ pD = qDlδ(xD xDl)δ(yD yDl) ln k pD (3.20) l=1 which is subject to the boundary conditions of Eq. 3.17 and Eq. 3.18.

3.1.2 Laplace Space Formulation

The Laplace transform is of great utility in transient flow problems, since it transforms the original partial differential equation in space and time variables into a differential

equation in only space variables. By using this transformation with respect to tDA: ∞ −stDA p¯D = pDe dtDA (3.21) 0 wherep ¯D denotes the transformed variable and s is the Laplace transform parameter, Eq. 3.10 subject to the initial condition given by Eq. 3.19 is reduced to

ns ∇2 − 1+Φ 1 − − −∇ ·∇ p¯D s p¯D = qDlδ(xD xDl)δ(yD yDl) ln k p¯D (3.22) K s l=1 The boundary conditions are transformed to

HD p¯ = , Γ1 ∈ Γ (3.23) D s ∂p¯D QD = , Γ2 ∈ Γ (3.24) ∂nD s If the solution in Laplace space is obtained in a closed form, it may be inverted to real space through an inversion table or an integral in the complex plane. When some numerical technique is used in Laplace space and the solution cannot be expressed in a closed form, robust numerical inversion routines, such as the Stehfest algorithm (1970), can be used to obtain the physical solution. CHAPTER 3. MATHEMATICAL PRELIMINARIES 16

3.2 Green’s Function Method

Let us consider the differential operator D, and integrate the product vDu by parts over the domain Ω of interest repeatedly. The result can be expressed as vDu dΩ= [···] dΓ+ uD∗vdΩ (3.25) Ω Γ Ω where Γ is the boundary of Ω, [···] denotes an expression to be integrated along Γ, and the functions u and v are arbitrary as long as they are differentiable for Du and D∗v. In the special case, D = ∇2, the integrand of the contour integral is ∂u ∂v v − u ∂n ∂n and the adjoint operator D∗ becomes ∇2. When D∗ = D, the operator D is said to be self-adjoint. Eq. 3.25 becomes ∂u ∂v v∇2udΩ= v − u dΓ+ u∇2vdΩ (3.26) Ω Γ ∂n ∂n Ω which is known as the second form of Green’s theorem. Another example in which the [···] term takes the form of v(∂u/∂n) − u(∂v/∂n) is the modified Helmholtz operator (∇2 − s). This operator is also self-adjoint. The integrand of the form v(∂u/∂n) − u(∂v/∂n) is crucial in the Green’s function method. In boundary-value problems in terms of u, the boundary conditions are usually prescribed in terms of u and/or ∂u/∂n, and, hence, if the function v can be determined such that it cancels unprescribed boundary conditions and that the double integral terms are reduced to simpler forms, the resultant equation becomes solvable for u. Unfortunately, the governing equations derived in the previous section do not give the integrand form desirable in the Green’s function method. However, suppose, for the moment, that k and φ are constant over a porous medium, then, since ∇ ln k =0, K = 1, and Φ = 0, the steady-state flow equation (Eq. 3.20) and the Laplace-space transient flow equation (Eq. 3.22) become

ns ∇2 − − pD = qDlδ(xD xDl)δ(yD yDl) (3.27) l=1 CHAPTER 3. MATHEMATICAL PRELIMINARIES 17

and ns ∇2 − 1 − − p¯D sp¯D = qDlδ(xD xDl)δ(yD yDl) (3.28) s l=1 These two equations are associated with the Laplace (∇2) and the modified Helmholtz (∇2 − s) operator, respectively. In the next two sections, we discuss the Green’s function methods applicable to these two operators.

3.2.1 Laplace Operator

For the two-dimensional Laplace operator ∇2, let us consider an application of the second form of Green’s theorem to a domain Ω in the xy plane bounded by a closed boundary Γ: 2 ∂pD ∂U 2 U∇ pD dΩ= U − pD dΓ+ pD∇ UdΩ (3.29) Ω Γ ∂nD ∂nD Ω where U is a scalar function of position.

In defining U, it is convenient to introduce a temporarily fixed point P (˜xD, y˜D)in the domain Ω. In Eq. 3.29, if the function U is given such that

2 ∇ U = −δ(xD − x˜D)δ(yD − y˜D) (3.30) from the shifting property of the Dirac delta function (Appendix A):

∞ f(t)δ(t − t˜) dt = f(t˜) (3.31) −∞

the double integral on the right in Eq. 3.29 yields the pressure at the point P :

−pD(˜xD, y˜D)

Since the function pD, which is also a scalar function of position, satisfies Eq. 3.27, again from the property of the Dirac delta function, the double integral on the left becomes ns U(˜xD, y˜D; xDl,yDl)qDl l=1 CHAPTER 3. MATHEMATICAL PRELIMINARIES 18

and Eq. 3.29 yields the boundary integral equation for the dimensionless pressure at the point P : ns ∂pD − ∂U − pD(˜xD, y˜D)= U pD dΓ U(˜xD, y˜D; xDl,yDl)qDl (3.32) Γ ∂nD ∂nD l=1 In the Green’s function method, the function U is defined such that an unfavorable part of the integrand in Eq. 3.32 is canceled, and the resultant equation becomes solvable for pD(˜xD, y˜D). Such a function U is called the Green’s function. In Dirichlet

problems, for instance, since ∂pD/∂nD on the boundary Γ is unknown, U must be zero on the boundary to eliminate this unknown term. In Neumann problems, in contrast,

∂U/∂nD must be zero on the boundary. Such requirements on the boundary are different from one problem to another, and, hence, the “universal” Green’s function cannot be determined conclusively. However, if U is split into two parts G and g, and the function g, which is called the regular part, is determined such that the combination U = G+g satisfies required conditions on the boundary, then the function G becomes independent of boundary conditions. The function G is called the free-space Green’s function for the Laplace operator, and can be determined by solving

2 ∇ G = −δ(xD − x˜D)δ(yD − y˜D) (3.33)

An interpretation of its physical nature is of great help in solving Eq. 3.33 for the free-space Green’s function G. In potential theory, G(˜xD, y˜D; xD,yD) is interpreted as the potential at the point P (˜xD, y˜D) induced by a point mass of unit strength located at (xD,yD), and, hence, G is symmetric about the point (xD,yD) and depends only on the Euclidean distance between the two points: 2 2 rD = (xD − x˜D) +(yD − y˜D) (3.34)

Replacing the Dirac delta function by a δ sequence (Appendix A) and expressing the Laplace operator in the polar coordinates, Eq. 3.33 becomes

2 2 −κrD 1 ∂ ∂G 1 ∂ G − κe rD + 2 2 = lim→∞ (3.35) rD ∂rD ∂rD rD ∂θ κ π CHAPTER 3. MATHEMATICAL PRELIMINARIES 19

in which the second term on the left becomes zero since G was found to be independent

of θ. Multiplying Eq. 3.35 by the Euclidean distance rD and integrating from 0 to rD yields − 2 − κrD ∂G − 1 e rD = lim→∞ (3.36) ∂rD κ 2π

Dividing through by rD and integrating from rD to 1 gives

2 1 1 1 1 e−κt G(rD) − G(1) = ln − lim dt (3.37) κ→∞ 2π rD 2π rD t where for any fixed rD the limit of the last term as κ →∞is zero. The constant G(1), which may always be added to the potential, is arbitrary and for convenience can be set to 0. The free-space Green’s function associated with the two-dimensional Laplace operator is finally obtained as 1 1 G(˜xD, y˜D; xD,yD)= ln (3.38) 2π rD where rD is given by Eq. 3.34.

3.2.2 Modified Helmholtz Operator

For the two-dimensional modified Helmholtz operator ∇2 −s with s real and positive, since it is self-adjoint, there follows 2 ∂p¯D ∂U¯ 2 U¯(∇ p¯D −sp¯D) dΩ= U¯ − p¯D dΓ+ p¯D(∇ U¯ −sU¯) dΩ (3.39) Ω Γ ∂nD ∂nD Ω As is the case with the Laplace operator, the Dirac delta function is introduced to define U¯: 2 ∇ U¯ − sU¯ = −δ(xD − x˜D)δ(yD − y˜D) (3.40) From the shifting property of the Dirac delta function, the double integral on the right in Eq. 3.39 is

−p¯D(˜xD, y˜D) and combined with Eq. 3.28, the double integral on the left becomes

ns 1 ¯ U(˜xD, y˜D; xDl,yDl)qDl s l=1 CHAPTER 3. MATHEMATICAL PRELIMINARIES 20

Eq. 3.39 yields the boundary integral equation for the transformed dimensionless pressure at the point P : ¯ ns ¯ ∂p¯D − ∂U − 1 ¯ p¯D(˜xD, y˜D)= U p¯D dΓ U(˜xD, y˜D; xDl,yDl)qDl (3.41) Γ ∂nD ∂nD s l=1 The “universal” Green’s function for transient flow problems cannot be deter- mined conclusively as is the case with steady-state flow problems. However, using the splitting technique, we can determine the boundary-independent part, that is, the free-space Green’s function G¯ for the modified Helmholtz operator, which should satisfy 2 ∇ G¯ − sG¯ = −δ(xD − x˜D)δ(yD − y˜D) (3.42)

The symmetry of the free-space Green’s function reduces Eq. 3.42 in polar coordinates to ¯ 1 ∂ ∂G ¯ rD − sG = −δ(xD − x˜D)δ(yD − y˜D) (3.43) rD ∂rD ∂rD In order to utilize the Hankel transformation (Churchill, 1972), let us multiply Eq. 3.43 by

rDJ0(αrD) drD dθ and consider the following integration: 2π ∞ 2 ¯ ¯ ∂ G 1 ∂G − ¯ − 2 + sG rDJ0(αrD) drD dθ = 1 (3.44) 0 0 ∂rD rD ∂rD where the property of the Dirac delta function was used on the right. The Hankel transformation of order zero expressed as

∞ H0α{G¯} = Gr¯ DJ0(αrD) drD (3.45) 0 has the following operational property: 2 ¯ ¯ H ∂ G 1 ∂G − 2H { ¯} 0α 2 + = α 0α G (3.46) ∂rD rD ∂rD which reduces Eq. 3.44 to 1 H0 {G¯} = (3.47) α 2π(α2 + s) CHAPTER 3. MATHEMATICAL PRELIMINARIES 21

The solution can be obtained through the inverse Hankel transformation:

∞ ∞ ¯ ¯ 1 αJ0(αrD) G = αJ0(αrD)H0α{G} dα = dα (3.48) 0 2π 0 α2 + s This is a Hankel-Nicholson type integral, for which a closed-form solution is known (Abramowitz and Stegun, 1970):

∞ ν+1 μ ν−μ t Jν(at) a z dt = Kν−μ(az) (3.49) 0 (t2 + z2)μ+1 2μΓ(μ +1) and, finally, the free-space Green’s function for the modified Helmholtz operator is 1 √ G¯(˜x , y˜ ; x ,y ; s)= K0( sr ) (3.50) D D D D 2π D where rD is given by Eq. 3.34.

3.3 Boundary Element Method

The Green’s function method is a powerful tool to obtain the solution for a linear partial differential equation as long as the problem is subject to simple boundary conditions such that the corresponding Green’s function can be determined. As men- tioned in the previous section, however, it is not always possible to establish Green’s functions, which limits the applicability of Green’s function methods. The difficult part in constructing Green’s functions is to determine regular parts such that un- known boundary conditions are eliminated. In reverse, if the boundary conditions are all known along the boundary, regular parts are not required, and free-space Green’s functions rather than Green’s functions can be used. The boundary integral equations associated with the free-space Green’s functions G and G¯ are ns ∂pD − ∂G − pD(˜xD, y˜D)= G pD dΓ G(˜xD, y˜D; xDl,yDl)qDl (3.51) Γ ∂nD ∂nD l=1 for steady-state flow problems, and ¯ ns ¯ ∂p¯D − ∂G − 1 ¯ p¯D(˜xD, y˜D)= G p¯D dΓ G(˜xD, y˜D; xDl,yDl; s)qDl (3.52) Γ ∂nD ∂nD s l=1 CHAPTER 3. MATHEMATICAL PRELIMINARIES 22

for transient flow problems. In well-posed problems, only half of the boundary conditions are prescribed, and

according to the problem setting in this study, boundary unknowns are ∂pD/∂nD

(or ∂p¯D/∂nD) on the boundary Γ1 and pD (orp ¯D) on the boundary Γ2. When the point P is located within the domain Ω, these integral equations are of no use to compute pD orp ¯D due to the incompleteness of boundary conditions. On the other hand, if the point P is allocated on the boundary, these equations can be used for the purpose of obtaining the unprescribed boundary values. This procedure usually requires boundary discretizations and interpolations, since we rarely have sufficient information to evaluate the contour integral analytically. Once the boundary unknowns are determined, the boundary integral equations can be used to compute pD orp ¯D at any location within the domain Ω. The numerical technique which performs these procedures is called the boundary integral equation method (BIEM) or the boundary element method (BEM). In this section, we discuss the outline of this method. For convenience, let us employ the following equation as a common form of the two boundary integral equations, Eq. 3.51 and Eq. 3.52: ∂u ∂v u(˜x, y˜)= v − u dΓ − b (3.53) Γ ∂n ∂n

3.3.1 Boundary Discretization

In order to evaluate the contour integral involved in the boundary integral equation,

the boundary Γ is discretized into nb straight-line elements along which interpolation functions are given to define variations of u and ∂u/∂n. In the simplest interpolation scheme, the so-called constant element, the values of u and ∂u/∂n are assumed to be constant over each element. The points where the boundary values are considered

are called nodes and taken to be in the middle of the element. For the nb-boundary discretization, nb nodes are required. Although the linear element is easy to implement in the boundary element code, discontinuities of u at the intersections of elements discourage us from its application. The interpolation scheme used in this study is the linear element, which requires CHAPTER 3. MATHEMATICAL PRELIMINARIES 23

also nb nodes but provides a continuous profile of u at the intersection of elements. The nodes are allocated at the edges of elements and boundary values are linearly interpolated in between. While the node-numbering direction is arbitrary, the positive direction is chosen in accordance with the convention regarding the transversal of a closed path. In the case of a filled circle, for instance, the positive direction is the counterclockwise direction. Since the contour integral in Eq. 3.53 is a double integral in the xy coordinate system, it is desirable to introduce a local coordinate system in which the integral along each element becomes a line integral. The local ξη coordinate system as shown in Fig. 3.1 is appropriate for this purpose. The coordinate origin is at the point P ,

from which the ξ axis is set parallel to the boundary element ΔΓj and in the opposite direction of the node numbering. The η axis is defined by the right-hand rule. In the local ξη coordinate system, boundary values are interpolated as

(uj+1 − uj)ξ + ξj+1uj − ξjuj+1 u = ,ξj ≤ ξ ≤ ξj+1 (3.54) ξj+1 − ξj − − ∂u (unaj+1 unlj)ξ + ξj+1unlj ξjunaj+1 = ,ξj ≤ ξ ≤ ξj+1 (3.55) ∂n ξj+1 − ξj Since ∂u/∂n is not necessarily continuous at the intersections of elements where the directions of normal vectors may be different, the following definitions should be introduced: ∂u u : at point j when approaching the node naj ∂n ∂u u : at point j when leaving the node nlj ∂n The contour integral can be approximated as a summation of piecewise line inte- grals: ∂u ∂v nb ∂u ∂v v − u dΓ= v − u dΓ Γ ΔΓ ∂n ∂n j=1 j ∂n ∂n nb = (V1ijunlj + V2ijunaj+1 − W1ijuj − W2ijuj+1) (3.56) j=1 CHAPTER 3. MATHEMATICAL PRELIMINARIES 24

unl unaj η j K 6 s s K ΔΓ j j j − 1 s s y j +1 s 6 s s * ξ s - x s s s P s

s s domain Ω 2

s 1 s

s boundary Γ s nb s s s s

Figure 3.1: Local ξη coordinate system. CHAPTER 3. MATHEMATICAL PRELIMINARIES 25

where the point P is denoted by the subscript i and the coefficients are 1 − V1ij = − ξvi dΓ ξj+1 vi dΓ (3.57) ξj+1 ξj ΔΓj ΔΓj 1 − V2ij = − ξvi dΓ+ξj vi dΓ (3.58) ξj+1 ξj ΔΓj ΔΓj 1 ∂v ∂v W1ij = ξ dΓ − ξj+1 dΓ (3.59) +1 − ΔΓ ΔΓ ξj ξj j ∂n i j ∂n i 1 ∂v ∂v W2ij = − ξ dΓ+ξj dΓ (3.60) +1 − ΔΓ ΔΓ ξj ξj j ∂n i j ∂n i The free-space Green’s functions (denoted by v in the above expressions) for our problems have been determined in closed forms, and their normal derivatives are readily found. Some of these line integrals can be evaluated analytically, while others must be done numerically. In either case, attention should be given to the singularities of the free-space Green’s functions when the point i coincides with the boundary node j or j + 1. The existence of singularities in G and G¯ is readily understood because of the singular nature of the Dirac delta function, which was used to define the free- space Green’s functions. The evaluation of these line integrals will be discussed in the following chapters.

3.3.2 Boundary Solutions

There are four possible node types to define boundary conditions, and boundary unknowns are the counterparts of prescribed boundary conditions:

• Type 1 : u and una specified node located at the transection from Γ2 to Γ1

• Type 2 : u specified node on Γ1

• Type 3 : u and unl specified node located at the transection from Γ1 to Γ2

• Type 4 : una and unl specified node on Γ2

Assuming that una = unl in Type 2, we have one boundary unknown for each node or nb unknowns in all. CHAPTER 3. MATHEMATICAL PRELIMINARIES 26

A set of nb equations required to determine the nb unknowns can be obtained by allocating the point P on nb boundary nodes. When the point P is moved onto the boundary, the location of the point P is not of free space any more, and the free-space

Green’s function should be modified by αi: θ α = i (3.61) i 2π where θi is the internal angle between the boundary elements ΔΓi−1 and ΔΓi. The discretized boundary integral equations become

nb αiui = (V1ijunlj + V2ijunaj+1 − W1ijuj − W2ijuj+1) − bi,i=1,nb (3.62) j=1 where V1, V2, W1, and W2 are called the boundary influence coefficients. The coeffi- cients W1ij and W2ij−1, for instance, give αu at the ith node due to a unit strength of u at the jth node. Reordering the subscripts gives

nb nb (V1ijunlj + V2ij−1unaj) − (W1ij + W2ij−1 + αiδij)uj = bi,i=1,nb (3.63) j=1 j=1 where δij is the Kronecker delta. The whole set of equations can be expressed in a matrix form:

V1unl + V2una − Wu = b (3.64)

Rearranging Eq. 3.64 with the unknowns on the left yields a system of equations whose matrix form is AU = B (3.65) where U is the vector of unknowns u, una, and unl, and B is the vector obtained by multiplying matrix elements by the known boundary values and then adding by b. Unlike the domain methods such as finite differences or finite elements, the matrix A is fully populated. However, since unknowns are only on the selected boundary nodes, the size of A is much smaller than that of domain schemes for the same problem. Another redeeming feature is that the matrix A is diagonally dominant. This is due to the fact that the influence coefficient between the nodes i and j takes its maximum value when the node j coincides with node i. CHAPTER 3. MATHEMATICAL PRELIMINARIES 27

3.3.3 Interior Solutions

Once Eq. 3.65 is solved, all the boundary values are known and the value of u at any interior point can be obtained through

nb ui = (V1ijunlj + V2ijunaj+1 − W1ijuj − W2ijuj+1) − bi (3.66) j=1 which is a discretized expression of the boundary integral equation (Eq. 3.53). Since the point P is now in free space, no modification of the free-space Green’s function is necessary. A similar calculation is possible for the gradient of u, which will be discussed in the following chapter.

3.4 Perturbation Method

In the last section, we discussed the boundary element method (BEM) applicable to fluid flow problems in homogeneous media. The BEM owes its elegance with regard to the computational efficiency and accuracy to the existence of the free-space Green’s function. If there is no such function in a closed form, the BEM cannot be applied, and, unfortunately, this is the case for fluid flow problems with permeability and/or porosity variabilities. A possible way to make the BEM applicable to flow problems in heterogeneous media is to manipulate the governing equations so that the free- space Green’s functions become valid to the resulting equations. For this purpose, perturbation methods are employed. The perturbation method is a collection of techniques for analyzing the global behavior of the solution for a differential equation which involve a perturbation pa- rameter, usually denoted by . If the solution can be expressed as a perturbation series in powers of  and the power series has a nonvanishing radius of convergence, the problem is referred to as a regular perturbation problem. In such a problem, the exact solution smoothly approaches the zeroth-order perturbation solution (the leading term in the perturbation series) as  → 0. On the other hand, when the solution does not take the form of a power series in CHAPTER 3. MATHEMATICAL PRELIMINARIES 28

 or, if it does, the power series has a vanishing radius of convergence, the problem is referred to as a singular perturbation problem. The exact solution, in this case, may not exist for  = 0 or, if it does, its character is totally different from that of the neighboring solution obtained in the limit of  → 0. In boundary-value problems, for example, the singular perturbation takes place when the highest derivatives are mul- tiplied by , since in the limit of  → 0 the unperturbed solution obeys a lower-order differential equation and cannot satisfy all the boundary conditions. One technique of dealing with this problem is by using matched asymptotic expansions. In this tech- nique, a straightforward solution (outer solution) is determined first by dropping a part of boundary conditions. The outer solution breaks down in the neighborhood of the boundary whose condition is neglected. This small region is called the boundary layer. The solution which is valid in the boundary layer (inner solution) is determined by using the stretching transformation, and finally the composite solution, which is uniformly valid, is formed from the outer and inner solutions. The choice between the regular and the singular perturbation is to be made ac- cording to the nature of a problem. For fluid flow problems in heterogeneous media, it is possible to formulate perturbation equations in either way. In this study, we employ the regular perturbation method, in which the highest derivatives should not be multiplied by the parameter . In other words, by selecting this method, it is implicitly assumed that the zeroth-order solution corresponds to the solution in ho- mogeneous media, since the highest derivatives of the governing equations contain no spatial variability. The most important step of the perturbation method is to identify the pertur- bation parameter  such that if  = 0 the problem can be solved exactly or more readily. In many physical problems,  appears naturally in the equation or can be found through dimensional analyses, and, consequently,  has a certain physical mean- ing. However, there is no mathematical objection to introducing  temporarily into a problem which has no small parameter, and then setting  = 1 to recover the original problem. The second step is to express the solution in the form of a perturbation series. Combined with this series in terms of , the original differential equation is decomposed into successive perturbation equations. The zeroth-order solution, which CHAPTER 3. MATHEMATICAL PRELIMINARIES 29

corresponds to the unperturbed problem, is obtained by solving the zeroth-order perturbation equation and the higher-order solutions are determined in succession. As a final step, the solution to the original equation is recovered by summing the perturbation solutions obtained in the second step. In this section, utilizing the regular perturbation method, we decompose the equa- tions governing steady-state and transient flow in heterogeneous media into pertur- bation equations to which the BEM is applicable.

3.4.1 Steady-State Flow Problems

As the boundary element method is known to be applicable to differential equations associated with the Laplace operator, it is natural to try to identify the parameter  that converts the steady-state flow equation (Eq. 3.20) into the Poisson (or Laplace) equation when  = 0. Eq. 3.20 differs from the Poisson equation by the last term

∇ ln k ·∇pD, and, hence, if this term is multiplied by , the zeroth-order perturbation equation yields the Poisson equation. Let us postulate that permeability k can be expressed as

ln k =lnk0 +  ln K (3.67) where k0 is the constant reference permeability and K is the dimensionless perme- ability variation as defined by Eq. 3.15.  in this definition is a temporary parameter necessary for mathematical manipulations and has no physical meaning. The original equation can be recovered by setting  =1.

Since ∇ ln k0 = 0, Eq. 3.20 yields

ns ∇2 − − − ∇ ·∇ pD = qDlδ(xD xDl)δ(yD yDl)  ln K pD (3.68) l=1

Further assuming that pD can be expanded into a perturbation series in powers of  (n) (n−1) with descending magnitude (pD

(0) (1) 2 (2) ··· pD = pD + pD +  pD + ∞ n (n) =  pD (3.69) n=0 CHAPTER 3. MATHEMATICAL PRELIMINARIES 30

Substituting this expression into Eq. 3.68, and equating coefficients of equal powers of  gives zeroth-order and nth-order perturbation equations:

ns ∇2 (0) − − pD = qDlδ(xD xDl)δ(yD yDl) (3.70) l=1

∇2 (n) −∇ ·∇ (n−1) ≥ pD = ln K pD ,n1 (3.71) In a similar way, the boundary conditions can be decomposed into zeroth-order per- turbation expressions:

(0) ∈ pD = HD, Γ1 Γ (3.72) (0) ∂pD = QD, Γ2 ∈ Γ (3.73) ∂nD and nth-order expressions:

(n) ∈ pD =0, Γ1 Γ (3.74) (n) ∂pD =0, Γ2 ∈ Γ (3.75) ∂nD In this manner, the original governing equation is decomposed into the Poisson (0) equation in terms of pD (Eq. 3.70) subject to the original boundary conditions and (n) another set of Poisson equations in terms of pD (Eq. 3.71), right-hand sides of which are to be determined with the (n − 1)th-order perturbation solution, subject to ho- mogeneous boundary conditions.

3.4.2 Transient Flow Problems

The Laplace-space equation governing transient flow is given by Eq. 3.22. Unlike the steady-state flow equation, Eq. 3.22 contains two kinds of spatial properties, k (or K) and Φ, which appear in two terms:

1+Φ s p¯ K D and

∇ ln k ·∇p¯D CHAPTER 3. MATHEMATICAL PRELIMINARIES 31

Employing the same definition of k as Eq. 3.67 and utilizing ∇ ln k0 = 0 reduces the second term to ∇ ln K ·∇p¯D, which can be perturbed in the same way as described in the previous section. In order to perturb the first term, it must be expanded into a series in powers of the parameter . Comparing Eq. 3.15 with Eq. 3.67 reveals that K−1 in the first term should be replaced by K−, which can be expanded as

∞ (− ln K)n K− =1+ (3.76) n=1 n! Since the parameter  used in Eq. 3.67 has no physical meaning but is just a temporary parameter, it can be used to define another physical property as long as the original equation is recovered when  = 1. Let us postulate that porosity φ can be expressed as

φ = φ0(1 + Φ) (3.77)

then, by comparing Eq. 3.16 with Eq. 3.77, it is seen that 1 + Φ in the first term should be replaced by 1 + Φ. The relationship between k and K adopted in this study (Eq. 3.67) seems to be the only way that makes it possible to perturb the two terms simultaneously, in which K appears in different forms, K−1 and ln K. On the other hand, it is possible to use other relations between φ and Φ than Eq. 3.77. However, concerning the perturbation procedure, it is crucial to keep the expression as simple as possible. Using these expressions for K and Φ, a series expansion of the first term is ob- tained: 1+Φ ∞ (− ln K)n ∞ (− ln K)n s  p¯D = s 1+Φ+ + Φ p¯D (3.78) K n=1 n! n=1 n! Substitution of Eq. 3.78 into Eq. 3.22 gives ∞ n ∞ n 2 (− ln K) (− ln K) ∇ p¯D − s 1+Φ+ + Φ p¯D n=1 n! n=1 n! ns 1 − − − ∇ ·∇ = qDlδ(xD xDl)δ(yD yDl)  ln K p¯D (3.79) s l=1 CHAPTER 3. MATHEMATICAL PRELIMINARIES 32

Substituting the perturbation series for the transformed dimensionless pressure: (0) (1) 2 (2) ··· p¯D =¯pD + p¯D +  p¯D + ∞ n (n) =  p¯D (3.80) n=0 into Eq. 3.79 and equating coefficients of equal powers of  yields a zeroth-order perturbation equation:

ns ∇2 (0) − (0) 1 − − p¯D sp¯D = qDlδ(xD xDl)δ(yD yDl) (3.81) s l=1 and higher-order equations: ∇2 (1) − (1) − (0) −∇ ·∇ (0) p¯D sp¯D = s(Φ ln K)¯pD ln K p¯D 2 (2) (2) (1) (ln K) (0) ∇2p¯ − sp¯ = s(Φ − ln K)¯p + s −ΦlnK + p¯ D D D 2! D −∇ ·∇ (1) ln K p¯D 2 (3) (3) (2) (ln K) (1) ∇2p¯ − sp¯ = s(Φ − ln K)¯p + s −ΦlnK + p¯ D D D 2! D 2 3 (ln K) (ln K) (0) (2) +s Φ − p¯ −∇ln K ·∇p¯ 2! 3! D D . . and, in general, n ν−1 ν ( ) ( ) (− ln K) (− ln K) ( − ) ∇2p¯ n − sp¯ n = s Φ + p¯ n ν D D − D ν=1 (ν 1)! ν! −∇ ·∇ (n−1) ≥ ln K p¯D ,n1 (3.82) The corresponding decomposed boundary conditions are

(0) HD p¯ = , Γ1 ∈ Γ (3.83) D s (0) ∂p¯D QD = , Γ2 ∈ Γ (3.84) ∂nD s for the zeroth-order perturbation equation, and (n) ∈ p¯D =0, Γ1 Γ (3.85) (n) ∂p¯D =0, Γ2 ∈ Γ (3.86) ∂nD CHAPTER 3. MATHEMATICAL PRELIMINARIES 33

for the nth-order equations, respectively. Both the zeroth-order and higher-order perturbation equations are associated with the modified Helmholtz operator, for which the free-space Green’s function is known. Inhomogeneous terms in the nth-order perturbation equation can be determined by using the perturbation solutions of order zero through order (n − 1).

3.4.3 Convergence of Perturbation Series

When considering the local nature of solutions to differential equations near a certain

point x0, one should classify the point x0 as an ordinary point or a singular point.

The point x0 is said to be ordinary if all the coefficient functions in the standard form (the highest derivative has a coefficient of 1) can be expanded in a power series in a region including x0. Otherwise, the point x0 is said to be singular. The solution can be expanded in a Taylor series about x0 with a nonvanishing radius of convergence, if and only if, x0 is ordinary (Bender and Orszag, 1982). More precisely, the Taylor

series converges in a circle with center at an ordinary point x0 which extends up to the nearest singularity of the differential equation. In examining the convergence of a perturbation solution, we may use the analogy between the local analysis of differential equations mentioned above and the pertur- bation. According to such a cast, the regular perturbation is the analysis of the global behavior of the solution when 0 ( = 0) corresponds to an ordinary point, while the singular perturbation is the analysis when 0 corresponds to a singular point. As for the convergence, it can be deduced that its radius with respect to  is limited by the correspondent of the nearest singularity. Due to the lack of closed-form expressions for the coefficient functions, it is not always possible to determine the singularity involved in the differential equation and one cannot predict whether or not the per- turbation series converges. Qualitatively, however, the radius of convergence shrinks with increasing magnitude of spatial variabilities, which is equivalent to increasing . Consequently, the regular perturbation series is supposed to diverge for large values of K and Φ. CHAPTER 3. MATHEMATICAL PRELIMINARIES 34

3.5 Improvement of Perturbation Series

In the regular perturbation method, the solution is expressed as an infinite series in powers of . In practice, the first (N +1)-term expansion is accepted as an approxima- tion to the exact solution if the Nth-order perturbation solution is within a tolerance specified appropriately for the problem and the higher-order solutions are considered to be negligible. However, as mentioned in the previous section, such a truncated expansion is valid only for a limited range of values of K and Φ, beyond which the series becomes divergent. Nevertheless, it is possible to elicit a significant amount of information from the perturbation series and to recover an accurate approximation to the exact answer from the divergent series. To this end, Pad´e approximants have been successfully applied in physics and chemistry, particularly in the field of critical phenomena (Baker, 1990). The idea is to replace a power series by a particular type of rational-fraction approximation so that its radius of convergence becomes large enough to yield a convergent solution. Since the radius of convergence depends on singular points, we first discuss the analysis of the location and nature of singularities characterizing the power series, then introduce the Pad´e approximants.

3.5.1 Analysis of Series

As van Dyke (1974) noted, late terms of a power series are determined by the nearest singularities according to the theorem of Darboux, and, hence, in exploring the struc- ture of a power series, the analysis of the nearest singularity is crucial. The analysis is aimed at the following characters:

• the direction of the nearest singularities

• the distance to the nearest singularities

• the nature of the nearest singularities

The pattern of signs appearing in the extended series determines the direction of the dominant singularity (van Dyke, 1975a). In many physical problems, the CHAPTER 3. MATHEMATICAL PRELIMINARIES 35

signs soon appear to settle down to a certain simple pattern. If the signs are fixed (++++++++ or −−−−−−−−), the singularity lies on the positive real axis, while if the signs alternate (+−+−+−+−), it lies on the negative real axis. The singularity on the positive axis can be interpreted as a physical singularity. On the other hand, since the perturbation parameter  is usually identified as a physical quantity (only positive values of which have physical significance), the singularity on the negative axis is a mathematical (rather than physical) outcome. With a longer repeated pat- tern, the most likely possibility is that singularities occur as complex conjugate pairs. The pattern of period three (++−++−++) is associated with singularities located at angles ±(2π)/3 from the positive axis, and the pattern of four (++−−++−−) is as- sociated with complex conjugate pair of singularities on the imaginary axis (±(2π)/4 from the positive real axis). Periodic patterns of length five and greater are possible, and occasionally one can come across chaotic patterns. The distance to the nearest singularity can be determined by estimating the radius ∞ (n) n of convergence, R. If an infinite number of terms of the series n=0 a  are known, the radius of convergence can be calculated using the D’Alembert’s ratio test (van

Dyke, 1975a): ( −1) a n R = lim (3.87) n→∞ a(n) In the perturbation method, however, only a truncated series is known, and the available information must be extrapolated to estimate the limit as n →∞. Domb and Sykes (1957) proposed a plot of reciprocal ratio |a(n)/a(n−1)| versus 1/n, which usually becomes almost linear as n increases. If the linear pattern is assumed to prevail and extrapolated to 1/n = 0, the intercept gives 1/R. Symbolically, the relationship can be written as ⎧ ∞ ⎨ (R ± )α,α=0 , 1, 2, ··· a(n)n = const × (3.88) ⎩ α n=0 (R ± ) ln(R ± ),α=0, 1, 2, ··· and a(n) 1 1+α = ∓ 1 − (3.89) a(n−1) R n CHAPTER 3. MATHEMATICAL PRELIMINARIES 36

The algebraic-logarithmic form given by Eq. 3.88 is also useful in investigating the nature of the nearest singularity. From the slope of the asymptote in the Domb- Sykes plot, α can be evaluated and Eq. 3.88 allows us to classify singularities (poles or branch points).

3.5.2 Pad´e Approximants

When a perturbation series diverges, it indicates the presence of singular points and the inability of a polynomial to approximate the solution properly near the singularity. There are several summation methods proposed to provide a convergent expression to the function in question. For example, the Euler summation expresses the function as the limit of a convergent series, while the Borel summation uses the limit of a convergent integral (Bender and Orszag, 1982). In these summation methods, since the limit needs to be evaluated, all of the terms of the series must be known, which is, in practice, unattainable in the perturbation process. The Pad´e approximant, on the other hand, requires only a finite number of terms of the series and is acknowledged as a suitable algorithm to improve the perturbation ∞ (n) n series. Given a power series, f()= n=0 a  , the Pad´e approximant [L/M]is defined as P () [L/M]= L (3.90) QM () where PL is a polynomial of degree at most L and QM is a polynomial of degree at most M. There are L + 1 numerator coefficients and M + 1 denominator coefficients.

Since irrelevant common factors exist between them, for definiteness, QM (0) = 1 is chosen without loss of generality. There remain L + 1 independent numerator coefficients and M independent denominator coefficients which can be determined by imposing the condition that the expansion of the Pad´e approximant and the original power series must agree to the order L + M:

L+M+1 QM ()f() − PL()=O( ) (3.91)

There may exist different PL and QM satisfying Eq. 3.91, but the ratio [L/M]is known to be unique (Appendix B). CHAPTER 3. MATHEMATICAL PRELIMINARIES 37

Expressing PL() and QM ()as

L PL()=p0 + p1 + ···+ pL (3.92) M QM ()=1+q1 + ···+ qM  (3.93) substituting these polynomials into Eq. 3.91, and equating coefficients of equal powers of  gives a system of equations:

(0) a = p0 (1) (0) a + a q1 = p1 (2) (1) (0) a + a q1 + a q2 = p2 . .

(L) (L−1) (0) a + a q1 + ···+ a qL = pL (3.94) (L+1) (L) (L−M+1) a + a q1 + ···+ a qM =0 . .

(L+M) (L+M−1) (L) a + a q1 + ···+ a qM =0 where

a(n) =0 ifn<0 (3.95)

qj =0 ifj>M (3.96)

In Pad´e approximants, the convergent expression to f() is the rational fraction as defined by Eq. 3.90. Rational functions frequently converge more rapidly than power series expansions and in a much larger domain, because of their ability to express f() with poles (Baker and Graves-Morris, 1981). Poles can ruin the convergence of the power series f(), while the Pad´e approximant converges as long as it has enough

powers of  in its denominator QM () to cancel any nearby poles. In addition, by

examining roots of QM = 0, one can investigate the nearest singularity. The Pad´e table is customarily used to arrange a family of Pad´e approximants as CHAPTER 3. MATHEMATICAL PRELIMINARIES 38

shown below. [0/0] [1/0] [2/0] [3/0] ··· [0/1] [1/1] [2/1] [3/1] ··· [0/2] [1/2] [2/2] [3/2] ··· [0/3] [1/3] [2/3] [3/3] ··· [0/4] ··· ··· In this table, partial sums of the power series occupy the first row. If a power series of degree N is given, L and M can be chosen within the condition of L + M ≤ N. The best choice is known to occupy the stair-step diagonal path in the Pad´e table (L = M,ifN is even, or L = M − 1, if N is odd). This fact can be seen in the connection between Pad´e approximants and continued fractions, which also provide convergent expressions for f(). A continued fraction is an infinite sequence of fractions whose (N + 1)th member

FN () can be written in the conventional notation as

c0 c1 c2 c3 cN−1 FN ()= ··· (3.97) 1+ 1+ 1+ 1+ 1+cN  n It is observed by the Taylor expansion of FN () about  = 0 that the coefficient of 

depends only on c0,c1,c2, ···cn, and, hence, it follows that if FN () is to be a Pad´e (0) (1) (2) (n) approximant to f(), cn depends only on a ,a ,a , ···a . With writing AN () FN ()= (3.98) BN () recursive formulae for AN () and BN () can be found in Bender and Orszag (1982) as

An+1()=An()+cn+1An−1() (3.99)

Bn+1()=Bn()+cn+1Bn−1() (3.100)

with A−1()=0,B−1()=1,A0()=c0, and B0()=1.

Working out the degrees of An() and Bn()

degree[A2n()] = n degree[B2n()] = n

degree[A2n+1()] = n degree[B2n+1()] = n +1 CHAPTER 3. MATHEMATICAL PRELIMINARIES 39

By means of this information on the degrees and the observations of the order of the Taylor expansion reproduced, it can be deduced that the sequence of convergents of the continued fraction occupy the stair-step diagonal path in the Pad´e table:

[0/0] [1/0] [2/0] [3/0] ··· [0/1] [1/1] [2/1] [3/1] ··· [0/2] [1/2] [2/2] [3/2] ··· [0/3] [1/3] [2/3] [3/3] ··· [0/4] ··· ···

In particular, the entries along the diagonal in the Pad´e table have characteristic properties of analytic continuation (Appendix B) and are useful in improving the convergence of a series. Chapter 4

Development of a Steady-State Flow Model

The steady-state flow equation, characterized by invariance with time of all physical properties, furnishes an adequate description of some problems in porous media, such as balanced production-injection schemes or pressure-maintained bounded systems. In solving such problems, difficulties arise due to geometric complexities and/or flow domain heterogeneities. The conventional boundary element method is applicable to flow problems with a variety of complex geometries, but not with heterogeneous rock properties. Following the decomposed steady-state flow equations derived in the previous chapter, we develop the perturbation boundary element model applicable to steady- state flow problems in heterogeneous media. The influence of pattern geometries and permeability variations on displacement performances can be estimated by means of streamline tracking, which is also discussed here.

4.1 Boundary Integral Equations

The perturbation equations derived in Section 3.4.1 are associated with the Laplace operator, and, hence, the free-space Green’s function G given by Eq. 3.38 is applicable as the fundamental solution. Applying the second form of Green’s theorem over the

40 CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 41

domain Ω bounded by Γ, the steady-state perturbation equations can be expressed in integral forms as ⎛ ⎞ (0) ns (0) ⎝ ∂pD − (0) ∂G ⎠ − pD (˜xD, y˜D)= G pD dΓ G(˜xD, y˜D; xDl,yDl)qDl (4.1) Γ ∂nD ∂nD l=1 for the zeroth-order equation, and ⎛ ⎞ (n) (n) ⎝ ∂pD − (n) ∂G ⎠ pD (˜xD, y˜D)= G pD dΓ Γ ∂nD ∂nD ∇ ·∇ (n−1) ≥ + G ln K pD dΩ,n1 (4.2) Ω for the nth-order equation. In order to evaluate the contour integral as a summation of piecewise line integrals,

the boundary Γ is discretized into nb linear elements and the local ξη coordinate

system is introduced for each boundary element Γj (1 ≤ j ≤ nb). According to the definitions of influence coefficients given in Section 3.3.1, boundary-discretized forms of Eq. 4.1 and Eq. 4.2 are

nb   ns (0) (0) (0) − (0) − (0) − αipD i = V1ijpDnlj + V2ijpDnaj+1 W1ijpD j W2ijpD j+1 GilqDl (4.3) j=1 l=1 and

nb   (n) (n) (n) − (n) − (n) αipD i = V1ijpDnlj + V2ijpDnaj+1 W1ijpD j W2ijpD j+1 =1 j ∇ ·∇ (n−1) ≥ + G ln K pD dΩ,n1 (4.4) Ω where 1 − V1ij = − ξGi dΓ ξj+1 Gi dΓ (4.5) ξj+1 ξj ΔΓj ΔΓj 1 − V2ij = − ξGi dΓ+ξj Gi dΓ (4.6) ξj+1 ξj ΔΓj ΔΓj 1 ∂G ∂G W1ij = ξ dΓ − ξj+1 dΓ (4.7) +1 − ΔΓ ΔΓ ξj ξj j ∂nD i j ∂nD i 1 ∂G ∂G W2ij = − ξ dΓ+ξj dΓ (4.8) +1 − ΔΓ ΔΓ ξj ξj j ∂nD i j ∂nD i CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 42

Rearranging Eq. 4.3 and Eq. 4.4 with all the unknowns on the left and compar- ing them, one can find that the solution matrices for the zeroth-order and nth-order perturbation equations have identical coefficients, since the unknown boundary con- dition at each node remains the same during the perturbation process. The difference between the two systems of equations lies in the right-hand side, and, hence, once the solution matrix is formed and decomposed, the succeeding perturbation process does not entail any matrix manipulations except forward and backward substitutions with a new right-hand side vector to get the next order solution. Eq. 4.3 can be solved for unknown boundary values by using the conventional (0) BEM. Once all the unknown boundary values are obtained, pD at any selected interior point can be computed. The domain integral in Eq. 4.4 then consists of only known quantities, and can be evaluated numerically as will be discussed in Section 4.3.2. (1) The resulting equation is the Poisson equation in terms of pD , to which the conven- tional BEM is applicable. In a similar way, the higher-order (n>1) solutions can (n−1) be obtained by solving Eq. 4.4 repeatedly with known pD from the previous per- (n) turbation. This successive procedure is continued until pD becomes less than some tolerance value ΔpD, and the final solution is obtained as a summation of various order perturbation solutions. If a convergent solution at every node is obtained after solving the Nth-order perturbation equation, interior solutions can be expressed as nb N N (n) (n) pDi = V1ij pDnlj + V2ij pDnaj+1 j=1 n=0 n=0 N N − (n) − (n) W1ij pD j W2ij pD j+1 n=0 n=0 ns N − ∇ · ∇ (n−1) GilqDl + G ln K pD dΩ (4.9) Ω l=1 n=1 where the summations over n are independent of the location of the interior point i, and must be computed only once. CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 43

4.2 Treatment of Wells

One of the features of the boundary element method is a simple but accurate treat- ment of wells. In this section, we discuss how the model treats well singularities, which often cause considerable difficulty in domain methods.

4.2.1 Well Singularity

Thus far, well singularities have been treated as inhomogeneities in the zeroth-order perturbation equation as shown in Eq. 4.3. However, the solution of the first-order perturbation equation requires the evaluation of the domain integral, the integrand (0) of which involves pD , and as will be discussed in Section 4.3.2, it is desirable to treat well singularities separately in order to evaluate the integral with sufficient accuracy. In addition, even in the conventional BEM, the well singularity damages computational accuracy when the singularity lies so close to the boundary that the linear interpolation along the boundary is no longer appropriate. The so-called singularity programming approach lets us achieve the separation of well singularities and non-singular solutions. The procedure is a sequence of desu- perposition and superposition of singularities. For wells with diminishing radii in an (0) infinite domain, the singular solution pDs can be written as

ns (0) qDl pDs = ln rDl (4.10) l=1 2π By use of desuperposition, the zeroth-order boundary conditions in terms of the non- (0) singular solution pDns become

ns (0) − qDl ∈ pDns = HD ln rDl, Γ1 Γ (4.11) l=1 2π (0) ns ∂pDns qDl ∂rDl = QD − , Γ2 ∈ Γ (4.12) ∂nD l=1 2πrDl ∂nD (0) pDns under these boundary conditions can be determined with the conventional BEM, and, by superposition, the complete zeroth-order solution is

(0) (0) (0) pD = pDns + pDs (4.13) CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 44

As for the higher-order (n ≥ 2) perturbation equations, no well singularity is involved explicitly, and the perturbation solutions can be obtained in a conventional way without significant loss of accuracy.

4.2.2 Pressure Specified Wells

In some problems, the well pressure instead of its strength is prescribed. Suppose

the flowing pressure at the well L is specified, then an additional unknown qDL is entailed, and there are nb + 1 unknowns in all. A deficiency of one equation against unknowns can be made up by the interior-solution equation expressing the sand-face pressure at the well L:

nb   (0) (0) (0) − (0) − (0) pD L = V1LjpDnlj + V2LjpDnaj+1 W1LjpD j W2LjpD j+1 j=1 ns − − (0) GLlqDl GLLqD L (4.14) l=1,l=L for the zeroth-order perturbation and

nb   (n) (n) − (n) − (n) 0= V1LjpDnlj + V2LjpDnaj+1 W1LjpD j W2LjpD j+1 =1 j ∇ ·∇ (n−1) − (n) ≥ + G ln K pD dΩ GLLqD ,n1 (4.15) Ω L for the nth-order perturbation, respectively. (n) These equations are solved for qD L with a set of nb equations given by Eq. 4.3 or Eq. 4.4, simultaneously. The (nb +1)by(nb + 1) solution matrices have the same feature as observed in Section 4.1; they are identical regardless of the order of perturbation n, and must be formed and decomposed only once. (n) The final solution for the well strength is the summation of qD L:

N (n) qDL = qD L (4.16) n=0 and once qDL is obtained, Eq. 4.9 can be used to compute interior solutions in a way similar to the rate specified case. CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 45

When considering wells in a closed system, the procedure described here becomes indispensable. Since the nth-order (n ≥ 1) perturbation equation (Eq. 4.4) is in- homogeneous due to the domain integral term, the condition of steady state is vi- olated unless the domain is open through its boundary or wells, and, hence, the free-space Green’s function G cannot be applied. If the boundary permits no flow, the sink/source term, which is the only quantity to cancel the inhomogeneous term, must be introduced into Eq. 4.4. As is shown in Eq. 4.15, this can be done by treating (n) the well strength qD L as an unknown quantity.

4.3 Evaluation of Integrals

The discretized boundary integral equations, Eq. 4.3 and Eq. 4.4, involve boundary and domain integrals. In view of the repeated usage of these integrals in the pertur- bation process, the accuracy of their estimates is crucial to the accuracy of the final solution. In this section, we discuss the evaluation of these integrals.

4.3.1 Boundary Integrals

Four kinds of boundary integrals arise in the influence coefficients: ∂G ∂G Gi dΓ ξGi dΓ dΓ ξ dΓ ΔΓ ΔΓ ΔΓ ΔΓ j j j ∂nD i j ∂nD i As discussed in Section 3.3.1, these boundary integrals, which are double integrals in the xDyD coordinates, can be evaluated easily in the local ξη coordinates introduced previously. The connecting relations between the two coordinate systems are written as −Δx (x − x ) − Δy (y − y ) Dj D Di Dj D Di ξ = 2 2 (4.17) ΔxDj +ΔyDj −Δx (y − y )+Δy (x − x ) Dj Dj Di Dj Dj Di η = 2 2 (4.18) ΔxDj +ΔyDj − − where ΔxDj = xDj+1 xDj and ΔyDj = yDj+1 yDj. CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 46

In addition, referring to the definition of the ξη coordinate system, the following relations are readily found:

dΓ=−dξ (4.19) 2 2 rDi = ξ + η (4.20) ∂r η Di = (4.21) ∂nD rDi As Eq. 4.18 indicates, η is fixed for each boundary element, and can be taken outside of the integrals. Making use of these relations, the line integrals along the boundary element ΔΓj can be evaluated analytically with the integration variable ξ

from ξj to ξj+1: 1 Gi dΓ= ln rDi dξ ΔΓj 2π ΔΓj 1 { 2 2 − }|j+1 = ξ ln(ξ + η ) 2ξ +2η arctan(ξ/η) j (4.22) 4π 1 ξGi dΓ= ξ ln rDi dξ ΔΓj 2π ΔΓj 1 +1 = {(ξ2 + η2) ln(ξ2 + η2) − ξ2}|j (4.23) 8π j ∂G 1 η dΓ= dξ ΔΓ ΔΓ j ∂nD i 2π jrDi 1 +1 = arctan(ξ/η)|j (4.24) 2π j ∂G 1 ξη ξ dΓ= dξ ΔΓ ΔΓ j ∂nD i 2π jrDi 1 +1 = {η ln(ξ2 + η2)}|j (4.25) 4π j In the perturbation process, the influence coefficients remain the same, and the eval- uation of these boundary integrals must be performed only once.

4.3.2 Domain Integrals

In order to evaluate the domain integral in Eq. 4.4, the domain Ω is divided into nt triangular elements, vertices of which are allocated at the points where K is known. CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 47

For each element, ∇ ln K can be evaluated by assuming appropriate interpolation functions between the vertices. The following two interpolations, which appear to be sufficient for practical use, are employed in this study:

ln K = axD + byD + c (4.26)    K = a xD + b yD + c (4.27) which lead to ⎧ ⎪ ∂ ln K ⎨ a if ln K is linear  = ⎪ a (4.28) ∂xD ⎩⎪ if K is linear ⎧ K ⎪ ∂ ln K ⎨ b if ln K is linear  = ⎪ b (4.29) ∂yD ⎩⎪ if K is linear K (n−1) As for pD , when there is no well singularity, the linear interpolation is employed between the vertices: (n−1) pD = dxD + eyD + f (4.30) which results in ( −1) ∂p n D = d (4.31) ∂xD ( −1) ∂p n D = e (4.32) ∂yD Then, the domain integral can be approximated as a summation of triangular element integrals as nt ∇ ·∇ (n−1) ∇ ·∇ (n−1) G ln K pD dΩ= G ln K pD dΩ Ω ΔΩ m=1 m ⎧ ⎪ nt ⎪ ⎪ (ad + be) GdΩiflnK is linear ⎨ ΔΩ m=1 m = (4.33) ⎪ nt ⎪  G  G ⎩⎪ a d dΩ+b e dΩ if K is linear ΔΩ ΔΩ m=1 m K m K

(n−1) Since the integrands G and G/K are independent of pD , the area integral over each triangular element can be evaluated prior to the perturbation process. CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 48

Triangular Points coordinates Weights

1 1 1 9 s A ( , , ) − B 3 3 3 16 25 B (0.6, 0.2, 0.2) A 48 s 25 s C (0.2, 0.6, 0.2) 48 C s D 25 D (0.2, 0.2, 0.6) 48

Figure 4.1: Quadrature points and weights of four-point Gaussian quadrature.

The integration over a triangular area can be performed numerically using the Gaussian quadrature. Although the Gaussian quadrature is known to be optimal in the sense of being the highest order for a given number of function evaluations in one dimension (Davis and Rabinowitz, 1984), it is not necessarily optimal in multi- dimensional cases. Nevertheless, the Gaussian quadrature is still widely used, and is sufficient for the present needs. The weights and the quadrature points are chosen according to Cowper (1973), because they are symmetric with respect to the three vertices of the triangular ele- ment, and, hence, the result does not depend on the orientation of the element with respect to the quadrature points. Cowper’s four-point formula integrates any poly- nomial of degree three or less exactly, and requires computations of the integrand only four times, which appears to be accurate enough and efficient enough for the present problem unless the element size is too large to postulate the linear pressure profile over the element. Figure 4.1 shows the weights and the sampling points of the four-point quadrature formula. CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 49

Since the triangular coordinates are invariant under a mapping by a linear trans- formation, these quadrature points apply to triangles of any shape. The connecting

relations between the triangular coordinates (L1,L2,L3) and the Cartesian xDyD sys- tem are written (Zienkiewicz and Taylor, 1989) as

xD = L1xD1 + L2xD2 + L3xD3 (4.34)

yD = L1yD1 + L2yD2 + L3yD3 (4.35)

1=L1 + L2 + L3 (4.36) where the subscripts denote the vertices of a triangle. When well singularities affect the pressure profile, it is improper to use the linear (0) interpolation for pD , particularly in the vicinity of singular points. However, as (0) (0) described in Section 4.2.1, pD can be desuperposed into the non-singular part pDns, (0) (0) to which the linear interpolation is applicable, and the singular part pDs. Since pDs ∇ (0) is given by Eq. 4.10, pDs can be evaluated at quadrature points analytically, and (0) the domain integral in terms of pDs yields nt ∇ ·∇ (0) ∇ ·∇ (0) G ln K pDs dΩ= G ln K pDs dΩ Ω ΔΩ m=1 m ⎧ ⎪ nt ns − ⎪ qDl xD xDl ⎪ a G 2 dΩ ⎪ ΔΩ ⎪ m=1 m l=1 2π rDl ⎪ ⎪ ns − ⎪ qDl yD yDl ⎪ +b G 2 dΩ if ln K is linear ⎨ ΔΩ m l=1 2π rDl = (4.37) ⎪ nt ns − ⎪  G qDl xD xDl ⎪ a 2 dΩ ⎪ ΔΩ ⎪ m=1 m K l=1 2π rDl ⎪ ⎪ ns − ⎪  G qDl yD yDl ⎩ +b 2 dΩ if K is linear ΔΩ m K l=1 2π rDl

(0) The complete domain integral in terms of pD can be obtained as a summation of singular and non-singular parts: ∇ ·∇ (0) ∇ ·∇ (0) ∇ ·∇ (0) G ln K pD dΩ= G ln K pDns dΩ+ G ln K pDs dΩ (4.38) Ω Ω Ω CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 50

4.4 Evaluation of Pad´e Approximants

In order to improve the perturbation series, Pad´e approximants are utilized. During (n) the perturbation process, as each new pD is computed, it is folded in the Pad´e (0) (1) ··· (n−1) approximant with pD , pD , , pD to give a new and improved approximation to the exact solution pD. (n) ≤ ≤ Given pD , (0 n N), the Pad´e approximant [L/M] can be determined by a simple sequence of matrix operations as shown in Section 3.5.2. L and M are chosen according to the stair-step diagonal path in the Pad´e table: ⎧ ⎨ N if N is even L = 2 (4.39) ⎩ 1 − 2 (N 1) if N is odd ⎧ ⎨ N 2 if N is even M = ⎩ 1 (4.40) 2 (N +1) ifN is odd

If the Gaussian elimination is used in solving the matrix, it requires on the order of N 3 operations. Moreover, when the Pad´e approximant is expressed as a ratio of polynomials, every coefficient in the rational function must be recomputed during the perturbation process. Since these operations are necessary for every node, a more efficient algorithm is desirable as the number of nodes and the order of perturbation increase. Continued fractions, which are equivalent to the stair-step diagonal entries in the Pad´e table, provide an alternative. Setting the perturbation parameter  = 1 in Eq. 3.97, there follows

N (n) c0 c1 c2 c3 ··· cN−1 pD = FN = (4.41) n=0 1+ 1+ 1+ 1+ 1+cN The recursive formulae given by Eq. 3.99 and Eq. 3.100 indicate that only one new coefficient cn+1 must be estimated as the perturbation proceeds from the nth-order to the (n + 1)th-order solution:

An+1 Fn+1 = Bn+1 A + c +1A −1 = n n n (4.42) Bn + cn+1Bn−1 CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 51

where An, An−1, Bn, and Bn−1 are known from the previous perturbation computa- tions. (n) The coefficient cn+1 can be computed from pD by means of the QD (quotient- difference) algorithm (Baker and Graves-Morris, 1981), which is an extension of the classical Bernoulli’s method. In the context of numerical computation, it is more convenient to express Eq. 4.41 as

N J−1 (J) (J) (J) (J) (J) (n) (n) pD q1 e1 q2 e2 ··· pD = pD + (4.43) n=0 n=0 1+ 1+ 1+ 1+ 1+ (J) (J) ≥ It can be shown that the coefficients qi and ei satisfy, for J 0, the following rhombus rules:

(J+1) (J+1) (J) ei qi qi+1 = (J) (4.44) ei (J) (J) − (J+1) − (J+1) ei = qi qi ei−1 (4.45) and with setting the initializing values for 0 ≤ J ≤ n as

(J+1) (J) pD q1 = (J) (4.46) pD (J) e0 = 0 (4.47) cn+1 can be computed from Eq. 4.44 when n + 1 is even or from Eq. 4.45 when n +1 is odd. This method requires on the order of N 2 operations, and, compared with the direct solution method, saves computational effort as the order of perturbation increases.

4.5 Streamline Tracking

Bear (1972) defines streamlines as the instantaneous curves that are at every point tangent to the direction of the velocity at that point. According to this definition, streamlines can be drawn by tracking a fluid particle path with the knowledge of the velocity field in a flow domain, since for steady-state flow the pathlines coincide with the streamlines. CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 52

The velocity-vector component in the z-direction (z = x, y) can be evaluated by taking the directional derivative of Eq. 4.9: −k ∂pD vzDi = (4.48) μ ∂zD i where nb N N ∂pD ∂V1ij (n) ∂V2ij (n) 2π = pDnlj + pDnaj+1 ∂zD i j=1 ∂zDi n=0 ∂zDi n=0 N N −∂W1ij (n) − ∂W2ij (n) pD j pD j+1 ∂zDi n=0 ∂zDi n=0 ns N − ∂Gil ∂G ∇ · ∇ (n−1) qDl + ln K pD dΩ (4.49) Ω l=1 ∂zDi ∂zDi n=1 The derivatives of influence coefficients involved in Eq. 4.49 can be evaluated analyt- ically, and are discussed in Appendix C.

4.5.1 Euler and Modified Euler Methods

Let (xDi,yDi) be a point on a streamline. The Euler method gives the first-order estimate of the next point on the same streamline as ⎛ ⎞ ⎛ ⎞ vxD i ⎛ ⎞ ⎜ xDi + ΔsD ⎟ 2 xDi+1 v O(ΔsD ) ⎝ ⎠ = ⎜ Di ⎟ + ⎝ ⎠ (4.50) ⎝ vyD i ⎠ 2 yDi+1 yDi + ΔsD O(ΔsD ) vDi where ΔsD is some fixed length and 2 2 vDi = vxD i + vyD i (4.51)

The Euler method is based on the assumption that the fluid particle moves in the direction of the velocity vector at (xDi,yDi), which will not be valid when ΔsD is large and the streamline changes its advancing direction rapidly. In the second-order Runge-Kutta scheme, known as the modified Euler method, the fluid particle is assumed to move in the direction of the average velocity over the CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 53

interval between the point i and the next point i + 1. The location of the point i +1 is given by ⎛ ⎞ ⎛ ⎞ vxD i + vxD i+1/2 ⎛ ⎞ ⎜ xDi + ΔsD ⎟ 3 xDi+1 ⎜ 2¯v ⎟ O(ΔsD ) ⎝ ⎠ = ⎜ Di ⎟ + ⎝ ⎠ (4.52) ⎝ vyD i + vyD i+1/2 ⎠ 3 yD +1 O(ΔsD ) i yDi + ΔsD 2¯vDi where the subscript i +1/2 denotes the point that is tracked by the Euler method and 2 2 2¯vDi = (vxD i + vxD i+1/2) +(vyD i + vyD i+1/2) (4.53) It is possible to formulate higher-order Runge-Kutta schemes, which give further improvement in accuracy. In the mth-order Runge-Kutta scheme, the derivative must be evaluated m times for each particle point and the local truncation error is of m+1 order ΔsD . In choosing an adequate order m, one should consider two conflicting demands: on one hand, m should be as low as possible in order to avoid an excessive number of derivative evaluations, and, on the other hand, m should be high enough to achieve a sufficient order of accuracy. Fortunately, streamlines are usually smooth,

and the second-order Runge-Kutta scheme with a reasonably small ΔsD is accurate enough in tracking streamlines.

The time increment Δti, corresponding to the time during which the fluid particle moves from i to i + 1, can be expressed as ⎧ ⎪ ΔsD ⎨⎪ Euler Method v Δt = Di (4.54) i ⎪ Δs ⎩⎪ D Modified Euler Method v¯Di and the total elapsed time tnet after net stepwise trackings is given by

net

tnet = Δti (4.55) i=1 Numbere and Tiab (1988) presented a streamline tracking scheme with some fixed

Δt instead of ΔsD. With this scheme, since the advance length ΔsD is proportional to pressure gradients, Δt should be set small enough that the tracking accuracy is kept high in the region where the pressure gradient is steep. This fixed Δt may be CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 54

too large to perform an efficient tracking in the region where the pressure gradient is moderate. In the present scheme, on the other hand, the pressure-gradient variation

in the domain has an influence on Δti but not on ΔsD, and, hence, streamlines can be tracked efficiently throughout the flow domain.

4.5.2 Displacement Performance

In a unit-mobility ratio displacement problem including injection and production wells with balanced rates, the performance can be characterized by the breakthrough time and the effluent concentration history of the displacing fluid. With a number of streamlines tracked from the injection well towards the production well(s), these two characteristic factors can be obtained from the locations of fluid particles and the elapsed time.

If nsl streamlines are tracked from equiangular points around the sand face of the injection well I, the volumetric flow rate of the islth streamline is proportional to the pressure gradient at the sand-face starting point: ∂pD isl ∂rD rwDI qDI = qDI (4.56) isl nsl ∂p Djsl =1 ∂rD jsl rwDI Each of the streamlines from the injection well is tracked until it reaches one of the production wells or it travels out of the flow domain of interest. During the tracking procedure, the position of each particle is stored with the corresponding elapsed time. After all the streamlines are tracked, the breakthrough time can be estimated from the fastest streamline that arrives at the production well. The effluent concentration of the displacing fluid at the production well P after a certain injection time (t) can be evaluated by comparing the injection time with the time (tb) required for each of the streamlines to reach the production well. If tb of the islth streamline is smaller than t, the flow rate assigned to this streamline given by Eq. 4.56 contributes to the effluent concentration. Symbolically, this can be written CHAPTER 4. DEVELOPMENT OF A STEADY-STATE FLOW MODEL 55

as 1 nsl C(t)= q H(t − t ) (4.57) q DIisl bisl DP isl=1 − where C(t) is the effluent concentration at time t and H(t tbisl ) is the Heaviside step function: ⎧ ⎨ 1ift>tbisl H(t − tbi )= (4.58) sl ⎩ 0 otherwise Chapter 5

Development of a Transient Flow Model

The transient flow equation describes a large number of flow problems in petroleum reservoirs. If the medium is homogeneous, there exist a number of general techniques for the solution of the transient flow equation. In particular, analytical methods are applicable to relatively simple geometries and play an important role in analyzing well test data. However, if the domain shape is too complex to yield an analytical solution, some numerical means is required. The boundary element method is a good option because of its ability to preserve the nature of an analytical solution. Although it is possible to formulate the boundary integral equation in real space, the Laplace-space formulation described in Chapter 3 is employed in this study. Us- ing the decomposed transient flow equations, we develop the perturbation boundary element model applicable to flow problems in heterogeneous porous media. Since its main utility is found in well testing problems, the model includes pressure derivatives and effects of skin and wellbore storage.

5.1 Boundary Integral Equations

The perturbation equations derived in Section 3.4.2 are associated with the modified Helmholtz operator, and, hence, the free-space Green’s function G¯ given by Eq. 3.50

56 CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 57

is applicable as the fundamental solution. The corresponding boundary integral equa-

tions in terms of the transformed variablep ¯D can be expressed as ⎛ ⎞ (0) ¯ ns (0) ⎝ ¯ ∂p¯D − (0) ∂G ⎠ − 1 ¯ p¯D (˜xD, y˜D)= G p¯D dΓ G(˜xD, y˜D; xDl,yDl)qDl (5.1) Γ ∂nD ∂nD s l=1 for the zeroth-order equation, and ⎛ ⎞ (n) ¯ (n) ⎝ ¯ ∂p¯D − (n) ∂G ⎠ p¯D (˜xD, y˜D)= G p¯D dΓ Γ ∂nD ∂nD n − ν−1 − ν − ¯ ( ln K) ( ln K) (n−ν) s G Φ + p¯D dΩ Ω (ν − 1)! ν! ν=1 ¯ ∇ ·∇ (n−1) ≥ + G ln K p¯D dΩ,n1 (5.2) Ω for the nth-order equation. As is the case with the steady-state flow model, the boundary Γ is discretized into nb linear elements and the local coordinate system is introduced for each boundary element Γj (1 ≤ j ≤ nb). According to the definitions of influence coefficients given in Section 3.3.1, discretized forms of Eq. 5.1 and Eq. 5.2 become

nb   ns (0) ¯ (0) ¯ (0) − ¯ (0) − ¯ (0) − 1 ¯ αip¯Di = V1ijp¯Dnl j + V2ijp¯Dna j+1 W1ijp¯Dj W2ijp¯Dj+1 GilqDl (5.3) j=1 s l=1 and

nb   (n) ¯ (n) ¯ (n) − ¯ (n) − ¯ (n) αip¯Di = V1ijp¯Dnl j + V2ijp¯Dna j+1 W1ijp¯Dj W2ijp¯Dj+1 j=1 n − ν−1 − ν − ¯ ( ln K) ( ln K) (n−ν) s G Φ + p¯D dΩ Ω (ν − 1)! ν! ν=1 ¯ ∇ ·∇ (n−1) ≥ + G ln K p¯D dΩ,n1 (5.4) Ω

where ¯ 1 ¯ − ¯ V1ij = − ξGi dΓ ξj+1 Gi dΓ (5.5) ξj+1 ξj ΔΓj ΔΓj ¯ 1 − ¯ ¯ V2ij = − ξGi dΓ+ξj Gi dΓ (5.6) ξj+1 ξj ΔΓj ΔΓj CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 58

1 ∂G¯ ∂G¯ W¯ 1ij = ξ dΓ − ξj+1 dΓ (5.7) +1 − ΔΓ ΔΓ ξj ξj j ∂nD i j ∂nD i 1 ∂G¯ ∂G¯ W¯ 2ij = − ξ dΓ+ξj dΓ (5.8) +1 − ΔΓ ΔΓ ξj ξj j ∂nD i j ∂nD i To invert Laplace-space solutions to real space, the Stehfest algorithm (1970) is employed, based on the assumption that the approximate value of the inverse can be evaluated by the expectation of the inverse with respect to the following probability density function: (2n)! f (a, z)=a (1 − e−az)ne−naz (5.9) n n!(n − 1)! Symbolically, the algorithm can be written as

ln 2 nst pD(tDA)= Fip¯D(si) (5.10) tDA i=1 where ln 2 si = i (5.11) tDA min( 2) i,nst/ nst/2 2+ j (2j)! − nst/ i Fi =( 1) − − − − (5.12) j=(i+1)/2 (nst/2 j)! j!(j 1)! (i j)! (2j i)! and nst is the even number of sampling times at whichp ¯D is evaluated.

For a given tDA, Eq. 5.3 and Eq. 5.4 must be solved for each of the si values. Except for this repeating procedure, the perturbation process is analogous to the steady-state case described in the previous chapter. After solving a system of equations for each (n) ≤ ≤ of the si, the solutionsp ¯D (si)(1 i nst) are inverted to real space by means of (n) the Stehfest algorithm, and the resultant pD (tDA) is compared against the real-space tolerance ΔpD to check whether the perturbation series converges.

At each given time tDA, Eq. 5.3 and Eq. 5.4 form nst sets of equations. The nst sets of solution matrices for the zeroth-order perturbation equations are identical to those for the nth-order perturbation equations as is the case with the steady-state

flow model formulation. This implies that the nst sets of solution matrices should be formed and decomposed only once for each tDA. CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 59

If the first N + 1 perturbation solutions give a convergent series, interior solutions in Laplace space can be obtained as nb N N ¯ (n) ¯ (n) p¯Di = V1ij p¯Dnl j + V2ij p¯Dna j+1 j=1 n=0 n=0 N N ns − ¯ (n) − ¯ (n) − 1 ¯ W1ij p¯Dj W2ij p¯Dj+1 GilqDl n=0 n=0 s l=1 N n − ν−1 − ν − ¯ ( ln K) ( ln K) (n−ν) s G Φ + p¯D dΩ Ω − n=1 ν=1 (ν 1)! ν! N ¯ ∇ · ∇ (n−1) + G ln K p¯D dΩ (5.13) Ω n=1 where the summations over n are independent of the location of the interior point denoted by i, and must be computed only once. The Laplace-space interior solution can be inverted to real space by use of the Stehfest algorithm.

5.2 Treatment of Wells

Analyses of well testing results have been a great concern of petroleum engineers. When such problems are solved by numerical methods, an accurate representation of well singularities is of crucial importance. By use of superposition, the boundary element method can handle the singularities accurately.

5.2.1 Well Singularity

As is the case with the steady-state flow model, well singularities can be treated by means of the singularity programming. The concept of superposition allows us (0) to decompose the zeroth-order perturbation solutionp ¯D into the non-singular and singular parts: (0) (0) (0) p¯D =¯pDns +¯pDs (5.14) in which the singular solution is given by

ns √ (0) − qDl p¯Ds = K0( srDl) (5.15) l=1 2πs CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 60

where K0 is the modified Bessel function of the second kind and of order zero. By use of desuperposition, the corresponding zeroth-order boundary conditions in terms (0) of the non-singular solution (¯pDns) are expressed as

ns √ (0) HD qDl ∈ p¯Dns = + K0( srDl), Γ1 Γ (5.16) s l=1 2πs (0) ns √ ∂p¯Dns QD − qD√l ∂rDl ∈ = K1( srDl) , Γ2 Γ (5.17) ∂nD s l=1 2π s ∂nD where K1 is the modified Bessel function of the second kind and of order one. At early times (or until boundary effects and/or heterogeneities are felt), the pressure response at a well is fully determined by the well singularity. Therefore, the reference constants k0 and φ0 should be chosen in accordance with near-well values to preserve the computational accuracy at early times. If there exists more than one well and near-well properties are different, it is recommended that the perturbation BEM be applied separately and the solution obtained by superposition.

5.2.2 Pressure Specified Wells

The relationship between the pressure response to a constant flow rate and the flow rate response to a constant pressure production is given in Laplace space (van Everdin- gen and Hurst, 1949) as 1 q¯D = 2 (5.18) s p¯D Kikani (1989) showed the rate response can be simulated by the boundary element model through this identity. Although this production scheme is not included here because it is seldom used in practice, its inclusion can be readily achieved by adding an auxiliary routine.

5.3 Evaluation of Integrals

Most of the boundary and domain integrals involved in Eq. 5.3 and Eq. 5.4 cannot be evaluated analytically, and numerical integration must be used. In this section, the evaluation of these integrals is discussed. CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 61

5.3.1 Boundary Integrals

There are four line integrals involved in the influence coefficients: ∂G¯ ∂G¯ G¯i dΓ ξG¯i dΓ dΓ ξ dΓ ΔΓ ΔΓ ΔΓ ΔΓ j j j ∂nD i j ∂nD i only the last one of which can be evaluated analytically: √ ¯ √ ∂G − s ∂rDi ξ dΓ= ξK1( srDi) dΓ ΔΓj ∂nD 2π ΔΓj ∂nD i √ sη ξ √ = K1( srDi) dξ ΔΓ 2π j rDi √ η d 2 2 = − K0( s ξ + η ) dξ 2π ΔΓ dξ √j η 2 2 j+1 = − K0( s ξ + η ) | (5.19) 2π j where use is made of the relations Eq. 4.19 through Eq. 4.21 in Section 4.3.1 and d K0(ax)=−aK1(ax) (5.20) dx The other integrals, which can be rewritten with the integration variable ξ as below, require numerical evaluations. √ ¯ 1 Gi dΓ=− K0( srDi) dξ (5.21) ΔΓj 2π ΔΓj √ ¯ 1 ξGi dΓ=− ξK0( srDi) dξ (5.22) ΔΓj 2π ΔΓj √ √ ∂G¯ sη K1( sr ) dΓ= Di dξ (5.23) ΔΓ ΔΓ j ∂nD i 2π j rDi As mentioned in Section 4.3.2, the Gaussian (Gauss-Legendre) quadrature is known to be optimal in the sense of being the highest order for a given number of function evaluations in one dimension. Although high order is not always equivalent to high accuracy, the free-space Green’s function G¯ behaves smoothly except for singularity points, and this ensures that high order amounts to high accuracy. As is often the case with many other numerical integration schemes, the Gaussian quadrature approximates an integral by a linear combination of the estimates of the CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 62

integrand: b b − a ng f(x) dx = wif(xi)+Rng (5.24) a 2 i=1 where b − a b − a x = χ + (5.25) i 2 i 2 2ng +1 4 2ng (b − a) (ng!) d f(x) Rng = 3 2n (5.26) (2ng +1){(2M)!} dx g

The weights wi and the quadrature points χi can be determined through the three- term recurrence formula for orthogonal polynomials (Davis and Rabinowitz, 1984):

ng { − } Png+1(χ)= χPng (χ) Png−1(χ) + χPng (χ) (5.27) ng +1 with the initializing conditions:

P0(χ) = 1 (5.28)

P1(χ)=χ (5.29)

where Png (χ) is the Legendre polynomials, zeros of which are approximated by − − 1 −2 1 −3 4i 1 ··· χi =(1 ng + ng ) cos π, i =1, 2, ,ng (5.30) 8 8 4ng +2 and further refined by Newton-Raphson iteration. The corresponding weights are − 2 2(1 χi ) wi = { }2 (5.31) ngPng−1(χi)

It is obvious from the order of the derivative in Eq. 5.26 that the ng-point Gaussian quadrature can integrate any polynomial of degree 2ng − 1 or less exactly. Although the method can be coded so that it accepts any non-trivial ng, the six-point Gaussian quadrature (ng = 6) was used throughout this study, which gives satisfactory results as shown in Chapter 7. As mentioned in Section 3.3.1, the free-space Green’s function G¯ exhibits a sin- gularity when the point i coincides with the point j or j + 1. Since the Gaussian quadrature is an open formula, whose quadrature points are not allocated at the end-

points, it is possible to apply the quadrature. However, it requires much larger ng and CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 63

thus a significant computational effort to achieve an accurate evaluation. Fortunately, since η = 0 in this situation, Eq. 5.23 becomes zero and the integrands in Eq. 5.21 √ √ and Eq. 5.22 become K0( sξ) and ξK0( sξ), respectively, and the integrals can be evaluated analytically as discussed in Appendix C.

5.3.2 Domain Integrals

There arise two kinds of domain integrals in Eq. 5.4. The integrand of the first domain

integral: n − ν−1 − ν ¯ ( ln K) ( ln K) (n−ν) G Φ + p¯D dΩ Ω − ν=1 (ν 1)! ν! (n−ν) containsp ¯D , which is evaluated at each vertex of the internal nt triangular ele- ments. Due to the singularity of the free-space Green’s function G¯, the quadrature (n−ν) points cannot be allocated at the points wherep ¯D must be evaluated. Thus, the one-point Gaussian quadrature, in which the quadrature point is at the centroid of a triangle and the weight is 1, is employed. Although it is second-order accurate, the one-point quadrature gives an accurate enough evaluation of the domain integral including no singular solution as is demonstrated in Chapter 7. (0) When the integrand contains the singular solutionp ¯Ds, the integral is decomposed by use of superposition: − n−1 − n ¯ ( ln K) ( ln K) (0) G Φ + p¯D dΩ Ω (n − 1)! n! − n−1 − n ¯ ( ln K) ( ln K) (0) = G Φ + p¯Dns dΩ Ω (n − 1)! n! − n−1 − n ¯ ( ln K) ( ln K) (0) + G Φ + p¯Ds dΩ (5.32) Ω (n − 1)! n! the singular part of which can be rewritten as − n−1 − n ¯ ( ln K) ( ln K) (0) G Φ + p¯Ds dΩ Ω (n − 1)! n! nt − n−1 − n ¯ ( ln K) ( ln K) (0) = G Φ + p¯Ds dΩ ΔΩ − m=1 m (n 1)! n! nt − n−1 − n ns √ ¯ ( ln K) ( ln K) qDl = − G Φ + K0( srDl) dΩ (5.33) ΔΩ − m=1 m (n 1)! n! l=1 2πs CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 64

where the integrations over triangular elements are evaluated by the four-point Gaus- sian quadrature. The second domain integral: ¯ ∇ ·∇ (n−1) G ln K p¯D dΩ Ω can be evaluated in a way similar to that in the steady-state case. By using the log-linear (Eq. 4.26) or linear (Eq. 4.27) interpolation for K and the linear (Eq. 4.30) (n−1) ¯ interpolation for pD , Eq. 4.33 with G replaced by G provides an approximate evaluation of the domain integral. This approximation is valid as long as the integrand contains no singular solution. The Cowper four-point formula (1973) is employed as a numerical integration scheme. In order to achieve an accurate evaluation of the integral including the singular (0) solutionp ¯Ds, the concept of superposition is utilized and the domain integral in terms (0) ofp ¯D is desuperposed into the non-singular and the singular part: ¯ ∇ ·∇ (0) ¯ ∇ ·∇ (0) ¯ ∇ ·∇ (0) G ln K p¯D dΩ= G ln K p¯Dns dΩ+ G ln K p¯Ds dΩ (5.34) Ω Ω Ω

(0) ∇ (0) p¯Ds is given by Eq. 5.15, and, thus, p¯Ds can be evaluated at quadrature points (0) analytically. The domain integral in terms ofp ¯Ds becomes nt ¯ ∇ ·∇ (0) ¯ ∇ ·∇ (0) G ln K p¯Ds dΩ= G ln K p¯Ds dΩ Ω ΔΩ m=1 m ⎧ ⎪ nt ns q x − x √ ⎪ ¯ Dl ( √D Dl) ⎪ a G K1( srDl) dΩ ⎪ ΔΩ ⎪ m=1 m l=1 2π srDl ⎪ ⎪ ns − √ ⎪ ¯ qDl (y√D yDl) ⎪ +b G K1( srDl) dΩ if ln K is linear ⎨ ΔΩ m l=1 2π srDl = (5.35) ⎪ nt ¯ ns − √ ⎪  G qDl (x√D xDl) ⎪ a K1( srDl) dΩ ⎪ ΔΩ ⎪ m=1 m K l=1 2π srDl ⎪ ⎪ G¯ ns q (y − y ) √ ⎪  Dl √D Dl ⎩ +b K1( srDl) dΩ if K is linear ΔΩ m K l=1 2π srDl where a, b, a, and b are given by Eqs. 4.26 and 4.27. CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 65

5.4 Evaluation of Pad´e Approximants

(N) In the Nth-order perturbation process, the transient flow model computesp ¯D (si) N (n) at nst sampling points in Laplace space. When the naive summation n=1 p¯D (si) does not converge or, if it does, the rate of convergence is too slow to complete the computation within a practical limit, the series can be improved by the corresponding Laplace-space Pad´e approximant, which can be evaluated by the same method as described in Section 4.4: the direct matrix operations or the continued fractions with the QD algorithm. As mentioned previously, the evaluation of Pad´e approximants requires on the order of at least N 2 operations. Thus, during the perturbation process from the first order to the Nth order, the order of operations required for nst sets of perturbation solutions becomes   N 2 3 order nst n = nstN n=1

If all of the nst approximants converge, the real-space solution can be obtained by means of the Stehfest algorithm:

nst (n) ln 2 (n) pD (tDA)= Fip¯D (si) (5.36) tDA i=1 which requires on the order of nst operations, and, hence, the model executes on the 3 order of nstN + nst operations in all. Since the Laplace transform is linear, the Laplace-space perturbation series is inverted to real space as

∞ N N ∞ n (n) n (n)  p¯D dtDA =  p¯D dtDA 0 0 n=0 n=0 N n (n) =  pD (5.37) n=0 Due to the fact that the inversion of the perturbation series in Laplace space results in the perturbation series in real space, it is mathematically correct to evaluate the Pad´e approximant in real space, even if the perturbation process is carried out in Laplace space. CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 66

If the Laplace-space solution is inverted to real space first and the corresponding Pad´e approximant is evaluated in real space, the required operations during the same 3 perturbation process are on the order of N +nstN. For any nst ≥ 2 and N ≥ 1, it can 3 3 be shown that nstN +nst >N +nstN, and, therefore, it saves computational effort if the Pad´e approximant is evaluated for the real-space perturbation series rather than the Laplace-space series.

5.5 Transient Pressure Tests in Wells

The transient flow model can simulate pressure responses in a variety of well testing problems. Given reservoir geometries and rock properties, pressure type curves are readily generated by the model. The conventional definition of the dimensionless

pressure pDq is related to pD given by Eq. 3.11 as

2πk0hp0 p = p (5.38) Dq D qμ In type-curve matching, however, one often encounters difficulty in finding a unique match by a simple comparison of shapes, particularly when the pressure response is strongly affected by skin and/or wellbore storage. For this situation, the technique of pressure derivatives provides a prominent remedy (Bourdet et al., 1983). In this section, we discuss how the pressure derivative and the effects of skin and wellbore storage are implemented in the transient flow model.

5.5.1 Well with Skin and Wellbore Storage

The skin factor S accounts for a localized pressure drop ΔpS across a near-wellbore zone (skin) caused by the alteration in permeability resulting from drilling, comple- tion, production, or workover operations: 2πk0h S = Δp (5.39) qμ S

Thus, the dimensionless pressure pDS at the well with skin is higher by an amount proportional to S than the dimensionless pressure pD without skin:

pDS = pD + Sp (5.40) CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 67

where qμ Sp = S (5.41) 2πk0hp0

Since Sp is a constant, Eq. 5.40 is transformed in Laplace space as S p¯ =¯p + p (5.42) DS D s

The dimensionless wellbore storage coefficient CD quantifies the rate of wellbore fluid depletion, the difference between the flow rate at the surface and the flux at the sand face from the formation, and is ΔV CD = 2 (5.43) 2πφ0cthrwΔp where ΔV is the change in volume of fluid in the wellbore and Δp is the change in bottom-hole pressure. The definition suitable in connection with pD is

2 2πk0hp0r C = C w (5.44) Dp D qμA

The Laplace-space pressure responsep ¯DW of the well with wellbore storage can be expressed (van Everdingen and Hurst, 1949) as

p¯D p¯DW = 2 (5.45) 1+s CDpp¯D wherep ¯D is the Laplace-space pressure response of the well without wellbore storage. Substitution of Eq. 5.42 into Eq. 5.45 gives the Laplace-space pressure response p¯DWS of the well with skin and wellbore storage:

Sp p¯D + p¯ = s DSW S 1+s2C p¯ + p Dp D s −1 s 2 = + s CDp (5.46) sp¯D + Sp which can be inverted to real space by means of the Stehfest algorithm. CHAPTER 5. DEVELOPMENT OF A TRANSIENT FLOW MODEL 68

5.5.2 Pressure Derivatives

The pressure derivative, introduced by Bourdet et al. (1983), can be defined, accord- ing to the notation employed in this study, as

∂pD ∂pD = tDA (5.47) ∂ ln tDA ∂tDA

Transforming the derivative of pD with respect to tDA with the homogeneous initial condition gives ∂pD L = sp¯D (5.48) ∂tDA and, hence, the pressure derivative defined by Eq. 5.47 can be expressed as

∂pD −1 = tDAL {sp¯D} (5.49) ∂ ln tDA where L and L−1 are the Laplace transform and inverse Laplace transform operators, respectively. For the well with skin and wellbore storage, combining Eq. 5.46 with

Eq. 5.49 yields ⎧ ⎫ ⎨ −1⎬ ∂pDSW L−1 1 = tDA ⎩ + sCDp ⎭ (5.50) ∂ ln tDA sp¯D + Sp Chapter 6

Computational Procedures

In the course of investigating the methods developed in this study, two kinds of com- puter programs were implemented: one for steady-state flow problems and the other for transient flow problems. Although the mathematical backbone has been discussed in the foregoing chapters, computational procedures and concise descriptions of the important subroutines are provided in this chapter. Throughout the development, the following guidelines were set and followed:

• adhere to ANSI FORTRAN-77 standard statements

• keep the main program as laconic as possible

• define dimensions using parameter statements

• pass arguments (with a few exceptions) through common blocks

• use include statements, for compactness

• have the program provide diagnostic messages

Input/Output samples are given in Appendix F, and the program listing is attached in Appendix G.

69 CHAPTER 6. COMPUTATIONAL PROCEDURES 70

6.1 Steady-State Flow Model

The execution sequence of the steady-state flow model is shown in a flow chart in Fig. 6.1. The main program calls the principal subroutines shown in this flow chart, and some of these routines are supported by auxiliary subroutines.

Subroutine INPUT

The essential data required by the program are read in the subroutine INPUT, and the optional data are read in the routines HETERO(1), DOMAIN(1), and STREAM(1), which are called by INPUT. The input file should contain the following basic input lines:

1. Title Lines : Two lines containing the title of the problem.

2. Property Line : One line containing the reservoir and fluid properties.

3. Boundary Element Lines : One line containing the number of boundary elements (N). N lines containing the boundary node types, the Dirichlet boundary values, and the Neumann boundary values. N lines containing the coordinates of the boundary nodes.

4. Well Lines : One line containing the number of wells (NSS). NSS lines containing the well names, the coordinates of the well locations, the flow rates, the well radii, and the well permeabilities.

and the following optional input lines:

1. Basic Parameter Line : One line containing the maximum order of perturbation (NPRMX) and the tolerance.

2. Pad´e Approximant and Well Singularity Line : One line specifying whether the Pad´e approximant is applied and whether the well singularity is considered in the domain integrals.

3. Permeability Variation Lines : One line containing the number of triangular elements (NTRI) and the number of vertices (NVTX), and specifying the interpo- lation function between the vertices. NTRI lines containing the vertex numbers CHAPTER 6. COMPUTATIONAL PROCEDURES 71

 START ? INPUT ? BNDRY ? MATRIX ? DECOMP ? SOLVE ? PP  PP  PP yes P P PP NPRMX=0  PP  PP - ?no HETERO(2) ? SOLVE ? HETERO(3) ? PP  PP no  PP P P PPICONV=.TRUE. PP  PP  yes ? DOMAIN(2) ? STREAM(2)  ?  STOP

Figure 6.1: Flow chart for the steady-state flow model. CHAPTER 6. COMPUTATIONAL PROCEDURES 72

specifying each triangular element. NVTX lines containing the coordinates of the vertices and permeabilities. for HETERO(1),

1. Interior Solution Lines : One line containing the number of interior points (NR). NR lines containing the coordinates of the interior points. for DOMAIN(1), and

1. Basic Parameter Lines : One line containing the number of wells from which streamlines are tracked. One line containing the well numbers defined in the Well Lines. One line containing the number of streamlines tracked from each well.

2. Tracking Scheme Lines : One line containing the dimensionless advance length. One line specifying whether the modified Euler method is applied, and contain- ing the directional change allowance.

3. Front Tracking Lines : One line containing the number of time sequences when the displacing front should be reported. One line containing such time se- quences.

4. Effluent Concentration Lines : One line specifying whether effluent concentra- tions of displacing fluid should be reported. for STREAM(1). All the input data are written in free FORMAT and a comment line should be distinguished by the character “/” in its first column. This subroutine also converts boundary values, domain dimensions, and well strengths into the corresponding dimensionless quantities. The domain area is com- puted in the routine AREA and the internal angles at boundary nodes are evaluated in the routine ANGLE. These auxiliary subroutines are called by INPUT. CHAPTER 6. COMPUTATIONAL PROCEDURES 73

Subroutine BNDRY

The routine BNDRY evaluates the influence coefficients for the N boundary nodes and well singularities, which must be desuperposed at the boundary nodes, through the auxiliary subroutines COEFF(1) and SINK, respectively.

Subroutine MATRIX

The routine MATRIX rearranges the influence coefficients in accordance with the pre- scribed boundary conditions and forms the solution matrix A and the right-hand side vector B for zeroth-order perturbation equations. Since the solution matrix for zeroth-order perturbation equations is identical to that for higher-order equations, the routine MATRIX is called only once by the main program.

Subroutine DECOMP

Given a matrix A, the routine DECOMP replaces it by the LU decomposition of a rowwise permutation of itself. It saves the multipliers and the pivot information. For the same reason as mentioned above, the routine DECOMP must be called by the main program only once.

Subroutine SOLVE

The routine SOLVE uses the results obtained in DECOMP to compute the solution for any right-hand side B. If the routine HETERO is not called by the main program (NPRMX=0), the routine SOLVE outputs the boundary solutions for homogeneous problems.

Subroutine HETERO

The routine HETERO(IND) consists of three parts. If IND=1, the routine reads input data as described in Subroutine INPUT and evaluates piecewise domain integrals through the auxiliary subroutine INTGS(1).IfIND=2, the routine computes interior solutions of order n at the NVTX vertices and evaluates a new right-hand vector B, which corresponds to the (n + 1)th-order perturbation solution. If IND=3, the routine CHAPTER 6. COMPUTATIONAL PROCEDURES 74

examines whether the nth-order solution is within the tolerance, and if it is, ICONV returns as .TRUE., and the boundary solutions are output. If the Pad´e approximant is required, the subroutine PADE is called by HETERO(3).

Subroutine DOMAIN

The routine DOMAIN(IND) consists of two parts. If IND=1, the routine reads input data as mentioned in Subroutine INPUT.IfIND=2, the routine computes NR interior solutions through the auxiliary subroutines COEFF(1), WELL(1), and PGRAD(1).

Subroutine STREAM

The routine STREAM(IND) consists of two parts. If IND=1, the routine reads input data as mentioned in Subroutine INPUT.IfIND=2, the routine computes pres- sure gradients through the auxiliary subroutines COEFF(2), WELL(2), and PGRAD(2) and tracks streamlines by either Euler or modified Euler method. This routine also provides effluent concentrations of the displacing fluid.

Subroutine COEFF

The routine COEFF(IND) consists of two parts. If IND=1, the routine evaluates prin- cipal parts of influence coefficients through the auxiliary subroutines COORD, which performs coordinate transformations, and INTGVW(1), which computes the line inte- grals along the boundary elements. If IND=2, the routine evaluates the directional derivatives of the principal parts of influence coefficients through the auxiliary sub- routines COORD and INTGVW(2), which computes the directional derivatives of the line integrals.

Subroutine PADE

Given an array PPADE of length N, the routine PADE(IND,N,M,PPADE,PAPPX) evaluates the Pad´e approximant PAPPX at the Mth node. If IND=1, the continued fraction is used in the computation, while if IND=2, the Pad´e approximant is evaluated by solving the system of equations. CHAPTER 6. COMPUTATIONAL PROCEDURES 75

Subroutine PGRAD

The routine PGRAD(IND) consists of two parts. If IND=1, the routine computes interior solutions. If IND=2, pressure gradients are computed.

Subroutine SINK

The routine SINK evaluates well singularities at boundary nodes, and computes non- singular boundary values by use of desuperposition.

Subroutine WELL

The routine WELL(IND) consists of two parts. If IND=1, the routine evaluates well singularities at interior points. If IND=2, the directional derivatives of well singularities are evaluated.

6.2 Transient Flow Model

The execution sequence of the transient flow model is shown in a flow chart in Fig. 6.2. Except for the loops required for the Stehfest algorithm and the time stepping, its core structure is similar to that of the steady-state flow model, and, consequently, many subroutines are similar to those developed for the previous model.

Subroutine INPUT

The essential data required by the program are read in the subroutine INPUT, and the optional data are read in the routine HETERO(1), which is called by INPUT. The input file should contain the following basic input lines:

1. Title Lines : Two lines containing the title of the problem.

2. Unit Line : One line specifying units to be used.

3. Property Line : One line containing the reservoir and fluid properties. CHAPTER 6. COMPUTATIONAL PROCEDURES 76

 START ? INPUT  - ? BNDRY ? MATRIX ? DECOMP ? SOLVE ? PP  PP no  PP P P PPISTEH=NSTEH PP  PP ?yes PP  PP  PP yes P P PP NPRMX=0  PP  PP - - ?no HETERO(2) ? SOLVE ? PP  PP no  PP P P PPISTEH=NSTEH PP  PP ?yes HETERO(3) ? PP  PP no  PP P P PPICONV=.TRUE. PP  PP  yes ? WELSUM ? PP  PP  PP no P P PPITIME=NTIME PP  PP  ?yes  STOP

Figure 6.2: Flow chart for the transient flow model. CHAPTER 6. COMPUTATIONAL PROCEDURES 77

4. Boundary Element Lines : One line containing the number of boundary elements (N). N lines containing the boundary node types, the Dirichlet boundary values, and the Neumann boundary values. N lines containing the coordinates of the boundary nodes.

5. Well Lines : One line containing the number of wells (NSS). NSS lines containing the well names, the coordinates of the well locations, the flow rates, the well radii, the well permeabilities, the wellbore storage coefficients, and the skin factors.

6. Time Step Lines : One line specifying the time step option. One line containing the time step parameters.

7. Numerical Scheme Line : One line containing the number of the Stehfest sampling times (NSTEH), the number of Gaussian quadrature sampling points (NGAUSS), and specifying whether the singularity programming is activated. and the following optional input lines:

1. Basic Parameter Line : One line containing the maximum order of perturbation (NPRMX) and the tolerance.

2. Pad´e Approximant and Well Singularity Line: One line specifying whether the Pad´e approximant is applied and whether the well singularity is considered in the domain integrals.

3. Permeability Variation Lines: One line containing the number of triangular ele- ments (NTRI) and the number of vertices (NVTX), and specifying the interpolation functions for permeability and porosity variations between the vertices. NTRI lines containing the vertex numbers specifying each triangular element. NVTX lines containing the coordinates of the vertices, permeabilities, and . for HETERO(1). This subroutine also converts boundary values, domain dimensions, and well strengths into the corresponding dimensionless quantities. The domain area and the CHAPTER 6. COMPUTATIONAL PROCEDURES 78

internal angles at boundary nodes are computed through the auxiliary subroutines AREA and ANGLE, respectively. The subroutines GAUSS, which performs numerical in- tegrations, and LAPINV, which performs the Laplace inversion, are called by INPUT to set up the coefficients in accordance with the parameters defined in the Numerical Scheme Line.

Subroutine BNDRY

The routine BNDRY evaluates the influence coefficients for the N boundary nodes and well singularities, which must be desuperposed at the boundary nodes, through the auxiliary subroutines COEFF and SINK, respectively. If the singularity programming is not activated, the subroutine WELL (instead of SINK) is called.

Subroutine MATRIX

The routine MATRIX rearranges the influence coefficients in accordance with the pre- scribed boundary conditions and forms the solution matrix A and the right-hand side vector B for zeroth-order perturbation equations. Since the solution matrix for zeroth-order perturbation equations is identical to that for higher-order equations, the routine MATRIX is called only NSTEH times for each time step by the main program.

Subroutine DECOMP

Given a matrix A, the routine DECOMP replaces it by the LU decomposition of a rowwise permutation of itself. It saves the multipliers and the pivot information. For the same reason as mentioned above, the routine DECOMP must be called by the main program only NSTEH times for each time step.

Subroutine SOLVE

The routine SOLVE uses the results obtained in DECOMP to compute the solution for any right-hand side B. CHAPTER 6. COMPUTATIONAL PROCEDURES 79

Subroutine HETERO

The routine HETERO(IND) consists of three parts. If IND=1, the routine reads input data as described in Subroutine INPUT and evaluates piecewise domain integrals through the auxiliary subroutine INTGU(1).IfIND=2, the routine computes interior solutions of order n at the NVTX vertices and evaluates a new right-hand vector B, which corresponds to the (n + 1)th-order perturbation solution. If IND=3, the routine inverts the Laplace-space solution to real space through the subroutine LAPINV and examines whether the resulting nth-order solution is within the tolerance, and if it is, ICONV returns as .TRUE.. If the Pad´e approximant is required, the subroutine PADE is called by HETERO(3).

Subroutine WELSUM

The routine WELSUM manipulates the Laplace-space solutions so that the effects of skin and wellbore storage are included in the real-space solution. The real-space pressure solutions and pressure derivatives are computed through the subroutine LAPINV and output at specified time sequences.

Subroutine COEFF

The routine COEFF evaluates principal parts of influence coefficients through the aux- iliary subroutines COORD, which performs coordinate transformations, and INTGVW, which computes the line integrals along the boundary elements.

Subroutine LAPINV

The routine LAPINV(IND,F,FINV,DFINV) consists of two parts. If IND=1, the rou- tine computes the coefficients used in the Stehfest algorithm. These coefficients are independent of the Laplace transform parameter s, and the computation must be done only once prior to the time loop. If IND=2, the routine performs a numerical inversion of the Laplace transform and returns a real-space solution FINV and its time derivative DFINV. CHAPTER 6. COMPUTATIONAL PROCEDURES 80

Subroutine PADE

Given an array PPADE of length N, the routine PADE(IND,N,M,PPADE,PAPPX) evaluates the Pad´e approximant PAPPX at the Mth node. If IND=1, the continued fraction is used in the computation, while if IND=2, the Pad´e approximant is evaluated by solving the system of equations.

Subroutine SINK

The routine SINK evaluates well singularities at boundary nodes, and computes non- singular boundary values by use of desuperposition.

Subroutine WELL

The routine WELL evaluates well singularities at interior points. These singular solu- tions are used to recover the complete solutions by use of superposition. Chapter 7

Results and Discussion

The various aspects of the perturbation boundary element models have been tested, and are discussed in this chapter. Numerical models are usually verified against analytical solutions of simplified cases or experimental (sometimes scaled-field) data. However, an appropriate set of data for flow problems in heterogeneous media is seldom available, and, thus, analytical solutions attainable in a limited number of special cases are employed as bench marks. In the first two sections, the steady-state and transient flow models are verified. Some test problems are in one dimension, while the model treats them as two-dimensional problems. In the last section, the verified models are utilized to solve application problems, the solutions for which cannot be obtained analytically.

7.1 Verification of the Steady-State Flow Model

The applicability of the boundary element method to steady-state flow problems in homogeneous media has been confirmed by several authors. Since the solution in a homogeneous domain is essential in the perturbation process, which cannot properly function without an accurate zeroth-order solution, it is sufficient to verify the per- turbation BEM results for flow problems with heterogeneity. Thus, test problems are examined in heterogeneous media except for the verification of streamline tracking schemes, which is considered in homogeneous media.

81 CHAPTER 7. RESULTS AND DISCUSSION 82

7.1.1 Effectiveness of Pad´e Approximants

In order to examine how the Pad´e approximants improve a divergent perturbation series, we consider a simple problem concerning one-dimensional flow in a domain where permeability varies exponentially in the flow direction. Figure 7.1 shows a square porous medium with impermeable top and bottom boundaries. The inner and | | outer boundaries are maintained at pD xD=0 = 0 and pD xD=1 = 1, respectively. The analytical solution for this problem is readily obtained. Integrating the gov- erning differential equation d dpD k(xD) = 0 (7.1) dxD dxD subject to the corresponding boundary conditions yields xD 1 dz 0 k(z) p (x )= (7.2) D D 1 1 dz 0 k(z) If the permeability variation is k = eaxD (7.3) Eq. 7.2 becomes − 1 − e axD p (x )= (7.4) D D 1 − e−a For the steady-state flow model, 40 equally-spaced nodes are arranged along the −4 boundary and the pressure tolerance ΔpD is set to 1.0×10 . The perturbation BEM solutions are compared with the exact solutions for a = 1 and a = 3 in Fig. 7.2. Al- though Pad´e approximants are not applied to these problems, the agreement between the solutions is excellent. The convergent solutions are obtained with the first five perturbation solutions for a = 1 and with the first 12 terms for a = 3. As for the error characteristics with respect to the number of nodes, Figure 7.3 compares error profiles of 40- and 80-node discretizations for a = 3. The maximum error of 0.391% for 40 nodes is improved to 0.139% by doubling the discretization. As the magnitude of spatial variability increases, it becomes harder to obtain a convergent solution. Indeed, the perturbation BEM cannot obtain convergent solu- tions for a = 5 and a = 7 within the maximum order of perturbation nM which is CHAPTER 7. RESULTS AND DISCUSSION 83

yD 6

1

pD =0 pD =1

-

0 1 xD

Figure 7.1: Schematic configuration of the problems in Sections 7.1.1 and 7.2.1-3. CHAPTER 7. RESULTS AND DISCUSSION 84

1.0

0.8 k = exp(3x D )

0.6 k = exp(1xD )

0.4

: Perturbation BEM 0.2 Dimensionless Pressure : Exact Solution

0.0 0.0 0.2 0.4 0.6 0.8 1.0 Fractional Length Figure 7.2: Comparison of perturbation BEM results and exact solutions for the steady-state flow problems with k = exp(xD) and k = exp(3xD). CHAPTER 7. RESULTS AND DISCUSSION 85

0.5

0.4 : 40-node Discretization 0.3 : 80-node Discretization

0.2

Error (%) 0.1

0.0

-0.1 0.0 0.2 0.4 0.6 0.8 1.0 Fractional Length Figure 7.3: Error profiles of 40- and 80-node discretizations for the steady-state flow problem with k = exp(3xD). CHAPTER 7. RESULTS AND DISCUSSION 86

set to 20. Figure 7.4 shows the various order perturbation solutions at xD =0.7. For a = 5, the perturbation series seems to converge within the tolerance of 1.0 × 10−4, if the computation were to be continued further. On the other hand, for a =7,it is obvious that the series diverges from the beginning, and increasing the order of perturbation is of no help. This indicates that the perturbation parameter  =1is close to the radius of convergence for a = 5 and beyond the radius for a =7. To investigate the nature of Eq. 7.4, the perturbation parameter , defined by Eq. 3.67, is introduced into Eq. 7.2: xD 1 dz 0 K(z) p (x ,)= (7.5) D D 1 1 dz 0 K(z) the solution for which, with the exponential permeability variation, is

− 1 − e axD p (x ,)= (7.6) D D 1 − e−a Considering Eq. 7.6 as a function of  in the complex plane, simple poles are found at 2πn  = ± i, n =1, 2, 3, ··· (7.7) a and the radius of convergence R can be estimated as the distance to the nearest singularity (n = 1): 2π R = (7.8) a The result of this analysis is consistent with the fact that the rate of convergence of the perturbation series is slow for a = 5 and the convergence is ruined for a =7, since the value of a that gives R =  = 1 is 2π. Figure 7.5 depicts the locations of the nearest singularities and a unit circle centered at  =0. The exact solution Eq. 7.6 can be expanded into a Taylor series in terms of  about 0 =0: − ∞ − axD 1 e n = b ( − 0) (7.9) − −a n 1 e n=0 (n) Table 7.1 compares bn with pD obtained by the perturbation BEM for xD =0.7 and a = 7. (Actual computations are done in double precision.) CHAPTER 7. RESULTS AND DISCUSSION 87

2.5

2.0

1.5

1.0

0.5

0.0 : k = exp(5x )

Dimensionless Pressure D -0.5 : k = exp(7x D )

-1.0 0 2 4 6 8 10 12 14 16 18 20 Order of Perturbation Series Figure 7.4: Various order perturbation solutions for the steady-state flow problems with k = exp(5xD) and k = exp(7xD). CHAPTER 7. RESULTS AND DISCUSSION 88

Im() 6

c 2π + 5 i ppppppppppppppppppppppppppppp ppp ppp pppp pppp ppp ppppp ppppp ppppp pppppppp ppppppppppp ppppppppppppppppppppp ppppppppppp pppppppp ppppp ppppp ppppp ppp pppp pppp ppp ppppppppppp ppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp s pppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppppppppppp ppppppppppppppppppppppppppp ppppppppppppppppppppp 2π ppppppppppppppppppppp ppppppppppppppppppp + i pppppppppppppppppppp | | ppppppppppppppppp 7 ppppppppppppppppp  =1 pppppppppppppp  pppppppppppppp pppppppppppp pppppppppppp pppppppppp pppppppppp pppppppp pppppppp pppppp pppppp pppp ppppp ppp ppp p p - pp pp pppp ppp ppppp ppppp ppppppp ppppppp Re() ppppppppp ppppppppp ppppppppppp ppppppppppp ppppppppppppp ppppppppppppp ppppppppppppppp ppppppppppppppp pppppppppppppppppp ppppppppppppppppp ppppppppppppppppppppp 2π pppppppppppppppppppppp ppppppppppppppppppppppppp − i ppppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppp s 7 ppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp c− 2π 5 i

Figure 7.5: Locations of the nearest singularities for the steady-state flow problems with k = exp(5xD) and k = exp(7xD). CHAPTER 7. RESULTS AND DISCUSSION 89

Table 7.1: Coefficients of Taylor series and perturbation series expansions.

(n) Order Exact Perturbation (pD ) n bn 40 Nodes 80 Nodes 0 +0.70000 +0.70000 +0.70000 1 +0.73500 +0.73335 +0.73460 2 −0.34300 −0.34123 −0.34258 3 −0.63026 −0.59373 −0.62096 4 +0.45659 +0.42204 +0.44781 5 +0.73089 +0.64208 +0.70761 6 −0.57593 −0.49079 −0.55350 7 −0.89243 −0.72796 −0.84806 8 +0.71757 +0.56449 +0.67590 9 +1.10318 +0.83318 +1.02828 10 −0.89147 −0.64792 −0.82313 11 −1.36786 −0.95541 −1.25020 12 +1.10673 +0.74339 +1.00182 13 +1.69734 +1.09598 +1.52100 14 −1.37373 −0.85286 −1.21912 15 −2.10658 −1.25732 −1.85074 16 +1.70508 +0.97843 +1.48350 17 +2.61461 +1.44243 +2.25206 18 −2.11633 −1.12249 −1.80521 19 −3.24520 −1.65480 −2.74041 CHAPTER 7. RESULTS AND DISCUSSION 90

The table shows a qualitative character, the sign pattern of period four. According to the relationship between the pattern of signs and the direction of the nearest singularity discussed in Section 3.5.1, it can be deduced that the nearest singularity lies on the imaginary axis, which agrees with Eq. 7.7. The agreement between the coefficients is not perfect. This is due to the fact that the present discretization is too coarse for the problem of a = 7 to postulate the linear pressure profile over the triangular element and the domain integrals are not evaluated with a sufficient order of accuracy. (Note that when a = 7, the range of permeability variation is from 1 to over 1000.) The perturbation BEM results with 80 nodes along the boundary are also shown in Table 7.1. An improved agreement can be seen. Although the term-by-term agreement is still imperfect, a better match is expected in a summation form by a cancellation of errors. Since the nearest singularity is on the imaginary axis, it can be interpreted math- ematically (not physically) as not representing a breakdown of the formulation of the problem. The Pad´e approximants frequently improve the divergent series whose physical range of convergence is unnecessarily restricted by the mathematical singu- larity. The perturbation BEM with the Pad´e approximant applied, indeed, gives the convergent solutions for a = 5 with the first nine perturbation solutions and for a =7 with the first 13 solutions. Figure 7.6 compares these results with the exact solu- tions. The agreement is fairly good, and is further improved with the finer 80-node discretization as shown in Fig. 7.7. For a=7, the maximum error of 2.690% with 40 nodes is reduced to 0.962% with the 80-node discretization. The Pad´e approximant for the Taylor series expansion of the exact solution Eq. 7.6 for a = 7 and xD =0.7is 0.70000 + 1.39651 +1.191602 +0.978863+ [9/10] = 1.00000 + 0.94502 +1.200022 +1.501793− 0.213864 − 0.131045 − 0.219856 − 0.136007− 0.484764 +0.477605 − 0.647626 +0.103147− 0.040698 − 0.005139 (7.10) 0.138598 +0.021069 − 0.0035410 CHAPTER 7. RESULTS AND DISCUSSION 91

1.0

k = exp(7x D ) 0.8 k = exp(5xD )

0.6

0.4

: Perturbation BEM 0.2 Dimensionless Pressure : Exact Solution

0.0 0.0 0.2 0.4 0.6 0.8 1.0 Fractional Length Figure 7.6: Comparison of perturbation BEM results and exact solutions for the steady-state flow problems with k = exp(5xD) and k = exp(7xD). CHAPTER 7. RESULTS AND DISCUSSION 92

3.0

2.5 : 40-node Discretization 2.0 : 80-node Discretization 1.5

1.0 Error (%) 0.5

0.0

-0.5 0.0 0.2 0.4 0.6 0.8 1.0 Fractional Length Figure 7.7: Error profiles of 40- and 80-node discretizations for the steady-state flow problem with k = exp(7xD). CHAPTER 7. RESULTS AND DISCUSSION 93

which has the following zeros: ⎧ ⎪ ⎪ − ⎪ 2.931306 ⎪ ⎪ − ⎪ 0.7316502 ⎪ ⎨ +1.619407  = ⎪ ⎪ −0.4814265 ± 1.527250 i ⎪ ⎪ ⎪ − ± ⎪ 2.459438 1.805158 i ⎪ ⎩ ±1.282627 i and the following poles: ⎧ ⎪ ⎪ − ⎪ 0.7316502 ⎪ ⎪ ⎪ +1.619117 ⎪ ⎨ −0.4749748 ± 1.530215 i  = ⎪ ⎪ +0.0029871 ± 1.819273 i ⎪ ⎪ ⎪ ± ⎪ +3.001348 5.080924 i ⎪ ⎩ ±0.8975978 i Among these poles, the nearest to the origin is −0.7316502, which, however, is also a zero for the approximant [9/10], and is a removable singularity. Therefore, the distance to the nearest singularity and thus the radius of convergence is 2π R = |±0.8975978 i | = (7.11) 7 which is an expected result from the analysis discussed above (Eq. 7.8). The Pad´e approximant [6/7] generated by the model with 40 boundary nodes for a = 7 and xD =0.7is 0.70000 + 0.85976 +0.731952 +0.506563+ [6/7] = 1.00000 + 0.18057 +1.343942 +0.251903+ 0.194384 +0.031755 +0.001156 (7.12) 0.219174 +0.052325 − 0.007456 +0.001147 which has the following zeros: ⎧ ⎪ − ⎪ 20.20051 ⎪ ⎨ −2.270919  = ⎪ ⎪ −2.538511 ± 0.6416810 i ⎪ ⎩⎪ +0.0021008 ± 1.389559 i CHAPTER 7. RESULTS AND DISCUSSION 94

and the following poles: ⎧ ⎪ − ⎪ 3.173705 ⎪ ⎨ −0.0029927 ± 2.106667 i  = ⎪ ⎪ +4.869053 ± 6.925834 i ⎪ ⎩⎪ ±0.9336290 i

The radius of convergence estimated from the nearest pole is 2.080283π R = |±0.9336290 i | = (7.13) 7 Despite the relatively coarse discretization, the distance to the nearest singularity is reproduced fairly well. A similar analysis is performed for the result of the perturbation BEM with 80 boundary nodes, which yields the convergent solution with the first 11 perturbation solutions. 0.70000 + 0.62433 +0.609372 +0.388733+ [5/6] = 1.00000 − 0.15754 +1.525252 − 0.235323+ 0.117624 +0.013995 (7.14) 0.381984 − 0.053105 +0.008136 which has the following zeros: ⎧ ⎪ − ⎨⎪ 2.855209  = −2.778455 ± 1.585522 i ⎪ ⎩⎪ +0.0011483 ± 1.308754 i

and the following poles: ⎧ ⎪ ± ⎨⎪ +0.0076926 1.875640 i  = +3.257885 ± 5.650723 i ⎪ ⎩⎪ ±0.9065369 i

The radius of convergence estimated from the nearest pole is 2.019918π R = |±0.9065369 i | = (7.15) 7 which is only 1% off from the exact value. CHAPTER 7. RESULTS AND DISCUSSION 95

Effectiveness of Pad´e approximants for more rapid variations is illustrated in

Fig. 7.8, which shows the various order perturbation solutions at xD =0.7. For a =7, 11, and 15, convergent solutions are obtained with the first 13, 14, and 16 perturbation terms, respectively. Although the Pad´e approximant with the first 19 perturbation solutions for a = 19 could not yield a convergent solution, increasing the order of perturbation seems to improve the series further and to give a convergent solution. Since the Pad´e approximant converges as long as it has enough powers of  in its denominator to cancel any nearby pole, theoretically speaking, there is no limit of applicability of Pad´e approximants to problems the solutions for which include pole singularities. These analyses demonstrate that the Pad´e approximants accelerate the rate of convergence, when the naive summation converges very slowly, and even if the per- turbation series diverges, it can be improved by the Pad´e approximants due to their ability of canceling nearby poles. The approximants also provide useful information in examining the location of the nearest singularity.

7.1.2 Reservoir of Harmonically Varying Permeability

The example considered in the previous section was a one-dimensional flow problem, even though the model dealt with it in a two-dimensional domain. In this section, a true two-dimensional problem is considered. Georghitza (1969) showed that in harmonically heterogeneous media, where k

satisfies √ ∇2 k = 0 (7.16) √ a transformed pressure ψ = kpD satisfies the Laplace equation: √ 1 ∇2ψ = ψ∇2 k + √ (k∇2ψ + ∇k ·∇ψ) ≡ 0 (7.17) k Employing the square of a bilinear function as a harmonically heterogeneous perme- ability variation: 2 k =(1+axD + byD + cxDyD) (7.18) CHAPTER 7. RESULTS AND DISCUSSION 96

2.0

1.5

1.0

0.5

0.0 : k = exp(7x D ) : k = exp(11x D ) : k = exp(15x D )

Dimensionless Pressure -0.5 : k = exp(19x D )

-1.0 0 2 4 6 8 10 12 14 16 18 20 Order of Perturbation Series Figure 7.8: Various order Pad´e approximant solutions for the steady-state flow prob- lems with k = exp(7xD), k = exp(11xD), k = exp(15xD), and k = exp(19xD). CHAPTER 7. RESULTS AND DISCUSSION 97

there follows a possible solution:

ψ = xDyD (7.19) or xDyD pD = (7.20) 1+axD + byD + cxDyD Figure 7.9 shows the permeability variation given by Eq. 7.18 with a =3,b=2, and c = 1. For the perturbation BEM, the Dirichlet boundary values are calculated by −5 using Eq. 7.20 at 16 equally-spaced boundary nodes, and ΔpD is set to 1.0 × 10 . Table 7.2 compares the results computed by the model with the exact solutions. The convergent solutions are obtained with the first eight perturbation solutions without the Pad´e approximants. The maximum error is 0.657%, and the overall agreement is good.

7.1.3 A Well in an Exponentially Heterogeneous Reservoir

Analytical solutions for flow problems in heterogeneous media are hard to obtain, particularly when they include wells. The following analytical solution, against which the perturbation BEM is verified, is limited to a reservoir of exponentially varying permeability with a constant Dirichlet boundary value. Suppose the permeability variation can be expressed as 2(xD − xwD) k = k0 exp (7.21) a where xwD is the xD coordinate of a well location, then, if a square reservoir is surrounded by constant-pressure (pD = 0) boundaries and the well is located in its center (Fig. 7.10), the exact solution takes the following form (Appendix D): − ∞ qD xD xwD i+1 rDi pD = exp − (−1) K0 (7.22) 2π a i=1 a where rDi is the Euclidean distance between the point of interest and the well in the

ith imaginary pattern, and K0 is the modified Bessel function of the second kind and of order zero.

For the perturbation BEM, 40 nodes are arranged along the boundary and ΔpD is set to 1.0 × 10−5. The well is put on injection. Figure 7.11 compares the pressure CHAPTER 7. RESULTS AND DISCUSSION 98

Permeability

50 40 30 20 10 0

Figure 7.9: Permeability variation given by Eq. 7.18 with a =3,b = 2, and c =1. CHAPTER 7. RESULTS AND DISCUSSION 99

Table 7.2: Comparison of perturbation BEM results and exact solutions for the flow problem in harmonically heterogeneous media. Coordinates Exact Solution Perturbation Error xD yD pD pD (%) 0.20 0.20 0.01961 0.01965 +0.215 0.40 0.20 0.02985 0.03000 +0.503 0.60 0.20 0.03615 0.03607 −0.207 0.80 0.20 0.04040 0.04030 −0.248 0.20 0.40 0.03226 0.03247 +0.657 0.40 0.40 0.05063 0.05064 +0.014 0.60 0.40 0.06250 0.06250 +0.000 0.80 0.40 0.07080 0.07062 −0.249 0.20 0.60 0.04110 0.04101 −0.209 0.40 0.60 0.06593 0.06595 +0.024 0.60 0.60 0.08257 0.08245 −0.144 0.80 0.60 0.09449 0.09438 −0.114 0.20 0.80 0.04762 0.04747 −0.313 0.40 0.80 0.07767 0.07744 −0.296 0.60 0.80 0.09836 0.09823 −0.133 0.80 0.80 0.11348 0.11329 −0.163 CHAPTER 7. RESULTS AND DISCUSSION 100

yD 6

pD =0 1

wells pD =0 pD =0

-

0 pD =0 1 xD

Figure 7.10: Schematic configuration of the problems in Sections 7.1.3 and 7.2.4. CHAPTER 7. RESULTS AND DISCUSSION 101

1.2

1.0 : Perturbation BEM 0.8 : Exact Solution 0.50 0.6 0.40 yD = 0.30 0.20 0.10 0.4

Dimensionless Pressure 0.2

0.0 0.0 0.2 0.4 0.6 0.8 1.0 Fractional Length Figure 7.11: Comparison of perturbation BEM results and exact solutions for the steady-state flow problem with k = exp{3(xD − xwD)}. CHAPTER 7. RESULTS AND DISCUSSION 102

1.2

1.0 : Perturbation BEM 0.8 : Exact Solution 0.50 0.6 0.40 yD = 0.30 0.20 0.10 0.4

Dimensionless Pressure 0.2

0.0 0.0 0.2 0.4 0.6 0.8 1.0 Fractional Length Figure 7.12: Comparison of perturbation BEM results and exact solutions for the steady-state flow problem with k = exp{5(xD − xwD)}. CHAPTER 7. RESULTS AND DISCUSSION 103

1.2

1.0 : Perturbation BEM 0.8 : Exact Solution 0.50 0.6 0.40 yD = 0.30 0.20 0.10 0.4

Dimensionless Pressure 0.2

0.0 0.0 0.2 0.4 0.6 0.8 1.0 Fractional Length Figure 7.13: Comparison of perturbation BEM results and exact solutions for the steady-state flow problem with k = exp{7(xD − xwD)}. CHAPTER 7. RESULTS AND DISCUSSION 104

distributions for a =2/3 computed by the model with the corresponding analytical

solutions along yD =0.1, 0.2, 0.3, 0.4, and 0.5. The convergent solutions are obtained with the first nine perturbation solutions without the Pad´e approximants applied. An excellent match between the two is observed. For more rapid variations (a =2/5 and a =2/7), the Pad´e approximants are uti- lized to accelerate the rate of convergence. For a =2/5, the nine-term perturbation series gives the convergent solution, while for a =2/7, the 11-term series gives the solution. The model results are compared with the exact solutions in Fig. 7.12 and Fig. 7.13. Although the agreement between the model results and the exact solu- tions becomes slightly (hardly seen in these figures) poorer with decreasing a, these results demonstrate that the perturbation BEM can be applied to flow problems in heterogeneous media even with well singularities. The CPU times required on DEC 5810 for these three cases with a =2/3, a =2/5, and a =2/7 were 11.5, 11.5, and 12.0 seconds, respectively. When Pad´e approximants are not applied, the 16-term perturbation series yields the convergent solution for a =2/5 with the CPU time of 14.9 seconds. For a =2/7, the naive summation could −5 not give a convergent solution within the limits of ΔpD =1.0 × 10 and nM = 20.

7.1.4 Effectiveness of Modified Euler Method

Since the technique employed is a step-by-step approximation, the model may fail in tracking streamlines with acceptable accuracy. In many cases, this problem can be

overcome by setting a small advance length ΔsD. However, when a streamline changes its advancing direction rapidly, the Euler method requires ΔsD to be sufficiently small that the first-order approximation is valid for each interval tracked, and, eventually, computational limitations preclude its use. On the other hand, combined with a reasonably small ΔsD, the modified Euler method can be of practical use because of its additional order of accuracy. We consider the flow over a right-angled wedge as shown in Fig. 7.14, which can cause a rapid change in the advancing direction of a streamline. In this figure, lines represent no-flow boundaries, while broken lines represent constant-pressure CHAPTER 7. RESULTS AND DISCUSSION 105

boundaries, and boundary nodes are shown by solid circles. The inner and outer | | − boundaries are maintained at pD xD=−1 = +1 and pD xD=+1 = 1, respectively. This problem was also considered by Liggett and Liu (1983) to exemplify the effect of geometric singularities. At the summit of the wedge, there exists a singularity, since the limit of the velocity is infinite. To simulate the behavior in the vicinity of the singularity, a very fine discretization is required. However, if its functional behavior is known, a special interpolation function can be used between normally distributed nodes. From theoretical hydrodynamics, the pressure behavior in the ∼ 2/3 vicinity of the wedge singularity is known to be pD(rD) rD , according to which the interpolation function between the boundary nodes can be formulated. Table 7.3 compares the results of the steady-state flow model with and without account of the wedge singularity. The difference between the two is not notable. Liggett and Liu (1983) stated that the linear interpolation worked reasonably well for this problem, since the singularity was relatively weak. In tracking streamlines, however, interior pressure gradients are evaluated repeat- edly based on the boundary solutions, and, hence, as the streamlines advance, in- troduced errors are magnified. With the advance length ΔsD =0.01, 19 streamlines are tracked from the left end to the right. Figure 7.15 shows the results obtained by the Euler method (a) with regular elements and (b) with singular elements. The top three streamlines are seen to be invalid since they fail to pass over the wedge, when its singularity is not taken into account. With considering the singularity, the model gives a more reasonable result. However, because of the symmetric geometry, the yD coordinate of the arriving point should be the same as that of the starting point, which could not be attained in either case. Figure 7.16 depicts the effectiveness of the modified Euler method in tracking streamlines. The singularity problem is inherent in the boundary solutions, and can- not be improved (Fig. 7.16 (a)) by the approximation scheme of the streamline track- ing. However, when the boundary solutions are satisfactorily obtained, the modified Euler method shows its higher reliability (Fig. 7.16 (b)). One problem with the modified Euler method is an additional computational effort CHAPTER 7. RESULTS AND DISCUSSION 106

yD 6 ssppppppppp pppppppppps s pppppppppppppppppppp 0.5 pppppppppppppppppppp pppppppppppppppppppp pppppppppppppppppppp pppppppppppppppppppp pppppppppppppppppppp pppppppppppppppppppp pppppppppppppppppppp pppppppppppppppppppp ppppppppppppppppppp ppppppppppppppppppp ppppppppppppppppppp pppppspppppppppppppp ppppppppppppppsppppp ppppppppppppppppppp pppppppppppppppppppp pppppppppppppppppppp pppppppppppppppppppp ppppppppppppppppppp ppppppppppppppppppp ppppppppppppppppppp ppppppppppppppppppp ppppppppppppppppppp ppppppppppppppppppp s pppppppppppppppppppsppppppppppppppppppp - s pD =+1 pD = −1 0 0.5 xD

s s s s s

Figure 7.14: Schematic configuration of the right-angled wedge problem. CHAPTER 7. RESULTS AND DISCUSSION 107

Table 7.3: Boundary solutions for the right-angled wedge problem. Coordinates Regular Element Singular Element xD yD pD Flux pD Flux +0.00 −0.50 +0.000 +0.000 +0.000 +0.000 +0.25 −0.50 −0.282 +0.000 −0.287 +0.000 +1.00 −0.50 −1.000 −0.892 −1.000 −0.876 +1.00 +0.00 −1.000 −0.796 −1.000 −0.778 +1.00 +0.50 −1.000 −0.655 −1.000 −0.635 +0.50 +0.50 −0.720 +0.000 −0.728 +0.000 +0.25 +0.25 −0.505 +0.000 −0.520 +0.000 +0.00 +0.00 +0.000 +0.000 +0.000 +0.000 CHAPTER 7. RESULTS AND DISCUSSION 108

(a) Regular elements

(b) Singular elements

Figure 7.15: Streamlines tracked with (a) regular elements and (b) singular elements for the right-angled wedge problem, the Euler method. CHAPTER 7. RESULTS AND DISCUSSION 109

(a) Regular elements

(b) Singular elements

Figure 7.16: Streamlines tracked with (a) regular elements and (b) singular elements for the right-angled wedge problem, the modified Euler method. CHAPTER 7. RESULTS AND DISCUSSION 110

10000

(a) 1000

100

10

1

No. of Mod. Euler Methods Applied 0 2 4 6 8 10 12 14 16 18 20 Directional Change Allowance (deg) 1.0

(b) 0.8

0.6

0.4

Average Error (%) 0.2

0.0 0 2 4 6 8 10 12 14 16 18 20 Directional Change Allowance (deg) Figure 7.17: Effects of Δθ on (a) computational effort and (b) computational accuracy for the right-angled wedge problem. CHAPTER 7. RESULTS AND DISCUSSION 111

for every advance. In the example above, the total number of particle locations com- puted are 3075, and, thus, 3075 additional pressure-gradient evaluations are required. Except for the region nearby to the wedge singularity, however, the Euler method is accurate enough to track relatively straight streamlines as long as a reasonably small

ΔsD is used. If the two methods are selectively utilized in accordance with the rapid- ness of change in advancing directions, it is possible to reduce the computational effort without significant loss of accuracy. As a selection criterion, the directional change allowance Δθ is employed. If the angle between the velocity vectors at points i − 1 and i is smaller than Δθ, then the particle at the point i − 1 is advanced by the Euler method, while if the angle is greater than Δθ, the modified Euler method is used. When the modified Euler method is preferred all the way through, Δθ should be set to 0. Obviously, Δθ controls a compromise point between the accuracy of solutions and the computational efficiency. Figure 7.17 shows how Δθ affects these conflicting demands in the right-angled wedge problem. With an appropriately selected Δθ, the computational effort can be reduced significantly with only a small increase in error. Although the result obtained here is not necessarily conformable to other problems, a value of Δθ of two degrees appears to be a good compromise point. This value was used in all of the subsequent examples discussed.

7.2 Verification of the Transient Flow Model

As is the case with the steady-state flow model, the perturbation process of the transient flow model is contingent upon an accurate zeroth-order solution, and, hence, for the purpose of the model verification, it is sufficient to examine the model results for flow problems in heterogeneous media. Prior to a series of verification tests, however, the Stehfest algorithm should be examined. CHAPTER 7. RESULTS AND DISCUSSION 112

7.2.1 Optimal Number of Stehfest Sampling Times

As is obvious from the computational procedure, the computational effort is almost

proportional to the number of sampling times nst in the Stehfest algorithm, and, thus, a small nst is preferable. Theoretically speaking, however, the accuracy of solutions becomes higher for larger nst. Thus, selecting an optimal nst requires a compromise between these conflicting demands. In order to investigate the sensitivity of the transient flow model to the number of sampling times, we consider a simple one-dimensional flow problem in the same configuration as shown in Fig. 7.1. The flow domain is assumed to be equalized initially (a homogeneous initial condition). The exact solution is (Liggett and Liu, 1983) ∞ n 2 (−1) 2 2 −n π tDA pD = xD + e sin(k0πxD) (7.23) π n=1 n For the transient flow model, 40 equally-spaced nodes are arranged along the boundary. Table 7.4 compares the pressure responses at xD =0.5 obtained by the model for nst =4, 8, and 12 with the exact solutions.

For nst = 4, the error is beyond an acceptable limit, particularly at early times. The reason for the relatively small error at late times is related to the nature of the free-space Green’s function G¯. For a large tDA and thus for a small s, G¯ behaves as 1 √ lim G¯ = lim K0( srD) s→0 s→0 2π 1 1 1 1 = ln + ln (7.24) 4π s 2π rD where the first term is a constant which adds nothing to the solution, while the second term is the free-space Green’s function G for the two-dimensional Laplace equation.

For a large tDA, since the solution is less dependent on the Laplace transform param- eter s, the Stehfest algorithm works fairly well with a small nst.

As is expected from theoretical considerations, the model with nst = 12 gives the most accurate result among the three. As for the computational effort, however, the model with nst = 8 is 1.5 times faster than that with nst = 12. The result obtained with nst = 8 is accurate enough for practical purposes, and, hence, throughout the CHAPTER 7. RESULTS AND DISCUSSION 113

Table 7.4: Sensitivity of the perturbation BEM to the number of Stehfest sampling times.

Time Exact nst =4 nst =8 nst =12 tDA pD pD Error (%) pD Error (%) pD Error (%) 0.02 0.01242 0.01624 +30.780 0.01247 +0.3821 0.01247 +0.4022 0.04 0.07710 0.09626 +24.851 0.07788 +1.0069 0.07734 +0.3107 0.06 0.14900 0.17216 +15.618 0.14951 +0.4090 0.14925 +0.2318 0.08 0.21112 0.23376 +10.721 0.21173 +0.2893 0.21154 +0.1986 0.10 0.26276 0.28241 +7.4802 0.26342 +0.2520 0.26322 +0.1760 0.12 0.30523 0.32076 +5.0868 0.30585 +0.2008 0.30567 +0.1431 0.14 0.34012 0.35116 +3.2458 0.34056 +0.1282 0.34051 +0.1151 0.16 0.36876 0.36545 +1.8136 0.36893 +0.0459 0.36912 +0.0984 0.18 0.39227 0.39502 +0.7012 0.39213 −0.0346 0.39255 +0.0729 0.20 0.41157 0.41093 −0.1554 0.41113 −0.1058 0.41176 +0.0477 0.22 0.42721 0.42396 −0.8062 0.42671 −0.1637 0.42757 +0.0381 0.24 0.44041 0.43472 −1.2910 0.43950 −0.2066 0.44051 +0.0224 0.26 0.45109 0.44368 −1.6421 0.45002 −0.2354 0.45106 −0.0051 0.28 0.45985 0.45117 −1.8861 0.45870 −0.2501 0.45996 +0.0244 0.30 0.46704 0.45749 −2.0446 0.46586 −0.2536 0.46725 +0.0461 0.32 0.47294 0.46284 −2.1356 0.47178 −0.2470 0.47279 −0.0318 0.34 0.47779 0.46740 −2.1737 0.47668 −0.2329 0.47758 −0.0446 0.36 0.48177 0.47131 −2.1707 0.48074 −0.2137 0.48167 −0.0213 0.38 0.48504 0.47467 −2.1364 0.48412 −0.1889 0.48515 +0.0246 0.40 0.48772 0.47758 −2.0788 0.48693 −0.1610 0.48764 −0.0151 0.42 0.48992 0.48010 −2.0041 0.48927 −0.1310 0.48968 −0.0479 0.44 0.49172 0.48229 −1.9176 0.49124 −0.0983 0.49228 +0.1124 0.46 0.49321 0.48421 −1.8232 0.49287 −0.0688 0.49338 +0.0034 0.48 0.49442 0.48590 −1.7243 0.49422 −0.0405 0.49511 +0.1383 0.50 0.49542 0.48738 −1.6234 0.49535 −0.0144 0.49510 −0.0650 CHAPTER 7. RESULTS AND DISCUSSION 114

following study, nst = 8 is used exclusively. Figure 7.18 shows the pressure responses at xD =0.3, 0.5, and 0.7 obtained by the model with nst =8.

7.2.2 Reservoir of Harmonically Varying Permeability

In a reservoir of harmonically varying permeability as defined by Eq.7.16, the tran- sient pressure behavior can be expressed analytically. Using the transformed pressure √ ψ = kpD, the differential equation governing transient flow in permeability varying media: 2 1 ∂pD ∇ pD = −∇ln k ·∇pD (7.25) K ∂tDA can be rewritten as 1 ∂ψ ∇2ψ = (7.26) k0K ∂tDA If the permeability variation is given by

2 k = k0K =(1+axD) (7.27) for the same boundary configuration and conditions as those in Section 7.2.1, the exact solution in Laplace space is (Appendix D) √ √ 2 2 1 1+a (1 + ax )(a+ a +4s)/2a − (1 + ax )(a− a +4s)/2a p¯ = √ ψ¯ = D √ D √ (7.28) D (a+ a2+4s)/2a (a− a2+4s)/2a k s(1 + axD) (1 + a) − (1 + a) which can be inverted to real space by means of the Stehfest algorithm. For the transient flow model, 40 equally-spaced nodes are arranged and the per- −4 turbation parameters ΔpD =1.0 × 10 and nM = 20 are set. Figures 7.19 and 7.20 compare the model results for a = 1 and a = 5 with the corresponding ana- lytical solutions, respectively. The dimensionless time is defined with k0 =1.Ina comparison between the pressure behavior in a homogeneous domain (Fig. 7.18) and the results obtained here, quite a strong heterogeneity effect is observed. Neverthe- less, the model shows its ability to simulate transient flow in a reservoir of varying permeability accurately. CHAPTER 7. RESULTS AND DISCUSSION 115

1.0

0.8

x D = 0.7 0.6

x D = 0.5 0.4

x D = 0.3 0.2 Dimensionless Pressure : BEM : Exact Solution 0.0 0.0 0.1 0.2 0.3 0.4 0.5 Dimensionless Time Figure 7.18: Comparison of BEM results and exact solutions for the one-dimensional transient flow problem with nst =8. CHAPTER 7. RESULTS AND DISCUSSION 116

1.0

x D = 0.7 0.8

x D = 0.5 0.6

x D = 0.3 0.4

0.2 Dimensionless Pressure : Perturbation BEM : Exact Solution 0.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 Dimensionless Time Figure 7.19: Comparison of perturbation BEM results and exact solutions for the 2 transient flow problem with k =(1+xD) . CHAPTER 7. RESULTS AND DISCUSSION 117

1.0

0.8

0.6

0.7 0.4 x D = 0.5 0.3 0.2 Dimensionless Pressure : Perturbation BEM : Exact Solution 0.0 0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 Dimensionless Time Figure 7.20: Comparison of perturbation BEM results and exact solutions for the 2 transient flow problem with k =(1+5xD) . CHAPTER 7. RESULTS AND DISCUSSION 118

7.2.3 Reservoir of Varying Porosity

In a reservoir of constant permeability but varying porosity, the differential equation governing transient flow becomes

2 φ ∂pD ∇ pD = (7.29) φ0 ∂tDA If the porosity variation is given by

φ0 φ = 2 (7.30) (1 + axD) for the same boundary configuration and conditions as those in the previous section, the exact solution in Laplace space is (Appendix D) √ √ 2 2 1 (1 + ax )(a+ a +4s)/2a − (1 + ax )(a− a +4s)/2a D √ D √ p¯D = (7.31) s (1 + a)(a+ a2+4s)/2a − (1 + a)(a− a2+4s)/2a which can be inverted to real space by means of the Stehfest algorithm. For the transient flow model, 40 equally-spaced nodes are arranged and the per- −4 turbation parameters ΔpD =1.0 × 10 and nM = 20 are set. Figure 7.21 compares the model result for a = 1 with the analytical solution. The dimensionless time is defined with φ0 = 1. The overall agreement is good. Under the condition of steady state, variabilities in porosity have no effect on pressure responses, as is seen at late times in this figure.

7.2.4 Wells in an Exponentially Heterogeneous Reservoir

In the previous two sections, spatial variabilities in permeability and in porosity were dealt with separately. This section discusses a flow problem with aggregate heterogeneity in permeability and porosity. The transient pressure responses at wells in a reservoir of exponentially varying permeability and porosity can be obtained analytically. With the same boundary configuration and conditions as those in Section 7.1.3, if the permeability and porosity variations are 2(xD − xwD) k = k0 exp (7.32) a CHAPTER 7. RESULTS AND DISCUSSION 119

1.0

0.8

x D = 0.7 0.6

x D = 0.5 0.4

x D = 0.3 0.2 Dimensionless Pressure : Perturbation BEM : Exact Solution 0.0 0.00 0.05 0.10 0.15 0.20 0.25 0.30 Dimensionless Time Figure 7.21: Comparison of perturbation BEM results and exact solutions for the −2 transient flow problem with φ =(1+xD) . CHAPTER 7. RESULTS AND DISCUSSION 120

and φ = bk (7.33)

the exact solution takes the following form (Appendix D): − ∞ ∞ 2 qD xD xwD i+1 (rDi/a) dz pD = exp − (−1) exp −z − (7.34) 4π a i=1 ui 4z z where rDi is the Euclidean distance between the point of interest and the well in the 2 ith imaginary pattern, and ui =(brDi )/(4tDA). For the perturbation BEM, 40 equally-spaced nodes are arranged along the bound- −5 ary and ΔpD is set to 1.0 × 10 . The well at (0.5,0.5) is put on production and four observation wells are aligned along yD =0.5. The radius rwD of the active well is set to 0.0005. Figure 7.22 shows the model results in a homogeneous domain (a = ∞), while Figure 7.23 shows the results for a =2/3 and b =0.1. In both cases, the agreement between the model results and the corresponding analytical solutions is excellent. It should be noted that the transient pressure response at the active well is not very sensitive to the permeability and porosity variations given by Eq. 7.32 and Eq. 7.33. In general, the pressure response at the active well is affected by the average property values of a heterogeneous domain to a greater degree than by the local variance from the average. This is because the diffusive process is a process of equalization rather than a process of differentiation (Streltsova, 1988). On the other hand, the pressure responses at the observation wells are affected largely by the variabilities in permeability and porosity. This can be explained by the fact that the average values of well-to-well properties in the region xD xwD. These observations can be confirmed by examining the exact solution Eq. 7.34, which, for the active well, can be rewritten as ∞ 2 qD rwD (rwD/a) dz pD = exp − exp −z − 4π a u1 4z z q r ∞ ∞ (r /a)2 dz + D exp − wD (−1)i+1 exp −z − Di (7.35) 4π a i=2 ui 4z z CHAPTER 7. RESULTS AND DISCUSSION 121

10

Active Well : BEM : Exact Solution 1.

0.1 Observation Wells (0.6, 0.5)

Dimensionless Pressure (0.8, 0.5) 0.01 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.22: Comparison of BEM results and exact solutions for transient pressure responses at wells in a homogeneous reservoir. CHAPTER 7. RESULTS AND DISCUSSION 122

10

Active Well : Perturbation BEM : Exact Solution 1.

0.1 Observation Wells (0.4, 0.5) (0.6, 0.5) Dimensionless Pressure (0.2, 0.5) (0.8, 0.5) 0.01 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.23: Comparison of perturbation BEM results and exact solutions for tran- sient pressure responses at wells in an exponentially heterogeneous reservoir. CHAPTER 7. RESULTS AND DISCUSSION 123

2 where u1 =(brwD )/(4tDA). At early times, since the pressure response is affected by its own singularity to a greater degree than by those of imaginary wells, the second term on the right is negligible. From the fact that rwD/a is very small, the first term is approximated as q r ∞ (r /a)2 dz D exp − wD exp −z − wD 4π a u1 4z z ∞ 2 qD 1 dz qD 1 brwD  exp(−z) = − Ei (7.36) 2π 2 u1 z 2π 2 4tDA which is the solution for a line source well in an infinite homogeneous reservoir. At the observation wells, on the other hand, the corresponding values of (rD/a) are not small, and, hence, the first term is not reduced to the solution in a homogeneous domain.

Taking the derivative of Eq. 7.34 with respect to ln tDA, the pressure derivative is − ∞ 2 ∂pD qD −xD xwD − i+1 −brDi − tDA = exp ( 1) exp 2 (7.37) ∂ ln tDA 4π a i=1 4tDA a b The model results are compared with the exact solutions in Fig. 7.24 and Fig. 7.25 for the homogeneous and heterogeneous cases mentioned above, respectively. The agreement is again excellent. To compute pressure responses and pressure derivatives at 51 time sequences, the CPU times required on DEC 5810 were 850.3 seconds for the homogeneous problem and 5962.7 seconds for the heterogeneous problem. The computation took about seven times more for the latter problem than for the former. The average number (0) of perturbation solutions (including pD ) computed at each time sequence for the heterogeneous problem was about 10 (Appendix F). This nonproportionality between the CPU time and the order of perturbation solutions is due to the facts that the nst sets of solution matrices must be formed and decomposed only once for each time sequence and that the principal parts of domain integrals can be evaluated regardless of the order of perturbation (Appendix G). CHAPTER 7. RESULTS AND DISCUSSION 124

10 Observation Wells (0.6, 0.5)

1. (0.8, 0.5) : BEM Active Well : Exact Solution

0.1 Pressure Derivative

0.01 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.24: Comparison of BEM results and exact solutions for pressure derivatives at wells in a homogeneous reservoir. CHAPTER 7. RESULTS AND DISCUSSION 125

10 Observation Wells (0.4, 0.5) (0.6, 0.5) (0.2, 0.5) 1. (0.8, 0.5) : Perturbation BEM Active Well : Exact Solution

0.1 Pressure Derivative

0.01 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.25: Comparison of perturbation BEM results and exact solutions for pressure derivatives at wells in an exponentially heterogeneous reservoir. CHAPTER 7. RESULTS AND DISCUSSION 126

7.2.5 Importance of Well-Singularity Treatment

In the previous section, the transient flow problem in a heterogeneous domain in- cluding a well singularity was solved successfully by the perturbation BEM. In the computation, the well singularity was dealt with by using the singularity programming described in Section 5.2.1. The technique of singularity programming approach was implemented in consideration of the accuracy in the evaluation of domain integrals. This section discusses the importance of the well-singularity treatment. To the same problem described in the previous section, the perturbation BEM without the singularity programming is applied. Since the pressure response at the active well is not sensitive to the variabilities in permeability and porosity, those at the observation wells located at (0.4,0.5) and (0.6,0.5) are compared with the corresponding exact solutions in Table 7.5 and Table 7.6, respectively. The results computed by using the singularity programming agree with the exact solutions very well, while the results without the singularity programming are erroneous. Errors introduced into the domain integrals are found to have substantial effects on final solutions. When the singularity programming is not used, the results are positively biased

from the exact solutions in the region xD xwD. Since the exact solutions are biased from the solutions for a homogeneous-domain problem in the same direction due to the variabilities in permeability and porosity, this observation implies that the heterogeneity effect is erroneously magnified due to the improper well-singularity treatment. The perturbation BEM results presented here reveal that singularity programming is indispensable to the problems including well singularities.

7.2.6 Effects of Skin and Wellbore Storage

In order to exemplify the utility of the transient flow model in solving well testing problems, we consider a well with skin and wellbore storage located in the center of a homogeneous and closed square reservoir. The exact solution in Laplace space is CHAPTER 7. RESULTS AND DISCUSSION 127

Table 7.5: Comparison of pressure responses at (0.4,0.5) computed with and without the singularity programming. Time Exact Singularity Prog. Regular Prog. tDA pD pD Error (%) pD Error (%) 0.00100 0.01445 0.01428 −1.1477 0.06888 +376.78 0.00126 0.02891 0.02894 +0.1242 0.09514 +229.12 0.00158 0.05169 0.05188 +0.3702 0.13059 +152.63 0.00200 0.08439 0.08460 +0.2467 0.17644 +109.07 0.00251 0.12797 0.12803 +0.0483 0.23325 +82.270 0.00316 0.18270 0.18247 −0.1244 0.30093 +64.712 0.00398 0.24826 0.24766 −0.2439 0.37876 +52.563 0.00501 0.32388 0.32287 −0.3134 0.46564 +43.768 0.00631 0.40851 0.40712 −0.3395 0.56023 +37.140 0.00794 0.50094 0.49930 −0.3265 0.66118 +31.988 0.01000 0.59992 0.59805 −0.3114 0.76701 +27.852 0.01259 0.70425 0.70227 −0.2809 0.87666 +24.481 0.01585 0.81276 0.81068 −0.2559 0.98894 +21.676 0.01995 0.92438 0.92224 −0.2314 1.10296 +19.319 0.02512 1.03807 1.03603 −0.1965 1.21799 +17.332 0.03162 1.15277 1.15116 −0.1393 1.33333 +15.663 0.03981 1.26714 1.26637 −0.0610 1.44787 +14.263 0.05012 1.37909 1.37938 +0.0208 1.55954 +13.084 0.06310 1.48528 1.48652 +0.0839 1.66497 +12.098 0.07943 1.58099 1.58293 +0.1229 1.75964 +11.299 0.10000 1.66108 1.66373 +0.1594 1.83894 +10.707 CHAPTER 7. RESULTS AND DISCUSSION 128

Table 7.6: Comparison of pressure responses at (0.6,0.5) computed with and without the singularity programming. Time Exact Singularity Prog. Regular Prog. tDA pD pD Error (%) pD Error (%) 0.00100 0.01070 0.01053 −1.5927 −0.04496 −520.09 0.00126 0.02142 0.02121 −0.9685 −0.04608 −315.18 0.00158 0.03829 0.03789 −1.0429 −0.04214 −210.03 0.00200 0.06252 0.06176 −1.2193 −0.03168 −150.67 0.00251 0.09480 0.09357 −1.2976 −0.01364 −114.38 0.00316 0.13535 0.13362 −1.2735 0.01259 −90.701 0.00398 0.18392 0.18176 −1.1738 0.04717 −74.351 0.00501 0.23994 0.23745 −1.0382 0.08984 −62.556 0.00631 0.30263 0.29990 −0.9012 0.14007 −53.714 0.00794 0.37110 0.36827 −0.7642 0.19716 −46.873 0.01000 0.44443 0.44146 −0.6699 0.26010 −41.476 0.01259 0.52172 0.51867 −0.5854 0.32810 −37.112 0.01585 0.60211 0.59894 −0.5262 0.40013 −33.544 0.01995 0.68480 0.68150 −0.4815 0.47532 −30.590 0.02512 0.76902 0.76566 −0.4365 0.55290 −28.102 0.03162 0.85399 0.85072 −0.3830 0.63207 −25.986 0.03981 0.93872 0.93567 −0.3247 0.71179 −24.174 0.05012 1.02166 1.01878 −0.2813 0.79034 −22.641 0.06315 1.10032 1.09737 −0.2684 0.86502 −21.384 0.07943 1.17123 1.16794 −0.2804 0.93240 −20.390 0.10000 1.23056 1.22704 −0.2858 0.98902 −19.628 CHAPTER 7. RESULTS AND DISCUSSION 129

100

10 C D = 0 5 4 10 103 10 1

: BEM Pressure : BEM Derivative : Exact Solution

Dimensionless Pressure / Derivative 0.1 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.26: Comparison of BEM results and exact solutions for transient pressure responses at a well with S = 0 and various CD’s. CHAPTER 7. RESULTS AND DISCUSSION 130

100

C D = 0

5 4 10 10 103 10

1

: BEM Pressure : BEM Derivative : Exact Solution

Dimensionless Pressure / Derivative 0.1 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.27: Comparison of BEM results and exact solutions for transient pressure responses at a well with S = 20 and various CD’s. CHAPTER 7. RESULTS AND DISCUSSION 131

readily found as ∞ −1 s 2 p¯D = √ + s CD (7.38) i=1 K0( srDi)+S and the pressure derivative is ⎧ ⎫ ⎨∞ −1⎬ ∂pD L−1 √ 1 = tDA ⎩ + sCD ⎭ (7.39) ∂tDA i=1 K0( srDi)+S

Since the domain is assumed to be homogeneous, and, thus, there is no need to use boundary nodes as permeability allocation points, only 16 boundary elements are arranged. Figure 7.26 shows the model results for S = 0 and various values of CD with the corresponding exact solutions, while Figure 7.27 compares those for S = 20. In either case, the agreement is good in the transient flow period as well as in the pseudosteady-state flow period. In the transient flow period, the good agreement is not a surprise, since the model utilizes the well singularity programming, in which skin and wellbore storage are included analytically. The good match in the transitional and pseudosteady-state flow periods verifies the transient flow model as a whole.

7.3 Application Problems

Through the test problems in the previous two sections, the perturbation BEM can deal with flow problems in heterogeneous media without losing principal features of the conventional BEM. In this section, we consider problems which exemplify the practical usefulness of the perturbation BEM.

7.3.1 Full-Field Problem

One of the features of the boundary element method is its flexibility in treating boundary geometries and boundary conditions. Figure 7.28 shows a synthetic reser- voir bounded by the Dirichlet (p = 1000) and Neumann (∂p/∂n = 0) boundaries. The permeability variation is also indicated as values measured at selected boundary CHAPTER 7. RESULTS AND DISCUSSION 132

nodes and the well locations in the figure. The northern region is relatively perme- able, and permeability gradually decreases towards the south. Among the seven wells drilled, five of them are put on production, while the other two are put on injection. The production rates and other properties are given in Table 7.7. As for the injection wells, a maximum injection pressure of 1500 psi and a maximum injection rate of 400 RB/D are assumed. Table 7.8 compares well responses under steady-state conditions with and without the variability in permeability. When the variability is ignored, a constant perme- ability of 10 md is assumed. In either case, INJC-1 is constrained by the injection pressure limit, while INJC-2 is constrained by the rate limit. Because of the rela- tively high permeability in the northern region, the pressure difference between the injection well (INJC-2) and the production wells (PROD-5,6,7) is lower than that in the homogeneous case. The reverse is true in the southern region. Figures 7.29 and 7.30 illustrate the effects of the permeability variation on dis- placement profiles after 0.2 PV of injection and 0.5 PV of injection, respectively. In these figures, the number of streamlines is set proportional to the injection rate. The heterogeneity effect is insignificant in the northern region, where permeability varies only twofold. In contrast, the displacement profiles exhibit a conspicuous heterogene- ity effect in the southern region, where permeability varies more than one order of magnitude. The southernmost production well (PROD-3) in the heterogeneous case is almost isolated from the injection-production system and is encroached by water from the . The production well (PROD-5) in the homogeneous case is not di- rectly supported by the aquifer, while in the heterogeneous case it will produce water from the aquifer. These results show that the steady-state flow model is effective in studying het- erogeneity effects on well performances and will be of great utility in planning dis- placement schemes. CHAPTER 7. RESULTS AND DISCUSSION 133

23 23 22 24 21 N 23 PROD-7 18 21 23 12 PROD-6 22 21 INJC-2 12 10 21 PROD-5 14 6 14

PROD-4 4 12 6

INJC-1 2 8 5

1 6 PROD-3 1 2 4 1

2 1

1

Figure 7.28: Configuration of the full-field problem. CHAPTER 7. RESULTS AND DISCUSSION 134

Table 7.7: Parameters for the full-field problem. Reservoir and Fluid Data Area (A) , acres 39.4 Thickness (h) , ft 35.0 Porosity (φ) , fraction 0.20 Viscosity (μ) , cp 0.5 Well Data Production Rate (ql) , RB/D PROD-3 100.0 PROD-4 100.0 PROD-5 200.0 PROD-6 200.0 PROD-7 200.0 Well Radius (rw) , ft 0.35 CHAPTER 7. RESULTS AND DISCUSSION 135

Table 7.8: Comparison of well responses in a synthetic reservoir with and without variability in permeability. Well Heterogeneous Homogeneous p (psi) q (RB/D) p (psi) q (RB/D) INJC-1 1500.0 305.1 1500.0 397.4 INJC-2 851.5 400.0 1321.0 400.0 PROD-3 181.5 100.0 861.6 100.0 PROD-4 276.6 100.0 737.7 100.0 PROD-5 208.8 200.0 510.3 200.0 PROD-6 232.0 200.0 447.3 200.0 PROD-7 231.0 200.0 441.6 200.0 CHAPTER 7. RESULTS AND DISCUSSION 136

Figure 7.29: Displacement profiles after 0.2 PV of injection with the permeability variation ignored (left) and honored (right). CHAPTER 7. RESULTS AND DISCUSSION 137

Figure 7.30: Displacement profiles after 0.5 PV of injection with the permeability variation ignored (left) and honored (right). CHAPTER 7. RESULTS AND DISCUSSION 138

7.3.2 Repeated Five-Spot Pattern

As a commonly encountered well arrangement, a quarter of a repeated five-spot pat- tern is frequently used in studying well-to-well displacement performances. If the flow domain is homogeneous, some useful analytical solutions are found for fluid injectiv- ity problems in Muskat (1950) and for tracer breakthrough problems in Abbaszadeh- Dehghani (1982). Effects of heterogeneity on pressure and tracer test responses have also been studied by some authors (Smith and Brown, 1984: Mishra et al., 1991). In this section, the steady-state and transient flow models are applied to balanced injection-production problems in a repeated five-spot pattern. Injection and production rates are considered constant and equal to each other, and, hence, steady state will be reached when the system is totally equalized. Steady- state fluid injectivities for a number of different flooding patterns are presented by

Muskat (1950). For a repeated five-spot pattern, the injection rate qinj is related to the steady-state pressure difference between the two wells by

0.001538k h(p − p ) q = ss inj prd (7.40) inj d μ log − 0.2688 rw where d is the distance between injection and production wells, the subscript ss denotes steady state, and all the terms are in oilfield units. Given the parameters shown in Table 7.9, there follows

μ(3.4515 − 0.2688) pinj − pprd = qinj = 165.6 (psi) (7.41) 0.001538kssh Figure 7.31 shows the pressure responses at injection and production wells computed by the transient flow model with 40 equally-spaced boundary nodes. When the system reaches steady state, pinj = 3082.8 and pprd = 2917.2 are observed, and the pressure difference of 165.6 psi agrees with Eq. 7.41.

At early times, the slope ml of the linear portion in a semilog plot can be related to the near-well permeability (Matthews and Russell, 1967):

162.6qlμ ml = (7.42) klh CHAPTER 7. RESULTS AND DISCUSSION 139

Table 7.9: Parameters for the repeated five-spot pattern flooding. Reservoir and Fluid Data Area (A) , acres 23 Distance between Wells (d) , ft 1414.2 Initial Pressure (pi) , psi 3000.0 Thickness (h) , ft 50.0 Porosity (φ) , fraction 0.15 Permeability (k) , md 10.0 −6 Total Compressibility (ct) , 1/psi 8.7 × 10 Viscosity (μ) , cp 0.2 Well Data Production Rate (qprd) , RB/D 200.0 Injection Rate (qinj) , RB/D 200.0 Well Radius (rw) , ft 0.5 CHAPTER 7. RESULTS AND DISCUSSION 140

3150

3100 m inj = 13.0 psi/cycle 3050

3000

2950 Pressure (psi)

m = 13.0 psi/cycle 2900 prd

2850 0.01 0.1 1. 10 100 Time (hrs) Figure 7.31: Pressure responses at injection and production wells in a homogeneous repeated five-spot pattern. CHAPTER 7. RESULTS AND DISCUSSION 141

where the subscript l denotes injection (inj) or production (prd). The near-well

permeability kl should be distinguished from kss, which is supposed to represent some “average” permeability over the whole domain. By using a least-square fit in

Fig. 7.31, minj = mprd =13.0 is obtained. The near-well permeability is 162.6qμ k = k = =10.0 (md) (7.43) inj prd 13.0h which is consistent with the input data. Under the conditions of steady state, unit-mobility ratio displacement, and misci- ble displacement, the effluent concentration of the displacing fluid can be estimated (Abbaszadeh-Dehghani, 1982) as

∞ π(1 + λ) √ dz√ Vp = (7.44) 4(1.8540747)2 0 z2 + λ2 z2 +1 the integral in which is equal to the complete elliptic integral of the first kind K(λ2) (Abramowitz and Stegun, 1970), and there follows

2 Vp =0.228473(1 + λ)K(λ ) (7.45) where π(1 − C) λ = tan2 (7.46) 4

Vp is the pore volume injected into the system, and C is the effluent concentration of the displacing fluid. From the injection well, 49 streamlines are tracked by using the steady-state flow model as shown in Fig. 7.32, where the displacing fluid (tracer) is indicated by solid lines. As discussed in Section 4.5.2, the tracer effluent concentration can be computed by the model and is compared with the exact solution in Fig. 7.33. The agreement is excellent. In particular, the breakthrough time (0.718 PV) is accurately computed by the model. This result demonstrates the superiority of the BEM over domain methods, which would not provide such an accurate result due to the numerical dispersion and grid orientation effects. Figure 7.34 shows the results obtained by a finite difference model, ECLIPSE (Version 91A), which uses an implicit formulation and has a “dispersion control option”. Tracer flow is simulated in a quarter of a CHAPTER 7. RESULTS AND DISCUSSION 142

repeated five-spot pattern with 10 × 10 and 30 × 30 diagonal grid systems and in a half of a five-spot pattern with a parallel 14 × 14 grid system. The timestep size is chosen to be equivalent to 0.01 PV of injection. The diagonal grid system yields less numerical dispersion than the parallel system, and the grid refinement reduces the discrepancy between the model result and the analytical solution. To eliminate the numerical dispersion completely, however, an infinite number of grids are required. In addition, if the flow domain is heterogeneous, these unfavorable effects are unlikely to be alleviated even with fine grids (Brand et al., 1991). In a homogeneous reservoir, the leading edge of the tracer is characterized by its cusped shape. This is because the fastest path from the injection well to the production well is on the diagonal line between the wells. If the permeability variation is given so that the fastest path takes a route other than the diagonal, some different displacement behavior is expected. To examine heterogeneity effects, the following permeability variation is considered:

k = a − exp{b sin(πxD) sin(πyD)} (7.47) Figure 7.35 shows the permeability distribution with a = 22 and b = 3. For the −4 perturbation BEM, ΔpD =1.0 × 10 and nM = 20 are used. Figure 7.36 shows 49 streamlines tracked from the injection well. Although the domain should be subdi- vided to capture the permeability variation, flow is not restricted by the grid system, and streamlines are tracked smoothly. The streamlines detour the clustered low per- meability region and preferential flow paths are developed. Consequently, the fastest path is no longer on the diagonal, as is to be expected from the permeability distribu- tion. The effluent concentration history is shown in Fig. 7.37. Tracer breakthrough occurs at 0.828 PV of injection. The clustered low permeability on the diagonal causes the tracer to arrive later at the production well and the overall displacement to become more uniform. Computed pressure responses at two wells are shown in Fig. 7.38. At late times, pinj = 3041.5 and pprd = 2958.5 are observed, and from Eq. 7.40 the steady-state permeability kss is q μ(3.4515 − 0.2688) k = inj =19.9 (md) (7.48) ss 0.001538h(3041.5 − 2958.5) CHAPTER 7. RESULTS AND DISCUSSION 143

Figure 7.32: Streamlines and tracer fronts at breakthrough in a homogeneous repeated five-spot pattern. CHAPTER 7. RESULTS AND DISCUSSION 144

1.0

0.8

0.6

0.4

: BEM

Effluent Concentration 0.2 : Exact Solution

0.0 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 Pore Volumes Injected Figure 7.33: Comparison of simulated tracer breakthrough curve and exact solution for a homogeneous repeated five-spot pattern. CHAPTER 7. RESULTS AND DISCUSSION 145

1.0

0.8

0.6

0.4 : Parallel (14x14) : Diagonal (10x10)

Effluent Concentration 0.2 : Diagonal (30x30) : Exact Solution 0.0 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 Pore Volumes Injected Figure 7.34: Tracer breakthrough curves simulated by ECLIPSE for a homogeneous repeated five-spot pattern. CHAPTER 7. RESULTS AND DISCUSSION 146

Producer Permeability

20

15 10 5 0

Injector Figure 7.35: Permeability variation given by Eq. 7.47 with a = 22 and b =3. CHAPTER 7. RESULTS AND DISCUSSION 147

Figure 7.36: Streamlines and tracer fronts at breakthrough in a repeated five-spot pattern with the permeability variation given by Eq 7.47 with a = 22 and b =3. CHAPTER 7. RESULTS AND DISCUSSION 148

1.0

0.8

0.6

0.4

: Eq. 7.47

Effluent Concentration 0.2 : Homogeneous

0.0 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 Pore Volumes Injected Figure 7.37: Tracer breakthrough curve for a repeated five-spot pattern with the permeability variation given by Eq 7.47 with a = 22 and b =3. CHAPTER 7. RESULTS AND DISCUSSION 149

At early times, minj = mprd =6.21 is obtained, and there follows 162.6qμ k = k = =20.9 (md) (7.49) inj prd 6.21h

Referring to the actual permeability variation, since kl represents near-well perme- abilities, the estimated value of 20.9 appears to be reasonable. On the other hand, as a measure of “average” permeability, the estimated value of kss seems to be too high. This is because the two wells are continuously connected by the high-permeability region along the boundary and the clustered low permeability has only negligible ef- fect on the pressure response. The consistency between the estimated values of kl

and kss can be also explained by the preferential flow paths which have an “average” permeability of around 20 md. In the next example, the permeability variation is given so that any connecting path between the two wells undergoes the whole range of permeability:

k = exp(axD) (7.50)

Figure 7.39 shows the permeability distribution with a = 3. Computed pressure responses are shown in Fig. 7.40. At late times, pinj = 3709.5 and pprd = 2942.7 are observed, and the steady-state permeability yields

q μ(3.4515 − 0.2688) k = inj =2.16 (md) (7.51) ss 0.001538h(3709.5 − 2942.7)

At early times, minj = 130.4 and mprd =6.98 are obtained, and the near-well perme- abilities are 162.6qμ k = =1.00 (md) (7.52) inj 130.4h and 162.6qμ k = =18.6 (md) (7.53) prd 6.98h

Unlike the previous example, and as is expected, kss and kl are not consistent. How- ever, the harmonic average of kinj and kprd gives a rough estimate of kss: 1 1 2 2 + = = (7.54) kinj kprd k¯ 1.90 CHAPTER 7. RESULTS AND DISCUSSION 150

3060

3040 m inj = 6.21 psi/cycle

3020

3000

2980 Pressure (psi)

2960 m prd = 6.21 psi/cycle

2940 0.01 0.1 1. 10 100 Time (hrs) Figure 7.38: Pressure responses at injection and production wells in a repeated five- spot pattern with the permeability variation given by Eq 7.47 with a = 22 and b =3. CHAPTER 7. RESULTS AND DISCUSSION 151

Figure 7.41 shows 49 streamlines tracked from the injection well, and Figure 7.42 compares the effluent concentration history with that in the homogeneous case. The permeability variation of Eq. 7.50 causes earlier breakthrough at 0.685 PV of injection. Up to around 1.0 PV of injection, the tracer recovery rate is almost equal to that in the homogeneous case. During this period, the tracer is recovered from the right-edge region. As is seen in Fig. 7.41, the flow direction in this region is perpendicular to the x-axis, and the flow paths follow almost constant permeability lines. After 1.0 PV of injection, the recovery rate becomes slower. This is because the tracer is recovered from the top-edge region where the flow direction is almost parallel to the x-axis and the flow paths travel from low to high permeability regions. Thus far, heterogeneity has been defined by some analytical function, which is rarely encountered in real situations. Since the introduction of geostatistics, a study of rock properties varying from point to point in a random manner but honoring spatial correlation has attracted much attention (Lake and Carroll, 1986). Under the assumption of stationarity over the flow domain, spatial images of rock properties that honor the specified histogram and the correlation of spatial variability can be generated by geostatistical techniques. Although it is not the only option, the semi- variogram, half the expectation of the random variable {Z(x) − Z(x + h)}2, is widely used to express the spatial continuity (Journel and Huijbregts, 1978). By introducing a second-order stationarity of the differences Z(x) − Z(x + h), the semivariogram can be estimated as half the arithmetic mean of the squared differences between the paired data values:

n(h) 1 2 γ(h)= {z(xi + h) − z(xi)} (7.55) 2n(h) i=1 where z(x) is the attribute value at point x, h the vector between the paired points, and n(h) the number of pairs separated by h. In stochastic simulations, the semivariogram is modeled by some function (Isaaks and Srivastava, 1989). To define such a function, the sill (C0), a plateau of the semivariogram, and the range (a), a distance at which the sill is reached, must be CHAPTER 7. RESULTS AND DISCUSSION 152

Producer Permeability

20

15

10

5

0

Injector

Figure 7.39: Permeability variation given by k = exp(3xD). CHAPTER 7. RESULTS AND DISCUSSION 153

3800

3600 m inj = 130.4 psi/cycle

3400

3200 Pressure (psi)

3000 m prd = 6.98 psi/cycle

2800 0.01 0.1 1. 10 100 Time (hrs) Figure 7.40: Pressure responses at injection and production wells in a repeated five- spot pattern with the permeability variation given by k = exp(3xD). CHAPTER 7. RESULTS AND DISCUSSION 154

Figure 7.41: Streamlines and tracer fronts at breakthrough in a repeated five-spot pattern with the permeability variation given by k = exp(3xD). CHAPTER 7. RESULTS AND DISCUSSION 155

1.0

0.8

0.6

0.4

: k = exp(3x D )

Effluent Concentration 0.2 : Homogeneous

0.0 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 Pore Volumes Injected Figure 7.42: Tracer breakthrough curve for a repeated five-spot pattern with the permeability variation given by k = exp(3xD). CHAPTER 7. RESULTS AND DISCUSSION 156

specified. In an isotropic medium, a simple circular semivariogram model is ⎧ ⎫ 2 ⎨ h ⎬ γ(h)=C0 1 − (7.56) ⎩ a ⎭ where h is the modulus of the separation vector h. The range is a spatial quantity and has no direct relation to “summary” statistics. On the other hand, the sill is half the average squared difference between the paired data which are distant beyond the spatial correlation range, and is equivalent to a variance. Permeability often shows a log-normal distribution and can be characterized by a standard deviation σln(k) and a 50th percentile value k50. The sill is given by 2 σln(k). Given k50 = 10, σln(k) =0.7, and a = 300, two spatial images (realizations) of permeability are generated by use of a simple stochastic simulation technique, the moving-average method (Journel and Huijbregts, 1978), as shown in Figs. 7.43 and 7.44. Computed pressure responses are shown in Figs. 7.45 and 7.46. For Realization

No.1, pinj = 3117.2 and pprd = 2822.8 are observed at late times, and the steady-state permeability yields q μ(3.4515 − 0.2688) k = inj =5.62 (md) (7.57) ss 0.001538h(3117.2 − 2822.8)

At early times, minj =16.9 and mprd =28.5 are obtained, and the corresponding near-well permeabilities are 162.6qμ k = =7.70 (md) (7.58) inj 16.9h and 162.6qμ k = =4.56 (md) (7.59) prd 28.5h For Realization No.2, pinj = 3140.0 and pprd = 2953.9 are observed at late times, and the steady-state permeability yields q μ(3.4515 − 0.2688) k = inj =8.90 (md) (7.60) ss 0.001538h(3140.0 − 2953.9)

At early times, minj =20.8 and mprd =6.16 are obtained, and the corresponding near-well permeabilities are 162.6qμ k = =6.25 (md) (7.61) inj 20.8h CHAPTER 7. RESULTS AND DISCUSSION 157

Producer Permeability

50 40 30 20 10 0

Injector

Figure 7.43: Permeability realization (No.1) for k50 = 10, σln(k) =0.7, and the range of 300 ft. CHAPTER 7. RESULTS AND DISCUSSION 158

Producer Permeability

50 40 30 20 10 0

Injector

Figure 7.44: Permeability realization (No.2) for k50 = 10, σln(k) =0.7, and the range of 300 ft. CHAPTER 7. RESULTS AND DISCUSSION 159

and 162.6qμ k = =21.1 (md) (7.62) prd 6.16h

In either case, the harmonic average of kinj and kprd appears to be a good estimate of kss: 1 1 2 2 + = ¯ = (7.63) kinj kprd k 5.72 for Realization No.1, and 1 1 2 2 + = ¯ = (7.64) kinj kprd k 9.64 for Realization No.2. Figure 7.47 shows 49 streamlines tracked from the injection well, and Figure 7.48 shows the effluent concentration history for Realization No.1, while Figures 7.49 and 7.50 show those for Realization No.2. Although it may be true that heterogeneity tends to cause earlier tracer breakthrough as Mishra et al. (1991) pointed out, ex- ceptions can be found in not only intentionally (Eq. 7.47) but randomly (Realization No.2) generated heterogeneities.

7.3.3 Type Curves for Idealized Heterogeneities

In Section 7.2.4, it was observed that the pressure response at the active well exhibited no detectable symptom of heterogeneity and, in contrast, the pressure responses at observation wells were affected by the well-to-well heterogeneity. It is deduced that heterogeneity has little effect on pressure responses if the average property value within a drainage area is not much different from the near-well property value. Similar observations were made by Butler (1991) and Rosa and Horne (1991). In this section, type curves for idealized heterogeneities in permeability and porosity, which may be detected by a single-well testing, are generated. Permeability and porosity are closely correlated with the texture of a sediment, and the texture is related to the original depositional fabric of the sediment and the subsequent diagenesis. The textural parameters that may affect permeability and porosity are grain shape, grain size, grain sorting, grain packing, and grain orien- tation (Selley, 1985). Although an empirical correlation sometimes works between CHAPTER 7. RESULTS AND DISCUSSION 160

3150 3100 3050 m inj = 16.9 psi/cycle 3000 2950 m = 28.5 psi/cycle 2900 prd Pressure (psi) 2850 2800 2750 0.01 0.1 1. 10 100 Time (hrs) Figure 7.45: Pressure responses at injection and production wells in a repeated five- spot pattern with the permeability realization No.1. CHAPTER 7. RESULTS AND DISCUSSION 161

3200

3150

3100 m inj = 20.8 psi/cycle

3050

3000 Pressure (psi)

2950 m prd = 6.16 psi/cycle

2900 0.01 0.1 1. 10 100 Time (hrs) Figure 7.46: Pressure responses at injection and production wells in a repeated five- spot pattern with the permeability realization No.2. CHAPTER 7. RESULTS AND DISCUSSION 162

Figure 7.47: Streamlines and tracer fronts at breakthrough in a repeated five-spot pattern with the permeability realization No.1. CHAPTER 7. RESULTS AND DISCUSSION 163

1.0

0.8

0.6

0.4

: Realization No.1

Effluent Concentration 0.2 : Homogeneous

0.0 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 Pore Volumes Injected Figure 7.48: Tracer breakthrough curve for a repeated five-spot pattern with the permeability realization No.1. CHAPTER 7. RESULTS AND DISCUSSION 164

Figure 7.49: Streamlines and tracer fronts at breakthrough in a repeated five-spot pattern with the permeability realization No.2. CHAPTER 7. RESULTS AND DISCUSSION 165

1.0

0.8

0.6

0.4

: Realization No.2

Effluent Concentration 0.2 : Homogeneous

0.0 0.0 0.2 0.4 0.6 0.8 1.0 1.2 1.4 1.6 1.8 2.0 Pore Volumes Injected Figure 7.50: Tracer breakthrough curve for a repeated five-spot pattern with the permeability realization No.2. CHAPTER 7. RESULTS AND DISCUSSION 166

permeability and porosity, the “universal” correlation does not exist due to unique environmental factors in each reservoir. Theoretical attempts to correlate permeability with porosity have been reported by several authors. Among those models, the one proposed by Kozeny (as cited in Bear, 1972) has been widely accepted:

φ3 k = c0 (7.65) M 2 where c0 is the Kozeny constant and M is the specific surface with respect to a unit volume of porous material. Kozeny’s equation was later modified by Carman (1937) who expressed the specific surface (Ms) with respect to a unit volume of solid rather than of porous material: φ3 k = c0 (7.66) 2 − 2 Ms (1 φ) Although the theoretical correlation is not universal either, the Kozeny-Carman equa- tion is employed in this study to correlate permeability with porosity. Since type curves are dimensionless, the Kozeny-Carman equation can be rewritten as

φ3 k(φ)=c (7.67) (1 − φ)2 where c is chosen so that the permeability at a well location yields 1 md. To confirm the observation made in Section 7.2.4, a linear porosity variation is first considered:

φ(xD)=axD + b (7.68)

Figure 7.51 shows the porosity variation with a =0.2 and b =0.1 and the permeability variation given by the Kozeny-Carman equation in a square flow domain. The well is

located at (0.5, 0.5) and its radius rwD is set to 0.0005. For the perturbation BEM, 40 −5 equally-spaced nodes are arranged along the boundary, and ΔpD is set to 1.0 × 10 . Computed pressure responses with constant-pressure and closed boundary conditions are compared with those in homogeneous media in Fig. 7.52. In this figure, the dimensionless time is defined with the properties at the well. As is expected, no behavior indicating heterogeneity is observed, and the deduction: heterogeneity has CHAPTER 7. RESULTS AND DISCUSSION 167

Porosity

0.3

0.2

0.1

0

Permeability

4.5

3.0

1.5

0

Figure 7.51: The linear variation in porosity (above) and the permeability variation given by the Kozeny-Carman equation (below). CHAPTER 7. RESULTS AND DISCUSSION 168

100

Closed System 10

1. Constant Pressure System

0.1 : Pressure : Derivative : Homogeneous Dimensionless Pressure / Derivative 0.01 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.52: Type curve for a single well in a square flow domain with the linear variation in porosity and the permeability variation given by the Kozeny-Carman equation. CHAPTER 7. RESULTS AND DISCUSSION 169

Porosity

0.3

0.2

0.1

0

Permeability

45

30

15

0

Figure 7.53: The concave variation in porosity (above) and the permeability variation given by the Kozeny-Carman equation (below). CHAPTER 7. RESULTS AND DISCUSSION 170

100

Closed System 10

1. Constant Pressure System

0.1 : Pressure : Derivative : Homogeneous Dimensionless Pressure / Derivative 0.01 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.54: Type curve for a single well in a square flow domain with the concave variation in porosity and the permeability variation given by the Kozeny-Carman equation. CHAPTER 7. RESULTS AND DISCUSSION 171

little effect on pressure responses if the average property value within a drainage area is not much different from the near-well property value, is again confirmed. In the next two examples, the spatial variation in porosity is chosen so that its average value varies as a drainage area changes:

2 φ(xD)=a(xD − 0.5) + b (7.69)

Figure 7.53 shows the porosity and permeability variations in a square flow domain with a =0.8 and b =0.1. Figure 7.54 illustrates the heterogeneity effects on pres- sure responses. For increasing average values of porosity and permeability within a drainage area, the dimensionless pressure is lower than expected in homogeneous media at late times. This is true for both boundary conditions. The corresponding pressure derivatives are characterized by the earlier decline in a constant-pressure system and by the downward hump in a closed system. Figure 7.55 shows the porosity and permeability variations in a square flow domain with a = −0.8 and b =0.3. In this case, average values of porosity and permeability within a drainage area increase with time. In comparison with a set of type curves above, opposite effects on pressure responses are observed as shown in Fig. 7.56. Effects of the porosity variation and of the permeability variation can be investi- gated separately with the following subset heterogeneities:

• constant k and φ = φ(xD)

• k = k(xD) and constant φ

For the first example above (the concave variation), its subset heterogeneities are examined. When the average value of only porosity increases with time (Fig. 7.57), the pressure response with the constant-pressure boundary condition shows little de- viation from that in homogeneous media. In particular, when steady state is reached, there is no difference, since porosity variations have no effect under steady-state con- ditions. In contrast, the pressure response with the closed boundary condition is again lowered due to the variability in porosity. The magnitude of the deviation, however, is smaller than that in the aggregate case, and the downward hump characterizing the pressure-derivative profile is no more seen. It is deduced that the missing characters CHAPTER 7. RESULTS AND DISCUSSION 172

Porosity

0.3

0.2

0.1

0

Permeability

1

0.75

0.5

0.25

0

Figure 7.55: The convex variation in porosity (above) and the permeability variation given by the Kozeny-Carman equation (below). CHAPTER 7. RESULTS AND DISCUSSION 173

100

Closed System 10

1. Constant Pressure System

0.1 : Pressure : Derivative : Homogeneous Dimensionless Pressure / Derivative 0.01 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.56: Type curve for a single well in a square flow domain with the convex variation in porosity and the permeability variation given by the Kozeny-Carman equation. CHAPTER 7. RESULTS AND DISCUSSION 174

from the aggregate case are due to the variability in permeability, and Fig. 7.58 lets us confirm this fact. These two sets of type curves for the subset heterogeneities illus- trate that the variability in permeability is detectable with either boundary condition, while the variability in porosity is hardly detectable in a constant-pressure system. CHAPTER 7. RESULTS AND DISCUSSION 175

100

Closed System 10

1. Constant Pressure System

0.1 : Pressure : Derivative : Homogeneous Dimensionless Pressure / Derivative 0.01 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.57: Type curve for a single well in a square flow domain with the concave variation in porosity. CHAPTER 7. RESULTS AND DISCUSSION 176

100

Closed System 10

1. Constant Pressure System

0.1 : Pressure : Derivative : Homogeneous Dimensionless Pressure / Derivative 0.01 0.0001 0.001 0.01 0.1 1. 10 Dimensionless Time Figure 7.58: Type curve for a single well in a square flow domain with the perme- ability variation given by the Kozeny-Carman equation (for the concave variation in porosity). Chapter 8

Conclusions and Recommendations

The main objective of this study is to broaden the versatility of the boundary ele- ment method (BEM) to flow problems in continuously heterogeneous media. When applying the conventional BEM to such problems, there arises difficulty in finding the corresponding free-space Green’s functions. Although it is possible to find specialized Green’s functions in limited cases, for general problems with complex heterogeneities, it may be assumed that no exact free-space Green’s function is available. The decomposition of the governing equation into a series of perturbation equa- tions shows us a way out. The perturbation parameter is identified such that the flow equations governing steady-state and transient flow problems can be converted into perturbation equations associated with the Laplace operator and with the modified Helmholtz operator in Laplace space, respectively. These decomposed equations are solved by the BEM, and the solution to the original problem is recovered by summing the perturbation solutions. The convergence of a perturbation series is determined by the singular point in- herent in the governing equation, and is aggravated with the increasing magnitude of heterogeneity. In order to improve the convergence, Pad´e approximants are employed and implemented in the numerical models. This study owes a great deal to two branches of applied mathematics: perturbation methods in paving the way and Pad´e approximants in polishing the tool. The following list summarizes the principal contributions made and the findings

177 CHAPTER 8. CONCLUSIONS AND RECOMMENDATIONS 178

obtained in the course of this study:

1. Perturbation forms for steady-state and transient flow equations including well singularities are derived. The solution is assumed to be a perturbation series with descending magnitude. These perturbation forms should be of value in formulating any semi-analytical scheme.

2. Based on the perturbation equations, two kinds of numerical models are de- veloped: one for steady-state flow problems, associated with the Laplace op- erator and the other for transient flow problems, associated with the modified Helmholtz operator in Laplace space. These models are verified against the analytical solutions for simplified heterogeneous problems and utilized to solve application problems.

3. As the magnitude of spatial variabilities increases, the rate of convergence of a perturbation series becomes very slow, and, eventually, the series diverges for large values of K and Φ. This is because the distance to the nearest singularity shrinks with the increasing magnitude of heterogeneity. The critical distance is equal to the value of the perturbation parameter  (= 1).

4. Pad´e approximants are utilized in the perturbation boundary element models. When the naive summation of perturbation solutions converges slowly, or even if it diverges, the convergence can be improved by the Pad´e approximant. The assumption of the descending magnitude in a perturbation series is thus relaxed (but not removed), and the durability of the model to rapid spatial variabilities is established.

5. The evaluation of boundary integrals can be performed analytically in the steady-state flow model, while that in the transient flow model requires a nu- merical technique. Through the verification problems considered in this study, the six-point Gaussian quadrature is found to yield an accurate evaluation.

6. In both models, domain integrals are evaluated numerically. The four-point Gaussian quadrature is found to provide an accurate evaluation. If there is no CHAPTER 8. CONCLUSIONS AND RECOMMENDATIONS 179

well singularity, the linear pressure profile can be assumed over each of the trian- gular subdomains. When dealing with well singularities, however, the singular part should be treated separately by the use of singularity programming.

7. Streamlines and displacing-fluid fronts are accurately and efficiently tracked by the steady-state flow model. With properly selected parameters, the modified Euler method shows its ability to track rapidly curving streamlines. Break- through curves are also satisfactorily simulated by the model. Although the domain subdivision is required to capture heterogeneity, flow is not restricted by the grid system.

8. The transient flow model shows its utility in well testing problems. The ana- lytical nature of the solution is well preserved through the free-space Green’s function methodologically and through the singularity programming technically. The inclusion of pressure derivatives and effects of skin and wellbore storage is done analytically. Type curves for idealized heterogeneities are presented. It is observed that if the average property value within a drainage area is not much different from the near-well property value, heterogeneity has little effect on pressure responses. The present study relaxed the requirements of free-space Green’s functions at the price of the domain subdivision, which induced an additional computational work of domain integrals. Among the two major features of the BEM, the computational efficiency is thus limited. However, the sound mathematical foundations ensure the high degree of computational accuracy. At various stages of this study, it has been recognized that the boundary element method is still a developing but promising technique. Its versatility can be broadened to a variety of flow problems. Further study addressing the following aspects is recommended: 1. Permeability and porosity variabilities were considered in the present study. The remaining formation property, the formation thickness, may be perturbed in a similar way by assuming its spatial variation is moderate so that the two- dimensional flow equation is approximately valid. CHAPTER 8. CONCLUSIONS AND RECOMMENDATIONS 180

2. Heterogeneities considered in this study were assumed deterministic. When using numerical flow simulators in connection with geostatistics, the capability of honoring the uncertainties involved in input data is desirable. This may be established in perturbation boundary element models by casting stochastic partial differential equations into an equivalent series of perturbation boundary integral equations.

3. In solid mechanics, the indirect method (known as the displacement discontinu- ity method) plays an important role in solving fracture problems. Although the direct method has been exclusively applied to fluid flow problems, the indirect formulation may be worth investigating. Nomenclature

A Area of the problem region A Solution matrix B Right-hand side vector c Fluid compressibility

cf Formation compressibility ct Total isothermal compressibility C(t) Effluent concentration at time t

CD Dimensionless wellbore storage coefficient

CDp Dimensionless wellbore storage coefficient, Chapter 5

FN Continued fraction G Free-space Green’s function for the Laplace operator G¯ Free-space Green’s function for the modified Helmholtz operator h Formation thickness H Dirichlet boundary value H(x − x˜) Heaviside step function

H0α{f} Hankel transformation of f i Imaginary number

In Modified Bessel function of the first kind and of order n

Jn Bessel function of the first kind and of order n k Permeability k0 Reference permeability K Dimensionless permeability, Chapter 3

Kn Modified Bessel function of the second kind and of order n

181 NOMENCLATURE 182

L Index of pressure specified well

L1,L2,L3 Triangular coordinates L{f} Laplace transformation of f [L/M] Pad´e approximant n Outward normal

nb Number of boundary elements ni Number of inner boundaries nM Maximum order of perturbation ns Number of sinks nst Number of Stehfest sampling times nt Number of triangular elements N Order of convergent perturbation series p0 Reference pressure, Chapter 3 pi Initial pressure, Chapter 3 pD Dimensionless pressure, Chapter 3 pDq Dimensionless pressure, Chapter 5

PL Numerator of Pad´e approximant [L/M]

ΔpD Dimensionless pressure tolerance in perturbation q Flow rate ql Flow rate per unit thickness at well l qD Dimensionless flow rate, Chapter 3 Q Neumann boundary value

QM Denominator of Pad´e approximant [L/M] rD Dimensionless Euclidean distance R Radius of convergence s Parameter of Laplace transformation S Skin factor

Sp Skin factor, Chapter 5

ΔsD Dimensionless advance length t Time tDA Dimensionless time based on drainage area, Chapter 3 NOMENCLATURE 183

u, una, unl Vectors of boundary values U Vectors of boundary unknowns vx Velocity in the x-direction vy Velocity in the y-direction

V1ij,V2ij Influence coefficients between points i and j

V1, V2 Matrices of influence coefficients wκ(x − x˜) δ sequence

W1ij,W2ij Influence coefficients between points i and j W Matrix of influence coefficients xD Dimensionless distance, Chapter 3 yD Dimensionless distance, Chapter 3

GREEKS γ Euler’s constant, Appendix C Γ Boundary of the problem region

Γ1 Dirichlet boundary

Γ2 Neumann boundary Γ(n) Gamma function, Appendix C

ΔΓi Boundary element δ(x − x˜) Dirac delta function

δij Kronecker delta  Perturbation parameter η Transformed local coordinate

θi Internal angle between boundary elements ΔΓi−1 and ΔΓi Δθ Directional change allowance in streamline tracking μ Fluid viscosity ξ Transformed local coordinate ρ Fluid density φ Porosity

φ0 Reference porosity Φ Dimensionless porosity, Chapter 3 NOMENCLATURE 184

ψ Transformed pressure, Appendix D Ω Domain of the problem region

SUBSCRIPTS 0 Reference D Dimensionless i, j, l, m Integer indices ns Non-singular s Singular w Wellbore value

SUPERSCRIPTS (n) Order of perturbation ¯ Laplace transformed variable ˜ Source point Bibliography

Abbaszadeh-Dehghani, M.: Analysis of Unit Mobility Ratio Well-To-Well Tracer Flow to Determine Reservoir Heterogeneity, Ph.D. Dissertation, Stanford U. (1982).

Abou-Kassem, J.H. and Aziz, K.: “Analytical Well Models for Reservoir Simula- tion,” Soc. Pet. Eng. J. (Aug. 1985) 573-79.

Abramowitz, M. and Stegun, I.A.: Handbook of Mathematical Functions with Formu- las, Graphs, and Mathematical Tables, National Bureau of Standards, Applied Mathematics Series-55 (1970).

Aral, M.M. and Tang, Y.: “A New Boundary Element Formulation for Time-De- pendent Confined and Unconfined Aquifer Problems,” Water Resources Re- search (1988) 24(6) 831-42.

Aziz, A. and Na, T.Y.: Perturbation Methods in Heat Transfer, Hemisphere, Wash- ington (1984).

Aziz, K. and Settari, A.: Simulation, Applied Science Publish- ers, London (1979).

Babu, D.K. and Odeh, A.S.: “Productivity of a Horizontal Well,” SPE Res. Eng. (Nov. 1989) 417-21.

Baker, G.A., Jr.: Essentials of Pad´e Approximants, Academic Press, New York (1975).

185 BIBLIOGRAPHY 186

Baker, G.A., Jr.: Quantitative Theory of Critical Phenomena, Academic Press, San Diego (1990).

Baker, G.A., Jr. and Graves-Morris, P.R.: Pad´e Approximants, Part I: Basic The- ory, Cambridge Univ. Press, London (1981).

Bear, J.: Dynamics of Fluids in Porous Media, American Elsevier, New York (1972).

Bender, C.M. and Orszag, S.A.: Advanced Mathematical Methods for Scientists and Engineers, McGraw-Hill, New York (1982).

Borisenko, A.I. and Tarapov, I.E.: Vector and Tensor Analysis with Applications, Dover, New York (1968).

Bourdet, D., Whittle, T.M., Douglas, A.A., and Pirard, Y-M.: “A New Set of Type Curves Simplifies Well Test Analysis,” World Oil (May 1983) 95-106.

Brand, C.W., Heinemann, Z.E., and Aziz, K.: “The Grid Orientation Effect in Reservoir Simulation,” paper SPE 21228, presented at the 11th SPE Symposium on Reservoir Simulation, held in Anaheim, CA, Feb. 17-20, 1991.

Brebbia, C.A., Telles, J.C.F., and Wrobel, L.C.: Boundary Element Techniques – Theory and Applications in Engineering, Springer-Verlag, Berlin (1984).

Butler, J.J.: “A Stochastic Analysis of Pumping Tests in Laterally Nonuniform Me- dia,” Water Resources Research (1981) 27(9) 2401-14.

Carman, P.C.: “Fluid Flow through a Granular Bed,” Trans. Inst. Chem. Eng. (1937) 15 150-56.

Carnahan, B., Luther, H.A., and Wilkes, J.O.: Applied Numerical Methods, John Wiley & Sons, New York (1969).

Carslaw, H.S. and Jaeger, J.C.: Conduction of Heat in , 2nd edition, Clarendon Press, Oxford (1959). BIBLIOGRAPHY 187

Cheng, A.H-D.: “Darcy’s Flow with Variable Permeability - A Boundary Integral Solution,” Water Resources Research (1984) 20(7) 980-84.

Cheng, A.H-D. and Lafe, O.E.: “Boundary Element Solution for Stochastic Ground- water Flow: Random Boundary Condition and Recharge,” Water Resources Research (1991) 27(2) 231-42.

Churchill, R.V.: Operational Mathematics, McGraw-Hill, New York (1972).

Churchill, R.V. and Brown, J.W.: Complex Variables and Applications, 5th edition, McGraw-Hill, New York (1990).

Cinco-Ley, H. and Meng, H.Z.: “Pressure Transient Analysis of Wells with Finite Conductivity Vertical Fractures in Double Porosity Reservoirs,” paper SPE 18172, presented at the 63rd Annual Technical Conference and Exhibition of the Society of Petroleum Engineers of AIME, held in Houston, TX, Oct. 2-5, 1988.

Cinco-Ley, H., Samaniego-V,F., and Dominguez, A.N.: “Transient Pressure Behav- ior for a Well with a Finite-Conductivity Vertical Fracture,” Soc. Pet. Eng. J. (Aug. 1978) 253-64.

Clements, D.L.: “A Boundary Integral Equation Method for the Numerical Solu- tion of a Second-Order Elliptic Equation with Variable Coefficients,” J. Austrl. Math. Soc. (1980) 22B 218-28.

Cowper, G.R.: “Gaussian Quadrature Formulas for Triangles,” Int. J. for Num. Methods in Eng. (1973) 7 405-08.

Craig, F.C., Jr.: The Reservoir Engineering Aspects of Waterflooding, Monograph Series, Society of Petroleum Engineers of AIME, Dallas (1971).

Crouch, S.L. and Starfield, A.M.: Boundary Element Methods in Solid Mechanics, Unwin Hyman, London (1983). BIBLIOGRAPHY 188

Cruse, T.A. and Rizzo, F.J.: “A Direct Formulation and Numerical Solution of the General Transient Elasto-Dynamic Problem, I” J. Math. Anal. Appl. (1968) 22 244-59.

Davis, P.J. and Rabinowitz, P.: Methods of Numerical Integration, 2nd edition, Aca- demic Press, San Diego (1984).

Domb, C. and Sykes, M.F.: “On the Susceptibility of a Ferromagnetic above the Curie Point,” Proc. Roy. Soc. Ser. A (1957) 240 214-28.

Dwight, H.B.: Tables of Integrals and Other Mathematical Data, 4th edition, MacMil- lan Publishing, New York (1961).

Earlougher, R.C., Jr.: Advances in Well Test Analysis, Monograph Series, Society of Petroleum Engineers of AIME, Dallas (1977).

Erd´elyi, A: Asymptotic Expansions, Dover, New York (1956).

Forsythe, G.E., Malcolm, M.A., and Moler, C.B.: Computer Methods for Mathemat- ical Computations, Prentice Hall, Englewood Cliffs, NJ (1977).

Georghitza, S.I.: “On the Plane Steady Flow of Water through Inhomogeneous Porous Media,” paper presented at the Symposium on the Fundamentals of Transport Phenomena in Porous Media, held in Haifa, Israel, 1969.

Greenberg, M.D.: Application of Green’s Functions in Science and Engineering, Prentice Hall, Englewood Cliffs, NJ (1971).

Gringarten, A.C. and Ramey, H.J., Jr.: “The Use of Source and Green’s Functions in Solving Unsteady-Flow Problems in Reservoirs,” Soc. Pet. Eng. J. (Oct. 1973) 285-96.

Gringarten, A.C., Ramey, H.J., Jr., and Raghavan, R.: “Unsteady State Pressure Distributions Created by a Well with a Single Infinite-Conductivity Vertical Fracture,” Soc. Pet. Eng. J. (Aug. 1974) 347-60. BIBLIOGRAPHY 189

Hantush, M.S.: “Flow of Ground Water in Sands of Nonuniform Thickness,” J. Geo- phys. Research (1962) 67(4) 1527-34.

Harrington, R.F., Pontoppidan, K., Abrahamsen, P., and Albertsen, N.C.: “Compu- tation of Laplacian potentials by an Equivalent-Source Method,” Proc. IEE (1969) 116 1715-20.

Heinemann, Z.E., Brand, C.W., Munka, M., and Chen, Y.M.: “Modeling Reservoir Geometry with Irregular Grids,” SPE Res. Eng. (May 1991) 225-32.

Hess, J.L. and Smith, A.M.O.: “Calculation of Potential Flow about Arbitrary Bod- ies,” Progress in Aeronautical Sciences 8, Pergamon Press, London (1967).

Hildebrand, F.B.: Advanced Calculus for Applications, 2nd edition, Prentice Hall, Englewood Cliffs, NJ (1976).

Hirasaki, G.J. and O’Dell, P.M.: “Representation of Reservoir Geometry for Numer- ical Simulation,” Soc. Pet. Eng. J. (Dec. 1970) 393-404.

Horne, R.N.: Modern Well Test Analysis, Petroway, Palo Alto (1990).

Hromadka, T.V., II and Lai, C.: The Complex Variable Boundary Element Method in Engineering Analysis, Springer-Verlag, Berlin (1987).

Hunt, B. and Isaacs, L.T.: “Integral Equation Formulation for Ground-Water Flow,” J. Hyd. Div., ASCE (1981) 107(HY10) 1197-1209.

Isaaks, E.H. and Srivastava, R.M.: An Introduction to Applied Geostatistics, Oxford Univ. Press, New York (1989).

Jaswon, M.A.: “Integral Equation Methods in Potential Theory, I” Proc. Roy. Soc. Ser. A (1963) 275 23-32.

Jaswon, M.A. and Ponter, A.R.: “An Integral Equation Solution of the Torsion Prob- lem,” Proc. Roy. Soc. Ser. A (1963) 273 237-46. BIBLIOGRAPHY 190

Journel, A.G. and Huijbregts, C.J.: Mining Geostatistics, Academic Press, London (1978).

Kellogg, O.D.: Foundations of Potential Theory, Dover, New York (1953). Originally published by Springer-Verlag, Berlin in 1929.

Kevorkian, J. and Cole, J.D.: Perturbation Methods in Applied Mathematics, Ap- plied Mathematical Sciences 34, Springer-Verlag, Berlin (1981).

Kikani, J.: Application of Boundary Element Method to Streamline Generation and Pressure Transient Testing, Ph.D. Dissertation, Stanford U. (1989).

Kikani, J. and Horne, R.N.: “Pressure Transient Analysis of Arbitrary Shaped Reser- voirs with the Boundary Element Method,” paper SPE 18159, presented at the 63rd Annual Technical Conference and Exhibition of the Society of Petroleum Engineers of AIME, held in Houston, TX, Oct. 2-5, 1988.

Kikani, J. and Horne, R.N.: “Modeling Pressure Transient Behavior of Sectionally Heterogeneous Reservoirs by the Boundary Element Method,” paper SPE 19778, presented at the 64th Annual Technical Conference and Exhibition of the Society of Petroleum Engineers of AIME, held in San Antonio, TX, Oct. 8-11, 1989.

Kuniansky, J. and Hillestad, J.G.: “Reservoir Simulation Using Bottomhole Pressure Boundary Conditions,” Soc. Pet. Eng. J. (Dec. 1980) 473-86.

Lafe, O.E. and Cheng, A.H-D.: “A Perturbation Boundary Element Code for Steady State Groundwater Flow in Heterogeneous Aquifers,” Water Resources Research (1987) 23(6) 1079-84.

Lafe, O.E., Liggett, J.A., and Liu, P.L-F.: “BIEM Solutions to Combinations of Leaky, Layered, Confined, Unconfined, Nonisotropic Aquifers,” Water Re- sources Research (1981) 17(5) 1431-44. BIBLIOGRAPHY 191

Lafe, O.E., Montes, J.S., Cheng, A.H-D., Liggett, J.A., and Liu, P.L-F.: “Singularities in Darcy Flow through Porous Media,” J. Hyd. Div., ASCE (1980) 106(HY6) 977-97.

Lagerstrom, P.A.: Matched Asymptotic Expansions - Ideas and Techniques, Applied Mathematical Sciences 76, Springer-Verlag, Berlin (1988).

Lake, L.W. and Carroll, H.B., Jr.: Reservoir Characterization, Academic Press, Or- lando (1986).

Lennon, G.P.: “Boundary Element Analysis of Flow in Heterogeneous Porous Me- dia,” paper presented at the ASCE/HYD Specialty Conference, held in Coeurd’Alene, ID, 1984.

Lennon, G.P., Liu, P.L-F., and Liggett, J.A.: “Boundary Integral Equation Solution to Axisymmetric Potential Flows,” Water Resources Research (1979) 15(5) 1102-15.

Lennon, G.P., Liu, P.L-F., and Liggett, J.A.: “A Boundary Integration Method Ap- plied to Three-Dimensional Darcy Flow,” Proc. of the Second Int. Symp. on Innovative Numerical Analysis in Applied Eng. Sciences, The University Press of Virginia (1980) 47-56.

Liggett, J.A.: “Location of Free Surface in Porous Media,” J. Hyd. Div., ASCE (1977) 103(HY4) 353-65.

Liggett, J.A. and Liu, P.L-F.: “Unsteady Free Surface Flow through a Zoned Dam using Boundary Integration,” paper presented at the Symposium on Applica- tions of Computer Methods, held in Los Angeles, CA, Aug. 23-26, 1977.

Liggett, J.A. and Liu, P.L-F.: “Unsteady Flow in Confined Aquifers - A Comparison of Two Boundary Integral Methods,” Water Resources Research (1979) 15(4) 861-66.

Liggett, J.A. and Liu, P.L-F.: The Boundary Integral Equation Method for Porous Media Flow, George Allen & Unwin, London (1983). BIBLIOGRAPHY 192

Liu, P.L-F., Cheng, A.H-D., Liggett, J.A., and Lee, J.H.: “Boundary Integral Equa- tion Solutions to Moving Interface between Two Fluids in Porous Media,” Water Resources Research (1981) 17(5) 1445-52.

Liu, P.L-F. and Liggett, J.A.: “Boundary Integral Solutions to Groundwater Prob- lems,” paper presented at the First International Conference on Applied Nu- merical Modeling, held in Southampton, England, July 11-15, 1977.

Liu, P.L-F. and Liggett, J.A.: “An Efficient Numerical Method of Two-Dimensional Steady Groundwater Problems,” Water Resources Research (1978) 14(3) 385- 90.

Liu, P.L-F. and Liggett, J.A.: “Boundary Solutions to Two Problems in Porous Me- dia,” J. Hyd. Div., ASCE (1979) 105(HY3) 171-83.

Masukawa, J. and Horne, R.N.: “Application of the Boundary Integral Method to Immiscible Displacement Problems,” SPE Res. Eng. (Aug. 1988) 1069-77.

Matthews, C.S. and Russell, D.G.: Pressure Buildup and Flow Tests in Wells, Mono- graph Series, Society of Petroleum Engineers of AIME, Dallas (1967).

Mishra, S., Brigham, W.E., and Orr, F.M., Jr.: “Tracer- and Pressure-Test Analysis for Characterization of Areally Heterogeneous Reservoirs,” SPE Form. Eval. (March 1991) 45-54.

Muskat, M.: Physical Principles of Oil Production, McGraw-Hill, New York (1950).

Nayfeh, A.H.: Perturbation Methods, John Wiley & Sons, New York (1973).

Numbere, D.T. and Tiab, D.: “An Improved Streamline-Generating Technique that Uses the Boundary (Integral) Element Method,” SPE Res. Eng. (Aug. 1988) 1061-68.

O’Malley, R.E., Jr.: Introduction to Singular Perturbations, Academic Press, New York (1974). BIBLIOGRAPHY 193

Palagi, C.L. and Aziz, K.: “The Modeling of Vertical and Horizontal Wells with Voronoi Grid,” paper SPE 24072, presented at the Western Regional Meeting, held in Bakersfield, CA, March 30-April 1, 1992.

Peaceman, D.W.: “Interpretation of Well-Block Pressures in Numerical Reservoir Simulation,” Soc. Pet. Eng. J. (June 1978) 183-94.

Peaceman, D.W.: “Interpretation of Well-Block Pressures in Numerical Reservoir Simulation with Non-Square Grid Blocks and Anisotropic Permeability,” Soc. Pet. Eng. J. (June 1983) 531-43.

Peaceman, D.W.: “Interpretation of Well-Block Pressures in Numerical Reservoir Simulation - Part 3: Some Additional Well Geometries,” paper SPE 16976, presented at the 62nd Annual Technical Conference and Exhibition of the So- ciety of Petroleum Engineers of AIME, held in Dallas, TX, Sept. 27-30, 1987.

Press, W.H., Flannery, B.P., Teukolsky,S.A., and Vetterling, W.T.: Numerical Recipes The Art of Scientific Computing (FORTRAN Version), Cambridge University Press, Cambridge (1986).

Pruess, K. and Bodvarsson, G.S.: “A Seven-Point Finite-Difference Method for Im- proved Grid Orientation Performance in Pattern Steam-floods,” paper SPE 12252, presented at the Seventh SPE Symposium on Reservoir Simulation, held in San Francisco, CA, Nov. 15-18, 1983.

Rizzo, F.J.: “An Integral Equation Approach to Boundary Value Problems of Clas- sical Elastostatics,” Q. J. Appl. Math. (1967) 25 83-95.

Rosa, A.J. and Horne, R.N.: “Reservoir Description by Well Test Analysis Using Cyclic Flow Rate Variation,” paper SPE 22698, presented at the 66th Annual Technical Conference and Exhibition of the Society of Petroleum Engineers of AIME, held in Dallas, TX, Oct. 6-9, 1991.

Rubin, B. and Blunt, M.J.: “Higher-Order Implicit Flux Limiting Schemes for Black Oil Simulation,” paper SPE 21222, presented at the 11th SPE Symposium on Reservoir Simulation, held in Anaheim, CA, Feb. 17-20, 1991. BIBLIOGRAPHY 194

Selley, R.C.: Elements of Petroleum Geology, W.H. Freeman and Co., New York (1985).

Smith, P.J. and Brown, C.E.: “Interpretation of Tracer Test Response from Hetero- geneous Reservoirs,” paper SPE 13262, presented at the 59th Annual Technical Conference and Exhibition of the Society of Petroleum Engineers of AIME, held in Houston, TX, Sept. 16-19, 1984.

Stakgold, I.: Green’s Functions and Boundary Value Problems, John Wiley & Sons, New York (1979).

Stehfest, H.: “Algorithm 368 - Numerical Inversion of Laplace Transforms [D5],” Comm. of ACM (1970) 13(1) 47-49. Errata, Comm. of ACM (1970) 13(10) 624.

Strack, O.D.L.: Groundwater Mechanics, Prentice Hall, Englewood Cliffs, NJ (1989).

Streltsova, T.D.: Well Testing in Heterogeneous Formations, John Wiley & Sons, New York (1988).

Sweby, P.K.: “High Resolution Schemes using Flux Limiters for Hyperbolic Conser- vation Laws,” SIAM J. Numer. Anal. (1984) 21 995-1011.

Symm, G.T.: “Integral Equation Methods in Potential Theory, II” Proc. Roy. Soc. Ser. A (1963) 275 33-46.

Taigbenu, A.E. and Liggett, J.A.: “An Integral Formulation Applied to the Diffusion and Boussinesq Equations,” Int. J. for Num. Methods in Eng. (1986) 23 1057- 79.

Todd, M.R., O’Dell, P.M., and Hirasaki, G.J.: “Methods for Increased Accuracy in Numerical Reservoir Simulators,” Soc. Pet. Eng. J. (Dec. 1972) 515-30. van Dyke, M.: “Analysis and Improvement of Perturbation Series,” Q. J. Mech. Appl. Math. (1974) 27 423-50. BIBLIOGRAPHY 195

van Dyke, M.: Perturbation Methods in Fluid Mechanics, Annotated ed., Parabolic Press, Stanford, CA (1975a). van Dyke, M.: “Computer Extension of Perturbation Series in Fluid Mechanics,” SIAM J. Appl. Math. (1975b) 28 720-34. van Dyke, M.: “Extension, Analysis, and Improvement of Perturbation Series,” Naval Hydrodynamics Symposium (1976) 449-57. van Everdingen, A.F. and Hurst, W.: “The Application of the Laplace Transforma- tion to Flow Problems in Reservoirs,” Trans., AIME (1949) 186 305-24. van Kruysdijk, C.P.J.W.: “Semianalytical Modeling of Pressure Transients in Frac- tured Reservoirs,” paper SPE 18169, presented at the 63rd Annual Technical Conference and Exhibition of the Society of Petroleum Engineers of AIME, held in Houston, TX, Oct. 2-5, 1988.

Vinsome, P.K. and Au, A.D.K.: “One Approach to the Grid Orientation Problem in Reservoir Simulation,” Soc. Pet. Eng. J. (April 1981) 160-161.

Wood, W.L.: Practical Time-Stepping Schemes, Oxford Applied Mathematics and Computing Science Series, Clarendon Press, Oxford (1990).

Yanosik, J.L. and McCracken, T.A.: “A Nine-Point Finite-Difference Reservoir Sim- ulator for Realistic Prediction of Adverse Mobility Ratio Displacements,” Soc. Pet. Eng. J. (Aug. 1979) 253-62.

Zalesak, S.: “Fully Multidimensional Flux Corrected Transport Algorithms for Flu- ids,” JCP (1979) 31 p355.

Zienkiewicz, O.C. and Taylor, R.L.: The Finite Element Method – Volume 1, Basic Formulation and Linear Problems, 4th edition, McGraw-Hill, London (1989). Appendix A

Dirac Delta Function

Although it is referred to as a function, technically speaking, the Dirac delta function is a distribution. Physical analogies to this function (distribution) can be found in many engineering disciplines. A typical instance is the stress field induced in an infinite plane by a unit force applied at an infinitely small point (Greenberg, 1971). Such localized sources found in other engineering disciplines are the heat sources and dipoles in heat conduction; the point masses in the theory of gravitational potential; the impulsive forces in and in impact mechanics; and the point charges, dipoles, multipoles, line charges, and surface layers in electrostatics (Stakgold, 1979). The only difference between the physical analogy above and the Dirac delta function is the fact that the stress distribution is the solution for the boundary-value problem and is not known a prioi, while the delta function can be assumed in not only one but several ways as long as the following two conditions are satisfied:

δ(x − x˜)=0,x=˜ x (A.1)

∞ δ(x − x˜) dx = 1 (A.2) −∞ From these properties, the crucial result in defining Green’s functions (shifting prop- erty) is obtained: ∞ δ(x − x˜)f(x) dx = f(˜x) (A.3) −∞ where f(x) must be continuous atx ˜.

196 APPENDIX A. DIRAC DELTA FUNCTION 197

wκ 6

κ increasing 9 - x x˜

Figure A.1: δ sequence defined by Eq. A.6.

The delta function may be expressed as the limit of a sequence of functions:

δ(x − x˜) = lim wκ(x − x˜) (A.4) κ→∞ where wκ(x − x˜) is called the δ sequence. The simplest example of the δ sequence in one dimension is ⎧ ⎪ 1 ⎨ 0if|x − x˜| > − ≡ wκ(x x˜) ⎪ 2κ (A.5) ⎩ κ otherwise The way of defining the δ sequence is not unique. For instance, the bell-shaped distribution can be defined as κ 2 w (x − x˜) ≡ e−κ(x−x˜) (A.6) κ π and Figure A.1 schematically shows how it behaves with increasing κ. It is seen that the δ sequence is quite concentrated for large values of the index κ.

Although wκ is a well-defined function, its limit as κ →∞, that is, the Dirac delta function, defines no mathematical function in a classical sense. This is why the Dirac delta function should be treated as a distribution rather than a function. APPENDIX A. DIRAC DELTA FUNCTION 198

Nevertheless, when we consider the functional:

∞ F(f)= g(x − x˜)f(x) dx (A.7) −∞ and claim that F(f)=f(˜x) (A.8) there is no ordinary function g which satisfies Eq. A.8 for any function f, and the delta function needs to be introduced to utilize its useful property, Eq. A.3. The functional F gives another definition of the Dirac delta function. If we claim, instead of Eq. A.8, that ∞ F(f)= f(x) dx (A.9) x˜ it is clear that the kernel g must be the Heaviside step function: ⎧ ⎨ 1ifx>x˜ H(x − x˜)= (A.10) ⎩ 0 otherwise

− d − Since H(x x˜) is not continuous at x =˜x, dx H(x x˜) does not exist in a classical d − sense. However, it is possible to define dx H(x x˜) as a generalized function: ∞ d ∞ d H(x − x˜)f(x) dx = − H(x − x˜) f(x) dx −∞ dx −∞ dx ∞ d = − f(x) dx = f(˜x) (A.11) x˜ dx which leads to d δ(x − x˜)= H(x − x˜) (A.12) dx

The n-dimensional Dirac delta function δn in Rn can be defined in a similar way:

δn(x − x˜)=0, x = x˜ (A.13)

δn(x − x˜) dx = 1 (A.14) Rn

The shifting property also holds in Rn:

δn(x − x˜)f(x) dx = f(x˜) (A.15) Rn APPENDIX A. DIRAC DELTA FUNCTION 199

In Chapter 3, the Dirac delta function was used to define two-dimensional Green’s functions. The two-dimensional Dirac delta function is related to the one-dimensional delta functions (Greenberg, 1971) as

δ(x − x,˜ y − y˜)=δ(x − x˜)δ(y − y˜) (A.16)

and the two-dimensional δ sequence is defined as

δ(x − x,˜ y − y˜) = lim wκ(x − x,˜ y − y˜) (A.17) κ→∞

Referring to these two equations and employing the bell-shaped δ sequence given by Eq. A.6 yields the two-dimensional δ sequence:

2 κe−κr w (x − x,˜ y − y˜) ≡ (A.18) κ π where r2 =(x − x˜)2 +(y − y˜)2. Appendix B

Selected Theorems on Pad´e Approximants

This appendix presents some selected theorems on Pad´e approximants considered to be important to this study. The uniqueness theorem and the invariance theorems, which are related to algebraic properties of Pad´e approximants, are proven (Baker, 1975: Baker, 1990) and discussed.

B.1 Uniqueness Theorem

When converting a power series into some approximate representation, its uniqueness is essential, otherwise multiple approximate solutions are produced. For the Pad´e approximant, the following theorem confirms its uniqueness.

Uniqueness Theorem : When it exists, the Pad´e approximant [L/M] to any formal power series is unique.

Proof : Suppose that there exist two approximants, XL/YM and UL/VM satis- fying the required Pad´e equations: X L − f()=O(L+M+1) (B.1) YM U L − f()=O(L+M+1) (B.2) VM

200 APPENDIX B. SELECTED THEOREMS ON PADE´ APPROXIMANTS 201

which lead to X U L − L = O(L+M+1) (B.3) YM VM

Multiplying Eq. B.3 by YM VM gives

L+M+1 XLVM − ULYM = O( ) (B.4) but the left-hand side is a polynomial of degree at most L + M, and, thus

XLVM − ULYM = 0 (B.5) or, equivalently X U L = L (B.6) YM VM which proves the uniqueness. 2

B.2 Invariance Theorems

The properties of analytic continuation (Churchill and Brown, 1990) possessed by the diagonal entries in the Pad´e table are closely related to the following three invariance theorems.

Duality Theorem : If PL()/QM () is the Pad´e approximant [L/M] to f(),

then QM ()/PL() is the Pad´e approximant [M/L] to 1/f(), provided f(0) =0 . Proof : 1 P () − Q ()f() − [M/L]= L M (B.7) f() PL()f() From the Pad´e equation, the numerator gives

L+M+1 PL() − QM ()f()=O( ) (B.8) and, thus 1 − [L/M]=O(L+M+1) (B.9) f() The duality theorem now follows by the uniqueness theorem. 2 APPENDIX B. SELECTED THEOREMS ON PADE´ APPROXIMANTS 202

Argument Invariance Theorem : If PM ()/QM () is the Pad´e approximant

[M/M] to f(), then PM (z)/QM (z) is the Pad´e approximant [M/M] to f(z), where a z = (B.10) 1+b Proof M i : Multiplying the numerator PM (z)= i=0 piz and the denominator M i M QM (z)= i=0 qiz by (1 + b) gives M (1 + b) PM (z) [M/M]= M (1 + b) QM (z) M M−i i pi(1 + b) (a) = i=0 (B.11) M M−i i qi(1 + b) (a) i=0 which is of the form of [M/M]tof(), and since

O([a/(1 + b)]2M+1)=O(2M+1) (B.12) it also satisfies the Pad´e equations. Therefore the argument invariance theorem follows by the uniqueness theorem. 2

Value Invariance Theorem : If PM ()/QM () is the Pad´e approximant [M/M] to f(), c + df (0) =0 , and ad − bc =0 , then a + b[M/M] c + d[M/M] is the Pad´e approximant [M/M] to {a + bf()}/{c + df ()}.

Proof : Multiplying the numerator a+b[M/M] and the denominator c+d[M/M]

by QM () gives a + b[M/M] aQ ()+bP () = M M (B.13) c + d[M/M] cQM ()+dPM () which is of the form of polynomial of degree M divided by another of degree M, and since a + b[M/M] a + bf() (ad − bc){f() − [M/M]} − = c + d[M/M] c + df () (c + d[M/M]){c + df ()} = O(2M+1) (B.14) APPENDIX B. SELECTED THEOREMS ON PADE´ APPROXIMANTS 203

it also satisfies the Pad´e equations. Therefore the value invariance theorem follows by the uniqueness theorem. 2

The argument invariance theorem states that the diagonal Pad´e approximants are invariant under the Euler transformation (Eq. B.10), which is the most general one-to-one conformal mapping with the origin fixed. This implies that the diagonal Pad´e approximants yield approximation results similar to a convergent Taylor series generated by use of the Euler transformation. In addition, it is seen from the duality and the value invariance theorem that poles are handled like zeros (Baker, 1990). Appendix C

Extra Evaluation of Influence Coefficients

This appendix evaluates directional derivatives of the influence coefficients required in computing pressure gradients in the steady-state flow model and singular integrals encountered in the transient flow model.

C.1 Directional Derivatives

While former authors (Ligget and Liu, 1983: Masukawa and Horne, 1988: Kikani, 1989) took the derivatives of the integrands of influence coefficients, the influence coefficients themselves are differentiated here. Referring to the definitions of the influence coefficients given in Chapter 3, their directional derivatives are expressed as ∂V1ij 1 ∂ ∂ ∂ξj+1 = ξGi dΓ − ξj+1 Gi dΓ − Gi dΓ (C.1) ∂zDi Δξj ∂zDi ΔΓj ∂zDi ΔΓj ∂zDi ΔΓj ∂V2ij 1 ∂ ∂ ∂ξj = − ξGi dΓ+ξj Gi dΓ+ Gi dΓ (C.2) ∂zDi Δξj ∂zDi ΔΓj ∂zDi ΔΓj ∂zDi ΔΓj ∂W1 1 ∂ ∂G ij = ξ dΓ ΔΓ ∂zDi Δξj ∂zDi j ∂nD i ∂ ∂G ∂ξj+1 ∂G −ξj+1 dΓ − dΓ (C.3) ΔΓ ΔΓ ∂zDi j ∂nD i ∂zDi j ∂nD i

204 APPENDIX C. EXTRA EVALUATION OF INFLUENCE COEFFICIENTS 205

∂W2 1 ∂ ∂G ij = − ξ dΓ ΔΓ ∂zDi Δξj ∂zDi j ∂nD i ∂ ∂G ∂ξj ∂G +ξj+1 dΓ+ dΓ (C.4) ΔΓ ΔΓ ∂zDi j ∂nD i ∂zDi j ∂nD i where Δξj = ξj+1 − ξj and account is taken of ∂ 1 = 0 (C.5) ∂zDi Δξj

The integrals along the boundary element ΔΓj are evaluated analytically as given by Eq. 4.22 through Eq. 4.25. From the connecting relations between the xDyD coordinates and the local ξη coordinates, there follows

∂ξ ∂ξ +1 Δx j = j = Dj ≡ ξ (C.6) ∂x ∂x 2 2 x Di Di ΔxDj +ΔyDj ∂ξ ∂ξ +1 Δy j = j = Dj ≡ ξ (C.7) ∂y ∂y 2 2 y Di Di ΔxDj +ΔyDj

∂η Δy = − Dj ≡ η (C.8) ∂x 2 2 x Di ΔxDj +ΔyDj ∂η Δx = Dj ≡ η (C.9) ∂y 2 2 y Di ΔxDj +ΔyDj where ΔxDj = xDj+1 − xDj and ΔyDj = yDj+1 − yDj. Making use of these relations, taking the derivatives of the boundary integrals, and rearranging the results, yields ∂ 1 { 2 2 }|j+1 Gi dΓ= ξz ln(ξ + η )+2ηz arctan(ξ/η) j (C.10) ∂z ΔΓ 4π Di j ∂ 1 2 2 |j+1 ξGi dΓ= (ξzξ + ηzη)ln(ξ + η ) j (C.11) ∂z ΔΓ 4π Di j j+1 ∂ ∂G 1 ξ η − η ξ dΓ= z z (C.12) ΔΓ 2 2 ∂zDi j ∂nD i 2π ξ + η j j+1 ∂ ∂G 1 2 2 ξzξ + ηzη ξ dΓ= ηz ln(ξ + η )+2η (C.13) ΔΓ 2 2 ∂zDi j ∂nD i 4π ξ + η j APPENDIX C. EXTRA EVALUATION OF INFLUENCE COEFFICIENTS 206

C.2 Singular Integrals

In the transient flow model, there arises difficulty in evaluating the following two singular integrals if the Gaussian quadrature is applied: √ Δξj √ K0( sξ) dξ = K0( sξ) dξ (C.14) ΔΓj 0 √ Δξj √ ξK0( sξ) dξ = ξK0( sξ) dξ (C.15) ΔΓ 0 √ j √ Introducing t = sξ and z = s Δξj gives Δ ξj √ 1 z K0( sξ) dξ = √ K0(t) dt (C.16) 0 s 0 and Δ ξj √ 1 z ξK0( sξ) dξ = tK0(t) dt (C.17) 0 s 0 The ascending series expression for the integral in Eq. C.16 is found in Abramowitz and Stegun (1970): z z ∞ (z/2)2k K0(t) dt = − γ +ln z 0 2 2 k=0 (k!) (2k +1) ∞ (z/2)2k ∞ (z/2)2k k 1 +z 2 2 + z 2 (C.18) k=0 (k!) (2k +1) k=1 (k!) (2k +1)κ=1 κ which is valid for small arguments. For larger arguments, the following asymptotic expansion is valid (Abramowitz and Stegun, 1970): ∞ ∞ −x π k −k K0(t) dt = e (−1) akx (C.19) x 2x k=0 where ak holds the three-term recurrence formula: 1 5 1 2 1 2(k +1)a +1 =3 k + k + a − k + k − a −1 (C.20) k 2 6 k 2 2 k with the initializing conditions of a0 =1.0 and a1 =0.625. Because the exact integration is known when x =0: ∞ π K0(t) dt = (C.21) 0 2 APPENDIX C. EXTRA EVALUATION OF INFLUENCE COEFFICIENTS 207

there follows z ∞ π −z π k −k K0(t) dt = − e (−1) akz (C.22) 0 2 2z k=0 for large z. In the present model, Eq. C.18 is used for z<12 and Eq. C.22 is used for 12 ≤ z<50. For z ≥ 50, the integral is simply approximated by π/2. As for the integral in Eq. C.17, the following formula is applicable (Abramowitz and Stegun, 1970): z n n−1 n t Kn−1(t) dt =2 Γ(n) − z Kn(z) (C.23) 0 where Γ(n) is the gamma function, and there follows z tK0(t) dt = Γ(1) − zK1(z) 0 =1− zK1(z) (C.24)

which is readily evaluated. Appendix D

Exact Solutions for Verification Problems

This appendix presents the analytical solutions for the verification problems. The steady-state flow problem in a reservoir of exponentially varying permeability men- tioned in Section 7.1.3 is a subset problem of the transient flow problem in a exponen- tially heterogeneous reservoir mentioned in Section 7.2.4. The transient flow problem in a reservoir of harmonically varying permeability mentioned in Section 7.2.2 and the problem in a reservoir of varying porosity mentioned in Section 7.2.3 can be solved by knowing that both the problems are governed by equidimensional equations in Laplace space.

D.1 Wells in a Heterogeneous Reservoir

In this section, the verification problems mentioned in Sections 7.2.4 and 7.1.3 are solved analytically.

D.1.1 Transient Pressure Solution

In Section 7.2.4, the pressure responses at wells in a reservoir of exponentially vary- ing permeability and porosity were considered, where the permeability and porosity

208 APPENDIX D. EXACT SOLUTIONS FOR VERIFICATION PROBLEMS 209

variations were given as 2(xD − xwD) k = k0 exp (D.1) a and φ = bk (D.2)

With these variations, the two-dimensional transient flow equation can be rewritten

as 2 2 ∂ pD 2 ∂pD ∂ pD ∂pD 2 + + 2 = b (D.3) ∂xD a ∂xD ∂yD ∂tDA If an infinite areal extent is assumed, the outer boundary conditions may be given as

pD(±∞,yD,tDA)=pD(xD, ±∞,tDA) = 0 (D.4) and for a well with a diminishing radius under a constant rate production, the inner boundary condition is 2π ∂p lim r D dθ = −q (D.5) →0 D D rD 0 ∂rD

Introducing a new pressure variable ψ(xD,yD,tDA) (Hantush, 1962) defined as x − x p = ψ exp − D wD (D.6) D a into Eq. D.3 yields 2 2 ∂ ψ ∂ ψ − ψ ∂ψ 2 + 2 2 = b (D.7) ∂xD ∂yD a ∂tDA In Laplace space, Eq. D.7 subject to a homogeneous initial condition becomes 2 ¯ 2 ¯ ∂ ψ ∂ ψ − 1 ¯ 2 + 2 sb + 2 ψ = 0 (D.8) ∂xD ∂yD a and the corresponding boundary conditions are

p¯D(±∞,yD,s)=¯pD(xD, ±∞,s) = 0 (D.9)

and 2π ∂p¯ q lim r D dθ = − D (D.10) →0 D rD 0 ∂rD s APPENDIX D. EXACT SOLUTIONS FOR VERIFICATION PROBLEMS 210

In the polar coordinate system, Eq. D.8 takes a form of Bessel’s equation and possesses a general solution: ¯ 2 2 ψ = AI0( sb +1/a rD)+BK0( sb +1/a rD) (D.11) 2 2 where I0( sb +1/a rD) and K0( sb +1/a rD) are the modified Bessel functions of the first and second kind, respectively, and of order zero. The constants A and B are determined through application of the boundary conditions, and it is readily seen that A must be zero from the outer boundary conditions, which leaves − xD xwD 2 p¯ = B exp − K0( sb +1/a r ) (D.12) D a D By applying Eq. D.12 to the inner boundary condition, the constant B is found to be qD/(2πs) (Hantush, 1962), and the final solution in Laplace space is obtained: − qD xD xwD 2 p¯ = exp − K0( sb +1/a r ) (D.13) D 2πs a D

The inverse transform of qD/(2πs)is q q L−1 D = D (D.14) 2πs 2π 2 and the inverse transform of K0( sb +1/a rD)is 2 L−1 2 1 − brD − tDA K0( sb +1/a rD) = exp 2 (D.15) 2tDA 4tDA a b where use is made of the substitution theorem. Applying the convolution integral to the Laplace-space solution gives t 2 xD − xwD DA qD 1 brD τ pD = exp − exp − − dτ a 0 2π 2τ 4τ a2b q x − x ∞ (r /a)2 dz = D exp − D wD exp −z − D (D.16) 4π a u 4z z

2 where u =(brDi )/(4tDA). When the flow domain is not infinite but bounded, the solution for a pressure response can be often constructed by use of superposition. However, this technique APPENDIX D. EXACT SOLUTIONS FOR VERIFICATION PROBLEMS 211

bbbbbbb

bbbbbbb 6

bbbbbbb5  4 3 6

1 bbbbbbb6 r - 2

bbbbbbb? - 78910

bbbbbbb

bbbbbbb

Figure D.1: Image-well location for a single well in the center of a square. may not be applied to flow problems in heterogeneous media, since in general, the symmetry condition of the problem is ruined by spatial variabilities. Nevertheless, for the Dirichlet (pD = 0) boundary condition considered in Section 7.2.4, the concept of superposition turns out to be applicable.

In Eq. D.6, since exp{−(xD − xwD)/a} cannot take zero on the boundary, ψ must satisfy the boundary condition. The solution for ψ is symmetric and thus can be superposed. If image wells are arranged as shown in Fig. D.1, the solution satisfying the Dirichlet boundary condition can be expressed as − ∞ ∞ 2 qD xD xwD i+1 (rDi/a) dz pD = exp − (−1) exp −z − (D.17) 4π a i=1 ui 4z z where rDi is the Euclidean distance between the point of interest and the ith imag- 2 inary well and ui =(brDi )/(4tDA). The improper integral involved in this solution can be evaluated numerically. When ui is small, however, a robust and efficient rou- tine, such as the Romberg integration (Press et al., 1986), needs to be used to save APPENDIX D. EXACT SOLUTIONS FOR VERIFICATION PROBLEMS 212

computational effort.

D.1.2 Steady-State Pressure Solution

The analytical solution for the steady-state problem considered in Section 7.1.3 is also obtained by introducing the same pressure transformation as above: x − x p = ψ(x ,y ) exp − D wD (D.18) D D D a which rewrites the governing equation as

2 2 ∂ ψ ∂ ψ − ψ 2 + 2 2 = 0 (D.19) ∂xD ∂yD a In the polar coordinate system, Eq. D.19 takes a form of Bessel’s equation and pos- sesses a general solution: rD rD ψ = AI0 + BK0 (D.20) a a In an infinite flow domain, since the solution should be bounded, the constant A must be zero. From the inner boundary condition, the constant B is found to be qD/(2π), and the solution becomes qD xD − xwD rD p = exp − K0 (D.21) D 2π a a For the Dirichlet boundary condition, using the concept of superposition with the same imaginary-well arrangement as above gives − ∞ qD xD xwD i+1 rDi pD = exp − (−1) K0 (D.22) 2π a i=1 a where rDi is the Euclidean distance between the point of interest and the ith imaginary well.

D.2 Equidimensional Laplace-Space Equations

In this section, the verification problems mentioned in Sections 7.2.2 and 7.2.3 are solved analytically. APPENDIX D. EXACT SOLUTIONS FOR VERIFICATION PROBLEMS 213

D.2.1 Reservoir of Varying Permeability

In Section 7.2.2, the pressure responses in a reservoir of harmonically varying perme- ability were considered, where the permeability variation was given as

2 k = k0K =(1+axD) (D.23) and through the transformation proposed by Georghitza (1969) the governing equa- √ tion in terms of ψ(xD,tDA)= kpD was expressed as 1 ∂ψ ∇2ψ = (D.24) k0K ∂tDA The boundary and initial conditions in terms of ψ become

ψ(0,tDA) = 0 (D.25)

ψ(1,tDA)=1+axD (D.26) and

ψ(xD, 0) = 0 (D.27)

In Laplace space, Eq. D.24 subject to a homogeneous initial condition becomes 2 ¯ d ψ s ¯ 2 = 2 ψ (D.28) dxD (1 + axD) and the corresponding boundary conditions are

ψ¯(0,s) = 0 (D.29) 1+ax ψ¯(1,s)= D (D.30) s Since Eq. D.28 is a homogeneous and equidimensional equation, its fundamental solution takes the following form (Hildebrand, 1976):

¯ r ψ =(1+axD) (D.31)

Substituting Eq. D.31 into Eq. D.28 and equating the coefficients gives

a2r2 − a2r − s = 0 (D.32) APPENDIX D. EXACT SOLUTIONS FOR VERIFICATION PROBLEMS 214

which has two distinct roots: ⎧ √ ⎪ 2 ⎪ a + a +4s ⎨⎪ √2a r = ⎪ (D.33) ⎪ − 2 ⎩⎪ a a +4s 2a and the general solution for Eq. D.28 is obtained as

√ √ ¯ (a+ a2+4s)/2a (a− a2+4s)/2a ψ = A(1 + axD) + B(1 + axD) (D.34)

The constants A and B are determined through the boundary conditions, and after some mathematical manipulations, the final Laplace-space solution is found in the following form: √ √ 2 2 1 1+a (1 + ax )(a+ a +4s)/2a − (1 + ax )(a− a +4s)/2a p¯ = √ ψ¯ = D √ D √ (D.35) D (a+ a2+4s)/2a (a− a2+4s)/2a k s(1 + axD) (1 + a) − (1 + a)

D.2.2 Reservoir of Varying Porosity

In Section 7.2.3, the pressure responses in a reservoir of varying porosity were con- sidered, where the porosity variation was given as

φ0 φ = 2 (D.36) (1 + axD) and the governing equation was expressed as

2 φ ∂pD ∇ pD = φ0 ∂tDA 1 ∂pD = 2 (D.37) (1 + axD) ∂tDA subject to the boundary and initial conditions of

pD(0,tDA) = 0 (D.38)

pD(1,tDA) = 1 (D.39) and

pD(xD, 0) = 0 (D.40) APPENDIX D. EXACT SOLUTIONS FOR VERIFICATION PROBLEMS 215

In Laplace space, Eq. D.37 subject to a homogeneous initial condition becomes

2 d p¯D s 2 = 2 p¯D (D.41) dxD (1 + axD) and the corresponding boundary conditions are

p¯D(0,s) = 0 (D.42) 1 p¯ (1,s)= (D.43) D s Since Eq. D.41 is again a homogeneous and equidimensional equation, the same procedure as discussed in the previous section can be applied, and the final solution in Laplace space is obtained as √ √ 2 2 1 (1 + ax )(a+ a +4s)/2a − (1 + ax )(a− a +4s)/2a D √ D √ p¯D = (D.44) s (1 + a)(a+ a2+4s)/2a − (1 + a)(a− a2+4s)/2a Appendix E

Multiple-Boundary Problems

In the main chapters, the boundary element models are developed considering that the domain Ω is simply connected. In petroleum engineering practice, however, some problems require inner boundaries. Impermeable barriers, which may result from shale lenses or salt domes, can be represented using inner boundary elements with the Neumann boundary value of zero, while constant pressure subregions, which may be encountered as naturally or artificially generated gas caps or infinite-conductivity fractures, can be modeled by inner elements with a constant Dirichlet boundary value. In this appendix, the boundary element model applicable to such problems is considered. Although the discussion is limited to steady-state flow problems in ho- mogeneous media, the same concept can be extended to transient flow problems and to problems with heterogeneous rock properties.

E.1 Mathematical Considerations

In deriving the boundary integral equation (Eq. 3.51), the second form of Green’s theorem has been utilized. This identity holds if the boundary Γ is simple and piece- wise smooth, but does not require the domain Ω to be simply connected. (A simple boundary has the property that it does not intersect itself, and a simply connected re- gion has the property that an arbitrary closed curve lying in the region can be shrunk

216 APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 217

pppppppppppppppppppppppppppppppppppppppppp ppppp ppp ppp ppp ppp ppp pppp pppp pppp ppppp ppppppp ppppppppppp ppppppppppppppp ppppppppppp ppppppp ppppp pppp pppp pppp ppp ppp ppp ppp ppp ppppp ppppppppppppppppppppppppppppppppppppppppppΓ0 ppppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppp pppppppppppppppppppppppp pppppppppppppppppppppppp pppppppppppppppppp pppppppppppppppppp pppppppppppppp pppppppppppppp ppppppppppppppp ppppppppppppppp ppppppppppppp pppppppppppp ppppppppppp pppppppppppp pppppppppp pppppppppp ppppppppp ppppppppp ppppppp ppppppp pppppp '$ pppppp ppppp - Γm ppppp ppp ppp pp Cm pp p - p pp  pp ppp ppp ppppp ppppp pppppp &% pppppp ppppppp ppppppp ppppppppp ppppppppp pppppppppp pppppppppp ppppppppppp pppppppppppp ppppppppppppp pppppppppppp ppppppppppppppp ppppppppppppppp ppppppppppppppp ppppppppppppppp ppppppppppppppppp ppppppppppppppppp ppppppppppppppppppppppp pppppppppppppppppppppppp pppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppp pppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppppp ppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppppp

Figure E.1: Multiple-boundary system.

continuously to a point in the region without passing outside of the region.) There- fore, introducing simple inner boundaries does not ruin the mathematical formulation discussed in Chapter 3.

Suppose that the boundary Γ0 is a simple outer boundary, described in the coun- terclockwise direction, and Γm(m =1,ni) denotes a finite number of simple inner boundaries, all described in the clockwise direction (Fig. E.1). In order to take into account the complete boundary in the contour integral, a polygonal path Cm, con- necting the outer boundary Γ0 to the inner boundary Γm, needs to be introduced temporarily. Applying the second form of Green’s theorem to the domain surrounded ∪ ∪ ∪···∪ ∪ ∪···∪ ∪ by the boundaries Γ0 C1 Γ1 Cm Γm Cni Γni yields ni ni ∂pD ∂G ∂pD ∂G pD(˜xD, y˜D)= G − pD dΓ+ G − pD dC Γ m=0 m ∂nD ∂nD m=1 Cm ∂nD ∂nD ns − G(˜xD, y˜D; xDl,yDl)qDl (E.1) l=1

However, the sum of the integrals over polygonal contours Cm is found to be zero, APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 218

and the boundary integral equation involving inner boundaries becomes ni ns ∂pD − ∂G − pD(˜xD, y˜D)= G pD dΓ G(˜xD, y˜D; xDl,yDl)qDl (E.2) Γ m=0 m ∂nD ∂nD l=1

The contour integrals over Γm can be approximated using linear elements. The nbm-boundary discretization along Γm gives ni nbm ns ∂pD − ∂G − pD(˜xD, y˜D)= G pD dΓ G(˜xD, y˜D; xDl,yDl)qDl ΔΓ m=0 j=1 mj ∂nD ∂nD l=1 (E.3) where the counterclockwise numbering is adopted on the outer boundary Γ0, while the clockwise numbering is adopted on the inner boundaries Γm(m =1,ni). The same definitions of influence coefficients as described in Chapter 3 are appli- ni cable, and a system of m=0 nbm equations are obtained. Once these equations are solved, the solution and its directional derivative at any point in Ω can be constructed in a way similar to the single-boundary formulation.

E.2 Results and Discussion

The model is used to generate streamlines in a quarter of a repeated five-spot pattern with various inner boundaries. In all examples, only 16 nodes are arranged along the outer boundary, and the singularity programming discussed in Chapter 4 are utilized. Inner boundary conditions are considered either no flow or constant pressure, and fluid production and injection take place only through the two wells lying at the diagonal corners. Figure E.2 shows 21 streamlines tracked by the model with an impermeable circle in the center of the flow domain. The circle is modeled with 20 boundary nodes. Al- though the outermost streamlines are somewhat wavy due to the coarse discretization along the outer boundary, the overall flow profile is reasonably simulated. When the inner circle is maintained at constant pressure, streamlines are tracked as shown in Fig. E.3. In this figure, streamlines towards the production well are tracked backwards. Since the inner boundary is an equipotential line, the streamlines intersect it perpendicularly. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 219

Figure E.2: Streamlines in a repeated five-spot pattern with an impermeable centered circle. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 220

Figure E.3: Streamlines in a repeated five-spot pattern with a constant-pressure centered circle. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 221

Figure E.4 illustrates that the model can simulate multiple inner boundaries with different boundary conditions. The perpendicularity between the equipotential line and the streamlines again holds. If the circular boundary with a constant Dirichlet boundary value is crushed to the limit, it can be used to model an infinite-conductivity fracture. However, since the fracture is infinitely thin, boundary nodes on one side occupy the same plane as those on the other side, which makes the solution matrix singular. (Liggett and Liu (1983) noticed the same problem in the cut-off wall problem.) Thus, the fracture aperture needs to be set somewhat wider than a realistic width. In the following four cases, it is set to 1/1000 of the domain edge length, which, for instance, corresponds to a 12 in width fracture in a 1000 ft × 1000 ft flow domain. Figure E.5 illustrates the flow profile with a 500 ft length fracture created in the direction of N45W/S45E. The fracture is modeled by arranging eight boundary nodes along its circumference. As the diagonal (N45W/S45E) happens to be an equipotential line due to the symmetric configuration, the presence of the finite- conductivity fracture along the diagonal has no effect on the flow profile. When the fracture azimuth is different from N45W/S45E, a new equipotential line along the fracture is introduced, and, hence, a different flow profile is expected. Figure E.6 shows the model results with a 500 ft length fracture lying in the direction of N/S. Eight boundary nodes are arranged along the fracture. It is seen that the flux distribution in the southern region is more condensed on the west side of the fracture, while that in the northern region is condensed on the opposite side. This implies that the fracture is functioning as a partial conduit from the injection to the production well. The perpendicularity between the fracture and the streamlines is not well modeled. The flux distribution computed by the model is shown in Fig. E.7, where the fracture origin xfD = 0 is set at the northernmost tip. It is observed that the flux varies rapidly around each end of the fracture due to the geometric singularity. With the nature of the realistic entry-flux distribution in mind, angular profiles seen at xfD =0.2 and xfD =0.8 appear to be inaccurate. The simplest rectification of such errors is achieved by refining boundary elements around the fracture tips. With 20 boundary elements APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 222

Figure E.4: Streamlines in a repeated five-spot pattern with impermeable and constant-pressure circles. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 223

Figure E.5: Streamlines in a repeated five-spot pattern with a N45W/S45E fracture, coarse discretization. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 224

Figure E.6: Streamlines in a repeated five-spot pattern with a N/S fracture, coarse discretization. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 225

arranged along the fracture, the model yields a more reasonable flux distribution as shown in Fig. E.8. Figure E.9 demonstrates that the boundary refinement recovers the perpendicularity between the fracture and the streamlines. Figure E.10 illustrates the flow profile in the same flow domain with an off-centered fracture. It is observed that the northern tip has inward (fracture to domain) flux on both sides of the fracture, while the southern tip has outward flux on both sides. Such a detailed observation would not be obtained by conventional domain methods. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 226

0.3

0.2

0.1 East Side

0.0

-0.1 West Side -0.2 Dimensionless Inward Flux

-0.3 0.0 0.2 0.4 0.6 0.8 1.0 Fractional Fracture Length Figure E.7: Dimensionless inward-flux distribution along the N/S fracture, coarse discretization. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 227

0.3

0.2

0.1 East Side

0.0

-0.1 West Side -0.2 Dimensionless Inward Flux

-0.3 0.0 0.2 0.4 0.6 0.8 1.0 Fractional Fracture Length Figure E.8: Dimensionless inward-flux distribution along the N/S fracture, fine dis- cretization. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 228

Figure E.9: Streamlines in a repeated five-spot pattern with a N/S fracture, fine discretization. APPENDIX E. MULTIPLE-BOUNDARY PROBLEMS 229

Figure E.10: Streamlines in a repeated five-spot pattern with a N/S off-centered fracture. Appendix F

Input/Output Samples

This appendix provides the input and output files for the verification problem dis- cussed in Section 7.2.4. Besides the output file presented here, data files for graphics are also generated.

Input file

/ ************************************ / ***** BEMPER INPUT DATA FILE ***** / ************************************ / / +----- TITLE (TWO LINES ALLOWED, SHOULD BE LESS THAN 68 CHARACTERS) /| /V /--+----+----+----+----+----+----M----+----+----+----+----+----+---- PERTURBATION BEM VERIFICATION PROBLEM 7.2.4 K = EXP(3X) PHI = 0.1 K / / / ************************* / ***** I/O OPTIONS ***** / ************************* / / +----- UNIT SYSTEM ( 1 : FIELD, 2 : DARCY, -1 OR -2 : OUTPUT IS DIM’LESS ) / | +----- OUTPUT OPTION ( 0 : WELL SOLUTION ONLY / | | 1 : + PLOT DATA / V V 2 : + BOUNDARY SOLUTION ) -2 1 /

230 APPENDIX F. INPUT/OUTPUT SAMPLES 231

/ / *************************************** / ***** CHARACTERISTIC PROPERTIES ***** / *************************************** / / +----- INITIAL PRESSURE (PSI) / | +----- REFERENCE PRESSURE (PSI) / | | +----- CONSTANT PERMEABILITY (MD) / | | | +----- CONSTANT VISCOSITY (CP) / | | | | +----- CONSTANT POROSITY (FRACTION) / | | | | | +----- TOTAL COMPRESSIBILITY (1/PSI) /||||||+----- RESERVOIR HEIGHT (FT) /||||||| /VVVVVVV 0. 1. 1. 1. 0.1 1. 1. / / / ***************************************** / ***** BOUNDARY ELEMENT DEFINITION ***** / ***************************************** / / +----- NO. OF BOUNDARY NODES (N) /| /V 40 / / +----- INDICATOR OF BOUNDARY TYPE / | +----- POTENTIAL (PSI) / | | +---+-- NEUMANN BOUNDARY VALUES /| | || /V V VV 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. APPENDIX F. INPUT/OUTPUT SAMPLES 232

2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. 2 0.0 0. 0. / / +----- NODE NUMBER / | +----- X COORDINATE (FT) / | | +----- Y COORDINATE (FT) /| | | /V V V 1 0.0000E+00 0.0000E+00 2 0.1000 0.0000E+00 3 0.2000 0.0000E+00 4 0.3000 0.0000E+00 5 0.4000 0.0000E+00 6 0.5000 0.0000E+00 7 0.6000 0.0000E+00 8 0.7000 0.0000E+00 9 0.8000 0.0000E+00 10 0.9000 0.0000E+00 11 1.000 0.0000E+00 12 1.000 0.1000 13 1.000 0.2000 15 1.000 0.4000 16 1.000 0.5000 17 1.000 0.6000 18 1.000 0.7000 19 1.000 0.8000 20 1.000 0.9000 APPENDIX F. INPUT/OUTPUT SAMPLES 233

21 1.000 1.000 22 0.9000 1.000 23 0.8000 1.000 24 0.7000 1.000 25 0.6000 1.000 26 0.5000 1.000 27 0.4000 1.000 28 0.3000 1.000 29 0.2000 1.000 30 0.1000E+00 1.000 31 0.0000E+00 1.000 32 0.0000E+00 0.9000 33 0.0000E+00 0.8000 34 0.0000E+00 0.7000 35 0.0000E+00 0.6000 36 0.0000E+00 0.5000 37 0.0000E+00 0.4000 38 0.0000E+00 0.3000 39 0.0000E+00 0.2000 40 0.0000E+00 0.1000E+00 / / / ************************************ / ***** SINK/SOURCE DEFINITION ***** / ************************************ / / +----- NO. OF SINK/SOURCE POINTS (NSS) /| /V 5 / / +----- WELL NAME (MAX. 10 CHARACTERS, ENCLOSED WITH ’) / | +--- X COORDINATE (FT) / | | +--- Y COORDINATE (FT) / | | | +--- FLOW RATE (RBD) / | | | | +--- WELL RADIUS (FT) / | | | | | +--- PERMEABILITY (MD) / | | | | | | +--- WELLBORE STORAGE /|| | ||||+--- SKIN /|| | ||||| /----MM---- V V VVVVV ’ WELL-1 ’ .5 .5 1. 0.0005 1. 0. 0. ’(0.2,0.5) ’ .2 .5 0. 1.E-20 1. 0. 0. ’(0.4,0.5) ’ .4 .5 0. 1.E-20 1. 0. 0. ’(0.6,0.5) ’ .6 .5 0. 1.E-20 1. 0. 0. ’(0.8,0.5) ’ .8 .5 0. 1.E-20 1. 0. 0. / / APPENDIX F. INPUT/OUTPUT SAMPLES 234

/ ********************************** / ***** TIME STEP DEFINITION ***** / ********************************** / / +----- TIME STEP SELECTION ( 0 : CARTESIAN , 1 : LOGARITHMIC ) /| /V 1 / / +----- STARTING TIME (HRS) / | +----- MAX. TIME (HRS) OR NO. OF LOG CYCLES / | | +----- TIME STEP SIZE (HRS) OR NO. OF POINTS PER CYCLE /| | | /V V V 0.00001 5 10 / / / ********************************************** / ***** PARAMETERS FOR NUMERICAL SCHEMES ***** / ********************************************** / / +----- NO. OF SAMPLING POINTS FOR LAPLACE INVERSION / | +----- NO.OF SAMPLING POINTS FOR GAUSS-LEGENDRE INTEGRAL / | | +----- NO.OF PANELS FOR GAUSS-LEGENDRE INTEGRAL / | | | +----- WELL SINGULARITY TREATMENT / | | | | ( 0 : IDLE , 1 : ACTIVE ) /V V V V 8621 / / / ************************************** / ***** HETEROGENEITY DEFINITION ***** / ************************************** / / +----- MAX. NO. OF PERTURBATION / | +----- CONVERGENCE PRESSURE TOLERANCE /| | /V V 20 1.E-5 / / +----- PADE APPROXIMANTS ( 0 : IDLE , 1 : ACTIVE ) / | +----- SELECTION OF PADE SUMMATION EVALUATION / | | ( 1 : CONTINUED FRACTION , 2 : DIRECT ) / | | +----- WELL SINGULARITY IN DOMAIN INTEGRATION / | | | ( 0 : IDLE , 1 : ACTIVE ) /V V V 111 APPENDIX F. INPUT/OUTPUT SAMPLES 235

/ / +----- NO. OF TRIANGULAR ELEMENTS (NTRI) / | +----- NO. OF VERTICES DEFINING TRIANGLES (NVTX) / | | +----- PERMEABILITY VARIATION / | | | +----- POROSITY VARIATION / | | | | ( 1 : LINEAR , 2 : LOGARITHMIC ) /V V V V 200 121 2 2 / / +----- ELEMENT NUMBER / | +----+----+- VERTEX NUMBER (COUNTERCLOCKWISE) /|||| /VVVV 1 1 41 40 21241 32341 4 3 42 41 5 3 43 42 63443 74543 8 5 44 43 9 5 45 44 10 5 6 45 11 6 7 45 12 7 46 45 13 7 47 46 14 7 8 47 15 8 9 47 : 181 32 113 31 182 113 30 31 183 113 29 30 184 113 114 29 185 114 115 29 186 115 28 29 187 115 27 28 188 115 116 27 189 116 117 27 190 117 26 27 191 117 25 26 192 117 118 25 193 118 119 25 194 119 24 25 195 119 23 24 196 119 120 23 197 120 121 23 198 121 22 23 199 121 21 22 APPENDIX F. INPUT/OUTPUT SAMPLES 236

200 121 20 21 / / +----- NODE NUMBER / | +----- X COORDINATE (FT) / | | +----- Y COORDINATE (FT) / | | | +----- PERMEABILITY (MD) / | | | | +----- POROSITY (FRAC) /| | | | | /V V V V V 1 0.0000E+00 0.0000E+00 0.2231302 0.2231302E-01 2 0.1000 0.0000E+00 0.3011942 0.3011942E-01 3 0.2000 0.0000E+00 0.4065697 0.4065697E-01 4 0.3000 0.0000E+00 0.5488116 0.5488116E-01 5 0.4000 0.0000E+00 0.7408182 0.7408182E-01 6 0.5000 0.0000E+00 1.000000 0.1000000 7 0.6000 0.0000E+00 1.349859 0.1349859 8 0.7000 0.0000E+00 1.822119 0.1822119 9 0.8000 0.0000E+00 2.459603 0.2459603 10 0.9000 0.0000E+00 3.320117 0.3320117 11 1.000 0.0000E+00 4.481689 0.4481689 12 1.000 0.1000 4.481689 0.4481689 13 1.000 0.2000 4.481689 0.4481689 14 1.000 0.3000 4.481689 0.4481689 15 1.000 0.4000 4.481689 0.4481689 : 101 0.7000 0.7000 1.822119 0.1822119 102 0.8000 0.7000 2.459603 0.2459603 103 0.9000 0.7000 3.320117 0.3320117 104 0.1000 0.8000 0.3011942 0.3011942E-01 105 0.2000 0.8000 0.4065697 0.4065697E-01 106 0.3000 0.8000 0.5488116 0.5488116E-01 107 0.4000 0.8000 0.7408182 0.7408182E-01 108 0.5000 0.8000 1.000000 0.1000000 109 0.6000 0.8000 1.349859 0.1349859 110 0.7000 0.8000 1.822119 0.1822119 111 0.8000 0.8000 2.459603 0.2459603 112 0.9000 0.8000 3.320117 0.3320117 113 0.1000 0.9000 0.3011942 0.3011942E-01 114 0.2000 0.9000 0.4065697 0.4065697E-01 115 0.3000 0.9000 0.5488116 0.5488116E-01 116 0.4000 0.9000 0.7408182 0.7408182E-01 117 0.5000 0.9000 1.000000 0.1000000 118 0.6000 0.9000 1.349859 0.1349859 119 0.7000 0.9000 1.822119 0.1822119 120 0.8000 0.9000 2.459603 0.2459603 121 0.9000 0.9000 3.320117 0.3320117 APPENDIX F. INPUT/OUTPUT SAMPLES 237

Output file

************************************************************************** * ********************************************************************** * ** ** ** ** * * STANFORD UNIVERSITY * * * * DEPARTMENT OF PETROLEUM ENGINEERING * * ** ** ** BEMPER ** ** ** * * VERSION 2.3 * * * * REVISION 09/30/91 * * * * COPYRIGHT 1991 BY KOZO SATO * * ** ** ** ** * ********************************************************************** * ** ** * * PERTURBATION BEM VERIFICATION PROBLEM 7.2.4 * * * * K = EXP(3X) PHI = 0.1 K * * ** ** * ********************************************************************** * **************************************************************************

+------+ | CURRENT DIMENSION LIMITS | +------+

NO. OF BOUNDARY NODES (NDND) : 100 NO. OF TRIANGULAR SUB-DOMAINS (NDTRI) : 200 NO. OF TRIANGLE VERTICES (NDVTX) : 121 NO. OF SINK/SOURCE POINTS (NDSS) : 20 NO. OF TIME STEPS (NDTIME) : 100 NO. OF PERTURBATIONS (NDPRTB) : 20

+------+ | CHARACTERISTIC PROPERTIES | +------+

INITIAL PRESSURE : 0.00 (ATM) REFERENCE PRESSURE : 1.00 (ATM) PERMEABILITY (AVG) : 1.00000 (D) VISCOSITY : 1.00000 (CP) POROSITY : 0.10000 (FRACTION) APPENDIX F. INPUT/OUTPUT SAMPLES 238

TOTAL COMPRESSIBILITY : 0.100E+01 (1/ATM) RESERVOIR HEIGHT : 1.00 (CM) RESERVOIR AREA : 1. (CM2) RESERVOIR BULK VOLUME : 1. (CM3) CHARACTERISTIC LENGTH : 1.00 (CM)

+------+ | DEFINITION OF BOUNDARY NODES | +------+

NODE NODE LOCATION BOUNDARY POTENTIAL DP/DN (I) DP/DN (O) NO. (X) (CM) (Y) TYPE (ATM) (ATM/CM) (ATM/CM) ------1 0.000 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 2 0.100 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 3 0.200 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 4 0.300 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 5 0.400 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 6 0.500 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 7 0.600 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 8 0.700 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 9 0.800 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 10 0.900 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 11 1.000 0.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 12 1.000 0.100 DIRICHLET 0.000 UNKNOWN UNKNOWN 13 1.000 0.200 DIRICHLET 0.000 UNKNOWN UNKNOWN 14 1.000 0.300 DIRICHLET 0.000 UNKNOWN UNKNOWN 15 1.000 0.400 DIRICHLET 0.000 UNKNOWN UNKNOWN 16 1.000 0.500 DIRICHLET 0.000 UNKNOWN UNKNOWN 17 1.000 0.600 DIRICHLET 0.000 UNKNOWN UNKNOWN 18 1.000 0.700 DIRICHLET 0.000 UNKNOWN UNKNOWN 19 1.000 0.800 DIRICHLET 0.000 UNKNOWN UNKNOWN 20 1.000 0.900 DIRICHLET 0.000 UNKNOWN UNKNOWN 21 1.000 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 22 0.900 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 23 0.800 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 24 0.700 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 25 0.600 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 26 0.500 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 27 0.400 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 28 0.300 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 29 0.200 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 30 0.100 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 31 0.000 1.000 DIRICHLET 0.000 UNKNOWN UNKNOWN 32 0.000 0.900 DIRICHLET 0.000 UNKNOWN UNKNOWN 33 0.000 0.800 DIRICHLET 0.000 UNKNOWN UNKNOWN APPENDIX F. INPUT/OUTPUT SAMPLES 239

34 0.000 0.700 DIRICHLET 0.000 UNKNOWN UNKNOWN 35 0.000 0.600 DIRICHLET 0.000 UNKNOWN UNKNOWN 36 0.000 0.500 DIRICHLET 0.000 UNKNOWN UNKNOWN 37 0.000 0.400 DIRICHLET 0.000 UNKNOWN UNKNOWN 38 0.000 0.300 DIRICHLET 0.000 UNKNOWN UNKNOWN 39 0.000 0.200 DIRICHLET 0.000 UNKNOWN UNKNOWN 40 0.000 0.100 DIRICHLET 0.000 UNKNOWN UNKNOWN

+------+ | DEFINITION OF SINK/SOURCE | +------+

WELL WELL LOCATION RATE RADIUS PERM. CD SKIN NAME (X) (CM) (Y) (CCM/S) (CM) (D) ------WELL-1 0.50 0.50 1.000 .500E-03 1.00 .000E+00 .000E+00 (0.2,0.5) 0.20 0.50 0.0000E+00 .100E-19 1.00 .000E+00 .000E+00 (0.4,0.5) 0.40 0.50 0.0000E+00 .100E-19 1.00 .000E+00 .000E+00 (0.6,0.5) 0.60 0.50 0.0000E+00 .100E-19 1.00 .000E+00 .000E+00 (0.8,0.5) 0.80 0.50 0.0000E+00 .100E-19 1.00 .000E+00 .000E+00

+------+ | PARAMETERS FOR NUMERICAL SCHEMES | +------+

NO. OF SAMPLING POINTS FOR LAPLACE INVERSION : 8 NO. OF SAMPLING POINTS FOR GAUSS-LEGENDRE INTEGRATION : 6 NO. OF PANELS FOR GAUSS-LEGENDRE INTEGRATION : 2 WELL SINGULARITY TREATMENT : ACTIVE

+------+ | ROCK PROPERTY SPATIAL DISTRIBUTION | +------+

PERMEABILITY VARIATION BETWEEN NODES : LOGARITHMIC POROSITY VARIATION BETWEEN NODES : LOGARITHMIC

NODE NODE LOCATION PERMEABILITY POROSITY NO. (X) (FT) (Y) (MD) (FRACTION) ------1 0.000 0.000 0.223 0.022313 APPENDIX F. INPUT/OUTPUT SAMPLES 240

2 0.100 0.000 0.301 0.030119 3 0.200 0.000 0.407 0.040657 4 0.300 0.000 0.549 0.054881 5 0.400 0.000 0.741 0.074082 6 0.500 0.000 1.000 0.100000 7 0.600 0.000 1.350 0.134986 8 0.700 0.000 1.822 0.182212 9 0.800 0.000 2.460 0.245960 10 0.900 0.000 3.320 0.332012 11 1.000 0.000 4.482 0.448169 12 1.000 0.100 4.482 0.448169 13 1.000 0.200 4.482 0.448169 14 1.000 0.300 4.482 0.448169 15 1.000 0.400 4.482 0.448169 : 101 0.700 0.700 1.822 0.182212 102 0.800 0.700 2.460 0.245960 103 0.900 0.700 3.320 0.332012 104 0.100 0.800 0.301 0.030119 105 0.200 0.800 0.407 0.040657 106 0.300 0.800 0.549 0.054881 107 0.400 0.800 0.741 0.074082 108 0.500 0.800 1.000 0.100000 109 0.600 0.800 1.350 0.134986 110 0.700 0.800 1.822 0.182212 111 0.800 0.800 2.460 0.245960 112 0.900 0.800 3.320 0.332012 113 0.100 0.900 0.301 0.030119 114 0.200 0.900 0.407 0.040657 115 0.300 0.900 0.549 0.054881 116 0.400 0.900 0.741 0.074082 117 0.500 0.900 1.000 0.100000 118 0.600 0.900 1.350 0.134986 119 0.700 0.900 1.822 0.182212 120 0.800 0.900 2.460 0.245960 121 0.900 0.900 3.320 0.332012

+------+ | PARAMETERS FOR PERTURBATION METHOD | +------+

MAX. NO. OF PERTURBATION : 20 CONVERGENCE TOLERANCE : 0.10E-04 (ATM) PADE APPROXIMANTS : ACTIVE EVALUATION OF SUMMATION : CONTINUED FRACTION WELL SINGULARITY : ACTIVE APPENDIX F. INPUT/OUTPUT SAMPLES 241

WELL-1 (0.2,0.5) (0.4,0.5) ------TIME PRT PRESSURE DERIVATIVE PRESSURE DERIVATIVE PRESSURE DERIVATIVE (DIMLES) NO. (DIMLES) T(DP/DT) (DIMLES) T(DP/DT) (DIMLES) T(DP/DT) ------0.100E-03 1 3.400 0.4998 -.5862E-12 -.4058E-12 -.3520E-05 0.5935E-05 0.126E-03 1 3.516 0.4998 -.1017E-10 -.7019E-11 0.5179E-05 0.1543E-04 0.158E-03 1 3.631 0.4999 -.1303E-09 -.8930E-10 0.2929E-04 0.1748E-04 0.200E-03 1 3.746 0.4999 -.1267E-08 -.8536E-09 0.6561E-04 -.2124E-04 0.251E-03 1 3.861 0.4999 -.9527E-08 -.6196E-08 0.8671E-04 -.9679E-04 0.316E-03 1 3.976 0.4998 -.5606E-07 -.3406E-07 0.6107E-04 0.5836E-05 0.398E-03 2 4.091 0.4997 -.2877E-06 -.1458E-06 0.4975E-04 0.8687E-03 0.501E-03 4 4.206 0.5000 -.1372E-05 -.4175E-06 0.4141E-03 0.4169E-02 0.631E-03 5 4.321 0.5000 -.3387E-05 0.3621E-06 0.1935E-02 0.1162E-01 0.794E-03 5 4.436 0.5000 -.4731E-05 0.3940E-05 0.5955E-02 0.2555E-01 0.100E-02 6 4.551 0.5000 0.1598E-06 0.1329E-04 0.1428E-01 0.4773E-01 0.126E-02 4 4.667 0.4999 0.1954E-04 0.2150E-04 0.2894E-01 0.7881E-01 0.158E-02 5 4.782 0.4998 0.6040E-04 -.2700E-08 0.5188E-01 0.1179 0.200E-02 7 4.897 0.4996 0.1005E-03 -.7420E-04 0.8460E-01 0.1631 0.251E-02 9 5.012 0.4992 0.1030E-03 -.9116E-04 0.1280 0.2115 0.316E-02 10 5.127 0.4986 0.6589E-04 0.4581E-03 0.1825 0.2601 0.398E-02 9 5.241 0.4978 0.1741E-03 0.2847E-02 0.2477 0.3065 0.501E-02 12 5.356 0.4966 0.1283E-02 0.9227E-02 0.3229 0.3488 0.631E-02 10 5.470 0.4951 0.4542E-02 0.2236E-01 0.4071 0.3860 0.794E-02 12 5.584 0.4932 0.1201E-01 0.4490E-01 0.4993 0.4177 0.100E-01 14 5.697 0.4907 0.2614E-01 0.7850E-01 0.5981 0.4435 0.126E-01 12 5.810 0.4877 0.4954E-01 0.1231 0.7023 0.4640 0.158E-01 11 5.921 0.4839 0.8445E-01 0.1766 0.8107 0.4796 0.200E-01 12 6.032 0.4793 0.1325 0.2350 0.9222 0.4906 0.251E-01 15 6.142 0.4738 0.1937 0.2924 1.036 0.4974 0.316E-01 15 6.250 0.4663 0.2673 0.3416 1.151 0.4994 0.398E-01 12 6.357 0.4546 0.3504 0.3759 1.266 0.4942 0.501E-01 12 6.460 0.4346 0.4386 0.3886 1.379 0.4775 0.631E-01 13 6.557 0.4014 0.5264 0.3752 1.487 0.4439 0.794E-01 18 6.644 0.3514 0.6072 0.3351 1.583 0.3901 0.100 13 6.717 0.2855 0.6758 0.2732 1.664 0.3172 0.126 13 6.772 0.2100 0.7283 0.1989 1.726 0.2329 0.158 16 6.810 0.1352 0.7641 0.1248 1.768 0.1492 0.200 15 6.833 0.7187E-01 0.7851 0.6261E-01 1.793 0.7843E-01 0.251 9 6.845 0.2694E-01 0.7954 0.1905E-01 1.806 0.2828E-01 0.316 9 6.849 0.1481E-02 0.7989 -.4793E-02 1.811 0.5664E-04 0.398 11 6.850 -.8265E-02 0.7991 -.1304E-01 1.811 -.1049E-01 0.501 11 6.850 -.8444E-02 0.7981 -.1205E-01 1.811 -.1041E-01 0.631 12 6.849 -.4666E-02 0.7971 -.7362E-02 1.810 -.5861E-02 0.794 11 6.849 -.5428E-03 0.7963 -.2502E-02 1.809 -.1025E-02 APPENDIX F. INPUT/OUTPUT SAMPLES 242

1.00 12 6.849 0.2286E-02 0.7958 0.8897E-03 1.809 0.2303E-02 1.26 9 6.849 0.3555E-02 0.7955 0.2347E-02 1.809 0.3885E-02 1.58 13 6.849 0.3559E-02 0.7953 0.2902E-02 1.809 0.3905E-02 2.00 8 6.849 0.2962E-02 0.7951 0.2538E-02 1.809 0.3276E-02 2.51 8 6.849 0.2125E-02 0.7950 0.1875E-02 1.809 0.2366E-02 3.16 8 6.849 0.1327E-02 0.7949 0.1171E-02 1.809 0.1486E-02 3.98 8 6.849 0.6841E-03 0.7948 0.6077E-03 1.809 0.7752E-03 5.01 8 6.849 0.2223E-03 0.7947 0.1939E-03 1.808 0.2570E-03 6.31 8 6.849 -.7725E-04 0.7947 -.7713E-04 1.808 -.7698E-04 7.94 8 6.849 -.2505E-03 0.7946 -.2345E-03 1.808 -.2710E-03 10.0 7 6.849 -.3343E-03 0.7946 -.3109E-03 1.808 -.3654E-03

(0.6,0.5) (0.8,0.5) ------TIME PRT PRESSURE DERIVATIVE PRESSURE DERIVATIVE (DIMLES) NO. (DIMLES) T(DP/DT) (DIMLES) T(DP/DT) ------0.100E-03 1 -.2196E-05 0.4527E-05 -.3102E-12 -.2147E-12 0.126E-03 1 0.4259E-05 0.1104E-04 -.5305E-11 -.3660E-11 0.158E-03 1 0.2179E-04 0.1078E-04 -.6699E-10 -.4585E-10 0.200E-03 1 0.4703E-04 -.1725E-04 -.6412E-09 -.4310E-09 0.251E-03 1 0.6046E-04 -.6703E-04 -.4740E-08 -.3068E-08 0.316E-03 1 0.4322E-04 0.1236E-04 -.2737E-07 -.1644E-07 0.398E-03 2 0.4711E-04 0.7435E-03 -.1249E-06 -.2460E-07 0.501E-03 4 0.3379E-03 0.3152E-02 -.1012E-05 -.1410E-06 0.631E-03 5 0.1484E-02 0.8608E-02 -.1245E-05 0.7379E-07 0.794E-03 5 0.4449E-02 0.1875E-01 -.1966E-05 0.1296E-05 0.100E-02 6 0.1053E-01 0.3483E-01 0.5605E-07 0.5826E-05 0.126E-02 4 0.2121E-01 0.5740E-01 0.1023E-04 0.6946E-05 0.158E-02 5 0.3789E-01 0.8597E-01 0.3701E-04 0.6861E-05 0.200E-02 7 0.6176E-01 0.1192 0.4026E-04 -.3581E-04 0.251E-02 9 0.9357E-01 0.1551 0.3692E-04 -.5934E-04 0.316E-02 10 0.1336 0.1916 0.1648E-04 0.1414E-03 0.398E-02 9 0.1818 0.2265 0.6901E-04 0.1079E-02 0.501E-02 12 0.2374 0.2584 0.4711E-03 0.3639E-02 0.631E-02 10 0.2999 0.2863 0.1765E-02 0.8953E-02 0.794E-02 12 0.3683 0.3098 0.4765E-02 0.1813E-01 0.100E-01 14 0.4415 0.3288 0.1049E-01 0.3184E-01 0.126E-01 12 0.5187 0.3438 0.2000E-01 0.5000E-01 0.158E-01 11 0.5989 0.3550 0.3419E-01 0.7168E-01 0.200E-01 12 0.6815 0.3629 0.5365E-01 0.9509E-01 0.251E-01 15 0.7657 0.3676 0.7841E-01 0.1178 0.316E-01 15 0.8507 0.3686 0.1080 0.1369 0.398E-01 12 0.9357 0.3641 0.1411 0.1497 0.501E-01 12 1.019 0.3508 0.1761 0.1538 0.631E-01 13 1.097 0.3254 0.2107 0.1479 0.794E-01 18 1.168 0.2854 0.2425 0.1316 APPENDIX F. INPUT/OUTPUT SAMPLES 243

0.100 13 1.227 0.2320 0.2695 0.1076 0.126 13 1.272 0.1706 0.2902 0.7897E-01 0.158 16 1.303 0.1100 0.3046 0.5066E-01 0.200 15 1.322 0.5876E-01 0.3134 0.2688E-01 0.251 9 1.332 0.2240E-01 0.3180 0.1006E-01 0.316 9 1.336 0.1819E-02 0.3200 0.7050E-03 0.398 11 1.337 -.5989E-02 0.3206 -.2688E-02 0.501 11 1.337 -.6209E-02 0.3208 -.2705E-02 0.631 12 1.336 -.3178E-02 0.3207 -.1284E-02 0.794 11 1.336 0.8759E-04 0.3207 0.2610E-03 1.00 12 1.336 0.2311E-02 0.3208 0.1280E-02 1.26 9 1.336 0.3262E-02 0.3209 0.1718E-02 1.58 13 1.336 0.3219E-02 0.3209 0.1700E-02 2.00 8 1.336 0.2693E-02 0.3210 0.1413E-02 2.51 8 1.336 0.1963E-02 0.3211 0.1103E-02 3.16 8 1.336 0.1276E-02 0.3211 0.7615E-03 3.98 8 1.336 0.7207E-03 0.3211 0.4854E-03 5.01 8 1.336 0.3174E-03 0.3212 0.2792E-03 6.31 8 1.336 0.4975E-04 0.3212 0.1361E-03 7.94 8 1.336 -.1117E-03 0.3212 0.4352E-04 10.0 7 1.336 -.1974E-03 0.3212 -.1248E-04 Appendix G

FORTRAN Code

As is seen in the flow charts presented in Chapter 6, there are many subroutines com- mon (with some modification) between the steady-state and the transient flow model. A complete FORTRAN code of the transient flow model and the streamline-tracking routine, which is peculiar to the steady-state flow model, are presented herein.

Parameter param.h PARAMETER (NDND=100,NDTRI=200,NDVTX=121,NDSS=20,NDMX=101, * NDTIME=100,NDSTEH=12,NDPRTB=20)

NDND Maximum number of boundary nodes NDTRI Maximum number of triangular elements NDVTX Maximum number of vertices NDSS Maximum number of sinks NDMX Dimension of solution matrix NDTIME Maximum number of time steps NDSTEH Maximum number of Stehfest sampling times NDPRTB Maximum order of perturbation

244 APPENDIX G. FORTRAN CODE 245

Common Blocks bndemt.h COMMON /BNDRYN/ * N,NTRI,NVTX,ID(0:NDND) COMMON /BNDRYR/ * HH(NDND),QI(NDND),QO(NDND),RMB(0:NDND), * XX(0:NDVTX),YY(0:NDVTX), * VI(NDND,NDND),VO(NDND,NDND),WW(NDND,NDND),ALP(0:NDND) coord.h COMMON/COORDR/ * XI1,XI2,ETA,THETA,SOU,TOU gauss.h COMMON /GAUSSN/ * NGAUSS,NPNL intgvw.h COMMON/INTVWI/ * IFAIL COMMON/INTVWR/ * V1,V2,W1,W2,RM lapvar.h COMMON /LAPVAN/ * NSTEH,ISTEH,NTIME,ITIME COMMON /LAPVAR/ * S,VMOD,T(NDTIME) matrix.h COMMON /MATRIN/ * N1,IPVT(NDMX,NDSTEH) COMMON /MATRIR/ * AMAT(NDMX,NDMX,NDSTEH),RHS(NDMX) nond.h COMMON /NOND/ * RLNGTH,PRSI,PREF,APERM,APOR,DIFFA,CONSPD,QCNST(NDSS) pertub.h COMMON /PERTUI/ * ICONV,IPRTB,NPRMX,KK(NDTRI,3) COMMON /PERTUR/ * PERM(NDVTX),POR(NDVTX), * HQ(NDND,0:NDPRTB,NDSTEH), * HQN(NDND,NDSTEH), * GPXN(NDTRI,NDSTEH),GPYN(NDTRI,NDSTEH),SMLKPN(NDTRI,NDSTEH) LOGICAL ICONV APPENDIX G. FORTRAN CODE 246

pgrad.h COMMON/PGRAR/ * PP,ALPHA, * VIP(NDND),VOP(0:NDND),WWP(0:NDND), * UU(NDVTX,NDTRI),UUX(NDVTX,NDTRI),UUY(NDVTX,NDTRI), * UUXL(NDVTX),UUYL(NDVTX),UUPK(NDVTX,NDPRTB), * UP(NDTRI),UPX(NDTRI),UPY(NDTRI), * UPXL,UPYL,UPPK point.h COMMON /POINT/ * XI,YI,XJ1,YJ1,XJ2,YJ2,XJ,YJ sink.h CHARACTER WLNAME(NDSS)*10 COMMON /SINKN/ * NSS,ISS,ISNG,LOCSS(NDSS),WLNAME(NDSS) COMMON /SINKR/ * QWPQ,QB(NDND), * CD(NDSS),SKIN(NDSS),XSS(NDSS),YSS(NDSS),RW(NDSS),ALPSS(NDSS), * SPQ(NDSS), * PW(0:NDND,NDSTEH),PWO(0:NDND,NDSTEH),PWI(NDND,NDSTEH), * PSS(NDSS,NDSTEH) trigrd.h INTEGER KVAR,PVAR COMMON /TRIGRN/ * KVAR,PVAR,ILOG COMMON /TRIGRR/ * XV1,YV1,XV2,YV2,XV3,YV3,F1,F2,F3,DFDX,DFDY,FCON, * DFDXK,DFDYK,FCONK,DFDXP,DFDYP,FCONP unit.h COMMON /UNITN/ * IUNIT,IOUT COMMON /UNITR/ * UPRS(2),URAT(2),ULNG(2),UTIM(2),UVIS(2),UPRM(2),UCMP(2),UPGR(2), * UARE(2),UVOL(2) CHARACTER UPRS(2)*5,URAT(2)*7,ULNG(2)*4,UTIM(2)*5, * UVIS(2)*4,UPRM(2)*4,UCMP(2)*7,UPGR(2)*8, * UARE(2)*5,UVOL(2)*5 APPENDIX G. FORTRAN CODE 247

FORTRAN Code of the Transient Flow Model

PROGRAM BEMPER C ********************************************************************** C ********************************************************************** C** ** C ** PERTURBATION BOUNDARY ELEMENT MODEL ** C** ** C ********************************************************************** C ** BEMPER-MAIN ******************************************************* C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’lapvar.h’ INCLUDE ’pertub.h’ C DATA DLN2/0.6931471805599453/ C C ------CALL INPUT C ------C DO 999 ITIME=1,NTIME IPRTB=0 VMOD=DLN2/T(ITIME) DO 100 ISTEH=1,NSTEH S=VMOD*ISTEH C ------CALL BNDRY CALL MATRIX CALL DECOMP CALL SOLVE C ------100 CONTINUE C IF(NPRMX.EQ.0) THEN C ------CALL WELSUM C ------GO TO 999 END IF C DO 110 IPRTB=1,NPRMX DO 115 ISTEH=1,NSTEH S=VMOD*ISTEH C ------CALL HETERO(2) APPENDIX G. FORTRAN CODE 248

CALL SOLVE C ------115 CONTINUE C ------CALL HETERO(3) C ------IF(ICONV) GOTO 999 110 CONTINUE WRITE(6,10) 999 CONTINUE C 10 FORMAT(1X,’CONVERGENCE WAS NOT ATTAINED IN MAIN’) STOP END

SUBROUTINE ANGLE C ********************************************************************** C ********************************************************************** C** ** C ** INTERNAL ANGLE ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’coord.h’ INCLUDE ’point.h’ C DATA PI/3.141592653589793/ C NM1=N-1 C C <<< COMPUTE INTERNAL ANGLE ON THE BOUNDARY >>> C XJ1=XX(NM1) YJ1=YY(NM1) XJ2=XX(N) YJ2=YY(N) C ------CALL COORD C ------THETA1=THETA DO 100 J=0,NM1 XJ1=XX(J) APPENDIX G. FORTRAN CODE 249

YJ1=YY(J) XJ2=XX(J+1) YJ2=YY(J+1) C ------CALL COORD C ------ALPHA=THETA-THETA1+PI ALPHA=MOD(ALPHA,2.*PI) IF(ALPHA.LT.0.) ALPHA=ALPHA+2.*PI ALP(J)=ALPHA THETA1=THETA 100 CONTINUE ALP(N)=ALP(0) C RETURN END

SUBROUTINE AREA(TAREA) C ********************************************************************** C ********************************************************************** C** ** C ** AREA OF INTERNAL DOMAIN ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’coord.h’ INCLUDE ’point.h’ C TAREA=0. XI=XX(1) YI=YY(1) DO 100 J=2,N-1 XJ1=XX(J) YJ1=YY(J) XJ2=XX(J+1) YJ2=YY(J+1) C ------CALL COORD C ------TAREA=TAREA+.5*(XI1-XI2)*ETA 100 CONTINUE C APPENDIX G. FORTRAN CODE 250

RETURN END

SUBROUTINE BNDRY C ********************************************************************** C ********************************************************************** C** ** C ** INFLUENCE COEFFICIENTS AT BOUNDARY NODES ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’pgrad.h’ INCLUDE ’point.h’ INCLUDE ’sink.h’ C C <<< COMPUTE INFLUENCE COEFFICIENTS >>> C DO 200 I=1,N XI=XX(I) YI=YY(I) C ------CALL COEFF C ------C C ... BOUNDARY NODE TO BOUNDARY ELEMENTS ... C DO 210 J=1,N WW(I,J)=WWP(J) VO(I,J)=VOP(J) VI(I,J)=VIP(J) 210 CONTINUE C C ... BOUNDARY NODE TO SINK-SOURCE ... C IF(ISNG.EQ.0) THEN C ------CALL WELL C ------QB(I)=QWPQ END IF 200 CONTINUE C APPENDIX G. FORTRAN CODE 251

C <<< WELL SINGULARITY >>> C IF(ISNG.EQ.1) THEN C ------CALL SINK C ------END IF C RETURN END

SUBROUTINE BNDSUM C ********************************************************************** C ********************************************************************** C** ** C ** BOUNDARY SOLUTION SUMMARY ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’lapvar.h’ INCLUDE ’nond.h’ INCLUDE ’pertub.h’ INCLUDE ’unit.h’ C IF(IOUT.LT.2) RETURN C DO 100 I=1,N DO 150 ISTEH=1,NSTEH HQL=HQN(I,ISTEH) C ------CALL LAPINV(2,HQL,HQR,D) C ------150 CONTINUE IF(ID(I).EQ.4) THEN WRITE(6,*) I,PRSI-HQR*PREF ELSE WRITE(6,*) I,HQR END IF 100 CONTINUE C RETURN END APPENDIX G. FORTRAN CODE 252

SUBROUTINE COEFF C ********************************************************************** C ********************************************************************** C** ** C ** INFLUENCE COEFFICIENTS ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) LOGICAL IFAIL C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’coord.h’ INCLUDE ’intgvw.h’ INCLUDE ’pertub.h’ INCLUDE ’pgrad.h’ INCLUDE ’point.h’ INCLUDE ’sink.h’ INCLUDE ’trigrd.h’ C NM1=N-1 WWP(0)=0. DO 100 J=0,NM1 XJ1=XX(J) YJ1=YY(J) XJ2=XX(J+1) YJ2=YY(J+1) C ------CALL COORD CALL INTGVW C ------WWP(J)=WWP(J)+W1 WWP(J+1)=W2 VOP(J)=V1 VIP(J+1)=V2 100 CONTINUE WWP(N)=WWP(N)+WWP(0) VOP(N)=VOP(0) C RETURN END APPENDIX G. FORTRAN CODE 253

SUBROUTINE COORD C ********************************************************************** C ********************************************************************** C** ** C ** COORDINATE TRANSFORMATION ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’coord.h’ INCLUDE ’point.h’ C S=XJ2-XJ1 T=YJ2-YJ1 U=SQRT(S*S+T*T) SOU=S/U TOU=T/U XI1=(-XJ1+XI)*SOU+(-YJ1+YI)*TOU XI2=(-XJ2+XI)*SOU+(-YJ2+YI)*TOU ETA=(XJ1-XI)*TOU-(YJ1-YI)*SOU THETA=ATAN2(TOU,-SOU) C RETURN END

SUBROUTINE DECOMP C ********************************************************************** C ********************************************************************** C** ** C ** DECOMPOSITION OF MATRIX BY GAUSSIAN ELIMINATION ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’lapvar.h’ INCLUDE ’matrix.h’ C IPVT(N1,ISTEH)=1 IF(N1.EQ.1) RETURN NM1=N1-1 DO 400 K=1,NM1 KP1=K+1 APPENDIX G. FORTRAN CODE 254

M=K DO 100 I=KP1,N1 IF(ABS(AMAT(I,K,ISTEH)).GT.ABS(AMAT(M,K,ISTEH))) M=I 100 CONTINUE IPVT(K,ISTEH)=M IF(M.NE.K) IPVT(N1,ISTEH)=-IPVT(N1,ISTEH) TT=AMAT(M,K,ISTEH) AMAT(M,K,ISTEH)=AMAT(K,K,ISTEH) AMAT(K,K,ISTEH)=TT IF(TT.EQ.0.) GOTO 400 DO 200 I=KP1,N1 AMAT(I,K,ISTEH)=-AMAT(I,K,ISTEH)/TT 200 CONTINUE DO 300 J=KP1,N1 TT=AMAT(M,J,ISTEH) AMAT(M,J,ISTEH)=AMAT(K,J,ISTEH) AMAT(K,J,ISTEH)=TT IF(TT.EQ.0.) GOTO 300 DO 350 I=KP1,N1 AMAT(I,J,ISTEH)=AMAT(I,J,ISTEH)+AMAT(I,K,ISTEH)*TT 350 CONTINUE 300 CONTINUE 400 CONTINUE C RETURN END

SUBROUTINE GAUSS(IND,N,M,FUN,A,B,SUM) C ********************************************************************** C ********************************************************************** C** ** C ** GAUSSIAN QUADRATURE ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C DIMENSION X(25),W(25) EXTERNAL FUN DATA PI/3.141592653589793/ C GO TO (1000,2000) IND C C======C C ABSCISSAS AND WEIGHTS OF N-POINT GAUSS-LEGENDRE RULE C C======C APPENDIX G. FORTRAN CODE 255

C 1000 CONTINUE C L=(N+1)/2 E1=N*(N+1) DO 100 I=1,L T=(4*I-1)*PI/(4*N+2) X0=(1.-(1.-1./N)/(8.*N*N))*COS(T) PKM1=1. PK=X0 DO 150 K=2,N T1=X0*PK PKP1=T1-PKM1-(T1-PKM1)/K+T1 PKM1=PK PK=PKP1 150 CONTINUE DEN=1.-X0*X0 D1=N*(PKM1-X0*PK) DPN=D1/DEN D2PN=(2.*X0*DPN-E1*PK)/DEN D3PN=(4.*X0*D2PN+(2.-E1)*DPN)/DEN D4PN=(6.*X0*D3PN+(6.-E1)*D2PN)/DEN U=PK/DPN V=D2PN/DPN H=-U*(1.+.5*U*(V+U*(V*V-D3PN/(3.*DPN)))) P=PK+H*(DPN+.5*H*(D2PN+H/3.*(D3PN+.25*H*D4PN))) DP=DPN+H*(D2PN+.5*H*(D3PN+H*D4PN/3.)) H=H-P/DP X(I)=X0+H FX=D1-H*E1*(PK+.5*H*(DPN+H/3.*(D2PN+.25*H*(D3PN+.2*H*D4PN)))) W(I)=2.*(1.-X(I)*X(I))/(FX*FX) 100 CONTINUE IF(L+L.GT.N) X(L)=0. C K=2*L-N+1 C RETURN C C======C C COMPOSITE SYMMETRIC RULE C C======C C 2000 CONTINUE C SUM=0. H1=(B-A)/M H=0.5*H1 A0=A+H APPENDIX G. FORTRAN CODE 256

DO 200 M1=1,M IF(K.EQ.2) SUM=SUM+W(L)*FUN(A0) DO 250 I=L,K,-1 H2=H*X(I) SUM=SUM+W(I)*(FUN(A0+H2)+FUN(A0-H2)) 250 CONTINUE A0=A0+H1 200 CONTINUE SUM=SUM*H C RETURN END

SUBROUTINE HETERO(IND) C ********************************************************************** C ********************************************************************** C** ** C ** PERTURBATION FOR HETEROGENEITY ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’lapvar.h’ INCLUDE ’matrix.h’ INCLUDE ’nond.h’ INCLUDE ’pertub.h’ INCLUDE ’pgrad.h’ INCLUDE ’point.h’ INCLUDE ’sink.h’ INCLUDE ’trigrd.h’ INCLUDE ’unit.h’ C EXTERNAL FACT CHARACTER BAR*11,LINLOG(2)*11,ONOFF(2)*6,CFD(3)*18 DIMENSION WWD(NDVTX*NDND,NDSTEH), * VID(NDVTX*NDND,NDSTEH),VOD(NDVTX*NDND,NDSTEH), * SVT(NDVTX*NDTRI,NDSTEH), * SVTX(NDVTX*NDTRI,NDSTEH),SVTY(NDVTX*NDTRI,NDSTEH), * SVTXL(NDVTX,NDSTEH),SVTYL(NDVTX,NDSTEH), * SVTPK(NDVTX*NDPRTB,NDSTEH), * QD(NDVTX,NDSTEH),PDW(NDVTX,NDSTEH), * GPX(NDTRI,NDSTEH),GPY(NDTRI,NDSTEH),SMLKP(NDTRI,NDSTEH), * PD(NDVTX,0:NDPRTB,NDSTEH),COR(NDVTX,NDSTEH), APPENDIX G. FORTRAN CODE 257

* PR(NDTRI,0:NDPRTB),PRD(NDTRI,0:NDPRTB), * PPADE(0:NDPRTB),PPADEN(NDVTX) DATA BAR/’------’/ DATA ONOFF/’IDLE ’,’ACTIVE’/ DATA LINLOG/’LINEAR ’,’LOGARITHMIC’/ DATA CFD/’CONTINUED FRACTION’,’DIRECT ’, * ’----- ’/ DATA PI/3.141592653589793/ C GO TO (1000,2000,3000) IND C C======C C DATA INPUT AND COMPUTE INVARIANT COEFFICIENTS C C======C C 1000 CONTINUE C CALL READC READ(5,*) NPRMX,TOLP IF(NPRMX.EQ.0) RETURN TOLP=TOLP/PREF CALL READC READ(5,*) IPADE,INDP,ILOG IF(IPADE.EQ.0) INDP=3 CALL READC READ(5,*) NTRI,NVTX,KVAR,PVAR IF(NPRMX.GT.NDPRTB .OR. NTRI.GT.NDTRI .OR. NVTX.GT.NDVTX) THEN WRITE(6,60) STOP END IF CALL READC DO 100 K=1,NTRI READ(5,*) KNN,KK(KNN,1),KK(KNN,2),KK(KNN,3) 100 CONTINUE CALL READC WRITE(6,11) LINLOG(KVAR),LINLOG(PVAR) DO 110 M=1,NVTX READ(5,*) MNN,XM,YM,PERM(MNN),POR(MNN) WRITE(6,12) MNN,XM,YM,PERM(MNN),POR(MNN) C C ... NON-DIMENSIONALIZATION ... C XM=XM/RLNGTH YM=YM/RLNGTH IF(MNN.LE.N .AND. (XM.NE.XX(MNN) .OR. YM.NE.YY(MNN))) THEN WRITE(6,10) MNN WRITE(6,*) XM,XX(MNN),YM,YY(MNN) STOP APPENDIX G. FORTRAN CODE 258

END IF XX(MNN)=XM YY(MNN)=YM PERM(MNN)=PERM(MNN)/APERM POR(MNN)=POR(MNN)/APOR-1. C C ... CHECK SINK-SOURCE LOCATION ... C DO 115 ISS=1,NSS IF(XSS(ISS).EQ.XM .AND. YSS(ISS).EQ.YM) THEN LOCSS(ISS)=M IF(IPADE.EQ.1) LOCSS(ISS)=-M GOTO 115 END IF 115 CONTINUE IF(IPADE.EQ.1 .AND. M.EQ.NVTX) THEN DO 118 ISS=1,NSS IF(LOCSS(ISS).EQ.0) THEN WRITE(6,13) STOP END IF 118 CONTINUE END IF 110 CONTINUE C WRITE(6,14) NPRMX,TOLP*PREF,UPRS(ABS(IUNIT)), * ONOFF(IPADE+1),CFD(INDP),ONOFF(ILOG+1) C C ------CALL INTGU(1) C ------C RETURN C C======C C COMPUTE R.H.S. VECTOR FOR PERTURBATION PROCESS C C======C C 2000 CONTINUE C IPRM1=IPRTB-1 C IF(IPRTB.EQ.1) THEN C C <<< COMPUTE INFLUENCE COEFFICIENTS >>> C C ------CALL INTGU(2) APPENDIX G. FORTRAN CODE 259

C ------C MJ=0 MK=0 MP=0 DO 220 M=1,NVTX XI=XX(M) YI=YY(M) C ------CALL COEFF C ------C C ... VERTEX TO BOUNDARY ELEMENTS ... C DO 221 J=1,N MJ=MJ+1 WWD(MJ,ISTEH)=WWP(J) VOD(MJ,ISTEH)=VOP(J) VID(MJ,ISTEH)=VIP(J) 221 CONTINUE C C ... VERTEX TO TRIANGULAR SUB-DOMAINS ... C DO 223 K=1,NTRI MK=MK+1 SVT(MK,ISTEH)=UU(M,K) SVTX(MK,ISTEH)=UUX(M,K) SVTY(MK,ISTEH)=UUY(M,K) 223 CONTINUE C IF(ILOG.EQ.1) THEN SVTXL(M,ISTEH)=UUXL(M) SVTYL(M,ISTEH)=UUYL(M) DO 225 IPR=1,NPRMX MP=MP+1 SVTPK(MP,ISTEH)=UUPK(M,IPR) 225 CONTINUE END IF C C ... VERTEX TO SINK-SOURCE ... C C ------CALL WELL C ------QD(M,ISTEH)=QWPQ 220 CONTINUE END IF C APPENDIX G. FORTRAN CODE 260

MJ=N*N DO 250 M=N+1,NVTX IF(IPRTB.EQ.1) THEN PP=0.0 ELSE PP=COR(M,ISTEH) END IF DO 255 J=1,N MJ=MJ+1 IF(IPRTB.EQ.1) THEN HHS=HH(J)/S-PW(J,ISTEH) QIS=QI(J)/S-PWI(J,ISTEH) QOS=QO(J)/S-PWO(J,ISTEH) END IF IF(ID(J).EQ.1) THEN PP=PP+VOD(MJ,ISTEH)*HQ(J,IPRM1,ISTEH) IF(IPRTB.EQ.1) * PP=PP+VID(MJ,ISTEH)*QIS-WWD(MJ,ISTEH)*HHS ELSE IF(ID(J).EQ.2) THEN PP=PP+(VID(MJ,ISTEH)+VOD(MJ,ISTEH))*HQ(J,IPRM1,ISTEH) IF(IPRTB.EQ.1) * PP=PP-WWD(MJ,ISTEH)*HHS ELSE IF(ID(J).EQ.3) THEN PP=PP+VID(MJ,ISTEH)*HQ(J,IPRM1,ISTEH) IF(IPRTB.EQ.1) * PP=PP+VOD(MJ,ISTEH)*QOS-WWD(MJ,ISTEH)*HHS ELSE IF(ID(J).EQ.4) THEN PP=PP-WWD(MJ,ISTEH)*HQ(J,IPRM1,ISTEH) IF(IPRTB.EQ.1) * PP=PP+VID(MJ,ISTEH)*QIS+VOD(MJ,ISTEH)*QOS END IF 255 CONTINUE C IF(IPRTB.EQ.1) THEN IF(ILOG.EQ.0) PP=PP-QD(M,ISTEH) IF(ILOG.EQ.1) PDW(M,ISTEH)=-QD(M,ISTEH)/(2.*PI) END IF C PD(M,IPRM1,ISTEH)=PP/(2.*PI) 250 CONTINUE C DO 260 I=1,N IF(ID(I).EQ.4) THEN PD(I,IPRM1,ISTEH)=HQ(I,IPRM1,ISTEH) ELSE IF(IPRTB.GT.1) THEN PD(I,IPRM1,ISTEH)=0. ELSE PD(I,IPRM1,ISTEH)=HH(I)/S-PW(I,ISTEH) APPENDIX G. FORTRAN CODE 261

END IF 260 CONTINUE C DO 270 K=1,NTRI K1=KK(K,1) K2=KK(K,2) K3=KK(K,3) XV1=XX(K1) YV1=YY(K1) XV2=XX(K2) YV2=YY(K2) XV3=XX(K3) YV3=YY(K3) F1=PD(K1,IPRM1,ISTEH) F2=PD(K2,IPRM1,ISTEH) F3=PD(K3,IPRM1,ISTEH) C ------CALL TRIGRD C ------GPX(K,ISTEH)=DFDX GPY(K,ISTEH)=DFDY C DUM=0.0 DO 275 I=1,IPRTB IM1=I-1 IPRMI=IPRTB-I FI=FLOAT(I) POR1=POR(K1) POR2=POR(K2) POR3=POR(K3) PRM1=-LOG(PERM(K1)) PRM2=-LOG(PERM(K2)) PRM3=-LOG(PERM(K3)) DUM=DUM+(PD(K1,IPRMI,ISTEH)*(FI*POR1*(PRM1)**IM1+(PRM1)**I)+ * PD(K2,IPRMI,ISTEH)*(FI*POR2*(PRM2)**IM1+(PRM2)**I)+ * PD(K3,IPRMI,ISTEH)*(FI*POR3*(PRM3)**IM1+(PRM3)**I)) * /(3.*FACT(FI)) 275 CONTINUE SMLKP(K,ISTEH)=S*DUM 270 CONTINUE C IK=0 IP=-NPRMX+IPRTB DO 280 I=1,NVTX HET=0. DO 285 K=1,NTRI IK=IK+1 HET=HET+SVT(IK,ISTEH)*SMLKP(K,ISTEH) APPENDIX G. FORTRAN CODE 262

* -SVTX(IK,ISTEH)*GPX(K,ISTEH) * -SVTY(IK,ISTEH)*GPY(K,ISTEH) 285 CONTINUE IF(ILOG.EQ.1) THEN IF(IPRTB.EQ.1) HET=HET-SVTXL(I,ISTEH)-SVTYL(I,ISTEH) IP=IP+NPRMX HET=HET+SVTPK(IP,ISTEH) END IF IF(I.LE.N) THEN RHS(I)=HET ELSE COR(I,ISTEH)=-HET END IF 280 CONTINUE C RETURN C C======C C CONVERGENCE CHECK C C======C C 3000 CONTINUE C IF(IPADE.EQ.0) THEN C C <<< CONVERGENCE CHECK WITH NAIVE SERIES >>> C DO 300 ISTEH=1,NSTEH DO 305 I=1,N HQN(I,ISTEH)=HQN(I,ISTEH)+HQ(I,IPRTB,ISTEH) 305 CONTINUE DO 307 K=1,NTRI IF(IPRTB.EQ.1) THEN GPXN(K,ISTEH)=GPX(K,ISTEH) GPYN(K,ISTEH)=GPY(K,ISTEH) SMLKPN(K,ISTEH)=SMLKP(K,ISTEH) ELSE GPXN(K,ISTEH)=GPXN(K,ISTEH)+GPX(K,ISTEH) GPYN(K,ISTEH)=GPYN(K,ISTEH)+GPY(K,ISTEH) SMLKPN(K,ISTEH)=SMLKPN(K,ISTEH)+SMLKP(K,ISTEH) END IF 307 CONTINUE DO 308 L=1,NSS IF(LOCSS(L).EQ.0) GOTO 308 IF(IPRTB.EQ.1) THEN IF(ILOG.EQ.0) THEN PSS(L,ISTEH)=0. ELSE IF(ILOG.EQ.1) THEN APPENDIX G. FORTRAN CODE 263

IF(LOCSS(L).LE.N) THEN PSS(L,ISTEH)=PW(LOCSS(L),ISTEH) ELSE PSS(L,ISTEH)=PDW(LOCSS(L),ISTEH) END IF END IF END IF PSS(L,ISTEH)=PSS(L,ISTEH)+PD(LOCSS(L),IPRM1,ISTEH) 308 CONTINUE 300 CONTINUE C ICONV=.TRUE. DO 310 M=1,NVTX IF(M.LE.N .AND. ID(M).NE.4) GOTO 310 DO 312 ISTEH=1,NSTEH S=VMOD*ISTEH IF(IPRTB.EQ.1 .AND. ILOG.EQ.1) THEN IF(M.LE.N) THEN PL=PD(M,IPRM1,ISTEH)+PW(M,ISTEH) ELSE PL=PD(M,IPRM1,ISTEH)+PDW(M,ISTEH) END IF ELSE PL=PD(M,IPRM1,ISTEH) END IF C ------CALL LAPINV(2,PL,PRM,DD) C ------312 CONTINUE IF(ABS(PRM).GT.TOLP) THEN ICONV=.FALSE. IF(IPRTB.LT.NPRMX) RETURN GO TO 319 END IF 310 CONTINUE 319 CONTINUE C ELSE C C <<< CONVERGENCE CHECK WITH PADE APPROXIMANTS >>> C ICONV=.TRUE. DO 320 M=1,NVTX IF(M.LE.N .AND. ID(M).NE.4) GOTO 320 DO 325 ISTEH=1,NSTEH S=VMOD*ISTEH IF(IPRTB.EQ.1 .AND. ILOG.EQ.1) THEN IF(M.LE.N) THEN APPENDIX G. FORTRAN CODE 264

PL=PD(M,IPRM1,ISTEH)+PW(M,ISTEH) ELSE PL=PD(M,IPRM1,ISTEH)+PDW(M,ISTEH) END IF ELSE PL=PD(M,IPRM1,ISTEH) END IF C ------CALL LAPINV(2,PL,PINV,DPINV) C ------325 CONTINUE PR(M,IPRM1)=PINV PRD(M,IPRM1)=DPINV IF(IPRM1.GE.1) THEN NN=IPRM1 IF(INDP.EQ.1 .AND. IPRM1.GT.1) NN=-IPRM1 DO 327 IPR=0,IPRM1 PPADE(IPR)=PR(M,IPR) 327 CONTINUE C ------CALL PADE(INDP,NN,M,PPADE,PP) C ------DIF=PP-PPADEN(M) PPADEN(M)=PP IF(ABS(DIF).GT.TOLP) ICONV=.FALSE. ELSE PPADEN(M)=PR(M,0) ICONV=.FALSE. END IF 320 CONTINUE C IF(.NOT.ICONV .AND. IPRTB.LT.NPRMX) RETURN C DO 330 L=1,NSS M=-LOCSS(L) PSS(L,1)=PPADEN(M) DO 335 IPR=0,IPRM1 PPADE(IPR)=PRD(M,IPR) 335 CONTINUE C ------CALL PADE(INDP,NN,M,PPADE,PP) C ------PSS(L,2)=PP 330 CONTINUE C IF(IOUT.EQ.2) THEN DO 350 M=1,NVTX WRITE(6,*) M,PRSI-PREF*PPADEN(M) APPENDIX G. FORTRAN CODE 265

350 CONTINUE END IF C END IF C IF(NSS.EQ.0) RETURN C C ------CALL WELSUM C ------C RETURN C 10 FORMAT(1H ,’BOUNDARY DATA AND PERMEABILITY DISTRIBUTION’, 1 ’ DATA ARE INCONSISTENT AT NODE-’,I3) 11 FORMAT(///1H ,’+------+’/ 1 1H ,’| ROCK PROPERTY SPATIAL DISTRIBUTION |’/ 2 1H ,’+------+’//, 3 1H ,3X,’PERMEABILITY VARIATION BETWEEN NODES :’,1X,A11/ 3 1H ,3X,’POROSITY VARIATION BETWEEN NODES :’,1X,A11// 3 1H ,3X,’NODE NODE LOCATION PERMEABILITY ’ 3 ,’ POROSITY ’/ 4 1H ,3X,’ NO. (X) (FT) (Y) (MD) ’ 4 ,’ (FRACTION) ’/ 5 1H ,3X,’------’ 5 ,’------’) 12 FORMAT(1H ,3X,I3,3X,F10.3,1X,F10.3,2X,F10.3,3X,F10.6) 13 FORMAT(1H ,’SINK-SOURCE SHOULD BE AT A NODE WHEN PADE’, 1 ’ APPROXIMANTS ARE APPLIED’) 14 FORMAT(///1H ,’+------+’/ 1 1H ,’| PARAMETERS FOR PERTURBATION METHOD |’/ 2 1H ,’+------+’//, 3 1H ,3X,’MAX. NO. OF PERTURBATION :’,I3/ 4 1H ,3X,’CONVERGENCE TOLERANCE :’,G9.2,1X,A5/ 5 1H ,3X,’PADE APPROXIMANTS :’,1X,A6/ 6 1H ,3X,’EVALUATION OF SUMMATION :’,1X,A18/ 7 1H ,3X,’WELL SINGULARITY :’,1X,A6/) 60 FORMAT(1H ,’DIMENSION EXCEEDS CURRENT LIMIT’) END

SUBROUTINE INPUT C ********************************************************************** C ********************************************************************** C** ** C ** DATA INPUT AND NON-DIMENSIONALIZATION ** C** ** C ********************************************************************** APPENDIX G. FORTRAN CODE 266

C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’gauss.h’ INCLUDE ’lapvar.h’ INCLUDE ’nond.h’ INCLUDE ’sink.h’ INCLUDE ’unit.h’ C CHARACTER TITLE1*68,TITLE2*68,ND(4)*11,UNKWN*10,CND*11,WSNG(2)*6 DIMENSION CONSQ(2),CONST(2) DIMENSION WPERM(NDSS) C DATA CONSQ/887.217,1.0/ DATA CONST/2.63679D-4,1.0/ DATA ND/’DRCL+NMN(I)’,’ DIRICHLET ’,’DRCL+NMN(O)’,’ NEUMANN ’/ DATA WSNG/’IDLE ’,’ACTIVE’/ DATA UNKWN/’ UNKNOWN ’/ DATA UPRS/’(PSI)’,’(ATM)’/ DATA URAT/’(STB/D)’,’(CCM/S)’/ DATA ULNG/’(FT)’,’(CM)’/ DATA UTIM/’(HRS)’,’(SEC)’/ DATA UVIS/’(CP)’,’(CP)’/ DATA UPRM/’(MD)’,’(D) ’/ DATA UCMP/’(1/PSI)’,’(1/ATM)’/ DATA UPGR/’(PSI/FT)’,’(ATM/CM)’/ DATA UARE/’(FT2)’,’(CM2)’/ DATA UVOL/’(FT3)’,’(CM3)’/ DATA PI/3.141592653589793/ C C======C C DATA INPUT C C======C C CALL READC READ(5,’(A)’) TITLE1 READ(5,’(A)’) TITLE2 WRITE(6,1) WRITE(6,2) TITLE1,TITLE2 WRITE(6,3) NDND,NDTRI,NDVTX,NDSS,NDTIME,NDPRTB C C 1 FORMAT(1H ,3X,74(’*’)/1H ,3X,’* ’,70(’*’),’ *’/ 1 1H ,3X,’* *’,68X,’* *’/1H ,3X,’* *’,68X,’* *’/ 2 1H ,3X,’* *’,24X,’STANFORD UNIVERSITY’,25X,’* *’/ APPENDIX G. FORTRAN CODE 267

3 1H ,3X,’* *’,16X,’DEPARTMENT OF PETROLEUM ENGINEERING’ 4 ,17X,’* *’/1H ,3X,’* *’,68X,’* *’/ 5 1H ,3X,’* *’,28X,’B E M P E R’,29X,’* *’/ 6 1H ,3X,’* *’,68X,’* *’/ 2 FORMAT(1H ,3X,’* *’,28X,’VERSION 2.3’,29X,’* *’/ 1 1H ,3X,’* *’,25X,’REVISION 09/30/91’,26X,’* *’/ 2 1H ,3X,’* *’,20X,’COPYRIGHT 1991 BY KOZO SATO’,21X,’* *’/ 3 1H ,3X,’* *’,68X,’* *’/,1H ,3X,’* *’,68X,’* *’/1H ,3X 4 ,’* ’,70(’*’),’ *’/1H ,3X,’* *’,68X,’* *’/1H ,3X,’* *’ 5 ,A,’* *’/1H ,3X,’* *’,A,’* *’/1H ,3X,’* *’ 6 ,68X,’* *’/1H ,3X,’* ’,70(’*’),’ *’/1H ,3X,74(’*’)///) 3 FORMAT(1H ,22X,’+------+’/ 1 1H ,22X,’| CURRENT DIMENSION LIMITS |’/ 2 1H ,22X,’+------+’// 3 1H ,15X,’NO. OF BOUNDARY NODES (NDND) : ’,I4/ 4 1H ,15X,’NO. OF TRIANGULAR SUB-DOMAINS (NDTRI) : ’,I4/ 5 1H ,15X,’NO. OF TRIANGLE VERTICES (NDVTX) : ’,I4/ 6 1H ,15X,’NO. OF SINK/SOURCE POINTS (NDSS) : ’,I4/ 7 1H ,15X,’NO. OF TIME STEPS (NDTIME) : ’,I4/ 8 1H ,15X,’NO. OF PERTURBATIONS (NDPRTB) : ’,I4) C CALL READC READ(5,*) IUNIT,IOUT IAU=ABS(IUNIT) CALL READC READ(5,*) PRSI,PREF,APERM,VIS,APOR,COMP,RHIGHT CALL READC READ(5,*) N IPS=0 CALL READC DO 100 I=1,N READ(5,*) ID(I),HH(I),QI(I),QO(I) 100 CONTINUE CALL READC DO 110 I=1,N READ(5,*) JNN,XX(JNN),YY(JNN) 110 CONTINUE CALL READC READ(5,*) NSS CALL READC DO 120 L=1,NSS READ(5,*) WLNAME(L),XSS(L),YSS(L),SPQ(L),RW(L),WPERM(L), * CD(L),SKIN(L) 120 CONTINUE CALL READC READ(5,*) ICL CALL READC IF(ICL.EQ.0) THEN APPENDIX G. FORTRAN CODE 268

READ(5,*) TMIN,TMAX,DELT NTIME=1 T(1)=TMIN 130 CONTINUE NTIME=NTIME+1 T(NTIME)=T(NTIME-1)+DELT IF(T(NTIME).LT.TMAX) GOTO 130 IF(T(NTIME).GT.TMAX) T(NTIME)=TMAX ELSE READ(5,*) TMIN,NLOG,NCYC NTIME=NLOG*NCYC+1 DELT=10.0**(1.0/NCYC) T(1)=TMIN DO 135 I=2,NTIME T(I)=TMIN*DELT**(I-1) 135 CONTINUE END IF CALL READC READ(5,*) NSTEH,NGAUSS,NPNL,ISNG C ------CALL LAPINV(1,D,D,D) CALL GAUSS(1,NGAUSS,NPNL,D,D,D,D) C ------C ------CALL AREA(TAREA) C ------RLNGTH=SQRT(TAREA) VOLUME=TAREA*RHIGHT C WRITE(6,10) PRSI,UPRS(IAU),PREF,UPRS(IAU),APERM,UPRM(IAU), * VIS,UVIS(IAU),APOR,COMP,UCMP(IAU), * RHIGHT,ULNG(IAU),TAREA,UARE(IAU), * VOLUME,UVOL(IAU),RLNGTH,ULNG(IAU) C WRITE(6,20) ULNG(IAU),UPRS(IAU),UPGR(IAU),UPGR(IAU) DO 150 J=1,N CND=ND(ID(J)) IF(ID(J).EQ.1) THEN WRITE(6,21) J,XX(J),YY(J),CND,HH(J),QI(J),UNKWN ELSE IF(ID(J).EQ.2) THEN WRITE(6,22) J,XX(J),YY(J),CND,HH(J),UNKWN,UNKWN ELSE IF(ID(J).EQ.3) THEN WRITE(6,23) J,XX(J),YY(J),CND,HH(J),UNKWN,QO(J) ELSE IF(ID(J).EQ.4) THEN WRITE(6,24) J,XX(J),YY(J),CND,UNKWN,QI(J),QO(J) END IF 150 CONTINUE C APPENDIX G. FORTRAN CODE 269

IF(NSS.GE.1) WRITE(6,30) WRITE(6,31) ULNG(IAU),URAT(IAU),ULNG(IAU),UPRM(IAU) DO 160 L=1,NSS WRITE(6,32) WLNAME(L),XSS(L),YSS(L),SPQ(L),RW(L),WPERM(L), * CD(L),SKIN(L) IF(SPQ(L).NE.0.0) THEN DRATE=SPQ(L) IF(IUNIT.LT.0) ICHCK=ICHCK+1 END IF 165 CONTINUE 160 CONTINUE C IF(ICHCK.GT.1) THEN WRITE(6,’(1X,40HIUNIT AND WELL SCHEME ARE NOT CONSISTENT)’) STOP END IF C WRITE(6,50) NSTEH,NGAUSS,NPNL,WSNG(ISNG+1) C IF(N.GT.NDND .OR. NSS.GT.NDSS .OR. NTIME.GT.NDTIME * .OR. NSTEH.GT.NDSTEH) THEN WRITE(6,60) STOP END IF C C======C C NON-DIMENSIONALIZATION C C======C C IF(DRATE.EQ.0) THEN CONSPD=1. ELSE CONSPD=2.*PI*APERM*RHIGHT/(CONSQ(IAU)*VIS*DRATE) END IF DO 200 I=1,N HH(I)=(PRSI-HH(I))/PREF QI(I)=QI(I)/PREF*RLNGTH QO(I)=QO(I)/PREF*RLNGTH XX(I)=XX(I)/RLNGTH YY(I)=YY(I)/RLNGTH 200 CONTINUE XX(0)=XX(N) YY(0)=YY(N) ID(0)=ID(N) C C ------CALL ANGLE C ------APPENDIX G. FORTRAN CODE 270

C DIFFA=CONST(IAU)*APERM/(APOR*VIS*COMP*TAREA) DO 210 L=1,NSS RW(L)=RW(L)/RLNGTH XSS(L)=XSS(L)/RLNGTH YSS(L)=YSS(L)/RLNGTH CD(L)=CD(L)*RW(L)*RW(L)*CONSPD*PREF SKIN(L)=SKIN(L)/(CONSPD*PREF) QCNST(L)=-CONSQ(IAU)*VIS/RHIGHT/WPERM(L)/PREF SPQ(L)=QCNST(L)*SPQ(L) ALPSS(L)=2.*PI DO 212 I=0,N-1 IF(XSS(L).EQ.XX(I) .AND. YSS(L).EQ.YY(I)) THEN ALPSS(L)=ALP(I) GO TO 210 END IF 212 CONTINUE 210 CONTINUE C DO 220 I=1,NTIME T(I)=DIFFA*T(I) 220 CONTINUE C C ------CALL HETERO(1) C ------C 10 FORMAT(///1H ,’+------+’/ * 1H ,’| CHARACTERISTIC PROPERTIES |’/ * 1H ,’+------+’// * ,1H ,3X,’ INITIAL PRESSURE :’,F10.2,1X,A5/ * ,1H ,3X,’ REFERENCE PRESSURE :’,F10.2,1X,A5/ * ,1H ,3X,’ PERMEABILITY (AVG) :’,F10.5,1X,A4/ * ,1H ,3X,’ VISCOSITY :’,F10.5,1X,A4/ * ,1H ,3X,’ POROSITY :’,F10.5,’ (FRACTION)’/ * ,1H ,3X,’ TOTAL COMPRESSIBILITY :’,E10.3,1X,A7/ * ,1H ,3X,’ RESERVOIR HEIGHT :’,F10.2,1X,A4/ * ,1H ,3X,’ RESERVOIR AREA :’,F10.0,1X,A5/ * ,1H ,3X,’ RESERVOIR BULK VOLUME :’,F10.0,1X,A5/ * ,1H ,3X,’ CHARACTERISTIC LENGTH :’,F10.2,1X,A4) 20 FORMAT(///1H ,’+------+’/ * 1H ,’| DEFINITION OF BOUNDARY NODES |’/ * 1H ,’+------+’// * 1H ,’NODE NODE LOCATION BOUNDARY ’ * ,’ POTENTIAL DP/DN (I) DP/DN (O)’/ * 1H ,’ NO. (X) ’,A4,’ (Y) TYPE ’ * ,’ ’,A5,’ ’,A8,’ ’,A8/ * 1H ,’------’ APPENDIX G. FORTRAN CODE 271

* ,’------’) 21 FORMAT(1H ,I3,3X,F10.3,1X,F10.3,2X,A11,1X,2(1X,F10.3),1X,A10) 22 FORMAT(1H ,I3,3X,F10.3,1X,F10.3,2X,A11,2X,F10.3,2(1X,A10)) 23 FORMAT(1H ,I3,3X,F10.3,1X,F10.3,2X,A11,2X,F10.3,1X,A10,1X,F10.3) 24 FORMAT(1H ,I3,3X,F10.3,1X,F10.3,2X,A11,2X,A10,2(1X,F10.3)) 25 FORMAT(1H ,I3,3X,F10.3,1X,F10.3,2X,A11,1X,3(1X,F10.3)) 30 FORMAT(///1H ,’+------+’/ * 1H ,’| DEFINITION OF SINK/SOURCE |’/ * 1H ,’+------+’/) 31 FORMAT(/1H ,’ WELL WELL LOCATION RATE ’ * ,’ RADIUS PERM. CD SKIN ’/ * 1H ,’ NAME (X) ’,A4,’ (Y) ’,A7,’ ’ * ,’ ’,A4,’ ’,A4,’ ’/ * 1H ,’------’ * ,’------’) 32 FORMAT(1H ,A10,2(1X,F9.2),1X,G10.4,1X,G8.3,1X,F8.2,2(1X,G8.3)) 50 FORMAT(///1H ,’+------+’/ * 1H ,’| PARAMETERS FOR NUMERICAL SCHEMES |’/ * 1H ,’+------+’// * ,1H ,3X,’ NO. OF SAMPLING POINTS FOR LAPLACE INVERSION’ * ,’ :’,I3/ * ,1H ,3X,’ NO. OF SAMPLING POINTS FOR GAUSS-LEGENDRE ’ * ,’INTEGRATION :’,I3/ * ,1H ,3X,’ NO. OF PANELS FOR GAUSS-LEGENDRE INTEGRATION’ * ,’ :’,I3/ * ,1H ,3X,’ WELL SINGULARITY TREATMENT ’ * ,’ :’,2X,A6) 60 FORMAT(1H ,’DIMENSION EXCEEDS CURRENT LIMIT’) RETURN END

SUBROUTINE INTGU(IND) C ********************************************************************** C ********************************************************************** C** ** C ** INTEGRATION OF SURFACE-DISTRIBUTED FUNCTION ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’coord.h’ INCLUDE ’lapvar.h’ INCLUDE ’pertub.h’ APPENDIX G. FORTRAN CODE 272

INCLUDE ’pgrad.h’ INCLUDE ’point.h’ INCLUDE ’sink.h’ INCLUDE ’trigrd.h’ C EXTERNAL BK0,BK1,FACT C DIMENSION XJJ(NDTRI,4),YJJ(NDTRI,4),DLKDX(NDTRI,4),DLKDY(NDTRI,4), * WTSUB(NDTRI,4),PK(NDTRI,4,NDPRTB),RIJ(NDVTX,NDTRI,4) C DATA PI/3.141592653589793/ C GO TO (1000,2000,2000) IND C C======C C COMPUTE INVARIANT COEFFICIENTS C C======C C 1000 CONTINUE C DO 100 K=1,NTRI K1=KK(K,1) K2=KK(K,2) K3=KK(K,3) XV1=XX(K1) YV1=YY(K1) XV2=XX(K2) YV2=YY(K2) XV3=XX(K3) YV3=YY(K3) IF(KVAR.EQ.1) THEN F1=PERM(K1) F2=PERM(K2) F3=PERM(K3) ELSE IF(KVAR.EQ.2) THEN F1=LOG(PERM(K1)) F2=LOG(PERM(K2)) F3=LOG(PERM(K3)) END IF C ------CALL TRIGRD C ------DFDXK=DFDX DFDYK=DFDY FCONK=FCON IF(PVAR.EQ.1) THEN F1=POR(K1) F2=POR(K2) APPENDIX G. FORTRAN CODE 273

F3=POR(K3) ELSE IF(PVAR.EQ.2) THEN F1=LOG(POR(K1)+1.) F2=LOG(POR(K2)+1.) F3=LOG(POR(K3)+1.) END IF C ------CALL TRIGRD C ------DFDXP=DFDX DFDYP=DFDY FCONP=FCON C ASUB=0.5*(XV2*YV3+XV1*YV2+XV3*YV1-XV2*YV1-XV3*YV2-XV1*YV3) C DO 120 MU=1,4 WT=25./48. IF(MU.EQ.1) THEN XJ=(XV1+XV2+XV3)/3. YJ=(YV1+YV2+YV3)/3. WT=-9./16. ELSE IF(MU.EQ.2) THEN XJ=0.6*XV1+0.2*XV2+0.2*XV3 YJ=0.6*YV1+0.2*YV2+0.2*YV3 ELSE IF(MU.EQ.3) THEN XJ=0.2*XV1+0.6*XV2+0.2*XV3 YJ=0.2*YV1+0.6*YV2+0.2*YV3 ELSE IF(MU.EQ.4) THEN XJ=0.2*XV1+0.2*XV2+0.6*XV3 YJ=0.2*YV1+0.2*YV2+0.6*YV3 END IF XJJ(K,MU)=XJ YJJ(K,MU)=YJ DO 125 I=1,NVTX XI=XX(I) YI=YY(I) RIJ(I,K,MU)=SQRT((XI-XJ)*(XI-XJ)+(YI-YJ)*(YI-YJ)) 125 CONTINUE WTSUB(K,MU)=WT*ASUB PRMJ=DFDXK*XJ+DFDYK*YJ+FCONK IF(KVAR.EQ.1) THEN DLKDX(K,MU)=DFDXK/PRMJ DLKDY(K,MU)=DFDYK/PRMJ PRMJ=LOG(PRMJ) ELSE IF(KVAR.EQ.2) THEN DLKDX(K,MU)=DFDXK DLKDY(K,MU)=DFDYK END IF APPENDIX G. FORTRAN CODE 274

IF(PVAR.EQ.1) THEN PORJ=DFDXP*XJ+DFDYP*YJ+FCONP ELSE IF(PVAR.EQ.2) THEN PORJ=EXP(DFDXP*XJ+DFDYP*YJ+FCONP)-1. END IF IF(ILOG.EQ.1) THEN DO 150 IPR=1,NPRMX FIPR=FLOAT(IPR) IPRM1=IPR-1 PK(K,MU,IPR)=(FIPR*PORJ*(-PRMJ)**IPRM1 * +(-PRMJ)**IPR)/FACT(FIPR) 150 CONTINUE END IF 120 CONTINUE 100 CONTINUE C RETURN C C======C C COMPUTE DOMAIN INTEGRALS C C======C C 2000 CONTINUE C IF(IND.EQ.2) THEN DO 200 I=1,NVTX UUXL(I)=0. UUYL(I)=0. DO 202 IPR=1,NPRMX UUPK(I,IPR)=0. 202 CONTINUE DO 205 K=1,NTRI UUX(I,K)=0. UUY(I,K)=0. UU(I,K)=0. 205 CONTINUE 200 CONTINUE ELSE IF(IND.EQ.3) THEN UPXL=0. UPYL=0. UPPK=0. DO 207 K=1,NTRI UPX(K)=0. UPY(K)=0. UP(K)=0. 207 CONTINUE END IF C APPENDIX G. FORTRAN CODE 275

SS=SQRT(S) C DO 210 K=1,NTRI DO 220 MU=1,4 IF(ILOG.EQ.1) THEN SP0=0. DPX=0. DPY=0. DO 230 ISS=1,NSS XJXS=XJJ(K,MU)-XSS(ISS) YJYS=YJJ(K,MU)-YSS(ISS) R=SQRT(XJXS*XJXS+YJYS*YJYS) QSS=SPQ(ISS)/(2.*PI*S) SP0=SP0-S*QSS*BK0(R*SS) DPX=DPX+QSS*SS*XJXS/R*BK1(R*SS) DPY=DPY+QSS*SS*YJYS/R*BK1(R*SS) 230 CONTINUE END IF IF(IND.EQ.2) THEN DO 250 I=1,NVTX BK0RS=WTSUB(K,MU)*BK0(RIJ(I,K,MU)*SS) UUX(I,K)=UUX(I,K)+BK0RS*DLKDX(K,MU) UUY(I,K)=UUY(I,K)+BK0RS*DLKDY(K,MU) UU(I,K)=UU(I,K)+BK0RS IF(ILOG.EQ.1) THEN UUXL(I)=UUXL(I)+BK0RS*DLKDX(K,MU)*DPX UUYL(I)=UUYL(I)+BK0RS*DLKDY(K,MU)*DPY DO 255 IPR=1,NPRMX UUPK(I,IPR)=UUPK(I,IPR)+BK0RS*SP0*PK(K,MU,IPR) 255 CONTINUE END IF 250 CONTINUE ELSE IF(IND.EQ.3) THEN XIXJ=XI-XJJ(K,MU) YIYJ=YI-YJJ(K,MU) R=SQRT(XIXJ*XIXJ+YIYJ*YIYJ) BK0RS=WTSUB(K,MU)*BK0(R*SS) UPX(K)=UPX(K)+BK0RS*DLKDX(K,MU) UPY(K)=UPY(K)+BK0RS*DLKDY(K,MU) UP(K)=UP(K)+BK0RS IF(ILOG.EQ.1) THEN UPXL=UPXL+BK0RS*DLKDX(K,MU)*DPX UPYL=UPYL+BK0RS*DLKDY(K,MU)*DPY DO 265 IPR=1,IPRTB UPPK=UPPK+BK0RS*SP0*PK(K,MU,IPR) 265 CONTINUE END IF END IF APPENDIX G. FORTRAN CODE 276

220 CONTINUE 210 CONTINUE C RETURN END

SUBROUTINE INTGVW C ********************************************************************** C ********************************************************************** C** ** C ** INTEGRALS V AND W ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’intgvw.h’ INCLUDE ’coord.h’ INCLUDE ’gauss.h’ INCLUDE ’lapvar.h’ C EXTERNAL BK0,BK1,RK0,RXK0,RK1,RINTK C DATA EPS/1.0D-6/ C SS=SQRT(S) AETA=ABS(ETA) AXI1=ABS(XI1) AXI2=ABS(XI2) XID=XI2-XI1 SQXE1=XI1*XI1+ETA*ETA SQXE2=XI2*XI2+ETA*ETA C IF(AXI1.LT.EPS .AND. AETA.LT.EPS) THEN W1=0. W2=0. RIXK0=1.0/S-AXI2/SS*BK1(AXI2*SS) RIK0=-RINTK(AXI2*SS)/SS V1=(-XI2*RIK0+RIXK0)/XID V2=-RIXK0/XID ELSE IF(AXI2.LT.EPS .AND. AETA.LT.EPS) THEN W1=0. W2=0. RIXK0=-1.0/S+AXI1/SS*BK1(AXI1*SS) RIK0=-RINTK(AXI1*SS)/SS APPENDIX G. FORTRAN CODE 277

V1=RIXK0/XID V2=(XI1*RIK0-RIXK0)/XID ELSE CALL GAUSS(2,NGAUSS,NPNL,RK0,XI1,XI2,RIK0) CALL GAUSS(2,NGAUSS,NPNL,RXK0,XI1,XI2,RIXK0) CALL GAUSS(2,NGAUSS,NPNL,RK1,XI1,XI2,RIK1) RIXK1=(RK0(XI1)-RK0(XI2))/SS V1=(-XI2*RIK0+RIXK0)/XID V2=(XI1*RIK0-RIXK0)/XID W1=ETA*SS*(XI2*RIK1-RIXK1)/XID W2=ETA*SS*(-XI1*RIK1+RIXK1)/XID ENDIF C RETURN END

SUBROUTINE LAPINV(IND,F,FINV,DFINV) C ********************************************************************** C ********************************************************************** C** ** C ** LAPLACE TRANSFORM INVERSION ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’lapvar.h’ C DIMENSION G(0:NDSTEH),H(NDSTEH/2),V(NDSTEH) C GO TO (1000,2000) IND C C======C C COEFFICIENTS FOR THE STEHFEST ALGORITHM C C======C C 1000 CONTINUE C 100 G(0)=1.0 NH=NSTEH/2 SN=2*MOD(NH,2)-1 DO 110 I=1,NSTEH G(I)=G(I-1)*I 110 CONTINUE H(1)=2.0/G(NH-1) APPENDIX G. FORTRAN CODE 278

DO 120 I=2,NH FI=FLOAT(I) H(I)=FI**NH*G(2*I)/G(NH-I)/G(I)/G(I-1) 120 CONTINUE DO 150 I=1,NSTEH V(I)=0.0 KBG=(I+1)/2 KND=MIN0(I,NH) DO 155 K=KBG,KND V(I)=V(I)+H(K)/G(I-K)/G(2*K-I) 155 CONTINUE V(I)=SN*V(I) SN=-SN 150 CONTINUE C RETURN C C======C C LAPLACE TRANSFORM INVERSION C C======C C 2000 CONTINUE C IF(ISTEH.EQ.1) THEN FINV=0.0 DFINV=0.0 END IF FINV=FINV+V(ISTEH)*F DFINV=DFINV+V(ISTEH)*S*F IF(ISTEH.EQ.NSTEH) THEN FINV=FINV*VMOD DFINV=DFINV*VMOD END IF C RETURN END

SUBROUTINE MATRIX C ********************************************************************** C ********************************************************************** C** ** C ** MATRIX CONSTRUCTION ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) APPENDIX G. FORTRAN CODE 279

C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’lapvar.h’ INCLUDE ’matrix.h’ INCLUDE ’sink.h’ C DATA PI/3.141592653589793/ C N1=N C DO 100 I=1,N RHS(I)=0.0 C C <<< BOUNDARY NODE TO BONUDARY ELEMENT >>> C DO 150 J=1,N HHS=HH(J)/S-PW(J,ISTEH) QIS=QI(J)/S-PWI(J,ISTEH) QOS=QO(J)/S-PWO(J,ISTEH) DIJ=0. IF(I.EQ.J) DIJ=1. IF(ID(J).EQ.1) THEN AMAT(I,J,ISTEH)=VO(I,J) RHS(I)=RHS(I)+(WW(I,J)+DIJ*ALP(I))*HHS-VI(I,J)*QIS ELSE IF(ID(J).EQ.2) THEN AMAT(I,J,ISTEH)=VI(I,J)+VO(I,J) RHS(I)=RHS(I)+(WW(I,J)+DIJ*ALP(I))*HHS ELSE IF(ID(J).EQ.3) THEN AMAT(I,J,ISTEH)=VI(I,J) RHS(I)=RHS(I)+(WW(I,J)+DIJ*ALP(I))*HHS-VO(I,J)*QOS ELSE IF(ID(J).EQ.4) THEN AMAT(I,J,ISTEH)=-WW(I,J)-DIJ*ALP(I) RHS(I)=RHS(I)-VI(I,J)*QIS-VO(I,J)*QOS END IF 150 CONTINUE C C <<< BOUNDARY NODE TO SINK-SOURCE >>> C IF(ISNG.EQ.0) RHS(I)=RHS(I)+QB(I) C 100 CONTINUE C RETURN END APPENDIX G. FORTRAN CODE 280

SUBROUTINE PADE(IND,N,M,PPADE,PAPPX) C ********************************************************************** C ********************************************************************** C** ** C ** PADE APPROXIMANTS ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ C DIMENSION PPADE(0:NDPRTB),C(NDVTX,0:NDPRTB,0:NDPRTB), * R(NDVTX,-1:NDPRTB),S(NDVTX,-1:NDPRTB), * A(NDPRTB/2+2,NDPRTB/2+2),B(NDPRTB/2+2), * IPVT(NDPRTB/2+2),AA(NDPRTB/2+2) C DATA EPS/1.0D-25/ C GO TO (1000,2000) IND C C======C C QD ALGORITHM C C======C C 1000 CONTINUE C NN=1 IF(N.LE.0) THEN N=-N NN=N END IF C DO 100 J=NN-1,N-1 C(M,J,0)=0. C(M,J,1)=PPADE(J+1)/(PPADE(J)+EPS) 100 CONTINUE C DO 150 I=2,N L=2*(I/2) DO 160 J=N-I,0,-1 IF(I.EQ.L) THEN C(M,J,I)=C(M,J+1,I-2)+C(M,J+1,I-1)-C(M,J,I-1) ELSE C(M,J,I)=C(M,J+1,I-1)*C(M,J+1,I-2)/(C(M,J,I-1)+EPS) END IF IF(NN.EQ.N) GOTO 150 APPENDIX G. FORTRAN CODE 281

160 CONTINUE 150 CONTINUE C IF(NN.EQ.1) THEN R(M,0)=PPADE(0) R(M,-1)=0. S(M,0)=1. S(M,-1)=1. END IF C DO 180 I=NN,N R(M,I)=R(M,I-1)-C(M,0,I)*R(M,I-2) S(M,I)=S(M,I-1)-C(M,0,I)*S(M,I-2) 180 CONTINUE C PAPPX=R(M,N)/S(M,N) C RETURN C C======C C DIRECT PADE APPROXIMANTS C C======C C 2000 CONTINUE C IF(N.EQ.1) THEN PAPPX=PPADE(0)*PPADE(0)/(PPADE(0)-PPADE(1)+EPS) RETURN END IF C NN=N/2 MM=N-NN C DO 200 I=1,MM B(I)=-PPADE(NN+I) DO 200 J=1,MM A(I,J)=PPADE(NN+I-J) 200 CONTINUE C IPVT(MM)=1 IF(MM.EQ.1) GOTO 260 MM1=MM-1 DO 210 K=1,MM1 KP1=K+1 L=K DO 215 I=KP1,MM IF(ABS(A(I,K)).GT.ABS(A(L,K))) L=I 215 CONTINUE APPENDIX G. FORTRAN CODE 282

IPVT(K)=L IF(L.NE.K) IPVT(MM)=-IPVT(MM) T=A(L,K) A(L,K)=A(K,K) A(K,K)=T IF(T.EQ.0.) GOTO 210 DO 220 I=KP1,MM A(I,K)=-A(I,K)/T 220 CONTINUE DO 230 J=KP1,MM T=A(L,J) A(L,J)=A(K,J) A(K,J)=T IF(T.EQ.0.) GOTO 230 DO 235 I=KP1,MM A(I,J)=A(I,J)+A(I,K)*T 235 CONTINUE 230 CONTINUE 210 CONTINUE C DO 240 K=1,MM1 KP1=K+1 L=IPVT(K) T=B(L) B(L)=B(K) B(K)=T DO 245 I=KP1,MM B(I)=B(I)+A(I,K)*T 245 CONTINUE 240 CONTINUE C DO 250 KB=1,MM1 KM1=MM-KB K=KM1+1 B(K)=B(K)/A(K,K) T=-B(K) DO 255 I=1,KM1 B(I)=B(I)+A(I,K)*T 255 CONTINUE 250 CONTINUE C 260 B(1)=B(1)/A(1,1) C DO 270 L=1,NN DO 270 I=0,L IF(I.EQ.0) THEN AA(L)=PPADE(L) ELSE APPENDIX G. FORTRAN CODE 283

AA(L)=AA(L)+PPADE(L-I)*B(I) END IF 270 CONTINUE RR=PPADE(0) SS=1. DO 280 I=1,NN RR=RR+AA(I) 280 CONTINUE DO 285 I=1,MM SS=SS+B(I) 285 CONTINUE C PAPPX=RR/SS C RETURN END

SUBROUTINE PGRAD C ********************************************************************** C ********************************************************************** C** ** C ** INTERIOR SOLUTION ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’lapvar.h’ INCLUDE ’pertub.h’ INCLUDE ’pgrad.h’ INCLUDE ’sink.h’ INCLUDE ’trigrd.h’ DATA PI/3.141592653589793/ C PP=0. DO 100 J=1,N HHS=HH(J)/S-PW(J,ISTEH) QIS=QI(J)/S-PWI(J,ISTEH) QOS=QO(J)/S-PWO(J,ISTEH) IF(ID(J).EQ.1) THEN PP=PP+VIP(J)*QIS+VOP(J)*HQN(J,ISTEH)-WWP(J)*HHS ELSE IF(ID(J).EQ.2) THEN PP=PP+(VIP(J)+VOP(J))*HQN(J,ISTEH)-WWP(J)*HHS ELSE IF(ID(J).EQ.3) THEN APPENDIX G. FORTRAN CODE 284

PP=PP+VIP(J)*HQN(J,ISTEH)+VOP(J)*QOS-WWP(J)*HHS ELSE IF(ID(J).EQ.4) THEN PP=PP+VIP(J)*QIS+VOP(J)*QOS-WWP(J)*HQN(J,ISTEH) END IF 100 CONTINUE C IF(NPRMX.GT.0) THEN DO 115 K=1,NTRI PP=PP-UP(K)*SMLKPN(K,ISTEH) * +UPX(K)*GPXN(K,ISTEH)+UPY(K)*GPYN(K,ISTEH) 115 CONTINUE IF(ILOG.EQ.1) PP=PP-UPPK+UPXL+UPYL END IF C PP=PP/ALPHA-QWPQ/(2.*PI) C RETURN END

SUBROUTINE READC C ********************************************************************** C ********************************************************************** C** ** C ** SKIP COMMENT CARDS ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C CHARACTER IC*1 C DO 10 I=1,50 READ(5,’(A)’) IC IF(IC.NE.’/’) THEN BACKSPACE 5 RETURN END IF 10 CONTINUE C WRITE(6,1000) 1000 FORMAT(1X,’COMMENT CARDS SHOULD BE LESS THAN 50 IN A SERIES’) RETURN END APPENDIX G. FORTRAN CODE 285

SUBROUTINE SINK C ********************************************************************** C ********************************************************************** C** ** C ** WELL SINGULARITY TREATMENT ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’coord.h’ INCLUDE ’lapvar.h’ INCLUDE ’point.h’ INCLUDE ’sink.h’ C EXTERNAL BK0,BK1 C DATA EPS/1.D-8/ DATA PI/3.141592653589793/ C DO 100 J=1,N PW(J,ISTEH)=0. PWO(J,ISTEH)=0. PWI(J,ISTEH)=0. 100 CONTINUE PW(0,ISTEH)=0. PWO(0,ISTEH)=0. SS=SQRT(S) C DO 150 ISS=1,NSS XI=XSS(ISS) YI=YSS(ISS) DO 160 J=0,N-1 XJ1=XX(J) YJ1=YY(J) XJ2=XX(J+1) YJ2=YY(J+1) XIXJ1=XI-XJ1 YIYJ1=YI-YJ1 XIXJ2=XI-XJ2 YIYJ2=YI-YJ2 C ------CALL COORD C ------R1=SQRT(XIXJ1*XIXJ1+YIYJ1*YIYJ1) APPENDIX G. FORTRAN CODE 286

R2=SQRT(XIXJ2*XIXJ2+YIYJ2*YIYJ2) IF(R1.LT.RW(ISS)) R1=RW(ISS) IF(R2.LT.RW(ISS)) R2=RW(ISS) QSS=SPQ(ISS)/(2.*PI*S) PW(J,ISTEH)=PW(J,ISTEH)-QSS*BK0(R1*SS) PWO(J,ISTEH)=PWO(J,ISTEH)+QSS*SS*ETA/R1*BK1(R1*SS) PWI(J+1,ISTEH)=PWI(J+1,ISTEH)+QSS*SS*ETA/R2*BK1(R2*SS) 160 CONTINUE 150 CONTINUE PW(N,ISTEH)=PW(0,ISTEH) PWO(N,ISTEH)=PWO(0,ISTEH) C RETURN END

SUBROUTINE SOLVE C ********************************************************************** C ********************************************************************** C** ** C ** LINEAR SYSTEM SOLUTION ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’lapvar.h’ INCLUDE ’matrix.h’ INCLUDE ’pertub.h’ C IF(N1.EQ.1) GOTO 500 NM1=N1-1 DO 200 K=1,NM1 KP1=K+1 M=IPVT(K,ISTEH) TT=RHS(M) RHS(M)=RHS(K) RHS(K)=TT DO 100 I=KP1,N1 RHS(I)=RHS(I)+AMAT(I,K,ISTEH)*TT 100 CONTINUE 200 CONTINUE C DO 400 KB=1,NM1 KM1=N1-KB APPENDIX G. FORTRAN CODE 287

K=KM1+1 RHS(K)=RHS(K)/AMAT(K,K,ISTEH) TT=-RHS(K) DO 300 I=1,KM1 RHS(I)=RHS(I)+AMAT(I,K,ISTEH)*TT 300 CONTINUE 400 CONTINUE C 500 RHS(1)=RHS(1)/AMAT(1,1,ISTEH) C DO 600 I=1,N HQ(I,IPRTB,ISTEH)=RHS(I) IF(IPRTB.EQ.0) HQN(I,ISTEH)=RHS(I) 600 CONTINUE C RETURN END

SUBROUTINE TRIGRD C ********************************************************************** C ********************************************************************** C** ** C ** GRADIENT OVER TRIANGLE ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’trigrd.h’ C DEN=(XV1-XV2)*(YV2-YV3)-(XV2-XV3)*(YV1-YV2) XNUM=(F1-F2)*(YV2-YV3)-(F2-F3)*(YV1-YV2) YNUM=-(F1-F2)*(XV2-XV3)+(F2-F3)*(XV1-XV2) DFDX=XNUM/DEN DFDY=YNUM/DEN FCON=F1-DFDX*XV1-DFDY*YV1 C RETURN END APPENDIX G. FORTRAN CODE 288

SUBROUTINE WELL C ********************************************************************** C ********************************************************************** C** ** C ** SINK/SOURCE STRENGTH ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C INCLUDE ’param.h’ INCLUDE ’lapvar.h’ INCLUDE ’point.h’ INCLUDE ’sink.h’ C EXTERNAL BK0 C DATA PI/3.141592653589793/ C QWPQ=0. SS=SQRT(S) DO 100 ISS=1,NSS XJ=XSS(ISS) YJ=YSS(ISS) XIXJ=XI-XJ YIYJ=YI-YJ R=SQRT(XIXJ*XIXJ+YIYJ*YIYJ) IF(R.LT.RW(ISS)) R=RW(ISS) QWPQ=QWPQ+SPQ(ISS)/S*BK0(R*SS) 100 CONTINUE C RETURN END

SUBROUTINE WELSUM C ********************************************************************** C ********************************************************************** C** ** C ** SINK/SOURCE SUMMARY ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) CHARACTER WELLN*5,NUMBER*40,FNAME*7 C APPENDIX G. FORTRAN CODE 289

INCLUDE ’param.h’ INCLUDE ’lapvar.h’ INCLUDE ’nond.h’ INCLUDE ’pertub.h’ INCLUDE ’pgrad.h’ INCLUDE ’point.h’ INCLUDE ’sink.h’ INCLUDE ’unit.h’ C CHARACTER PDP*21,BAR*10,BAR21*21,DLESS*8 DIMENSION POUT(NDSS,NDTIME),DPOUT(NDSS,NDTIME),IPRM(NDTIME), * IU(NDSS) DATA PDP/’ PRESSURE DERIVATIVE’/ DATA BAR/’------’/ DATA BAR21/’------’/ DATA DLESS/’(DIMLES)’/ DATA WELLN/’well-’/ DATA NUMBER/’0102030405060708091011121314151617181920’/ DATA PI/3.141592653589793/ C IPRM(ITIME)=IPRTB-1 C DO 100 L=1,NSS XI=XSS(L) YI=YSS(L) ALPHA=ALPSS(L) IF(LOCSS(L).LT.0) THEN POUT(L,ITIME)=PSS(L,1) DPOUT(L,ITIME)=PSS(L,2) GOTO 100 END IF DO 110 ISTEH=1,NSTEH S=VMOD*ISTEH IF(LOCSS(L).EQ.0) THEN C ------CALL COEFF CALL INTGU(3) CALL WELL CALL PGRAD C ------ELSE PP=PSS(L,ISTEH) END IF C C ... INCLUSION OF WELLBORE STORAGE AND SKIN ... C PP=1.0/(CD(L)*S*S+S/(SKIN(L)+S*PP)) C ------APPENDIX G. FORTRAN CODE 290

CALL LAPINV(2,PP,PWR,DPWR) C ------110 CONTINUE POUT(L,ITIME)=PWR DPOUT(L,ITIME)=DPWR 100 CONTINUE C CONSP=CONSPD*PREF IF(IOUT.GE.1) THEN IF(ITIME.EQ.1) THEN DO 150 L=1,NSS IU(L)=10+L FNAME=WELLN//NUMBER(2*L-1:2*L) OPEN(UNIT=IU(L),FILE=FNAME) 150 CONTINUE END IF TT=T(ITIME) IF(IUNIT.GT.0) THEN DO 153 L=1,NSS WRITE(IU(L),*) TT/DIFFA, * PRSI-PREF*POUT(L,ITIME),-PREF*DPOUT(L,ITIME)*TT 153 CONTINUE ELSE DO 155 L=1,NSS WRITE(IU(L),*) TT, * CONSP*POUT(L,ITIME),CONSP*DPOUT(L,ITIME)*TT 155 CONTINUE END IF END IF C IF(ITIME.LT.NTIME) RETURN C MMAX=0 188 MMIN=MMAX+1 MMAX=MMIN+2 MN1=NSS-MMIN IF(MN1.LT.3) MMAX=NSS WRITE(6,11) (WLNAME(L),L=MMIN,MMAX) WRITE(6,12) (BAR21,L=MMIN,MMAX) WRITE(6,13) (PDP,L=MMIN,MMAX) IF(IUNIT.GT.0) THEN WRITE(6,14) UTIM(IUNIT),(UPRS(IUNIT),L=MMIN,MMAX) ELSE WRITE(6,15) DLESS,(DLESS,L=MMIN,MMAX) END IF WRITE(6,16) (BAR,L=1,2*(MMAX-MMIN+1)) DO 180 IT=1,NTIME TT=T(IT) APPENDIX G. FORTRAN CODE 291

IF(IUNIT.GT.0) THEN WRITE(6,17) TT/DIFFA,IPRM(IT), * (PRSI-PREF*POUT(L,IT),-PREF*DPOUT(L,IT)*TT,L=MMIN,MMAX) ELSE WRITE(6,17) TT,IPRM(IT), * (CONSP*POUT(L,IT),CONSP*DPOUT(L,IT)*TT,L=MMIN,MMAX) END IF 180 CONTINUE IF(MMAX.LT.NSS) GOTO 188 C 10 FORMAT(//1H ,’+------+’/ * 1H ,’| SOLUTIONS OF SINK/SOURCE |’/ * 1H ,’+------+’) 11 FORMAT(//1H ,’ ’,3(1X,’ ’,A10,’ ’)) 12 FORMAT(1H ,’ ’,3(1X,A21)) 13 FORMAT(1H ,’ TIME PRT’,3(1X,A21)) 14 FORMAT(1H ,’ ’,A5,’ NO.’,3(1X,’ ’,A5,’ T(DP/DT) ’)) 15 FORMAT(1H ,A8,’ NO.’,3(1X,’ ’,A8,’ T(DP/DT) ’)) 16 FORMAT(1H ,’------’,3(1X,A10,1X,A10)) 17 FORMAT(1H ,G9.3,1X,I2,1X,3(1X,G10.4,1X,G10.4)) C RETURN END

DOUBLE PRECISION FUNCTION BK0(X) C ********************************************************************** C ********************************************************************** C** ** C ** SECOND KIND MODIFIED BESSEL FUNCTION OF ORDER ZERO ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C DATA P1,P2,P3,P4,P5,P6,P7/ * -0.57721566, 0.42278420, 0.23069756, 0.03488590, 0.00262698, * 0.00010750, 0.00000740/ DATA Q1,Q2,Q3,Q4,Q5,Q6,Q7/ * 1.25331414,-0.07832358, 0.02189568,-0.01062446, 0.00587872, * -0.00251540, 0.00053208/ DATA R1,R2,R3,R4,R5,R6,R7/ * 1.0000000, 3.5156229, 3.0899424, 1.2067492, 0.2659732, * 0.0360768, 0.0045813/ C IF(X.LE.2.0) THEN Y=0.25*X*X APPENDIX G. FORTRAN CODE 292

YY=(X/3.75)*(X/3.75) BESSI0=R1+YY*(R2+YY*(R3+YY*(R4+YY*(R5+YY*(R6+YY*R7))))) BK0=-LOG(0.5*X)*BESSI0 * +P1+Y*(P2+Y*(P3+Y*(P4+Y*(P5+Y*(P6+Y*P7))))) ELSE Y=2.0/X BK0=EXP(-X)/SQRT(X) * *(Q1+Y*(Q2+Y*(Q3+Y*(Q4+Y*(Q5+Y*(Q6+Y*Q7)))))) END IF RETURN END

DOUBLE PRECISION FUNCTION BK1(X) C ********************************************************************** C ********************************************************************** C** ** C ** SECOND KIND MODIFIED BESSEL FUNCTION OF ORDER ONE ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C DATA P1,P2,P3,P4,P5,P6,P7/ * 1.00000000, 0.15443144,-0.67278579,-0.18156897,-0.01919402, * -0.00110404,-0.00004686/ DATA Q1,Q2,Q3,Q4,Q5,Q6,Q7/ * 1.25331414, 0.23498619,-0.03655620, 0.01504268,-0.00780353, * 0.00325614,-0.00068245/ DATA R1,R2,R3,R4,R5,R6,R7/ * 0.50000000, 0.87890594, 0.51498869, 0.15084934, 0.02658733, * 0.00301532, 0.00032411/ C IF(X.LE.2.0) THEN Y=0.25*X*X YY=(X/3.75)*(X/3.75) BESSI1=X*(R1+YY*(R2+YY*(R3+YY*(R4+YY*(R5+YY*(R6+YY*R7)))))) BK1=LOG(0.5*X)*BESSI1 * +(P1+Y*(P2+Y*(P3+Y*(P4+Y*(P5+Y*(P6+Y*P7))))))/X ELSE Y=2.0/X BK1=EXP(-X)/SQRT(X) * *(Q1+Y*(Q2+Y*(Q3+Y*(Q4+Y*(Q5+Y*(Q6+Y*Q7)))))) END IF RETURN END APPENDIX G. FORTRAN CODE 293

DOUBLE PRECISION FUNCTION RK0(X) C ********************************************************************** C ********************************************************************** C** ** C ** INTEGRAND K0 ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C EXTERNAL BK0 INCLUDE ’param.h’ INCLUDE ’coord.h’ INCLUDE ’lapvar.h’ C SS=SQRT(S) R=SQRT(X*X+ETA*ETA) RK0=BK0(SS*R) RETURN END

DOUBLE PRECISION FUNCTION RXK0(X) C ********************************************************************** C ********************************************************************** C** ** C ** INTEGRAND XI*K0 ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C EXTERNAL BK0 INCLUDE ’param.h’ INCLUDE ’coord.h’ INCLUDE ’lapvar.h’ C SS=SQRT(S) R=SQRT(X*X+ETA*ETA) RXK0=X*BK0(SS*R) RETURN END APPENDIX G. FORTRAN CODE 294

DOUBLE PRECISION FUNCTION RK1(X) C ********************************************************************** C ********************************************************************** C** ** C ** INTEGRAND K1/R ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C EXTERNAL BK1 INCLUDE ’param.h’ INCLUDE ’coord.h’ INCLUDE ’lapvar.h’ C SS=SQRT(S) R=SQRT(X*X+ETA*ETA) RK1=BK1(SS*R)/R RETURN END

DOUBLE PRECISION FUNCTION RINTK(X) C ********************************************************************** C ********************************************************************** C** ** C ** INTEGRAL OF BESSEL FUNCTION K0 ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) DATA PI/3.141592653589793D0/ DATA GAMMA/0.57721566490153D0/ C RINTK=0.0D0 C IF(X.LT.12.0) THEN SUMINV=0.0 RINTK=X*(-GAMMA-LOG(0.5*X)+1.0) DO 100 K=1,1000 FK=FLOAT(K) SUMINV=SUMINV+1.0/FK RADD=X*(0.5*X)**(2*K)/FACT(FK)/FACT(FK)/(2.0*FK+1.0) * *(-GAMMA-LOG(0.5*X)+1.0/(2.0*FK+1.0)+SUMINV) RINTK=RINTK+RADD IF(RINTK/RADD.GT.1.0D+16) RETURN APPENDIX G. FORTRAN CODE 295

100 CONTINUE WRITE(6,99) STOP ELSE IF(X.LT.50.0) THEN ASSYM=SQRT(0.5*PI/X)*EXP(-X) AKM1=1.0 AK=0.625 RINTK=ASSYM*(AKM1-AK/X) DO 200 K=2,1000 FK=FLOAT(K-1) AKP1=(1.5*AK*(FK+0.5)*(FK+5.0/6.0) * -0.5*AKM1*(FK+0.5)*(FK+0.5)*(FK-0.5))/(FK+1.0) RADD=ASSYM*(-1.0/X)**K*AKP1 RINTK=RINTK+RADD IF(ABS(0.5*PI/RADD) .GT. 1.0D+10) THEN RINTK=0.5*PI-RINTK RETURN END IF AKM1=AK AK=AKP1 200 CONTINUE WRITE(6,99) STOP ELSE RINTK=0.5*PI RETURN END IF C 99 FORMAT(1X,’ERROR IN RINTK’) END

DOUBLE PRECISION FUNCTION FACT(W) C ********************************************************************** C ********************************************************************** C** ** C ** FACTORIAL ** C** ** C ********************************************************************** C ** BEMPER-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) C IF(W.GT.56) THEN WRITE(6,99) STOP END IF FACT=1.0 APPENDIX G. FORTRAN CODE 296

IF(W.LE.1.0D-4) RETURN X=0.0 100 X=X+1.0 FACT=FACT*X IF(ABS(X-W).GE.1.0D-4) GOTO 100 C 99 FORMAT(1X,’FACTORIAL ARGUMANT TOO LARGE’) RETURN END

FORTRAN Code of the Streamline-Tracking Routine

SUBROUTINE STREAM(IND) C ********************************************************************** C ********************************************************************** C** ** C ** STREAMLINE TRACKING ** C** ** C ********************************************************************** C ** STREAM-SUB ******************************************************** C IMPLICIT REAL*8(A-H,O-Z) CHARACTER ACTIDL*6,ISTEP*36 C INCLUDE ’param.h’ INCLUDE ’bndemt.h’ INCLUDE ’coord.h’ INCLUDE ’nond.h’ INCLUDE ’pertub.h’ INCLUDE ’pgrad.h’ INCLUDE ’point.h’ INCLUDE ’intgvw.h’ INCLUDE ’sink.h’ INCLUDE ’trigrd.h’ INCLUDE ’plot.h’ INCLUDE ’wcross.h’ C LOGICAL IWL,ICROSS DIMENSION NPNTTL(NDSS),NEULER(NDSS) DIMENSION XSL(NDSL),YSL(NDSL),NW(NDSS) DIMENSION IFIL(NDSL),BTTIME(NDSL),VELSLG(NDSL) DATA EPSD/5.D-2/

GO TO (1000,2000) IND C C======C APPENDIX G. FORTRAN CODE 297

C DATA INPUT C C======C C 1000 CONTINUE CALL READC READ(5,*) NWELL IF(NWELL.EQ.0) RETURN IWL=.FALSE. IF(NWELL.GT.0) IWL=.TRUE. NWELL=ABS(NWELL) CALL READC READ(5,*) (NW(I),I=1,NWELL) CALL READC IF(IWL) THEN READ(5,*) (NSLW(I),I=1,NWELL) ELSE DO 102 I=1,NWELL READ(5,*) XSL(I),YSL(I) XSL(I)=XSL(I)/RLNGTH YSL(I)=YSL(I)/RLNGTH NSLW(I)=1 102 CONTINUE END IF CALL READC READ(5,*) DXYLIM,DXYCOR CALL READC READ(5,*) IEULER,DIRLIM DIRLIM=DIRLIM*PI/180. CALL READC READ(5,*) NTIME IF(NTIME.GT.0) THEN CALL READC READ(5,*) (TIMEFT(I),I=1,NTIME) DO 104 I=1,NWELL WELTMP=WELTMP+ABS(SPQ(NW(I)))*ALPSS(NW(I))*WPERM(NW(I)) 104 CONTINUE WELTMP=WELTMP/(2.*PI) DO 105 I=1,NTIME TIMEFT(I)=TIMEFT(I)/WELTMP 105 CONTINUE END IF CALL READC READ(5,*) ITRACE IF(ITRACE.EQ.1 .AND. NWELL.GT.1) THEN WRITE(6,15) STOP END IF C APPENDIX G. FORTRAN CODE 298

IF(.NOT.IWL) RETURN C L=0 DO 100 I=1,NWELL IW=ABS(NW(I)) DR=RW(IW) DA=ALPSS(IW)/NSLW(I) DO 110 J=1,NSLW(I) L=L+1 ANGL=DA*FLOAT(J)-.5*DA XSL(L)=XSS(IW)+DR*COS(ANGL) YSL(L)=YSS(IW)+DR*SIN(ANGL) 110 CONTINUE 100 CONTINUE C RETURN C C======C C STREAMLINE TRACKING C C======C C 2000 CONTINUE IF(NWELL.EQ.0) RETURN C NPNTMX=INT(3./DXYLIM) I=0 DO 210 NNN=1,NWELL IW=ABS(NW(NNN)) NPNTTL(NNN)=0 NEULER(NNN)=0 DO 220 ISL=1,NSLW(NNN) TIME=0. I=I+1 IFIL(I)=0 WRITE(99,*) I XI=XSL(I) YI=YSL(I) WRITE(8,*) XI,YI,TIME DISN=1.D+5 NPNT=1 PERMA=APERM C C <<< TRACKING LOOP >>> C 201 CONTINUE IF(NPNT.GE.NPNTMX) GOTO 299 C C ... PERMEABILITY INTERPOLATION ... APPENDIX G. FORTRAN CODE 299

C IF(NPRMX.GT.0 .AND. (NTIME.GT.0 .OR. ITRACE.EQ.1)) THEN C ------CALL KINTPL(ISL,PERMA) C ------IF(PERMA.EQ.0) PERMA=1.D+5 END IF C C ... COMPUTE PRESSURE GRADIENT AND VELOCITY ... C C ------CALL COEFF(2) CALL WELL(2) C ------IF(IFAIL) THEN IFIL(I)=1 DO 225 L=1,NSS IF(L.EQ.IW) GO TO 225 DIS=SQRT((XI-XSS(L))*(XI-XSS(L)) * +(YI-YSS(L))*(YI-YSS(L))) IF(DIS.LT.(2.*DXYLIM)) IFIL(I)=0 225 CONTINUE GOTO 299 END IF C ------CALL PGRAD(2) C ------C VELX=-DPDX*PERMA VELY=-DPDY*PERMA IF(NW(NNN).LT.0) THEN VELX=-VELX VELY=-VELY END IF C C ... SET TIME STEP SIZE ... C DXY=SQRT(VELX*VELX+VELY*VELY) DT=DXYLIM/DXY C C ... MODIFIED EULER’S METHOD ... C IF(IEULER.EQ.1) THEN DIR=ATAN(VELY/VELX) IF(NPNT.GT.1 .AND. ABS(DIR-DIRO).LT.DIRLIM) THEN DIRO=DIR ELSE VELXO=VELX APPENDIX G. FORTRAN CODE 300

VELYO=VELY XIO=XI YIO=YI XI=XI+VELX*DT YI=YI+VELY*DT C ------CALL COEFF(2) CALL WELL(2) CALL PGRAD(2) C ------VELX=-DPDX*PERMA VELY=-DPDY*PERMA XI=XIO YI=YIO IF(VELXO*VELX.GT.0. .AND. VELYO*VELY.GT.0.) THEN VELX=0.5*(VELX+VELXO) VELY=0.5*(VELY+VELYO) DXY=SQRT(VELX*VELX+VELY*VELY) DT=DXYLIM/DXY NEULER(NNN)=NEULER(NNN)+1 ELSE VELX=VELXO VELY=VELYO END IF DIRO=ATAN(VELY/VELX) END IF END IF C C ... UPDATE TIME AND DISPLACING FRONT LOCATION ... C TIME=TIME+DT DX=VELX*DT DY=VELY*DT XI=XI+DX YI=YI+DY IF(ITRACE.EQ.1 .AND. NPNT.EQ.1) THEN VELSLG(I)=SQRT(VELX*VELX+VELY*VELY) VELT=VELT+VELSLG(I) END IF C C ... CHECK IF THE FRONT REACHES THE WELL ... C DISM=1.D+5 ICROSS=.FALSE. C DO 240 L=1,NSS IF(L.EQ.IW) GO TO 240 DIS=SQRT((XI-XSS(L))*(XI-XSS(L)) APPENDIX G. FORTRAN CODE 301

* +(YI-YSS(L))*(YI-YSS(L))) IF(DIS.LT.DISM) DISM=DIS IF(DIS.LE.RW(L)) ICROSS=.TRUE. 240 CONTINUE C C ... OUTPUT IF THE FRONT REACHES THE WELL ... C IF((NSS.GT.0 .AND. (DISM.LT.DXYLIM .AND. DISM.GT.DISN)) * .OR. ICROSS) GO TO 299 DISN=DISM C NPNT=NPNT+1 WRITE(8,*) XI,YI,TIME C GO TO 201 C 299 CONTINUE C WRITE(9,*) NPNT NPNTTL(NNN)=NPNTTL(NNN)+NPNT 220 CONTINUE 210 CONTINUE C C <<< SUMMARY OUTPUT >>> C WRITE(6,20) IF(IWL) THEN WRITE(6,21) NWELL DO 280 I=1,NWELL WRITE(6,22) ABS(NW(I)),NSLW(I), * NPNTTL(I)-NSLW(I),NEULER(I)-NSLW(I) 280 CONTINUE ELSE WRITE(6,23) NWELL DO 281 I=1,NWELL WRITE(6,24) XSL(I)*RLNGTH,YSL(I)*RLNGTH, * NPNTTL(I)-NSLW(I),NEULER(I)-NSLW(I) 281 CONTINUE END IF ACTIDL=’ IDLE ’ IF(NTIME.GT.0) ACTIDL=’ACTIVE’ WRITE(6,25) DXYLIM,ACTIDL,NTIME DO 282 I=1,NTIME WRITE(6,26) TIMEFT(I)*WELTMP,’ACTIVE’ 282 CONTINUE 15 FORMAT(1H ,’TRACER TEST ALLOWS ONLY ONE WELL’) 20 FORMAT(///1H ,’+------+’/ * 1H ,’| STREAM LINE TRACKING |’/ APPENDIX G. FORTRAN CODE 302

* 1H ,’+------+’//) 21 FORMAT(1H ,3X,’NO. OF INJECTORS WHERE STREAM LINES ARE TRACKED :’ * ,I3// * 1H ,3X,’WELL NO. OF NO. OF NO. OF ’/ * 1H ,3X,’ NO. STREAM LINES TRACKINGS EULER APPLD’/ * 1H ,3X,’------’) 22 FORMAT(1H ,4X,I2,7X,I3,10X,I5,8X,I5) 23 FORMAT(1H ,3X,’NO. OF POINTS WHERE STREAM LINES ARE TRACKED :’ * ,I3// * 1H ,3X,’ POINT LOCATION NO. OF NO. OF ’/ * 1H ,3X,’ (X) (FT) (Y) TRACKINGS EULER APPLD’/ * 1H ,3X,’------’) 24 FORMAT(1H ,3X,F10.2,1X,F10.2,5X,I5,5X,I5) 25 FORMAT(/1H ,3X,’STREAM LINE INCREMENT LIMIT :’,F9.6,1X, * ’(DIMLESS)’/ * 1H ,3X,’DISPLACING FRONT TRACKING :’,1X,A6/ * 1H ,3X,’NO. OF TIME TO BE HIT :’,I3// * 1H ,5X,’TIME (DAYS) PLOT DATA’/ * 1H ,5X,’------’) 26 FORMAT(1H ,5X,F10.2,4X,A6) C C======C C EFFLUENT CONCENTRATION C C======C C IF(ITRACE.EQ.0) RETURN C REWIND(8) REWIND(9) NTRACE=0 NWW=NW(1) DO 300 J=1,NSLW(1) READ(9,*) NPNT DO 310 I=1,NPNT READ(8,*) XJ,YJ,TIME 310 CONTINUE IF(IFIL(J).EQ.1) GOTO 300 NTRACE=NTRACE+1 VELSLG(NTRACE)=VELSLG(J)/VELT BTTIME(NTRACE)=TIME*ABS(SPQ(NWW))*WPERM(NWW)*ALPSS(NWW)/(2.*PI) 300 CONTINUE C C ... SORTING ... C DO 320 J=2,NTRACE A=BTTIME(J) B=VELSLG(J) DO 325 I=J-1,1,-1 APPENDIX G. FORTRAN CODE 303

IF(BTTIME(I).LE.A) GOTO 327 BTTIME(I+1)=BTTIME(I) VELSLG(I+1)=VELSLG(I) 325 CONTINUE I=0 327 BTTIME(I+1)=A VELSLG(I+1)=B 320 CONTINUE C NTIME=1 TIMEFT(1)=BTTIME(1)/ABS(SPQ(NWW))/WPERM(NWW)/ALPSS(NWW)*(2.*PI) C WRITE(6,30) KST=1 SLGTTL=VELSLG(1) WRITE(6,31) BTTIME(1),SLGTTL DO 350 J=2,NTRACE SLGTTL=SLGTTL+VELSLG(J) WRITE(6,31) BTTIME(J),SLGTTL 350 CONTINUE C 30 FORMAT(///1H ,’+------+’/ * 1H ,’| TRACER EFFLUENT CONCENTRATION |’/ * 1H ,’+------+’// * 1H ,’ PORE VOLUME RECOVERY’/ * 1H ,’ INJECTED (FRAC) ’/ * 1H ,’------’) 31 FORMAT(1H ,1X,F10.7,5X,F10.8) 32 FORMAT(1H ,’ RECOVERY CALCULATION IS NOT VALID ’) RETURN END