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,40 @@
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_kd_vec(c0, i4, s_0, alpha):
8
+ """
9
+ kd is a (nx6x6x(number of alphas)) matrix.
10
+
11
+ Parameters
12
+ ----------
13
+ c0 : np.ndarray
14
+ Stiffness tensor of the host material (nx6x6 matrix).
15
+ i4 : np.ndarray
16
+ Array of 6x6 identity matrices.
17
+ s_0: np.ndarray
18
+ Inverse of stiffness tensor.
19
+ alpha : np.ndarray
20
+ Vector of aspect ratios (1x (number of aspect ratios) vector) or nx(number of (number of alphas)).
21
+
22
+ Returns
23
+ -------
24
+ np.ndarray
25
+ kd: stiffness tensor.
26
+ """
27
+ log_length = c0.shape[0]
28
+
29
+ if alpha.ndim == 1 and alpha.shape[0] != c0.shape[0]:
30
+ alpha = np.tile(alpha.reshape(1, alpha.shape[0]), (log_length, 1))
31
+ L = alpha.shape[1]
32
+ kd = np.zeros((log_length, 6, 6, L))
33
+
34
+ for nc in range(L):
35
+ g = g_tensor_vec(c0, s_0, alpha[:, nc])
36
+ kd[:, :, :, nc] = array_matrix_mult(
37
+ array_inverse(i4 + array_matrix_mult(g, c0)), s_0
38
+ )
39
+
40
+ return kd
@@ -0,0 +1,116 @@
1
+ import numpy as np
2
+
3
+ from .array_functions import array_inverse, array_matrix_mult
4
+ from .calc_isolated import calc_isolated_part_vec
5
+ from .g_tensor import g_tensor_vec
6
+
7
+
8
+ def calc_kd_eff_vec(
9
+ c0, s_0, k_fl, alpha_con, alpha_iso, v_con, v_iso, gd, ctrl, frac_ani
10
+ ):
11
+ """Returns the effective dry K-tensor (6x6x(numbers of inclusions) matrix.
12
+ If there is no connected or no isolated pores, the function returns a NaN for
13
+ the case which is not considered. E.g. if only isolated pores, the kd_eff_connected = NaN.
14
+
15
+ Note: When isolated pores, the pores are considered as filled when
16
+ calculating the dry effective K-tensor.
17
+
18
+ Parameters
19
+ ----------
20
+ c0 : np.ndarray
21
+ Stiffness tensor of the host material (nx6x6 matrix).
22
+ s_0 : np.ndarray
23
+ Inverse of the stiffness tensor.
24
+ k_fl : np.ndarray
25
+ Bulk modulus of the fluid (n length vector).
26
+ alpha_con : np.ndarray
27
+ Aspect ratio of connected inclusions.
28
+ alpha_iso : np.ndarray
29
+ Aspect ratio of isolated inclusions.
30
+ v_con : np.ndarray
31
+ Concentration of connected pores.
32
+ v_iso : np.ndarray
33
+ Concentration of isolated pores.
34
+ gd : np.ndarray
35
+ Correlation function (nx6x6 matrix).
36
+ ctrl : int
37
+ 0 :only isolated pores, 1 :both isolated and connected pores, 2 :only connected pores.
38
+ frac_ani : float
39
+ Fraction of anisotropic inclusions.
40
+
41
+ Returns
42
+ -------
43
+ tuple
44
+ kd_eff_isolated, kd_eff_connected: (np.ndarray, np.ndarray).
45
+
46
+ Notes
47
+ -----
48
+ Equations used can be found in:
49
+ Agersborg (2007), phd thesis:
50
+ https://bora.uib.no/handle/1956/2422
51
+
52
+ 09.03.2012
53
+ Remy Agersborg
54
+ email: remy@agersborg.com
55
+
56
+ Translated to Python and vectorised by Harald Flesche, hfle@equinor.com 2020.
57
+ """
58
+ log_len = c0.shape[0]
59
+ c1dry = np.zeros((log_len, 6, 6))
60
+ c2dry = np.zeros((log_len, 6, 6))
61
+
62
+ kd_eff_isolated = None
63
+ kd_eff_connected = None
64
+
65
+ c1_isolated = None
66
+ if ctrl != 2:
67
+ c1_isolated = calc_isolated_part_vec(
68
+ c0, s_0, k_fl, alpha_iso, v_iso, ctrl, frac_ani
69
+ )
70
+ c1dry = c1dry + c1_isolated
71
+ if alpha_iso.ndim == 1 and alpha_iso.shape[0] != c0.shape[0]:
72
+ alpha_iso = np.tile(alpha_iso.reshape(1, alpha_iso.shape[0]), (log_len, 1))
73
+ c2dry = c2dry + array_matrix_mult(c1_isolated, gd, c1_isolated)
74
+ if ctrl != 0:
75
+ c1_connected = calc_isolated_part_vec(
76
+ c0, s_0, np.zeros_like(k_fl), alpha_con, v_con, ctrl, frac_ani
77
+ )
78
+ c1dry = c1dry + c1_connected
79
+ if alpha_con.ndim == 1 and alpha_con.shape[0] != c0.shape[0]:
80
+ alpha_con = np.tile(alpha_con.reshape(1, alpha_con.shape[0]), (log_len, 1))
81
+ c2dry = c2dry + array_matrix_mult(c1_connected, gd, c1_connected)
82
+ if c1_isolated is not None:
83
+ c2dry = (
84
+ c2dry
85
+ + array_matrix_mult(c1_connected, gd, c1_isolated)
86
+ + array_matrix_mult(c1_isolated, gd, c1_connected)
87
+ )
88
+
89
+ i4 = np.tile(np.eye(6).reshape(1, 6, 6), (log_len, 1, 1))
90
+ c_eff_dry = c0 + array_matrix_mult(
91
+ c1dry, array_inverse(i4 + array_matrix_mult(array_inverse(c1dry), c2dry))
92
+ )
93
+ temp = array_matrix_mult(
94
+ i4,
95
+ array_inverse(i4 + array_matrix_mult(array_inverse(c1dry), c2dry)),
96
+ array_inverse(c_eff_dry),
97
+ )
98
+
99
+ # if only connected or mixed connected and isolated
100
+ if ctrl != 0:
101
+ kd_eff_connected = np.zeros((log_len, 6, 6, alpha_con.shape[1]))
102
+ for j in range(alpha_con.shape[1]):
103
+ g = g_tensor_vec(c0, s_0, alpha_con[:, j])
104
+ kd_eff_connected[:, :, :, j] = array_matrix_mult(
105
+ array_inverse(i4 + array_matrix_mult(g, c0)), temp
106
+ )
107
+
108
+ if ctrl != 2:
109
+ kd_eff_isolated = np.zeros((log_len, 6, 6, alpha_iso.shape[1]))
110
+ for j in range(alpha_iso.shape[1]):
111
+ g = g_tensor_vec(c0, s_0, alpha_iso[:, j])
112
+ kd_eff_isolated[:, :, :, j] = array_matrix_mult(
113
+ array_inverse(i4 + array_matrix_mult(g, c0)), temp
114
+ )
115
+
116
+ return kd_eff_isolated, kd_eff_connected
@@ -0,0 +1,18 @@
1
+ import numpy as np
2
+
3
+
4
+ def calc_kd_uuvv_vec(kd):
5
+ """Returns the sum of dry k_uuvv.
6
+
7
+ Parameters
8
+ ----------
9
+ kd : np.ndarray
10
+ The dry K-tensor (n, 6,6,(numbers of inclusions)) matrix.
11
+
12
+ Returns
13
+ -------
14
+ np.ndarray
15
+ Summed elements.
16
+
17
+ """
18
+ return np.sum(kd[:, :3, :3, :], axis=(1, 2))
@@ -0,0 +1,140 @@
1
+ import numpy as np
2
+
3
+ from .calc_kd_eff import calc_kd_eff_vec
4
+
5
+
6
+ def calc_pressure_vec(
7
+ alpha_con,
8
+ alpha_iso,
9
+ v_con,
10
+ v_iso,
11
+ c0,
12
+ s_0,
13
+ gd,
14
+ d_p,
15
+ tau,
16
+ gamma,
17
+ k_fl,
18
+ ctrl,
19
+ frac_ani,
20
+ ):
21
+ """Calculate the effect of depletion on aspect ratios.
22
+
23
+ Parameters
24
+ ----------
25
+ alpha_con : np.ndarray
26
+ Aspect ratio for connected inclusions (r length vector).
27
+ alpha_iso : np.ndarray
28
+ Aspect ratio for connected inclusions (s length vector).
29
+ v_con : np.ndarray
30
+ Volume of connected inclusions (r length vector).
31
+ v_iso : np.ndarray
32
+ Volume of connected inclusions (s length vector).
33
+ c0 : np.ndarray
34
+ Stiffness tensor of host material (nx6x6 array).
35
+ s_0 : np.ndarray
36
+ Inverse of stiffness tensor (nx6x6 array).
37
+ gd : np.ndarray
38
+ The correlation function (green's tensor nx6x6 matrix).
39
+ d_p : float
40
+ Change in effective pressure.
41
+ tau : np.ndarray
42
+ Relaxation time constant ((numbers of connected pores) vector).
43
+ gamma : np.ndarray
44
+ Gamma factor ((numbers of connected pores) vector).
45
+ k_fl : np.ndarray
46
+ Fluid bulk modulus (n length vector).
47
+ ctrl : int
48
+ Control parameter.
49
+ frac_ani : float
50
+ Fraction of anisotropic inclusions.
51
+
52
+ Returns
53
+ -------
54
+ tuple
55
+ alpha_n_connected, v_n_connected, alpha_n_isolated, v_n_isolated, tau_n_out, gamma_n_out -
56
+ modified alphas, volumes, relaxation times and gamma factors.
57
+
58
+ Notes
59
+ -----
60
+ Equations used can be found in:
61
+ Agersborg (2007), phd thesis:
62
+ https://bora.uib.no/handle/1956/2422
63
+
64
+ 09.03.2012
65
+ Remy Agersborg
66
+ email: remy@agersborg.com
67
+
68
+ Translated to Python and vectorised by Harald Flesche, hfle@equinor.com 2020
69
+ """
70
+
71
+ def _new_values(k, sum_k, a, v, d_p, t, g):
72
+ # Local helper function to avoid code duplication
73
+ len_alpha = a.shape[1]
74
+ len_log = k.shape[0]
75
+
76
+ v_new = v * (
77
+ 1
78
+ - (np.sum(k[:, 0:3, 0:3, :], axis=(1, 2)) - sum_k.reshape(len_log, 1)) * d_p
79
+ )
80
+ alpha_new = a * (
81
+ 1
82
+ - (np.sum(k[:, 2, 0:3, :], axis=1) - np.sum(k[:, 0, 0:3, :], axis=1)) * d_p
83
+ )
84
+
85
+ idx_neg = (alpha_new < 0.0) | (v_new < 0.0)
86
+ idx_high = (alpha_new > 1.0) | (v_new > 1.0)
87
+ idx_inval = np.logical_or(idx_neg, idx_high)
88
+
89
+ for i in range(len_alpha):
90
+ # Maybe best to set undefined, but for now keep old values
91
+ # alpha_new[idx_inval] = np.nan
92
+ # v_new[idx_inval] = np.nan
93
+ alpha_new[idx_inval[:, i], i] = a[idx_inval[:, i], i]
94
+ v_new[idx_inval[:, i], i] = v[idx_inval[:, i], i]
95
+ tau_n = np.array(t)
96
+ gamma_n = np.array(g)
97
+
98
+ return v_new, alpha_new, tau_n, gamma_n
99
+
100
+ kd_eff_isolated, kd_eff_connected = calc_kd_eff_vec(
101
+ c0, s_0, k_fl, alpha_con, alpha_iso, v_con, v_iso, gd, ctrl, frac_ani
102
+ )
103
+ # Find the sum in the eq. 21 Jakobsen and Johansen 2005
104
+ sum_kd = 0.0
105
+ if ctrl != 2 and kd_eff_isolated is not None:
106
+ count_isolated = kd_eff_isolated.shape[3]
107
+ for j in range(count_isolated):
108
+ sum_kd = sum_kd + v_iso[:, j] * np.sum(
109
+ kd_eff_isolated[:, 0:3, 0:3, j], axis=(1, 2)
110
+ )
111
+ if ctrl != 0 and kd_eff_connected is not None:
112
+ count_connected = kd_eff_connected.shape[3]
113
+ for j in range(count_connected):
114
+ sum_kd = sum_kd + v_con[:, j] * np.sum(
115
+ kd_eff_connected[:, 0:3, 0:3, j], axis=(1, 2)
116
+ )
117
+ # Find the new concentration of inclusion
118
+ alpha_n_isolated = None
119
+ alpha_n_connected = None
120
+ v_n_isolated = None
121
+ v_n_connected = None
122
+ gamma_n_out = []
123
+ tau_n_out = []
124
+ if ctrl != 2:
125
+ v_n_isolated, alpha_n_isolated, _, _ = _new_values(
126
+ kd_eff_isolated, sum_kd, alpha_iso, v_iso, d_p, tau, gamma
127
+ )
128
+ if ctrl != 0:
129
+ v_n_connected, alpha_n_connected, tau_n_out, gamma_n_out = _new_values(
130
+ kd_eff_connected, sum_kd, alpha_con, v_con, d_p, tau, gamma
131
+ )
132
+
133
+ return (
134
+ alpha_n_connected,
135
+ v_n_connected,
136
+ alpha_n_isolated,
137
+ v_n_isolated,
138
+ tau_n_out,
139
+ gamma_n_out,
140
+ )
@@ -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