forked from gnilson/Tarner-Black-Oil-Simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
OIL.py
executable file
·100 lines (71 loc) · 2.78 KB
/
OIL.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
from math import *
def Rso(p, t , pb , API , SGgas):
#Beggs and Standing Correlation
#UNITS=scf/STB
#T is reservoir temperature, F
#Rs is solution GOR in scf/STB
Yg = 0.00091 * t - 0.0125 * API
if (p > pb):
return SGgas * (pb / (18 * 10 ** Yg)) ** 1.204
else:
return SGgas * (p / (18 * 10 ** Yg)) ** 1.204
def Visoil(p, t, pb, SGgas, API):
#P -Pressure, psia
#T -Temperature, F
#pb-Bubble Point Pressure, psia
#API- Oil API Gravity
#Rsob-Solution gas oil ratio at bubble point
#Rso-Solution Gas Oil Ratio
#Function Returns as Oil viscosity
myRso = Rso(p, t, pb, API, SGgas)
myRsob = Rso(pb, t, pb, API, SGgas)
A = 10.715 * ((myRsob + 100) ** (-0.515))
B = 5.44 * ((myRsob + 150) ** (-0.338))
Uob = A * (10 ** (10 ** (1.8653 - 0.025086 * API - 0.5644 * log10(t))) - 1) ** B
if (p == pb):
return Uob
elif (p > pb):
M = 2.6 * p ** 1.187 * (exp(-11.513 - ((8.98 * 10 ** (-5)) * p)))
return Uob * ((p / float(pb)) ** M)
else:
C = 10.715 * (myRso + 100) ** (-0.515)
D = 5.44 * (myRso + 150) ** (-0.338)
Ucd = C * ((10 ** (10 ** (1.8653 - 0.025086 * API - 0.5644 * log10(t))) - 1) ** D)
return Ucd
def Co(p, t, pb, sepGasGrav, apiOilGrav):
rsob = Rso(pb, t, pb, apiOilGrav, sepGasGrav)
if (p >= pb):
A1 = -1433
A2 = 5
A3 = 17.2
A4 = -1180
A5 = 12.61
A6 = 10 ** 5
return (A1 + A2 * rsob + A3 * t + A4 * sepGasGrav + A5 * apiOilGrav) / (A6 * p)
else:
#This is the Villena and Lanzi correlation from Craft&Hawkins pg 39
return exp(-0.664 - 1.43 * log(p) - 0.395 * log(pb) + 0.39 * log(t+459.67) + 0.455 * log(rsob) + 0.262 * log(apiOilGrav))
def Bo(p, t, pb, rso, sepGasGrav, apiOilGrav):
sgo = (141.5 / (131.5 + apiOilGrav))
f = rso * (sepGasGrav / sgo) ** 0.5 + 1.25 * t
bob = 0.972 + 0.000147 * f ** 1.175
if (p > pb):
return bob * exp(Co(p, t, pb, sepGasGrav, apiOilGrav) * (pb - p))
else:
return bob
def Pb_almarhoun(rsp, SGgas, sgSTO, t):
"""Al-Marhoun "PVT Correlations for Middle East Crude Oils" from McCain pg 519
Note that the equation gives better results when the separator gas-oil ratio is used rather than
the total gas-oil ratio."""
temp = t + 459.67
a1 = 5.38088 * 10 ^ -3
a2 = 0.715082
a3 = -1.87784
a4 = 3.1437
a5 = 1.32657
return a1 * (rsp ** a2) * (SGgas ** a3) * (sgSTO ** a4) * (temp ** a5)
def Pb_standing(rs, SGgas, APIoil, t):
"""Standing bubble point correlation
Rs should include separator gas and stock-tank gas
T in deg F"""
return 18.2 * ((rs / SGgas) ** 0.83 * 10 ** (0.00091 * t - 0.0125 * APIoil) - 1.4)