rock-physics-open 0.2.3__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.

Files changed (42) hide show
  1. rock_physics_open/equinor_utilities/gen_utilities/dict_to_float.py +6 -1
  2. rock_physics_open/equinor_utilities/gen_utilities/dim_check_vector.py +35 -5
  3. rock_physics_open/equinor_utilities/gen_utilities/filter_input.py +11 -6
  4. rock_physics_open/equinor_utilities/gen_utilities/filter_output.py +29 -19
  5. rock_physics_open/equinor_utilities/machine_learning_utilities/__init__.py +18 -5
  6. rock_physics_open/equinor_utilities/machine_learning_utilities/base_pressure_model.py +172 -0
  7. rock_physics_open/equinor_utilities/machine_learning_utilities/exponential_model.py +100 -86
  8. rock_physics_open/equinor_utilities/machine_learning_utilities/friable_pressure_models.py +230 -0
  9. rock_physics_open/equinor_utilities/machine_learning_utilities/import_ml_models.py +23 -4
  10. rock_physics_open/equinor_utilities/machine_learning_utilities/patchy_cement_pressure_models.py +280 -0
  11. rock_physics_open/equinor_utilities/machine_learning_utilities/polynomial_model.py +128 -0
  12. rock_physics_open/equinor_utilities/machine_learning_utilities/sigmoidal_model.py +204 -155
  13. rock_physics_open/equinor_utilities/optimisation_utilities/__init__.py +19 -0
  14. rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py +1 -2
  15. rock_physics_open/fluid_models/brine_model/brine_properties.py +70 -35
  16. rock_physics_open/fluid_models/gas_model/gas_properties.py +79 -37
  17. rock_physics_open/fluid_models/oil_model/dead_oil_density.py +21 -16
  18. rock_physics_open/fluid_models/oil_model/dead_oil_velocity.py +9 -7
  19. rock_physics_open/fluid_models/oil_model/live_oil_density.py +16 -13
  20. rock_physics_open/fluid_models/oil_model/live_oil_velocity.py +3 -3
  21. rock_physics_open/fluid_models/oil_model/oil_properties.py +59 -29
  22. rock_physics_open/sandstone_models/__init__.py +2 -0
  23. rock_physics_open/sandstone_models/constant_cement_optimisation.py +4 -1
  24. rock_physics_open/sandstone_models/friable_optimisation.py +4 -1
  25. rock_physics_open/sandstone_models/patchy_cement_model.py +89 -6
  26. rock_physics_open/sandstone_models/patchy_cement_optimisation.py +4 -1
  27. rock_physics_open/t_matrix_models/__init__.py +0 -10
  28. rock_physics_open/t_matrix_models/carbonate_pressure_substitution.py +1 -1
  29. rock_physics_open/t_matrix_models/curvefit_t_matrix_exp.py +1 -2
  30. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_exp.py +3 -3
  31. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_petec.py +5 -1
  32. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_exp.py +5 -1
  33. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_min.py +4 -1
  34. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_exp.py +5 -1
  35. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_min.py +4 -1
  36. rock_physics_open/version.py +2 -2
  37. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.0.dist-info}/METADATA +4 -8
  38. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.0.dist-info}/RECORD +42 -37
  39. /rock_physics_open/{t_matrix_models → equinor_utilities/optimisation_utilities}/opt_subst_utilities.py +0 -0
  40. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.0.dist-info}/WHEEL +0 -0
  41. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.0.dist-info}/licenses/LICENSE +0 -0
  42. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.0.dist-info}/top_level.txt +0 -0
@@ -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 # g/mol
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
- den_gas = gas_density(celsius_to_kelvin(temperature), pressure * 1e-6, gas_gravity)
24
- k_gas = gas_bulk_modulus(
25
- celsius_to_kelvin(temperature), pressure * 1e-6, gas_gravity
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 molecluar weight of a gas from gas gravity.
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 g/mol.
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 MPa.
51
- :return: The volume of the gas in cc/mol.
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 MPa.
66
- :return: The density of the gas in g/cc
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, ideal_gas_velocity
94
+ :return: ideal_gas_velocity [m/s], ideal_gas_density [kg/m^3],
93
95
  """
94
- ideal_gas_den = 1000 * ideal_gas_density(
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 ideal_gas_den, ideal_gas_vel
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 MPa.
136
- :return: Pseudoreduced pressure in MPa.
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 compressability_factor(
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 MPa.
153
- :return: The density of the gas in g/cc
152
+ :param pressure: Confining pressure in Pa.
153
+ :return: Gas compressibility - unitless
154
154
  """
155
155
  tpr = pseudoreduced_temperature(absolute_temperature, gas_gravity)
156
- ppr = pseudoreduced_pressure(pressure, gas_gravity)
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 MPa.
180
- :return: The density of the gas in g/cc
181
+ :param pressure: Confining pressure in Pa.
182
+ :return: The density of the gas in kg/m^3
181
183
  """
182
- ideal_gas_den, ideal_gas_vel = ideal_gas(
183
- absolute_temperature, pressure * 1e-6, gas_gravity
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 compressability_rate_per_pseudoreduced_pressure(
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: The density of the gas in g/cc
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
- ppr = pseudoreduced_pressure(pressure, gas_gravity)
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 MPa.
230
- :return: The bulk modulus of the gas in MPa.
232
+ :param pressure: Confining pressure in Pa.
233
+ :return: The bulk modulus of the gas in Pa.
231
234
  """
232
- z = compressability_factor(absolute_temperature, pressure, gas_gravity)
233
- dz_dppr = compressability_rate_per_pseudoreduced_pressure(
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 = pseudoreduced_pressure(pressure, gas_gravity)
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 (g/cc) of the dead oil at 15.6 degrees Celsius
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 (MPa) to adjust to.
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
- return (
20
- reference_density
21
- + (0.00277 * pressure - 1.71 * 10**-7 * pressure**3)
22
- * (reference_density - 1.15) ** 2
23
- + 3.49 * 10**-4 * pressure
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 (g/cc) of the dead oil at 21 degrees Celsius
37
- :param temperature: Temperature (Celsius) of oil.
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
- return density_at_21c / (0.972 + 3.81 * (10**-4) * (temperature + 17.78) ** 1.175)
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. (g/cc)
55
- :param pressure: Pressure (MPa) of oil
56
- :param temperature: Temperature (Celsius) of oil.
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 (g/cc)
16
- :param pressure: Pressure (MPa) of oil
17
- :param temperature: Temperature (Celsius) of oil.
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(reference_density / (2.6 - reference_density))
23
+ 2096 * np.sqrt(density_gcc / (2.6 - density_gcc))
22
24
  - 3.7 * temperature
23
- + 4.64 * pressure
25
+ + 4.64 * pressure_mpa
24
26
  + 0.0115
25
- * (4.12 * np.sqrt(1.08 * reference_density**-1 - 1) - 1)
27
+ * (4.12 * np.sqrt(1.08 * density_gcc**-1 - 1) - 1)
26
28
  * temperature
27
- * pressure
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. (g/cc)
18
- :param pressure: Pressure (MPa) of oil (for future implementation only)
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 (Celsius) of oil.
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 [g/cc].
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 (reference_density + 0.0012 * gas_gravity * gas_oil_ratio) / b0
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. (g/cc)
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 (Celsius) of oil.
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 (reference_density / b0) / (1 + 0.001 * gas_oil_ratio)
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. (g/cc)
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 (Celsius) of oil.
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 / reference_density)
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. (g/cc)
15
- :param pressure: Pressure (MPa) of oil
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 (Celsius) of oil.
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
  """
@@ -17,13 +17,13 @@ def oil_properties(
17
17
  gas_gravity: np.ndarray | float,
18
18
  ) -> np.ndarray | float:
19
19
  """
20
- :param temperature: Temperature (Celsius) of oil.
21
- :param pressure: Pressure (Pa) of oil
20
+ :param temperature: Temperature [°C] of oil.
21
+ :param pressure: Pressure [Pa] of oil
22
22
  :param rho0: Density of the oil without dissolved gas at 15.6 degrees Celsius and
23
- atmospheric pressure. (kg/m^3)
23
+ atmospheric pressure. [kg/m^3]
24
24
  :param gas_oil_ratio: The volume ratio of gas to oil [l/l]
25
25
  :param gas_gravity: Gas Gravity, molar mass of gas relative to air molar mas.
26
- :return: vel_oil, den_oil, k_oil
26
+ :return: vel_oil [m/s], den_oil [kg/m^3], k_oil [Pa]
27
27
  """
28
28
  # Since live_oil with gas_oil_ratio=0.0 is not equal to dead oil
29
29
  # we use an apodization function to interpolate between the two
@@ -41,10 +41,11 @@ def oil_properties(
41
41
  window = np.clip((np.abs(x) - length / 2) / (length / 2), 0, 1)
42
42
  return 1 - window
43
43
 
44
- loil_den, loil_vel = live_oil(
45
- temperature, pressure, rho0, gas_oil_ratio, gas_gravity
46
- )
47
- doil_den, doil_vel = dead_oil(temperature, pressure, rho0)
44
+ (
45
+ loil_vel,
46
+ loil_den,
47
+ ) = live_oil(temperature, pressure, rho0, gas_oil_ratio, gas_gravity)
48
+ doil_vel, doil_den = dead_oil(temperature, pressure, rho0)
48
49
  window = triangular_window(gas_oil_ratio)
49
50
  den_oil = doil_den * window + (1 - window) * loil_den
50
51
  vel_oil = doil_vel * window + (1 - window) * loil_vel
@@ -59,20 +60,16 @@ def dead_oil(
59
60
  ) -> tuple[np.ndarray | float, np.ndarray | float]:
60
61
  """
61
62
  :param reference_density: Density of the oil without dissolved gas
62
- at 15.6 degrees Celsius and atmospheric pressure. kg/m3
63
+ at 15.6 degrees Celsius and atmospheric pressure. [kg/m^3]
63
64
  :param gas_oil_ratio: The volume ratio of gas to oil [l/l]
64
65
  :param gas_gravity: molar mass of gas relative to air molar mas.
65
- :param pressure: Pressure (Pa) of oil
66
- :param temperature: Temperature (Celsius) of oil.
67
- :return: dead_oil_density, dead_oil_velocity
66
+ :param pressure: Pressure [Pa] of oil
67
+ :param temperature: Temperature [°C] of oil.
68
+ :return: dead_oil_density [kg/m^3], dead_oil_velocity [m/s]
68
69
  """
69
- dead_oil_den = 1000 * dead_oil_density(
70
- temperature, pressure * 1e-6, reference_density / 1000
71
- )
72
- dead_oil_vel = dead_oil_velocity(
73
- temperature, pressure * 1e-6, reference_density / 1000
74
- )
75
- return dead_oil_den, dead_oil_vel
70
+ dead_oil_den = dead_oil_density(temperature, pressure, reference_density)
71
+ dead_oil_vel = dead_oil_velocity(temperature, pressure, reference_density)
72
+ return dead_oil_vel, dead_oil_den
76
73
 
77
74
 
78
75
  def live_oil(
@@ -84,12 +81,12 @@ def live_oil(
84
81
  ) -> tuple[np.ndarray | float, np.ndarray | float]:
85
82
  """
86
83
  :param reference_density: Density of the oil without dissolved gas
87
- at 15.6 degrees Celsius and atmospheric pressure. (kg/m^3)
84
+ at 15.6 degrees Celsius and atmospheric pressure. [kg/m^3]
88
85
  :param gas_oil_ratio: The volume ratio of gas to oil [l/l]
89
86
  :param gas_gravity: molar mass of gas relative to air molar mas.
90
- :param pressure: Pressure (Pa) of oil
91
- :param temperature: Temperature (Celsius) of oil.
92
- :return: live_oil_density, live_oil_velocity
87
+ :param pressure: Pressure [Pa] of oil
88
+ :param temperature: Temperature [°C] of oil.
89
+ :return: live_oil_density , live_oil_velocity
93
90
  """
94
91
  if np.any(
95
92
  pressure
@@ -99,18 +96,51 @@ def live_oil(
99
96
  "Pressure is below bubble point of oil, estimated elastic properties can be inaccurate",
100
97
  stacklevel=1,
101
98
  )
102
- live_oil_den = 1000 * live_oil_density(
99
+ live_oil_den = live_oil_density(
103
100
  temperature,
104
- pressure * 1e-6,
105
- reference_density / 1000,
101
+ pressure,
102
+ reference_density,
106
103
  gas_oil_ratio,
107
104
  gas_gravity,
108
105
  )
109
106
  live_oil_vel = live_oil_velocity(
110
107
  temperature,
111
- pressure * 1e-6,
112
- reference_density / 1000,
108
+ pressure,
109
+ reference_density,
113
110
  gas_oil_ratio,
114
111
  gas_gravity,
115
112
  )
116
- return live_oil_den, live_oil_vel
113
+ return (
114
+ live_oil_vel,
115
+ live_oil_den,
116
+ )
117
+
118
+
119
+ def oil_viscosity(
120
+ temperature: np.ndarray | float,
121
+ pressure: np.ndarray | float,
122
+ reference_density: np.ndarray | float,
123
+ ) -> np.ndarray | float:
124
+ """
125
+ Calculate dead oil viscosity. If dissolved gas is present in the oil, the reference density
126
+ should be substituted by live oil density.
127
+
128
+ Equations 25a, 25b, 26a & 26b in Batzle and Wang 1992
129
+
130
+ Based on Beggs and Robinson 1975
131
+
132
+ :param temperature: Temperature [°C] of oil
133
+ :param pressure: Pressure [Pa] of oil
134
+ :param reference_density: Density of the oil without dissolved gas
135
+ """
136
+ # Change unit in pressure to MPa
137
+ pressure_mpa = pressure / 1.0e6
138
+ # Change unit in density to g/cc
139
+ density_gcc = reference_density / 1000.0
140
+
141
+ y_factor = 10 ** (5.693 - 2.863 / density_gcc)
142
+ eta_t = -1.0 + 10 ** (0.505 * y_factor * (17.8 + temperature) ** -1.163)
143
+ i_factor = 10 ** (
144
+ 18.6 * (0.1 * np.log10(eta_t) + (np.log10(eta_t) + 2) ** -0.1 - 0.985)
145
+ )
146
+ return eta_t + 0.145 * pressure_mpa * i_factor
@@ -22,6 +22,7 @@ from .patchy_cement_fluid_substitution_model import (
22
22
  from .patchy_cement_model import (
23
23
  constant_cement_model_pcm,
24
24
  patchy_cement_model_cem_frac,
25
+ patchy_cement_model_dry,
25
26
  patchy_cement_model_weight,
26
27
  )
27
28
  from .patchy_cement_optimisation import (
@@ -48,6 +49,7 @@ __all__ = [
48
49
  "friable_shaly_sand_sandy_shale_model",
49
50
  "patchy_cement_pressure_fluid_substitution",
50
51
  "constant_cement_model_pcm",
52
+ "patchy_cement_model_dry",
51
53
  "patchy_cement_model_cem_frac",
52
54
  "patchy_cement_model_weight",
53
55
  "patchy_cement_model_optimisation",
@@ -1,7 +1,10 @@
1
1
  import numpy as np
2
2
 
3
3
  from rock_physics_open.equinor_utilities import gen_utilities
4
- from rock_physics_open.t_matrix_models import gen_opt_routine, save_opt_params
4
+ from rock_physics_open.equinor_utilities.optimisation_utilities import (
5
+ gen_opt_routine,
6
+ save_opt_params,
7
+ )
5
8
 
6
9
  from .curvefit_sandstone_models import curvefit_constant_cement
7
10
 
@@ -1,7 +1,10 @@
1
1
  import numpy as np
2
2
 
3
3
  from rock_physics_open.equinor_utilities import gen_utilities
4
- from rock_physics_open.t_matrix_models import gen_opt_routine, save_opt_params
4
+ from rock_physics_open.equinor_utilities.optimisation_utilities import (
5
+ gen_opt_routine,
6
+ save_opt_params,
7
+ )
5
8
 
6
9
  from .curvefit_sandstone_models import curvefit_friable
7
10