gebpy 1.1.3__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 (254) hide show
  1. gebpy/__init__.py +55 -0
  2. gebpy/__pycache__/__init__.cpython-310.pyc +0 -0
  3. gebpy/adapters/__init__.py +0 -0
  4. gebpy/cli/__init__.py +0 -0
  5. gebpy/core/__init__.py +0 -0
  6. gebpy/core/chemistry/__init__.py +0 -0
  7. gebpy/core/chemistry/common.py +1369 -0
  8. gebpy/core/chemistry/elements.py +317 -0
  9. gebpy/core/chemistry/geochemistry.py +1728 -0
  10. gebpy/core/fluids/__init__.py +0 -0
  11. gebpy/core/io/__init__.py +0 -0
  12. gebpy/core/mathematics/__init__.py +0 -0
  13. gebpy/core/minerals/__init__.py +0 -0
  14. gebpy/core/minerals/carbonates.py +412 -0
  15. gebpy/core/minerals/common.py +555 -0
  16. gebpy/core/minerals/config.py +77 -0
  17. gebpy/core/minerals/cyclosilicates.py +0 -0
  18. gebpy/core/minerals/halides.py +0 -0
  19. gebpy/core/minerals/inosilicates.py +0 -0
  20. gebpy/core/minerals/nesosilicates.py +0 -0
  21. gebpy/core/minerals/organics.py +0 -0
  22. gebpy/core/minerals/oxides.py +589 -0
  23. gebpy/core/minerals/phosphates.py +0 -0
  24. gebpy/core/minerals/phospides.py +0 -0
  25. gebpy/core/minerals/phyllosilicates.py +436 -0
  26. gebpy/core/minerals/sorosilicates.py +0 -0
  27. gebpy/core/minerals/sulfates.py +0 -0
  28. gebpy/core/minerals/sulfides.py +459 -0
  29. gebpy/core/minerals/synthesis.py +201 -0
  30. gebpy/core/minerals/tectosilicates.py +433 -0
  31. gebpy/core/physics/__init__.py +0 -0
  32. gebpy/core/physics/common.py +53 -0
  33. gebpy/core/physics/geophysics.py +351 -0
  34. gebpy/core/rocks/__init__.py +0 -0
  35. gebpy/core/rocks/anisotropic_rocks.py +395 -0
  36. gebpy/core/rocks/common.py +95 -0
  37. gebpy/core/rocks/config.py +77 -0
  38. gebpy/core/rocks/isotropic_rocks.py +395 -0
  39. gebpy/core/rocks/sedimentary.py +385 -0
  40. gebpy/core/subsurface/__init__.py +0 -0
  41. gebpy/data_minerals/__init__.py +0 -0
  42. gebpy/data_minerals/albite.yaml +59 -0
  43. gebpy/data_minerals/anatase.yaml +43 -0
  44. gebpy/data_minerals/ankerite.yaml +47 -0
  45. gebpy/data_minerals/annite.yaml +57 -0
  46. gebpy/data_minerals/anorthite.yaml +59 -0
  47. gebpy/data_minerals/antigorite.yaml +53 -0
  48. gebpy/data_minerals/aragonite.yaml +48 -0
  49. gebpy/data_minerals/argutite.yaml +43 -0
  50. gebpy/data_minerals/arsenolite.yaml +40 -0
  51. gebpy/data_minerals/au3oxide.yaml +46 -0
  52. gebpy/data_minerals/avicennite.yaml +40 -0
  53. gebpy/data_minerals/azurite.yaml +53 -0
  54. gebpy/data_minerals/baddeleyite.yaml +49 -0
  55. gebpy/data_minerals/bismite.yaml +49 -0
  56. gebpy/data_minerals/boehmite.yaml +48 -0
  57. gebpy/data_minerals/brookite.yaml +46 -0
  58. gebpy/data_minerals/brucite.yaml +45 -0
  59. gebpy/data_minerals/bunsenite.yaml +40 -0
  60. gebpy/data_minerals/calcite.yaml +45 -0
  61. gebpy/data_minerals/cassiterite.yaml +43 -0
  62. gebpy/data_minerals/cerussite.yaml +48 -0
  63. gebpy/data_minerals/chamosite.yaml +56 -0
  64. gebpy/data_minerals/chlorite.yaml +75 -0
  65. gebpy/data_minerals/chromite.yaml +42 -0
  66. gebpy/data_minerals/chrysotile.yaml +53 -0
  67. gebpy/data_minerals/claudetite.yaml +49 -0
  68. gebpy/data_minerals/clinochlore.yaml +55 -0
  69. gebpy/data_minerals/cochromite.yaml +42 -0
  70. gebpy/data_minerals/corundum.yaml +43 -0
  71. gebpy/data_minerals/crocoite.yaml +51 -0
  72. gebpy/data_minerals/cuprite.yaml +40 -0
  73. gebpy/data_minerals/cuprospinel.yaml +42 -0
  74. gebpy/data_minerals/diaspore.yaml +48 -0
  75. gebpy/data_minerals/dolomite.yaml +47 -0
  76. gebpy/data_minerals/eastonite.yaml +57 -0
  77. gebpy/data_minerals/eskolaite.yaml +43 -0
  78. gebpy/data_minerals/fechlorite.yaml +61 -0
  79. gebpy/data_minerals/fecolumbite.yaml +48 -0
  80. gebpy/data_minerals/ferberite.yaml +51 -0
  81. gebpy/data_minerals/fetantalite.yaml +48 -0
  82. gebpy/data_minerals/franklinite.yaml +42 -0
  83. gebpy/data_minerals/gahnite.yaml +42 -0
  84. gebpy/data_minerals/galaxite.yaml +42 -0
  85. gebpy/data_minerals/geikielite.yaml +45 -0
  86. gebpy/data_minerals/gibbsite.yaml +51 -0
  87. gebpy/data_minerals/glauconite.yaml +69 -0
  88. gebpy/data_minerals/goethite.yaml +48 -0
  89. gebpy/data_minerals/groutite.yaml +48 -0
  90. gebpy/data_minerals/hematite.yaml +43 -0
  91. gebpy/data_minerals/hercynite.yaml +42 -0
  92. gebpy/data_minerals/huebnerite.yaml +51 -0
  93. gebpy/data_minerals/ikaite.yaml +53 -0
  94. gebpy/data_minerals/illite.yaml +55 -0
  95. gebpy/data_minerals/ilmenite.yaml +45 -0
  96. gebpy/data_minerals/jacobsite.yaml +42 -0
  97. gebpy/data_minerals/kalsilite.yaml +47 -0
  98. gebpy/data_minerals/kaolinite.yaml +59 -0
  99. gebpy/data_minerals/karelianite.yaml +43 -0
  100. gebpy/data_minerals/lime.yaml +40 -0
  101. gebpy/data_minerals/litharge.yaml +43 -0
  102. gebpy/data_minerals/magnesiochromite.yaml +42 -0
  103. gebpy/data_minerals/magnesioferrite.yaml +42 -0
  104. gebpy/data_minerals/magnesite.yaml +45 -0
  105. gebpy/data_minerals/magnetite.yaml +41 -0
  106. gebpy/data_minerals/malachite.yaml +53 -0
  107. gebpy/data_minerals/manganite.yaml +51 -0
  108. gebpy/data_minerals/manganochromite.yaml +42 -0
  109. gebpy/data_minerals/manganosite.yaml +40 -0
  110. gebpy/data_minerals/marialite.yaml +49 -0
  111. gebpy/data_minerals/massicot.yaml +46 -0
  112. gebpy/data_minerals/meionite.yaml +49 -0
  113. gebpy/data_minerals/mgchlorite.yaml +61 -0
  114. gebpy/data_minerals/mgcolumbite.yaml +48 -0
  115. gebpy/data_minerals/mgtantalite.yaml +48 -0
  116. gebpy/data_minerals/microcline.yaml +59 -0
  117. gebpy/data_minerals/minium.yaml +44 -0
  118. gebpy/data_minerals/mnchlorite.yaml +61 -0
  119. gebpy/data_minerals/mncolumbite.yaml +48 -0
  120. gebpy/data_minerals/mntantalite.yaml +48 -0
  121. gebpy/data_minerals/monteponite.yaml +40 -0
  122. gebpy/data_minerals/montmorillonite.yaml +77 -0
  123. gebpy/data_minerals/muscovite.yaml +55 -0
  124. gebpy/data_minerals/nanepheline.yaml +47 -0
  125. gebpy/data_minerals/nichlorite.yaml +61 -0
  126. gebpy/data_minerals/nichromite.yaml +42 -0
  127. gebpy/data_minerals/nimite.yaml +55 -0
  128. gebpy/data_minerals/nontronite.yaml +73 -0
  129. gebpy/data_minerals/orthoclase.yaml +53 -0
  130. gebpy/data_minerals/paratellurite.yaml +43 -0
  131. gebpy/data_minerals/pennantite.yaml +61 -0
  132. gebpy/data_minerals/periclase.yaml +40 -0
  133. gebpy/data_minerals/phlogopite.yaml +57 -0
  134. gebpy/data_minerals/plattnerite.yaml +43 -0
  135. gebpy/data_minerals/powellite.yaml +45 -0
  136. gebpy/data_minerals/pyrite.yaml +40 -0
  137. gebpy/data_minerals/pyrolusite.yaml +43 -0
  138. gebpy/data_minerals/pyrophanite.yaml +45 -0
  139. gebpy/data_minerals/pyrophyllite.yaml +59 -0
  140. gebpy/data_minerals/quartz.yaml +43 -0
  141. gebpy/data_minerals/rhodochrosite.yaml +45 -0
  142. gebpy/data_minerals/rutile.yaml +43 -0
  143. gebpy/data_minerals/saponite.yaml +77 -0
  144. gebpy/data_minerals/scheelite.yaml +45 -0
  145. gebpy/data_minerals/scrutinyite.yaml +46 -0
  146. gebpy/data_minerals/senarmontite.yaml +40 -0
  147. gebpy/data_minerals/siderite.yaml +45 -0
  148. gebpy/data_minerals/siderophyllite.yaml +57 -0
  149. gebpy/data_minerals/smithsonite.yaml +45 -0
  150. gebpy/data_minerals/spinel.yaml +42 -0
  151. gebpy/data_minerals/stishovite.yaml +43 -0
  152. gebpy/data_minerals/stolzite.yaml +45 -0
  153. gebpy/data_minerals/talc.yaml +53 -0
  154. gebpy/data_minerals/tistarite.yaml +43 -0
  155. gebpy/data_minerals/trevorite.yaml +42 -0
  156. gebpy/data_minerals/ulvoespinel.yaml +42 -0
  157. gebpy/data_minerals/uraninite.yaml +40 -0
  158. gebpy/data_minerals/valentinite.yaml +46 -0
  159. gebpy/data_minerals/vermiculite.yaml +69 -0
  160. gebpy/data_minerals/wulfenite.yaml +45 -0
  161. gebpy/data_minerals/wustite.yaml +40 -0
  162. gebpy/data_minerals/zincite.yaml +43 -0
  163. gebpy/data_minerals/zincochromite.yaml +42 -0
  164. gebpy/data_rocks/__init__.py +0 -0
  165. gebpy/data_rocks/dolostone.yaml +40 -0
  166. gebpy/data_rocks/limestone.yaml +40 -0
  167. gebpy/data_rocks/marl.yaml +50 -0
  168. gebpy/data_rocks/sandstone.yaml +39 -0
  169. gebpy/data_rocks/shale.yaml +50 -0
  170. gebpy/gebpy_app.py +8732 -0
  171. gebpy/gui/__init__.py +0 -0
  172. gebpy/lib/images/GebPy_Header.png +0 -0
  173. gebpy/lib/images/GebPy_Icon.png +0 -0
  174. gebpy/lib/images/GebPy_Logo.png +0 -0
  175. gebpy/main.py +29 -0
  176. gebpy/modules/__init__.py +0 -0
  177. gebpy/modules/__pycache__/__init__.cpython-310.pyc +0 -0
  178. gebpy/modules/__pycache__/metamorphics.cpython-310.pyc +0 -0
  179. gebpy/modules/__pycache__/silicates.cpython-310.pyc +0 -0
  180. gebpy/modules/carbonates.py +2658 -0
  181. gebpy/modules/chemistry.py +1369 -0
  182. gebpy/modules/core.py +1805 -0
  183. gebpy/modules/elements.py +317 -0
  184. gebpy/modules/evaporites.py +1299 -0
  185. gebpy/modules/exploration.py +1145 -0
  186. gebpy/modules/fluids.py +339 -0
  187. gebpy/modules/geochemistry.py +1727 -0
  188. gebpy/modules/geophysics.py +351 -0
  189. gebpy/modules/gui.py +9093 -0
  190. gebpy/modules/gui_elements.py +145 -0
  191. gebpy/modules/halides.py +485 -0
  192. gebpy/modules/igneous.py +2241 -0
  193. gebpy/modules/metamorphics.py +3222 -0
  194. gebpy/modules/mineralogy.py +442 -0
  195. gebpy/modules/minerals.py +7954 -0
  196. gebpy/modules/ore.py +1648 -0
  197. gebpy/modules/organics.py +530 -0
  198. gebpy/modules/oxides.py +9057 -0
  199. gebpy/modules/petrophysics.py +98 -0
  200. gebpy/modules/phosphates.py +589 -0
  201. gebpy/modules/phospides.py +194 -0
  202. gebpy/modules/plotting.py +619 -0
  203. gebpy/modules/pyllosilicates.py +380 -0
  204. gebpy/modules/sedimentary_rocks.py +908 -0
  205. gebpy/modules/sequences.py +2166 -0
  206. gebpy/modules/series.py +1625 -0
  207. gebpy/modules/silicates.py +11102 -0
  208. gebpy/modules/siliciclastics.py +1846 -0
  209. gebpy/modules/subsurface_2d.py +179 -0
  210. gebpy/modules/sulfates.py +1629 -0
  211. gebpy/modules/sulfides.py +4786 -0
  212. gebpy/plotting/__init__.py +0 -0
  213. gebpy/ui_nb/__init__.py +0 -0
  214. gebpy/user_data/.gitkeep +0 -0
  215. gebpy-1.1.3.dist-info/LICENSE +165 -0
  216. gebpy-1.1.3.dist-info/METADATA +207 -0
  217. gebpy-1.1.3.dist-info/RECORD +254 -0
  218. gebpy-1.1.3.dist-info/WHEEL +5 -0
  219. gebpy-1.1.3.dist-info/entry_points.txt +2 -0
  220. gebpy-1.1.3.dist-info/top_level.txt +1 -0
  221. modules/__init__.py +0 -0
  222. modules/carbonates.py +2658 -0
  223. modules/chemistry.py +1369 -0
  224. modules/core.py +1805 -0
  225. modules/elements.py +317 -0
  226. modules/evaporites.py +1299 -0
  227. modules/exploration.py +765 -0
  228. modules/fluids.py +339 -0
  229. modules/geochemistry.py +1727 -0
  230. modules/geophysics.py +337 -0
  231. modules/gui.py +9093 -0
  232. modules/gui_elements.py +145 -0
  233. modules/halides.py +485 -0
  234. modules/igneous.py +2196 -0
  235. modules/metamorphics.py +2699 -0
  236. modules/mineralogy.py +442 -0
  237. modules/minerals.py +7954 -0
  238. modules/ore.py +1628 -0
  239. modules/organics.py +530 -0
  240. modules/oxides.py +9057 -0
  241. modules/petrophysics.py +98 -0
  242. modules/phosphates.py +589 -0
  243. modules/phospides.py +194 -0
  244. modules/plotting.py +619 -0
  245. modules/pyllosilicates.py +380 -0
  246. modules/sedimentary_rocks.py +908 -0
  247. modules/sequences.py +2166 -0
  248. modules/series.py +1625 -0
  249. modules/silicates.py +11102 -0
  250. modules/siliciclastics.py +1830 -0
  251. modules/subsurface_2d.py +179 -0
  252. modules/sulfates.py +1629 -0
  253. modules/sulfides.py +4786 -0
  254. notebooks/__init__.py +0 -0
@@ -0,0 +1,1830 @@
1
+ #!/usr/bin/env python
2
+ # -*-coding: utf-8 -*-
3
+
4
+ #-----------------------------------------------
5
+
6
+ # Name: siliciclastics.py
7
+ # Author: Maximilian A. Beeskow
8
+ # Version: 1.0
9
+ # Date: 10.12.2024
10
+
11
+ #-----------------------------------------------
12
+
13
+ ## MODULES
14
+ import datetime
15
+ import sys
16
+
17
+ import numpy as np
18
+ from numpy import round
19
+ from random import *
20
+ import random as rd
21
+ from modules import minerals, oxides, fluids
22
+ from modules.geophysics import Elasticity as elast
23
+ from modules import oxides, carbonates, silicates
24
+ from modules.chemistry import PeriodicSystem, OxideCompounds
25
+ from modules.oxides import Oxides
26
+ from modules.carbonates import Carbonates
27
+ from modules.silicates import Phyllosilicates
28
+ from modules.silicates import Tectosilicates
29
+ from modules.sulfides import Sulfides
30
+ from modules.organics import Organics
31
+ from modules.phosphates import Phosphates
32
+ from modules.fluids import Water, Hydrocarbons
33
+ from modules.petrophysics import SeismicVelocities
34
+
35
+ class Geophysics:
36
+ #
37
+ def __init__(self, var_data):
38
+ self.var_data = var_data
39
+ #
40
+ def calculate_seismic_velocity(self):
41
+ results = {"vP": 0, "vS": 0}
42
+ var_porosity = self.var_data["porosity"]
43
+ #
44
+ for var_type in results.keys():
45
+ inv_v = 0
46
+ for key, velocity in self.var_data["v"].items():
47
+ fraction = self.var_data["Phi"][key]
48
+ inv_v += fraction/velocity[var_type]
49
+ #inv_v += fraction/(velocity[var_type]**(1 - var_porosity))
50
+ #inv_v += ((1 - var_porosity)*fraction)/velocity[var_type]
51
+ results[var_type] = round((1/inv_v)**(1 - var_porosity), 3)
52
+ #results[var_type] = round((1/inv_v), 3)
53
+ #
54
+ return results
55
+
56
+ class Soil:
57
+ #
58
+ def __init__(self):
59
+ pass
60
+ #
61
+ def create_simple_soil(self, w_C=None, amounts=None, grainsize_list=False):
62
+ self.w_C = w_C
63
+ self.amounts = amounts
64
+ #
65
+ # [chemical formula, molar mass, density, bulk modulus, shear modulus, vP, vS]
66
+ quartz = minerals.oxides.quartz("")
67
+ illite = minerals.phyllosilicates.illite("")
68
+ kaolinite = minerals.phyllosilicates.kaolinite("")
69
+ organic = minerals.natives.organic_matter("")
70
+ #
71
+ mineralogy = [quartz, illite, kaolinite, organic]
72
+ #
73
+ # [molar mass, density, bulk modulus, vP]
74
+ water = fluids.Water.water("")
75
+ air = fluids.Gas.air("")
76
+ #
77
+ data = []
78
+ #
79
+ cond = False
80
+ composition = []
81
+ while cond == False:
82
+ if self.w_C == None and self.amounts == None:
83
+ w_org = 0.05
84
+ w_qz = round(abs(rd.uniform(0.5, 0.95)), 4)
85
+ w_ilt = round(abs(rd.uniform(0.0, (1-w_org-w_qz))), 4)
86
+ w_kln = round(abs(1-w_qz-w_ilt-w_org), 4)
87
+ elif self.w_C != None:
88
+ w_org = round(self.w_C, 4)
89
+ w_mineral = round(1-w_org, 4)
90
+ w_qz = round(abs(w_mineral*rd.uniform(0.25, 1)), 4)
91
+ w_ilt = round(abs(w_mineral*rd.uniform(0, (1-w_qz))), 4)
92
+ w_kln = round(abs(w_mineral*(1-w_qz-w_ilt)), 4)
93
+ elif type(self.amounts) is list:
94
+ w_qz = round(abs(np.random.normal(self.amounts[0], 0.025)), 4)
95
+ w_ilt = round(abs(np.random.normal(self.amounts[1], 0.025)), 4)
96
+ w_kln = round(abs(np.random.normal(self.amounts[2], 0.025)), 4)
97
+ w_org = round(1-w_qz-w_ilt-w_kln, 4)
98
+ #
99
+ if 0.0 <= w_qz <= 1.0 and 0.0 <= w_ilt <= 1.0 and 0.0 <= w_kln <= 1.0 and 0.0 <= w_org <= 1.0:
100
+ sumMin = round(w_qz + w_ilt + w_kln + w_org, 4)
101
+ else:
102
+ sumMin = 0
103
+ #
104
+ w_H = round(w_ilt*illite[6][0] + w_kln*kaolinite[6][0], 4)
105
+ w_C = round(w_org, 4)
106
+ w_O = round(w_qz*quartz[6][0] + w_ilt*illite[6][1] + w_kln*kaolinite[6][1], 4)
107
+ w_Mg = round(w_ilt*illite[6][2], 4)
108
+ w_Al = round(w_ilt*illite[6][3] + w_kln*kaolinite[6][2], 4)
109
+ w_Si = round(w_qz*quartz[6][1] + w_ilt*illite[6][4] + w_kln*kaolinite[6][3], 4)
110
+ w_K = round(w_ilt*illite[6][5], 4)
111
+ w_Fe = round(w_ilt*illite[6][6], 4)
112
+ sumConc = w_H + w_C + w_O + w_Mg + w_Al + w_Si + w_K + w_Fe
113
+ #
114
+ if sumMin == 1 and sumConc == 1:
115
+ cond = True
116
+ composition.extend((["Qz", "Ilt", "Kln", "Org"]))
117
+ concentrations = [w_H, w_C, w_O, w_Mg, w_Al, w_Si, w_K, w_Fe]
118
+ amounts = [w_qz, w_ilt, w_kln, w_org]
119
+ else:
120
+ cond = False
121
+ #
122
+ grainsize = []
123
+ n_Grains = 100
124
+ if w_qz > 0:
125
+ grainsize.append([rd.randint(2, 2000) for i in range(int(round(w_qz*n_Grains, 0)))])
126
+ if w_ilt > 0:
127
+ grainsize.append(list(np.around([rd.uniform(1, 2) for i in range(int(round(w_ilt*n_Grains, 0)))], 2)))
128
+ if w_kln > 0:
129
+ grainsize.append(list(np.around([rd.uniform(1, 2) for i in range(int(round(w_kln*n_Grains, 0)))], 2)))
130
+ if w_org > 0:
131
+ grainsize.append([rd.randint(2, 63) for i in range(int(round(w_org*n_Grains, 0)))])
132
+ #
133
+ rhoSolid = (w_qz*quartz[2] + w_ilt*illite[2] + w_kln*kaolinite[2] + w_org*organic[2])/1000
134
+ X = [w_qz, w_ilt, w_kln, w_org]
135
+ K_list = [mineralogy[i][3][0] for i in range(len(mineralogy))]
136
+ G_list = [mineralogy[i][3][1] for i in range(len(mineralogy))]
137
+ K_geo = elast.calc_geometric_mean(self, X, K_list)
138
+ G_geo = elast.calc_geometric_mean(self, X, G_list)
139
+ K_solid = K_geo
140
+ G_solid = G_geo
141
+ #vP_solid = np.sqrt((K_solid*10**9+4/3*G_solid*10**9)/(rhoSolid*10**3))
142
+ #vS_solid = np.sqrt((G_solid*10**9)/(rhoSolid*10**3))
143
+ vP_solid = w_qz*quartz[4][0] + w_ilt*illite[4][0] + w_kln*kaolinite[4][0] + w_org*organic[4][0]
144
+ vS_solid = w_qz*quartz[4][1] + w_ilt*illite[4][1] + w_kln*kaolinite[4][1] + w_org*organic[4][1]
145
+ E_solid = (9*K_solid*G_solid)/(3*K_solid+G_solid)
146
+ nu_solid = (3*K_solid-2*G_solid)/(2*(3*K_solid+G_solid))
147
+ #
148
+ phi = rd.uniform(0.5, 0.65)
149
+ #
150
+ rho = (1 - phi) * rhoSolid + phi * (0.5*water[2]+0.5*air[2]/1000) / 1000
151
+ vP = ((1-phi)*vP_solid + phi*(0.5*water[4][0] + 0.5*air[4][0]))/3
152
+ vS = ((1 - phi) * vS_solid)/3
153
+ G_bulk = vS**2 * rho
154
+ K_bulk = vP**2 * rho - 4/3*G_bulk
155
+ E_bulk = (9*K_bulk*G_bulk)/(3*K_bulk+G_bulk)
156
+ phiD = (rhoSolid - rho) / (rhoSolid - (0.5*water[2]+0.5*air[2]/1000) / 1000)
157
+ phiN = (2 * phi ** 2 - phiD ** 2) ** (0.5)
158
+ GR = w_qz*quartz[5][0] + w_ilt*illite[5][0] + w_kln*kaolinite[5][0] + w_org*organic[5][0]
159
+ PE = w_qz*quartz[5][1] + w_ilt*illite[5][1] + w_kln*kaolinite[5][1] + w_org*organic[5][1]
160
+ poisson_seismic = 0.5*(vP**2 - 2*vS**2)/(vP**2 - vS**2)
161
+ poisson_elastic = (3*K_bulk - 2*G_bulk)/(6*K_bulk + 2*G_bulk)
162
+ poisson_mineralogical = w_qz*quartz[3][3] + w_ilt*illite[3][3] + w_kln*kaolinite[3][3] + w_org*organic[3][3]
163
+ #
164
+ data.append(composition)
165
+ data.append([round(rho, 3), round(rhoSolid, 3), round(water[2] / 1000, 6), round(air[2]/1000, 3)])
166
+ data.append([round(K_bulk*10**(-6), 2), round(G_bulk*10**(-6), 2), round(E_bulk*10**(-6), 2), round(poisson_mineralogical, 3)])
167
+ data.append([round(vP, 2), round(vS, 2), round(vP_solid, 2), round(water[4][0], 2), round(air[4][0], 2)])
168
+ data.append([round(phi, 3), round(phiD, 3), round(phiN, 3)])
169
+ data.append(["water", "air"])
170
+ data.append([round(GR, 3), round(PE, 3)])
171
+ data.append(concentrations)
172
+ data.append(amounts)
173
+ if grainsize_list == True:
174
+ data.append(grainsize)
175
+ #
176
+ return data
177
+ #
178
+ def create_simple_sand(self, w_C=None, amounts=None, grainsize_list=False):
179
+ self.w_C = w_C
180
+ self.amounts = amounts
181
+ #
182
+ # [chemical formula, molar mass, density, bulk modulus, shear modulus, vP, vS]
183
+ quartz = minerals.oxides.quartz("")
184
+ illite = minerals.phyllosilicates.illite("")
185
+ kaolinite = minerals.phyllosilicates.kaolinite("")
186
+ organic = minerals.natives.organic_matter("")
187
+ #
188
+ mineralogy = [quartz, illite, kaolinite, organic]
189
+ #
190
+ # [molar mass, density, bulk modulus, vP]
191
+ water = fluids.Water.water("")
192
+ air = fluids.Gas.air("")
193
+ #
194
+ data = []
195
+ #
196
+ cond = False
197
+ composition = []
198
+ while cond == False:
199
+ if self.w_C == None and self.amounts == None:
200
+ w_org = 0.025
201
+ w_qz = round(abs(rd.uniform(0.85, 0.975)), 4)
202
+ w_ilt = round(abs(rd.uniform(0.0, (1-w_org-w_qz))), 4)
203
+ w_kln = round(abs(1-w_qz-w_ilt-w_org), 4)
204
+ elif self.w_C != None:
205
+ w_org = round(self.w_C, 4)
206
+ w_mineral = round(1-w_org, 4)
207
+ w_qz = round(abs(w_mineral*rd.uniform(0.25, 1)), 4)
208
+ w_ilt = round(abs(w_mineral*rd.uniform(0, (1-w_qz))), 4)
209
+ w_kln = round(abs(w_mineral*(1-w_qz-w_ilt)), 4)
210
+ elif type(self.amounts) is list:
211
+ w_qz = round(abs(np.random.normal(self.amounts[0], 0.025)), 4)
212
+ w_ilt = round(abs(np.random.normal(self.amounts[1], 0.025)), 4)
213
+ w_kln = round(abs(np.random.normal(self.amounts[2], 0.025)), 4)
214
+ w_org = round(1-w_qz-w_ilt-w_kln, 4)
215
+ #
216
+ if 0.0 <= w_qz <= 1.0 and 0.0 <= w_ilt <= 1.0 and 0.0 <= w_kln <= 1.0 and 0.0 <= w_org <= 1.0:
217
+ sumMin = round(w_qz + w_ilt + w_kln + w_org, 4)
218
+ else:
219
+ sumMin = 0
220
+ #
221
+ w_H = round(w_ilt*illite[6][0] + w_kln*kaolinite[6][0], 4)
222
+ w_C = round(w_org, 4)
223
+ w_O = round(w_qz*quartz[6][0] + w_ilt*illite[6][1] + w_kln*kaolinite[6][1], 4)
224
+ w_Mg = round(w_ilt*illite[6][2], 4)
225
+ w_Al = round(w_ilt*illite[6][3] + w_kln*kaolinite[6][2], 4)
226
+ w_Si = round(w_qz*quartz[6][1] + w_ilt*illite[6][4] + w_kln*kaolinite[6][3], 4)
227
+ w_K = round(w_ilt*illite[6][5], 4)
228
+ w_Fe = round(w_ilt*illite[6][6], 4)
229
+ sumConc = w_H + w_C + w_O + w_Mg + w_Al + w_Si + w_K + w_Fe
230
+ #
231
+ if sumMin == 1 and sumConc == 1:
232
+ cond = True
233
+ composition.extend((["Qz", "Ilt", "Kln", "Org"]))
234
+ concentrations = [w_H, w_C, w_O, w_Mg, w_Al, w_Si, w_K, w_Fe]
235
+ amounts = [w_qz, w_ilt, w_kln, w_org]
236
+ else:
237
+ cond = False
238
+ #
239
+ grainsize = []
240
+ n_Grains = 100
241
+ if w_qz > 0:
242
+ grainsize.append([rd.randint(2, 2000) for i in range(int(round(w_qz*n_Grains, 0)))])
243
+ if w_ilt > 0:
244
+ grainsize.append(list(np.around([rd.uniform(1, 2) for i in range(int(round(w_ilt*n_Grains, 0)))], 2)))
245
+ if w_kln > 0:
246
+ grainsize.append(list(np.around([rd.uniform(1, 2) for i in range(int(round(w_kln*n_Grains, 0)))], 2)))
247
+ if w_org > 0:
248
+ grainsize.append([rd.randint(2, 63) for i in range(int(round(w_org*n_Grains, 0)))])
249
+ #
250
+ rhoSolid = (w_qz*quartz[2] + w_ilt*illite[2] + w_kln*kaolinite[2] + w_org*organic[2])/1000
251
+ X = [w_qz, w_ilt, w_kln, w_org]
252
+ K_list = [mineralogy[i][3][0] for i in range(len(mineralogy))]
253
+ G_list = [mineralogy[i][3][1] for i in range(len(mineralogy))]
254
+ K_geo = elast.calc_geometric_mean(self, X, K_list)
255
+ G_geo = elast.calc_geometric_mean(self, X, G_list)
256
+ K_solid = K_geo
257
+ G_solid = G_geo
258
+ #vP_solid = np.sqrt((K_solid*10**9+4/3*G_solid*10**9)/(rhoSolid*10**3))
259
+ #vS_solid = np.sqrt((G_solid*10**9)/(rhoSolid*10**3))
260
+ vP_solid = w_qz*quartz[4][0] + w_ilt*illite[4][0] + w_kln*kaolinite[4][0] + w_org*organic[4][0]
261
+ vS_solid = w_qz*quartz[4][1] + w_ilt*illite[4][1] + w_kln*kaolinite[4][1] + w_org*organic[4][1]
262
+ E_solid = (9*K_solid*G_solid)/(3*K_solid+G_solid)
263
+ nu_solid = (3*K_solid-2*G_solid)/(2*(3*K_solid+G_solid))
264
+ #
265
+ phi = rd.uniform(0.45, 0.55)
266
+ #
267
+ rho = (1 - phi) * rhoSolid + phi * water[2] / 1000
268
+ vP = ((1-phi)*vP_solid + phi*water[4][0])/3
269
+ vS = ((1 - phi) * vS_solid)/3
270
+ G_bulk = vS**2 * rho
271
+ K_bulk = vP**2 * rho - 4/3*G_bulk
272
+ E_bulk = (9*K_bulk*G_bulk)/(3*K_bulk+G_bulk)
273
+ phiD = (rhoSolid - rho) / (rhoSolid - water[2]/1000)
274
+ phiN = (2 * phi ** 2 - phiD ** 2) ** (0.5)
275
+ GR = w_qz*quartz[5][0] + w_ilt*illite[5][0] + w_kln*kaolinite[5][0] + w_org*organic[5][0]
276
+ PE = w_qz*quartz[5][1] + w_ilt*illite[5][1] + w_kln*kaolinite[5][1] + w_org*organic[5][1]
277
+ poisson_seismic = 0.5*(vP**2 - 2*vS**2)/(vP**2 - vS**2)
278
+ poisson_elastic = (3*K_bulk - 2*G_bulk)/(6*K_bulk + 2*G_bulk)
279
+ poisson_mineralogical = w_qz*quartz[3][3] + w_ilt*illite[3][3] + w_kln*kaolinite[3][3] + w_org*organic[3][3]
280
+ #
281
+ data.append(composition)
282
+ data.append([round(rho, 3), round(rhoSolid, 3), round(water[2] / 1000, 6)])
283
+ data.append([round(K_bulk*10**(-6), 2), round(G_bulk*10**(-6), 2), round(E_bulk*10**(-6), 2), round(poisson_mineralogical, 3)])
284
+ data.append([round(vP, 2), round(vS, 2), round(vP_solid, 2), round(water[4][0], 2)])
285
+ data.append([round(phi, 3), round(phiD, 3), round(phiN, 3)])
286
+ data.append("water")
287
+ data.append([round(GR, 3), round(PE, 3)])
288
+ data.append(concentrations)
289
+ data.append(amounts)
290
+ if grainsize_list == True:
291
+ data.append(grainsize)
292
+ #
293
+ return data
294
+
295
+ #########################
296
+ ## SILICICLASTIC ROCKS ##
297
+ #########################
298
+ class SiliciclasticRocks:
299
+ #
300
+ def __init__(self, fluid="water", actualThickness=100):
301
+ self.fluid = fluid
302
+ self.actualThickness = actualThickness
303
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
304
+ self.data_calcite = Carbonates(impurity="pure", data_type=True).create_calcite()
305
+ self.data_hematite = Oxides(impurity="pure", data_type=True).create_hematite()
306
+ self.data_pyrite = Sulfides(impurity="pure", data_type=True).create_pyrite()
307
+ self.data_uraninite = Oxides(impurity="pure", data_type=True).create_uraninite()
308
+ self.data_kaolinite = Phyllosilicates(impurity="pure", data_type=True).create_kaolinite()
309
+ #
310
+ self.data_water = Water.water("")
311
+ self.data_oil = Hydrocarbons.oil("")
312
+ self.data_gas = Hydrocarbons.natural_gas("")
313
+ #
314
+ def create_sandstone(self, rock="Sandstone", number=1, composition=None, classification="Sandstone", porosity=None):
315
+ results_container = {}
316
+ results_container["rock"] = rock
317
+ results_container["mineralogy"] = {}
318
+ results_container["chemistry"] = {}
319
+ results_container["compounds"] = {}
320
+ results_container["phi"] = []
321
+ results_container["phi_true"] = []
322
+ results_container["fluid"] = self.fluid
323
+ results_container["rho_s"] = []
324
+ results_container["rho"] = []
325
+ results_container["vP"] = []
326
+ results_container["vS"] = []
327
+ results_container["vP/vS"] = []
328
+ results_container["K"] = []
329
+ results_container["G"] = []
330
+ results_container["E"] = []
331
+ results_container["nu"] = []
332
+ results_container["GR"] = []
333
+ results_container["PE"] = []
334
+
335
+ n = 0
336
+ while n < number:
337
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
338
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
339
+ mineralogy = {"Qz": self.data_quartz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
340
+ "Kln": self.data_kaolinite, "Hem": self.data_hematite}
341
+ minerals_list = list(mineralogy.keys())
342
+
343
+ if minerals_list[0] not in results_container["mineralogy"]:
344
+ for mineral in minerals_list:
345
+ results_container["mineralogy"][mineral] = []
346
+
347
+ condition = False
348
+ while condition == False:
349
+ elements_list = []
350
+ phi_minerals = {}
351
+ w_minerals = {}
352
+ w_elements = {}
353
+
354
+ if composition != None:
355
+ phi_qz = composition["Qz"]
356
+ phi_kfs = composition["Kfs"]
357
+ phi_pl = composition["Pl"]
358
+ phi_kln = composition["Kln"]
359
+ phi_hem = composition["Hem"]
360
+
361
+ phi_minerals["Qz"] = phi_qz
362
+ phi_minerals["Kfs"] = phi_kfs
363
+ phi_minerals["Pl"] = phi_pl
364
+ phi_minerals["Kln"] = phi_kln
365
+ phi_minerals["Hem"] = phi_hem
366
+
367
+ else:
368
+ condition_2 = False
369
+ while condition_2 == False:
370
+ if classification == "Sandstone":
371
+ qz_limits = [0.7, 1.0]
372
+ kfs_limits = [0.0, 0.25]
373
+ pl_limits = [0.0, 0.25]
374
+ kln_limits = [0.0, 0.25]
375
+ hem_limits = [0.0, 0.05]
376
+
377
+ phi_qz = round(rd.uniform(qz_limits[0], qz_limits[1]), 4)
378
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1 - phi_qz)), 4)
379
+ phi_pl = round(rd.uniform(pl_limits[0], (1 - phi_qz - phi_kfs)), 4)
380
+ phi_kln = round(rd.uniform(kln_limits[0], (1 - phi_qz - phi_kfs - phi_pl)), 4)
381
+ phi_hem = round(1 - phi_qz - phi_kfs - phi_pl - phi_kln, 4)
382
+
383
+ phi_total = phi_qz + phi_kfs + phi_pl + phi_kln + phi_hem
384
+
385
+ if np.isclose(phi_total, 1.0000) == True:
386
+ if qz_limits[0] <= phi_qz <= qz_limits[1] \
387
+ and kfs_limits[0] <= phi_kfs <= kfs_limits[1] \
388
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
389
+ and kln_limits[0] <= phi_kln <= kln_limits[1] \
390
+ and hem_limits[0] <= phi_hem <= hem_limits[1]:
391
+ condition_2 = True
392
+
393
+ phi_minerals["Qz"] = phi_qz
394
+ phi_minerals["Kfs"] = phi_kfs
395
+ phi_minerals["Pl"] = phi_pl
396
+ phi_minerals["Kln"] = phi_kln
397
+ phi_minerals["Hem"] = phi_hem
398
+
399
+ rho_s = 0
400
+ for key, value in phi_minerals.items():
401
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
402
+ for element, value in mineralogy[key]["chemistry"].items():
403
+ if element not in elements_list:
404
+ elements_list.append(element)
405
+ w_elements[element] = 0.0
406
+
407
+ if elements_list[0] not in results_container["chemistry"]:
408
+ for element in elements_list:
409
+ results_container["chemistry"][element] = []
410
+
411
+ rho_s = round(rho_s, 3)
412
+ for key, value in phi_minerals.items():
413
+ if key == "Urn":
414
+ n_digits = 4
415
+ else:
416
+ n_digits = 4
417
+
418
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
419
+
420
+ if self.fluid == "water":
421
+ data_fluid = self.data_water
422
+
423
+ old_index = elements_list.index("O")
424
+ elements_list += [elements_list.pop(old_index)]
425
+
426
+ w_elements_total = 0.0
427
+ for element in elements_list:
428
+ if element != "O":
429
+ for mineral, w_mineral in w_minerals.items():
430
+ if element in mineralogy[mineral]["chemistry"]:
431
+ if element == "U":
432
+ n_digits = 4
433
+ else:
434
+ n_digits = 4
435
+
436
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
437
+ w_elements[element] += value
438
+ w_elements_total += value
439
+ w_elements[element] = round(w_elements[element], n_digits)
440
+ elif element == "O":
441
+ w_elements[element] += round(1 - w_elements_total, 4)
442
+ w_elements[element] = round(w_elements[element], 4)
443
+
444
+ total_w_minerals = round(sum(w_minerals.values()), 4)
445
+ total_w_elements = round(sum(w_elements.values()), 4)
446
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
447
+ for key, value in w_minerals.items():
448
+ w_minerals[key] = abs(value)
449
+ for key, value in w_elements.items():
450
+ w_elements[key] = abs(value)
451
+ condition = True
452
+
453
+ velocity_solid = {"vP": 0, "vS": 0}
454
+ gamma_ray = 0.0
455
+ photoelectricity = 0.0
456
+ for key, value in phi_minerals.items():
457
+ velocity_solid["vP"] += phi_minerals[key]*mineralogy[key]["vP"]
458
+ velocity_solid["vS"] += phi_minerals[key]*mineralogy[key]["vS"]
459
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
460
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
461
+
462
+ ## Bulk Density, Porosity, Seismic Velocities
463
+ rho_solid = round(rho_s, 3)
464
+ vP, vS, vPvS, rho, var_porosity = SeismicVelocities(
465
+ rho_solid=rho_solid, rho_fluid=self.data_water[2]).calculate_seismic_velocities(
466
+ rho_limits=[1800, 2800], vP_limits=[2800, 4800], vS_limits=[1500, 2500], delta=0.05,
467
+ porosity=porosity)
468
+ phi_neutron = round((1900/rho)*0.15, 4)
469
+ ## Elastic Parameters
470
+ bulk_modulus, shear_modulus, youngs_modulus, poisson_ratio = SeismicVelocities(
471
+ rho_solid=None, rho_fluid=None).calculate_elastic_properties(
472
+ rho=rho, vP=vP, vS=vS)
473
+ ## Gamma Ray
474
+ gamma_ray = round(gamma_ray, 3)
475
+ ## Photoelectricity
476
+ photoelectricity = round(photoelectricity, 3)
477
+ # Composition data
478
+ for key, value in w_minerals.items():
479
+ results_container["mineralogy"][key].append(value)
480
+
481
+ amounts = []
482
+ for key, value in w_elements.items():
483
+ results_container["chemistry"][key].append(value)
484
+ chem_data = PeriodicSystem(name=key).get_data()
485
+ amounts.append([key, chem_data[1], value])
486
+
487
+ list_oxides = ["H2O", "Na2O", "Al2O3", "SiO2", "K2O", "CaO", "Fe2O3"]
488
+ composition_oxides = {}
489
+ for var_oxide in list_oxides:
490
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
491
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
492
+
493
+ if list_oxides[0] not in results_container["compounds"]:
494
+ for oxide in list_oxides:
495
+ results_container["compounds"][oxide] = []
496
+
497
+ for key, value in composition_oxides.items():
498
+ results_container["compounds"][key].append(value)
499
+
500
+ results_container["mineralogy"] = dict(sorted(
501
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
502
+ results_container["chemistry"] = dict(sorted(
503
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
504
+ results_container["compounds"] = dict(sorted(
505
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
506
+
507
+ # Results
508
+ results_container["phi"].append(phi_neutron)
509
+ results_container["phi_true"].append(var_porosity)
510
+ results_container["rho_s"].append(rho_s)
511
+ results_container["rho"].append(rho)
512
+ results_container["vP"].append(vP)
513
+ results_container["vS"].append(vS)
514
+ results_container["vP/vS"].append(vPvS)
515
+ results_container["K"].append(bulk_modulus)
516
+ results_container["G"].append(shear_modulus)
517
+ results_container["E"].append(youngs_modulus)
518
+ results_container["nu"].append(poisson_ratio)
519
+ results_container["GR"].append(gamma_ray)
520
+ results_container["PE"].append(photoelectricity)
521
+ n += 1
522
+
523
+ return results_container
524
+
525
+ def create_siltstone(self, rock="Siltstone", number=1, composition=None, classification="Siltstone", porosity=None):
526
+ results_container = {}
527
+ results_container["rock"] = rock
528
+ results_container["mineralogy"] = {}
529
+ results_container["chemistry"] = {}
530
+ results_container["compounds"] = {}
531
+ results_container["phi"] = []
532
+ results_container["phi_true"] = []
533
+ results_container["fluid"] = self.fluid
534
+ results_container["rho_s"] = []
535
+ results_container["rho"] = []
536
+ results_container["vP"] = []
537
+ results_container["vS"] = []
538
+ results_container["vP/vS"] = []
539
+ results_container["K"] = []
540
+ results_container["G"] = []
541
+ results_container["E"] = []
542
+ results_container["nu"] = []
543
+ results_container["GR"] = []
544
+ results_container["PE"] = []
545
+
546
+ n = 0
547
+ while n < number:
548
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
549
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
550
+ data_apatite = Phosphates(data_type=True).create_aptite()
551
+ mineralogy = {"Qz": self.data_quartz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
552
+ "Kln": self.data_kaolinite, "Ap": data_apatite}
553
+ minerals_list = list(mineralogy.keys())
554
+
555
+ if minerals_list[0] not in results_container["mineralogy"]:
556
+ for mineral in minerals_list:
557
+ results_container["mineralogy"][mineral] = []
558
+
559
+ condition = False
560
+ while condition == False:
561
+ elements_list = []
562
+ phi_minerals = {}
563
+ w_minerals = {}
564
+ w_elements = {}
565
+
566
+ if composition != None:
567
+ phi_qz = composition["Qz"]
568
+ phi_kfs = composition["Kfs"]
569
+ phi_pl = composition["Pl"]
570
+ phi_kln = composition["Kln"]
571
+ phi_ap = composition["Ap"]
572
+
573
+ phi_minerals["Qz"] = phi_qz
574
+ phi_minerals["Kfs"] = phi_kfs
575
+ phi_minerals["Pl"] = phi_pl
576
+ phi_minerals["Kln"] = phi_kln
577
+ phi_minerals["Ap"] = phi_ap
578
+
579
+ else:
580
+ condition_2 = False
581
+ while condition_2 == False:
582
+ if classification == "Siltstone":
583
+ qz_limits = [0.7, 1.0]
584
+ kfs_limits = [0.0, 0.25]
585
+ pl_limits = [0.0, 0.25]
586
+ kln_limits = [0.0, 0.25]
587
+ ap_limits = [0.0, 0.025]
588
+
589
+ phi_qz = round(rd.uniform(qz_limits[0], qz_limits[1]), 4)
590
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1 - phi_qz)), 4)
591
+ phi_pl = round(rd.uniform(pl_limits[0], (1 - phi_qz - phi_kfs)), 4)
592
+ phi_kln = round(rd.uniform(kln_limits[0], (1 - phi_qz - phi_kfs - phi_pl)), 4)
593
+ phi_ap = round(1 - phi_qz - phi_kfs - phi_pl - phi_kln, 4)
594
+
595
+ phi_total = phi_qz + phi_kfs + phi_pl + phi_kln + phi_ap
596
+
597
+ if np.isclose(phi_total, 1.0000) == True:
598
+ if qz_limits[0] <= phi_qz <= qz_limits[1] \
599
+ and kfs_limits[0] <= phi_kfs <= kfs_limits[1] \
600
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
601
+ and kln_limits[0] <= phi_kln <= kln_limits[1] \
602
+ and ap_limits[0] <= phi_ap <= ap_limits[1]:
603
+ condition_2 = True
604
+
605
+ phi_minerals["Qz"] = phi_qz
606
+ phi_minerals["Kfs"] = phi_kfs
607
+ phi_minerals["Pl"] = phi_pl
608
+ phi_minerals["Kln"] = phi_kln
609
+ phi_minerals["Ap"] = phi_ap
610
+
611
+ rho_s = 0
612
+ for key, value in phi_minerals.items():
613
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
614
+ for element, value in mineralogy[key]["chemistry"].items():
615
+ if element not in elements_list:
616
+ elements_list.append(element)
617
+ w_elements[element] = 0.0
618
+
619
+ if elements_list[0] not in results_container["chemistry"]:
620
+ for element in elements_list:
621
+ results_container["chemistry"][element] = []
622
+
623
+ rho_s = round(rho_s, 3)
624
+ for key, value in phi_minerals.items():
625
+ if key == "Urn":
626
+ n_digits = 4
627
+ else:
628
+ n_digits = 4
629
+
630
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
631
+
632
+ if self.fluid == "water":
633
+ data_fluid = self.data_water
634
+
635
+ old_index = elements_list.index("O")
636
+ elements_list += [elements_list.pop(old_index)]
637
+
638
+ w_elements_total = 0.0
639
+ for element in elements_list:
640
+ if element != "O":
641
+ for mineral, w_mineral in w_minerals.items():
642
+ if element in mineralogy[mineral]["chemistry"]:
643
+ if element == "U":
644
+ n_digits = 4
645
+ else:
646
+ n_digits = 4
647
+
648
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
649
+ w_elements[element] += value
650
+ w_elements_total += value
651
+ w_elements[element] = round(w_elements[element], n_digits)
652
+ elif element == "O":
653
+ w_elements[element] += round(1 - w_elements_total, 4)
654
+ w_elements[element] = round(w_elements[element], 4)
655
+
656
+ total_w_minerals = round(sum(w_minerals.values()), 4)
657
+ total_w_elements = round(sum(w_elements.values()), 4)
658
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
659
+ for key, value in w_minerals.items():
660
+ w_minerals[key] = abs(value)
661
+ for key, value in w_elements.items():
662
+ w_elements[key] = abs(value)
663
+ condition = True
664
+
665
+ velocity_solid = {"vP": 0, "vS": 0}
666
+ gamma_ray = 0.0
667
+ photoelectricity = 0.0
668
+ for key, value in phi_minerals.items():
669
+ velocity_solid["vP"] += phi_minerals[key]*mineralogy[key]["vP"]
670
+ velocity_solid["vS"] += phi_minerals[key]*mineralogy[key]["vS"]
671
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
672
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
673
+
674
+ ## Bulk Density, Porosity, Seismic Velocities
675
+ rho_solid = round(rho_s, 3)
676
+ vP, vS, vPvS, rho, var_porosity = SeismicVelocities(
677
+ rho_solid=rho_solid, rho_fluid=self.data_water[2]).calculate_seismic_velocities(
678
+ rho_limits=[1800, 2800], vP_limits=[2800, 4800], vS_limits=[1500, 2500], delta=0.05,
679
+ porosity=porosity)
680
+ phi_neutron = round((1900/rho)*0.15, 4)
681
+ ## Elastic Parameters
682
+ bulk_modulus, shear_modulus, youngs_modulus, poisson_ratio = SeismicVelocities(
683
+ rho_solid=None, rho_fluid=None).calculate_elastic_properties(
684
+ rho=rho, vP=vP, vS=vS)
685
+ ## Gamma Ray
686
+ gamma_ray = round(gamma_ray, 3)
687
+ ## Photoelectricity
688
+ photoelectricity = round(photoelectricity, 3)
689
+ # Composition data
690
+ for key, value in w_minerals.items():
691
+ results_container["mineralogy"][key].append(value)
692
+
693
+ amounts = []
694
+ for key, value in w_elements.items():
695
+ results_container["chemistry"][key].append(value)
696
+ chem_data = PeriodicSystem(name=key).get_data()
697
+ amounts.append([key, chem_data[1], value])
698
+
699
+ list_oxides = ["H2O", "F", "Na2O", "Al2O3", "SiO2", "P2O5", "Cl", "K2O", "CaO"]
700
+ composition_oxides = {}
701
+ for var_oxide in list_oxides:
702
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
703
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
704
+
705
+ if list_oxides[0] not in results_container["compounds"]:
706
+ for oxide in list_oxides:
707
+ results_container["compounds"][oxide] = []
708
+
709
+ for key, value in composition_oxides.items():
710
+ results_container["compounds"][key].append(value)
711
+
712
+ results_container["mineralogy"] = dict(sorted(
713
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
714
+ results_container["chemistry"] = dict(sorted(
715
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
716
+ results_container["compounds"] = dict(sorted(
717
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
718
+
719
+ # Results
720
+ results_container["phi"].append(phi_neutron)
721
+ results_container["phi_true"].append(var_porosity)
722
+ results_container["rho_s"].append(rho_s)
723
+ results_container["rho"].append(rho)
724
+ results_container["vP"].append(vP)
725
+ results_container["vS"].append(vS)
726
+ results_container["vP/vS"].append(vPvS)
727
+ results_container["K"].append(bulk_modulus)
728
+ results_container["G"].append(shear_modulus)
729
+ results_container["E"].append(youngs_modulus)
730
+ results_container["nu"].append(poisson_ratio)
731
+ results_container["GR"].append(gamma_ray)
732
+ results_container["PE"].append(photoelectricity)
733
+ n += 1
734
+
735
+ return results_container
736
+
737
+ def create_mudstone_alt(self, rock="Mudstone", number=1, composition=None, classification="Mudstone",
738
+ porosity=None):
739
+ #
740
+ results_container = {}
741
+ results_container["rock"] = rock
742
+ results_container["mineralogy"] = {}
743
+ results_container["chemistry"] = {}
744
+ results_container["compounds"] = {}
745
+ results_container["phi"] = []
746
+ results_container["fluid"] = self.fluid
747
+ results_container["rho_s"] = []
748
+ results_container["rho"] = []
749
+ results_container["vP"] = []
750
+ results_container["vS"] = []
751
+ results_container["vP/vS"] = []
752
+ results_container["K"] = []
753
+ results_container["G"] = []
754
+ results_container["E"] = []
755
+ results_container["nu"] = []
756
+ results_container["GR"] = []
757
+ results_container["PE"] = []
758
+ #
759
+ n = 0
760
+ helper = [[], []]
761
+ while n < number:
762
+ data_illite = Phyllosilicates(impurity="pure", data_type=True).create_illite_simple()
763
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
764
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
765
+ data_organics = Organics(data_type=True).create_organic_matter()
766
+ #
767
+ mineralogy = {
768
+ "Kln": self.data_kaolinite, "Ilt": data_illite, "Qz": self.data_quartz, "Kfs": data_alkalifeldspar,
769
+ "Pl": data_plagioclase, "Org": data_organics, "Py": self.data_pyrite}
770
+ #
771
+ minerals_list = list(mineralogy.keys())
772
+ #
773
+ if minerals_list[0] not in results_container["mineralogy"]:
774
+ for mineral in minerals_list:
775
+ results_container["mineralogy"][mineral] = []
776
+ #
777
+ condition = False
778
+ #
779
+ while condition == False:
780
+ elements_list = []
781
+ phi_minerals = {}
782
+ w_minerals = {}
783
+ w_elements = {}
784
+ #
785
+ if composition != None:
786
+ phi_kln = composition["Kln"]
787
+ phi_ilt = composition["Ilt"]
788
+ phi_qz = composition["Qz"]
789
+ phi_kfs = composition["Kfs"]
790
+ phi_pl = composition["Pl"]
791
+ phi_org = composition["Org"]
792
+ phi_py = composition["Py"]
793
+ #
794
+ phi_minerals["Kln"] = phi_kln
795
+ phi_minerals["Ilt"] = phi_ilt
796
+ phi_minerals["Qz"] = phi_qz
797
+ phi_minerals["Kfs"] = phi_kfs
798
+ phi_minerals["Pl"] = phi_pl
799
+ phi_minerals["Org"] = phi_org
800
+ phi_minerals["Py"] = phi_py
801
+ #
802
+ else:
803
+ condition_2 = False
804
+ while condition_2 == False:
805
+ if classification == "Mudstone":
806
+ kln_limits = [0.4, 0.5]
807
+ ilt_limits = [0.0, 0.1]
808
+ qz_limits = [0.1, 0.3]
809
+ kfs_limits = [0.0, 0.1]
810
+ pl_limits = [0.0, 0.1]
811
+ org_limits = [0.0, 0.1]
812
+ py_limits = [0.0, 0.05]
813
+ #
814
+ phi_kln = round(rd.uniform(kln_limits[0], kln_limits[1]), 4)
815
+ #
816
+ condition_ilt = False
817
+ while condition_ilt == False:
818
+ phi_ilt = round(rd.uniform(ilt_limits[0], (1 - phi_kln)), 4)
819
+ if ilt_limits[0] <= phi_ilt <= ilt_limits[1]:
820
+ condition_ilt = True
821
+ #
822
+ condition_qz = False
823
+ while condition_qz == False:
824
+ phi_qz = round(rd.uniform(qz_limits[0], (1 - phi_kln - phi_ilt)), 4)
825
+ if qz_limits[0] <= phi_qz <= qz_limits[1]:
826
+ condition_qz = True
827
+ #
828
+ condition_kfs = False
829
+ while condition_kfs == False:
830
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1 - phi_kln - phi_ilt - phi_qz)), 4)
831
+ if kfs_limits[0] <= phi_kfs <= kfs_limits[1]:
832
+ condition_kfs = True
833
+ #
834
+ condition_pl = False
835
+ while condition_pl == False:
836
+ phi_pl = round(rd.uniform(pl_limits[0], (1 - phi_kln - phi_ilt - phi_qz - phi_kfs)), 4)
837
+ if pl_limits[0] <= phi_pl <= pl_limits[1]:
838
+ condition_pl = True
839
+ #
840
+ condition_org = False
841
+ while condition_org == False:
842
+ phi_org = round(rd.uniform(
843
+ org_limits[0], (1 - phi_kln - phi_ilt - phi_qz - phi_kfs - phi_pl)), 4)
844
+ if org_limits[0] <= phi_org <= org_limits[1]:
845
+ condition_org = True
846
+ #
847
+ phi_py = round(1 - phi_kln - phi_ilt - phi_qz - phi_kfs - phi_pl - phi_org, 4)
848
+ #
849
+ phi_total = phi_kln + phi_ilt + phi_qz + phi_kfs + phi_pl + phi_org + phi_py
850
+ #
851
+ if np.isclose(phi_total, 1.0000) == True:
852
+ if kln_limits[0] <= phi_kln <= kln_limits[1] \
853
+ and ilt_limits[0] <= phi_ilt <= ilt_limits[1] \
854
+ and qz_limits[0] <= phi_qz <= qz_limits[1] \
855
+ and kfs_limits[0] <= phi_kfs <= kfs_limits[1] \
856
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
857
+ and org_limits[0] <= phi_org <= org_limits[1] \
858
+ and py_limits[0] <= phi_py <= py_limits[1]:
859
+ condition_2 = True
860
+ #
861
+ phi_minerals["Kln"] = phi_kln
862
+ phi_minerals["Ilt"] = phi_ilt
863
+ phi_minerals["Qz"] = phi_qz
864
+ phi_minerals["Kfs"] = phi_kfs
865
+ phi_minerals["Pl"] = phi_pl
866
+ phi_minerals["Org"] = phi_org
867
+ phi_minerals["Py"] = phi_py
868
+ #
869
+ rho_s = 0
870
+ for key, value in phi_minerals.items():
871
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
872
+ #
873
+ for element, value in mineralogy[key]["chemistry"].items():
874
+ if element not in elements_list:
875
+ elements_list.append(element)
876
+ w_elements[element] = 0.0
877
+ #
878
+ if elements_list[0] not in results_container["chemistry"]:
879
+ for element in elements_list:
880
+ results_container["chemistry"][element] = []
881
+ #
882
+ rho_s = round(rho_s, 3)
883
+ for key, value in phi_minerals.items():
884
+ if key == "Urn":
885
+ n_digits = 4
886
+ else:
887
+ n_digits = 4
888
+ #
889
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
890
+ #
891
+ if self.fluid == "water":
892
+ data_fluid = self.data_water
893
+ #
894
+ old_index = elements_list.index("O")
895
+ elements_list += [elements_list.pop(old_index)]
896
+ #
897
+ w_elements_total = 0.0
898
+ for element in elements_list:
899
+ if element != "O":
900
+ for mineral, w_mineral in w_minerals.items():
901
+ if element in mineralogy[mineral]["chemistry"]:
902
+ if element == "U":
903
+ n_digits = 4
904
+ else:
905
+ n_digits = 4
906
+ #
907
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
908
+ w_elements[element] += value
909
+ w_elements_total += value
910
+ #
911
+ w_elements[element] = round(w_elements[element], n_digits)
912
+ elif element == "O":
913
+ w_elements[element] += round(1 - w_elements_total, 4)
914
+ #
915
+ w_elements[element] = round(w_elements[element], 4)
916
+ #
917
+ total_w_minerals = round(sum(w_minerals.values()), 4)
918
+ total_w_elements = round(sum(w_elements.values()), 4)
919
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
920
+ for key, value in w_minerals.items():
921
+ w_minerals[key] = abs(value)
922
+ #
923
+ for key, value in w_elements.items():
924
+ w_elements[key] = abs(value)
925
+ #
926
+ condition = True
927
+
928
+ velocity_solid = {"vP": 0, "vS": 0}
929
+ gamma_ray = 0.0
930
+ photoelectricity = 0.0
931
+ for key, value in phi_minerals.items():
932
+ velocity_solid["vP"] += phi_minerals[key]*mineralogy[key]["vP"]
933
+ velocity_solid["vS"] += phi_minerals[key]*mineralogy[key]["vS"]
934
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
935
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
936
+ #
937
+ ## Bulk Density, Porosity, Seismic Velocities
938
+ rho_solid = round(rho_s, 3)
939
+ vP, vS, vPvS, rho, var_porosity = SeismicVelocities(
940
+ rho_solid=rho_solid, rho_fluid=self.data_water[2]).calculate_seismic_velocities(
941
+ rho_limits=[1800, 2800], vP_limits=[3000, 4500], vS_limits=[2000, 2600], delta=0.05,
942
+ porosity=porosity)
943
+ ## Elastic Parameters
944
+ bulk_modulus, shear_modulus, youngs_modulus, poisson_ratio = SeismicVelocities(
945
+ rho_solid=None, rho_fluid=None).calculate_elastic_properties(
946
+ rho=rho, vP=vP, vS=vS)
947
+ ## Gamma Ray
948
+ gamma_ray = round(gamma_ray, 3)
949
+ ## Photoelectricity
950
+ photoelectricity = round(photoelectricity, 3)
951
+ # Composition data
952
+ for key, value in w_minerals.items():
953
+ results_container["mineralogy"][key].append(value)
954
+
955
+ amounts = []
956
+ for key, value in w_elements.items():
957
+ results_container["chemistry"][key].append(value)
958
+ chem_data = PeriodicSystem(name=key).get_data()
959
+ amounts.append([key, chem_data[1], value])
960
+
961
+ list_oxides = ["H2O", "CO2", "N2O5", "Na2O", "Al2O3", "SiO2", "SO3", "K2O", "CaO", "Fe2O3"]
962
+ composition_oxides = {}
963
+ for var_oxide in list_oxides:
964
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
965
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
966
+
967
+ if list_oxides[0] not in results_container["compounds"]:
968
+ for oxide in list_oxides:
969
+ results_container["compounds"][oxide] = []
970
+
971
+ for key, value in composition_oxides.items():
972
+ results_container["compounds"][key].append(value)
973
+
974
+ results_container["mineralogy"] = dict(sorted(
975
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
976
+ results_container["chemistry"] = dict(sorted(
977
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
978
+ results_container["compounds"] = dict(sorted(
979
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
980
+
981
+ # Results
982
+ results_container["phi"].append(var_porosity)
983
+ results_container["rho_s"].append(rho_s)
984
+ results_container["rho"].append(rho)
985
+ results_container["vP"].append(vP)
986
+ results_container["vS"].append(vS)
987
+ results_container["vP/vS"].append(vPvS)
988
+ results_container["K"].append(bulk_modulus)
989
+ results_container["G"].append(shear_modulus)
990
+ results_container["E"].append(youngs_modulus)
991
+ results_container["nu"].append(poisson_ratio)
992
+ results_container["GR"].append(gamma_ray)
993
+ results_container["PE"].append(photoelectricity)
994
+ #
995
+ n += 1
996
+ #
997
+ return results_container
998
+
999
+ def create_conglomerate(self, number, porosity=None):
1000
+ #
1001
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
1002
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1003
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
1004
+ #
1005
+ assemblage = [self.data_quartz, data_alkalifeldspar, data_plagioclase, data_biotite, self.data_calcite,
1006
+ self.data_hematite]
1007
+ #
1008
+ amounts_mineralogy = {}
1009
+ amounts_chemistry = {}
1010
+ amounts_compounds = {}
1011
+ bulk_properties = {}
1012
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
1013
+ for property in properties:
1014
+ bulk_properties[property] = []
1015
+ mineral_list = []
1016
+ elements = []
1017
+ for mineral in assemblage:
1018
+ amounts_mineralogy[mineral["mineral"]] = []
1019
+ mineral_list.append(mineral["mineral"])
1020
+ elements_mineral = list(mineral["chemistry"].keys())
1021
+ for element in elements_mineral:
1022
+ if element not in elements:
1023
+ elements.append(element)
1024
+ amounts_chemistry[element] = []
1025
+ mineral_list.sort()
1026
+ elements.sort()
1027
+ #
1028
+ n = 0
1029
+ amounts_helper = []
1030
+ while n < number:
1031
+ w_total = 0
1032
+ n_minerals = 0
1033
+ for mineral in mineral_list:
1034
+ if mineral == "Qz":
1035
+ if n_minerals < len(mineral_list) - 1:
1036
+ value = round(1 - w_total, 4)
1037
+ else:
1038
+ value = round(1 - w_total, 4)
1039
+ if value >= 0.0 and 0.5 <= value <= 0.8:
1040
+ amounts_helper.append(value)
1041
+ w_total += value
1042
+ n_minerals += 1
1043
+ elif mineral == "Kfs":
1044
+ if n_minerals < len(mineral_list) - 1:
1045
+ value = round(rd.uniform(0.0, 0.2), 4)
1046
+ else:
1047
+ value = round(1 - w_total, 4)
1048
+ if value >= 0.0 and 0.0 <= value <= 0.2:
1049
+ amounts_helper.append(value)
1050
+ w_total += value
1051
+ n_minerals += 1
1052
+ elif mineral == "Pl":
1053
+ if n_minerals < len(mineral_list) - 1:
1054
+ value = round(rd.uniform(0.0, 0.2), 4)
1055
+ else:
1056
+ value = round(1 - w_total, 4)
1057
+ if value >= 0.0 and 0.0 <= value <= 0.2:
1058
+ amounts_helper.append(value)
1059
+ w_total += value
1060
+ n_minerals += 1
1061
+ elif mineral == "Cal":
1062
+ if n_minerals < len(mineral_list) - 1:
1063
+ value = round(rd.uniform(0.1, 0.2), 4)
1064
+ else:
1065
+ value = round(1 - w_total, 4)
1066
+ if value >= 0.0 and 0.1 <= value <= 0.2:
1067
+ amounts_helper.append(value)
1068
+ w_total += value
1069
+ n_minerals += 1
1070
+ elif mineral == "Bt":
1071
+ if n_minerals < len(mineral_list) - 1:
1072
+ value = round(rd.uniform(0.0, 0.05), 4)
1073
+ else:
1074
+ value = round(1 - w_total, 4)
1075
+ if value >= 0.0 and 0.0 <= value <= 0.05:
1076
+ amounts_helper.append(value)
1077
+ w_total += value
1078
+ n_minerals += 1
1079
+ elif mineral == "Hem":
1080
+ if n_minerals < len(mineral_list) - 1:
1081
+ value = round(rd.uniform(0.0, 0.05), 4)
1082
+ else:
1083
+ value = round(1 - w_total, 4)
1084
+ if value >= 0.0 and 0.0 <= value <= 0.05:
1085
+ amounts_helper.append(value)
1086
+ w_total += value
1087
+ n_minerals += 1
1088
+ #
1089
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
1090
+ for index, mineral in enumerate(mineral_list):
1091
+ amounts_mineralogy[mineral].append(amounts_helper[index])
1092
+ n += 1
1093
+ amounts_helper.clear()
1094
+ else:
1095
+ n += 0
1096
+ amounts_helper.clear()
1097
+ #
1098
+ n = 0
1099
+ amounts_helper = {}
1100
+ while n < number:
1101
+ w_total = 0
1102
+ n_elements = 0
1103
+ rho_s_helper = 0
1104
+ bulkmod_helper = 0
1105
+ shearmod_helper = 0
1106
+ gr_helper = 0
1107
+ pe_helper = 0
1108
+ if porosity == None:
1109
+ phi_helper = round(rd.uniform(0.0, 0.2), 4)
1110
+ else:
1111
+ phi_helper = round(rd.uniform(porosity[0], porosity[1]), 4)
1112
+ #
1113
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
1114
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1115
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
1116
+ #
1117
+ for element in elements:
1118
+ amounts_helper[element] = 0
1119
+ if element in self.data_quartz["chemistry"]:
1120
+ if n_elements < len(elements) - 1:
1121
+ value = round(amounts_mineralogy["Qz"][n] * self.data_quartz["chemistry"][element], 4)
1122
+ else:
1123
+ value = round(1 - w_total, 4)
1124
+ amounts_helper[element] += value
1125
+ w_total += value
1126
+ if element in data_alkalifeldspar["chemistry"]:
1127
+ if n_elements < len(elements) - 1:
1128
+ value = round(amounts_mineralogy["Kfs"][n] * data_alkalifeldspar["chemistry"][element], 4)
1129
+ else:
1130
+ value = round(1 - w_total, 4)
1131
+ amounts_helper[element] += value
1132
+ w_total += value
1133
+ if element in data_plagioclase["chemistry"]:
1134
+ if n_elements < len(elements) - 1:
1135
+ value = round(amounts_mineralogy["Pl"][n] * data_plagioclase["chemistry"][element], 4)
1136
+ else:
1137
+ value = round(1 - w_total, 4)
1138
+ amounts_helper[element] += value
1139
+ w_total += value
1140
+ if element in data_biotite["chemistry"]:
1141
+ if n_elements < len(elements) - 1:
1142
+ value = round(amounts_mineralogy["Bt"][n] * data_biotite["chemistry"][element], 4)
1143
+ else:
1144
+ value = round(1 - w_total, 4)
1145
+ amounts_helper[element] += value
1146
+ w_total += value
1147
+ if element in self.data_calcite["chemistry"]:
1148
+ if n_elements < len(elements) - 1:
1149
+ value = round(amounts_mineralogy["Cal"][n] * self.data_calcite["chemistry"][element], 4)
1150
+ else:
1151
+ value = round(1 - w_total, 4)
1152
+ amounts_helper[element] += value
1153
+ w_total += value
1154
+ if element in self.data_hematite["chemistry"]:
1155
+ if n_elements < len(elements) - 1:
1156
+ value = round(amounts_mineralogy["Hem"][n] * self.data_hematite["chemistry"][element], 4)
1157
+ else:
1158
+ value = round(1 - w_total, 4)
1159
+ amounts_helper[element] += value
1160
+ w_total += value
1161
+ #
1162
+ n_elements += 1
1163
+ #
1164
+ shear_factor = 1.0
1165
+ #
1166
+ if sum(amounts_helper.values()) == 1.0:
1167
+ for key, value in amounts_helper.items():
1168
+ amounts_chemistry[key].append(round(value, 4))
1169
+
1170
+ for mineral in mineral_list:
1171
+ if mineral == "Qz":
1172
+ rho_s_helper += round(amounts_mineralogy[mineral][n] * self.data_quartz["rho"], 3)
1173
+ bulkmod_helper += round(amounts_mineralogy[mineral][n] * self.data_quartz["K"], 3)
1174
+ shearmod_helper += round(shear_factor * amounts_mineralogy[mineral][n] * self.data_quartz["G"], 3)
1175
+ gr_helper += round(amounts_mineralogy[mineral][n] * self.data_quartz["GR"], 3)
1176
+ pe_helper += round(amounts_mineralogy[mineral][n] * self.data_quartz["PE"], 3)
1177
+ elif mineral == "Kfs":
1178
+ rho_s_helper += round(amounts_mineralogy[mineral][n] * data_alkalifeldspar["rho"], 3)
1179
+ bulkmod_helper += round(amounts_mineralogy[mineral][n] * data_alkalifeldspar["K"], 3)
1180
+ shearmod_helper += round(shear_factor * amounts_mineralogy[mineral][n] * data_alkalifeldspar["G"],
1181
+ 3)
1182
+ gr_helper += round(amounts_mineralogy[mineral][n] * data_alkalifeldspar["GR"], 3)
1183
+ pe_helper += round(amounts_mineralogy[mineral][n] * data_alkalifeldspar["PE"], 3)
1184
+ elif mineral == "Pl":
1185
+ rho_s_helper += round(amounts_mineralogy[mineral][n] * data_plagioclase["rho"], 3)
1186
+ bulkmod_helper += round(amounts_mineralogy[mineral][n] * data_plagioclase["K"], 3)
1187
+ shearmod_helper += round(shear_factor * amounts_mineralogy[mineral][n] * data_plagioclase["G"], 3)
1188
+ gr_helper += round(amounts_mineralogy[mineral][n] * data_plagioclase["GR"], 3)
1189
+ pe_helper += round(amounts_mineralogy[mineral][n] * data_plagioclase["PE"], 3)
1190
+ elif mineral == "Bt":
1191
+ rho_s_helper += round(amounts_mineralogy[mineral][n] * data_biotite["rho"], 3)
1192
+ bulkmod_helper += round(amounts_mineralogy[mineral][n] * data_biotite["K"], 3)
1193
+ shearmod_helper += round(shear_factor * amounts_mineralogy[mineral][n] * data_biotite["G"], 3)
1194
+ gr_helper += round(amounts_mineralogy[mineral][n] * data_biotite["GR"], 3)
1195
+ pe_helper += round(amounts_mineralogy[mineral][n] * data_biotite["PE"], 3)
1196
+ elif mineral == "Cal":
1197
+ rho_s_helper += round(amounts_mineralogy[mineral][n] * self.data_calcite["rho"], 3)
1198
+ bulkmod_helper += round(amounts_mineralogy[mineral][n] * self.data_calcite["K"], 3)
1199
+ shearmod_helper += round(shear_factor * amounts_mineralogy[mineral][n] * self.data_calcite["G"], 3)
1200
+ gr_helper += round(amounts_mineralogy[mineral][n] * self.data_calcite["GR"], 3)
1201
+ pe_helper += round(amounts_mineralogy[mineral][n] * self.data_calcite["PE"], 3)
1202
+ elif mineral == "Hem":
1203
+ rho_s_helper += round(amounts_mineralogy[mineral][n] * self.data_hematite["rho"], 3)
1204
+ bulkmod_helper += round(amounts_mineralogy[mineral][n] * self.data_hematite["K"], 3)
1205
+ shearmod_helper += round(shear_factor * amounts_mineralogy[mineral][n] * self.data_hematite["G"], 3)
1206
+ gr_helper += round(amounts_mineralogy[mineral][n] * self.data_hematite["GR"], 3)
1207
+ pe_helper += round(amounts_mineralogy[mineral][n] * self.data_hematite["PE"], 3)
1208
+ #
1209
+ rho_helper = round((1 - phi_helper) * rho_s_helper + phi_helper * self.data_water[2] / 1000, 3)
1210
+ youngsmod_helper = round(
1211
+ (9 * bulkmod_helper * shearmod_helper) / (3 * bulkmod_helper + shearmod_helper), 3)
1212
+ poisson_helper = round(
1213
+ (3 * bulkmod_helper - 2 * shearmod_helper) / (6 * bulkmod_helper + 2 * shearmod_helper), 3)
1214
+ vP_helper = round(
1215
+ ((bulkmod_helper * 10 ** 9 + 4 / 3 * shearmod_helper * 10 ** 9) / (rho_helper)) ** 0.5, 3)
1216
+ vS_helper = round(((shearmod_helper * 10 ** 9) / (rho_helper)) ** 0.5, 3)
1217
+ vPvS_helper_helper = round(vP_helper / vS_helper, 3)
1218
+ #
1219
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
1220
+ bulk_properties["rho"].append(rho_helper)
1221
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
1222
+ bulk_properties["G"].append(round(shearmod_helper, 3))
1223
+ bulk_properties["E"].append(youngsmod_helper)
1224
+ bulk_properties["nu"].append(poisson_helper)
1225
+ bulk_properties["vP"].append(vP_helper)
1226
+ bulk_properties["vS"].append(vS_helper)
1227
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
1228
+ bulk_properties["GR"].append(round(gr_helper, 3))
1229
+ bulk_properties["PE"].append(round(pe_helper, 3))
1230
+ bulk_properties["phi"].append(round(phi_helper, 3))
1231
+
1232
+ amounts = []
1233
+ for key, value in amounts_chemistry.items():
1234
+ chem_data = PeriodicSystem(name=key).get_data()
1235
+ amounts.append([key, chem_data[1], value[-1]])
1236
+
1237
+ list_oxides = ["H2O", "CO2", "Na2O", "MgO", "Al2O3", "SiO2", "K2O", "CaO", "Fe2O3"]
1238
+ composition_oxides = {}
1239
+ for var_oxide in list_oxides:
1240
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1241
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1242
+
1243
+ if list_oxides[0] not in amounts_compounds:
1244
+ for oxide in list_oxides:
1245
+ amounts_compounds[oxide] = []
1246
+
1247
+ for key, value in composition_oxides.items():
1248
+ amounts_compounds[key].append(value)
1249
+
1250
+ n += 1
1251
+
1252
+ amounts_mineralogy = dict(sorted(
1253
+ amounts_mineralogy.items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1254
+ amounts_chemistry = dict(sorted(
1255
+ amounts_chemistry.items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1256
+ amounts_compounds = dict(sorted(
1257
+ amounts_compounds.items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1258
+
1259
+ results = {}
1260
+ results["rock"] = "Conglomerate"
1261
+ if number > 1:
1262
+ results["mineralogy"] = amounts_mineralogy
1263
+ results["chemistry"] = amounts_chemistry
1264
+ results["compounds"] = amounts_compounds
1265
+ results["phi"] = bulk_properties["phi"]
1266
+ results["fluid"] = "water"
1267
+ results["rho_s"] = bulk_properties["rho_s"]
1268
+ results["rho"] = bulk_properties["rho"]
1269
+ results["vP"] = bulk_properties["vP"]
1270
+ results["vS"] = bulk_properties["vS"]
1271
+ results["vP/vS"] = bulk_properties["vPvS"]
1272
+ results["K"] = bulk_properties["K"]
1273
+ results["G"] = bulk_properties["G"]
1274
+ results["E"] = bulk_properties["E"]
1275
+ results["nu"] = bulk_properties["nu"]
1276
+ results["GR"] = bulk_properties["GR"]
1277
+ results["PE"] = bulk_properties["PE"]
1278
+ else:
1279
+ single_amounts_mineralogy = {}
1280
+ single_amounts_chemistry = {}
1281
+ single_amounts_compounds = {}
1282
+ for mineral, value in amounts_mineralogy.items():
1283
+ single_amounts_mineralogy[mineral] = value[0]
1284
+ for element, value in amounts_chemistry.items():
1285
+ single_amounts_chemistry[element] = value[0]
1286
+ for compound, value in amounts_compounds.items():
1287
+ single_amounts_compounds[compound] = value[0]
1288
+ results["mineralogy"] = single_amounts_mineralogy
1289
+ results["chemistry"] = single_amounts_chemistry
1290
+ results["compounds"] = single_amounts_compounds
1291
+ results["phi"] = bulk_properties["phi"][0]
1292
+ results["fluid"] = "water"
1293
+ results["rho_s"] = bulk_properties["rho_s"][0]
1294
+ results["rho"] = bulk_properties["rho"][0]
1295
+ results["vP"] = bulk_properties["vP"][0]
1296
+ results["vS"] = bulk_properties["vS"][0]
1297
+ results["vP/vS"] = bulk_properties["vPvS"][0]
1298
+ results["K"] = bulk_properties["K"][0]
1299
+ results["G"] = bulk_properties["G"][0]
1300
+ results["E"] = bulk_properties["E"][0]
1301
+ results["nu"] = bulk_properties["nu"][0]
1302
+ results["GR"] = bulk_properties["GR"][0]
1303
+ results["PE"] = bulk_properties["PE"][0]
1304
+ #
1305
+ return results
1306
+
1307
+ def create_shale_alt(self, number=1, composition=None, porosity=None):
1308
+ results_container = {}
1309
+ results_container["rock"] = "Shale"
1310
+ results_container["mineralogy"] = {}
1311
+ results_container["chemistry"] = {}
1312
+ results_container["compounds"] = {}
1313
+ results_container["phi"] = []
1314
+ results_container["fluid"] = "water"
1315
+ results_container["rho_s"] = []
1316
+ results_container["rho"] = []
1317
+ results_container["vP"] = []
1318
+ results_container["vS"] = []
1319
+ results_container["vP/vS"] = []
1320
+ results_container["K"] = []
1321
+ results_container["G"] = []
1322
+ results_container["E"] = []
1323
+ results_container["nu"] = []
1324
+ results_container["GR"] = []
1325
+ results_container["PE"] = []
1326
+ #
1327
+ n = 0
1328
+ while n < number:
1329
+ data_montmorillonite = Phyllosilicates(impurity="pure", data_type=True).create_montmorillonite()
1330
+ data_illite = Phyllosilicates(impurity="pure", data_type=True).create_illite_simple()
1331
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1332
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
1333
+ data_organics = Organics(data_type=True).create_organic_matter()
1334
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
1335
+ #
1336
+ mineralogy = {"Ilt": data_illite, "Mnt": data_montmorillonite, "Chl": data_chlorite,
1337
+ "Qz": self.data_quartz, "Kfs": data_alkalifeldspar, "Bt": data_biotite, "Org": data_organics,
1338
+ "Urn": self.data_uraninite, "Py": self.data_pyrite}
1339
+ #
1340
+ minerals_list = list(mineralogy.keys())
1341
+ #
1342
+ if minerals_list[0] not in results_container["mineralogy"]:
1343
+ for mineral in minerals_list:
1344
+ results_container["mineralogy"][mineral] = []
1345
+ #
1346
+ condition = False
1347
+ #
1348
+ while condition == False:
1349
+ elements_list = []
1350
+ phi_minerals = {}
1351
+ w_minerals = {}
1352
+ w_elements = {}
1353
+ #
1354
+ if composition != None:
1355
+ phi_ilt = composition["Ilt"]
1356
+ phi_mnt = composition["Mnt"]
1357
+ phi_chl = composition["Chl"]
1358
+ phi_qz = composition["Qz"]
1359
+ phi_kfs = composition["Kfs"]
1360
+ phi_bt = composition["Bt"]
1361
+ phi_org = composition["Org"]
1362
+ phi_urn = composition["Urn"]
1363
+ phi_py = composition["Py"]
1364
+ #
1365
+ phi_minerals["Ilt"] = phi_ilt
1366
+ phi_minerals["Mnt"] = phi_mnt
1367
+ phi_minerals["Chl"] = phi_chl
1368
+ phi_minerals["Qz"] = phi_qz
1369
+ phi_minerals["Kfs"] = phi_kfs
1370
+ phi_minerals["Bt"] = phi_bt
1371
+ phi_minerals["Org"] = phi_org
1372
+ phi_minerals["Urn"] = phi_urn
1373
+ phi_minerals["Py"] = phi_py
1374
+ #
1375
+ else:
1376
+ condition_2 = False
1377
+ while condition_2 == False:
1378
+ w_misc = round(rd.uniform(0.0, 0.2), 4)
1379
+ w_silic = round(rd.uniform(0.0, 0.4), 4)
1380
+ w_clay = round(1 - w_misc - w_silic, 4)
1381
+ #
1382
+ ## Others
1383
+ upper_limit_urn = 0.000025
1384
+ phi_urn = round(rd.uniform(0.000001, upper_limit_urn), 6)
1385
+ phi_org = round(w_misc*rd.uniform(0.0, (1 - phi_urn)), 6)
1386
+ phi_py = round(w_misc*rd.uniform(0.0, (1 - phi_urn - phi_org)), 6)
1387
+ phi_bt = round(w_misc - phi_urn - phi_org - phi_py, 6)
1388
+ #
1389
+ ## Siliciclastics
1390
+ phi_qz = round(w_silic*rd.uniform(0.2, 0.8), 6)
1391
+ phi_kfs = round(w_silic - phi_qz, 6)
1392
+ #
1393
+ ## Clays
1394
+ phi_ilt = round(w_clay*rd.uniform(0.5, 1.0), 6)
1395
+ phi_mnt = round(w_clay*rd.uniform(0.0, (1 - phi_ilt)), 6)
1396
+ phi_chl = round(w_clay - phi_ilt - phi_mnt, 6)
1397
+ #
1398
+ phi_total = phi_urn + phi_org + phi_bt + phi_py + phi_qz + phi_kfs + phi_ilt + phi_mnt + phi_chl
1399
+ #
1400
+ if np.isclose(phi_total, 1.0000) == True:
1401
+ if 0.0 <= phi_urn <= upper_limit_urn and 0.0 <= phi_org <= w_misc \
1402
+ and 0.0 <= phi_bt <= w_misc and 0.0 <= phi_py <= 0.1 \
1403
+ and 0.0 <= phi_qz <= w_silic and 0.1 <= phi_kfs <= w_silic \
1404
+ and 0.0 <= phi_ilt <= w_clay and 0.0 <= phi_mnt <= w_clay \
1405
+ and 0.0 <= phi_chl <= w_clay:
1406
+ condition_2 = True
1407
+ #
1408
+ phi_minerals["Ilt"] = phi_ilt
1409
+ phi_minerals["Mnt"] = phi_mnt
1410
+ phi_minerals["Chl"] = phi_chl
1411
+ phi_minerals["Qz"] = phi_qz
1412
+ phi_minerals["Kfs"] = phi_kfs
1413
+ phi_minerals["Bt"] = phi_bt
1414
+ phi_minerals["Org"] = phi_org
1415
+ phi_minerals["Urn"] = phi_urn
1416
+ phi_minerals["Py"] = phi_py
1417
+ #
1418
+ rho_s = 0
1419
+ for key, value in phi_minerals.items():
1420
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
1421
+ #
1422
+ for element, value in mineralogy[key]["chemistry"].items():
1423
+ if element not in elements_list:
1424
+ elements_list.append(element)
1425
+ w_elements[element] = 0.0
1426
+ #
1427
+ if elements_list[0] not in results_container["chemistry"]:
1428
+ for element in elements_list:
1429
+ results_container["chemistry"][element] = []
1430
+ #
1431
+ rho_s = round(rho_s, 3)
1432
+ for key, value in phi_minerals.items():
1433
+ if key == "Urn":
1434
+ n_digits = 6
1435
+ else:
1436
+ n_digits = 6
1437
+ #
1438
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
1439
+ #
1440
+ if self.fluid == "water":
1441
+ data_fluid = self.data_water
1442
+ elif self.fluid == "oil":
1443
+ data_fluid = self.data_oil
1444
+ elif self.fluid == "gas":
1445
+ data_fluid = self.data_gas
1446
+ #
1447
+ old_index = elements_list.index("O")
1448
+ elements_list += [elements_list.pop(old_index)]
1449
+ #
1450
+ w_elements_total = 0.0
1451
+ for element in elements_list:
1452
+ if element != "O":
1453
+ for mineral, w_mineral in w_minerals.items():
1454
+ if element in mineralogy[mineral]["chemistry"]:
1455
+ if element == "U":
1456
+ n_digits = 6
1457
+ else:
1458
+ n_digits = 6
1459
+ #
1460
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1461
+ w_elements[element] += value
1462
+ w_elements_total += value
1463
+ #
1464
+ w_elements[element] = round(w_elements[element], n_digits)
1465
+ elif element == "O":
1466
+ w_elements[element] += round(1 - w_elements_total, 6)
1467
+ #
1468
+ w_elements[element] = round(w_elements[element], 6)
1469
+ #
1470
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
1471
+ condition = True
1472
+ #
1473
+ rho_solid = 0
1474
+ gamma_ray = 0.0
1475
+ photoelectricity = 0.0
1476
+ for key, value in phi_minerals.items():
1477
+ rho_solid += phi_minerals[key] * mineralogy[key]["rho"]
1478
+ gamma_ray += phi_minerals[key] * mineralogy[key]["GR"]
1479
+ photoelectricity += phi_minerals[key] * mineralogy[key]["PE"]
1480
+ #
1481
+ ## Bulk Density, Porosity, Seismic Velocities
1482
+ vP, vS, vPvS, rho, var_porosity = SeismicVelocities(
1483
+ rho_solid=rho_solid, rho_fluid=data_fluid[2]).calculate_seismic_velocities(
1484
+ rho_limits=[1800, 2900], vP_limits=[2000, 5000], vS_limits=[1000, 2000], delta=0.05, porosity=porosity)
1485
+ ## Elastic Parameters
1486
+ bulk_modulus, shear_modulus, youngs_modulus, poisson_ratio = SeismicVelocities(
1487
+ rho_solid=None, rho_fluid=None).calculate_elastic_properties(
1488
+ rho=rho, vP=vP, vS=vS)
1489
+ ## Gamma Ray
1490
+ gamma_ray = round(gamma_ray, 3)
1491
+ ## Photoelectricity
1492
+ photoelectricity = round(photoelectricity, 3)
1493
+ phi_neutron = (2400/rho)*0.39
1494
+ # Composition data
1495
+ for key, value in w_minerals.items():
1496
+ results_container["mineralogy"][key].append(value)
1497
+
1498
+ amounts = []
1499
+ for key, value in w_elements.items():
1500
+ results_container["chemistry"][key].append(value)
1501
+ chem_data = PeriodicSystem(name=key).get_data()
1502
+ amounts.append([key, chem_data[1], value])
1503
+
1504
+ list_oxides = ["H2O", "CO2", "N2O5", "Na2O", "MgO", "Al2O3", "SiO2", "SO3", "K2O", "CaO", "Mn2O3", "Fe2O3",
1505
+ "NiO", "UO2"]
1506
+ composition_oxides = {}
1507
+ for var_oxide in list_oxides:
1508
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1509
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1510
+
1511
+ if list_oxides[0] not in results_container["compounds"]:
1512
+ for oxide in list_oxides:
1513
+ results_container["compounds"][oxide] = []
1514
+
1515
+ for key, value in composition_oxides.items():
1516
+ results_container["compounds"][key].append(value)
1517
+
1518
+ results_container["mineralogy"] = dict(sorted(
1519
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1520
+ results_container["chemistry"] = dict(sorted(
1521
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1522
+ results_container["compounds"] = dict(sorted(
1523
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1524
+
1525
+ ## Results
1526
+ results_container["phi"].append(var_porosity)
1527
+ results_container["rho_s"].append(rho_solid)
1528
+ results_container["rho"].append(rho)
1529
+ results_container["vP"].append(vP)
1530
+ results_container["vS"].append(vS)
1531
+ results_container["vP/vS"].append(vPvS)
1532
+ results_container["K"].append(bulk_modulus)
1533
+ results_container["G"].append(shear_modulus)
1534
+ results_container["E"].append(youngs_modulus)
1535
+ results_container["nu"].append(poisson_ratio)
1536
+ results_container["GR"].append(gamma_ray)
1537
+ results_container["PE"].append(photoelectricity)
1538
+ #
1539
+ n += 1
1540
+ #
1541
+ return results_container
1542
+ #
1543
+ def create_greywacke_huckenholz(self, rock="Greywacke", number=1, composition=None, enrichment_fsp="Pl",
1544
+ enrichment_mca="Bt", porosity=None):
1545
+ results_container = {}
1546
+ results_container["rock"] = rock
1547
+ results_container["mineralogy"] = {}
1548
+ results_container["chemistry"] = {}
1549
+ results_container["compounds"] = {}
1550
+ results_container["phi"] = []
1551
+ results_container["fluid"] = self.fluid
1552
+ results_container["rho_s"] = []
1553
+ results_container["rho"] = []
1554
+ results_container["vP"] = []
1555
+ results_container["vS"] = []
1556
+ results_container["vP/vS"] = []
1557
+ results_container["K"] = []
1558
+ results_container["G"] = []
1559
+ results_container["E"] = []
1560
+ results_container["nu"] = []
1561
+ results_container["GR"] = []
1562
+ results_container["PE"] = []
1563
+ #
1564
+ n = 0
1565
+ while n < number:
1566
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
1567
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1568
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
1569
+ data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite()
1570
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1571
+ #
1572
+ mineralogy = {
1573
+ "Qz": self.data_quartz, "Pl": data_plagioclase, "Kfs": data_alkalifeldspar, "Bt": data_biotite,
1574
+ "Ms": data_muscovite, "Chl": data_chlorite, "Cal": self.data_calcite, "Py": self.data_pyrite}
1575
+ #
1576
+ minerals_list = list(mineralogy.keys())
1577
+ #
1578
+ if minerals_list[0] not in results_container["mineralogy"]:
1579
+ for mineral in minerals_list:
1580
+ results_container["mineralogy"][mineral] = []
1581
+ #
1582
+ condition = False
1583
+ #
1584
+ while condition == False:
1585
+ elements_list = []
1586
+ phi_minerals = {}
1587
+ w_minerals = {}
1588
+ w_elements = {}
1589
+ #
1590
+ if composition != None:
1591
+ phi_qz = composition["Qz"]
1592
+ phi_pl = composition["Pl"]
1593
+ phi_kfs = composition["Kfs"]
1594
+ phi_bt = composition["Bt"]
1595
+ phi_ms = composition["Ms"]
1596
+ phi_chl = composition["Chl"]
1597
+ phi_cal = composition["Cal"]
1598
+ phi_py = composition["Py"]
1599
+ #
1600
+ phi_minerals["Qz"] = phi_qz
1601
+ phi_minerals["Pl"] = phi_pl
1602
+ phi_minerals["Kfs"] = phi_kfs
1603
+ phi_minerals["Bt"] = phi_bt
1604
+ phi_minerals["Ms"] = phi_ms
1605
+ phi_minerals["Chl"] = phi_chl
1606
+ phi_minerals["Cal"] = phi_cal
1607
+ phi_minerals["Py"] = phi_py
1608
+ #
1609
+ else:
1610
+ condition_2 = False
1611
+ while condition_2 == False:
1612
+ fsp_dominance = round(rd.uniform(0.75, 1.0), 2)
1613
+ mca_dominance = round(rd.uniform(0.75, 1.0), 2)
1614
+ #
1615
+ if enrichment_fsp == "Pl":
1616
+ qz_limits = [0.25, 0.55]
1617
+ #
1618
+ pl_limits = [round(fsp_dominance*0.25, 2), round(fsp_dominance*0.45, 2)]
1619
+ kfs_limits = [round((1 - fsp_dominance)*0.25, 2), round((1 - fsp_dominance)*0.47, 2)]
1620
+ #
1621
+ if enrichment_mca == "Bt":
1622
+ bt_limits = [round(mca_dominance*0.0, 2), round(mca_dominance*0.20, 2)]
1623
+ ms_limits = [round((1 - mca_dominance)*0.0, 2), round((1 - mca_dominance)*0.21, 2)]
1624
+ else:
1625
+ ms_limits = [round(mca_dominance*0.0, 2), round(mca_dominance*0.20, 2)]
1626
+ bt_limits = [round((1 - mca_dominance)*0.0, 2), round((1 - mca_dominance)*0.21, 2)]
1627
+ #
1628
+ chl_limits = [0.0, 0.25]
1629
+ cal_limits = [0.0, 0.06]
1630
+ py_limits = [0.0, 0.03]
1631
+ #
1632
+ else:
1633
+ qz_limits = [0.25, 0.55]
1634
+ #
1635
+ kfs_limits = [round(fsp_dominance*0.25, 2), round(fsp_dominance*0.45, 2)]
1636
+ pl_limits = [round((1 - fsp_dominance)*0.25, 2), round((1 - fsp_dominance)*0.47, 2)]
1637
+ #
1638
+ if enrichment_mca == "Bt":
1639
+ bt_limits = [round(mca_dominance*0.0, 2), round(mca_dominance*0.20, 2)]
1640
+ ms_limits = [round((1 - mca_dominance)*0.0, 2), round((1 - mca_dominance)*0.21, 2)]
1641
+ else:
1642
+ ms_limits = [round(mca_dominance*0.0, 2), round(mca_dominance*0.20, 2)]
1643
+ bt_limits = [round((1 - mca_dominance)*0.0, 2), round((1 - mca_dominance)*0.21, 2)]
1644
+ #
1645
+ chl_limits = [0.0, 0.22]
1646
+ cal_limits = [0.0, 0.05]
1647
+ py_limits = [0.0, 0.03]
1648
+ #
1649
+ phi_qz = round(rd.uniform(qz_limits[0], qz_limits[1]), 4)
1650
+ phi_pl = round(rd.uniform(pl_limits[0], (1 - phi_qz)), 4)
1651
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1 - phi_qz - phi_pl)), 4)
1652
+ phi_bt = round(rd.uniform(bt_limits[0], (1 - phi_qz - phi_pl - phi_kfs)), 4)
1653
+ phi_ms = round(rd.uniform(ms_limits[0], (1 - phi_qz - phi_pl - phi_kfs - phi_bt)), 4)
1654
+ phi_chl = round(rd.uniform(chl_limits[0], (1 - phi_qz - phi_pl - phi_kfs - phi_bt - phi_ms)), 4)
1655
+ phi_cal = round(rd.uniform(cal_limits[0],
1656
+ (1 - phi_qz - phi_pl - phi_kfs - phi_bt - phi_ms - phi_chl)), 4)
1657
+ phi_py = round(1 - phi_qz - phi_pl - phi_kfs - phi_bt - phi_ms - phi_chl - phi_cal, 4)
1658
+ #
1659
+ phi_total = round(phi_qz + phi_pl + phi_kfs + phi_bt + phi_ms + phi_chl + phi_cal + phi_py, 4)
1660
+ #
1661
+ if np.isclose(phi_total, 1.0000) == True:
1662
+ if qz_limits[0] <= phi_qz <= qz_limits[1] \
1663
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
1664
+ and kfs_limits[0] <= phi_kfs <= kfs_limits[1] \
1665
+ and bt_limits[0] <= phi_bt <= bt_limits[1] \
1666
+ and ms_limits[0] <= phi_ms <= ms_limits[1] \
1667
+ and chl_limits[0] <= phi_chl <= chl_limits[1] \
1668
+ and cal_limits[0] <= phi_cal <= cal_limits[1] \
1669
+ and py_limits[0] <= phi_py <= py_limits[1]:
1670
+ condition_2 = True
1671
+ #
1672
+ phi_minerals["Qz"] = phi_qz
1673
+ phi_minerals["Pl"] = phi_pl
1674
+ phi_minerals["Kfs"] = phi_kfs
1675
+ phi_minerals["Bt"] = phi_bt
1676
+ phi_minerals["Ms"] = phi_ms
1677
+ phi_minerals["Chl"] = phi_chl
1678
+ phi_minerals["Cal"] = phi_cal
1679
+ phi_minerals["Py"] = phi_py
1680
+ #
1681
+ rho_s = 0
1682
+ velocities_minerals = {}
1683
+ for key, value in phi_minerals.items():
1684
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
1685
+ #
1686
+ velocities_minerals[key] = {}
1687
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
1688
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
1689
+ #
1690
+ for element, value in mineralogy[key]["chemistry"].items():
1691
+ if element not in elements_list:
1692
+ elements_list.append(element)
1693
+ w_elements[element] = 0.0
1694
+ #
1695
+ if elements_list[0] not in results_container["chemistry"]:
1696
+ for element in elements_list:
1697
+ results_container["chemistry"][element] = []
1698
+ #
1699
+ rho_s = round(rho_s, 3)
1700
+ #
1701
+ rho_solid = rho_s
1702
+ for key, value in phi_minerals.items():
1703
+ if key == "Urn":
1704
+ n_digits = 4
1705
+ else:
1706
+ n_digits = 4
1707
+ #
1708
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
1709
+ #
1710
+ if self.fluid == "water":
1711
+ data_fluid = self.data_water
1712
+ elif self.fluid == "oil":
1713
+ data_fluid = self.data_oil
1714
+ elif self.fluid == "gas":
1715
+ data_fluid = self.data_gas
1716
+ #
1717
+ old_index = elements_list.index("O")
1718
+ elements_list += [elements_list.pop(old_index)]
1719
+ #
1720
+ w_elements_total = 0.0
1721
+ for element in elements_list:
1722
+ if element != "O":
1723
+ for mineral, w_mineral in w_minerals.items():
1724
+ if element in mineralogy[mineral]["chemistry"]:
1725
+ if element == "U":
1726
+ n_digits = 4
1727
+ else:
1728
+ n_digits = 4
1729
+ #
1730
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1731
+ w_elements[element] += value
1732
+ w_elements_total += value
1733
+ #
1734
+ w_elements[element] = round(w_elements[element], n_digits)
1735
+ elif element == "O":
1736
+ w_elements[element] += round(1 - w_elements_total, 4)
1737
+ #
1738
+ w_elements[element] = round(w_elements[element], 4)
1739
+ #
1740
+ total_w_minerals = round(sum(w_minerals.values()), 4)
1741
+ total_w_elements = round(sum(w_elements.values()), 4)
1742
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
1743
+ for key, value in w_minerals.items():
1744
+ w_minerals[key] = abs(value)
1745
+ #
1746
+ for key, value in w_elements.items():
1747
+ w_elements[key] = abs(value)
1748
+ #
1749
+ condition = True
1750
+ #
1751
+ gamma_ray = 0.0
1752
+ photoelectricity = 0.0
1753
+ #
1754
+ K_list = []
1755
+ G_list = []
1756
+ phi_list = []
1757
+ for key, value in phi_minerals.items():
1758
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
1759
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
1760
+ #
1761
+ gamma_ray = round(gamma_ray, 3)
1762
+ photoelectricity = round(photoelectricity, 3)
1763
+ #
1764
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
1765
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
1766
+ phi_list.append(phi_minerals[key])
1767
+ #
1768
+ ## Bulk Density, Porosity, Seismic Velocities
1769
+ rho_solid = round(rho_s, 3)
1770
+ vP, vS, vPvS, rho, var_porosity = SeismicVelocities(
1771
+ rho_solid=rho_solid, rho_fluid=self.data_water[2]).calculate_seismic_velocities(
1772
+ rho_limits=[2000, 2800], vP_limits=[2500, 6000], vS_limits=[2000, 3000], delta=0.05,
1773
+ porosity=porosity)
1774
+ ## Elastic Parameters
1775
+ bulk_modulus, shear_modulus, youngs_modulus, poisson_ratio = SeismicVelocities(
1776
+ rho_solid=None, rho_fluid=None).calculate_elastic_properties(
1777
+ rho=rho, vP=vP, vS=vS)
1778
+ # Composition data
1779
+ for key, value in w_minerals.items():
1780
+ results_container["mineralogy"][key].append(value)
1781
+
1782
+ amounts = []
1783
+ for key, value in w_elements.items():
1784
+ results_container["chemistry"][key].append(value)
1785
+ chem_data = PeriodicSystem(name=key).get_data()
1786
+ amounts.append([key, chem_data[1], value])
1787
+
1788
+ list_oxides = ["H2O", "CO2", "F", "Na2O", "MgO", "Al2O3", "SiO2", "SO3", "K2O", "CaO", "Mn2O3", "Fe2O3",
1789
+ "NiO"]
1790
+ composition_oxides = {}
1791
+ for var_oxide in list_oxides:
1792
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1793
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1794
+
1795
+ if list_oxides[0] not in results_container["compounds"]:
1796
+ for oxide in list_oxides:
1797
+ results_container["compounds"][oxide] = []
1798
+
1799
+ for key, value in composition_oxides.items():
1800
+ results_container["compounds"][key].append(value)
1801
+
1802
+ results_container["mineralogy"] = dict(sorted(
1803
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1804
+ results_container["chemistry"] = dict(sorted(
1805
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1806
+ results_container["compounds"] = dict(sorted(
1807
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1808
+
1809
+ # Results
1810
+ results_container["phi"].append(var_porosity)
1811
+ results_container["rho_s"].append(rho_s)
1812
+ results_container["rho"].append(rho)
1813
+ results_container["vP"].append(vP)
1814
+ results_container["vS"].append(vS)
1815
+ results_container["vP/vS"].append(vPvS)
1816
+ results_container["K"].append(bulk_modulus)
1817
+ results_container["G"].append(shear_modulus)
1818
+ results_container["E"].append(youngs_modulus)
1819
+ results_container["nu"].append(poisson_ratio)
1820
+ results_container["GR"].append(gamma_ray)
1821
+ results_container["PE"].append(photoelectricity)
1822
+ #
1823
+ n += 1
1824
+ #
1825
+ return results_container
1826
+ #
1827
+ #
1828
+ ## TEST
1829
+ # print(Sandstone(fluid="water", actualThickness=0).create_sandstone(number=100))
1830
+ # print(Sandstone(fluid="water", actualThickness=0).create_conglomerate(number=10))