rock-physics-open 0.2.1__py3-none-any.whl → 0.3.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rock-physics-open might be problematic. Click here for more details.
- rock_physics_open/equinor_utilities/gen_utilities/dict_to_float.py +6 -1
- rock_physics_open/equinor_utilities/gen_utilities/dim_check_vector.py +35 -5
- rock_physics_open/equinor_utilities/gen_utilities/filter_input.py +11 -6
- rock_physics_open/equinor_utilities/gen_utilities/filter_output.py +29 -19
- rock_physics_open/equinor_utilities/machine_learning_utilities/__init__.py +18 -5
- rock_physics_open/equinor_utilities/machine_learning_utilities/base_pressure_model.py +172 -0
- rock_physics_open/equinor_utilities/machine_learning_utilities/exponential_model.py +100 -86
- rock_physics_open/equinor_utilities/machine_learning_utilities/friable_pressure_models.py +230 -0
- rock_physics_open/equinor_utilities/machine_learning_utilities/import_ml_models.py +23 -4
- rock_physics_open/equinor_utilities/machine_learning_utilities/patchy_cement_pressure_models.py +280 -0
- rock_physics_open/equinor_utilities/machine_learning_utilities/polynomial_model.py +128 -0
- rock_physics_open/equinor_utilities/machine_learning_utilities/sigmoidal_model.py +204 -155
- rock_physics_open/equinor_utilities/optimisation_utilities/__init__.py +19 -0
- rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py +16 -8
- rock_physics_open/equinor_utilities/snapshot_test_utilities/snapshots.py +33 -10
- rock_physics_open/fluid_models/brine_model/brine_properties.py +70 -35
- rock_physics_open/fluid_models/gas_model/gas_properties.py +79 -37
- rock_physics_open/fluid_models/oil_model/dead_oil_density.py +21 -16
- rock_physics_open/fluid_models/oil_model/dead_oil_velocity.py +9 -7
- rock_physics_open/fluid_models/oil_model/live_oil_density.py +16 -13
- rock_physics_open/fluid_models/oil_model/live_oil_velocity.py +3 -3
- rock_physics_open/fluid_models/oil_model/oil_properties.py +59 -29
- rock_physics_open/sandstone_models/__init__.py +2 -0
- rock_physics_open/sandstone_models/constant_cement_optimisation.py +4 -1
- rock_physics_open/sandstone_models/friable_optimisation.py +4 -1
- rock_physics_open/sandstone_models/patchy_cement_model.py +89 -6
- rock_physics_open/sandstone_models/patchy_cement_optimisation.py +4 -1
- rock_physics_open/t_matrix_models/__init__.py +0 -10
- rock_physics_open/t_matrix_models/carbonate_pressure_substitution.py +1 -1
- rock_physics_open/t_matrix_models/curvefit_t_matrix_exp.py +1 -2
- rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_exp.py +3 -3
- rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_petec.py +5 -1
- rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_exp.py +5 -1
- rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_min.py +4 -1
- rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_exp.py +5 -1
- rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_min.py +4 -1
- rock_physics_open/version.py +16 -3
- {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/METADATA +4 -8
- {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/RECORD +43 -38
- /rock_physics_open/{t_matrix_models → equinor_utilities/optimisation_utilities}/opt_subst_utilities.py +0 -0
- {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/WHEEL +0 -0
- {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/licenses/LICENSE +0 -0
- {rock_physics_open-0.2.1.dist-info → rock_physics_open-0.3.0.dist-info}/top_level.txt +0 -0
|
@@ -14,16 +14,16 @@ def brine_properties(
|
|
|
14
14
|
p_cacl: np.ndarray | float | None = None,
|
|
15
15
|
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
|
|
16
16
|
"""
|
|
17
|
-
:param salinity: Salinity of solution as ppm of NaCl.
|
|
18
|
-
:param pressure: Pressure
|
|
19
|
-
:param temperature: Temperature
|
|
17
|
+
:param salinity: Salinity of solution as [ppm] of NaCl.
|
|
18
|
+
:param pressure: Pressure [Pa]
|
|
19
|
+
:param temperature: Temperature [°C]
|
|
20
20
|
:param p_nacl: NaCl percentage, for future use
|
|
21
21
|
:param p_kcl: KCl percentage, for future use
|
|
22
22
|
:param p_cacl: CaCl percentage, for future use
|
|
23
|
-
:return: vel_b [m/s], den_b [kg/m^3], k_b [Pa]
|
|
23
|
+
:return: Brine velocity vel_b [m/s], brine density den_b [kg/m^3], brine bulk modulus k_b [Pa]
|
|
24
24
|
"""
|
|
25
|
-
vel_b = brine_primary_velocity(temperature, pressure
|
|
26
|
-
den_b = brine_density(temperature, pressure
|
|
25
|
+
vel_b = brine_primary_velocity(temperature, pressure, salinity)
|
|
26
|
+
den_b = brine_density(temperature, pressure, salinity)
|
|
27
27
|
k_b = vel_b**2 * den_b
|
|
28
28
|
return vel_b, den_b, k_b
|
|
29
29
|
|
|
@@ -35,19 +35,27 @@ def brine_density(
|
|
|
35
35
|
) -> np.ndarray | float:
|
|
36
36
|
"""
|
|
37
37
|
density of sodium chloride solutions, equation 27 in Batzle & Wang [1].
|
|
38
|
-
:param salinity: Salinity of solution
|
|
39
|
-
|
|
40
|
-
:param
|
|
41
|
-
:
|
|
42
|
-
:return: density of solution in g/cc.
|
|
38
|
+
:param salinity: Salinity of solution in ppm
|
|
39
|
+
:param pressure: Pressure [Pa]
|
|
40
|
+
:param temperature: Temperature [°C]
|
|
41
|
+
:return: density of solution in [kg/m^3].
|
|
43
42
|
"""
|
|
43
|
+
# Change unit of pressure to MPa
|
|
44
|
+
pressure_mpa = pressure / 1.0e6
|
|
45
|
+
# Change unit of salinity to fraction
|
|
46
|
+
salinity_frac = salinity / 1.0e6
|
|
47
|
+
|
|
44
48
|
coefficients = [
|
|
45
49
|
[[0.668, 3e-4], [8e-5, -13e-6], [3e-6, 0.0]],
|
|
46
50
|
[[0.44, -24e-4], [-33e-4, 47e-6], [0.0, 0.0]],
|
|
47
51
|
]
|
|
48
|
-
|
|
49
|
-
|
|
52
|
+
water_den = water_density(temperature, pressure)
|
|
53
|
+
brine_correction = (
|
|
54
|
+
salinity_frac
|
|
55
|
+
* polyval3d(salinity_frac, temperature, pressure_mpa, coefficients)
|
|
56
|
+
* 1000.0
|
|
50
57
|
)
|
|
58
|
+
return water_den + brine_correction
|
|
51
59
|
|
|
52
60
|
|
|
53
61
|
def brine_primary_velocity(
|
|
@@ -58,12 +66,16 @@ def brine_primary_velocity(
|
|
|
58
66
|
"""
|
|
59
67
|
Primary wave velocity of sodium chloride solutions, equation 29 in Batzle & Wang [1]
|
|
60
68
|
|
|
61
|
-
:param salinity: Salinity of solution as
|
|
62
|
-
|
|
63
|
-
:param
|
|
64
|
-
:param temperature: Temperature (Celsius) of oil.
|
|
69
|
+
:param salinity: Salinity of solution as [ppm] of sodium chloride
|
|
70
|
+
:param pressure: Pressure [Pa]
|
|
71
|
+
:param temperature: Temperature [°C]
|
|
65
72
|
:return: velocity of solution in m/s.
|
|
66
73
|
"""
|
|
74
|
+
# Change unit for salinity from ppm to fraction
|
|
75
|
+
salinity_frac = salinity / 1.0e6
|
|
76
|
+
# Change the unit for pressure from Pa to MPa
|
|
77
|
+
pressure_mpa = pressure / 1.0e6
|
|
78
|
+
|
|
67
79
|
coefficients = np.zeros((3, 4, 3))
|
|
68
80
|
coefficients[0, 0, 0] = 1170
|
|
69
81
|
coefficients[0, 1, 0] = -9.6
|
|
@@ -77,8 +89,8 @@ def brine_primary_velocity(
|
|
|
77
89
|
coefficients[1, 0, 2] = 0.16
|
|
78
90
|
coefficients[2, 0, 0] = -820
|
|
79
91
|
|
|
80
|
-
return water_primary_velocity(temperature, pressure) +
|
|
81
|
-
sqrt(
|
|
92
|
+
return water_primary_velocity(temperature, pressure) + salinity_frac * polyval3d(
|
|
93
|
+
sqrt(salinity_frac), temperature, pressure_mpa, coefficients
|
|
82
94
|
)
|
|
83
95
|
|
|
84
96
|
|
|
@@ -88,17 +100,20 @@ def water_density(
|
|
|
88
100
|
) -> np.ndarray | float:
|
|
89
101
|
"""
|
|
90
102
|
Density of water,, equation 27a in Batzle & Wang [1].
|
|
91
|
-
:param pressure: Pressure
|
|
92
|
-
:param temperature: Temperature
|
|
93
|
-
:return: Density of water in
|
|
103
|
+
:param pressure: Pressure [Pa]
|
|
104
|
+
:param temperature: Temperature [°C]
|
|
105
|
+
:return: Density of water in [kg/m^3].
|
|
94
106
|
"""
|
|
107
|
+
# Change unit of pressure from Pa to MPa
|
|
108
|
+
pressure_mpa = pressure / 1.0e6
|
|
109
|
+
|
|
95
110
|
coefficients = [
|
|
96
111
|
[1.0, 489e-6, -333e-9],
|
|
97
112
|
[-8e-5, -2e-6, -2e-09],
|
|
98
113
|
[-33e-7, 16e-9, 0.0],
|
|
99
114
|
[1.75e-9, -13e-12, 0.0],
|
|
100
115
|
]
|
|
101
|
-
return polyval2d(temperature,
|
|
116
|
+
return polyval2d(temperature, pressure_mpa, coefficients) * 1000.0
|
|
102
117
|
|
|
103
118
|
|
|
104
119
|
def water_primary_velocity(
|
|
@@ -107,11 +122,14 @@ def water_primary_velocity(
|
|
|
107
122
|
) -> np.ndarray | float:
|
|
108
123
|
"""
|
|
109
124
|
Primary wave velocity of water, table 1 and equation 28 in Batzle & Wang [1].
|
|
110
|
-
:param pressure: Pressure
|
|
111
|
-
:param temperature: Temperature
|
|
125
|
+
:param pressure: Pressure [Pa]
|
|
126
|
+
:param temperature: Temperature [°C]
|
|
112
127
|
:return: primary wave velocity of water in m/s.
|
|
113
128
|
"""
|
|
114
|
-
|
|
129
|
+
# Change unit of pressure from Pa to MPa
|
|
130
|
+
pressure_mpa = pressure / 1.0e6
|
|
131
|
+
|
|
132
|
+
if np.any(pressure_mpa > 100):
|
|
115
133
|
warnings.warn(
|
|
116
134
|
"Calculations for water velocity is not precise for\n"
|
|
117
135
|
+ "pressure outside [0,100]MPa"
|
|
@@ -125,19 +143,36 @@ def water_primary_velocity(
|
|
|
125
143
|
[1.487e-4, -6.503e-7, -1.455e-8, 1.327e-10],
|
|
126
144
|
[-2.197e-7, 7.987e-10, 5.23e-11, -4.614e-13],
|
|
127
145
|
]
|
|
128
|
-
return polyval2d(temperature,
|
|
146
|
+
return polyval2d(temperature, pressure_mpa, coefficients)
|
|
129
147
|
|
|
130
148
|
|
|
131
149
|
def water(
|
|
132
150
|
temperature: np.ndarray | float, pressure: np.ndarray | float
|
|
133
151
|
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
|
|
134
152
|
"""
|
|
135
|
-
:param pressure: Pressure
|
|
136
|
-
:param temperature: Temperature
|
|
137
|
-
:return:
|
|
153
|
+
:param pressure: Pressure [Pa]
|
|
154
|
+
:param temperature: Temperature [°C]
|
|
155
|
+
:return: water_velocity [m/s], water_density [kg/m^3], water_bulk_modulus [Pa]
|
|
138
156
|
"""
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
157
|
+
water_den = water_density(temperature, pressure)
|
|
158
|
+
water_vel = water_primary_velocity(temperature, pressure)
|
|
159
|
+
water_k = water_vel**2 * water_den
|
|
160
|
+
return water_vel, water_den, water_k
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
def brine_viscosity(
|
|
164
|
+
temperature: np.ndarray | float,
|
|
165
|
+
salinity: np.ndarray | float,
|
|
166
|
+
) -> np.ndarray | float:
|
|
167
|
+
"""
|
|
168
|
+
Brine viscosity according to Batzle & Wang [1].
|
|
169
|
+
|
|
170
|
+
Based on equation 32.
|
|
171
|
+
"""
|
|
172
|
+
salinity_frac = salinity / 1.0e6
|
|
173
|
+
return (
|
|
174
|
+
0.1
|
|
175
|
+
+ 0.333 * salinity_frac
|
|
176
|
+
+ (1.65 + 91.9 * salinity_frac**3)
|
|
177
|
+
* np.exp(-(0.42 * (salinity_frac**0.8 - 0.17) ** 2 + 0.045) * temperature**0.8)
|
|
178
|
+
)
|
|
@@ -4,7 +4,7 @@ from scipy.constants import gas_constant
|
|
|
4
4
|
|
|
5
5
|
from rock_physics_open.equinor_utilities.conversions import celsius_to_kelvin
|
|
6
6
|
|
|
7
|
-
AIR_WEIGHT = 28.8 #
|
|
7
|
+
AIR_WEIGHT = 28.8 * 1.0e-3 # kg/mol
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
def gas_properties(
|
|
@@ -20,10 +20,11 @@ def gas_properties(
|
|
|
20
20
|
:param model: for future use
|
|
21
21
|
:return: vel_gas [m/s], den_gas [kg/m^3], k_gas [Pa], eta_gas [cP]
|
|
22
22
|
"""
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
)
|
|
23
|
+
|
|
24
|
+
den_gas = gas_density(celsius_to_kelvin(temperature), pressure, gas_gravity)
|
|
25
|
+
|
|
26
|
+
k_gas = gas_bulk_modulus(celsius_to_kelvin(temperature), pressure, gas_gravity)
|
|
27
|
+
|
|
27
28
|
vel_gas = (k_gas / den_gas) ** 0.5
|
|
28
29
|
|
|
29
30
|
eta_gas = lee_gas_viscosity(celsius_to_kelvin(temperature), pressure, gas_gravity)
|
|
@@ -33,9 +34,9 @@ def gas_properties(
|
|
|
33
34
|
|
|
34
35
|
def molecular_weight(gas_gravity: np.ndarray | float) -> np.ndarray | float:
|
|
35
36
|
"""
|
|
36
|
-
calculates
|
|
37
|
+
calculates molecular weight of a gas from gas gravity.
|
|
37
38
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
38
|
-
:return: The volume of the gas in
|
|
39
|
+
:return: The volume of the gas in kg/mol.
|
|
39
40
|
"""
|
|
40
41
|
return gas_gravity * AIR_WEIGHT
|
|
41
42
|
|
|
@@ -47,9 +48,10 @@ def molar_volume(
|
|
|
47
48
|
"""
|
|
48
49
|
calculates molar volume using the ideal gas law.
|
|
49
50
|
:param absolute_temperature: The absolute temperature of the gas in kelvin.
|
|
50
|
-
:param pressure: Confining pressure in
|
|
51
|
-
:return: The volume of the gas in
|
|
51
|
+
:param pressure: Confining pressure in Pa.
|
|
52
|
+
:return: The volume of the gas in m^3/mol.
|
|
52
53
|
"""
|
|
54
|
+
|
|
53
55
|
return gas_constant * absolute_temperature / pressure
|
|
54
56
|
|
|
55
57
|
|
|
@@ -62,8 +64,8 @@ def ideal_gas_density(
|
|
|
62
64
|
calculates molar volume using the ideal gas law.
|
|
63
65
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
64
66
|
:param absolute_temperature: The absolute temperature of the gas in kelvin.
|
|
65
|
-
:param pressure: Confining pressure in
|
|
66
|
-
:return: The density of the gas in
|
|
67
|
+
:param pressure: Confining pressure in Pa.
|
|
68
|
+
:return: The density of the gas in kg/m^3
|
|
67
69
|
"""
|
|
68
70
|
return molecular_weight(gas_gravity) / molar_volume(absolute_temperature, pressure)
|
|
69
71
|
|
|
@@ -89,13 +91,11 @@ def ideal_gas(
|
|
|
89
91
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
90
92
|
:param absolute_temperature: The absolute temperature of the gas in kelvin.
|
|
91
93
|
:param pressure: Confining pressure in Pa.
|
|
92
|
-
:return: ideal_gas_density,
|
|
94
|
+
:return: ideal_gas_velocity [m/s], ideal_gas_density [kg/m^3],
|
|
93
95
|
"""
|
|
94
|
-
ideal_gas_den =
|
|
95
|
-
absolute_temperature, pressure * 1e6, gas_gravity
|
|
96
|
-
)
|
|
96
|
+
ideal_gas_den = ideal_gas_density(absolute_temperature, pressure, gas_gravity)
|
|
97
97
|
ideal_gas_vel = ideal_gas_primary_velocity(absolute_temperature, gas_gravity)
|
|
98
|
-
return
|
|
98
|
+
return ideal_gas_vel, ideal_gas_den
|
|
99
99
|
|
|
100
100
|
|
|
101
101
|
def pseudoreduced_temperature(
|
|
@@ -132,13 +132,13 @@ def pseudoreduced_pressure(
|
|
|
132
132
|
Tech., 22, 889-892.
|
|
133
133
|
|
|
134
134
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
135
|
-
:param pressure: Confining pressure in
|
|
136
|
-
:return: Pseudoreduced pressure in
|
|
135
|
+
:param pressure: Confining pressure in Pa.
|
|
136
|
+
:return: Pseudoreduced pressure in Pa.
|
|
137
137
|
"""
|
|
138
138
|
return pressure / (4.892 - 0.4048 * gas_gravity)
|
|
139
139
|
|
|
140
140
|
|
|
141
|
-
def
|
|
141
|
+
def compressibility_factor(
|
|
142
142
|
absolute_temperature: np.ndarray | float,
|
|
143
143
|
pressure: np.ndarray | float,
|
|
144
144
|
gas_gravity: np.ndarray | float,
|
|
@@ -149,11 +149,13 @@ def compressability_factor(
|
|
|
149
149
|
|
|
150
150
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
151
151
|
:param absolute_temperature: The absolute temperature of the gas in kelvin.
|
|
152
|
-
:param pressure: Confining pressure in
|
|
153
|
-
:return:
|
|
152
|
+
:param pressure: Confining pressure in Pa.
|
|
153
|
+
:return: Gas compressibility - unitless
|
|
154
154
|
"""
|
|
155
155
|
tpr = pseudoreduced_temperature(absolute_temperature, gas_gravity)
|
|
156
|
-
|
|
156
|
+
|
|
157
|
+
# Pseudoreduced pressure has unit MPa in equation
|
|
158
|
+
ppr = pseudoreduced_pressure(pressure, gas_gravity) * 1.0e-6
|
|
157
159
|
|
|
158
160
|
return (
|
|
159
161
|
(0.03 + 0.00527 * (3.5 - tpr) ** 3) * ppr
|
|
@@ -162,7 +164,7 @@ def compressability_factor(
|
|
|
162
164
|
- 0.52
|
|
163
165
|
+ 0.109
|
|
164
166
|
* (3.85 - tpr) ** 2
|
|
165
|
-
/ exp((0.45 + 8 * (0.56 - 1 / tpr) ** 2) * ppr**1.2 / tpr)
|
|
167
|
+
/ exp((0.45 + 8.0 * (0.56 - 1 / tpr) ** 2) * ppr**1.2 / tpr)
|
|
166
168
|
)
|
|
167
169
|
|
|
168
170
|
|
|
@@ -176,18 +178,17 @@ def gas_density(
|
|
|
176
178
|
|
|
177
179
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
178
180
|
:param absolute_temperature: The absolute temperature of the gas in kelvin.
|
|
179
|
-
:param pressure: Confining pressure in
|
|
180
|
-
:return: The density of the gas in
|
|
181
|
+
:param pressure: Confining pressure in Pa.
|
|
182
|
+
:return: The density of the gas in kg/m^3
|
|
181
183
|
"""
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
return ideal_gas_den / compressability_factor(
|
|
184
|
+
|
|
185
|
+
_, ideal_gas_den = ideal_gas(absolute_temperature, pressure, gas_gravity)
|
|
186
|
+
return ideal_gas_den / compressibility_factor(
|
|
186
187
|
absolute_temperature, pressure, gas_gravity
|
|
187
188
|
)
|
|
188
189
|
|
|
189
190
|
|
|
190
|
-
def
|
|
191
|
+
def compressibility_rate_per_pseudoreduced_pressure(
|
|
191
192
|
absolute_temperature: np.ndarray | float,
|
|
192
193
|
pressure: np.ndarray | float,
|
|
193
194
|
gas_gravity: np.ndarray | float,
|
|
@@ -198,10 +199,12 @@ def compressability_rate_per_pseudoreduced_pressure(
|
|
|
198
199
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
199
200
|
:param absolute_temperature: The absolute temperature of the gas in kelvin.
|
|
200
201
|
:param pressure: Confining pressure in MPa.
|
|
201
|
-
:return:
|
|
202
|
+
:return: Derivative of the compressibility factor (unitless) with respect to pseudoreduced pressure
|
|
202
203
|
"""
|
|
203
204
|
tpr = pseudoreduced_temperature(absolute_temperature, gas_gravity)
|
|
204
|
-
|
|
205
|
+
|
|
206
|
+
# Pseudoreduced pressure is expected to be in MPa in the expression
|
|
207
|
+
ppr = pseudoreduced_pressure(pressure, gas_gravity) * 1.0e-6
|
|
205
208
|
|
|
206
209
|
return (
|
|
207
210
|
0.03
|
|
@@ -226,15 +229,16 @@ def gas_bulk_modulus(
|
|
|
226
229
|
|
|
227
230
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
228
231
|
:param absolute_temperature: The absolute temperature of the gas in kelvin.
|
|
229
|
-
:param pressure: Confining pressure in
|
|
230
|
-
:return: The bulk modulus of the gas in
|
|
232
|
+
:param pressure: Confining pressure in Pa.
|
|
233
|
+
:return: The bulk modulus of the gas in Pa.
|
|
231
234
|
"""
|
|
232
|
-
z =
|
|
233
|
-
dz_dppr =
|
|
235
|
+
z = compressibility_factor(absolute_temperature, pressure, gas_gravity)
|
|
236
|
+
dz_dppr = compressibility_rate_per_pseudoreduced_pressure(
|
|
234
237
|
absolute_temperature, pressure, gas_gravity
|
|
235
238
|
)
|
|
236
239
|
|
|
237
|
-
ppr
|
|
240
|
+
# Set ppr in unit MPa in order to use it in calculation of gamma_0
|
|
241
|
+
ppr = pseudoreduced_pressure(pressure, gas_gravity) * 1.0e-6
|
|
238
242
|
|
|
239
243
|
# Equation 11b
|
|
240
244
|
gamma_0 = (
|
|
@@ -247,6 +251,44 @@ def gas_bulk_modulus(
|
|
|
247
251
|
return gamma_0 * pressure / (1 - dz_dppr * ppr / z)
|
|
248
252
|
|
|
249
253
|
|
|
254
|
+
def gas_viscosity(
|
|
255
|
+
absolute_temperature: np.ndarray | float,
|
|
256
|
+
pressure: np.ndarray | float,
|
|
257
|
+
gas_gravity: np.ndarray | float,
|
|
258
|
+
) -> np.ndarray | float:
|
|
259
|
+
"""
|
|
260
|
+
The gas viscosity of hydrocarbon gas, using equations 12 and 13 of Batzle & Wang [1].
|
|
261
|
+
|
|
262
|
+
:param absolute_temperature: The absolute temperature of the gas in kelvin.
|
|
263
|
+
:param pressure: Confining pressure in Pa.
|
|
264
|
+
:param gas_gravity: molar mass of gas relative to air mas.
|
|
265
|
+
:return: The gas viscosity of the gas in cP.
|
|
266
|
+
"""
|
|
267
|
+
temp_pr = pseudoreduced_temperature(absolute_temperature, gas_gravity)
|
|
268
|
+
|
|
269
|
+
# Pseudoreduced pressure should be in unit MPa
|
|
270
|
+
pres_pr = pseudoreduced_pressure(pressure, gas_gravity) * 1.0e-6
|
|
271
|
+
|
|
272
|
+
eta_1 = 0.0001 * (
|
|
273
|
+
temp_pr * (28.0 + 48.0 * gas_gravity - 5.0 * gas_gravity**2)
|
|
274
|
+
- 6.47 * gas_gravity**-2
|
|
275
|
+
+ 35.0 * gas_gravity**-1
|
|
276
|
+
+ 1.14 * gas_gravity
|
|
277
|
+
- 15.55
|
|
278
|
+
)
|
|
279
|
+
return eta_1 * (
|
|
280
|
+
0.001
|
|
281
|
+
* pres_pr
|
|
282
|
+
* (
|
|
283
|
+
(1057.0 - 8.08 * temp_pr) / pres_pr
|
|
284
|
+
+ (796.0 * pres_pr**0.5 - 704.0)
|
|
285
|
+
/ (((temp_pr - 1.0) ** 0.7) * (pres_pr + 1.0))
|
|
286
|
+
- 3.24 * temp_pr
|
|
287
|
+
- 38.0
|
|
288
|
+
)
|
|
289
|
+
)
|
|
290
|
+
|
|
291
|
+
|
|
250
292
|
def lee_gas_viscosity(
|
|
251
293
|
absolute_temperature: np.ndarray | float,
|
|
252
294
|
pressure: np.ndarray | float,
|
|
@@ -10,17 +10,19 @@ def pressure_adjusted_dead_oil_density(
|
|
|
10
10
|
|
|
11
11
|
Uses equation 18 from Batzle & Wang [1].
|
|
12
12
|
|
|
13
|
-
:param reference_density: The density
|
|
13
|
+
:param reference_density: The density [kg/m^3] of the dead oil at 15.6 degrees Celsius
|
|
14
14
|
and atmospheric pressure.
|
|
15
|
-
:param pressure: Pressure
|
|
15
|
+
:param pressure: Pressure [Pa] to adjust to.
|
|
16
16
|
:return: Density of oil at given pressure and 21 degrees Celsius (~70 degrees
|
|
17
|
-
Farenheit).
|
|
17
|
+
Farenheit). [kg/m^3]
|
|
18
18
|
"""
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
+
|
|
19
|
+
pressure_mpa = pressure / 1e6
|
|
20
|
+
density_gcc = reference_density / 1000.0
|
|
21
|
+
return 1000.0 * (
|
|
22
|
+
density_gcc
|
|
23
|
+
+ (0.00277 * pressure_mpa - 1.71e-7 * pressure_mpa**3)
|
|
24
|
+
* (density_gcc - 1.15) ** 2
|
|
25
|
+
+ 3.49e-4 * pressure_mpa
|
|
24
26
|
)
|
|
25
27
|
|
|
26
28
|
|
|
@@ -33,11 +35,14 @@ def temperature_adjusted_dead_oil_density(
|
|
|
33
35
|
|
|
34
36
|
Uses equation 19 from Batzle & Wang [1].
|
|
35
37
|
|
|
36
|
-
:param density_at_21c: The density
|
|
37
|
-
:param temperature: Temperature
|
|
38
|
-
:return: Density of oil at given temperature.
|
|
38
|
+
:param density_at_21c: The density [kg/m^3] of the dead oil at 21 degrees Celsius
|
|
39
|
+
:param temperature: Temperature [°C] of oil.
|
|
40
|
+
:return: Density of oil at given temperature. [kg/m^3]
|
|
39
41
|
"""
|
|
40
|
-
|
|
42
|
+
density_at_21c_gcc = density_at_21c / 1000.0
|
|
43
|
+
return (
|
|
44
|
+
1000.0 * density_at_21c_gcc / (0.972 + 3.81e-4 * (temperature + 17.78) ** 1.175)
|
|
45
|
+
)
|
|
41
46
|
|
|
42
47
|
|
|
43
48
|
def dead_oil_density(
|
|
@@ -51,10 +56,10 @@ def dead_oil_density(
|
|
|
51
56
|
Uses equation 18 & 19 from Batzle & Wang [1].
|
|
52
57
|
|
|
53
58
|
:param reference_density: Density of oil at 15.6 degrees Celsius and atmospheric
|
|
54
|
-
pressure
|
|
55
|
-
:param pressure: Pressure
|
|
56
|
-
:param temperature: Temperature
|
|
57
|
-
:return: density of dead oil at given conditions.
|
|
59
|
+
pressure [kg/m^3]
|
|
60
|
+
:param pressure: Pressure [Pa] of oil
|
|
61
|
+
:param temperature: Temperature [°C] of oil.
|
|
62
|
+
:return: density of dead oil at given conditions (kg/m^3).
|
|
58
63
|
"""
|
|
59
64
|
density_p = pressure_adjusted_dead_oil_density(pressure, reference_density)
|
|
60
65
|
return temperature_adjusted_dead_oil_density(temperature, density_p)
|
|
@@ -12,17 +12,19 @@ def dead_oil_velocity(
|
|
|
12
12
|
Uses equation 20a from Batzle & Wang [1].
|
|
13
13
|
|
|
14
14
|
:param reference_density: Density of oil at 15.6 degrees Celsius and atmospheric
|
|
15
|
-
pressure
|
|
16
|
-
:param pressure: Pressure
|
|
17
|
-
:param temperature: Temperature
|
|
15
|
+
pressure [kg/m^3]
|
|
16
|
+
:param pressure: Pressure [Pa] of oil
|
|
17
|
+
:param temperature: Temperature [°C] of oil.
|
|
18
18
|
:return: primary velocity of dead oil in m/s.
|
|
19
19
|
"""
|
|
20
|
+
pressure_mpa = pressure * 1e-6
|
|
21
|
+
density_gcc = reference_density / 1000.0
|
|
20
22
|
return (
|
|
21
|
-
2096 * np.sqrt(
|
|
23
|
+
2096 * np.sqrt(density_gcc / (2.6 - density_gcc))
|
|
22
24
|
- 3.7 * temperature
|
|
23
|
-
+ 4.64 *
|
|
25
|
+
+ 4.64 * pressure_mpa
|
|
24
26
|
+ 0.0115
|
|
25
|
-
* (4.12 * np.sqrt(1.08 *
|
|
27
|
+
* (4.12 * np.sqrt(1.08 * density_gcc**-1 - 1) - 1)
|
|
26
28
|
* temperature
|
|
27
|
-
*
|
|
29
|
+
* pressure_mpa
|
|
28
30
|
)
|
|
@@ -14,17 +14,18 @@ def live_oil_density(
|
|
|
14
14
|
Equation 24 in Batzle & Wang [1].
|
|
15
15
|
|
|
16
16
|
:param reference_density: Density of the oil without dissolved gas
|
|
17
|
-
at 15.6 degrees Celsius and atmospheric pressure.
|
|
18
|
-
:param pressure: Pressure
|
|
17
|
+
at 15.6 degrees Celsius and atmospheric pressure. [kg/m^3]
|
|
18
|
+
:param pressure: Pressure [Pa] of oil (for future implementation only)
|
|
19
19
|
:param gas_oil_ratio: The volume ratio of gas to oil [l/l]
|
|
20
|
-
:param temperature: Temperature
|
|
20
|
+
:param temperature: Temperature [°C] of oil.
|
|
21
21
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
22
|
-
:return: Density of live oil [
|
|
22
|
+
:return: Density of live oil [kg/m^3].
|
|
23
23
|
"""
|
|
24
|
+
density_gcc = reference_density / 1000.0
|
|
24
25
|
b0 = live_oil_volume_factor(
|
|
25
26
|
temperature, reference_density, gas_oil_ratio, gas_gravity
|
|
26
27
|
)
|
|
27
|
-
return (
|
|
28
|
+
return 1000.0 * (density_gcc + 0.0012 * gas_gravity * gas_oil_ratio) / b0
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
def live_oil_pseudo_density(
|
|
@@ -40,16 +41,17 @@ def live_oil_pseudo_density(
|
|
|
40
41
|
Equation 22 in Batzle & Wang [1].
|
|
41
42
|
|
|
42
43
|
:param reference_density: Density of the oil without dissolved gas
|
|
43
|
-
at 15.6 degrees Celsius and atmospheric pressure.
|
|
44
|
+
at 15.6 degrees Celsius and atmospheric pressure. [kg/m^3]
|
|
44
45
|
:param gas_oil_ratio: The volume ratio of gas to oil [l/l]
|
|
45
|
-
:param temperature: Temperature
|
|
46
|
+
:param temperature: Temperature [°C] of oil.
|
|
46
47
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
47
|
-
:return: Pseudo-density of live oil.
|
|
48
|
+
:return: Pseudo-density of live oil [kg/m^3].
|
|
48
49
|
"""
|
|
50
|
+
density_gcc = reference_density / 1000.0
|
|
49
51
|
b0 = live_oil_volume_factor(
|
|
50
52
|
temperature, reference_density, gas_oil_ratio, gas_gravity
|
|
51
53
|
)
|
|
52
|
-
return (
|
|
54
|
+
return 1000.0 * (density_gcc / b0) / (1 + 0.001 * gas_oil_ratio)
|
|
53
55
|
|
|
54
56
|
|
|
55
57
|
def live_oil_volume_factor(
|
|
@@ -61,17 +63,18 @@ def live_oil_volume_factor(
|
|
|
61
63
|
"""
|
|
62
64
|
Volume factor derived by Standing (1962), equation 23 in Batzle & Wang [1].
|
|
63
65
|
:param reference_density: Density of the oil without dissolved gas
|
|
64
|
-
at 15.6 degrees Celsius and atmospheric pressure.
|
|
66
|
+
at 15.6 degrees Celsius and atmospheric pressure. [kg/m^3]
|
|
65
67
|
:param gas_oil_ratio: The volume ratio of gas to oil [l/l]
|
|
66
|
-
:param temperature: Temperature
|
|
68
|
+
:param temperature: Temperature [°C] of oil.
|
|
67
69
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
68
|
-
:return: A volume factor in calculating pseudo-density of live oil.
|
|
70
|
+
:return: A volume factor in calculating pseudo-density of live oil [unitless].
|
|
69
71
|
"""
|
|
72
|
+
density_gcc = reference_density / 1000.0
|
|
70
73
|
return (
|
|
71
74
|
0.972
|
|
72
75
|
+ 0.00038
|
|
73
76
|
* (
|
|
74
|
-
2.4 * gas_oil_ratio * np.sqrt(gas_gravity /
|
|
77
|
+
2.4 * gas_oil_ratio * np.sqrt(gas_gravity / density_gcc)
|
|
75
78
|
+ temperature
|
|
76
79
|
+ 17.8
|
|
77
80
|
)
|
|
@@ -11,10 +11,10 @@ def live_oil_velocity(
|
|
|
11
11
|
Substitute Equation 22 in Equation 20 of Batzle & Wang [1].
|
|
12
12
|
|
|
13
13
|
:param reference_density: Density of the oil without dissolved gas
|
|
14
|
-
at 15.6 degrees Celsius and atmospheric pressure.
|
|
15
|
-
:param pressure: Pressure
|
|
14
|
+
at 15.6 degrees Celsius and atmospheric pressure. [kg/m^3]
|
|
15
|
+
:param pressure: Pressure [Pa] of oil
|
|
16
16
|
:param gas_oil_ratio: The volume ratio of gas to oil [l/l]
|
|
17
|
-
:param temperature: Temperature
|
|
17
|
+
:param temperature: Temperature [°C] of oil.
|
|
18
18
|
:param gas_gravity: molar mass of gas relative to air molar mas.
|
|
19
19
|
:return: Primary wave velocity of live oil [m/s].
|
|
20
20
|
"""
|