Progress Report - Maria Indira
Progress Report - Maria Indira
Progress Report - Maria Indira
CONTINUITY EQUATION
where :
∆(𝜌𝜙𝑆)
𝑚̇𝑎𝑐𝑐𝑢𝑚𝑢𝑙𝑎𝑡𝑒𝑑 = 𝑉𝑏
∆𝑡
∆(𝜌𝜙𝑆)
[(𝜌𝐴𝑣)𝑥 + (𝜌𝐴𝑣)𝑦 + (𝜌𝐴𝑣)𝑧 ] − [(𝜌𝐴𝑣)𝑥+∆𝑥 + (𝜌𝐴𝑣)𝑦+∆𝑦 + (𝜌𝐴𝑣)𝑧+∆𝑧 ] − 𝑚𝑠𝑖𝑛𝑘 = 𝑉𝑏
∆𝑡
Fluid Model
for Gas:
𝜌𝑔𝑠
𝜌𝑔 =
𝐵𝑔
𝑉𝑔
𝐵𝑔 =
𝑉𝑔𝑠
for Water:
𝑠
𝜌𝑤
𝜌𝑤 =
𝐵𝑤
𝑉𝑤
𝐵𝑤 =
𝑉𝑤𝑠
for sink / source :
𝑚𝑠𝑖𝑛𝑘 = 𝜌 𝑠 𝑞
Based on the EOS stated above, the continuity equation for each phase become:
for Gas:
for Water:
𝑠 𝑠
𝜌𝑤 𝑠
𝜕 𝜌𝑤
−𝑉𝑏 ∇ ∙ ( 𝑣⃗𝑤 ) = 𝜌𝑤 𝑞𝑤 + 𝑉𝑏 ( 𝜙𝑆𝑤 )
𝐵𝑤 𝜕𝑡 𝐵𝑤
for Gas:
𝑣⃗𝑔 𝜕 𝜙𝑆𝑔
−𝑉𝑏 ∇ ∙ ( ) = 𝑞𝑔 + 𝑉𝑏 ( )
𝐵𝑔 𝜕𝑡 𝐵𝑔
for Water:
𝑣⃗𝑤 𝜕 𝜙𝑆𝑤
−𝑉𝑏 ∇ ∙ ( ) = 𝑞𝑤 + 𝑉𝑏 ( )
𝐵𝑤 𝜕𝑡 𝐵𝑤
MOMENTUM BALANCE
Here is Darcy Equation for both phases using the relative permeability:
𝐾𝑘𝑟𝑛
𝑣⃗𝑛 = − (∇𝑃𝑛 − 𝜌𝑛 𝑔∇𝑧)
𝜇𝑛
𝑣⃗𝑛
= −𝜆𝑛 (∇𝑃𝑛 − 𝛾𝑛 ∇𝑧)
𝐵𝑛
Where,
𝐾𝑘𝑟𝑛
𝜆𝑛 =
𝜇𝑛 𝐵𝑛
𝛾𝑛 = 𝜌𝑛 𝑔
𝑛 = 𝑜, 𝑔
With assumption that reservoir is modeled with grid in the form of horizontal block:
𝜕/𝜕𝑥 𝜆𝑥 𝑝𝑥
𝑣⃗
−∇ ∙ ( ) = ∇ ∙ [𝜆(∇𝑝 − 𝛾∇𝑧)] = [𝜕/𝜕𝑦] ∙ [ 𝜆𝑦 𝑝𝑦 ]
𝐵
𝜕/𝜕𝑧 𝜆𝑧 (𝑝𝑧 − 𝛾∇𝑧)
𝑣⃗ 𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕
−∇ ∙ ( ) = (𝜆𝑥 ) + (𝜆𝑦 ) + (𝜆𝑧 ) − (𝜆𝑧 𝛾∇𝑧)
𝐵 𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑧 𝜕𝑧 𝜕𝑧
Combining the continuity equation for each phase with momentum balance equation from
Darcy’s Equation, The equation for each phase becomes:
for Gas
𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕 𝜕 𝜙𝑆𝑔
𝑉𝑏 [ (𝜆𝑔𝑥 ) + (𝜆𝑔𝑦 ) + (𝜆𝑔𝑧 ) − (𝜆𝑔𝑧 𝛾𝑔 ∇𝑧)] = 𝑞𝑔 + 𝑉𝑏 ( )
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑧 𝜕𝑧 𝜕𝑧 𝜕𝑡 𝐵𝑔
for Water:
𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕 𝜕 𝜙𝑆𝑤
𝑉𝑏 [ (𝜆𝑤𝑥 ) + (𝜆𝑤𝑦 ) + (𝜆𝑤𝑧 ) − (𝜆𝑤𝑧 𝛾𝑤 ∇𝑧)] = 𝑞𝑤 + 𝑉𝑏 ( )
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑧 𝜕𝑧 𝜕𝑧 𝜕𝑡 𝐵𝑤
Unknown Parameters:
𝑆𝑔 + 𝑆𝑤 = 1
𝑝𝑐𝑔𝑤 = 𝑝𝑔 − 𝑝𝑤
𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕
𝑉𝑏 [ (𝜆𝑔𝑥 ) + (𝜆𝑔𝑦 ) + (𝜆𝑔𝑧 ) − (𝜆𝑔𝑧 𝛾𝑔 ∇𝑧)]
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑧 𝜕𝑧 𝜕𝑧
𝜕 𝜕𝑝
𝑉𝑏 . (𝜆𝑔𝑧 ) ≡ 𝑉𝑏 . ∆𝑧 (𝜆𝑔𝑧 . ∆𝑧 𝑝𝑔 )
𝜕𝑧 𝜕𝑧
Since
𝑉𝑏 = ∆𝑧𝑘 . 𝐴𝑘
Therefore,
1
∆𝑧 (∆𝑧𝑘 . 𝐴𝑘 . 𝜆𝑔𝑧 . ∆𝑧 𝑝𝑔 ) = [(∆𝑧𝑘 . 𝐴𝑘 . 𝜆𝑔𝑧 . ∆𝑧 𝑝𝑔 )𝑘+1 − (∆𝑧𝑘 . 𝐴𝑘 . 𝜆𝑔𝑧 . ∆𝑧 𝑝𝑔 )𝑘−1 ]
∆𝑧𝑘 2 2
Transmisibility,
𝐴𝑘
𝑇𝑍 1 = 𝜆 1
𝑘+
2 ∆𝑧 1 𝑔,𝑘+2
𝑘+
2
Therefore,
For x-direction
𝜕 𝜕𝑝
𝑉𝑏 (𝜆 ) ≈ 𝑇𝑋 1 (𝑝𝑖+1 − 𝑝𝑖 ) − 𝑇𝑋 1 (𝑝𝑖 − 𝑝𝑖−1 )
𝜕𝑥 𝑥 𝜕𝑥 𝑖+
2
𝑖−
2
For y-direction
𝜕 𝜕𝑝
𝑉𝑏 (𝜆𝑦 ) ≈ 𝑇𝑌 1 (𝑝𝑗+1 − 𝑝𝑗 ) − 𝑇𝑌 1 (𝑝𝑗 − 𝑝𝑗−1 )
𝜕𝑦 𝜕𝑦 𝑗+
2
𝑗−
2
For z-direction:
𝜕 𝜕𝑝
𝑉𝑏 (𝜆𝑧 ) ≈ 𝑇𝑍 1 (𝑝𝑘+1 − 𝑝𝑘 ) − 𝑇𝑍 1 (𝑝𝑘 − 𝑝𝑘−1 )
𝜕𝑧 𝜕𝑧 𝑘+
2
𝑘−
2
𝜕 𝜕 𝜕𝑧
(𝜆𝑤𝑧 𝛾𝑤 ∇𝑧) = (𝜆𝑧 𝛾𝑧 )
𝜕𝑧 𝜕𝑧 𝜕𝑧
𝑧𝑘+1 − 𝑧𝑘 𝑧𝑘 − 𝑧𝑘−1
𝜆 1(
∆𝑧 ) − 𝜆𝑧,𝑘−12 ( ∆𝑥 )
𝜕 𝜕𝑧 𝑧,𝑘+
2
(𝜆𝑧 𝛾𝑧 ) ≈
𝜕𝑧 𝜕𝑧 ∆𝑧
𝜕 𝜕𝑧 𝑧𝑖+1 − 𝑧𝑖 𝑧𝑘 − 𝑧𝑘−1
𝑉𝑏 (𝜆𝑧 𝛾𝑧 ) ≈ 𝜆 1 ∆𝑥∆𝑦 ( ) − 𝜆 1 ∆𝑥∆𝑦 ( )
𝜕𝑧 𝜕𝑧 𝑘+
2 ∆𝑧 𝑘−
2 ∆𝑧
Submitting again the term of transmissibility,
∆𝑥∆𝑦
𝑇𝑍 1 = 𝜆 1
𝑘+
2 ∆𝑧 𝑘+2
𝜕 𝜕𝑧
𝑉𝑏 (𝜆𝑧 𝛾𝑧 ) ≈ 𝑇𝑍 1 𝛾 1 [𝑧𝑘+1 − 𝑧𝑘 ] − 𝑇𝑍 1 𝛾 1 [𝑧𝑘 − 𝑧𝑘−1 ]
𝜕𝑧 𝜕𝑧 𝑘+ 𝑘+
2 2
𝑘− 𝑘−
2 2
𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕
𝑉𝑏 [ (𝜆𝑔𝑥 ) + (𝜆𝑔𝑦 ) + (𝜆𝑔𝑧 ) − (𝜆𝑔𝑧 𝛾𝑔 ∇𝑧)]
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑧 𝜕𝑧 𝜕𝑧
= 𝑇𝑋 1 (𝑝𝑔,𝑖+1 − 𝑝𝑔,𝑖 ) − 𝑇𝑋𝑔,𝑖−1 (𝑝𝑔,𝑖 − 𝑝𝑔,𝑖−1 )
𝑔,𝑖+
2 2
𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕 𝜕𝑝 𝜕
𝑉𝑏 [ (𝜆𝑔𝑥 ) + (𝜆𝑔𝑦 ) + (𝜆𝑔𝑧 ) − (𝜆𝑔𝑧 𝛾𝑔 ∇𝑧)]
𝜕𝑥 𝜕𝑥 𝜕𝑦 𝜕𝑦 𝜕𝑧 𝜕𝑧 𝜕𝑧
with :
𝜕 𝜙𝑆𝑔
( ) + 𝑄𝑔
𝜕𝑡 𝐵𝑔
Since LHS is multiplied by Vb, then the RHS is also multiplied by Vb. Using
𝜕 ∅𝑆
backward method, the value of 𝑉𝑏 𝜕𝑡 [ 𝐵 ] is obtained:
𝜕𝑝 𝑝𝑡+1 − 𝑝𝑡
=
𝜕𝑡 ∆𝑡
𝜕 ∅𝑆 𝑡 𝑉𝑏 ∅𝑆 𝑡+1 ∅𝑆 𝑡
𝑉𝑏 [ ] = [( ) −( ) ]
𝜕𝑡 𝐵 ∆𝑡 𝐵 𝐵
𝑡 𝑡+1 𝑡
𝜕 𝜙𝑆𝑔 𝑉𝑏 𝜙𝑆𝑔 𝜙𝑆𝑔
𝑉𝑏 [ ] + 𝑄𝑔 = [( ) −( ) ] + 𝑄𝑔
𝜕𝑡 𝐵𝑔 ∆𝑡 𝐵𝑔 𝐵𝑔
By procedure of discretization for RHS and LHS, thus the diffusivity equation for gas and
water becomes:
- GAS EQUATION
𝜕 𝜙𝑆𝑔
𝑉𝑏 ∇ ∙ (𝜆𝑔 (∇𝑃𝑔 − 𝛾𝑔 ∇𝑧)) = 𝑉𝑏 ( ) + 𝑄𝑔
𝜕𝑡 𝐵𝑔
𝜕 𝜙(1 − 𝑆𝑤 )
𝑉𝑏 ∇[𝜆𝑔 (∇(𝑝𝑐𝑔𝑤 + 𝑝𝑤 ) − 𝛾𝑔 ∇𝑧)] = 𝑞𝑔 + 𝑉𝑏 ( )
𝜕𝑡 𝐵𝑔
- Water
𝜕 𝜙𝑆𝑤
𝑉𝑏 ∇[𝜆𝑤 (∇𝑝𝑤 − 𝛾𝑤 ∇𝑧)] = 𝑞𝑤 + 𝑉𝑏 ( )
𝜕𝑡 𝐵𝑤
- Water
𝜕𝐹𝑤 𝜕𝐹𝑤
𝐹𝑤(𝑆𝑤 + ∆𝑆𝑤 , 𝑝𝑤 + ∆𝑝𝑤 ) = 𝐹𝑤(𝑆𝑤 , 𝑝𝑤 ) + ∆𝑆𝑤 + ∆𝑝𝑤
𝜕𝑝𝑤 𝜕𝑆𝑤
The first guess for the New Rhapson solving method gives:
𝐹𝑔(𝑆𝑤 + ∆𝑆𝑤 , 𝑝𝑤 + ∆𝑝𝑤 ) = 𝐹𝑤(𝑆𝑤 + ∆𝑆𝑤 , 𝑝𝑤 + ∆𝑝𝑤 ) = 0
Then, the equations above become:
- Gas
𝜕𝐹𝑔 𝜕𝐹𝑔
−𝐹𝑔(𝑆𝑤 , 𝑝𝑤 ) = ∆𝑆𝑤 + ∆𝑝𝑤
𝜕𝑝𝑤 𝜕𝑆𝑤
- Water
𝜕𝐹𝑤 𝜕𝐹𝑤
−𝐹𝑤(𝑆𝑤 , 𝑝𝑤 ) = ∆𝑆𝑤 + ∆𝑝𝑤
𝜕𝑝𝑤 𝜕𝑆𝑤
The system of the equations of gas and water then can be represented in the form of Jacobian
Matrix:
𝜕𝐹𝑔 𝜕𝐹𝑔
𝜕𝑝𝑤 𝜕𝑆𝑤 ∆𝑆𝑤 𝐹𝑔(𝑆𝑤 , 𝑝𝑤 )
[ ] = −[ ]
𝜕𝐹𝑤 𝜕𝐹𝑤 ∆𝑝𝑤 𝐹𝑤(𝑆𝑤 , 𝑝𝑤 )
[ 𝜕𝑝𝑤 𝜕𝑆𝑤 ]
𝜕𝐹𝑔 𝜕𝐹𝑔 −1
∆𝑆 𝜕𝑝𝑤 𝜕𝑆𝑤 𝐹𝑔(𝑆𝑤 , 𝑝𝑤 )
[ 𝑤] = − [ ]
∆𝑝𝑤 𝜕𝐹𝑤 𝜕𝐹𝑤 𝐹𝑤(𝑆𝑤 , 𝑝𝑤 )
[ 𝜕𝑝𝑤 𝜕𝑆𝑤 ]
𝜕𝐹𝑤 𝜕𝐹𝑔
−
𝜕𝑆𝑤 𝜕𝑆𝑤 𝐹𝑔(𝑆𝑤 , 𝑝𝑤 )
−[ ][ ]
𝜕𝐹𝑤 𝜕𝐹𝑔 𝐹𝑤(𝑆𝑤 , 𝑝𝑤 )
−
∆𝑆𝑤 𝜕𝑝𝑤 𝜕𝑝𝑤
[ ]=
∆𝑝𝑤 𝜕𝐹𝑔 𝜕𝐹𝑔
𝜕𝑝 𝜕𝑆𝑤
| 𝑤 |
𝜕𝐹𝑤 𝜕𝐹𝑤
𝜕𝑝𝑤 𝜕𝑆𝑤
𝜕𝐹𝑤 𝜕𝐹𝑔
−
𝜕𝑆𝑤 𝜕𝑆𝑤 𝐹𝑔(𝑆𝑤 , 𝑝𝑤 )
[ ][ ]
𝜕𝐹𝑤 𝜕𝐹𝑔 𝐹𝑤(𝑆𝑤 , 𝑝𝑤 )
−
∆𝑆 𝜕𝑝𝑤 𝜕𝑝𝑤
[ 𝑤] =
∆𝑝𝑤 𝜕𝐹𝑔 𝜕𝐹𝑤 𝜕𝐹𝑔 𝜕𝐹𝑤
−
𝜕𝑝𝑤 𝜕𝑆𝑤 𝜕𝑆𝑤 𝜕𝑝𝑤
Evaluate mat.
Read data (1) Balance error (9)
Inputdata.f90 Mbal_error.f90
End
C
Intialize (2)
Check
Init_con.f90 convergence
Time = time + dt
Solver.f90
Well.f90 Jacobian.f90