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,71 @@
1
+ import numpy as np
2
+
3
+
4
+ def calc_t_vec(td, theta, x, z, omega, gamma, tau, k_fluid):
5
+ """
6
+ Returns the t-matrices (6x6x(numbers of connected pores)) of the
7
+ connected pores.
8
+
9
+ Parameters
10
+ ----------
11
+ td : np.ndarray
12
+ Dry t-matrix tensors, (nx6x6x(numbers of empty cavities) matrix).
13
+ theta : np.ndarray
14
+ Theta-tensor (nx6x6 matrix).
15
+ x : np.ndarray
16
+ X-tensor (nx6x6x(numbers of empty cavities) matrix).
17
+ z : np.ndarray
18
+ Z-tensor (nx6x6x(numbers of empty cavities) matrix).
19
+ omega : np.ndarray
20
+ Frequency (2*pi*f).
21
+ gamma : np.ndarray
22
+ Gamma factor of all the inclusions (nx(numbers of empty cavities) vector).
23
+ tau : np.ndarray
24
+ Relaxation time constant (1x(numbers of empty cavities) vector).
25
+ k_fluid : np.ndarray
26
+ Bulk modulus of the fluid.
27
+
28
+ Returns
29
+ -------
30
+ np.ndarray
31
+ t-matrices.
32
+ """
33
+ if not (
34
+ td.ndim == 4
35
+ and x.ndim == 4
36
+ and z.ndim == 4
37
+ and gamma.ndim == 2
38
+ and k_fluid.ndim == 1
39
+ and theta.ndim == 1
40
+ and np.all(np.array([td.shape[1:2], x.shape[1:2], z.shape[1:2]]) == td.shape[1])
41
+ and np.all(
42
+ np.array(
43
+ [
44
+ x.shape[0],
45
+ z.shape[0],
46
+ gamma.shape[0],
47
+ theta.shape[0],
48
+ k_fluid.shape[0],
49
+ ]
50
+ )
51
+ == td.shape[0]
52
+ )
53
+ and np.all(
54
+ np.array([x.shape[3], z.shape[3], tau.shape[0], gamma.shape[1]])
55
+ == td.shape[3]
56
+ )
57
+ ):
58
+ raise ValueError(f"{__name__}: mismatch in inputs dimension/shape")
59
+
60
+ log_len = k_fluid.shape[0]
61
+ alpha_len = td.shape[3]
62
+
63
+ # Reshape to enable broadcast
64
+ k_fluid = k_fluid.reshape((log_len, 1, 1, 1))
65
+ gamma = gamma.reshape((log_len, 1, 1, alpha_len))
66
+ tau = tau.reshape((1, 1, 1, alpha_len))
67
+ theta = theta.reshape((log_len, 1, 1, 1))
68
+
69
+ return td + (theta * z + 1j * omega * tau * k_fluid * x) / (
70
+ 1 + 1j * omega * gamma * tau
71
+ )
@@ -0,0 +1,42 @@
1
+ import numpy as np
2
+
3
+ from .array_functions import array_inverse, array_matrix_mult
4
+ from .g_tensor import g_tensor_vec
5
+
6
+
7
+ def calc_td_vec(c0, i4, s_0, kd, alpha):
8
+ """Returns the dry t-matrix tensors (nx6x6x(numbers of empty cavities) matrix).
9
+
10
+ Parameters
11
+ ----------
12
+ c0 : np.ndarray
13
+ Stiffness tensor of the host material (nx6x6 matrix).
14
+ i4 : np.ndarray
15
+ An n x Identity matrix.
16
+ s_0 : np.ndarray
17
+ Inverse of stiffness tensor.
18
+ kd : np.ndarray
19
+ Dry K tensor of all the empty cavities (nx6x6x(numbers of empty cavities) matrix) see Agersborg et al.
20
+ 2009 for explanation.
21
+ alpha : np.ndarray
22
+ Aspect ratios of all the empty cavities (1x(numbers of empty cavities) vector).
23
+
24
+ Returns
25
+ -------
26
+ np.ndarray
27
+ Dry t-matrix tensors.
28
+ """
29
+ log_len = c0.shape[0]
30
+ if alpha.ndim == 1 and alpha.shape[0] != c0.shape[0]:
31
+ alpha = np.tile(alpha.reshape(1, alpha.shape[0]), (log_len, 1))
32
+ alpha_len = alpha.shape[1]
33
+
34
+ td = np.array(np.zeros((log_len, 6, 6, alpha_len)))
35
+
36
+ for nc in range(alpha_len):
37
+ g = g_tensor_vec(c0, s_0, alpha[:, nc])
38
+ td[:, :, :, nc] = array_matrix_mult(
39
+ array_inverse(g), array_matrix_mult(kd[:, :, :, nc], c0) - i4
40
+ )
41
+
42
+ return td
@@ -0,0 +1,43 @@
1
+ import numpy as np
2
+
3
+
4
+ def calc_theta_vec(v, omega, gamma, tau, kd_uuvv, dr, k, kappa, kappa_f):
5
+ """Returns the theta tensor (6x6 matrix) for more explanation see e.g.
6
+ Agersborg et al. 2009 or "The effects of drained and undrained loading in
7
+ visco-elsatic waves in rock-like composites" M. Jakobsen and T.A. Johansen.
8
+ (2005). Int. J. Solids and Structures (42). p. 1597-1611.
9
+
10
+ Parameters
11
+ ----------
12
+ v : np.ndarray
13
+ Concentration of all the empty cavities (1x(numbers of empty cavities) vector).
14
+ omega : np.ndarray
15
+ Frequency (2*pi*f).
16
+ gamma : np.ndarray
17
+ Gamma factor of all the inclusions (1x(numbers of empty cavities) vector).
18
+ tau : np.ndarray
19
+ Relaxation time constant (1x(numbers of empty cavities) vector).
20
+ kd_uuvv : np.ndarray
21
+ Tensor sum of the dry K tensor for all the cavities (1x(numbers of empty cavities) vector).
22
+ dr : np.ndarray
23
+ Permeability/viscosity.
24
+ k : np.ndarray
25
+ Wave number vector.
26
+ kappa : np.ndarray
27
+ Bulk modulus of the host material.
28
+ kappa_f : np.ndarray
29
+ Bulk modulus of the fluid.
30
+
31
+ Returns
32
+ -------
33
+ np.ndarray
34
+ Theta tensor.
35
+ """
36
+ sigma_a = np.sum((v / (1 + 1j * omega * gamma * tau)), axis=1)
37
+ sigma_b = np.sum((v / (1 + 1j * omega * gamma * tau)) * kd_uuvv, axis=1)
38
+
39
+ return kappa_f / (
40
+ (1 - kappa_f / kappa) * sigma_a
41
+ + kappa_f * sigma_b
42
+ - (1j * k * k / omega) * dr * kappa_f
43
+ )
@@ -0,0 +1,33 @@
1
+ import numpy as np
2
+
3
+ from .array_functions import array_matrix_mult
4
+ from .check_and_tile import check_and_tile
5
+
6
+
7
+ def calc_x_vec(s_0, td):
8
+ """Returns the x-tensor (6x6x(numbers of empty cavities) matrix) for more explanation see e.g.
9
+ Agersborg et al. 2009 or "The effects of drained and undrained loading in
10
+ visco-elsatic waves in rock-like composites" M. Jakobsen and T.A. Johansen.
11
+ (2005). Int. J. Solids and Structures (42). p. 1597-1611
12
+
13
+ Parameters
14
+ ----------
15
+ s_0: np.ndarray
16
+ Inverse of stiffness tensor of the host material (nx6x6 matrix).
17
+ td : np.ndarray
18
+ Dry t-matrix tensors (nx6x6x(numbers of empty cavities) matrix).
19
+
20
+ Returns
21
+ -------
22
+ np.ndarray
23
+ x-tensor.
24
+ """
25
+ i2_i2, log_length, alpha_length = check_and_tile(s_0, td)
26
+
27
+ x = np.zeros((log_length, 6, 6, alpha_length))
28
+ for j in range(alpha_length):
29
+ x[:, :, :, j] = array_matrix_mult(
30
+ td[:, :, :, j], s_0, i2_i2, s_0, td[:, :, :, j]
31
+ )
32
+
33
+ return x
@@ -0,0 +1,50 @@
1
+ import numpy as np
2
+
3
+ from .array_functions import array_matrix_mult
4
+ from .check_and_tile import check_and_tile
5
+
6
+
7
+ def calc_z_vec(s0, td, td_bar, omega, gamma, v, tau):
8
+ """Returns the z tensor (6x6x(numbers of empty cavities) matrix) for more explanation see e.g.
9
+ Agersborg et al. 2009 or "The effects of drained and undrained loading in
10
+ visco-elsatic waves in rock-like composites" M. Jakobsen and T.A. Johansen.
11
+ (2005). Int. J. Solids and Structures (42). p. 1597-1611.
12
+
13
+ Parameters
14
+ ----------
15
+ s0 : np.ndarray
16
+ Stiffness tensor of the host material (6x6 matrix).
17
+ td : np.ndarray
18
+ Dry t-matrix tensors, (6x6x(numbers of empty cavities) matrix).
19
+ td_bar : np.ndarray
20
+ Dry t-matrix tensors, (6x6x(numbers of empty cavities) matrix).
21
+ omega : np.ndarray
22
+ Frequency (2*pi*f).
23
+ gamma : np.ndarray
24
+ Gamma factor of all the inclusions (1x(numbers of empty cavities) vector).
25
+ v : np.ndarray
26
+ Concentration of all the empty cavities (1x(numbers of empty cavities) vector).
27
+ tau : np.ndarray
28
+ Relaxation time constant (1x(numbers of empty cavities) vector).
29
+
30
+ Returns
31
+ -------
32
+ tuple
33
+ z, z_bar : (np.ndarray, np.ndarray).
34
+ """
35
+ i2_i2, log_length, alpha_length = check_and_tile(s0, td)
36
+
37
+ sum_z = 0.0
38
+ z = np.zeros((log_length, 6, 6, alpha_length), dtype="complex128")
39
+ z_bar = np.zeros((log_length, 6, 6, alpha_length), dtype="complex128")
40
+
41
+ for j in range(alpha_length):
42
+ sum_z = sum_z + (td[:, :, :, j] + td_bar[:, :, :, j]) * (
43
+ v[:, j] / (1 + 1j * omega * gamma[:, j] * tau[j])
44
+ ).reshape(log_length, 1, 1)
45
+
46
+ for j in range(alpha_length):
47
+ z[:, :, :, j] = array_matrix_mult(td[:, :, :, j], s0, i2_i2, s0, sum_z)
48
+ z_bar[:, :, :, j] = array_matrix_mult(td_bar[:, :, :, j], s0, i2_i2, s0, sum_z)
49
+
50
+ return z, z_bar
@@ -0,0 +1,43 @@
1
+ import numpy as np
2
+
3
+
4
+ def check_and_tile(s, t):
5
+ """Utility - code that was repeated in the T-Matrix functions.
6
+
7
+ Parameters
8
+ ----------
9
+ s : np.ndarray
10
+ s parameter.
11
+ t : np.ndarray
12
+ t parameter.
13
+
14
+ Returns
15
+ -------
16
+ tuple
17
+ i2_i2, log_length, alpha_length : (np.ndarray, int, int).
18
+ i2_i2: array with upper left matrices set to 1, log_length: array dimension, alpha_length: number of inclusions.
19
+ """
20
+ if not (
21
+ s.ndim == 3
22
+ and t.ndim == 4
23
+ and np.all(np.array([s.shape[1], s.shape[2], t.shape[1]]) == t.shape[2])
24
+ and s.shape[0] == t.shape[0]
25
+ ):
26
+ raise ValueError(f"{__name__}: mismatch in inputs variables dimension/shape")
27
+
28
+ log_length = t.shape[0]
29
+ alpha_length = t.shape[3]
30
+
31
+ tmp = np.array(
32
+ [
33
+ [1, 1, 1, 0, 0, 0],
34
+ [1, 1, 1, 0, 0, 0],
35
+ [1, 1, 1, 0, 0, 0],
36
+ [0, 0, 0, 0, 0, 0],
37
+ [0, 0, 0, 0, 0, 0],
38
+ [0, 0, 0, 0, 0, 0],
39
+ ]
40
+ )
41
+ i2_i2 = np.tile(tmp.reshape((1, 6, 6)), (log_length, 1, 1))
42
+
43
+ return i2_i2, log_length, alpha_length
@@ -0,0 +1,140 @@
1
+ import numpy as np
2
+
3
+ from .array_functions import array_matrix_mult
4
+
5
+
6
+ def g_tensor_vec(c0, s_0, alpha):
7
+ """Returns the Eshelby green's tensor (nx6x6 array).
8
+
9
+ Parameters
10
+ ----------
11
+ c0 : np.ndarray
12
+ n stiffness tensors of the host material (nx6x6 array).
13
+ s_0 : np.ndarray
14
+ Inverse of stiffness tensor.
15
+ alpha : float
16
+ Aspect ratio for single inclusion.
17
+
18
+ Returns
19
+ -------
20
+ np.ndarray
21
+ g-tensor.
22
+
23
+ Raises
24
+ ------
25
+ ValueError
26
+ If mismatch in input dimension/shape.
27
+ """
28
+ if not (
29
+ c0.ndim == 3
30
+ and c0.shape[1] == c0.shape[2]
31
+ and s_0.ndim == 3
32
+ and s_0.shape[1] == s_0.shape[2]
33
+ ):
34
+ raise ValueError(f"{__name__}: mismatch in inputs variables dimension/shape")
35
+
36
+ log_len = c0.shape[0]
37
+ mu = c0[:, 3, 3] / 2
38
+ kappa = c0[:, 0, 0] - (4 / 3) * mu
39
+ pois_ratio = (3 * kappa - 2 * mu) / (2 * (3 * kappa + mu))
40
+
41
+ s_r = np.zeros(c0.shape)
42
+
43
+ s_11 = np.zeros(log_len)
44
+ s_12 = np.zeros(log_len)
45
+ s_13 = np.zeros(log_len)
46
+ s_21 = np.zeros(log_len)
47
+ s_22 = np.zeros(log_len)
48
+ s_23 = np.zeros(log_len)
49
+ s_31 = np.zeros(log_len)
50
+ s_32 = np.zeros(log_len)
51
+ s_33 = np.zeros(log_len)
52
+ s_44 = np.zeros(log_len)
53
+ s_55 = np.zeros(log_len)
54
+ s_66 = np.zeros(log_len)
55
+
56
+ if isinstance(alpha, float):
57
+ alpha = np.ones(log_len) * alpha
58
+ # Check for valid range of alpha - those outside are returned with zero matrices
59
+ idx_in = (alpha >= 0) & (alpha < 1)
60
+ idx_one = alpha == 1
61
+ alpha_in = alpha[idx_in]
62
+ pois_ratio_in = pois_ratio[idx_in]
63
+ pois_ratio_one = pois_ratio[idx_one]
64
+
65
+ if np.any(idx_in):
66
+ q = (alpha_in / (1 - alpha_in**2) ** (3 / 2)) * (
67
+ np.arccos(alpha_in) - alpha_in * (1 - alpha_in**2) ** (1 / 2)
68
+ )
69
+ s_11[idx_in] = (3 / (8 * (1 - pois_ratio_in))) * (
70
+ alpha_in**2 / (alpha_in**2 - 1)
71
+ ) + (1 / (4 * (1 - pois_ratio_in))) * (
72
+ 1 - 2 * pois_ratio_in - 9 / (4 * (alpha_in**2 - 1))
73
+ ) * q
74
+ s_33[idx_in] = (1 / (2 * (1 - pois_ratio_in))) * (
75
+ 1
76
+ - 2 * pois_ratio_in
77
+ + (3 * alpha_in**2 - 1) / (alpha_in**2 - 1)
78
+ - (1 - 2 * pois_ratio_in + 3 * alpha_in**2 / (alpha_in**2 - 1)) * q
79
+ )
80
+ s_12[idx_in] = (1 / (4 * (1 - pois_ratio_in))) * (
81
+ alpha_in**2 / (2 * (alpha_in**2 - 1))
82
+ - (1 - 2 * pois_ratio_in + 3 / (4 * (alpha_in**2 - 1))) * q
83
+ )
84
+ s_13[idx_in] = (1 / (2 * (1 - pois_ratio_in))) * (
85
+ -(alpha_in**2) / (alpha_in**2 - 1)
86
+ + 0.5 * (3 * alpha_in**2 / (alpha_in**2 - 1) - (1 - 2 * pois_ratio_in)) * q
87
+ )
88
+ s_31[idx_in] = (1 / (2 * (1 - pois_ratio_in))) * (
89
+ 2 * pois_ratio_in
90
+ - 1
91
+ - 1 / (alpha_in**2 - 1)
92
+ + (1 - 2 * pois_ratio_in + 3 / (2 * (alpha_in**2 - 1))) * q
93
+ )
94
+ s_66[idx_in] = (1 / (4 * (1 - pois_ratio_in))) * (
95
+ alpha_in**2 / (2 * (alpha_in**2 - 1))
96
+ + (1 - 2 * pois_ratio_in - 3 / (4 * (alpha_in**2 - 1))) * q
97
+ )
98
+ s_44[idx_in] = (1 / (4 * (1 - pois_ratio_in))) * (
99
+ 1
100
+ - 2 * pois_ratio_in
101
+ - (alpha_in**2 + 1) / (alpha_in**2 - 1)
102
+ - 0.5
103
+ * (1 - 2 * pois_ratio_in - (3 * (alpha_in**2 + 1)) / (alpha_in**2 - 1))
104
+ * q
105
+ )
106
+ s_22[idx_in] = s_11[idx_in]
107
+ s_21[idx_in] = s_12[idx_in]
108
+ s_23[idx_in] = s_13[idx_in]
109
+ s_32[idx_in] = s_31[idx_in]
110
+ s_55[idx_in] = s_44[idx_in]
111
+ if np.any(idx_one):
112
+ s_11[idx_one] = (5 * pois_ratio_one - 1) / (15 * (1 - pois_ratio_one)) + (
113
+ 2 * (4 - 5 * pois_ratio_one)
114
+ ) / (15 * (1 - pois_ratio_one))
115
+ s_12[idx_one] = (5 * pois_ratio_one - 1) / (15 * (1 - pois_ratio_one))
116
+ s_13[idx_one] = (5 * pois_ratio_one - 1) / (15 * (1 - pois_ratio_one))
117
+ s_31[idx_one] = (5 * pois_ratio_one - 1) / (15 * (1 - pois_ratio_one))
118
+ s_44[idx_one] = (4 - 5 * pois_ratio_one) / (15 * (1 - pois_ratio_one))
119
+ s_22[idx_one] = s_11[idx_one]
120
+ s_33[idx_one] = s_11[idx_one]
121
+ s_21[idx_one] = s_12[idx_one]
122
+ s_32[idx_one] = s_31[idx_one]
123
+ s_23[idx_one] = s_13[idx_one]
124
+ s_55[idx_one] = s_44[idx_one]
125
+ s_66[idx_one] = s_44[idx_one]
126
+
127
+ s_r[:, 0, 0] = s_11
128
+ s_r[:, 1, 1] = s_22
129
+ s_r[:, 2, 2] = s_33
130
+ s_r[:, 3, 3] = 2 * s_44
131
+ s_r[:, 4, 4] = 2 * s_55
132
+ s_r[:, 5, 5] = 2 * s_66
133
+ s_r[:, 0, 1] = s_12
134
+ s_r[:, 0, 2] = s_13
135
+ s_r[:, 1, 0] = s_21
136
+ s_r[:, 1, 2] = s_23
137
+ s_r[:, 2, 0] = s_31
138
+ s_r[:, 2, 1] = s_32
139
+
140
+ return array_matrix_mult(-s_r, s_0)
@@ -0,0 +1,60 @@
1
+ import numpy as np
2
+
3
+
4
+ def iso_av_vec(t):
5
+ """Returns a (nx6x6) matrix t_bar averaged over all the orientations (isotropy).
6
+
7
+
8
+ t_bar = np.array([
9
+
10
+ [c11, c12, c12, 0, 0, 0],
11
+
12
+ [c12, c11, c12, 0, 0, 0],
13
+
14
+ [c12, c12, c11, 0, 0, 0],
15
+
16
+ [0, 0, 0, 2 * c44, 0, 0],
17
+
18
+ [0, 0, 0, 0, 2 * c44, 0],
19
+
20
+ [0, 0, 0, 0, 0, 2 * c44]
21
+
22
+ ])
23
+
24
+
25
+ Parameters
26
+ ----------
27
+ t : np.ndarray
28
+ An nx6x6 matrix which has a HTI symmetry.
29
+
30
+
31
+ Returns
32
+ -------
33
+ np.ndarray
34
+ Averaged value.
35
+ """
36
+ t_bar = np.zeros(t.shape)
37
+
38
+ lambda_var = (
39
+ t[:, 0, 0] + t[:, 2, 2] + 5 * t[:, 0, 1] + 8 * t[:, 0, 2] - 2 * t[:, 3, 3]
40
+ ) / 15
41
+ mu = (
42
+ 7 * t[:, 0, 0]
43
+ + 2 * t[:, 2, 2]
44
+ - 5 * t[:, 0, 1]
45
+ - 4 * t[:, 0, 2]
46
+ + 6 * t[:, 3, 3]
47
+ ) / 30
48
+ c11 = lambda_var + 2 * mu
49
+ c12 = lambda_var
50
+ c44 = mu
51
+
52
+ for i in range(3):
53
+ t_bar[:, i, i] = c11
54
+ t_bar[:, i + 3, i + 3] = 2 * c44
55
+ for i in range(2):
56
+ t_bar[:, 0, i + 1] = c12
57
+ t_bar[:, 1, 2 * i] = c12
58
+ t_bar[:, 2, i] = c12
59
+
60
+ return t_bar
@@ -0,0 +1,55 @@
1
+ import numpy as np
2
+
3
+ from .iso_av import iso_av_vec
4
+
5
+
6
+ def iso_av_all_vec(x, case_iso):
7
+ """Returns an multi dimensional matrix with isotropic elements. (nx6x6x(numbers of inclusions) matrix).
8
+ Not used in the present implementation - direct call to iso_av_vec from main function instead
9
+
10
+
11
+ Parameters
12
+ ----------
13
+ x : np.ndarray
14
+ An nx6x6x(numbers of inclusions) matrix.
15
+ case_iso : int
16
+ Control parameter.
17
+
18
+ Returns
19
+ -------
20
+ np.ndarray,
21
+ Isotropic values.
22
+
23
+ Examples
24
+ --------
25
+ caseIso : control parameter
26
+ if caseIso = 0 then all the pore types are isotropic,
27
+ if caseIso = 1 then there is a mix of isotropic and anisotropic pores,
28
+ if caseIso = 2 then all the pore types are anisotropic.
29
+
30
+ Notes
31
+ -----
32
+ HFLE 01.11.2020: Anisotropic inclusions are set to have the same aspect ratio as the isotropic ones.
33
+ """
34
+ if not (x.ndim == 4 and x.shape[1] == x.shape[2]):
35
+ raise ValueError(f"{__name__}: mismatch in inputs variables dimension/shape")
36
+
37
+ no_inclusions = x.shape[3]
38
+ x_iso = np.zeros(x.shape)
39
+
40
+ # if caseIso = 0 then all the pore types are isotropic
41
+ if case_iso == 0:
42
+ for j in range(no_inclusions):
43
+ x_iso[:, :, j] = iso_av_vec(x[:, :, j])
44
+ # if caseIso = 1 then all the pore types are isotropic
45
+ elif case_iso == 1:
46
+ for j in range(no_inclusions):
47
+ x_iso[:, :, j] = iso_av_vec(x[:, :, j])
48
+
49
+ x_iso[:, :, (no_inclusions // 2) : no_inclusions] = x[
50
+ :, :, (no_inclusions // 2) : no_inclusions
51
+ ]
52
+ elif case_iso == 2:
53
+ x_iso = x
54
+
55
+ return x_iso
@@ -0,0 +1,44 @@
1
+ import numpy as np
2
+
3
+ from .array_functions import array_inverse, array_matrix_mult
4
+ from .g_tensor import g_tensor_vec
5
+
6
+
7
+ def pressure_input_utility(k_min, mu_min, log_length):
8
+ """Utility that calculates some of the elastic properties needed for T-Matrix pressure estimation.
9
+
10
+ Parameters
11
+ ----------
12
+ k_min : np.ndarray
13
+ Effective mineral bulk modulus [Pa].
14
+ mu_min : np.ndarray
15
+ Effective mineral shear modulus [Pa].
16
+ log_length : int
17
+ Number of samples in logs.
18
+
19
+ Returns
20
+ -------
21
+ tuple
22
+ c0 (background stiffness), s0 (inverse of background stiffness), gd (G tensor for inclusions with aspect
23
+ ratio 1.0).
24
+ """
25
+ # Calculate elastic parameters
26
+ c11 = k_min + 4 / 3 * mu_min
27
+ c44 = mu_min
28
+ c12 = c11 - 2 * c44
29
+
30
+ i4 = np.tile(np.eye(6).reshape(1, 6, 6), (log_length, 1, 1))
31
+ c0 = np.zeros((log_length, 6, 6))
32
+
33
+ for i in range(3):
34
+ c0[:, i, i] = c11
35
+ c0[:, i + 3, i + 3] = 2 * c44
36
+ for i in range(2):
37
+ c0[:, 0, i + 1] = c12
38
+ c0[:, 1, 2 * i] = c12
39
+ c0[:, 2, i] = c12
40
+
41
+ s0 = array_matrix_mult(i4, array_inverse(c0))
42
+ gd = g_tensor_vec(c0, s0, 1.0)
43
+
44
+ return c0, s0, gd