rock-physics-open 0.3.2__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.
Files changed (145) 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 +211 -0
  4. rock_physics_open/equinor_utilities/classification_functions/__init__.py +17 -0
  5. rock_physics_open/equinor_utilities/classification_functions/class_stats.py +68 -0
  6. rock_physics_open/equinor_utilities/classification_functions/lin_class.py +53 -0
  7. rock_physics_open/equinor_utilities/classification_functions/mahal_class.py +63 -0
  8. rock_physics_open/equinor_utilities/classification_functions/norm_class.py +73 -0
  9. rock_physics_open/equinor_utilities/classification_functions/poly_class.py +45 -0
  10. rock_physics_open/equinor_utilities/classification_functions/post_prob.py +27 -0
  11. rock_physics_open/equinor_utilities/classification_functions/two_step_classification.py +60 -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 +38 -0
  15. rock_physics_open/equinor_utilities/gen_utilities/dim_check_vector.py +113 -0
  16. rock_physics_open/equinor_utilities/gen_utilities/filter_input.py +131 -0
  17. rock_physics_open/equinor_utilities/gen_utilities/filter_output.py +88 -0
  18. rock_physics_open/equinor_utilities/machine_learning_utilities/__init__.py +15 -0
  19. rock_physics_open/equinor_utilities/machine_learning_utilities/base_pressure_model.py +170 -0
  20. rock_physics_open/equinor_utilities/machine_learning_utilities/dummy_vars.py +53 -0
  21. rock_physics_open/equinor_utilities/machine_learning_utilities/exponential_model.py +137 -0
  22. rock_physics_open/equinor_utilities/machine_learning_utilities/import_ml_models.py +77 -0
  23. rock_physics_open/equinor_utilities/machine_learning_utilities/polynomial_model.py +132 -0
  24. rock_physics_open/equinor_utilities/machine_learning_utilities/run_regression.py +209 -0
  25. rock_physics_open/equinor_utilities/machine_learning_utilities/sigmoidal_model.py +241 -0
  26. rock_physics_open/equinor_utilities/optimisation_utilities/__init__.py +19 -0
  27. rock_physics_open/equinor_utilities/optimisation_utilities/opt_subst_utilities.py +455 -0
  28. rock_physics_open/equinor_utilities/snapshot_test_utilities/__init__.py +10 -0
  29. rock_physics_open/equinor_utilities/snapshot_test_utilities/compare_snapshots.py +184 -0
  30. rock_physics_open/equinor_utilities/snapshot_test_utilities/snapshots.py +97 -0
  31. rock_physics_open/equinor_utilities/std_functions/__init__.py +43 -0
  32. rock_physics_open/equinor_utilities/std_functions/backus_ave.py +68 -0
  33. rock_physics_open/equinor_utilities/std_functions/dvorkin_nur.py +77 -0
  34. rock_physics_open/equinor_utilities/std_functions/gassmann.py +165 -0
  35. rock_physics_open/equinor_utilities/std_functions/hashin_shtrikman.py +224 -0
  36. rock_physics_open/equinor_utilities/std_functions/hertz_mindlin.py +51 -0
  37. rock_physics_open/equinor_utilities/std_functions/moduli_velocity.py +67 -0
  38. rock_physics_open/equinor_utilities/std_functions/reflection_eq.py +120 -0
  39. rock_physics_open/equinor_utilities/std_functions/rho.py +69 -0
  40. rock_physics_open/equinor_utilities/std_functions/voigt_reuss_hill.py +149 -0
  41. rock_physics_open/equinor_utilities/std_functions/walton.py +45 -0
  42. rock_physics_open/equinor_utilities/std_functions/wood_brie.py +94 -0
  43. rock_physics_open/equinor_utilities/various_utilities/Equinor_logo.gif +0 -0
  44. rock_physics_open/equinor_utilities/various_utilities/Equinor_logo.ico +0 -0
  45. rock_physics_open/equinor_utilities/various_utilities/__init__.py +24 -0
  46. rock_physics_open/equinor_utilities/various_utilities/display_result_statistics.py +90 -0
  47. rock_physics_open/equinor_utilities/various_utilities/gassmann_dry_mod.py +56 -0
  48. rock_physics_open/equinor_utilities/various_utilities/gassmann_mod.py +56 -0
  49. rock_physics_open/equinor_utilities/various_utilities/gassmann_sub_mod.py +64 -0
  50. rock_physics_open/equinor_utilities/various_utilities/hs_average.py +59 -0
  51. rock_physics_open/equinor_utilities/various_utilities/pressure.py +96 -0
  52. rock_physics_open/equinor_utilities/various_utilities/reflectivity.py +101 -0
  53. rock_physics_open/equinor_utilities/various_utilities/timeshift.py +104 -0
  54. rock_physics_open/equinor_utilities/various_utilities/vp_vs_rho_set_statistics.py +170 -0
  55. rock_physics_open/equinor_utilities/various_utilities/vrh_3_min.py +83 -0
  56. rock_physics_open/fluid_models/__init__.py +9 -0
  57. rock_physics_open/fluid_models/brine_model/__init__.py +5 -0
  58. rock_physics_open/fluid_models/brine_model/brine_properties.py +178 -0
  59. rock_physics_open/fluid_models/gas_model/__init__.py +5 -0
  60. rock_physics_open/fluid_models/gas_model/gas_properties.py +319 -0
  61. rock_physics_open/fluid_models/oil_model/__init__.py +5 -0
  62. rock_physics_open/fluid_models/oil_model/dead_oil_density.py +65 -0
  63. rock_physics_open/fluid_models/oil_model/dead_oil_velocity.py +30 -0
  64. rock_physics_open/fluid_models/oil_model/live_oil_density.py +82 -0
  65. rock_physics_open/fluid_models/oil_model/live_oil_velocity.py +24 -0
  66. rock_physics_open/fluid_models/oil_model/oil_bubble_point.py +69 -0
  67. rock_physics_open/fluid_models/oil_model/oil_properties.py +146 -0
  68. rock_physics_open/sandstone_models/__init__.py +59 -0
  69. rock_physics_open/sandstone_models/cemented_shalysand_sandyshale_models.py +304 -0
  70. rock_physics_open/sandstone_models/constant_cement_models.py +204 -0
  71. rock_physics_open/sandstone_models/constant_cement_optimisation.py +125 -0
  72. rock_physics_open/sandstone_models/contact_cement_model.py +138 -0
  73. rock_physics_open/sandstone_models/curvefit_sandstone_models.py +143 -0
  74. rock_physics_open/sandstone_models/friable_models.py +177 -0
  75. rock_physics_open/sandstone_models/friable_optimisation.py +115 -0
  76. rock_physics_open/sandstone_models/friable_shalysand_sandyshale_models.py +235 -0
  77. rock_physics_open/sandstone_models/patchy_cement_fluid_substitution_model.py +477 -0
  78. rock_physics_open/sandstone_models/patchy_cement_model.py +384 -0
  79. rock_physics_open/sandstone_models/patchy_cement_optimisation.py +254 -0
  80. rock_physics_open/sandstone_models/unresolved_cemented_sandshale_models.py +134 -0
  81. rock_physics_open/sandstone_models/unresolved_friable_sandshale_models.py +126 -0
  82. rock_physics_open/shale_models/__init__.py +19 -0
  83. rock_physics_open/shale_models/dem.py +174 -0
  84. rock_physics_open/shale_models/dem_dual_por.py +61 -0
  85. rock_physics_open/shale_models/kus_tok.py +59 -0
  86. rock_physics_open/shale_models/multi_sca.py +133 -0
  87. rock_physics_open/shale_models/pq.py +102 -0
  88. rock_physics_open/shale_models/sca.py +90 -0
  89. rock_physics_open/shale_models/shale4_mineral.py +147 -0
  90. rock_physics_open/shale_models/shale4_mineral_dem_overlay.py +92 -0
  91. rock_physics_open/span_wagner/__init__.py +5 -0
  92. rock_physics_open/span_wagner/co2_properties.py +444 -0
  93. rock_physics_open/span_wagner/coefficients.py +165 -0
  94. rock_physics_open/span_wagner/equations.py +104 -0
  95. rock_physics_open/span_wagner/tables/__init__.py +0 -0
  96. rock_physics_open/span_wagner/tables/carbon_dioxide_density.npz +0 -0
  97. rock_physics_open/span_wagner/tables/lookup_table.py +33 -0
  98. rock_physics_open/t_matrix_models/Equinor_logo.ico +0 -0
  99. rock_physics_open/t_matrix_models/__init__.py +35 -0
  100. rock_physics_open/t_matrix_models/carbonate_pressure_substitution.py +124 -0
  101. rock_physics_open/t_matrix_models/curvefit_t_matrix_exp.py +123 -0
  102. rock_physics_open/t_matrix_models/curvefit_t_matrix_min.py +86 -0
  103. rock_physics_open/t_matrix_models/parse_t_matrix_inputs.py +297 -0
  104. rock_physics_open/t_matrix_models/run_t_matrix.py +243 -0
  105. rock_physics_open/t_matrix_models/t_matrix_C.py +210 -0
  106. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_exp.py +137 -0
  107. rock_physics_open/t_matrix_models/t_matrix_opt_fluid_sub_petec.py +167 -0
  108. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_exp.py +76 -0
  109. rock_physics_open/t_matrix_models/t_matrix_opt_forward_model_min.py +89 -0
  110. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_exp.py +176 -0
  111. rock_physics_open/t_matrix_models/t_matrix_parameter_optimisation_min.py +162 -0
  112. rock_physics_open/t_matrix_models/t_matrix_vector/__init__.py +12 -0
  113. rock_physics_open/t_matrix_models/t_matrix_vector/array_functions.py +75 -0
  114. rock_physics_open/t_matrix_models/t_matrix_vector/calc_c_eff.py +163 -0
  115. rock_physics_open/t_matrix_models/t_matrix_vector/calc_isolated.py +95 -0
  116. rock_physics_open/t_matrix_models/t_matrix_vector/calc_kd.py +40 -0
  117. rock_physics_open/t_matrix_models/t_matrix_vector/calc_kd_eff.py +116 -0
  118. rock_physics_open/t_matrix_models/t_matrix_vector/calc_kd_uuv.py +18 -0
  119. rock_physics_open/t_matrix_models/t_matrix_vector/calc_pressure.py +140 -0
  120. rock_physics_open/t_matrix_models/t_matrix_vector/calc_t.py +71 -0
  121. rock_physics_open/t_matrix_models/t_matrix_vector/calc_td.py +42 -0
  122. rock_physics_open/t_matrix_models/t_matrix_vector/calc_theta.py +43 -0
  123. rock_physics_open/t_matrix_models/t_matrix_vector/calc_x.py +33 -0
  124. rock_physics_open/t_matrix_models/t_matrix_vector/calc_z.py +50 -0
  125. rock_physics_open/t_matrix_models/t_matrix_vector/check_and_tile.py +43 -0
  126. rock_physics_open/t_matrix_models/t_matrix_vector/g_tensor.py +140 -0
  127. rock_physics_open/t_matrix_models/t_matrix_vector/iso_av.py +60 -0
  128. rock_physics_open/t_matrix_models/t_matrix_vector/iso_ave_all.py +55 -0
  129. rock_physics_open/t_matrix_models/t_matrix_vector/pressure_input.py +44 -0
  130. rock_physics_open/t_matrix_models/t_matrix_vector/t_matrix_vec.py +278 -0
  131. rock_physics_open/t_matrix_models/t_matrix_vector/velocity_vti_angles.py +81 -0
  132. rock_physics_open/t_matrix_models/tmatrix_python.dll +0 -0
  133. rock_physics_open/t_matrix_models/tmatrix_python.so +0 -0
  134. rock_physics_open/ternary_plots/__init__.py +3 -0
  135. rock_physics_open/ternary_plots/gen_ternary_plot.py +73 -0
  136. rock_physics_open/ternary_plots/shale_prop_ternary.py +337 -0
  137. rock_physics_open/ternary_plots/ternary_patches.py +277 -0
  138. rock_physics_open/ternary_plots/ternary_plot_utilities.py +197 -0
  139. rock_physics_open/ternary_plots/unconventionals_ternary.py +75 -0
  140. rock_physics_open/version.py +34 -0
  141. rock_physics_open-0.3.2.dist-info/METADATA +90 -0
  142. rock_physics_open-0.3.2.dist-info/RECORD +145 -0
  143. rock_physics_open-0.3.2.dist-info/WHEEL +5 -0
  144. rock_physics_open-0.3.2.dist-info/licenses/LICENSE +165 -0
  145. rock_physics_open-0.3.2.dist-info/top_level.txt +1 -0
@@ -0,0 +1,51 @@
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+
5
+ def hertz_mindlin(
6
+ k: npt.NDArray[np.float64],
7
+ mu: npt.NDArray[np.float64],
8
+ phi_c: npt.NDArray[np.float64],
9
+ p: npt.NDArray[np.float64],
10
+ shear_red: npt.NDArray[np.float64] | float,
11
+ coord: npt.NDArray[np.float64] | None = None,
12
+ ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
13
+ """
14
+ Hertz-Mindlin Pressure-induced moduli increase at critical porosity.
15
+
16
+ Parameters
17
+ ----------
18
+ k : np.ndarray
19
+ Bulk modulus of grain mineral [Pa].
20
+ mu : np.ndarray
21
+ Shear modulus of grain mineral [Pa].
22
+ phi_c : np.ndarray
23
+ Critical porosity [fraction].
24
+ p : np.ndarray
25
+ Effective pressure = lithostatic pressure - hydrostatic pressure [Pa].
26
+ shear_red : float or np.ndarray
27
+ Reduced shear factor, if set to 1.0, calculation reduces to standard Hertz-Mindlin equation.
28
+ coord
29
+ coordination number, i.e. the number of grain contacts per grain. If not provided a porosity based
30
+ estimate is used.
31
+
32
+ Returns
33
+ -------
34
+ tuple
35
+ k_dry, mu_dry : np.ndarray.
36
+ k_dry: Bulk modulus [Pa] at effective pressure p,
37
+ mu_dry: Shear modulus [Pa] at effective pressure p.
38
+ """
39
+ n = 25.98805 * phi_c**2 - 43.7622 * phi_c + 21.6719 if coord is None else coord
40
+
41
+ poiss = (3 * k - 2 * mu) / (2 * (3 * k + mu))
42
+
43
+ a = ((3 * np.pi * (1 - poiss) * p) / (2 * n * (1 - phi_c) * mu)) ** (1 / 3)
44
+
45
+ s_n = (4 * a * mu) / (1 - poiss)
46
+ s_t = (8 * a * mu) / (2 - poiss)
47
+
48
+ k_dry = (n * (1 - phi_c) / (12 * np.pi)) * s_n
49
+ mu_dry = (n * (1 - phi_c) / (20 * np.pi)) * (s_n + 1.5 * s_t * shear_red)
50
+
51
+ return k_dry, mu_dry
@@ -0,0 +1,67 @@
1
+ from typing import TypeVar, cast
2
+
3
+ import numpy as np
4
+ import numpy.typing as npt
5
+
6
+ _T = TypeVar("_T", npt.NDArray[np.float64], float)
7
+
8
+
9
+ def moduli(
10
+ vp: _T,
11
+ vs: _T,
12
+ rhob: _T,
13
+ ) -> tuple[_T, _T]:
14
+ """
15
+ Calculate isotropic moduli from velocity and density.
16
+
17
+ Parameters
18
+ ----------
19
+ vp : np.ndarray or float
20
+ Pressure wave velocity [m/s].
21
+ vs : np.ndarray or float
22
+ Shear wave velocity [m/s].
23
+ rhob : np.ndarray or float
24
+ Bulk density [kg/m^3].
25
+
26
+ Returns
27
+ -------
28
+ tuple
29
+ k, mu : (np.ndarray, np.ndarray) or (float, float).
30
+ k: bulk modulus [Pa], mu: shear modulus [Pa].
31
+ """
32
+ mu = vs**2 * rhob
33
+ k = vp**2 * rhob - 4 / 3 * mu
34
+
35
+ return k, mu
36
+
37
+
38
+ def velocity(
39
+ k: _T,
40
+ mu: _T,
41
+ rhob: _T,
42
+ ) -> tuple[_T, _T, _T, _T]:
43
+ """
44
+ Calculate velocity, acoustic impedance and vp/vs ratio from elastic moduli and density.
45
+
46
+ Parameters
47
+ ----------
48
+ k : np.ndarray, float
49
+ Bulk modulus [Pa].
50
+ mu : np.ndarray, float
51
+ Shear modulus [Pa].
52
+ rhob : np.ndarray, float
53
+ Bulk density [kg/m^3].
54
+
55
+ Returns
56
+ -------
57
+ tuple
58
+ vp, vs, ai, vp_vs : np.ndarray.
59
+ vp: pressure wave velocity [m/s], vs: shear wave velocity [m/s], ai: acoustic impedance [m/s x kg/m^3],
60
+ vp_vs: velocity ratio [fraction].
61
+ """
62
+ vs = cast(_T, (mu / rhob) ** 0.5)
63
+ vp = cast(_T, ((k + 4 / 3 * mu) / rhob) ** 0.5)
64
+ ai = cast(_T, vp * rhob)
65
+ vp_vs = cast(_T, vp / vs)
66
+
67
+ return vp, vs, ai, vp_vs
@@ -0,0 +1,120 @@
1
+ from typing import Literal
2
+
3
+ import numpy as np
4
+ import numpy.typing as npt
5
+
6
+
7
+ def _refl_models(
8
+ vp: npt.NDArray[np.float64],
9
+ vs: npt.NDArray[np.float64],
10
+ rho: npt.NDArray[np.float64],
11
+ theta: npt.NDArray[np.float64],
12
+ k: npt.NDArray[np.float64] | float = 2.0,
13
+ mod: Literal["aki_richards", "smith_gidlow"] = "aki_richards",
14
+ ) -> npt.NDArray[np.float64]:
15
+ """Calculate reflect coeff.
16
+
17
+ Parameters
18
+ ----------
19
+ vp : np.ndarray
20
+ vp array.
21
+ vs : np.ndarray
22
+ vs array.
23
+ rho : np.ndarray
24
+ rho array.
25
+ theta : float, np.ndarray
26
+ Theta value.
27
+ k : float, np.ndarray, optional
28
+ By default 2.0.
29
+ mod : str, optional
30
+ By default 'aki_richards'.
31
+
32
+ Returns
33
+ -------
34
+ np.ndarray
35
+ Reflect coeff.
36
+ """
37
+ theta = theta / 180 * np.pi
38
+ r_vp = (vp[1:] - vp[0:-1]) / (vp[0:-1] + vp[1:])
39
+ r_vs = (vs[1:] - vs[0:-1]) / (vs[0:-1] + vs[1:])
40
+ r_rho = (rho[1:] - rho[0:-1]) / (rho[0:-1] + rho[1:])
41
+ # Need to append one sample to make returned array of the same size - repeat the last value
42
+ r_vp = np.append(r_vp, r_vp[-1])
43
+ r_vs = np.append(r_vs, r_vs[-1])
44
+ r_rho = np.append(r_rho, r_rho[-1])
45
+
46
+ if mod == "aki_richards":
47
+ reflect_coeff = (
48
+ 0.5 * (r_vp + r_rho)
49
+ + (0.5 * r_vp - 2 * k**-2 * (2 * r_vs + r_rho)) * np.sin(theta) ** 2
50
+ + 0.5 * r_vp * (np.tan(theta) ** 2 - np.sin(theta) ** 2)
51
+ )
52
+ else:
53
+ reflect_coeff = (
54
+ 5 / 8 - 0.5 * k**-2 * np.sin(theta) ** 2 + 0.5 * np.tan(theta) ** 2
55
+ ) * r_vp - 4 * k**-2 * np.sin(theta) ** 2 * r_vs
56
+
57
+ return reflect_coeff
58
+
59
+
60
+ def aki_richards(
61
+ vp: npt.NDArray[np.float64],
62
+ vs: npt.NDArray[np.float64],
63
+ rho: npt.NDArray[np.float64],
64
+ theta: npt.NDArray[np.float64],
65
+ k: npt.NDArray[np.float64] | float = 2.0,
66
+ ) -> npt.NDArray[np.float64]:
67
+ """
68
+ Linearised Zoeppritz equation according to Aki and Richards.
69
+
70
+ Parameters
71
+ ----------
72
+ vp : np.ndarray
73
+ Pressure wave velocity [m/s].
74
+ vs : np.ndarray
75
+ Shear wave velocity [m/s].
76
+ rho : np.ndarray
77
+ Density [kg/m^3].
78
+ theta : np.ndarray
79
+ Angle of incident ray [radians].
80
+ k : float, np.ndarray
81
+ Background vp/vs [unitless].
82
+
83
+ Returns
84
+ -------
85
+ refl_coeff : np.ndarray
86
+ Reflection coefficient [unitless].
87
+ """
88
+ return _refl_models(vp, vs, rho, theta, k, mod="aki_richards")
89
+
90
+
91
+ def smith_gidlow(
92
+ vp: npt.NDArray[np.float64],
93
+ vs: npt.NDArray[np.float64],
94
+ rho: npt.NDArray[np.float64],
95
+ theta: npt.NDArray[np.float64],
96
+ k: npt.NDArray[np.float64] | float = 2.0,
97
+ ) -> npt.NDArray[np.float64]:
98
+ """
99
+ Linearised Zoeppritz equation according to Smith and Gidlow.
100
+
101
+ Parameters
102
+ ----------
103
+ vp : np.ndarray
104
+ Pressure wave velocity [m/s].
105
+ vs : np.ndarray
106
+ Shear wave velocity [m/s].
107
+ rho : np.ndarray
108
+ Density [kg/m^3].
109
+ theta : np.ndarray
110
+ Angle of incident ray [radians].
111
+ k : float, np.ndarray
112
+ Background vp/vs [unitless].
113
+
114
+ Returns
115
+ -------
116
+ refl_coeff : np.ndarray
117
+ Reflection coefficient [unitless].
118
+ """
119
+
120
+ return _refl_models(vp, vs, rho, theta, k, mod="smith_gidlow")
@@ -0,0 +1,69 @@
1
+ from warnings import warn
2
+
3
+ import numpy as np
4
+ import numpy.typing as npt
5
+
6
+
7
+ def rho_b(
8
+ phi: npt.NDArray[np.float64],
9
+ rho_f: npt.NDArray[np.float64],
10
+ rho_mat: npt.NDArray[np.float64],
11
+ ) -> npt.NDArray[np.float64]:
12
+ """
13
+ Calculate bulk density from porosity, fluid density and matrix density.
14
+
15
+ Parameters
16
+ ----------
17
+ phi: np.ndarray
18
+ Porosity [fraction].
19
+ rho_f: np.ndarray
20
+ Fluid bulk density [kg/m^3].
21
+ rho_mat: np.ndarray
22
+ Matrix bulk density [kg/m^3].
23
+
24
+ Returns
25
+ -------
26
+ np.ndarray
27
+ rhob: bulk density [kg/m^3].
28
+ """
29
+ return phi * rho_f + (1 - phi) * rho_mat
30
+
31
+
32
+ def rho_m(
33
+ frac_cem: npt.NDArray[np.float64],
34
+ phi: npt.NDArray[np.float64],
35
+ rho_cem: npt.NDArray[np.float64],
36
+ rho_min: npt.NDArray[np.float64],
37
+ ) -> npt.NDArray[np.float64]:
38
+ """
39
+ Calculates matrix density as a combination of cement fraction and minerals
40
+ fracCem is defined as cement fraction relative to total volume.
41
+
42
+ Parameters
43
+ ----------
44
+ frac_cem : np.ndarray
45
+ Cement fraction [fraction].
46
+ phi : np.ndarray
47
+ Porosity [fraction].
48
+ rho_cem : np.ndarray
49
+ Cement density [kg/m^3].
50
+ rho_min : np.ndarray
51
+ Mineral density [kg/m^3].
52
+
53
+ Returns
54
+ -------
55
+ np.ndarray
56
+ rho_mat: matrix density [kg/m^3]
57
+ """
58
+ idx = np.logical_and(phi >= 0.0, phi < 1.0)
59
+ if np.sum(idx) != len(phi):
60
+ warn(
61
+ f"{__file__}: phi out of range in {len(phi) - np.sum(idx)} sample",
62
+ )
63
+
64
+ rho_mat = np.ones_like(phi) * np.nan
65
+ f_cem = frac_cem[idx] / (1 - phi[idx])
66
+
67
+ rho_mat[idx] = f_cem * rho_cem[idx] + (1 - f_cem) * rho_min[idx]
68
+
69
+ return rho_mat
@@ -0,0 +1,149 @@
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+
5
+ def voigt(
6
+ k1: npt.NDArray[np.float64],
7
+ mu1: npt.NDArray[np.float64],
8
+ k2: npt.NDArray[np.float64],
9
+ mu2: npt.NDArray[np.float64],
10
+ f1: npt.NDArray[np.float64],
11
+ ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
12
+ """
13
+ Effective media calculation of a mixture of two phases using the Voigt bound.
14
+
15
+ Parameters
16
+ ----------
17
+ k1 : np.ndarray
18
+ Bulk modulus of phase 1 [Pa].
19
+ mu1 : np.ndarray
20
+ Shear modulus of phase 1 [Pa].
21
+ k2 : np.ndarray
22
+ Bulk modulus of phase 2 [Pa].
23
+ mu2 : np.ndarray
24
+ Shear modulus of phase 2 [Pa].
25
+ f1 : np.ndarray
26
+ Fraction of phase 1 [fraction].
27
+
28
+ Returns
29
+ -------
30
+ tuple
31
+ k, mu : np.ndarray.
32
+ k: effective bulk modulus [Pa], mu: effective shear modulus [Pa]
33
+ """
34
+ f2 = 1 - f1
35
+ k_v = f1 * k1 + f2 * k2
36
+ mu_v = f1 * mu1 + f2 * mu2
37
+
38
+ return k_v, mu_v
39
+
40
+
41
+ def voigt_reuss_hill(
42
+ k1: npt.NDArray[np.float64],
43
+ mu1: npt.NDArray[np.float64],
44
+ k2: npt.NDArray[np.float64],
45
+ mu2: npt.NDArray[np.float64],
46
+ f1: npt.NDArray[np.float64],
47
+ ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
48
+ """
49
+ Effective media calculation of a mixture of two phases using the Voigt-Reuss-Hill average.
50
+
51
+ Parameters
52
+ ----------
53
+ k1 : np.ndarray
54
+ Bulk modulus of phase 1 [Pa].
55
+ mu1 : np.ndarray
56
+ Shear modulus of phase 1 [Pa].
57
+ k2 : np.ndarray
58
+ Bulk modulus of phase 2 [Pa].
59
+ mu2 : np.ndarray
60
+ Shear modulus of phase 2 [Pa].
61
+ f1 : np.ndarray
62
+ Fraction of phase 1 [fraction].
63
+
64
+ Returns
65
+ -------
66
+ tuple
67
+ k, mu : np.ndarray
68
+ k: effective bulk modulus [Pa], mu: effective shear modulus [Pa]
69
+ """
70
+ k_v, mu_v = voigt(k1, mu1, k2, mu2, f1)
71
+ k_r, mu_r = reuss(k1, mu1, k2, mu2, f1)
72
+
73
+ k_vrh = (k_r + k_v) / 2
74
+ mu_vrh = (mu_r + mu_v) / 2
75
+
76
+ return k_vrh, mu_vrh
77
+
78
+
79
+ def multi_voigt_reuss_hill(
80
+ *varargin: npt.NDArray[np.float64],
81
+ ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
82
+ """
83
+ Voigt-Reuss-Hill with multiple mineral input.
84
+
85
+ Call function with [k, mu] = multi_voigt_reuss_hill(k1, mu1, f2, ....kn,
86
+ mun, fn). Fractions must add up to 1.0. All inputs are assumed to be
87
+ vectors with the same length.
88
+
89
+ Parameters
90
+ ----------
91
+ varargin : np.ndarray
92
+
93
+ Returns
94
+ -------
95
+ tuple
96
+ k, mu : np.ndarray
97
+ k: effective bulk modulus [Pa], mu: effective shear modulus [Pa].
98
+ """
99
+ k_min = np.array(varargin[::3])
100
+ mu_min = np.array(varargin[1::3])
101
+ f = np.array(varargin[2::3])
102
+
103
+ k_voigt = np.sum(k_min * f, axis=0)
104
+ mu_voigt = np.sum(mu_min * f, axis=0)
105
+
106
+ k_reuss = 1 / np.sum(f / k_min, axis=0)
107
+ mu_reuss = 1 / np.sum(f / mu_min, axis=0)
108
+
109
+ k = (k_voigt + k_reuss) / 2
110
+ mu = (mu_voigt + mu_reuss) / 2
111
+
112
+ return k, mu
113
+
114
+
115
+ def reuss(
116
+ k1: npt.NDArray[np.float64],
117
+ mu1: npt.NDArray[np.float64],
118
+ k2: npt.NDArray[np.float64],
119
+ mu2: npt.NDArray[np.float64],
120
+ f1: npt.NDArray[np.float64],
121
+ ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
122
+ """
123
+ Effective media calculation of a mixture of two phases using the Reuss bound.
124
+
125
+ Parameters
126
+ ----------
127
+ k1 : np.ndarray
128
+ Bulk modulus of phase 1 [Pa].
129
+ mu1 : np.ndarray
130
+ Shear modulus of phase 1 [Pa].
131
+ k2 : np.ndarray
132
+ Bulk modulus of phase 2 [Pa].
133
+ mu2 : np.ndarray
134
+ Shear modulus of phase 2 [Pa].
135
+ f1 : np.ndarray
136
+ Fraction of phase 1 [fraction].
137
+
138
+ Returns
139
+ -------
140
+ tuple
141
+ k, mu : np.ndarray.
142
+ k: effective bulk modulus [Pa], mu: effective shear modulus [Pa].
143
+ """
144
+ f2 = 1 - f1
145
+
146
+ k_r = 1 / (f1 / k1 + f2 / k2)
147
+ mu_r = 1 / (f1 / mu1 + f2 / mu2)
148
+
149
+ return k_r, mu_r
@@ -0,0 +1,45 @@
1
+ import numpy as np
2
+ import numpy.typing as npt
3
+
4
+
5
+ def walton_smooth(
6
+ k: npt.NDArray[np.float64],
7
+ mu: npt.NDArray[np.float64],
8
+ phi: npt.NDArray[np.float64],
9
+ p_eff: npt.NDArray[np.float64],
10
+ coord: float | npt.NDArray[np.float64] | None = None,
11
+ ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
12
+ """
13
+ Walton Smooth Pressure-induced moduli increase at critical porosity.
14
+
15
+ Parameters
16
+ ----------
17
+ k : np.ndarray
18
+ Bulk modulus of grain mineral [Pa].
19
+ mu : np.ndarray
20
+ Shear modulus of grain mineral [Pa].
21
+ phi : np.ndarray
22
+ Critical porosity [fraction].
23
+ p_eff : np.ndarray
24
+ Effective Pressure = (Lithostatic - Hydrostatic) pressure [Pa].
25
+ coord : float or np.ndarray
26
+ Coordination number, i.e. number of grain contract per grain. If not provided a porosity based estimate is
27
+ used [unitless].
28
+
29
+ Returns
30
+ -------
31
+ tuple
32
+ k_dry , mu_dry : np.ndarray.
33
+ k_dry Bulk modulus at effective pressure p,
34
+ mu_dry Shear modulus at effective pressure p.
35
+ """
36
+
37
+ n = 25.98805 * phi**2 - 43.7622 * phi + 21.6719 if coord is None else coord
38
+
39
+ pr_min = (3 * k - 2 * mu) / (2 * (3 * k + mu))
40
+ k_dry_num = n**2 * (1 - phi) ** 2 * mu**2 * p_eff # Numerator in walton expression
41
+ k_dry_denom = 18 * np.pi**2 * (1 - pr_min) ** 2 # Denominator in Walton expression
42
+ k_dry = (k_dry_num / k_dry_denom) ** (1 / 3) # Bulk modulus
43
+ mu_dry = 3 / 5 * k_dry
44
+
45
+ return k_dry, mu_dry
@@ -0,0 +1,94 @@
1
+ from collections.abc import Sequence
2
+
3
+ import numpy as np
4
+ import numpy.typing as npt
5
+
6
+
7
+ def brie(
8
+ s_gas: npt.NDArray[np.float64],
9
+ k_gas: npt.NDArray[np.float64],
10
+ s_brine: npt.NDArray[np.float64],
11
+ k_brine: npt.NDArray[np.float64],
12
+ s_oil: npt.NDArray[np.float64],
13
+ k_oil: npt.NDArray[np.float64],
14
+ e: float | npt.NDArray[np.float64],
15
+ ) -> npt.NDArray[np.float64]:
16
+ """
17
+ Brie function for effective bulk modulus of a mix of fluids.
18
+
19
+ Parameters
20
+ ----------
21
+ s_gas : np.ndarray
22
+ Gas saturation [ratio].
23
+ k_gas : np.ndarray
24
+ Gas bulk modulus [Pa].
25
+ s_brine : np.ndarray
26
+ Brine saturation [ratio].
27
+ k_brine : np.ndarray
28
+ Brine bulk modulus [Pa].
29
+ s_oil : np.ndarray
30
+ Oil saturation [ratio].
31
+ k_oil : np.ndarray
32
+ Oil bulk modulus [Pa].
33
+ e : float or np.ndarray
34
+ Exponent in Brie function [unitless].
35
+
36
+ Returns
37
+ -------
38
+ np.ndarray
39
+ k: effective bulk modulus [Pa].
40
+ """
41
+
42
+ # Reuss average for fluids, catch zero fluid saturations
43
+ idx = s_brine + s_oil > 0
44
+ k_liquid = np.zeros(k_brine.shape)
45
+ k_liquid[idx] = (s_brine[idx] / k_brine[idx] + s_oil[idx] / k_oil[idx]) ** -1
46
+
47
+ return (k_liquid - k_gas) * (1 - s_gas) ** e + k_gas
48
+
49
+
50
+ def wood(
51
+ s1: npt.NDArray[np.float64],
52
+ k1: npt.NDArray[np.float64],
53
+ rho1: npt.NDArray[np.float64],
54
+ k2: npt.NDArray[np.float64],
55
+ rho2: npt.NDArray[np.float64],
56
+ ) -> tuple[npt.NDArray[np.float64], npt.NDArray[np.float64]]:
57
+ """
58
+ Wood effective fluid properties for a mix of two fluids.
59
+
60
+ Parameters
61
+ ----------
62
+ s1 : np.ndarray
63
+ Saturation of phase 1 [ratio].
64
+ k1 : np.ndarray
65
+ Bulk modulus of phase 1 [Pa].
66
+ rho1 : np.ndarray
67
+ Density of phase 1 [kg/m^3].
68
+ k2 : np.ndarray
69
+ Bulk modulus of phase 2 [Pa].
70
+ rho2 : np.ndarray
71
+ Density of phase 2 [kg/m^3].
72
+
73
+ Returns
74
+ -------
75
+ tuple
76
+ k, rho : np.ndarray.
77
+ k: effective fluid bulk modulus [Pa], rho: effective fluid density [kg/m^3].
78
+ """
79
+ s2 = 1 - s1
80
+
81
+ k = 1 / (s1 / k1 + s2 / k2)
82
+ rho = s1 * rho1 + s2 * rho2
83
+
84
+ return k, rho
85
+
86
+
87
+ def multi_wood(fractions: Sequence[float], bulk_moduli: Sequence[float]) -> float:
88
+ assert len(fractions) == len(bulk_moduli)
89
+ sum_fractions = sum(fractions)
90
+ ratio_sum = sum(
91
+ saturation / bulk_modulus
92
+ for (saturation, bulk_modulus) in zip(fractions, bulk_moduli)
93
+ )
94
+ return sum_fractions / ratio_sum
@@ -0,0 +1,24 @@
1
+ from .display_result_statistics import disp_result_stats
2
+ from .gassmann_dry_mod import gassmann_dry_model
3
+ from .gassmann_mod import gassmann_model
4
+ from .gassmann_sub_mod import gassmann_sub_model
5
+ from .hs_average import hs_average
6
+ from .pressure import pressure
7
+ from .reflectivity import reflectivity
8
+ from .timeshift import time_shift_pp, time_shift_ps
9
+ from .vp_vs_rho_set_statistics import vp_vs_rho_stats
10
+ from .vrh_3_min import min_3_voigt_reuss_hill
11
+
12
+ __all__ = [
13
+ "disp_result_stats",
14
+ "gassmann_dry_model",
15
+ "gassmann_model",
16
+ "gassmann_sub_model",
17
+ "hs_average",
18
+ "pressure",
19
+ "reflectivity",
20
+ "time_shift_pp",
21
+ "time_shift_ps",
22
+ "vp_vs_rho_stats",
23
+ "min_3_voigt_reuss_hill",
24
+ ]