rock-physics-open 0.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 (142) hide show
  1. rock_physics_open/__init__.py +0 -0
  2. rock_physics_open/equinor_utilities/__init__.py +0 -0
  3. rock_physics_open/equinor_utilities/anisotropy.py +162 -0
  4. rock_physics_open/equinor_utilities/classification_functions/__init__.py +17 -0
  5. rock_physics_open/equinor_utilities/classification_functions/class_stats.py +58 -0
  6. rock_physics_open/equinor_utilities/classification_functions/lin_class.py +47 -0
  7. rock_physics_open/equinor_utilities/classification_functions/mahal_class.py +56 -0
  8. rock_physics_open/equinor_utilities/classification_functions/norm_class.py +65 -0
  9. rock_physics_open/equinor_utilities/classification_functions/poly_class.py +40 -0
  10. rock_physics_open/equinor_utilities/classification_functions/post_prob.py +26 -0
  11. rock_physics_open/equinor_utilities/classification_functions/two_step_classification.py +46 -0
  12. rock_physics_open/equinor_utilities/conversions.py +10 -0
  13. rock_physics_open/equinor_utilities/gen_utilities/__init__.py +11 -0
  14. rock_physics_open/equinor_utilities/gen_utilities/dict_to_float.py +33 -0
  15. rock_physics_open/equinor_utilities/gen_utilities/dim_check_vector.py +83 -0
  16. rock_physics_open/equinor_utilities/gen_utilities/filter_input.py +126 -0
  17. rock_physics_open/equinor_utilities/gen_utilities/filter_output.py +78 -0
  18. rock_physics_open/equinor_utilities/machine_learning_utilities/__init__.py +14 -0
  19. rock_physics_open/equinor_utilities/machine_learning_utilities/dummy_vars.py +42 -0
  20. rock_physics_open/equinor_utilities/machine_learning_utilities/exponential_model.py +119 -0
  21. rock_physics_open/equinor_utilities/machine_learning_utilities/import_ml_models.py +61 -0
  22. rock_physics_open/equinor_utilities/machine_learning_utilities/run_regression.py +151 -0
  23. rock_physics_open/equinor_utilities/machine_learning_utilities/sigmoidal_model.py +188 -0
  24. rock_physics_open/equinor_utilities/snapshot_test_utilities/__init__.py +10 -0
  25. rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py +145 -0
  26. rock_physics_open/equinor_utilities/snapshot_test_utilities/snapshots.py +54 -0
  27. rock_physics_open/equinor_utilities/std_functions/__init__.py +43 -0
  28. rock_physics_open/equinor_utilities/std_functions/backus_ave.py +53 -0
  29. rock_physics_open/equinor_utilities/std_functions/dvorkin_nur.py +69 -0
  30. rock_physics_open/equinor_utilities/std_functions/gassmann.py +140 -0
  31. rock_physics_open/equinor_utilities/std_functions/hashin_shtrikman.py +195 -0
  32. rock_physics_open/equinor_utilities/std_functions/hertz_mindlin.py +43 -0
  33. rock_physics_open/equinor_utilities/std_functions/moduli_velocity.py +51 -0
  34. rock_physics_open/equinor_utilities/std_functions/reflection_eq.py +98 -0
  35. rock_physics_open/equinor_utilities/std_functions/rho.py +59 -0
  36. rock_physics_open/equinor_utilities/std_functions/voigt_reuss_hill.py +128 -0
  37. rock_physics_open/equinor_utilities/std_functions/walton.py +38 -0
  38. rock_physics_open/equinor_utilities/std_functions/wood_brie.py +77 -0
  39. rock_physics_open/equinor_utilities/various_utilities/Equinor_logo.gif +0 -0
  40. rock_physics_open/equinor_utilities/various_utilities/Equinor_logo.ico +0 -0
  41. rock_physics_open/equinor_utilities/various_utilities/__init__.py +24 -0
  42. rock_physics_open/equinor_utilities/various_utilities/display_result_statistics.py +83 -0
  43. rock_physics_open/equinor_utilities/various_utilities/gassmann_dry_mod.py +37 -0
  44. rock_physics_open/equinor_utilities/various_utilities/gassmann_mod.py +37 -0
  45. rock_physics_open/equinor_utilities/various_utilities/gassmann_sub_mod.py +53 -0
  46. rock_physics_open/equinor_utilities/various_utilities/hs_average.py +40 -0
  47. rock_physics_open/equinor_utilities/various_utilities/pressure.py +88 -0
  48. rock_physics_open/equinor_utilities/various_utilities/reflectivity.py +85 -0
  49. rock_physics_open/equinor_utilities/various_utilities/timeshift.py +91 -0
  50. rock_physics_open/equinor_utilities/various_utilities/vp_vs_rho_set_statistics.py +154 -0
  51. rock_physics_open/equinor_utilities/various_utilities/vrh_3_min.py +61 -0
  52. rock_physics_open/fluid_models/__init__.py +9 -0
  53. rock_physics_open/fluid_models/brine_model/__init__.py +5 -0
  54. rock_physics_open/fluid_models/brine_model/brine_properties.py +143 -0
  55. rock_physics_open/fluid_models/gas_model/__init__.py +5 -0
  56. rock_physics_open/fluid_models/gas_model/gas_properties.py +277 -0
  57. rock_physics_open/fluid_models/oil_model/__init__.py +5 -0
  58. rock_physics_open/fluid_models/oil_model/dead_oil_density.py +60 -0
  59. rock_physics_open/fluid_models/oil_model/dead_oil_velocity.py +28 -0
  60. rock_physics_open/fluid_models/oil_model/live_oil_density.py +79 -0
  61. rock_physics_open/fluid_models/oil_model/live_oil_velocity.py +24 -0
  62. rock_physics_open/fluid_models/oil_model/oil_bubble_point.py +69 -0
  63. rock_physics_open/fluid_models/oil_model/oil_properties.py +114 -0
  64. rock_physics_open/sandstone_models/__init__.py +57 -0
  65. rock_physics_open/sandstone_models/cemented_shalysand_sandyshale_models.py +304 -0
  66. rock_physics_open/sandstone_models/constant_cement_models.py +204 -0
  67. rock_physics_open/sandstone_models/constant_cement_optimisation.py +122 -0
  68. rock_physics_open/sandstone_models/contact_cement_model.py +138 -0
  69. rock_physics_open/sandstone_models/curvefit_sandstone_models.py +143 -0
  70. rock_physics_open/sandstone_models/friable_models.py +178 -0
  71. rock_physics_open/sandstone_models/friable_optimisation.py +112 -0
  72. rock_physics_open/sandstone_models/friable_shalysand_sandyshale_models.py +235 -0
  73. rock_physics_open/sandstone_models/patchy_cement_fluid_substitution_model.py +477 -0
  74. rock_physics_open/sandstone_models/patchy_cement_model.py +286 -0
  75. rock_physics_open/sandstone_models/patchy_cement_optimisation.py +251 -0
  76. rock_physics_open/sandstone_models/unresolved_cemented_sandshale_models.py +134 -0
  77. rock_physics_open/sandstone_models/unresolved_friable_sandshale_models.py +126 -0
  78. rock_physics_open/shale_models/__init__.py +19 -0
  79. rock_physics_open/shale_models/dem.py +174 -0
  80. rock_physics_open/shale_models/dem_dual_por.py +61 -0
  81. rock_physics_open/shale_models/kus_tok.py +59 -0
  82. rock_physics_open/shale_models/multi_sca.py +133 -0
  83. rock_physics_open/shale_models/pq.py +102 -0
  84. rock_physics_open/shale_models/sca.py +90 -0
  85. rock_physics_open/shale_models/shale4_mineral.py +147 -0
  86. rock_physics_open/shale_models/shale4_mineral_dem_overlay.py +92 -0
  87. rock_physics_open/span_wagner/__init__.py +5 -0
  88. rock_physics_open/span_wagner/co2_properties.py +438 -0
  89. rock_physics_open/span_wagner/coefficients.py +165 -0
  90. rock_physics_open/span_wagner/equations.py +104 -0
  91. rock_physics_open/span_wagner/tables/__init__.py +0 -0
  92. rock_physics_open/span_wagner/tables/carbon_dioxide_density.npz +0 -0
  93. rock_physics_open/span_wagner/tables/lookup_table.py +33 -0
  94. rock_physics_open/t_matrix_models/Equinor_logo.ico +0 -0
  95. rock_physics_open/t_matrix_models/__init__.py +45 -0
  96. rock_physics_open/t_matrix_models/carbonate_pressure_substitution.py +124 -0
  97. rock_physics_open/t_matrix_models/curvefit_t_matrix_exp.py +124 -0
  98. rock_physics_open/t_matrix_models/curvefit_t_matrix_min.py +86 -0
  99. rock_physics_open/t_matrix_models/opt_subst_utilities.py +415 -0
  100. rock_physics_open/t_matrix_models/parse_t_matrix_inputs.py +297 -0
  101. rock_physics_open/t_matrix_models/run_t_matrix.py +243 -0
  102. rock_physics_open/t_matrix_models/t_matrix_C.py +210 -0
  103. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_exp.py +137 -0
  104. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_petec.py +163 -0
  105. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_exp.py +72 -0
  106. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_min.py +86 -0
  107. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_exp.py +172 -0
  108. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_min.py +159 -0
  109. rock_physics_open/t_matrix_models/t_matrix_vector/__init__.py +12 -0
  110. rock_physics_open/t_matrix_models/t_matrix_vector/array_functions.py +75 -0
  111. rock_physics_open/t_matrix_models/t_matrix_vector/calc_c_eff.py +163 -0
  112. rock_physics_open/t_matrix_models/t_matrix_vector/calc_isolated.py +95 -0
  113. rock_physics_open/t_matrix_models/t_matrix_vector/calc_kd.py +40 -0
  114. rock_physics_open/t_matrix_models/t_matrix_vector/calc_kd_eff.py +116 -0
  115. rock_physics_open/t_matrix_models/t_matrix_vector/calc_kd_uuv.py +18 -0
  116. rock_physics_open/t_matrix_models/t_matrix_vector/calc_pressure.py +140 -0
  117. rock_physics_open/t_matrix_models/t_matrix_vector/calc_t.py +71 -0
  118. rock_physics_open/t_matrix_models/t_matrix_vector/calc_td.py +42 -0
  119. rock_physics_open/t_matrix_models/t_matrix_vector/calc_theta.py +43 -0
  120. rock_physics_open/t_matrix_models/t_matrix_vector/calc_x.py +33 -0
  121. rock_physics_open/t_matrix_models/t_matrix_vector/calc_z.py +50 -0
  122. rock_physics_open/t_matrix_models/t_matrix_vector/check_and_tile.py +43 -0
  123. rock_physics_open/t_matrix_models/t_matrix_vector/g_tensor.py +140 -0
  124. rock_physics_open/t_matrix_models/t_matrix_vector/iso_av.py +60 -0
  125. rock_physics_open/t_matrix_models/t_matrix_vector/iso_ave_all.py +55 -0
  126. rock_physics_open/t_matrix_models/t_matrix_vector/pressure_input.py +44 -0
  127. rock_physics_open/t_matrix_models/t_matrix_vector/t_matrix_vec.py +278 -0
  128. rock_physics_open/t_matrix_models/t_matrix_vector/velocity_vti_angles.py +81 -0
  129. rock_physics_open/t_matrix_models/tmatrix_python.dll +0 -0
  130. rock_physics_open/t_matrix_models/tmatrix_python.so +0 -0
  131. rock_physics_open/ternary_plots/__init__.py +3 -0
  132. rock_physics_open/ternary_plots/gen_ternary_plot.py +73 -0
  133. rock_physics_open/ternary_plots/shale_prop_ternary.py +337 -0
  134. rock_physics_open/ternary_plots/ternary_patches.py +277 -0
  135. rock_physics_open/ternary_plots/ternary_plot_utilities.py +197 -0
  136. rock_physics_open/ternary_plots/unconventionals_ternary.py +75 -0
  137. rock_physics_open/version.py +21 -0
  138. rock_physics_open-0.0.dist-info/METADATA +92 -0
  139. rock_physics_open-0.0.dist-info/RECORD +142 -0
  140. rock_physics_open-0.0.dist-info/WHEEL +5 -0
  141. rock_physics_open-0.0.dist-info/licenses/LICENSE +165 -0
  142. rock_physics_open-0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,286 @@
1
+ import numpy as np
2
+
3
+ from rock_physics_open.equinor_utilities import std_functions
4
+
5
+ from .constant_cement_models import constant_cement_model_dry
6
+ from .friable_models import friable_model_dry
7
+
8
+ FRAC_CEM_UP = 0.1
9
+ P_EFF_LOW = 20.0e6
10
+
11
+
12
+ def constant_cement_model_pcm(
13
+ kmin, mymin, kcem, mycem, kzero, myzero, phi, cem_frac, phic, n, red_shear
14
+ ):
15
+ """
16
+ kdry, mydry = contantcementmodel_pcm(kmin, mymin, kcem, mycem, kzero, myzero, phi, cem_frac, phic, n, red_shear)
17
+ """
18
+
19
+ # Contact cement model (Dvorkin-Nur)for given cem_frac
20
+ kcc, mycc = std_functions.dvorkin_contact_cement(
21
+ cem_frac, phic, mymin, kmin, mycem, kcem, red_shear, n
22
+ )
23
+
24
+ # Fraction of zero-porosity end member
25
+ f1 = 1 - phi / (phic - cem_frac)
26
+
27
+ # Interpolating using Hashin -Shtrikman lower bound = Constant cement model.
28
+ # Same mineral point as upper and lower bound in patchy cement model
29
+ kdry, mydry = std_functions.hashin_shtrikman_walpole(
30
+ kzero, myzero, kcc, mycc, f1, bound="lower"
31
+ )
32
+
33
+ return kdry, mydry
34
+
35
+
36
+ def patchy_cement_model_weight(
37
+ k_min,
38
+ mu_min,
39
+ rho_min,
40
+ k_cem,
41
+ mu_cem,
42
+ rho_cem,
43
+ k_fl,
44
+ rho_fl,
45
+ phi,
46
+ p_eff,
47
+ frac_cem,
48
+ phi_c,
49
+ coord_num_func,
50
+ n,
51
+ shear_red,
52
+ weight_k,
53
+ weight_mu,
54
+ ):
55
+ """
56
+ Patchy cement model for sands that are a combination of friable model and constant cement model. No fluid or
57
+ pressure substitution. Input variables for weight of K and Mu determine the model's position between upper and
58
+ lower bound.
59
+
60
+ Parameters
61
+ ----------
62
+ k_min : np.ndarray
63
+ Mineral bulk modulus [Pa].
64
+ mu_min : np.ndarray
65
+ Mineral shear modulus [Pa].
66
+ rho_min : np.ndarray
67
+ Mineral bulk density [kg/m^3].
68
+ k_cem : np.ndarray
69
+ Sandstone cement bulk modulus [Pa].
70
+ mu_cem : np.ndarray
71
+ Sandstone cement shear modulus [Pa].
72
+ rho_cem : np.ndarray
73
+ Cement bulk density [kg/m^3].
74
+ k_fl : np.ndarray
75
+ Fluid bulk modulus [Pa].
76
+ rho_fl : np.ndarray
77
+ Fluid bulk density [kg/m^3].
78
+ phi : np.ndarray
79
+ Total porosity [fraction].
80
+ p_eff : np.ndarray
81
+ Effective pressure [Pa].
82
+ frac_cem : float
83
+ Upper bound cement volume fraction [fraction].
84
+ shear_red : float
85
+ Shear reduction factor for sandstone [fraction].
86
+ phi_c : float
87
+ Critical porosity [fraction].
88
+ n : float
89
+ Coordination number [unitless].
90
+ coord_num_func : str
91
+ Indication if coordination number should be calculated from porosity or kept constant.
92
+ weight_k : float
93
+ Weight between friable and cemented model for bulk modulus.
94
+ weight_mu : float
95
+ Weight between friable and cemented model for shear modulus.
96
+
97
+ Returns
98
+ -------
99
+ tuple
100
+ k, mu, rhob, vp, vs : (np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray).
101
+ vp :Saturated P-velocity [m/s] after fluid and pressure substitution,
102
+ vs : Saturated S-velocity [m/s] after fluid and pressure substitution,
103
+ rhob : Saturated density [kg/m3] after fluid and pressure substitution,
104
+ k : Saturated rock bulk modulus [Pa],
105
+ mu : Shear modulus [Pa].
106
+ """
107
+
108
+ k_zero, mu_zero = std_functions.hashin_shtrikman_walpole(
109
+ k_cem, mu_cem, k_min, mu_min, frac_cem, bound="lower"
110
+ )
111
+
112
+ # In this implementation of the patchy cement model the given cement fraction for the constant cement model defines
113
+ # the upper bound, and the effective pressure for the friable model defines the lower bound
114
+
115
+ k_fri, mu_fri = friable_model_dry(
116
+ k_zero, mu_zero, phi, p_eff, phi_c, coord_num_func, n, shear_red
117
+ )[0:2]
118
+
119
+ k_up, mu_up = constant_cement_model_dry(
120
+ k_min,
121
+ mu_min,
122
+ k_cem,
123
+ mu_cem,
124
+ phi,
125
+ frac_cem,
126
+ phi_c,
127
+ n,
128
+ shear_red,
129
+ extrapolate_to_max_phi=True,
130
+ )[0:2]
131
+
132
+ k_dry = k_fri + weight_k * (k_up - k_fri)
133
+ mu = mu_fri + weight_mu * (mu_up - mu_fri)
134
+
135
+ k = std_functions.gassmann(k_dry, phi, k_fl, k_zero)
136
+
137
+ weight_rho = 0.5 * (weight_k + weight_mu)
138
+ rhob = (
139
+ phi * rho_fl
140
+ + (1 - phi - frac_cem * weight_rho) * rho_min
141
+ + frac_cem * weight_rho * rho_cem
142
+ )
143
+
144
+ vp, vs, ai, vpvs = std_functions.velocity(k, mu, rhob)
145
+
146
+ return vp, vs, rhob, ai, vpvs
147
+
148
+
149
+ def patchy_cement_model_cem_frac(
150
+ k_min,
151
+ mu_min,
152
+ rho_min,
153
+ k_cem,
154
+ mu_cem,
155
+ rho_cem,
156
+ k_fl,
157
+ rho_fl,
158
+ phi,
159
+ p_eff,
160
+ frac_cem,
161
+ phi_c,
162
+ coord_num_func,
163
+ n,
164
+ shear_red,
165
+ ):
166
+ """
167
+ Patchy cement model for sands that are a combination of friable model and constant cement model. No fluid or
168
+ pressure substitution. In this implementation of the patchy cement model the given cement fraction for the constant
169
+ cement model defines the upper bound, and the effective pressure for the friable model defines the lower bound
170
+
171
+ Parameters
172
+ ----------
173
+ k_min : np.ndarray
174
+ Mineral bulk modulus [Pa].
175
+ mu_min : np.ndarray
176
+ Mineral shear modulus [Pa].
177
+ rho_min : np.ndarray
178
+ Mineral bulk density [kg/m^3].
179
+ k_cem : np.ndarray
180
+ Sandstone cement bulk modulus [Pa].
181
+ mu_cem : np.ndarray
182
+ Sandstone cement shear modulus [Pa].
183
+ rho_cem : np.ndarray
184
+ Cement bulk density [kg/m^3].
185
+ k_fl : np.ndarray
186
+ Fluid bulk modulus [Pa].
187
+ rho_fl : np.ndarray
188
+ Fluid bulk density [kg/m^3].
189
+ phi : np.ndarray
190
+ Total porosity [fraction].
191
+ p_eff : np.ndarray
192
+ Effective pressure [Pa].
193
+ frac_cem : float
194
+ Upper bound cement volume fraction [fraction].
195
+ shear_red : float
196
+ Shear reduction factor for sandstone [fraction].
197
+ phi_c : float
198
+ Critical porosity [fraction].
199
+ n : float
200
+ Coordination number [unitless].
201
+ coord_num_func : str
202
+ Indication if coordination number should be calculated from porosity or kept constant, either "ConstVal" or
203
+ "PoreBased" [default]
204
+
205
+ Returns
206
+ -------
207
+ tuple
208
+ vp, vs, rhob, ai, vpvs : (np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray).
209
+ vp :Saturated P-velocity [m/s] after fluid and pressure substitution,
210
+ vs : Saturated S-velocity [m/s] after fluid and pressure substitution,
211
+ rhob : Saturated density [kg/m3] after fluid and pressure substitution,
212
+ ai : Saturated rock acoustic impedance [kg/m3 * m/s] after fluid and pressure substitution,
213
+ vpvs : Saturated rock velocity ratio [ratio].
214
+ """
215
+
216
+ k_zero, mu_zero = std_functions.hashin_shtrikman_walpole(
217
+ k_cem, mu_cem, k_min, mu_min, FRAC_CEM_UP, bound="lower"
218
+ )
219
+
220
+ k_low, mu_low = friable_model_dry(
221
+ k_zero,
222
+ mu_zero,
223
+ phi,
224
+ P_EFF_LOW * np.ones_like(phi),
225
+ phi_c,
226
+ coord_num_func,
227
+ n,
228
+ shear_red,
229
+ )[0:2]
230
+
231
+ k_fri, mu_fri = friable_model_dry(
232
+ k_zero, mu_zero, phi, p_eff, phi_c, coord_num_func, n, shear_red
233
+ )[0:2]
234
+
235
+ k_up, mu_up = constant_cement_model_dry(
236
+ k_min,
237
+ mu_min,
238
+ k_cem,
239
+ mu_cem,
240
+ phi,
241
+ FRAC_CEM_UP,
242
+ phi_c,
243
+ n,
244
+ shear_red,
245
+ extrapolate_to_max_phi=True,
246
+ )[0:2]
247
+
248
+ # Special case for the constant cement model that represents the mean of the data
249
+ k_cc, mu_cc = constant_cement_model_pcm(
250
+ k_min,
251
+ mu_min,
252
+ k_cem,
253
+ mu_cem,
254
+ k_zero,
255
+ mu_zero,
256
+ phi,
257
+ frac_cem,
258
+ phi_c,
259
+ n,
260
+ shear_red,
261
+ )[0:2]
262
+
263
+ idwk = k_up == k_low
264
+ idwmu = mu_up == mu_low
265
+
266
+ weight_k = np.ones(k_zero.shape)
267
+ weight_mu = np.ones(mu_zero.shape)
268
+
269
+ weight_k[~idwk] = (k_cc[~idwk] - k_low[~idwk]) / (k_up[~idwk] - k_low[~idwk])
270
+ weight_mu[~idwmu] = (mu_cc[~idwmu] - mu_low[~idwmu]) / (
271
+ mu_up[~idwmu] - mu_low[~idwmu]
272
+ )
273
+
274
+ weight_mu = np.clip(weight_mu, 0.0, 1.0)
275
+ weight_k = np.clip(weight_k, 0.0, 1.0)
276
+
277
+ k_dry = k_fri + weight_k * (k_up - k_fri)
278
+ mu = mu_fri + weight_mu * (mu_up - mu_fri)
279
+
280
+ k = std_functions.gassmann(k_dry, phi, k_fl, k_zero)
281
+
282
+ rhob = phi * rho_fl + (1 - phi - frac_cem) * rho_min + frac_cem * rho_cem
283
+
284
+ vp, vs, ai, vpvs = std_functions.velocity(k, mu, rhob)
285
+
286
+ return vp, vs, rhob, ai, vpvs
@@ -0,0 +1,251 @@
1
+ import numpy as np
2
+
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
5
+
6
+ from .curvefit_sandstone_models import (
7
+ curvefit_patchy_cement,
8
+ patchy_cement_model_weight,
9
+ )
10
+
11
+
12
+ def patchy_cement_model_optimisation(
13
+ k_min: np.ndarray,
14
+ mu_min: np.ndarray,
15
+ rho_min: np.ndarray,
16
+ k_cem: np.ndarray,
17
+ mu_cem: np.ndarray,
18
+ rho_cem: np.ndarray,
19
+ k_fl: np.ndarray,
20
+ rho_fl: np.ndarray,
21
+ por: np.ndarray,
22
+ p_eff: np.ndarray,
23
+ vp: np.ndarray,
24
+ vs: np.ndarray,
25
+ rhob: np.ndarray,
26
+ phi_c,
27
+ file_out_str: str = "patchy_cement_optimal_params.pkl",
28
+ display_results: bool = False,
29
+ well_name: str = "Unknown well",
30
+ opt_params_only=False,
31
+ ):
32
+ """Patchy cement model with optimisation for a selection of parameters.
33
+
34
+ Parameters
35
+ ----------
36
+ k_min :
37
+ Cement bulk modulus [Pa].
38
+ mu_min :
39
+ Cement shear modulus [Pa].
40
+ rho_min :
41
+ Cement density [kg/m^3].
42
+ k_cem :
43
+ Cement bulk modulus [Pa].
44
+ mu_cem :
45
+ Cement shear modulus [Pa].
46
+ rho_cem :
47
+ Cement density [kg/m^3].
48
+ k_fl :
49
+ Fluid bulk modulus [Pa].
50
+ rho_fl :
51
+ Fluid density [kg/m^3].
52
+ por :
53
+ Inclusion porosity [ratio].
54
+ vp :
55
+ Compressional velocity log [m/s].
56
+ vs :
57
+ Shear velocity log [m/s].
58
+ rhob :
59
+ Bulk density log [kg/m^3].
60
+ p_eff :
61
+ Effective pressure log [Pa].
62
+ file_out_str :
63
+ Output file name (string) to store optimal parameters (pickle format).
64
+ phi_c : float
65
+ Critical porosity [fraction]
66
+ display_results :
67
+ Display optimal parameters in a window after run.
68
+ well_name : str
69
+ Name of well to be displayed in info box title.
70
+ opt_params_only : bool
71
+ return parameters from optimisation only
72
+ Returns
73
+ -------
74
+ tuple
75
+ vp_mod, vs_mod, rho_mod, ai_mod, vpvs_mod - modelled logs,
76
+ vp_res, vs_res, rho_res - residual logs.
77
+ """
78
+
79
+ # Skip hardcoded Vp/Vs ratio
80
+ def_vpvs = np.mean(vp / vs)
81
+ # Set weight to vs to give vp and vs similar influence on optimisation
82
+ y_data = np.stack([vp, vs * def_vpvs], axis=1)
83
+ # Optimisation function for selected parameters
84
+ opt_fun = curvefit_patchy_cement
85
+ # expand single value parameters to match logs length
86
+ por, phi_c, def_vpvs = gen_utilities.dim_check_vector((por, phi_c, def_vpvs))
87
+ x_data = np.stack(
88
+ (
89
+ k_min,
90
+ mu_min,
91
+ rho_min,
92
+ k_cem,
93
+ mu_cem,
94
+ rho_cem,
95
+ k_fl,
96
+ rho_fl,
97
+ por,
98
+ p_eff,
99
+ def_vpvs,
100
+ phi_c,
101
+ ),
102
+ axis=1,
103
+ )
104
+
105
+ # Params: weight_k, weight_mu, shear_red, frac_cem
106
+ lower_bound = np.array(
107
+ [
108
+ 0.0, # weight_k
109
+ 0.0, # weight_mu
110
+ 0.0, # shear_red
111
+ 0.01, # frac_cem
112
+ ],
113
+ dtype=float,
114
+ )
115
+ upper_bound = np.array(
116
+ [
117
+ 1.0, # weight_k
118
+ 1.0, # weight_mu
119
+ 1.0, # shear_red
120
+ 0.1, # frac_cem
121
+ ],
122
+ dtype=float,
123
+ )
124
+ x0 = (upper_bound + lower_bound) / 2.0
125
+ # Optimisation step without fluid substitution
126
+ vel_mod, vel_res, opt_params = gen_opt_routine(
127
+ opt_fun, x_data, y_data, x0, lower_bound, upper_bound
128
+ )
129
+
130
+ # Reshape outputs and remove weight from vs
131
+ vp_mod, vs_mod = [arr.flatten() for arr in np.split(vel_mod, 2, axis=1)]
132
+ vp_res, vs_res = [arr.flatten() for arr in np.split(vel_res, 2, axis=1)]
133
+ vs_mod = vs_mod / def_vpvs
134
+ vs_res = vs_res / def_vpvs
135
+ vpvs_mod = vp_mod / vs_mod
136
+ # Calculate the modelled density
137
+ # rho_cem??
138
+ rhob_mod = rho_min * (1.0 - por) + por * rho_fl
139
+ ai_mod = vp_mod * rhob_mod
140
+ rhob_res = rhob_mod - rhob
141
+ # Save the optimal parameters
142
+ save_opt_params("pat_cem", opt_params, file_out_str, well_name=well_name)
143
+ if display_results:
144
+ from rock_physics_open.t_matrix_models import opt_param_to_ascii
145
+
146
+ opt_param_to_ascii(file_out_str, well_name=well_name)
147
+
148
+ if opt_params_only:
149
+ return opt_params
150
+ return vp_mod, vs_mod, rhob_mod, ai_mod, vpvs_mod, vp_res, vs_res, rhob_res
151
+
152
+
153
+ def patchy_cement_model_optimisation_multiwell(
154
+ k_min,
155
+ mu_min,
156
+ rho_min,
157
+ k_cem,
158
+ mu_cem,
159
+ rho_cem,
160
+ k_fl,
161
+ rho_fl,
162
+ por,
163
+ p_eff,
164
+ vp,
165
+ vs,
166
+ rhob,
167
+ phi_c,
168
+ file_out_str: str = "pat_cem.pkl",
169
+ display_results: bool = False,
170
+ well_name: str = "Unknown well",
171
+ ):
172
+ # First: perform a calibration with all data, return optimal parameters only. Concatenate all list of arrays to
173
+ # make a single set of input arrays
174
+ k_min_all = np.concatenate(k_min, axis=0)
175
+ mu_min_all = np.concatenate(mu_min, axis=0)
176
+ rho_min_all = np.concatenate(rho_min, axis=0)
177
+ k_cem_all = np.concatenate(k_cem, axis=0)
178
+ mu_cem_all = np.concatenate(mu_cem, axis=0)
179
+ rho_cem_all = np.concatenate(rho_cem, axis=0)
180
+ k_fl_all = np.concatenate(k_fl, axis=0)
181
+ rho_fl_all = np.concatenate(rho_fl, axis=0)
182
+ por_all = np.concatenate(por, axis=0)
183
+ p_eff_all = np.concatenate(p_eff, axis=0)
184
+ vp_all = np.concatenate(vp, axis=0)
185
+ vs_all = np.concatenate(vs, axis=0)
186
+ rhob_all = np.concatenate(rhob, axis=0)
187
+
188
+ opt_param = patchy_cement_model_optimisation(
189
+ k_min_all,
190
+ mu_min_all,
191
+ rho_min_all,
192
+ k_cem_all,
193
+ mu_cem_all,
194
+ rho_cem_all,
195
+ k_fl_all,
196
+ rho_fl_all,
197
+ por_all,
198
+ p_eff_all,
199
+ vp_all,
200
+ vs_all,
201
+ rhob_all,
202
+ phi_c,
203
+ file_out_str=file_out_str,
204
+ display_results=display_results,
205
+ well_name=well_name,
206
+ opt_params_only=True,
207
+ )
208
+
209
+ # Next: run patchy cement model for all wells using the optimal parameters
210
+ weight_k = opt_param[0]
211
+ weight_mu = opt_param[1]
212
+ shear_red = opt_param[2]
213
+ frac_cem = opt_param[3]
214
+ vp_mod = []
215
+ vs_mod = []
216
+ rhob_mod = []
217
+ ai_mod = []
218
+ vpvs_mod = []
219
+ vp_res = []
220
+ vs_res = []
221
+ rhob_res = []
222
+ for i in range(len(k_min)):
223
+ vp_tmp, vs_tmp, rhob_tmp = patchy_cement_model_weight(
224
+ k_min[i],
225
+ mu_min[i],
226
+ rho_min[i],
227
+ k_cem[i],
228
+ mu_cem[i],
229
+ rho_cem[i],
230
+ k_fl[i],
231
+ rho_fl[i],
232
+ por[i],
233
+ p_eff[i],
234
+ frac_cem,
235
+ phi_c,
236
+ "por_based",
237
+ 9,
238
+ shear_red,
239
+ weight_k,
240
+ weight_mu,
241
+ )[0:3]
242
+ vp_mod.append(vp_tmp)
243
+ vs_mod.append(vs_tmp)
244
+ rhob_mod.append(rhob_tmp)
245
+ ai_mod.append(vp_tmp * rhob_tmp)
246
+ vpvs_mod.append(vp_tmp / vs_tmp)
247
+ vp_res.append(vp_tmp - vp[i])
248
+ vs_res.append(vs_tmp - vs[i])
249
+ rhob_res.append(rhob_tmp - rhob[i])
250
+
251
+ return vp_mod, vs_mod, rhob_mod, ai_mod, vpvs_mod, vp_res, vs_res, rhob_res
@@ -0,0 +1,134 @@
1
+ from rock_physics_open import sandstone_models as sm
2
+ from rock_physics_open.equinor_utilities import std_functions
3
+
4
+
5
+ def unresolved_constant_cement_sand_shale_model(
6
+ k_min_sst,
7
+ mu_min_sst,
8
+ rho_min_sst,
9
+ k_cem,
10
+ mu_cem,
11
+ rho_cem,
12
+ k_mud,
13
+ mu_mud,
14
+ rho_mud,
15
+ k_fl_sst,
16
+ rho_fl_sst,
17
+ k_fl_mud,
18
+ rho_fl_mud,
19
+ phi_sst,
20
+ phi_mud,
21
+ p_eff_mud,
22
+ shale_frac,
23
+ frac_cem,
24
+ phi_c_sst,
25
+ phi_c_mud,
26
+ n_sst,
27
+ coord_num_func_mud,
28
+ n_mud,
29
+ shear_red_sst,
30
+ shear_red_mud,
31
+ ):
32
+ """
33
+ Model for silisiclastic rocks with alternating layers of cemented sand and friable shale, and in which the layers
34
+ are not resolved by the investigating signal. Backus average is used to calculate the anisotropic effect of the
35
+ alternating layers.
36
+
37
+ Parameters
38
+ ----------
39
+ k_min_sst : np.ndarray
40
+ Sandstone matrix bulk modulus [Pa].
41
+ mu_min_sst : np.ndarray
42
+ Sandstone matrix shear modulus [Pa].
43
+ rho_min_sst : np.ndarray
44
+ Sandstone matrix bulk density [kg/m^3].
45
+ k_cem : np.ndarray
46
+ Sandstone cement bulk modulus [Pa].
47
+ mu_cem : np.ndarray
48
+ Sandstone cement shear modulus [Pa].
49
+ rho_cem : np.ndarray
50
+ Sandstone cement bulk density [kg/m^3].
51
+ k_mud : np.ndarray
52
+ Shale bulk modulus [Pa].
53
+ mu_mud : np.ndarray
54
+ Shale shear modulus [Pa].
55
+ rho_mud : np.ndarray
56
+ Shale bulk density [kg/m^3].
57
+ k_fl_sst : np.ndarray
58
+ Fluid bulk modulus for sandstone fluid [Pa].
59
+ rho_fl_sst : np.ndarray
60
+ Fluid bulk density for sandstone fluid [kg/m^3].
61
+ k_fl_mud : np.ndarray
62
+ Fluid bulk modulus for shale fluid [Pa].
63
+ rho_fl_mud : np.ndarray
64
+ Fluid bulk density for shale fluid[kg/m^3].
65
+ phi_sst : np.ndarray
66
+ Sandstone porosity [fraction].
67
+ phi_mud : np.ndarray
68
+ Shale porosity [fraction].
69
+ p_eff_mud : np.ndarray
70
+ Effective pressure in mud [Pa].
71
+ shale_frac : np.ndarray
72
+ Shale fraction [fraction].
73
+ frac_cem : float
74
+ Cement volume fraction [fraction].
75
+ phi_c_sst : float
76
+ Critical porosity for sandstone [fraction].
77
+ phi_c_mud : float
78
+ Critical porosity for mud [fraction].
79
+ n_sst : float
80
+ Coordination number for sandstone [unitless].
81
+ n_mud : float
82
+ Coordination number for shale [unitless].
83
+ coord_num_func_mud : str
84
+ Indication if coordination number should be calculated from porosity or kept constant for shale.
85
+ shear_red_sst : float
86
+ Shear reduction factor for sandstone [fraction].
87
+ shear_red_mud : float
88
+ Shear reduction factor for mud [fraction].
89
+
90
+ Returns
91
+ -------
92
+ tuple
93
+ vpv, vsv, vph, vsh, rho : (np.ndarray, np.ndarray, np.ndarray, np.ndarray, np.ndarray).
94
+ vertical p-wave velocity, vertical shear-wave velocity, horizontal p-wave velocity, horizontal shear-wave
95
+ velocity (all [m/s]), bulk density [kg/m^3].
96
+ """
97
+ # Estimate the sand end member through the constant cement model
98
+ vp_sst, vs_sst, rho_b_sst = sm.constant_cement_model(
99
+ k_min_sst,
100
+ mu_min_sst,
101
+ rho_min_sst,
102
+ k_cem,
103
+ mu_cem,
104
+ rho_cem,
105
+ k_fl_sst,
106
+ rho_fl_sst,
107
+ phi_sst,
108
+ frac_cem,
109
+ phi_c_sst,
110
+ n_sst,
111
+ shear_red_sst,
112
+ )[0:3]
113
+
114
+ # Estimate the shale end member through the friable model
115
+ vp_mud, vs_mud, rho_b_mud = sm.friable_model(
116
+ k_mud,
117
+ mu_mud,
118
+ rho_mud,
119
+ k_fl_mud,
120
+ rho_fl_mud,
121
+ phi_mud,
122
+ p_eff_mud,
123
+ phi_c_mud,
124
+ coord_num_func_mud,
125
+ n_mud,
126
+ shear_red_mud,
127
+ )[0:3]
128
+
129
+ # Calculate Backus average for the effective medium
130
+ vpv, vsv, vph, vsh, rho = std_functions.backus_average(
131
+ vp_sst, vs_sst, rho_b_sst, vp_mud, vs_mud, rho_b_mud, 1.0 - shale_frac
132
+ )
133
+
134
+ return vpv, vsv, vph, vsh, rho