Beruflich Dokumente
Kultur Dokumente
Lecture note 2
x(0) = x0
(1)
(2)
(3)
(4)
Divergence free flow in 2D: Streamline are still level curves of a streamfunction. An explicit formula for the streamfunction is
Z
Z
Z Z
dvy
dx dy
(x, y) = vx dy vy dx +
dy
For divergence free flow in 3D, two independent streamfunctions will
exist, such that their intersection describe a streamline. The streamfunctions in 3D seems to be more complicated and less useful in applications than the stream function in 2D.
x(0) = x0 ,
(5)
1 0 0
0 2 0
T = 1 . . . n ,
D= .
(6)
.. . .
.. ,
.
.
. .
.
0 0 n
corresponding to the eigenvalue decomposition AT = T D. By using
, Equation (5) becomes
the substitution x = T x
T
d
x
+b
= AT x
dt
(0) = T 1 x0 x
0,
x
(7)
is obtained by multiplication by T 1 ,
and a decoupled equation in x
d
x
+ T 1 b
= Dx
dt
(0) = x
0
x
(8)
x
i (0) = x
0i ,
i = 1, . . . , n,
(9)
(10)
Example
Let x = [x, y]T and v = [x 2y + 1, 3x + 4y 1]T and x0 = [2, 3]T .
Then
1 2
1
A=
,
b=
,
(11)
3
4
1
and 1 = 1, 2 = 2, 1 = [1, 1]T , and 2 = [2, 3]T . Hence,
1
2
3
2
1 0
1
T =
T =
D=
.
1 3
1 1
0 2
(12)
Then
T 1 b =
1
,
0
0 = T 1 x0 =
x
= [
and letting x
x, y], we have
d
x
x
+1
=
2
y
dt
0
1
(13)
C5 et 1
(t) =
x
,
C6 e2t
(14)
t
e 1
(t) =
x
,
e2t
(15)
and
0
(0) = x
0 =
x
1
and finally
(t)
x(t) = T x
et + 2e2t 1
x(t) =
et 3e2t + 1
(16)
See Figure 1
Numerical integration
Methods for numerical integration of initial value problems (IVP) for
ordinary differential equations (ODE) include :
Taylor series
Eulers method
Heuns method
Runge-Kutta methods
Adams methods
The methods can be further classified with respect to
3
6
6
x(0) = x0 .
(17)
now gives
x(t) = x0 +
f (x)dt
x(tn+1 ) = x(tn + t) = x0 +
xn +
xn +
tn
f (x)dt +
tn+1
f (x)dt
tn
tn+1
f (x)dt
tn
Z tn+1
tn
f (xn+1/2 )dt
Approximate
xn+1/2
dx
xn + (tn+1/2 tn )
dt tn
t
= xn +
f (xn )
2
(18)
t
f (xn ))
2
(19)
Note: Matlab has a variety of solvers for initial value promblems for
ordinary differential equations, e.g. ode45 and ode23, which have automatic error control.
A minimal MATLAB implementation
Example
Let v = [cos(xy), x], and x0 = [1, 1]. See Figure 2. A minimal
MATLAB implementation for this velocity field could be:
function rktest()
[t, y] = rk2(@vel, [0,3], [-1; 1], 0.01);
return
function y=vel(x)
y(1,1)=cos(x(1,1)*x(2,1));
y(2,1)=x(1,1);
return
function [tout, yout] = rk2(yprime, tspan, y0, dt)
t0=tspan(1);
5
2.5
2
1.5
1
0.5
0
0.5
1
1.5
2
2.5
2.5
1.5
0.5
0.5
1.5
2.5
Reservoir simulation
Reservoir simulation is the numerical solution of the partial differential
equations describing the flow in a porous media.
Ideally, the flow equations could be derived from conservation of mass
and momentum (and energy for compressible flow) for an infinitesimal
3.1
We will consider a simple model problem, where we consider two immiscible phases oil and water.
Darcys law then reads
q =
kr
K(P g),
= o, w,
(20)
where
q are the specific discharge vectors (commonly denoted the Darcy
velocity)
K is the permeability tensor
kr are the realtive permabilities,
are the viscosities,
are the densities,
g is the gravity vector,
P are the phase pressures.
The Darcy velocity is related to the average particle velocity v for
phase through
q = v ,
(21)
See Figure 3.
Let S denote the fraction of the volume occupied by phase at a
given point in the reservoir.
11111111111111111111111111
00000000000000000000000000
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
00000000000000000000000000
11111111111111111111111111
( q ) ndS = Q
( S )dV +
t V
V
( S ) + ( q ) = Q ,
t
where Q is the source term for phase .
(22)
(23)
(24)
(25)
Po Pw = Pc (Sw )
(26)
= (Pw )
(27)
= (Pw )
(28)
kr = kr (Sw )
(29)
(30)
K = K(x, t)
(31)
By inserting the Darcy velocity in (24), a formulation of the flow equations common for use with finite difference methods is obtained:
kr
( S ) + (
K(P g)) = Q ,
t
= o, w (32)
S +
S +
+ ( q ) = Q
t
t
t
1
S
1
Q
S + S
+
+ ( q ) =
t
t
t
P
S
1
Q
S + S c
+
+
( q ) =
,
t
t
t
(33)
(34)
(35)
where
c =
1
P
(36)
Pw
Po
+ Sw cw
+ So co
+
t
t
t
1
Qw
Qo
1
(w q w ) + (o q o ) =
+
, (37)
w
o
w
o
where we have eliminated the time derivatives of the saturations. This
last equation is denoted the pressure equation.
We now start by deriving the saturation equation. Define
=
kr
(38)
(39)
We will first express the water velocity in terms of the total velocity.
From Darcys law we have
1
q + o Kg
(40)
o o
1
q w Kg (41)
KPw =
w w
qo = o K(Po o g)
KPo =
qw = w K(Pw w g)
1
1
qo +
q + (o w )Kg
o
w w
(42)
(43)
By defining
o w
o + w
w
,
fw (Sw ) =
o + w
hw (Sw ) =
(44)
(45)
we get
q w = fw q + hw K(Pc + (w o )g)
(46)
3.2
(48)
Qw
Sw
+ (fw q) =
t
w
(49)
q =
(50)
Qo
Qw
+
w
o
(51)
3.3
Sw
+ q fw = 0
t
(52)
x(0) = x0
(53)
We also have:
dx
ds
kdsk
ds
k=k k=
=
d
d
d
d
ds
kqk
=
d
Z s
ds
(s) =
0 kqk
k
(54)
(55)
(56)
= ,
s
11
(57)
We now return to Equation (52). Using the previous relation and the
definition of a directional derivative, we get
q fw = kqk
fw
fw
=
s
(58)
(59)
References
12