























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























Instability leads to a simulator "blowing up", or at least oscillating with solutions that are
not physically realistic. Instability is usually associated with an oscillating solution. An oscillation
will sometimes get worse but occasionally will disappear as the simulation progresses.
There often is confusion about the type of stability that comes from different sources. We
will identify these following types of instability.
Timestep sequence instability. This is the most common analysis that is made. It refers to the
oscillation that occurs as timesteps are computed. One timestep will be too high (the solution) then
the next timestep will be too low.
p
t
We are familiar with the Von Neumann analysis for linear diffusion equations. This shows
the cause of instability and shows that explicit pressure gradients are stable only as long as
∆ t ∆
c k
≤ t x
for a 1-D problem.
Other instabilities involve nonlinearities in the finite difference equations. IMPES uses
explicit kr and Pc and has the following limits on timestep sizes.
For Pc n :
(From Young and Russell, SPE 25245, 1993)
A fully implicit simulator is unconditionally stable if at each timestep the solution
converges to the exact solution of the finite difference equations. If a fully implicit simulator is
unstable, it is because we are not converging to the finite difference equations at each timestep.
(Newton) iteration instability. Newton iteration (or some other iteration scheme) is used to solve
the nonlinear finite difference equations. Newton iteration sometimes does not converge for a
variety of reasons. It is possible for the solution to "blow up" during the Newton iteration. It is also
possible for the timestep sequence to be unstable if the Newton iteration does not converge at each
timestep.
Matrix solution instability. Another source of instability is in the matrix solution itself. For a
number of reasons, the matrix solution may not solve the linearized equations and may blow up
during the matrix solution.
Summary. There are a number of reasons for a simulator blowing up. It is important to know
whether the matrix solution is solving the linearized equations properly and whether the nonlinear
(Newton) iteration is converging. Verifying these is an important step in debugging simulators.
1-D oil-water model:
Implicit kr Ignore Pc, grav, co, cw, cf
Mass Balance Eqs.
S^ q t
a (^) w o
p o o o +
Sw q t
a (^) w
p w w w +
Where
Sw (^) S S n w
n = ( w - ) δ +^1
Implicit kr:
k k k k k w
n k w w
n w
k ro
n k ro ro
n ro ( - )
= (^) k (^) ro + k ' ro ( Snw +^1 - Skw ) k
a a a S S k w
n oE w
k oE
n oE =^ + ' ( - )
Sw upstream) (symmetric)
Recalling Eq. 1
S S^ q t
a p p a p p nw nw o
n p o i
n i
n oE i
n i
n i
n oE i ( - )+
1 + 1
1
1 + (^1) + 1
Assume flow direction to the right side, then, using upstream kr
[ (^) a a S S ]( p p ) n i
n i
k wi
n oE i w (^) i
k oE i +^ ' ( - ) -
(^) S S q t
a a S S p p w nwi o
n p o n i
n i
k wi
n oE i w (^) i
k oEi ( i - )+
1 + 1 + 1
1
1 ∆
RHS = S S q a - 1 p - 1 p a p + 1 p t
V B k i
k i
k oE
k i
k i
k o oE
n w
k w
p o ∆ i i i^ i (11)
Reversing signs, to give us a positive main diagonal, we have the final form:
- (^) a p +(a +a )p -a p -a (p -p )S*w - k i
k i-
. oE
* i+ k oE
* i k oE k oE
* i- k o (^) Ei- 1 1 i- 1 i i 1 ' i- 1 1 i- 1
S r t
a p p w k
k p o i
k o (^) Ei i i =
where,
o
k o
k o (^) o p o o
k p o o
n r a p^ a g^ z^ o t
V S b t
= ∆ ∆ + ∆ ∆ - ( ) + ( V (^) S b ) + q ∆ ∆
but use
b
pi-1 Sw i-1 pi Sw i p*i+
S*w i+
k
k ′ (^ a ko (^) Ei- 1 + a^ koEi )
' ( -^ )
/
− ∆
− (^) a p p t
V (^) B k i
k oE i
p o i
− −
/ p o. o E ( (^) ik +- (^) ik ) V B t
a (^) i p^ p ∆ 1
k
k ′ (^ a wE (^) i- 1 +a wEi) k k ' ( - )
/
− ∆
− (^) a p p t
V B k i
k wE i
p w i
− −
/ V (^) p Bw. w E ( (^) ik +- (^) ik ) t a (^) i p^ p ∆ 1
In the form
a (^) W 11 a (^) W 12 a (^) C 11 a (^) C 1 2 aE^11 aE 12
a (^) W 21 a (^) W 22 a (^) C 21 a (^) C 22 aE^21 aE 22
written form
aw11 = - aoEi- aw12 = - a ' oEi-1 (p k i-1 - pi
k )
Note: that - a ' oEi-1 (pki-1 - pik^ ) > 0 and occurs upstream
If flow is in the left direction
p
i-1 S
w i-1 p
i S
w i p
i+1 S
w i+
p
i-1 S
w i-1 p
i S
w i p
i+1 S
w i+
(c +c ) t
V b S (^) f o p o ∆ o -^
V b t
p o ∆
(c +c ) t
V b S (^) w p w f w ∆
V p bw ∆ t
P'c =
p
i-1 S
w i-1 p
i S
w i p
i+1 S
w
i+
Note: P'c is negative
In each case, the Q' has the following meaning (for the oil, water equations) :
p
q a (^) C o ∂
w
o C S
q a ∂
p
q a (^) C w ∂
w
w C S
q a ∂
Constant water injection rate , qwi :
No variation in qwi and qo = 0
so: aC11 = aC12 = aC21 = aC22 = 0
Constant pwf :
q J (^) ( )
k B o r p^ p^ etc o
= (^) wf
( ) o
wf ro o
r C p B
J p p k B
k a J
( ) w
ro wf o
C S
k p p B
a J ∂
( ) w
wf rw w
r C p B
J p p k B
k a J
( ) w
rw wf w
C S
k p p B
a J ∂
22 (27)
Constant qo:
q
k B
k B
w q
r w r o
= o
w w
o o o ro
rw C B
p
q k
k a
ro
rw w
o w w
o o C k
k S
q B
a
Constant qt :
w t w
w f q B
q
q ( ) B o f^ q o
= − w t
o
r w
r
w
r
w k k
k
f
where
= (^) w w
C t f p B
a q
( (^) w ) w w
C t f B S
a q ∂
Subroutine BAND1D2(A,D,X,NROW,LMAX) c *************************************************************************************** c c Subroutine BAND1D c c *************************************************************************************** c Subroutine Band Puts Coefs in 'A' for GBAND (1-D, 2EQN. Case) Implicit Real8(A-N, O-Z) $Insert Common Dimension A(),D(),X() NEQ = 2 NROW = NEQ * IMAX LLEFT = - LRIGHT = NROW LMAX = 3 IM = - c .............................IM is the Index of the Main Diagonal of A IROW = 0 DO 100 I= 1,IMAX DO 100 IEQ = 1,NEQ IM = IM + 1 IROW = IROW + 1 c .............................ADD Right Half-BAND from Row Above IM = IM + MINO(LRIGHT,LMAX) LRIGHT = LRIGHT - 1 LLEFT = LLEFT + 1 c .............................ADD LEFT Half-BAND from this Row IM = IM + MINO(LLEFT, LMAX) IF(IEQ .EQ. 1) THEN D(IROW) = -R1(I) IF(IFIRST .EQ. 0) THEN IF(I .GT. 1) THEN A(IM-2) = AW11(I) A(IM-1) = AW12(I) ENDIF A(IM) = AC11(I) A(IM+1) = AC12(I) IF(I .LT. IMAX) THEN A(IM+2) = AE11(I) A(IM+3) = AE12(I) ENDIF ENDIF IF(IEQ .EQ. 2) THEN D(IROW) = -R2(I) IF(IFIRST .EQ. 0) THEN IF(I .GT. 1) THEN A(IM-3) = AW21(I) A(IM-2) = AW22(I) ENDIF A(IM-1) = AC21(I) A(IM) = AC22(I) IF(I .LT. IMAX) THEN A(IM+1) = AE21(I) A(IM+2) = AE22(I) ENDIF ENDIF ENDIF 100 CONTINUE RETURN END
SUBROUTINE GBAND2( A,D,X,N,M,EPS,IERR,IFIRST ) C IMPLICIT REAL8(A-H,O-Z) C IMPLICIT INTEGER4(I-N) DIMENSION A() , D() , X(*) C C Solution of system of equations with band matrix by standard C elimination without pivoting. C C A-one-dimensional array containing the band of the matrix C stored by rows, the required dimension of A is: C N * ( 2 * M + 1 ) - M * M - M C C M-number of diagonals above the main diagonal. Number of C diagonals below the main diagonal is also M. Therefore, the C total bandwidth is 2 * M + 1 C C N - number of equation C D - R. H. S. vector C X - solution vector. C C EPS - the element of the main diagonal is compared to EPS C during elimination. If it is smaller, value of the counter C IERR is incremented. C C IERR - number of times the element on the main diagonal was C smaller than EPS. C C IFIRST - If IFIRST=0, Matrix is inverted and the inverse is C stored in place of the diagonal matrix. If IFIRST.GT.0 routine C assumes that the matrix has been inverted and will calculate C solution corresponding to the new R.H.S. vector. This option C is useful when solving repeatedly the same equations with C different R.H.S. vectors. C C I = column index for pivot C J = pivot element C------------------------------new GBAND code ---------RAW 3/8/88 --------------- LHALF = M NROWS = N NCOLS = N IERR= LRIGHT = LHALF KPIVOT = - LHALF C.......... eleminate by columns DO 100 JPIVOT = 1,NCOLS IPIVOT = JPIVOT LLEFT = MIN(LHALF,IPIVOT-1) KPIVOT = KPIVOT + LLEFT + LRIGHT + 1 LRIGHT = MIN(LHALF,NROWS-IPIVOT) KMAINX = KPIVOT LR = LRIGHT C....... go down the pivot column to eliminate elements DO 100 IXX = 1,LRIGHT I X = IPIVOT + IXX LL = MIN(LHALF,IX-1) KMAINX = KMAINX + LL + LR + 1 KX = KMAINX - IXX LR = MIN(LHALF,NROWS-IX) INC = KX - KPIVOT IF (ABS(A(KPIVOT)) .LT. EPS) IERR = IERR + 1 RATIO = A(KX) / A(KPIVOT) IF (FIRST .EQ. 0) THEN C... .subject pivot row form X row
Matrix Size For GBAND:
Nomenclature:
I = cells in i direction J = cells in j direction K = cells in k direction Neq = number of equations per cell M = matrix half-band size, for GBAND N = total number of equations (matrix rows)
M = 2 Neq - 1 N = I Neq
M = (I+1) Neq - 1 N = I J Neq
M = (I J + 1) Neq - 1 N = I J K Neq
Band width (all cases) = 2M + 1
a. Easy b. Unstable
a. Most common b. Works best with smoothness, near root
c. x x
f x f x
n + n = − ′
a. Straddles root
b. x k + x^ high^ xlow =
x
f(x)
x
f(x)
f(x)
x