Matlab Code

Download as pdf or txt
Download as pdf or txt
You are on page 1of 10
At a glance
Powered by AI
The key takeaways are that the paper tests Darcy's Equation to model fluid flow in a 2D oil reservoir and aims to develop a reliable MATLAB code that can be used as an alternative to traditional reservoir simulators like BOAST.

The purpose of this paper is to test the Darcy's Equation and investigates, by simulations, how it's suitable to use in one-phase oil reservoir. To be used later in history matching procedure.

The two main approaches for assessing reservoir properties mentioned are geometrical reservoir characterization which focuses on static data, and inverse modeling which estimates properties through matching dynamic data from simulations to field data.

Integrasi Teknologi, No. 1, vol. 2, September 2004.

1
Fluid Flow In 2-D Petroleum Reservoir Using Darcy's Equation
Thamir Abdul Hafedh

, Prayoto

, Fransiskus Soesianto

, Sasongko Pramono Hadi



1. Abstract
The purpose of this paper is to test the Darcy's Equation and investigates, by
simulations, how it's suitable to use in one-phase oil reservoir. To be used later in history
matching procedure.
The model used is a flow in a saturated reservoir and this model similar to steady
state two-dimensional (2-D) saturated porous media.
Reservoir engineering is based on the understanding of fluid flow in porous
media. our aim to produce reliable code in matlab is relevant for the reservoir process (as
simulator). To be used instant of traditional simulator, Black Oil Applied Simulator Tools
(BOAST) which is written in fortran, and widely used in almost works concern reservoir
simulation.
Key words: Partial Differential Equation, Finite Difference, Reservoir, Simulation,
Matlab.

2. Introduction
Reservoir engineering is based on the understanding of fluid flow in porous
media. We must have some data about permeability, porosity, saturation, and relative
permeability for oil, for a range of process conditions. We used fluid flow model in 2-D:
flow in a porous media. The model used is a flow in a saturated reservoir and this model
similar to steady state 2-D saturated porous media. The reservoir flow uses a potential
formulation, and we apply this model to reservoir management (Landa, et al, 2000).
The reservoir modeling is a complex, multidisciplinary task. Once satisfactorily
accomplished, the resulting model is used by operators and other interested parties for
predicting performance under the range of operating and maintenance scenarios, for
planning development strategies and for assisting production operations. (Parish, et al.,
1993)
Numerical simulation is widely used for predicting reservoir behavior and
forecasting its performance. However, the mathematical model used in the simulation
requires the knowledge of subsurface properties. Since petroleum reservoirs are relatively
inaccessible for sampling, the measurable quantities at the well provide the essential
information for reservoir description (Ewing, et. al., 1995).
The obtained data at the sampling locations can be divided into two categories:
static and dynamic. Static data such as permeability and porosity do not evolve
considerably during the reservoir lifetime. This can be considered the intrinsic identity of
the reservoir. On the other hand, dynamic data obtained at wells, such as hydrocarbon
production and pressure history, are changing and observable reservoir response resulting
from human and/or perturbation, ultimately. These two categories of data lead to two
different approaches for assessing reservoir properties.



Department of Electrical Engineering, Faculty of Engineering, Gadjah Mada University, Yogyakarta, Indonesia.
Department of Physics, Faculty of Mathematics and natural sciences, Gadjah Mada University, Yogyakarta, Indonesia
Integrasi Teknologi, No. 1, vol. 2, September 2004.
2
The first approach, commonly known as geometrical reservoir characterization,
focuses on static data. This approach uses the spatial correlation of static data to predict
the unknown parameters at unsampled locations. In the second approach, subsurface
properties are estimated through an inverse modeling procedure, which matches the
dynamic data, by comparing simulated production or pressure, to field data. Note: inverse
modeling takes into account the fluid flow when assessing reservoir properties. Until now
both approaches were used only for predicting geological models, while little attention
was given to other reservoir engineering parameters. Moreover, geostatistical methods
becomes a major research area after the mid 1980s. Consequently, research in inverse
modeling and automatic history matching lost its late 1970s and early 1980s vigor with
few exceptions. Although a number of algorithms have been proposed before the mid
1980s, automatic history matching has not found widespread use yet. A major reason
was the use of deterministic optimization methods, which can handle a limited number of
parameters.











Figure 1. Reservoir description
2. Previous Works
History matching is formulated depending on the process of determining
unknown parameter values for a mathematical reservoir model, such as permeability and
porosity, which give the closest fit of measured and calculated pressures. In principle, one
would like an automatic routine for history matching, applicable to simulators of varying
complexity, one that does not achieve a set of parameter estimates.
In the seventh decade of this century, various automatic and semiautomatic
history matching techniques have been introduced. Jacquard and Jain (1965) presented a
technique based on a version of the method of steepest descent. They did not consider
their method to be fully operational, however, due to the lack of experience with
convergence. Jahns (1965) presented a method based on the Gauss-Newton equation with
a stepwise solution for speeding the convergence; but his procedure still required a large
number of reservoir simulation to lead to a solution. Coats et al. (1970) presented a
workable automatic history matching procedure based on least-squares and linear
programming. Slater and Durrer (1971) presented a method based on a gradient method
and linear programming. In their study they mentioned the difficulty of choosing a step
size for their gradient method, especially for problems involving low values of porosity
and permeability. They also pointed out the need for a fairly small range in their reservoir
description parameters for highly non-linear problems.
Earth layers
Reservoir
Pressure
Oil
Integrasi Teknologi, No. 1, vol. 2, September 2004.
3
Thomas et al. (1972) presented a non-linear optimization technique that
automatically varies reservoir performance. Their method based on the classical Gauss-
Newton least-squares procedure. The method is a non-linear algorithm that will match
both linear and non-linear systems in reasonable number of simulations. Wasserman et al.
(1975) applied the material presented by two groups of scientists Chen et al. (1974) and
Chavent et al. (1975) to practical reservoir problems. The pressure history matching
algorithm used was initially based on a discretized single-phase reservoir model.
Multiphase effects are approximately treated in the single-phase model by multiplying
the transmissibility and storage terms by saturation-simulator run. Thus, all the history
matching is performed by a pseduo single-phase model. The multiplicative factors for
transmissibility and storage are updated when necessary. The matching technique can
change any model permeability thickness value.
Dogru et al. (1977) presented methods of non-linear regression theory, which was
applied to the reservoir history matching problem to determine the effect of erroneous
parameter estimates obtained from well testing on the future prediction of reservoir
pressures. Several studies on history matching have indicated that the well-test approach
for determining the reservoir parameters often suffers from incorrect and nonunique
parameter estimates. The factors that affect the parameter estimation can be classified as
model errors, observability, measurement errors or noise, history time, test procedure,
and optimization procedure.
Watson, et al. (1980) cleared that the aspect of the reservoir history matching
problem that distinguishes it from other parameter estimation problems in science and
engineering is the large dimensionality of both system state and the unknown parameters.
As a result of this large dimensionality, computational efficiency becomes a prime
consideration in the implementation of an automatic history matching method. In all
parameter estimation methods, a tradeoff exists between iteration and the speed of
convergence of the method. An important saving in computing time was realized in
single-phase automatic history matching through the introduction of optimal control
theory as a method for calculating the gradient of the objective function with respect to
the unknown parameters. This technique currently is limited to first-order gradient
methods. First-order gradient methods generally converge more slowly than those of
higher order do.
Lee et al. (1986) presented an algorithm for an automatic history matching which
developed from spline approximations of permeability and porosity distributions and
from theory of regularization to estimate permeability or porosity in a 1-Phase, 2-D areal
reservoir from well pressure data. The algorithm uses conjugate gradient method as its
core minimization method. A number of numerical experiments are carried out to
evaluate the performance of the algorithm. Comparisons with conventional (non-
regularized) automatic history matching algorithms indicate the superiority of the new
algorithm with respect to the parameter estimates obtained.

3. What is Reservoir Fluids?
The velocity of the fluid in reservoir has the form (u(x,y), (x,y), 0). In other words,
this means it is a 2-D steady state fluid flow. It is useful to be able to give a mathematical
description of reservoir fluid.
Integrasi Teknologi, No. 1, vol. 2, September 2004.
4
The compressibility of the fluid can be quantified by the divergence of the
velocity. In 2-D the divergence of (u,v) is u
x
+ v
y
. This measures how much mass enters a
small volume in a given unit of time. To understand this, consider the small thin
rectangular mass with density and discretize u
x
+ v
y

Flow in and out of volume
(dx dy T) = T dy (u(x+dx, y) - u(x,y)) dt+ T dx (v(x, y+dy) - v(x,y)) dt
Divide by (dx dy T)dt and let dx and dy go to zero to get rate of change of mass per unit
volume is (u
x
+ v
y
).


v
x
+ u
y
= 0 v
x
- u
y
= 0
Incompressible Irrotational
Figure2. Incompressible and irrotational 2-D fluid.
A fluid with no circulation or rotation can be described by the curl of the velocity vector.
In 2-D the curl of (u, v) is v
x
- u
y
. Also the discrete form of this gives some insight to the
meaning of this. The circulation or momentum of the loop about the volume (dx dy T)
with cross sectional area A and density is
momentum = A dy (v(x+dx, y) - v(x,y))- A dx (u(x, y+dy) - u(x,y)).
Divide by (A dy dx) and let dx and dy go to zero to get v
x
- u
y
= 0 for no rotation.

4. Applied to Saturated 2-D 1-Phase Reservoir
Consider a saturated reservoir which is to have at least one well. Assumed the
region is in the xy-plane and that the oil moves towards the well in such a way that the
velocity vector is in the xy-plane. At the top and bottom of the xy region we will assume
there is no flow through these boundaries. However, assume there is a wide supply from
the left and right boundaries so that the pressure is fixed. The problem is to determine the
oil flow rates of well, location of well and number of wells so that there is still oil to be
pumped out.
Integrasi Teknologi, No. 1, vol. 2, September 2004.
5
If a cell does not contain a well and is in the interior, then u
x
+ v
y
= 0. If there is a well in
a cell, then u
x
+ v
y
< 0. The motion of the fluid is governed by an empirical law which is
analogous to the Fourier heat law.
Darcy's Law. (u,v) = -K(h
x
,h
y
)

where
h is the hydraulic head pressure and
K is the hydraulic conductivity which is constant for saturated regions.
So, we have u
x
+ v
y
= - (Kh
x
)
x
- (Kh
y
)
y
is zero or negative.
NO FLOW THROUGH THIS SIDE

NO FLOW THROUGH THIS SIDE
Figure 3. 2-D 1-Phase reservoir flow in porous media.
5. Model
The model have a partial differential equation similar to that of the 2-D heat
diffusion model, with have different boundary conditions. For fluid flow reservoir
problems, they are either a given function along part of the boundary, or they are a zero
derivative for the remainder of the boundary.
6. Fluid Flow Reservoir Model
- (Kh
x
)
x
- (Kh
y
)
y
= ) 0 ( ) 0 ( ) 0 ( ) (
well ) (
well ) ( 0
,H ,L ,y x,y
x,y -R ,
x,y ,


Kh
y
= 0 for y=0 and y=H, and
h
x
= h
0
for x = 0 and x = L.

7. Problem Treatment
In this problem the finite difference method used coupled with the SOR iterative
method. For the (dx dy) cells in the interior. For the portions of the boundary where the
derivative is set equal zero on a half cell (dx/2 dy) or (dx dy/2), some additional code
inserted inside the SOR loop. For example, notice the model where h
y
= 0 at y = H on the
half cell (dx dy/2). The finite difference equation and corresponding line of SOR code
are, respectively, u = h:
(xw,yw)
well
Integrasi Teknologi, No. 1, vol. 2, September 2004.
6
-[(u(i+1,j) - u(i,j))/dx - (u(i,j) - u(i-1,j))/dx]/dx - [( 0 ) -(u(i,j) - u(i,j-1))/dy]/(dy/2) = 0

utemp = ((u(i+1,j) + u(i-1,j))/(dx*dx) + 2*u(i,j-1)/(dy*dy))/(2/(dx*dx) + 2/(dy*dy)).

u(i,j) = (1 -w)* u(i,j) + w*utemp.
In the following implementations observe where the extra lines of code are that reflect
these derivative boundary conditions.
8. Implementation.
The fluid flow reservoir model uses the following parameters:
L = 5,000 dx = h = 100 xw = (iw-1)h h = 100
H = 1,000 dy = h = 100 yw = (jw-1)h K = 10.
A single well with a flow rate of -1000 was used in the first numerical experiment. The
first output graphs are plots of the hydraulic head pressure as a function of x and y. Note
that the pressure near the well has dropped from 100 to about 30. The second experiment
has two wells with the same flow rate. In this case the pressures are negative near both
wells. This indicates that before any steady state solution was achieved, the wells went
dry!
9. Matlab Code for Fluid Flow in 2-D 1-Phase Saturated Reservoir in Porous Media.
cl ear al l
K=10;
wel l =- 1000;
i w=16;
j w=6;
eps=0. 0001;
nx= 50;
ny=10;
H=1000;
w=1. 7;


u=ones( nx+1, ny+1) *100;

h=H/ ny;

maxi t =400;
t ol =eps*h*h;
f or m=1 : maxi t
numi =0;
j = 1;
f or i = 2 : nx
ut emp= ( ( 2*u( i , j +1) + u( i +1, j ) + u( i - 1, j ) ) *0. 25) ;
ut emp= ( 1- w) *u( i , j ) + w*ut emp;
er r or = abs( ut emp - u( i , j ) ) ;
u( i , j ) =ut emp;
i f ( er r or < t ol )
numi =numi +1;
end
end
f or j = 2 : ny
f or i = 2 : nx
ut emp= ( ( u( i , j - 1) + u( i - 1, j ) + u( i +1, j ) + u( i , j +1) ) *0. 25) ;
Integrasi Teknologi, No. 1, vol. 2, September 2004.
7

i f ( ( i ==i w) & ( j ==j w) )
ut emp= ( ( u( i , j - 1) + u( i - 1, j ) + u( i +1, j ) + u( i , j +1) +
wel l / K) *0. 25) ;
end
ut emp= ( 1- w) *u( i , j ) + w*ut emp;
er r or = abs( ut emp - u( i , j ) ) ;
u( i , j ) =ut emp;
i f ( er r or < t ol )
numi =numi +1;
end
end
end
j = ny + 1;
f or i = 2 : nx
ut emp= ( ( 2*u( i , j - 1) + u( i +1, j ) + u( i - 1, j ) ) / 4) ;
ut emp= ( 1- w) *u( i , j ) + w*ut emp;
er r or = abs( ut emp - u( i , j ) ) ;
u( i , j ) =ut emp;
i f ( er r or < t ol )
numi =numi +1;
end
end

i f ( numi == ( nx- 1) *( ny+1) ) br eak; end
end


> dar cy2d
> m
27
> numi
539
sur f ( u)
cont our ( u)
















a. Surf 3-D b. Contour 2-D

Figure 4. Well at (16,6) with flow Rate 1000.





x y
P
r
e
s
s
u
r
e

y









x
Integrasi Teknologi, No. 1, vol. 2, September 2004.
8
9. Result Analysis
A two-dimensional, black-oil reservoir was modeled as shown in Figure 4. In this
instance, to avoid the effects of the heterogeneity in understanding the problem from the
conceptual point of view, the permeability and porosity were set constant throughout the
reservoir. In this model, well (16,6) is producing at constant flow rates of 1000. Figure 5
also shows the pressure in the reservoir as a function of time if we have two wells
production (16,6) and (36,4) with flow rates of 1000. The pressure maps are shown here
to illustrate what is going on in the reservoir and to help understand the results of the
analysis.




















a. Surf 3-D








b. Contour 2-D c. Plot 2-D
Figure 5. Wells at (16,6) and (36,4) with flow rates of 1000.


x y
P
r
e
s
s
u
r
e

x
y x
P
r
e
s
s
u
r
e

Integrasi Teknologi, No. 1, vol. 2, September 2004.
9
10. Assessment
This model has enough assumptions to rule out many real applications. For oil
reservoir problems the soils are usually not fully saturated, and the hydraulic conductivity
can be highly nonlinear and can vary with space according to the soil types. Often the
soils are very heterogeneous, and the soil properties are unknown. The model may
require 3-D calculations and irregular shaped domains. Fluid flow may often
compressible and irrotational. The good news is that the more complicated models have
many subproblems which are similar to model from heat diffusion, fluid flow in saturated
2-D 1-Phase oil reservoir in porous media.
11. Conclusions
The main purpose of this work was to develop procedure for Darcy's equation for
fluid flow. A second objective was to develop procedure to use as a simulator of reservoir
to assess the reservoir behavior.
The research resulted in the development of a procedure that allows us to
integrate information from several sources to determine the pressure of reservoir.
The components of the procedure developed during this work included:
A numerical reservoir simulator with the capability of computing the pressure as
part of the solution process. The simulator was limited to two-dimensional
reservoirs and oil system. We can expand the approach to three dimensions and to
gas-oil-water systems.
Mathematical procedures to construct dynamic reservoir objects.
Using the finite difference algorithm to discrete the model which in form of a
partial differential equation.
The example of reservoir objects shown here were relatively simple, but the method
is applicable to more complex cases. The method to compute pressure, as developed in
this work, is relatively simple to implement when it is possible to have access to the
numerical reservoir simulator computer code. Thus the complexity of modeling the
reservoir became easy because it done in the simulation part.

From the results of the numerical experiments performed during this research it is
possible to conclude that the method can be utilized as a tool for reservoir
characterization. The method seems to be more useful when the dynamic data set consists
of a large number of measurements that are difficult to honor with the existing
geostatistical approaches; this may be the case in mature fields that have already gone
through a secondary recovery process and in which data have been gathered over many
years.

For further research, one of the main assumptions in this work is that the
mathematical model (numerical reservoir simulator) can perform accurate predictions.
Thus more research has to be conducted in the areas of modeling, especially in the area of
well modeling in multiphase regimes, and in the area of controlling numerical dispersion
in finite difference models.


Integrasi Teknologi, No. 1, vol. 2, September 2004.
10
References
Chavent, G., Dupuy, M., and Lemonnier, P., 1975; History-Matching by Use of Optimal
Control Theory, SPE Journal, 259, 74-86.
Chen W. H., Gavalas, G. R., Seinfeld, J. H., and Wasserman, M. L., 1974; A New
Algorithm for Automatic History Matching, SPE Journal, 257, 593-608.
Coats, K. H., Dempesy, J. R., and Henderson, J. H.; 1970, A new Technique for
Determining Reservoir Description from Field Performance Data, SPE Journal,
249, 66-74.
Dogru, A. H., Dixon, T. N., and Edgar, T. F., 1977; Confidence Limits on the
Parameters Slightly Compressible, Single-phase Reservoirs, SPE Journal, 42-56.
Ewing R.E., Pilant M.S., Wade J.G., and Watson A.T, 1995, Identification and Control
Problems in Petroleum and Groundwater Modeling, Department of Mathematics
and Institute for Scientific Computation, Texas A&M University
Ewing R.E., Pilant M.S., Wade J.G., and Watson A.T., 1994, Parameter Estimation in
Petroleum and Groundwater Modeling, Department of Mathematics and Institute
for Scientific Computation, Texas A&M University
Jacquard, P., and Jain, C.; 1965, Permeability Distributions from Field Pressure Data,
SPE Journal, 234, 281-294.
Jahns, H. O.; 1965, A Rapid Method for Obtaining a Pressure Response Data, SPE
Journal, 237, 315-327.
Landa J. L, Horne R.N, M.M. Kamal, and C.D. Jenkins, 2000, Reservoir Characterization
Constrained to Well-Test Data: A Field Example, Arco Exploration and
Production Technology
Landa J. L., 1997, Reservoir Parameter Estimation Constrained to Pressure Transients,
Performance History and Distributed Saturation Data, Dissertation, Doctor of
Philosophy, Stanford University
Langaas K., Nilsson S., Stavland A., 2002, Pore-Scale Simulations of Dpr Gel Placement,
Rf-Rogaland Research, Norway
Lee, T., Kavaris, C., and Seinfeld, J. H., 1986; History-Matching by Spline
Approximation and Regularization in Single-Phase Areal Reservoirs, SPE
Reservoir Engineering Journal, Sept. 521-543.
Parish, R. G., Calderbank, V. J., Watkins, A. J., Muggeridge, A. H., Goode, A. T., and
Robinson, P. R., 1993; Effective History-Matching: The Application of
Advanced Software Techniques to the History-Matching Process, SPE Technical
Papers 25250.
Seidman T. I., 1996, Control of The Heat Equation, Department of Mathematics and
Statistics, University of Maryland Baltimore County, Baltimore, USA.
Slater, G. E., and Durrer, E. J.; 1971, Adjustment of Reservoir Simulation Models to
Match Field Performance, SPE Journal, 251, 259-305.
Thomas, L. K., Hellums, L. J., and Reheis, G. M.; 1972, A Nonlinear Automatic History
Matching Technique for Reservoir Simulation Model, SPE Journal, 253.
Wasserman, M. L., Emanuel, A. S., and Seinfeld, J. H., 1975; Practical Applications of
Optimal Control Theory to History-Matching Multiphase Simulator Reservoir
Models, SPE Journal, 259, 347-355.
Watson, A. T., Seinfeld, J. H., Gavalas, G. R., and Woo, P. T., 1980; History-Matching
in Two-Phase Petroleum Reservoirs, SPE Journal, Dec., 521-532.

You might also like