You are on page 1of 77

ENGSCI 442

Week 7/8
Rosalind Archer
1.1 Intro to Petroleum Engineering
• Petroleum engineers study the flow of
oil, gas and water through the the rock
comprising oil reservoirs.

• Capital and operating expenses in oil


field management are huge and large
computational fluid dynamics (CFD)
models are used in the process of
decision making.
1.2 Intro to Petroleum Engineering
• This set of lectures will introduce you to
petroleum engineering problems as an
application of the theoretical material
you studied in the earlier part of the
course.

• Many of the numerical issues petroleum


engineers encounter are common to
other CFD problems.
1.3 Vocabulary
• Petroleum engineering has a very
particular vocabulary and some peculiar
units.

• In all problem we study I will try to


convert all the units to SI. In many parts
of the world however petroleum
engineers do not use SI.
1.4 What is a Reservoir?
• An oil/gas reservoir is a permeable rock
formation that contains oil/gas. There
must be some kind of sealing
mechanism to prevent the oil from
escaping e.g. a impermeable rock
formation above.

• Reservoirs may be as far as 5km below


the surface of the earth (under land or
under the sea.)
1.5 What is a Reservoir?

Oil producing well

Oil Zone

Water Water

Courtesy NExT - BRE


1.6 Reservoir Fluids
• Gas may or may not co-exist with oil in
a reservoir. If present it will tend to exist
above the oil.

• Water may be present below the oil.

• As the reservoir pressure is reduced (by


production of oil) gas and water may
move into the oil zone.
1.7 Reservoir Fluids
• One of the things that makes CFD for
petroleum reservoirs interesting/difficult
is that the properties (density, viscosity)
of the fluids can depend strongly on
both pressure and temperature.

• As pressure is lowered gas may evolve


from the oil. This is the same process
that occurs when you take the cap of a
carbonated drink.
1.8 Rock Properties
• There are three key rock properties we
will be interested in permeability,
porosity and compressibility.
– Permeability (k) measures the ability of
fluid to flow through the rock. SI unit m2,
field unit md.
– Porosity (f) measures the fraction of the
total rock volume that is void space.
Dimensionless.
– Compressibility (cf) measures the change
in the volume of the rock per unit change in
pressure. SI unit Pa-1, field unit psi-1.
1.9 Fluid Properties
• The fluid properties we are interested in
are density, viscosity, compressibility,
solution gas-oil ratio and formation
volume factor.

– Density (r) is the mass of fluid per unit


volume. The SI unit is kg/m3 and the field
unit is lb/ft3.
– Viscosity (m) is measured in Pa-s (SI) and
centipoise (abbreviated cp) in field units.
1.10 Fluid Properties
– Compressibility (c) measures the change in
the volume of the fluid per unit change in
pressure. SI unit Pa-1, field unit psi-1.
– Imagine you have a unit volume of oil (at
reservoir pressure) when this volume of oil
is bought to the surface it will liberate some
gas. The solution gas-oil ratio (Rs) is the
ratio of the gas volume (at surface) to the
oil volume (at surface).
– Formation volume factor (B) is the ratio of
a unit volume of oil at surface conditions to
its volume at reservoir conditions.
1.11 Saturation
• We keep track of what fraction of the
pore space is filled with oil, water or gas
in terms of phase saturation (volume oil,
water, or gas divided by total volume).
The symbols for these are:
So, Sw, Sg.
1.12 Rock-Fluid Properties
• Relative permeability and capillary
pressure are quantities which govern
the interaction of the reservoir rock and
fluids.
• Relative permeability (kr) measures the
reduction in permeability in a pore
space due the effects of multiphase
flow, i.e. a mixture of oil and water
needs a greater pressure drop for the
same flow-rate than pure oil or water
does.
1.13 Relative Permeability
• Absolute permeability (k) is the
permeability of a porous medium to a
single phase.
• If multiphase flow occurs the absolute
permeability must be modified into an
“effective permeability” (k*kr).
• The relative permeability (kr) handles
multiphase flow effects.
1.14 Relative Permeability

krw

kro
1.15 Capillary Pressure
• Difference in pressure across the
interface between two fluids

• Function of saturation

pc  po  pw
1.16 Capillary Pressure

40

30

Pc, psi20
Drainage
10

0
0.2 0.4 0.6 0.8 1.0
Imbibition Sw
1.17 Standard Conditions
• Oil is typically measured in barrels,
1 barrel = 5.615 ft3 = 0.1589 m3.

• Volume however is not conserved –


only mass is conserved. A volume
balance is appropriate if all volumes are
converted to standard conditions
(atmospheric pressure and
temperature). Vreservoir
Vstandard 
Bo
1.18 CFD Approach
• Modelling of fluid flow in oil reservoirs in
based on one simple principle:
conservation of mass.

• In some problems conservation of


energy is also considered but we will
treat all our examples as isothermal.
1.19 Domain
The problem
domain may be
highly irregular
and the rock
properties may
be very
heterogeneous.

This figures
shows porosity
values in a
200,000 cell grid

SPE 71596
1.20 Continuity Equation
• The general equation for flow in a porous
medium is
 
  ru )   fr )
t
where
f is porosity , r is density, u is velocity,
and t is time.

• This equation is derived by performing a mass


balance on small volume of porous media.
1.21 Derivation

• Consider an element of area (dS) and the


flows passing through it:

 
ru  n dS


ru
1.22 Derivation
• When u is not normal (perpendicular) to
the surface, we take the normal
component u.n so that:
rate of mass flow out of dS = ( ru  n ) dS

• To get the total mass flow rate out of the


element, we integrate over the entire
surface.
total mass flow rate out =  
 ( ru  n )dS
S
1.23 Derivation
• Now, take a small volume, dV, from
anywhere in the element:

 (fr )
rate of mass loss out of V=  dV
t
• We then get the total rate of mass loss by
integrating over the entire element:

total rate of mass loss = (fr )


  dV
V
t
1.24

• Equate both sides:


  (fr )
S ( ru  n )dS =  
V
t
dV

• Gauss Divergence Theorem:


  
 ( ru  n)dS    ru )dV
S V

 (fr)
   ru )dV   dV
V V
t
1.25

• This implies:

  (fr)
  (ru )  
t
1.26 Alternative Viewpoint

• This is not the only way to derive the


continuity equation. It can also be
derived by summing mass inflows and
outflows and setting this equal to the
mass accumulation in a volume.

• The derivative appears in the limit as the


volume being considered shrinks to zero.
1.27 Alternate Derivation
• Consider a block shaped volume of the
porous media with side lengths Dx, Dy
and Dz.

Dz

Dy
x x+Dx
1.28

• Now consider the:


– inflows
– outflows
– rate of accumulation

of mass into/out of this volume.

• For simplicity we will consider the case


where there is only flow in the x-
direction i.e. u is a scalar.
1.29

• Inflow rate
volume of fluid entering the block
= velocity*area
 (u) |x (DyDz)
mass of fluid entering the block
 (ru) |x (DyDz)
units = mass/time
1.30

• Outflow rate
volume of fluid leaving the block
= velocity*area
 (u ) |( x  Dx ) (DyDz)
mass of fluid entering the block

 (ru ) |( x  Dx ) (DyDz)
units = mass/time
1.31

• Volume of fluid in the block


 f(DxDyDz)
• Mass of fluid in the block
 rf(DxDyDz)
• Rate of mass accumulation


rf)t  Dt  (rf) t
(DxDyDz)
Dt units = mass/time
1.32 Conservation of Mass
• Conservation of mass requires the net
inflow rate i.e. (inflow - outflow), must
equal the accumulation rate.

(ru) x  (ru) x Dx (DyDz)


(rf) t  Dt  (rf) t
 (DxDyDz)
Dt
1.33

• Dividing through by DxDyDz gives:

(ru ) x  (ru ) x  Dx (rf) t  Dt  (rf) t



Dx Dt
• Letting Dx and Dt go to zero gives:

 (ru )  (rf)

x t
i.e. continuity equation for 1D flow.
1.34 Summary
• This equation is very general. It can be
applied to any fluid flow situation. We
will customize the continuity equation to
represent oil and gas flows by
considering the representation of
density and velocity in more detail.
1.35 Diffusivity Equations
• Basic equations of fluid flow in a porous
medium combine:

 
Continuity Equation ru )   fr)
t
 k
Darcy ' s Law u   p
m
Equation of State r  f p, T )
1.36 Compressibility
• Also use definition of isothermal
compressibility:

1  V  1  B  1  r 
Fluid c           
V  p T B  p T r  p  m,T
1  f 
Rock cf   
f  p T
1.37 Derivation
• Start by substituting Darcy’s Law into
the continuity equation:

 k  fr )
  r   p   
 m  t

• Assume constant k, m

m  fr )
  rp 
k t
1.38

• Expand the left-hand side:


m  (fr)
r  p  (r)  (p) 
k t
• or
m  (fr )
r p  (r )  (p) 
2

k t

• The density gradient term can be


expanded as:
dr
r  p  crp
dp
1.39

• The middle term now becomes:


cr (p )  (p )
• This term is nonlinear. It can be
neglected however:
– c is small (for liquids)
– pressure-gradient squared is also small

• We now have:
m 1 (fr )
 p
2

k r t
1.40

• Our goal now is to write the right-


hand side in terms of pressure not
density. First expand it:
m 1  r f 
 p f r 
2

k r  t t 

• Apply the chain rule:


m 1  dr p df p 
 p
2
 f r 
k r  dp t dp t 
1.41

• Now introduce compressibility:


m 1 p p 
 p  f (cr )  r c f f ) 
2

k r t t 

fm p
 p 2
(c  c f )
k t

fmct p
 p 2

k t
1.42 Linearity
• If fmct does not depend on p the
k
equation is linear.

fmct
• If k does depend on p the
equation is nonlinear.
1.43 Coordinate Systems
• Cartesian
 2 p  2 p fmct p
 2 
x 2
y k t

• Radial
 2 p 1 p fmct p
 
r 2
r r k t

These equations are for 2D problems. To go to 3D


add  p .
2

z 2
1.44 Diffusivity: Numerical Solution
 p
2
p fmc t
 where  
x 2
t 0.00633k
• First discretize the region on interest
over both space and time.

Xi-2 Xi-1 xi Xi+1 Xi+2

t  t1 , t 2 , t 3 , ...
1.45 Diffusivity: Numerical Solution
• Replace the analytical derivatives by
numerical approximations.
– Central difference in space
– Backward difference in time
n 1
pi 1  2pi  pi 1 p p n

i i

Dx )2
Dt

– Right now we are not stating what timestep


(n or n+1) the terms on the left are being
evaluated.
1.46 Implicit Solution Template

t
n+1
t
n
t

1
t
x
x i-1 xi x i+1
1.47 Implicit - Time Level of Terms

An “implicit” solution scheme means


that the pressures at the nodes will be
evaluated at the new timestep (n+1) in
second derivative (space) term.

pin11  2pin 1  pin11 pin 1  pin



Dx ) 2
Dt
1.48 Alternative Approach

• We derived the finite difference form of


the diffusivity equation using by writing
expressions for the derivatives involved
in terms of finite differences.

• The same equation can also be derived


by posing the problem as a volume
balance on a grid block.
1.49 Gridblock Mass Balance

Outflow
Inflow

Accumulation

Conservation of Mass
Rate of Inflow - Rate of Outflow = Rate of Accumulation
1.50 Gridblock Mass Balance

Dz

Dy
xi-1 xi xi+1
Consider a balance on block i:
k dp
Inflow  0.00633 (DyDz) i-1/2 denotes
mB dx i  1 the boundary
2 between i-1 and i
n 1 n 1
k pi 1  pi Unit standard ft3/day
 0.00633 (DyDz)
mB Dx
1.51 Gridblock Mass Balance

k dp
Outflow  0.00633 (DyDz)
mB dx i  1
2
n 1 n 1
k p p
 0.00633 (DyDz) i i 1
mB Dx
i+1/2 denotes
the boundary
between i+1 and i

Unit standard ft3/day


1.52 Gridblock Mass Balance
Rate of Accumulation:
f( DxDyDz)
Volume of fluid in the gridblock =
B

The pressure in the gridblock is changing


with time so the volume of fluid is also
changing.

Fluid compressibility:
1  V 
c   
V  p 
1.53 Gridblock Mass Balance
• We are interested in the rate of increase
of fluid volume in the gridblock (dV/dt)
V V p

t p t

• From the definition of compressibility we


have: V
 cV
p
V p
  cV
t t
1.54 Gridblock Mass Balance
• Substituting for V gives:
V fc t (DxDyDz) dp

t B dt

• Finally substituting a numerical


approximation for dp/dt gives us an
accumulation rate of:
n 1
V fc t (DxDyDz) p  p
n
 i i
t B Dt
1.55 Conservation of Mass
• Conservation of mass (just as in the
derivation of the continuity equation)
requires

rate of inflow - rate of outflow + rate of


accumulation = 0

• If the terms did not sum to zero mass


would be being created or destroyed in
the grid block.
1.56 Conservation of Mass
• Combining the inflow, outflow and
accumulation terms gives:

k  n 1
pi 1  pi
n 1
pi  pi 1 
n 1 n 1
0.00633 (DyDz)   
mB  Dx Dx 
fc t (DxDyDz)  pi  pi 
n 1 n
  
B  Dt 
1.57 Conservation of Mass

• Dividing through by Dx, Dy, Dz gives:


k pi 1  2pi  pi 1 
n 1 n 1 n 1
0.00633  
mB  (Dx ) 2


fc t pi  pi 
n 1 n
  
B  Dt 

• This is identical to the form derived using


finite differences.
1.58 Volume versus Mass Balance

• Note that the way this is formulated it is


actually a volume balance, not a mass
balance. However since formation
volume factors are introduced to convert
volume at reservoir conditions to
volume at standard conditions this is
equivalent to a mass balance.
1.59 Wells
• Note that in this derivation we did not
included any source/sink terms to
represent wells. If the well flow-rate is
know then it can be easily added.

k pi 1  2 pi  pi 1 
 n 1 n 1 n 1

0.00633  
mB  (Dx) 2

fct  pi  pi 
n 1 n

    qi
B  Dt 
1.60 Wells

• If the well flow-rate is not known then it


must be determined in terms on the well
pressure ... more detail than we require
right now!
1.61 Initial and Boundary Conditions

• Initial condition
p  pinitial  i 1, 2,, IMAX )
0
i (1D case)

• Boundary conditions
– Constant pressure at boundaries:
mass balance equation replaced by a
constraint equation.
p1  C1
pIMAX  C2
1.62 Initial and Boundary Conditions

• Boundary conditions
– No flow at boundaries … delete flow
term corresponding to that boundary.

No flow
boundary Dz

Dy
xi xi+1
1.63

Original Mass Balance Equation:

k  n 1 n 1
pi 1  pi pi  pi 1 
n 1 n 1

0.00633 (DyDz )   
m  Dx Dx 
 pin 1  pin  Delete
 fct (DxDyDz )   inflow term
 Dt 
1.64

Dividing through by Dx, Dy, Dz gives:

k p p 
n 1 n 1
i 1
0.00633  i

m  (Dx) 2

 pi  pi 
n 1 n

 fct  
 D t 
1.65 Implicit Solution

• System of equations
– Left boundary (i = 1)
n 1
p 1  C1 (or no flow)

– Interior points (i = 2,,IMAX-1)


pin11  2   n1 pin11  n
    pi    pi
Dx )  Dx ) Dt 
2 2
Dx ) 2
Dt
– Right boundary (i = IMAX) fmct

1 0.00633k
pnIMAX  C2 (or no flow)
1.66 Implicit Solution
Matrix Equation

 b1 c1    
a b2 c2    
 2    
 a3 b3 c3    
    
 . . .    
 . . .   pin11    
   n 1   
 ai bi ci   pi  d i 
 . . .   p n 1   
   i 1   
 . . .    
 bN     
 aN   
1.67 Matrix Structure

• System is tridiagonal

• Size is (IMAX x IMAX)

• Solved by the Thomas Algorithm


1.68 Implicit Solution

• Advantage
– Unconditionally stable

• Disadvantage
– Matrix solution
1.69 Explicit Solution

• Discretize the region of interest


• Discretize the diffusivity equation
– Central difference in space
– Forward difference in time
pin1  2 pin  pin1 pin 1  pin

Dx ) 2
Dt
fmc
where  
0.00633k
1.70 Finite Difference Template
t
n+1
t
n
t

1
t
x
x i-1 xi x i+1
1.71 Initial and Boundary Conditions

• Initial and boundary conditions are


handled in the same manner as for
the implicit method
– but time level of all pressures in the
space derivative term is at n not n+1.
1.72 Explicit Solution

• Explicit equations
– Left boundary (i = 1)
p1  C1 (or no flow)

– Interior points (i = 2,,IMAX-1)


pin1  2   n pin1  n1
    pi   pi
Dx )  Dx ) Dt 
2 2
Dx ) Dt
2

– Right boundary (i = IMAX)


1
pnIMAX  C2 (or no flow)
1.73 Explicit Solution: Summary

• Advantage
– Simple
– Disadvantage
– Stability limited

We can explore this stability limit using


a spreadsheet example.
1.74 Explicit.xls
• Try entering different dx and dt
values on the spreadsheet.
• Each time you make an entry the
solution for u will update.
• For some dx and dt values the
solution will go to the steady-state
solution we expect. For others it
won’t.
What relationship is required
between dx and dt to maintain
stability?
1.75 Stability Limit
• Explicit.xls solves the problem:
 p p
2

x 2
t

• You should have discovered that the


stability limit is:

r 
Dt
Dx ) 2
2
1
1.76 Stability Limit
For the problem:
 p 1 p
2
 p 2 
2

x  t
The stability limit is:
Dt
r  Dx )  2
1
2

You might also like