rock-physics-open 0.2.3__py3-none-any.whl → 0.3.1__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 (64) 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 +6 -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/import_ml_models.py +7 -4
  9. rock_physics_open/equinor_utilities/machine_learning_utilities/polynomial_model.py +128 -0
  10. rock_physics_open/equinor_utilities/machine_learning_utilities/run_regression.py +6 -4
  11. rock_physics_open/equinor_utilities/machine_learning_utilities/sigmoidal_model.py +204 -155
  12. rock_physics_open/equinor_utilities/optimisation_utilities/__init__.py +19 -0
  13. rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py +1 -2
  14. rock_physics_open/equinor_utilities/std_functions/backus_ave.py +16 -1
  15. rock_physics_open/equinor_utilities/std_functions/dvorkin_nur.py +10 -2
  16. rock_physics_open/equinor_utilities/std_functions/gassmann.py +32 -7
  17. rock_physics_open/equinor_utilities/std_functions/hashin_shtrikman.py +36 -7
  18. rock_physics_open/equinor_utilities/std_functions/hertz_mindlin.py +9 -1
  19. rock_physics_open/equinor_utilities/std_functions/moduli_velocity.py +22 -6
  20. rock_physics_open/equinor_utilities/std_functions/reflection_eq.py +28 -6
  21. rock_physics_open/equinor_utilities/std_functions/rho.py +12 -2
  22. rock_physics_open/equinor_utilities/std_functions/voigt_reuss_hill.py +25 -4
  23. rock_physics_open/equinor_utilities/std_functions/walton.py +8 -1
  24. rock_physics_open/equinor_utilities/std_functions/wood_brie.py +20 -3
  25. rock_physics_open/equinor_utilities/various_utilities/display_result_statistics.py +16 -9
  26. rock_physics_open/equinor_utilities/various_utilities/gassmann_dry_mod.py +21 -2
  27. rock_physics_open/equinor_utilities/various_utilities/gassmann_mod.py +21 -2
  28. rock_physics_open/equinor_utilities/various_utilities/gassmann_sub_mod.py +23 -12
  29. rock_physics_open/equinor_utilities/various_utilities/hs_average.py +20 -1
  30. rock_physics_open/equinor_utilities/various_utilities/pressure.py +9 -1
  31. rock_physics_open/equinor_utilities/various_utilities/reflectivity.py +26 -10
  32. rock_physics_open/equinor_utilities/various_utilities/timeshift.py +15 -2
  33. rock_physics_open/equinor_utilities/various_utilities/vp_vs_rho_set_statistics.py +40 -24
  34. rock_physics_open/equinor_utilities/various_utilities/vrh_3_min.py +24 -2
  35. rock_physics_open/fluid_models/brine_model/brine_properties.py +70 -35
  36. rock_physics_open/fluid_models/gas_model/gas_properties.py +79 -37
  37. rock_physics_open/fluid_models/oil_model/dead_oil_density.py +21 -16
  38. rock_physics_open/fluid_models/oil_model/dead_oil_velocity.py +9 -7
  39. rock_physics_open/fluid_models/oil_model/live_oil_density.py +16 -13
  40. rock_physics_open/fluid_models/oil_model/live_oil_velocity.py +3 -3
  41. rock_physics_open/fluid_models/oil_model/oil_properties.py +59 -29
  42. rock_physics_open/sandstone_models/__init__.py +2 -0
  43. rock_physics_open/sandstone_models/constant_cement_optimisation.py +4 -1
  44. rock_physics_open/sandstone_models/friable_models.py +6 -7
  45. rock_physics_open/sandstone_models/friable_optimisation.py +4 -1
  46. rock_physics_open/sandstone_models/patchy_cement_model.py +103 -5
  47. rock_physics_open/sandstone_models/patchy_cement_optimisation.py +4 -1
  48. rock_physics_open/t_matrix_models/__init__.py +0 -10
  49. rock_physics_open/t_matrix_models/carbonate_pressure_substitution.py +1 -1
  50. rock_physics_open/t_matrix_models/curvefit_t_matrix_exp.py +1 -2
  51. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_exp.py +3 -3
  52. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_petec.py +5 -1
  53. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_exp.py +5 -1
  54. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_min.py +4 -1
  55. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_exp.py +5 -1
  56. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_min.py +4 -1
  57. rock_physics_open/ternary_plots/ternary_plot_utilities.py +3 -3
  58. rock_physics_open/version.py +2 -2
  59. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.1.dist-info}/METADATA +4 -8
  60. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.1.dist-info}/RECORD +64 -61
  61. /rock_physics_open/{t_matrix_models → equinor_utilities/optimisation_utilities}/opt_subst_utilities.py +0 -0
  62. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.1.dist-info}/WHEEL +0 -0
  63. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.1.dist-info}/licenses/LICENSE +0 -0
  64. {rock_physics_open-0.2.3.dist-info → rock_physics_open-0.3.1.dist-info}/top_level.txt +0 -0
@@ -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
 
@@ -124,7 +124,7 @@ def friable_model_dry(k_min, mu_min, phi, p_eff, phi_c, coord_num_func, n, shear
124
124
  Critical porosity [fraction].
125
125
  coord_num_func : str
126
126
  Indication if coordination number should be calculated from porosity or kept constant.
127
- n : float
127
+ n : float | None
128
128
  Coordination number [unitless].
129
129
  shear_red : float
130
130
  Shear reduction factor [fraction].
@@ -135,18 +135,17 @@ def friable_model_dry(k_min, mu_min, phi, p_eff, phi_c, coord_num_func, n, shear
135
135
  k, mu : (np.ndarray, np.ndarray).
136
136
  Bulk modulus k [Pa], shear modulus mu [Pa] of dry rock.
137
137
  """
138
- # Expand floats to arrays
139
- phi, phi_c, n, shear_red = gen_utilities.dim_check_vector(
140
- (phi, phi_c, n, shear_red)
138
+ # Expand floats to arrays, check for equal length
139
+ phi, phi_c, shear_red, k_min, mu_min, p_eff = gen_utilities.dim_check_vector(
140
+ (phi, phi_c, shear_red, k_min, mu_min, p_eff)
141
141
  )
142
-
143
142
  # Valid porosity values are less or equal to the critical porosity
144
143
  # Use filter_input_log to remove values that do not comply with this
145
144
  (
146
145
  idx_phi,
147
- (k_min, mu_min, phi, p_eff, phi_c, n, shear_red, _),
146
+ (phi, phi_c, shear_red, k_min, mu_min, p_eff, _),
148
147
  ) = gen_utilities.filter_input_log(
149
- (k_min, mu_min, phi, p_eff, phi_c, n, shear_red, phi_c - phi)
148
+ (phi, phi_c, shear_red, k_min, mu_min, p_eff, phi_c - phi)
150
149
  )
151
150
 
152
151
  # Dry rock properties of high-porosity end member calculated with
@@ -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
 
@@ -1,6 +1,11 @@
1
1
  import numpy as np
2
2
 
3
3
  from rock_physics_open.equinor_utilities import std_functions
4
+ from rock_physics_open.equinor_utilities.gen_utilities import (
5
+ dim_check_vector,
6
+ filter_input_log,
7
+ filter_output,
8
+ )
4
9
 
5
10
  from .constant_cement_models import constant_cement_model_dry
6
11
  from .friable_models import friable_model_dry
@@ -213,6 +218,101 @@ def patchy_cement_model_cem_frac(
213
218
  vpvs : Saturated rock velocity ratio [ratio].
214
219
  """
215
220
 
221
+ k_dry, mu, _ = patchy_cement_model_dry(
222
+ k_min,
223
+ mu_min,
224
+ rho_min,
225
+ k_cem,
226
+ mu_cem,
227
+ rho_cem,
228
+ phi,
229
+ p_eff,
230
+ frac_cem,
231
+ phi_c,
232
+ coord_num_func,
233
+ n,
234
+ shear_red,
235
+ )
236
+ k_zero, mu_zero = std_functions.hashin_shtrikman_walpole(
237
+ k_cem, mu_cem, k_min, mu_min, FRAC_CEM_UP, bound="lower"
238
+ )
239
+
240
+ k = std_functions.gassmann(k_dry, phi, k_fl, k_zero)
241
+
242
+ rhob = phi * rho_fl + (1 - phi - frac_cem) * rho_min + frac_cem * rho_cem
243
+
244
+ vp, vs, ai, vpvs = std_functions.velocity(k, mu, rhob)
245
+
246
+ return vp, vs, rhob, ai, vpvs
247
+
248
+
249
+ def patchy_cement_model_dry(
250
+ k_min,
251
+ mu_min,
252
+ rho_min,
253
+ k_cem,
254
+ mu_cem,
255
+ rho_cem,
256
+ phi,
257
+ p_eff,
258
+ frac_cem,
259
+ phi_c,
260
+ coord_num_func,
261
+ n,
262
+ shear_red,
263
+ ):
264
+ """
265
+ Patchy cement model for sands that are a combination of friable model and constant cement model. No fluid or
266
+ pressure substitution. In this implementation of the patchy cement model the given cement fraction for the constant
267
+ cement model defines the upper bound, and the effective pressure for the friable model defines the lower bound
268
+
269
+ Parameters
270
+ ----------
271
+ k_min : np.ndarray
272
+ Mineral bulk modulus [Pa].
273
+ mu_min : np.ndarray
274
+ Mineral shear modulus [Pa].
275
+ rho_min : np.ndarray
276
+ Mineral bulk density [kg/m^3].
277
+ k_cem : np.ndarray
278
+ Sandstone cement bulk modulus [Pa].
279
+ mu_cem : np.ndarray
280
+ Sandstone cement shear modulus [Pa].
281
+ rho_cem : np.ndarray
282
+ Cement bulk density [kg/m^3].
283
+ phi : np.ndarray
284
+ Total porosity [fraction].
285
+ p_eff : np.ndarray
286
+ Effective pressure [Pa].
287
+ frac_cem : float
288
+ Upper bound cement volume fraction [fraction].
289
+ shear_red : float
290
+ Shear reduction factor for sandstone [fraction].
291
+ phi_c : float
292
+ Critical porosity [fraction].
293
+ n : float
294
+ Coordination number [unitless].
295
+ coord_num_func : str
296
+ Indication if coordination number should be calculated from porosity or kept constant, either "ConstVal" or
297
+ "PoreBased" [default]
298
+
299
+ Returns
300
+ -------
301
+ tuple
302
+ k:dry, mu, rho_dry : (np.ndarray, np.ndarray, np.ndarray).
303
+ k_dry: dry rock bulk modulus [Pa],
304
+ mu : dry rock shear modulus [Pa],
305
+ rho_dry : dry rock density [kg/m3].,
306
+ """
307
+ # There are cases which suffer from a lack of consistency check at this stage,
308
+ # add dim_check_vector and filter input/output
309
+ phi, k_min, mu_min, rho_min, k_cem, mu_cem, rho_cem, p_eff = dim_check_vector(
310
+ (phi, k_min, mu_min, rho_min, k_cem, mu_cem, rho_cem, p_eff)
311
+ )
312
+ (idx, (phi, k_min, mu_min, rho_min, k_cem, mu_cem, rho_cem, p_eff)) = (
313
+ filter_input_log((phi, k_min, mu_min, rho_min, k_cem, mu_cem, rho_cem, p_eff))
314
+ )
315
+
216
316
  k_zero, mu_zero = std_functions.hashin_shtrikman_walpole(
217
317
  k_cem, mu_cem, k_min, mu_min, FRAC_CEM_UP, bound="lower"
218
318
  )
@@ -277,10 +377,8 @@ def patchy_cement_model_cem_frac(
277
377
  k_dry = k_fri + weight_k * (k_up - k_fri)
278
378
  mu = mu_fri + weight_mu * (mu_up - mu_fri)
279
379
 
280
- k = std_functions.gassmann(k_dry, phi, k_fl, k_zero)
380
+ rho_dry = (1 - phi - frac_cem) * rho_min + frac_cem * rho_cem
281
381
 
282
- rhob = phi * rho_fl + (1 - phi - frac_cem) * rho_min + frac_cem * rho_cem
382
+ k_dry, mu, rho_dry = filter_output(idx, (k_dry, mu, rho_dry))
283
383
 
284
- vp, vs, ai, vpvs = std_functions.velocity(k, mu, rhob)
285
-
286
- return vp, vs, rhob, ai, vpvs
384
+ return k_dry, mu, rho_dry
@@ -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 (
7
10
  curvefit_patchy_cement,
@@ -1,10 +1,4 @@
1
1
  from .carbonate_pressure_substitution import carbonate_pressure_model
2
- from .opt_subst_utilities import (
3
- gen_opt_routine,
4
- opt_param_info,
5
- opt_param_to_ascii,
6
- save_opt_params,
7
- )
8
2
  from .parse_t_matrix_inputs import parse_t_matrix_inputs
9
3
  from .run_t_matrix import run_t_matrix
10
4
  from .t_matrix_C import t_matrix_porosity_c_alpha_v
@@ -26,10 +20,6 @@ from .t_matrix_vector import (
26
20
 
27
21
  __all__ = [
28
22
  "carbonate_pressure_model",
29
- "gen_opt_routine",
30
- "opt_param_info",
31
- "opt_param_to_ascii",
32
- "save_opt_params",
33
23
  "parse_t_matrix_inputs",
34
24
  "run_t_matrix",
35
25
  "t_matrix_porosity_c_alpha_v",
@@ -1,6 +1,6 @@
1
1
  import pandas as pd
2
2
 
3
- from rock_physics_open.equinor_utilities.machine_learning_utilities import (
3
+ from rock_physics_open.equinor_utilities.machine_learning_utilities.run_regression import (
4
4
  run_regression,
5
5
  )
6
6
 
@@ -1,11 +1,10 @@
1
1
  import numpy as np
2
2
 
3
3
  from rock_physics_open.equinor_utilities.gen_utilities import dim_check_vector
4
+ from rock_physics_open.equinor_utilities.optimisation_utilities import opt_param_info
4
5
  from rock_physics_open.equinor_utilities.std_functions import hashin_shtrikman_average
5
6
  from rock_physics_open.t_matrix_models import t_matrix_porosity_c_alpha_v
6
7
 
7
- from .opt_subst_utilities import opt_param_info
8
-
9
8
 
10
9
  def curvefit_t_matrix_exp(
11
10
  x_data,
@@ -1,15 +1,15 @@
1
1
  import numpy as np
2
2
 
3
3
  from rock_physics_open.equinor_utilities import gen_utilities
4
-
5
- from .curvefit_t_matrix_exp import curvefit_t_matrix_exp
6
- from .opt_subst_utilities import (
4
+ from rock_physics_open.equinor_utilities.optimisation_utilities import (
7
5
  gen_mod_routine,
8
6
  gen_sub_routine,
9
7
  load_opt_params,
10
8
  opt_param_info,
11
9
  )
12
10
 
11
+ from .curvefit_t_matrix_exp import curvefit_t_matrix_exp
12
+
13
13
 
14
14
  def run_t_matrix_with_opt_params_exp(
15
15
  fl_k_orig,
@@ -1,9 +1,13 @@
1
1
  import numpy as np
2
2
 
3
3
  from rock_physics_open.equinor_utilities import gen_utilities
4
+ from rock_physics_open.equinor_utilities.optimisation_utilities import (
5
+ gen_mod_routine,
6
+ gen_sub_routine,
7
+ load_opt_params,
8
+ )
4
9
 
5
10
  from .curvefit_t_matrix_min import curve_fit_2_inclusion_sets
6
- from .opt_subst_utilities import gen_mod_routine, gen_sub_routine, load_opt_params
7
11
 
8
12
 
9
13
  def run_t_matrix_with_opt_params_petec(
@@ -1,9 +1,13 @@
1
1
  import numpy as np
2
2
 
3
3
  from rock_physics_open.equinor_utilities import gen_utilities
4
+ from rock_physics_open.equinor_utilities.optimisation_utilities import (
5
+ gen_mod_routine,
6
+ load_opt_params,
7
+ opt_param_info,
8
+ )
4
9
 
5
10
  from .curvefit_t_matrix_exp import curvefit_t_matrix_exp
6
- from .opt_subst_utilities import gen_mod_routine, load_opt_params, opt_param_info
7
11
 
8
12
 
9
13
  def run_t_matrix_forward_model_with_opt_params_exp(
@@ -1,9 +1,12 @@
1
1
  import numpy as np
2
2
 
3
3
  from rock_physics_open.equinor_utilities import gen_utilities
4
+ from rock_physics_open.equinor_utilities.optimisation_utilities import (
5
+ gen_mod_routine,
6
+ load_opt_params,
7
+ )
4
8
 
5
9
  from .curvefit_t_matrix_min import curve_fit_2_inclusion_sets
6
- from .opt_subst_utilities import gen_mod_routine, load_opt_params
7
10
 
8
11
 
9
12
  def run_t_matrix_forward_model_with_opt_params_petec(
@@ -1,9 +1,13 @@
1
1
  import numpy as np
2
2
 
3
3
  from rock_physics_open.equinor_utilities import gen_utilities
4
+ from rock_physics_open.equinor_utilities.optimisation_utilities import (
5
+ gen_opt_routine,
6
+ opt_param_info,
7
+ save_opt_params,
8
+ )
4
9
 
5
10
  from .curvefit_t_matrix_exp import curvefit_t_matrix_exp
6
- from .opt_subst_utilities import gen_opt_routine, opt_param_info, save_opt_params
7
11
  from .t_matrix_parameter_optimisation_min import DEF_VP_VS_RATIO
8
12
 
9
13