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,2241 @@
1
+ #!/usr/bin/env python
2
+ # -*-coding: utf-8 -*-
3
+
4
+ #-----------------------------------------------
5
+
6
+ # Name: igneous.py
7
+ # Author: Maximilian A. Beeskow
8
+ # Version: 1.0
9
+ # Date: 05.01.2025
10
+
11
+ #-----------------------------------------------
12
+
13
+ ## MODULES
14
+ import numpy as np
15
+ from numpy import round
16
+ from random import *
17
+ import random as rd
18
+ # internal
19
+ try:
20
+ from gebpy.modules.chemistry import PeriodicSystem, OxideCompounds
21
+ from gebpy.modules import minerals, geochemistry, oxides
22
+ from gebpy.modules import fluids
23
+ from gebpy.modules.geophysics import Elasticity as elast
24
+ from gebpy.modules.oxides import Oxides
25
+ from gebpy.modules.silicates import Tectosilicates, Phyllosilicates, Inosilicates, Nesosilicates
26
+ from gebpy.modules.fluids import Water, Hydrocarbons
27
+ from gebpy.modules.petrophysics import SeismicVelocities
28
+ except:
29
+ from modules.chemistry import PeriodicSystem, OxideCompounds
30
+ from modules import minerals, geochemistry, oxides
31
+ from modules import fluids
32
+ from modules.geophysics import Elasticity as elast
33
+ from modules.oxides import Oxides
34
+ from modules.silicates import Tectosilicates, Phyllosilicates, Inosilicates, Nesosilicates
35
+ from modules.fluids import Water, Hydrocarbons
36
+ from modules.petrophysics import SeismicVelocities
37
+
38
+ ## CLASSES
39
+ class UltraMafic:
40
+ #
41
+ def __init__(self, fluid, actualThickness, dict_output=False, porosity=None):
42
+ self.fluid = fluid
43
+ self.actualThickness = actualThickness
44
+ self.dict_output = dict_output
45
+ self.porosity = porosity
46
+ #
47
+ self.data_qz = Oxides(impurity="pure", data_type=True).create_quartz()
48
+ self.data_water = Water.water("")
49
+ self.data_oil = Hydrocarbons.oil("")
50
+ self.data_gas = Hydrocarbons.natural_gas("")
51
+ #
52
+ def create_ultramafic_rock(self, rock="Granite", number=1, composition=None):
53
+ results_container = {}
54
+ results_container["rock"] = rock
55
+ results_container["mineralogy"] = {}
56
+ results_container["chemistry"] = {}
57
+ results_container["compounds"] = {}
58
+ results_container["phi"] = []
59
+ results_container["fluid"] = self.fluid
60
+ results_container["rho_s"] = []
61
+ results_container["rho"] = []
62
+ results_container["vP"] = []
63
+ results_container["vS"] = []
64
+ results_container["vP/vS"] = []
65
+ results_container["K"] = []
66
+ results_container["G"] = []
67
+ results_container["E"] = []
68
+ results_container["nu"] = []
69
+ results_container["GR"] = []
70
+ results_container["PE"] = []
71
+ #
72
+ n = 0
73
+ while n < number:
74
+ data_clinopyroxene = Inosilicates(
75
+ mineral="Clinopyroxene", data_type=True, traces_list=[]).generate_dataset(
76
+ number=1)
77
+ data_orthopyroxene = Inosilicates(
78
+ mineral="Orthopyroxene", data_type=True, traces_list=[]).generate_dataset(
79
+ number=1)
80
+ data_olivine = Nesosilicates(
81
+ mineral="Olivine", data_type=True, traces_list=[]).generate_dataset(
82
+ number=1)
83
+ #
84
+ mineralogy = {"Opx": data_orthopyroxene, "Cpx": data_clinopyroxene, "Ol": data_olivine}
85
+ #
86
+ minerals_list = list(mineralogy.keys())
87
+ #
88
+ if minerals_list[0] not in results_container["mineralogy"]:
89
+ for mineral in minerals_list:
90
+ results_container["mineralogy"][mineral] = []
91
+ #
92
+ condition = False
93
+ #
94
+ while condition == False:
95
+ elements_list = []
96
+ phi_minerals = {}
97
+ w_minerals = {}
98
+ w_elements = {}
99
+ #
100
+ if composition != None:
101
+ phi_opx = composition["Opx"]
102
+ phi_cpx = composition["Cpx"]
103
+ phi_ol = composition["Ol"]
104
+ #
105
+ phi_minerals["Opx"] = phi_opx
106
+ phi_minerals["Cpx"] = phi_cpx
107
+ phi_minerals["Ol"] = phi_ol
108
+ #
109
+ else:
110
+ condition_2 = False
111
+ while condition_2 == False:
112
+ if rock == "Orthopyroxenite":
113
+ opx_limits = [0.9, 1.0]
114
+ cpx_limits = [0.0, 0.1]
115
+ ol_limits = [0.0, 0.1]
116
+ elif rock == "Clinopyroxenite":
117
+ opx_limits = [0.0, 0.1]
118
+ cpx_limits = [0.9, 1.0]
119
+ ol_limits = [0.0, 0.1]
120
+ elif rock == "Dunite":
121
+ opx_limits = [0.0, 0.1]
122
+ cpx_limits = [0.0, 0.1]
123
+ ol_limits = [0.9, 1.0]
124
+ elif rock == "Harzburgite":
125
+ opx_limits = [0.05, 0.6]
126
+ cpx_limits = [0.0, 0.1]
127
+ ol_limits = [0.4, 0.9]
128
+ elif rock == "Wehrlite":
129
+ opx_limits = [0.0, 0.1]
130
+ cpx_limits = [0.05, 0.6]
131
+ ol_limits = [0.4, 0.9]
132
+ elif rock == "Websterite":
133
+ opx_limits = [0.05, 0.9]
134
+ cpx_limits = [0.05, 0.9]
135
+ ol_limits = [0.0, 0.05]
136
+ elif rock == "Lherzolite":
137
+ opx_limits = [0.05, 0.55]
138
+ cpx_limits = [0.05, 0.55]
139
+ ol_limits = [0.4, 0.9]
140
+ elif rock == "Olivine-Websterite":
141
+ opx_limits = [0.05, 0.9]
142
+ cpx_limits = [0.05, 0.9]
143
+ ol_limits = [0.05, 0.4]
144
+ elif rock == "Olivine-Orthopyroxenite":
145
+ opx_limits = [0.55, 0.9]
146
+ cpx_limits = [0.0, 0.05]
147
+ ol_limits = [0.05, 0.4]
148
+ elif rock == "Olivine-Clinopyroxenite":
149
+ opx_limits = [0.0, 0.05]
150
+ cpx_limits = [0.55, 0.9]
151
+ ol_limits = [0.05, 0.4]
152
+ elif rock == "Peridotite":
153
+ opx_limits = [0.0, 0.6]
154
+ cpx_limits = [0.0, 0.6]
155
+ ol_limits = [0.4, 1.0]
156
+ elif rock == "Pyroxenite":
157
+ opx_limits = [0.0, 1.0]
158
+ cpx_limits = [0.0, 1.0]
159
+ ol_limits = [0.0, 0.4]
160
+ #
161
+ phi_opx = round(rd.uniform(opx_limits[0], opx_limits[1]), 4)
162
+ phi_cpx = round(rd.uniform(cpx_limits[0], (1.0 - phi_opx)), 4)
163
+ phi_ol = round(1 - phi_opx - phi_cpx, 4)
164
+ phi_total = phi_opx + phi_cpx + phi_ol
165
+ #
166
+ if np.isclose(phi_total, 1.0000) == True:
167
+ if opx_limits[0] <= phi_opx <= opx_limits[1] \
168
+ and cpx_limits[0] <= phi_cpx <= cpx_limits[1] \
169
+ and ol_limits[0] <= phi_ol <= ol_limits[1]:
170
+ condition_2 = True
171
+ #
172
+ phi_minerals["Opx"] = phi_opx
173
+ phi_minerals["Cpx"] = phi_cpx
174
+ phi_minerals["Ol"] = phi_ol
175
+ #
176
+ rho_s = 0
177
+ for key, value in phi_minerals.items():
178
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"][0]
179
+ for element, value in mineralogy[key]["chemistry"].items():
180
+ if element not in elements_list:
181
+ elements_list.append(element)
182
+ w_elements[element] = 0.0
183
+ #
184
+ if elements_list[0] not in results_container["chemistry"]:
185
+ for element in elements_list:
186
+ results_container["chemistry"][element] = []
187
+ #
188
+ rho_s = round(rho_s, 3)
189
+ for key, value in phi_minerals.items():
190
+ if key == "Urn":
191
+ n_digits = 6
192
+ else:
193
+ n_digits = 6
194
+ #
195
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"][0])/rho_s, n_digits)
196
+ #
197
+ if self.porosity == None:
198
+ var_porosity = round(rd.uniform(0.0, 0.1), 4)
199
+ else:
200
+ var_porosity = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
201
+ #
202
+ if self.fluid == "water":
203
+ data_fluid = self.data_water
204
+ elif self.fluid == "oil":
205
+ data_fluid = self.data_oil
206
+ elif self.fluid == "gas":
207
+ data_fluid = self.data_gas
208
+ #
209
+ rho = round((1 - var_porosity)*rho_s + var_porosity*data_fluid[2]/1000, 3)
210
+ #
211
+ old_index = elements_list.index("O")
212
+ elements_list += [elements_list.pop(old_index)]
213
+ #
214
+ w_elements_total = 0.0
215
+ for element in elements_list:
216
+ if element != "O":
217
+ for mineral, w_mineral in w_minerals.items():
218
+ if element in mineralogy[mineral]["chemistry"]:
219
+ if element == "U":
220
+ n_digits = 6
221
+ else:
222
+ n_digits = 6
223
+ #
224
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element][0], n_digits)
225
+ w_elements[element] += value
226
+ w_elements_total += value
227
+ #
228
+ w_elements[element] = round(w_elements[element], n_digits)
229
+ elif element == "O":
230
+ w_elements[element] += round(1 - w_elements_total, 6)
231
+ #
232
+ w_elements[element] = round(w_elements[element], 6)
233
+ #
234
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
235
+ for key, value in w_minerals.items():
236
+ w_minerals[key] = abs(value)
237
+ #
238
+ for key, value in w_elements.items():
239
+ w_elements[key] = abs(value)
240
+ #
241
+ condition = True
242
+ #
243
+ bulk_mod = 0.0
244
+ shear_mod = 0.0
245
+ gamma_ray = 0.0
246
+ photoelectricity = 0.0
247
+ #
248
+ K_list = []
249
+ G_list = []
250
+ phi_list = []
251
+ for key, value in phi_minerals.items():
252
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"][0]
253
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"][0]
254
+ #
255
+ gamma_ray = round(gamma_ray, 3)
256
+ photoelectricity = round(photoelectricity, 3)
257
+ #
258
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"][0], 3))
259
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"][0], 3))
260
+ phi_list.append(phi_minerals[key])
261
+ #
262
+ K_geo = elast.calc_geometric_mean(self, phi_list, K_list)
263
+ G_geo = elast.calc_geometric_mean(self, phi_list, G_list)
264
+ #
265
+ anisotropic_factor = 1.0
266
+ #
267
+ bulk_mod = K_geo/anisotropic_factor
268
+ shear_mod = G_geo/anisotropic_factor
269
+ #
270
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
271
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 6)
272
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
273
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
274
+ vPvS = round(vP/vS, 6)
275
+ # Composition data
276
+ for key, value in w_minerals.items():
277
+ results_container["mineralogy"][key].append(value)
278
+
279
+ amounts = []
280
+ for key, value in w_elements.items():
281
+ results_container["chemistry"][key].append(value)
282
+ chem_data = PeriodicSystem(name=key).get_data()
283
+ amounts.append([key, chem_data[1], value])
284
+
285
+ list_elements = list(w_elements.keys())
286
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
287
+ composition_oxides = {}
288
+ for var_oxide in list_oxides:
289
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
290
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
291
+
292
+ if list_oxides[0] not in results_container["compounds"]:
293
+ for oxide in list_oxides:
294
+ results_container["compounds"][oxide] = []
295
+
296
+ for key, value in composition_oxides.items():
297
+ results_container["compounds"][key].append(value)
298
+
299
+ results_container["mineralogy"] = dict(sorted(
300
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
301
+ results_container["chemistry"] = dict(sorted(
302
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
303
+ results_container["compounds"] = dict(sorted(
304
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
305
+
306
+ # Results
307
+ results_container["phi"].append(var_porosity)
308
+ results_container["rho_s"].append(rho_s)
309
+ results_container["rho"].append(rho)
310
+ results_container["vP"].append(vP)
311
+ results_container["vS"].append(vS)
312
+ results_container["vP/vS"].append(vPvS)
313
+ results_container["K"].append(bulk_mod)
314
+ results_container["G"].append(shear_mod)
315
+ results_container["E"].append(youngs_mod)
316
+ results_container["nu"].append(poisson_rat)
317
+ results_container["GR"].append(gamma_ray)
318
+ results_container["PE"].append(photoelectricity)
319
+ #
320
+ n += 1
321
+ #
322
+ return results_container
323
+ #
324
+ class Plutonic:
325
+ #
326
+ def __init__(self, fluid, actualThickness, dict_output=False, porosity=None):
327
+ self.fluid = fluid
328
+ self.actualThickness = actualThickness
329
+ self.dict_output = dict_output
330
+ self.porosity = porosity
331
+ #
332
+ self.data_qz = Oxides(impurity="pure", data_type=True).create_quartz()
333
+ self.data_water = Water.water("")
334
+ self.data_oil = Hydrocarbons.oil("")
335
+ self.data_gas = Hydrocarbons.natural_gas("")
336
+ #
337
+ def create_granite_streckeisen_alt(self, number=1, composition=None):
338
+ results_container = {}
339
+ results_container["rock"] = "Granite"
340
+ results_container["mineralogy"] = {}
341
+ results_container["chemistry"] = {}
342
+ results_container["phi"] = []
343
+ results_container["fluid"] = "water"
344
+ results_container["rho_s"] = []
345
+ results_container["rho"] = []
346
+ results_container["vP"] = []
347
+ results_container["vS"] = []
348
+ results_container["vP/vS"] = []
349
+ results_container["K"] = []
350
+ results_container["G"] = []
351
+ results_container["E"] = []
352
+ results_container["nu"] = []
353
+ results_container["GR"] = []
354
+ results_container["PE"] = []
355
+ #
356
+ n = 0
357
+ while n < number:
358
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
359
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
360
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
361
+ #
362
+ mineralogy = {"Qz": self.data_qz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase, "Bt": data_biotite}
363
+ #
364
+ minerals_list = list(mineralogy.keys())
365
+ #
366
+ if minerals_list[0] not in results_container["mineralogy"]:
367
+ for mineral in minerals_list:
368
+ results_container["mineralogy"][mineral] = []
369
+ #
370
+ condition = False
371
+ #
372
+ while condition == False:
373
+ elements_list = []
374
+ phi_minerals = {}
375
+ w_minerals = {}
376
+ w_elements = {}
377
+ #
378
+ if composition != None:
379
+ phi_qz = composition["Qz"]
380
+ phi_kfs = composition["Kfs"]
381
+ phi_pl = composition["Pl"]
382
+ phi_bt = composition["Bt"]
383
+ #
384
+ phi_minerals["Qz"] = phi_qz
385
+ phi_minerals["Kfs"] = phi_kfs
386
+ phi_minerals["Pl"] = phi_pl
387
+ phi_minerals["Bt"] = phi_bt
388
+ #
389
+ else:
390
+ condition_2 = False
391
+ while condition_2 == False:
392
+ phi_qz = round(rd.uniform(0.2, 0.6), 4)
393
+ phi_kfs = round(rd.uniform(0.15, (1.0 - phi_qz)), 4)
394
+ phi_pl = round(rd.uniform(0.0, (1.0 - phi_qz - phi_kfs)), 4)
395
+ phi_bt = round(1 - phi_qz - phi_kfs - phi_pl, 4)
396
+ phi_total = phi_qz + phi_kfs + phi_pl + phi_bt
397
+ #
398
+ if np.isclose(phi_total, 1.0000) == True:
399
+ if 0.2 <= phi_qz <= 0.6 and 0.15 <= phi_kfs <= 0.8 and 0.0 <= phi_pl <= 0.52 \
400
+ and 0.0 <= phi_bt <= 0.05:
401
+ condition_2 = True
402
+ #
403
+ phi_minerals["Qz"] = phi_qz
404
+ phi_minerals["Kfs"] = phi_kfs
405
+ phi_minerals["Pl"] = phi_pl
406
+ phi_minerals["Bt"] = phi_bt
407
+ #
408
+ rho_s = 0
409
+ for key, value in phi_minerals.items():
410
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
411
+ for element, value in mineralogy[key]["chemistry"].items():
412
+ if element not in elements_list:
413
+ elements_list.append(element)
414
+ w_elements[element] = 0.0
415
+ #
416
+ if elements_list[0] not in results_container["chemistry"]:
417
+ for element in elements_list:
418
+ results_container["chemistry"][element] = []
419
+ #
420
+ rho_s = round(rho_s, 3)
421
+ for key, value in phi_minerals.items():
422
+ if key == "Urn":
423
+ n_digits = 6
424
+ else:
425
+ n_digits = 6
426
+ #
427
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
428
+ #
429
+ if self.porosity == None:
430
+ var_porosity = round(rd.uniform(0.0, 0.1), 4)
431
+ else:
432
+ var_porosity = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
433
+ #
434
+ if self.fluid == "water":
435
+ data_fluid = self.data_water
436
+ elif self.fluid == "oil":
437
+ data_fluid = self.data_oil
438
+ elif self.fluid == "gas":
439
+ data_fluid = self.data_gas
440
+ #
441
+ rho = round((1 - var_porosity)*rho_s + var_porosity*data_fluid[2]/1000, 3)
442
+ #
443
+ old_index = elements_list.index("O")
444
+ elements_list += [elements_list.pop(old_index)]
445
+ #
446
+ w_elements_total = 0.0
447
+ for element in elements_list:
448
+ if element != "O":
449
+ for mineral, w_mineral in w_minerals.items():
450
+ if element in mineralogy[mineral]["chemistry"]:
451
+ if element == "U":
452
+ n_digits = 6
453
+ else:
454
+ n_digits = 6
455
+ #
456
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
457
+ w_elements[element] += value
458
+ w_elements_total += value
459
+ #
460
+ w_elements[element] = round(w_elements[element], n_digits)
461
+ elif element == "O":
462
+ w_elements[element] += round(1 - w_elements_total, 6)
463
+ #
464
+ w_elements[element] = round(w_elements[element], 6)
465
+ #
466
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
467
+ condition = True
468
+ #
469
+ bulk_mod = 0.0
470
+ shear_mod = 0.0
471
+ gamma_ray = 0.0
472
+ photoelectricity = 0.0
473
+ #
474
+ K_list = []
475
+ G_list = []
476
+ phi_list = []
477
+ for key, value in phi_minerals.items():
478
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
479
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
480
+ #
481
+ gamma_ray = round(gamma_ray, 3)
482
+ photoelectricity = round(photoelectricity, 3)
483
+ #
484
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
485
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
486
+ phi_list.append(phi_minerals[key])
487
+ #
488
+ K_geo = elast.calc_geometric_mean(self, phi_list, K_list)
489
+ G_geo = elast.calc_geometric_mean(self, phi_list, G_list)
490
+ #
491
+ # anisotropic_factor = round(rd.uniform(1.0, 2.0), 4)
492
+ anisotropic_factor = 1.0
493
+ #
494
+ bulk_mod = K_geo/anisotropic_factor
495
+ shear_mod = G_geo/anisotropic_factor
496
+ #
497
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
498
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 6)
499
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
500
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
501
+ vPvS = round(vP/vS, 6)
502
+ #
503
+ for key, value in w_minerals.items():
504
+ results_container["mineralogy"][key].append(value)
505
+ #
506
+ for key, value in w_elements.items():
507
+ results_container["chemistry"][key].append(value)
508
+ #
509
+ results_container["phi"].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_mod)
516
+ results_container["G"].append(shear_mod)
517
+ results_container["E"].append(youngs_mod)
518
+ results_container["nu"].append(poisson_rat)
519
+ results_container["GR"].append(gamma_ray)
520
+ results_container["PE"].append(photoelectricity)
521
+ #
522
+ n += 1
523
+ #
524
+ return results_container
525
+ #
526
+ def create_granodiorite_streckeisen_alt(self, number=1, composition=None):
527
+ results_container = {}
528
+ results_container["rock"] = "Granodiorite"
529
+ results_container["mineralogy"] = {}
530
+ results_container["chemistry"] = {}
531
+ results_container["phi"] = []
532
+ results_container["fluid"] = "water"
533
+ results_container["rho_s"] = []
534
+ results_container["rho"] = []
535
+ results_container["vP"] = []
536
+ results_container["vS"] = []
537
+ results_container["vP/vS"] = []
538
+ results_container["K"] = []
539
+ results_container["G"] = []
540
+ results_container["E"] = []
541
+ results_container["nu"] = []
542
+ results_container["GR"] = []
543
+ results_container["PE"] = []
544
+ #
545
+ n = 0
546
+ while n < number:
547
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
548
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
549
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
550
+ #
551
+ mineralogy = {"Qz": self.data_qz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase, "Bt": data_biotite}
552
+ #
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
+ #
561
+ while condition == False:
562
+ elements_list = []
563
+ phi_minerals = {}
564
+ w_minerals = {}
565
+ w_elements = {}
566
+ #
567
+ if composition != None:
568
+ phi_qz = composition["Qz"]
569
+ phi_kfs = composition["Kfs"]
570
+ phi_pl = composition["Pl"]
571
+ phi_bt = composition["Bt"]
572
+ #
573
+ phi_minerals["Qz"] = phi_qz
574
+ phi_minerals["Kfs"] = phi_kfs
575
+ phi_minerals["Pl"] = phi_pl
576
+ phi_minerals["Bt"] = phi_bt
577
+ #
578
+ else:
579
+ condition_2 = False
580
+ while condition_2 == False:
581
+ phi_qz = round(rd.uniform(0.2, 0.6), 4)
582
+ phi_kfs = round(rd.uniform(0.05, (1.0 - phi_qz)), 4)
583
+ phi_pl = round(rd.uniform(0.25 , (1.0 - phi_qz - phi_kfs)), 4)
584
+ phi_bt = round(1 - phi_qz - phi_kfs - phi_pl, 4)
585
+ phi_total = phi_qz + phi_kfs + phi_pl + phi_bt
586
+ #
587
+ if np.isclose(phi_total, 1.0000) == True:
588
+ if 0.2 <= phi_qz <= 0.6 and 0.05 <= phi_kfs <= 0.28 and 0.25 <= phi_pl <= 0.72 \
589
+ and 0.0 <= phi_bt <= 0.05:
590
+ condition_2 = True
591
+ #
592
+ phi_minerals["Qz"] = phi_qz
593
+ phi_minerals["Kfs"] = phi_kfs
594
+ phi_minerals["Pl"] = phi_pl
595
+ phi_minerals["Bt"] = phi_bt
596
+ #
597
+ rho_s = 0
598
+ for key, value in phi_minerals.items():
599
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
600
+ for element, value in mineralogy[key]["chemistry"].items():
601
+ if element not in elements_list:
602
+ elements_list.append(element)
603
+ w_elements[element] = 0.0
604
+ #
605
+ if elements_list[0] not in results_container["chemistry"]:
606
+ for element in elements_list:
607
+ results_container["chemistry"][element] = []
608
+ #
609
+ rho_s = round(rho_s, 3)
610
+ for key, value in phi_minerals.items():
611
+ if key == "Urn":
612
+ n_digits = 6
613
+ else:
614
+ n_digits = 6
615
+ #
616
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
617
+ #
618
+ if self.porosity == None:
619
+ var_porosity = round(rd.uniform(0.0, 0.1), 4)
620
+ else:
621
+ var_porosity = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
622
+ #
623
+ if self.fluid == "water":
624
+ data_fluid = self.data_water
625
+ elif self.fluid == "oil":
626
+ data_fluid = self.data_oil
627
+ elif self.fluid == "gas":
628
+ data_fluid = self.data_gas
629
+ #
630
+ rho = round((1 - var_porosity)*rho_s + var_porosity*data_fluid[2]/1000, 3)
631
+ #
632
+ old_index = elements_list.index("O")
633
+ elements_list += [elements_list.pop(old_index)]
634
+ #
635
+ w_elements_total = 0.0
636
+ for element in elements_list:
637
+ if element != "O":
638
+ for mineral, w_mineral in w_minerals.items():
639
+ if element in mineralogy[mineral]["chemistry"]:
640
+ if element == "U":
641
+ n_digits = 6
642
+ else:
643
+ n_digits = 6
644
+ #
645
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
646
+ w_elements[element] += value
647
+ w_elements_total += value
648
+ #
649
+ w_elements[element] = round(w_elements[element], n_digits)
650
+ elif element == "O":
651
+ w_elements[element] += round(1 - w_elements_total, 6)
652
+ #
653
+ w_elements[element] = round(w_elements[element], 6)
654
+ #
655
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
656
+ condition = True
657
+ #
658
+ bulk_mod = 0.0
659
+ shear_mod = 0.0
660
+ gamma_ray = 0.0
661
+ photoelectricity = 0.0
662
+ #
663
+ K_list = []
664
+ G_list = []
665
+ phi_list = []
666
+ for key, value in phi_minerals.items():
667
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
668
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
669
+ #
670
+ gamma_ray = round(gamma_ray, 3)
671
+ photoelectricity = round(photoelectricity, 3)
672
+ #
673
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
674
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
675
+ phi_list.append(phi_minerals[key])
676
+ #
677
+ K_geo = elast.calc_geometric_mean(self, phi_list, K_list)
678
+ G_geo = elast.calc_geometric_mean(self, phi_list, G_list)
679
+ #
680
+ # anisotropic_factor = round(rd.uniform(1.0, 2.0), 4)
681
+ anisotropic_factor = 1.0
682
+ #
683
+ bulk_mod = K_geo/anisotropic_factor
684
+ shear_mod = G_geo/anisotropic_factor
685
+ #
686
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
687
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 6)
688
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
689
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
690
+ vPvS = round(vP/vS, 6)
691
+ #
692
+ for key, value in w_minerals.items():
693
+ results_container["mineralogy"][key].append(value)
694
+ #
695
+ for key, value in w_elements.items():
696
+ results_container["chemistry"][key].append(value)
697
+ #
698
+ results_container["phi"].append(var_porosity)
699
+ results_container["rho_s"].append(rho_s)
700
+ results_container["rho"].append(rho)
701
+ results_container["vP"].append(vP)
702
+ results_container["vS"].append(vS)
703
+ results_container["vP/vS"].append(vPvS)
704
+ results_container["K"].append(bulk_mod)
705
+ results_container["G"].append(shear_mod)
706
+ results_container["E"].append(youngs_mod)
707
+ results_container["nu"].append(poisson_rat)
708
+ results_container["GR"].append(gamma_ray)
709
+ results_container["PE"].append(photoelectricity)
710
+ #
711
+ n += 1
712
+ #
713
+ return results_container
714
+ #
715
+ def create_plutonic_rock_streckeisen(self, rock="Granite", number=1, composition=None, enrichment_kfs=None,
716
+ enrichment_pl=None, upper_streckeisen=True, porosity=None):
717
+ results_container = {}
718
+ results_container["rock"] = rock
719
+ results_container["mineralogy"] = {}
720
+ results_container["chemistry"] = {}
721
+ results_container["compounds"] = {}
722
+ results_container["phi"] = []
723
+ results_container["fluid"] = self.fluid
724
+ results_container["rho_s"] = []
725
+ results_container["rho"] = []
726
+ results_container["vP"] = []
727
+ results_container["vS"] = []
728
+ results_container["vP/vS"] = []
729
+ results_container["K"] = []
730
+ results_container["G"] = []
731
+ results_container["E"] = []
732
+ results_container["nu"] = []
733
+ results_container["GR"] = []
734
+ results_container["PE"] = []
735
+ #
736
+ n = 0
737
+ while n < number:
738
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar(
739
+ enrichment=enrichment_kfs)
740
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase(
741
+ enrichment=enrichment_pl)
742
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
743
+ #
744
+ if upper_streckeisen == True:
745
+ mineralogy = {"Qz": self.data_qz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
746
+ "Bt": data_biotite}
747
+ elif upper_streckeisen == False:
748
+ data_nepheline = Tectosilicates(impurity="pure", data_type=True).create_nepheline()
749
+ mineralogy = {"Nph": data_nepheline, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
750
+ "Bt": data_biotite}
751
+ #
752
+ minerals_list = list(mineralogy.keys())
753
+ #
754
+ if minerals_list[0] not in results_container["mineralogy"]:
755
+ for mineral in minerals_list:
756
+ results_container["mineralogy"][mineral] = []
757
+ #
758
+ condition = False
759
+ #
760
+ while condition == False:
761
+ elements_list = []
762
+ phi_minerals = {}
763
+ w_minerals = {}
764
+ w_elements = {}
765
+ #
766
+ if composition != None:
767
+ if upper_streckeisen == True:
768
+ phi_qz = composition["Qz"]
769
+ phi_minerals["Qz"] = phi_qz
770
+ elif upper_streckeisen == False:
771
+ phi_nph = composition["Nph"]
772
+ phi_minerals["Nph"] = phi_nph
773
+ #
774
+ phi_kfs = composition["Kfs"]
775
+ phi_pl = composition["Pl"]
776
+ phi_bt = composition["Bt"]
777
+ #
778
+ phi_minerals["Kfs"] = phi_kfs
779
+ phi_minerals["Pl"] = phi_pl
780
+ phi_minerals["Bt"] = phi_bt
781
+ #
782
+ else:
783
+ condition_2 = False
784
+ while condition_2 == False:
785
+ #
786
+ ## UPPER STRECKEISEN DIAGRAM
787
+ #
788
+ if rock == "Granite":
789
+ qz_limits = [0.2, 0.6]
790
+ kfs_limits = [0.15, 0.8]
791
+ pl_limits = [0.0, 0.52]
792
+ bt_limits = [0.0, 0.05]
793
+ elif rock == "alpha-Granite":
794
+ qz_limits = [0.2, 0.6]
795
+ kfs_limits = [0.25, 0.725]
796
+ pl_limits = [0.04, 0.275]
797
+ bt_limits = [0.0, 0.05]
798
+ elif rock == "beta-Granite":
799
+ qz_limits = [0.2, 0.6]
800
+ kfs_limits = [0.15, 0.525]
801
+ pl_limits = [0.15, 0.525]
802
+ bt_limits = [0.0, 0.05]
803
+ elif rock == "Granodiorite":
804
+ qz_limits = [0.2, 0.6]
805
+ kfs_limits = [0.05, 0.28]
806
+ pl_limits = [0.25, 0.72]
807
+ bt_limits = [0.0, 0.05]
808
+ elif rock == "Tonalite":
809
+ qz_limits = [0.2, 0.6]
810
+ kfs_limits = [0.0, 0.08]
811
+ pl_limits = [0.35, 0.8]
812
+ bt_limits = [0.0, 0.05]
813
+ elif rock == "Monzodiorite":
814
+ qz_limits = [0.0, 0.2]
815
+ kfs_limits = [0.0, 0.35]
816
+ pl_limits = [0.52, 1.0]
817
+ bt_limits = [0.0, 0.05]
818
+ elif rock == "Monzogabbro":
819
+ qz_limits = [0.0, 0.2]
820
+ kfs_limits = [0.08, 0.35]
821
+ pl_limits = [0.52, 0.9]
822
+ bt_limits = [0.0, 0.05]
823
+ elif rock == "Gabbro":
824
+ qz_limits = [0.0, 0.2]
825
+ kfs_limits = [0.0, 0.1]
826
+ pl_limits = [0.72, 1.0]
827
+ bt_limits = [0.0, 0.05]
828
+ elif rock == "Diorite":
829
+ qz_limits = [0.0, 0.2]
830
+ kfs_limits = [0.0, 0.1]
831
+ pl_limits = [0.72, 1.0]
832
+ bt_limits = [0.0, 0.05]
833
+ elif rock == "Monzonite":
834
+ qz_limits = [0.0, 0.2]
835
+ kfs_limits = [0.28, 0.65]
836
+ pl_limits = [0.28, 0.65]
837
+ bt_limits = [0.0, 0.05]
838
+ elif rock == "Syenite":
839
+ qz_limits = [0.0, 0.2]
840
+ kfs_limits = [0.52, 1.0]
841
+ pl_limits = [0.0, 0.35]
842
+ bt_limits = [0.0, 0.05]
843
+ elif rock == "Granitoid":
844
+ qz_limits = [0.6, 0.9]
845
+ kfs_limits = [0.0, 0.4]
846
+ pl_limits = [0.0, 0.4]
847
+ bt_limits = [0.0, 0.05]
848
+ elif rock == "Quarzolite":
849
+ qz_limits = [0.9, 1.0]
850
+ kfs_limits = [0.0, 0.1]
851
+ pl_limits = [0.0, 0.1]
852
+ bt_limits = [0.0, 0.05]
853
+ elif rock == "Norite":
854
+ qz_limits = [0.0, 0.2]
855
+ kfs_limits = [0.0, 0.1]
856
+ pl_limits = [0.72, 1.0]
857
+ bt_limits = [0.0, 0.05]
858
+ #
859
+ ## LOWER STRECKEISEN DIAGRAM
860
+ #
861
+ elif rock == "Foid-bearing Syenite":
862
+ upper_streckeisen = False
863
+ nph_limits = [0.0, 0.1]
864
+ kfs_limits = [0.58, 1.0]
865
+ pl_limits = [0.0, 0.42]
866
+ bt_limits = [0.0, 0.05]
867
+ elif rock == "Foid-bearing Monzonite":
868
+ upper_streckeisen = False
869
+ nph_limits = [0.0, 0.1]
870
+ kfs_limits = [0.32, 0.65]
871
+ pl_limits = [0.32, 0.65]
872
+ bt_limits = [0.0, 0.05]
873
+ elif rock == "Foid-bearing Monzodiorite":
874
+ upper_streckeisen = False
875
+ nph_limits = [0.0, 0.1]
876
+ kfs_limits = [0.0, 0.35]
877
+ pl_limits = [0.58, 1.0]
878
+ bt_limits = [0.0, 0.05]
879
+ elif rock == "Foid-bearing Monzogabbro":
880
+ upper_streckeisen = False
881
+ nph_limits = [0.0, 0.1]
882
+ kfs_limits = [0.0, 0.35]
883
+ pl_limits = [0.58, 1.0]
884
+ bt_limits = [0.0, 0.05]
885
+ elif rock == "Foid Monzosyenite":
886
+ upper_streckeisen = False
887
+ nph_limits = [0.1, 0.6]
888
+ kfs_limits = [0.2, 0.9]
889
+ pl_limits = [0.0, 0.45]
890
+ bt_limits = [0.0, 0.05]
891
+ elif rock == "Foid Monzodiorite":
892
+ upper_streckeisen = False
893
+ nph_limits = [0.1, 0.6]
894
+ kfs_limits = [0.0, 0.45]
895
+ pl_limits = [0.2, 0.9]
896
+ bt_limits = [0.0, 0.05]
897
+ elif rock == "Foid Monzogabbro":
898
+ upper_streckeisen = False
899
+ nph_limits = [0.1, 0.6]
900
+ kfs_limits = [0.0, 0.45]
901
+ pl_limits = [0.2, 0.9]
902
+ bt_limits = [0.0, 0.05]
903
+ elif rock == "Foidolite":
904
+ upper_streckeisen = False
905
+ nph_limits = [0.6, 1.0]
906
+ kfs_limits = [0.0, 0.4]
907
+ pl_limits = [0.0, 0.4]
908
+ bt_limits = [0.0, 0.05]
909
+
910
+ if upper_streckeisen == True:
911
+ phi_qz = round(rd.uniform(qz_limits[0], qz_limits[1]), 4)
912
+ if rock not in ["alpha-Granite", "beta-Granite", "Granite"]:
913
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1.0 - phi_qz)), 4)
914
+ phi_pl = round(rd.uniform(0.0, (1.0 - phi_qz - phi_kfs)), 4)
915
+ else:
916
+ if rock == "alpha-Granite":
917
+ limit_upper_pl = (-1.823*10**(-1)*phi_qz**3 + 2.5*10**(-1)*phi_qz**2 -
918
+ 4.177*10**(-1)*phi_qz + 3.5*10**(-1))
919
+ limit_lower_pl = (-1.823*10**(-1)*phi_qz**3 + 2.5*10**(-1)*phi_qz**2 -
920
+ 1.677*10**(-1)*phi_qz + 1.0*10**(-1))
921
+ phi_pl = round(rd.uniform(limit_lower_pl, limit_upper_pl), 4)
922
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1.0 - phi_qz - phi_pl)), 4)
923
+ elif rock == "beta-Granite":
924
+ limit_upper_pl = (1.823*10**(-1)*phi_qz**3 - 2.5*10**(-1)*phi_qz**2 -
925
+ 5.823*10**(-1)*phi_qz + 6.5*10**(-1))
926
+ limit_lower_pl = (-1.823*10**(-1)*phi_qz**3 + 2.5*10**(-1)*phi_qz**2 -
927
+ 4.177*10**(-1)*phi_qz + 3.5*10**(-1))
928
+ phi_pl = round(rd.uniform(limit_lower_pl, limit_upper_pl), 4)
929
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1.0 - phi_qz - phi_pl)), 4)
930
+ elif rock == "Granite":
931
+ limit_upper_pl = (1.823*10**(-1)*phi_qz**3 - 2.5*10**(-1)*phi_qz**2 -
932
+ 5.823*10**(-1)*phi_qz + 6.5*10**(-1))
933
+ limit_lower_pl = (-1.823*10**(-1)*phi_qz**3 + 2.5*10**(-1)*phi_qz**2 -
934
+ 1.677*10**(-1)*phi_qz + 1.0*10**(-1))
935
+ phi_pl = round(rd.uniform(limit_lower_pl, limit_upper_pl), 4)
936
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1.0 - phi_qz - phi_pl)), 4)
937
+
938
+ phi_bt = round(1 - phi_qz - phi_kfs - phi_pl, 4)
939
+ phi_total = phi_qz + phi_kfs + phi_pl + phi_bt
940
+
941
+ if np.isclose(phi_total, 1.0000) == True:
942
+ if qz_limits[0] <= phi_qz <= qz_limits[1] \
943
+ and kfs_limits[0] <= phi_kfs <= kfs_limits[1] \
944
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
945
+ and bt_limits[0] <= phi_bt <= bt_limits[1]:
946
+ condition_2 = True
947
+
948
+ elif upper_streckeisen == False:
949
+ phi_nph = round(rd.uniform(nph_limits[0], nph_limits[1]), 4)
950
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1.0 - phi_nph)), 4)
951
+ phi_pl = round(rd.uniform(0.0, (1.0 - phi_nph - phi_kfs)), 4)
952
+ phi_bt = round(1 - phi_nph - phi_kfs - phi_pl, 4)
953
+ phi_total = phi_nph + phi_kfs + phi_pl + phi_bt
954
+ #
955
+ if np.isclose(phi_total, 1.0000) == True:
956
+ if nph_limits[0] <= phi_nph <= nph_limits[1] \
957
+ and kfs_limits[0] <= phi_kfs <= kfs_limits[1] \
958
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
959
+ and bt_limits[0] <= phi_bt <= bt_limits[1]:
960
+ condition_2 = True
961
+ #
962
+ if upper_streckeisen == True:
963
+ phi_minerals["Qz"] = phi_qz
964
+ elif upper_streckeisen == False:
965
+ phi_minerals["Nph"] = phi_nph
966
+ #
967
+ phi_minerals["Kfs"] = phi_kfs
968
+ phi_minerals["Pl"] = phi_pl
969
+ phi_minerals["Bt"] = phi_bt
970
+ #
971
+ rho_s = 0
972
+ for key, value in phi_minerals.items():
973
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
974
+ for element, value in mineralogy[key]["chemistry"].items():
975
+ if element not in elements_list:
976
+ elements_list.append(element)
977
+ w_elements[element] = 0.0
978
+ #
979
+ if elements_list[0] not in results_container["chemistry"]:
980
+ for element in elements_list:
981
+ results_container["chemistry"][element] = []
982
+ #
983
+ rho_s = round(rho_s, 3)
984
+ for key, value in phi_minerals.items():
985
+ if key == "Urn":
986
+ n_digits = 6
987
+ else:
988
+ n_digits = 6
989
+ #
990
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
991
+ #
992
+ if self.porosity == None:
993
+ var_porosity = round(rd.uniform(0.0, 0.1), 4)
994
+ else:
995
+ var_porosity = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
996
+ #
997
+ if self.fluid == "water":
998
+ data_fluid = self.data_water
999
+ elif self.fluid == "oil":
1000
+ data_fluid = self.data_oil
1001
+ elif self.fluid == "gas":
1002
+ data_fluid = self.data_gas
1003
+ #
1004
+ rho = round((1 - var_porosity)*rho_s + var_porosity*data_fluid[2]/1000, 3)
1005
+ #
1006
+ old_index = elements_list.index("O")
1007
+ elements_list += [elements_list.pop(old_index)]
1008
+ #
1009
+ w_elements_total = 0.0
1010
+ for element in elements_list:
1011
+ if element != "O":
1012
+ for mineral, w_mineral in w_minerals.items():
1013
+ if element in mineralogy[mineral]["chemistry"]:
1014
+ if element == "U":
1015
+ n_digits = 6
1016
+ else:
1017
+ n_digits = 6
1018
+ #
1019
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1020
+ w_elements[element] += value
1021
+ w_elements_total += value
1022
+ #
1023
+ w_elements[element] = round(w_elements[element], n_digits)
1024
+ elif element == "O":
1025
+ w_elements[element] += round(1 - w_elements_total, 6)
1026
+ #
1027
+ w_elements[element] = round(w_elements[element], 6)
1028
+ #
1029
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
1030
+ for key, value in w_minerals.items():
1031
+ w_minerals[key] = abs(value)
1032
+ #
1033
+ for key, value in w_elements.items():
1034
+ w_elements[key] = abs(value)
1035
+ #
1036
+ condition = True
1037
+ #
1038
+ gamma_ray = 0.0
1039
+ photoelectricity = 0.0
1040
+ #
1041
+ for key, value in phi_minerals.items():
1042
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
1043
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
1044
+ #
1045
+ ## Bulk Density, Porosity, Seismic Velocities
1046
+ rho_solid = round(rho_s, 3)
1047
+ vP, vS, vPvS, rho, var_porosity = SeismicVelocities(
1048
+ rho_solid=rho_solid, rho_fluid=self.data_water[2]).calculate_seismic_velocities(
1049
+ rho_limits=[2500, 3000], vP_limits=[6000, 7500], vS_limits=[3500, 4000], delta=0.05,
1050
+ porosity=porosity)
1051
+ #
1052
+ ## Elastic Parameters
1053
+ bulk_modulus, shear_modulus, youngs_modulus, poisson_ratio = SeismicVelocities(
1054
+ rho_solid=None, rho_fluid=None).calculate_elastic_properties(
1055
+ rho=rho, vP=vP, vS=vS)
1056
+ #
1057
+ ## Gamma Ray
1058
+ gamma_ray = round(gamma_ray, 3)
1059
+ ## Photoelectricity
1060
+ photoelectricity = round(photoelectricity, 3)
1061
+ # Composition data
1062
+ for key, value in w_minerals.items():
1063
+ results_container["mineralogy"][key].append(value)
1064
+
1065
+ amounts = []
1066
+ for key, value in w_elements.items():
1067
+ results_container["chemistry"][key].append(value)
1068
+ chem_data = PeriodicSystem(name=key).get_data()
1069
+ amounts.append([key, chem_data[1], value])
1070
+
1071
+ list_elements = list(w_elements.keys())
1072
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
1073
+ composition_oxides = {}
1074
+ for var_oxide in list_oxides:
1075
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1076
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1077
+
1078
+ if list_oxides[0] not in results_container["compounds"]:
1079
+ for oxide in list_oxides:
1080
+ results_container["compounds"][oxide] = []
1081
+
1082
+ for key, value in composition_oxides.items():
1083
+ results_container["compounds"][key].append(value)
1084
+
1085
+ results_container["mineralogy"] = dict(sorted(
1086
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1087
+ results_container["chemistry"] = dict(sorted(
1088
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1089
+ results_container["compounds"] = dict(sorted(
1090
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1091
+
1092
+ # Results
1093
+ results_container["phi"].append(var_porosity)
1094
+ results_container["rho_s"].append(rho_s)
1095
+ results_container["rho"].append(rho)
1096
+ results_container["vP"].append(vP)
1097
+ results_container["vS"].append(vS)
1098
+ results_container["vP/vS"].append(vPvS)
1099
+ results_container["K"].append(bulk_modulus)
1100
+ results_container["G"].append(shear_modulus)
1101
+ results_container["E"].append(youngs_modulus)
1102
+ results_container["nu"].append(poisson_ratio)
1103
+ results_container["GR"].append(gamma_ray)
1104
+ results_container["PE"].append(photoelectricity)
1105
+ #
1106
+ n += 1
1107
+ #
1108
+ return results_container
1109
+
1110
+ def create_felsic(self, w_Na=None, w_Mg=None, w_K=None, w_Ca=None, w_Fe = None, amounts=None):
1111
+ #
1112
+ self.w_Na = w_Na
1113
+ self.w_Mg = w_Mg
1114
+ self.w_K = w_K
1115
+ self.w_Ca = w_Ca
1116
+ self.w_Fe = w_Fe
1117
+ self.amounts = amounts
1118
+ #
1119
+ # Mineralogy + Fluids
1120
+ quartz = minerals.oxides.quartz("")
1121
+ alkalifeldspar = minerals.feldspars.alkalifeldspar(self, "K")
1122
+ plagioclase = minerals.feldspars.plagioclase(self, "Na")
1123
+ biotite = minerals.Biotites.biotite_group(self, "Biotite")
1124
+ muscovite = minerals.phyllosilicates.muscovite("")
1125
+ amphibole = minerals.inosilicates.amphibole_na("")
1126
+ mineralogy = [quartz, alkalifeldspar, plagioclase, biotite, muscovite, amphibole]
1127
+ water = fluids.Water.water("")
1128
+ #
1129
+ data = []
1130
+ #
1131
+ cond = False
1132
+ composition = []
1133
+ while cond == False:
1134
+ if self.w_Na == None and self.w_Mg == None and self.w_K == None and self.w_Ca == None and self.w_Fe == None and self.amounts == None:
1135
+ x = rd.uniform(0.0, 1.0)
1136
+ phi_qz = round(abs(-24.95*x**3 + 50.32*x**2 - 21.44*x + 96 - (574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82))/100, 4)
1137
+ phi_kfs = round(abs(574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82 - (45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4))/100, 4)
1138
+ phi_pl = round(abs(45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4 - (-23.27*x**3 + 54.32*x**2 + 0.37*x))/100, 4)
1139
+ phi_bt = round(abs(-23.27*x**3 + 54.32*x**2 + 0.37*x - (1.9*x**3 + 17.13*x**2 + 2.24*x))/100, 4)
1140
+ phi_ms = round(abs(100 - (-24.95*x**3 + 50.32*x**2 - 21.44*x + 96))/100, 4)
1141
+ phi_amph = round(abs(1.9*x**3 + 17.13*x**2 + 2.24*x)/100, 4)
1142
+ m_total = phi_qz*quartz[2] + phi_kfs*alkalifeldspar[2] + phi_pl*plagioclase[2] + phi_bt*biotite[2] + phi_ms*muscovite[2] + phi_amph*amphibole[2]
1143
+ w_qz = round(phi_qz*quartz[2]/m_total, 4)
1144
+ w_kfs = round(phi_kfs*alkalifeldspar[2]/m_total, 4)
1145
+ w_pl = round(phi_pl*plagioclase[2]/m_total, 4)
1146
+ w_bt = round(phi_bt*biotite[2]/m_total, 4)
1147
+ w_ms = round(phi_ms*muscovite[2]/m_total, 4)
1148
+ w_amph = round(phi_amph*amphibole[2]/m_total, 4)
1149
+ elif self.w_Na != None:
1150
+ w_kfs = round(abs(574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82 - (45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4))/100, 4)
1151
+ w_pl = round(abs(45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4 - (-23.27*x**3 + 54.32*x**2 + 0.37*x))/100, 4)
1152
+ w_amph = round((self.w_Na - w_kfs*alkalifeldspar[6][1] - w_pl*plagioclase[6][1])/(amphibole[6][2]), 4)
1153
+ w_qz = round(abs(-24.95*x**3 + 50.32*x**2 - 21.44*x + 96 - (574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82))/100, 4)
1154
+ w_bt = round(abs(-23.27*x**3 + 54.32*x**2 + 0.37*x - (1.9*x**3 + 17.13*x**2 + 2.24*x))/100, 4)
1155
+ w_ms = round(1-w_qz-w_kfs-w_pl-w_bt-w_amph, 4)
1156
+ elif self.w_Mg != None:
1157
+ w_bt = round((self.w_Mg)/(biotite[6][3]), 4)
1158
+ w_qz = round(abs(-24.95*x**3 + 50.32*x**2 - 21.44*x + 96 - (574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82))/100, 4)
1159
+ w_kfs = round(abs(574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82 - (45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4))/100, 4)
1160
+ w_pl = round(abs(45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4 - (-23.27*x**3 + 54.32*x**2 + 0.37*x))/100, 4)
1161
+ w_ms = round(abs(100 - (-24.95*x**3 + 50.32*x**2 - 21.44*x + 96))/100, 4)
1162
+ w_amph = round(1-w_qz-w_kfs-w_pl-w_bt-w_ms, 4)
1163
+ elif self.w_K != None:
1164
+ w_bt = round(abs(-23.27*x**3 + 54.32*x**2 + 0.37*x - (1.9*x**3 + 17.13*x**2 + 2.24*x))/100, 4)
1165
+ w_ms = round(abs(100 - (-24.95*x**3 + 50.32*x**2 - 21.44*x + 96))/100, 4)
1166
+ w_kfs = round((self.w_K - w_bt*biotite[6][6] - w_ms*muscovite[6][5])/(alkalifeldspar[6][4]), 4)
1167
+ w_qz = round(abs(-24.95*x**3 + 50.32*x**2 - 21.44*x + 96 - (574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82))/100, 4)
1168
+ w_pl = round(abs(45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4 - (-23.27*x**3 + 54.32*x**2 + 0.37*x))/100, 4)
1169
+ w_amph = round(1-w_qz-w_kfs-w_pl-w_bt-w_ms, 4)
1170
+ elif self.w_Ca != None:
1171
+ w_pl = round((self.w_Ca)/(plagioclase[6][4]), 4)
1172
+ w_qz = round(abs(-24.95*x**3 + 50.32*x**2 - 21.44*x + 96 - (574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82))/100, 4)
1173
+ w_kfs = round(abs(574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82 - (45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4))/100, 4)
1174
+ w_bt = round(abs(-23.27*x**3 + 54.32*x**2 + 0.37*x - (1.9*x**3 + 17.13*x**2 + 2.24*x))/100, 4)
1175
+ w_ms = round(abs(100 - (-24.95*x**3 + 50.32*x**2 - 21.44*x + 96))/100, 4)
1176
+ w_amph = round(1-w_qz-w_kfs-w_pl-w_bt-w_ms, 4)
1177
+ elif self.w_Fe != None:
1178
+ w_bt = round(abs(-23.27*x**3 + 54.32*x**2 + 0.37*x - (1.9*x**3 + 17.13*x**2 + 2.24*x))/100, 4)
1179
+ w_amph = round((self.w_Fe - w_bt*biotite[6][7])/(amphibole[6][4]), 4)
1180
+ w_qz = round(abs(-24.95*x**3 + 50.32*x**2 - 21.44*x + 96 - (574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82))/100, 4)
1181
+ w_kfs = round(abs(574.08*x**5 - 1466.01*x**4 + 1220.19*x**3 - 285.57*x**2 - 33.17*x + 82 - (45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4))/100, 4)
1182
+ w_pl = round(abs(45.95*x**3 - 0.2*x**2 + 24.45*x + 13.4 - (-23.27*x**3 + 54.32*x**2 + 0.37*x))/100, 4)
1183
+ w_ms = round(1-w_qz-w_kfs-w_pl-w_bt-w_amph, 4)
1184
+ elif type(self.amounts) is list:
1185
+ w_qz = round(abs(np.random.normal(self.amounts[0], 0.0025)), 4)
1186
+ w_kfs = round(abs(np.random.normal(self.amounts[1], 0.0025)), 4)
1187
+ w_pl = round(abs(np.random.normal(self.amounts[2], 0.0025)), 4)
1188
+ w_bt = round(abs(np.random.normal(self.amounts[3], 0.0025)), 4)
1189
+ w_ms = round(abs(np.random.normal(self.amounts[4], 0.00025)), 4)
1190
+ w_amph = round(1-w_qz-w_kfs-w_pl-w_bt-w_ms, 4)
1191
+ #
1192
+ if w_qz >= 0.0 and w_kfs >= 0.0 and w_pl >= 0.0 and w_bt >= 0.0 and w_ms >= 0.0 and w_amph >= 0.0:
1193
+ sumMin = round(w_qz + w_kfs + w_pl + w_bt + w_ms + w_amph, 4)
1194
+ else:
1195
+ sumMin = 0
1196
+ #
1197
+ w_H = round(w_bt*biotite[6][0] + w_ms*muscovite[6][0] + w_amph*amphibole[6][0], 4)
1198
+ w_F = round(w_bt*biotite[6][2] + w_ms*muscovite[6][2], 4)
1199
+ w_Na = round(w_kfs*alkalifeldspar[6][1] + w_pl*plagioclase[6][1] + w_amph*amphibole[6][2], 4)
1200
+ w_Mg = round(w_bt*biotite[6][3], 4)
1201
+ w_Al = round(w_kfs*alkalifeldspar[6][2] + w_pl*plagioclase[6][2] + w_bt*biotite[6][4] + w_ms*muscovite[6][3], 4)
1202
+ w_Si = round(w_qz*quartz[6][1] + w_kfs*alkalifeldspar[6][3] + w_pl*plagioclase[6][3] + w_bt*biotite[6][5] + w_ms*muscovite[6][4] + w_amph*amphibole[6][3], 4)
1203
+ w_K = round(w_kfs*alkalifeldspar[6][4] + w_bt*biotite[6][6] + w_ms*muscovite[6][5], 4)
1204
+ w_Ca = round(w_pl*plagioclase[6][4], 4)
1205
+ w_Fe = round(w_bt*biotite[6][7] + w_amph*amphibole[6][4], 4)
1206
+ w_O = round(1 - w_H - w_F - w_Na - w_Mg - w_Al - w_Si - w_K - w_Ca - w_Fe, 4)
1207
+ sumConc = round(w_H + w_O + w_F + w_Na + w_Mg + w_Al + w_Si + w_K + w_Ca + w_Fe, 4)
1208
+ #
1209
+ if sumMin == 1 and sumConc == 1:
1210
+ composition.extend((["Qz", "Kfs", "Pl", "Bt", "Ms", "Amph"]))
1211
+ concentrations = [w_H, w_O, w_F, w_Na, w_Mg, w_Al, w_Si, w_K, w_Ca, w_Fe]
1212
+ amounts = [w_qz, w_kfs, w_pl, w_bt, w_ms, w_amph]
1213
+ phi_V = geochemistry.Fractions.calculate_volume_fraction(self, mineralogy=mineralogy, w=amounts)
1214
+ if 0.20 <= phi_V[0] <= 0.6 and 0.15 <= phi_V[1] <= 0.8 and 0.0 <= phi_V[2] <= 0.52:
1215
+ cond = True
1216
+ else:
1217
+ composition = []
1218
+ cond = False
1219
+ else:
1220
+ cond = False
1221
+ data.append(composition)
1222
+ #
1223
+ rhoSolid = (w_qz*quartz[2] + w_kfs*alkalifeldspar[2] + w_pl*plagioclase[2] + w_bt*biotite[2] + w_ms*muscovite[2] + w_amph*amphibole[2]) / 1000
1224
+ X = [w_qz, w_kfs, w_pl, w_bt, w_ms, w_amph]
1225
+ K_list = [mineralogy[i][3][0] for i in range(len(mineralogy))]
1226
+ G_list = [mineralogy[i][3][1] for i in range(len(mineralogy))]
1227
+ K_geo = elast.calc_geometric_mean(self, X, K_list)
1228
+ G_geo = elast.calc_geometric_mean(self, X, G_list)
1229
+ K_solid = K_geo
1230
+ G_solid = G_geo
1231
+ vP_solid = 0.85*np.sqrt((K_solid*10**9+4/3*G_solid*10**9)/(rhoSolid*10**3))
1232
+ vS_solid = 0.85*np.sqrt((G_solid*10**9)/(rhoSolid*10**3))
1233
+ E_solid = (9*K_solid*G_solid)/(3*K_solid+G_solid)
1234
+ nu_solid = (3*K_solid-2*G_solid)/(2*(3*K_solid+G_solid))
1235
+ #
1236
+ if self.porosity == None:
1237
+ if self.actualThickness <= 1000:
1238
+ phi = rd.uniform(0.0, 0.025)
1239
+ elif self.actualThickness > 1000 and self.actualThickness <= 2000:
1240
+ phi = rd.uniform(0.0, 0.025)
1241
+ elif self.actualThickness > 2000 and self.actualThickness <= 3000:
1242
+ phi = rd.uniform(0.0, 0.025)
1243
+ elif self.actualThickness > 3000 and self.actualThickness <= 4000:
1244
+ phi = rd.uniform(0.0, 0.025)
1245
+ elif self.actualThickness > 4000:
1246
+ phi = rd.uniform(0.0, 0.025)
1247
+ else:
1248
+ phi = self.porosity
1249
+ #
1250
+ rho = (1 - phi) * rhoSolid + phi * water[2] / 1000
1251
+ vP = (1-phi)*vP_solid + phi*water[4][0]
1252
+ vS = (1 - phi) * vS_solid
1253
+ G_bulk = vS**2 * rho
1254
+ K_bulk = vP**2 * rho - 4/3*G_bulk
1255
+ E_bulk = (9*K_bulk*G_bulk)/(3*K_bulk+G_bulk)
1256
+ phiD = (rhoSolid - rho) / (rhoSolid - water[2] / 1000)
1257
+ phiN = (2 * phi ** 2 - phiD ** 2) ** (0.5)
1258
+ GR = w_qz*quartz[5][0] + w_kfs*alkalifeldspar[5][0] + w_pl*plagioclase[5][0] + w_bt*biotite[5][0] + w_ms*muscovite[5][0] + w_amph*amphibole[5][0]
1259
+ PE = w_qz*quartz[5][1] + w_kfs*alkalifeldspar[5][1] + w_pl*plagioclase[5][1] + w_bt*biotite[5][1] + w_ms*muscovite[5][1] + w_amph*amphibole[5][1]
1260
+ poisson_mineralogical = w_qz*quartz[3][3] + w_kfs*alkalifeldspar[3][3] + w_pl*plagioclase[3][3] + w_bt*biotite[3][3] + w_ms*muscovite[3][3] + w_amph*amphibole[3][3]
1261
+ #
1262
+ if self.dict_output == False:
1263
+ data.append([round(rho, 3), round(rhoSolid, 3), round(water[2] / 1000, 6)])
1264
+ data.append([round(K_bulk*10**(-6), 2), round(G_bulk*10**(-6), 2), round(E_bulk*10**(-6), 2), round(poisson_mineralogical, 3)])
1265
+ data.append([round(vP, 2), round(vS, 2), round(vP_solid, 2), round(water[4][0], 2)])
1266
+ data.append([round(phi, 3), round(phiD, 3), round(phiN, 3)])
1267
+ data.append("water")
1268
+ data.append([round(GR, 3), round(PE, 3)])
1269
+ data.append(concentrations)
1270
+ data.append(amounts)
1271
+ #
1272
+ return data
1273
+ else:
1274
+ results = {}
1275
+ results["rock"] = "Felsic Rock"
1276
+ #
1277
+ element_list = ["H", "O", "F", "Na", "Mg", "Al", "Si", "K", "Ca", "Fe"]
1278
+ mineral_list = ["Qz", "Kfs", "Pl", "Bt", "Ms", "Amph"]
1279
+ data.append(composition)
1280
+ results["chemistry"] = {}
1281
+ results["mineralogy"] = {}
1282
+ for index, element in enumerate(element_list, start=0):
1283
+ results["chemistry"][element] = concentrations[index]
1284
+ for index, mineral in enumerate(mineral_list, start=0):
1285
+ results["mineralogy"][mineral] = amounts[index]
1286
+ #
1287
+ results["phi"] = round(phi, 4)
1288
+ results["fluid"] = self.fluid
1289
+ #
1290
+ results["rho"] = round(rho*1000, 4)
1291
+ results["vP"] = round(vP, 4)
1292
+ results["vS"] = round(vS, 4)
1293
+ results["vP/vS"] = round(vP/vS, 4)
1294
+ results["G"] = round(G_bulk*10**(-6), 4)
1295
+ results["K"] = round(K_bulk*10**(-6), 4)
1296
+ results["E"] = round(E_bulk*10**(-6), 4)
1297
+ results["nu"] = round(poisson_mineralogical, 4)
1298
+ results["GR"] = round(GR, 4)
1299
+ results["PE"] = round(PE, 4)
1300
+ #
1301
+ return results
1302
+ #
1303
+ def create_intermediate(self, amounts=None):
1304
+ #
1305
+ self.amounts = amounts
1306
+ #
1307
+ results = {}
1308
+ results["rock"] = "Intermediate Rock"
1309
+ #
1310
+ # Mineralogy + Fluids
1311
+ data_kfs = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
1312
+ data_pl = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1313
+ data_bt = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
1314
+ data_amph = Inosilicates(impurity="pure", data_type=True).create_calcium_amphibole()
1315
+ data_px = Inosilicates(impurity="pure", data_type=True).create_calium_pyroxene()
1316
+ #
1317
+ minerals_list = [self.data_qz, data_kfs, data_pl, data_bt, data_amph, data_px]
1318
+ water = fluids.Water.water("")
1319
+ #
1320
+ elements_list = []
1321
+ for mineral in minerals_list:
1322
+ elements_mineral = list(mineral["chemistry"].keys())
1323
+ for element in elements_mineral:
1324
+ if element not in elements_list:
1325
+ elements_list.append(element)
1326
+ elements_list.sort()
1327
+ #
1328
+ data = []
1329
+ #
1330
+ cond = False
1331
+ while cond == False:
1332
+ if self.amounts == None:
1333
+ x = rd.uniform(0.0, 1.0)
1334
+ phi_qz = round(abs(100 - (17.97*x**3 - 32.67*x**2 + 26.71*x + 91 - 3*x))/100, 4)
1335
+ phi_kfs = round(abs(17.97*x**3 - 32.67*x**2 + 26.71*x + 91 - 3*x - (121.55*x**5 - 358.74*x**4 + 402.63*x**3 - 224.97*x**2 + 77.15*x + 81.5))/100, 4)
1336
+ phi_pl = round(abs(121.55*x**5 - 358.74*x**4 + 402.63*x**3 - 224.97*x**2 + 77.15*x + 81.5 - (9.48*x**3 - 14.12*x**2 + 30.33*x + 31))/100, 4)
1337
+ phi_bt = round(abs(9.48*x**3 - 14.12*x**2 + 30.33*x + 31 - (-274.33*x**5 + 771.98*x**4 - 755.27*x**3 + 275.7*x**2 + 17.43*x + 20.9))/100, 4)
1338
+ phi_amph = round(abs(-274.33*x**5 + 771.98*x**4 - 755.27*x**3 + 275.7*x**2 + 17.43*x + 20.9 - (-2.07*x**3 + 30.77*x**2 + 0.5*x))/100, 4)
1339
+ phi_pyx = round(abs(-2.07*x**3 + 30.77*x**2 + 0.5*x)/100, 4)
1340
+ m_total = phi_qz*self.data_qz["rho"] + phi_kfs*data_kfs["rho"] + phi_pl*data_pl["rho"] + phi_bt*data_bt["rho"] + phi_amph*data_amph["rho"] + phi_pyx*data_px["rho"]
1341
+ w_qz = round(phi_qz*self.data_qz["rho"]/m_total, 4)
1342
+ w_kfs = round(phi_kfs*data_kfs["rho"]/m_total, 4)
1343
+ w_pl = round(phi_pl*data_pl["rho"]/m_total, 4)
1344
+ w_bt = round(phi_bt*data_bt["rho"]/m_total, 4)
1345
+ w_amph = round(phi_amph*data_amph["rho"]/m_total, 4)
1346
+ w_pyx = round(phi_pyx*data_px["rho"]/m_total, 4)
1347
+ elif type(self.amounts) is list:
1348
+ w_qz = round(abs(np.random.normal(self.amounts[0], 0.00025)), 4)
1349
+ w_kfs = round(abs(np.random.normal(self.amounts[1], 0.0025)), 4)
1350
+ w_pl = round(abs(np.random.normal(self.amounts[2], 0.0025)), 4)
1351
+ w_bt = round(abs(np.random.normal(self.amounts[3], 0.0025)), 4)
1352
+ w_amph = round(abs(np.random.normal(self.amounts[4], 0.0025)), 4)
1353
+ w_pyx = round(1-w_qz-w_kfs-w_pl-w_bt-w_amph, 4)
1354
+ #
1355
+ if w_qz >= 0.0 and w_kfs >= 0.0 and w_pl >= 0.0 and w_bt >= 0.0 and w_amph >= 0.0 and w_pyx >= 0.0:
1356
+ sumMin = round(w_qz + w_kfs + w_pl + w_bt + w_amph + w_pyx, 4)
1357
+ else:
1358
+ sumMin = 0
1359
+ #
1360
+ mineral_amounts = {}
1361
+ mineral_amounts["Qz"] = w_qz
1362
+ mineral_amounts["Kfs"] = w_kfs
1363
+ mineral_amounts["Pl"] = w_pl
1364
+ mineral_amounts["Bt"] = w_bt
1365
+ mineral_amounts["Amph"] = w_amph
1366
+ mineral_amounts["Px"] = w_pyx
1367
+ #
1368
+ element_amounts = {}
1369
+ w_O = 1
1370
+ w_sum = 0
1371
+ for element in elements_list:
1372
+ if element != "O":
1373
+ element_amounts[element] = 0
1374
+ for mineral in minerals_list:
1375
+ if element in mineral["chemistry"]:
1376
+ element_amounts[element] += round(mineral["chemistry"][element]*mineral_amounts[mineral["mineral"]], 4)
1377
+ element_amounts[element] = round(element_amounts[element], 4)
1378
+ w_sum += element_amounts[element]
1379
+ w_O -= element_amounts[element]
1380
+ element_amounts["O"] = round(w_O, 4)
1381
+ w_sum += element_amounts["O"]
1382
+ if sumMin == 1 and w_sum == 1:
1383
+ cond = True
1384
+ else:
1385
+ cond = False
1386
+ #
1387
+ results["mineralogy"] = mineral_amounts
1388
+ results["chemistry"] = element_amounts
1389
+ #
1390
+ rhoSolid = 0
1391
+ K_list = []
1392
+ G_list = []
1393
+ for mineral in minerals_list:
1394
+ rhoSolid += mineral["rho"]*mineral_amounts[mineral["mineral"]]/1000
1395
+ K_list.append(round(mineral["K"]*mineral_amounts[mineral["mineral"]], 3))
1396
+ G_list.append(round(mineral["G"]*mineral_amounts[mineral["mineral"]], 3))
1397
+ X = [w_qz, w_kfs, w_pl, w_bt, w_amph, w_pyx]
1398
+ K_geo = elast.calc_geometric_mean(self, X, K_list)
1399
+ G_geo = elast.calc_geometric_mean(self, X, G_list)
1400
+ K_solid = K_geo
1401
+ G_solid = G_geo
1402
+ vP_solid = np.sqrt((K_solid*10**9+4/3*G_solid*10**9)/(rhoSolid*10**3))
1403
+ vS_solid = np.sqrt((G_solid*10**9)/(rhoSolid*10**3))
1404
+ #
1405
+ if self.porosity == None:
1406
+ if self.actualThickness <= 1000:
1407
+ phi = rd.uniform(0.0, 0.025)
1408
+ elif self.actualThickness > 1000 and self.actualThickness <= 2000:
1409
+ phi = rd.uniform(0.0, 0.025)
1410
+ elif self.actualThickness > 2000 and self.actualThickness <= 3000:
1411
+ phi = rd.uniform(0.0, 0.025)
1412
+ elif self.actualThickness > 3000 and self.actualThickness <= 4000:
1413
+ phi = rd.uniform(0.0, 0.025)
1414
+ elif self.actualThickness > 4000:
1415
+ phi = rd.uniform(0.0, 0.025)
1416
+ else:
1417
+ phi = self.porosity
1418
+ phi = round(phi, 4)
1419
+ results["phi"] = phi
1420
+ results["fluid"] = self.fluid
1421
+ #
1422
+ rho = (1 - phi)*rhoSolid + phi*water[2]/1000
1423
+ vP = (1 - phi)*vP_solid + phi*water[4][0]
1424
+ vS = (1 - phi)*vS_solid
1425
+ #
1426
+ G_bulk = vS**2 * rho
1427
+ K_bulk = vP**2 * rho - 4/3*G_bulk
1428
+ E_bulk = (9*K_bulk*G_bulk)/(3*K_bulk+G_bulk)
1429
+ phiD = (rhoSolid - rho) / (rhoSolid - water[2] / 1000)
1430
+ phiN = (2 * phi ** 2 - phiD ** 2) ** (0.5)
1431
+ #
1432
+ GR = 0
1433
+ PE = 0
1434
+ poisson_mineralogical = 0
1435
+ for mineral in minerals_list:
1436
+ GR += mineral["GR"]*mineral_amounts[mineral["mineral"]]
1437
+ PE += mineral["PE"]*mineral_amounts[mineral["mineral"]]
1438
+ poisson_mineralogical += mineral["nu"]*mineral_amounts[mineral["mineral"]]
1439
+ #
1440
+ if self.dict_output == False:
1441
+ data.append([round(rho, 3), round(rhoSolid, 3), round(water[2] / 1000, 3)])
1442
+ data.append([round(K_bulk*10**(-6), 2), round(G_bulk*10**(-6), 2), round(E_bulk*10**(-6), 2), round(poisson_mineralogical, 3)])
1443
+ data.append([round(vP, 2), round(vS, 2), round(vP_solid, 2), round(water[4][0], 2)])
1444
+ data.append([round(phi, 3), round(phiD, 3), round(phiN, 3)])
1445
+ data.append(self.fluid)
1446
+ data.append([round(GR, 3), round(PE, 3)])
1447
+ data.append(amounts)
1448
+ #
1449
+ return data
1450
+ else:
1451
+ results["rho"] = round(rho*1000, 4)
1452
+ results["vP"] = round(vP, 4)
1453
+ results["vS"] = round(vS, 4)
1454
+ results["vP/vS"] = round(vP/vS, 4)
1455
+ results["K"] = round(K_bulk*10**(-6), 4)
1456
+ results["G"] = round(G_bulk*10**(-6), 4)
1457
+ results["E"] = round(E_bulk*10**(-6), 4)
1458
+ results["nu"] = round(poisson_mineralogical, 4)
1459
+ results["GR"] = round(GR, 4)
1460
+ results["PE"] = round(PE, 4)
1461
+ #
1462
+ return results
1463
+
1464
+ class Volcanic:
1465
+ #
1466
+ def __init__(self, fluid, actualThickness, dict_output=False, porosity=None):
1467
+ self.fluid = fluid
1468
+ self.actualThickness = actualThickness
1469
+ self.dict_output = dict_output
1470
+ self.porosity = porosity
1471
+ #
1472
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
1473
+ #
1474
+ self.data_water = Water.water("")
1475
+ self.data_oil = Hydrocarbons.oil("")
1476
+ self.data_gas = Hydrocarbons.natural_gas("")
1477
+ #
1478
+ def create_volcanic_rock_streckeisen(self, rock="Rhyolite", number=1, composition=None, enrichment_kfs=None,
1479
+ enrichment_pl=None, upper_streckeisen=True):
1480
+ results_container = {}
1481
+ results_container["rock"] = rock
1482
+ results_container["mineralogy"] = {}
1483
+ results_container["chemistry"] = {}
1484
+ results_container["compounds"] = {}
1485
+ results_container["phi"] = []
1486
+ results_container["fluid"] = self.fluid
1487
+ results_container["rho_s"] = []
1488
+ results_container["rho"] = []
1489
+ results_container["vP"] = []
1490
+ results_container["vS"] = []
1491
+ results_container["vP/vS"] = []
1492
+ results_container["K"] = []
1493
+ results_container["G"] = []
1494
+ results_container["E"] = []
1495
+ results_container["nu"] = []
1496
+ results_container["GR"] = []
1497
+ results_container["PE"] = []
1498
+ #
1499
+ n = 0
1500
+ while n < number:
1501
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar(
1502
+ enrichment=enrichment_kfs)
1503
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase(
1504
+ enrichment=enrichment_pl)
1505
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
1506
+ #
1507
+ if upper_streckeisen == True:
1508
+ mineralogy = {"Qz": self.data_quartz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
1509
+ "Bt": data_biotite}
1510
+ elif upper_streckeisen == False:
1511
+ data_nepheline = Tectosilicates(impurity="pure", data_type=True).create_nepheline()
1512
+ mineralogy = {"Nph": data_nepheline, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
1513
+ "Bt": data_biotite}
1514
+ #
1515
+ minerals_list = list(mineralogy.keys())
1516
+ #
1517
+ if minerals_list[0] not in results_container["mineralogy"]:
1518
+ for mineral in minerals_list:
1519
+ results_container["mineralogy"][mineral] = []
1520
+ #
1521
+ condition = False
1522
+ #
1523
+ while condition == False:
1524
+ elements_list = []
1525
+ phi_minerals = {}
1526
+ w_minerals = {}
1527
+ w_elements = {}
1528
+ #
1529
+ if composition != None:
1530
+ if upper_streckeisen == True:
1531
+ phi_qz = composition["Qz"]
1532
+ phi_minerals["Qz"] = phi_qz
1533
+ elif upper_streckeisen == False:
1534
+ phi_nph = composition["Nph"]
1535
+ phi_minerals["Nph"] = phi_nph
1536
+ #
1537
+ phi_kfs = composition["Kfs"]
1538
+ phi_pl = composition["Pl"]
1539
+ phi_bt = composition["Bt"]
1540
+ #
1541
+ phi_minerals["Kfs"] = phi_kfs
1542
+ phi_minerals["Pl"] = phi_pl
1543
+ phi_minerals["Bt"] = phi_bt
1544
+ #
1545
+ else:
1546
+ condition_2 = False
1547
+ while condition_2 == False:
1548
+ #
1549
+ ## UPPER STRECKEISEN DIAGRAM
1550
+ #
1551
+ if rock == "Rhyolite":
1552
+ qz_limits = [0.2, 0.6]
1553
+ kfs_limits = [0.15, 0.8]
1554
+ pl_limits = [0.0, 0.52]
1555
+ bt_limits = [0.0, 0.05]
1556
+ elif rock == "Dacite":
1557
+ qz_limits = [0.2, 0.6]
1558
+ kfs_limits = [0.0, 0.28]
1559
+ pl_limits = [0.25, 0.8]
1560
+ bt_limits = [0.0, 0.05]
1561
+ elif rock == "Trachyte":
1562
+ qz_limits = [0.0, 0.2]
1563
+ kfs_limits = [0.52, 1.0]
1564
+ pl_limits = [0.0, 0.35]
1565
+ bt_limits = [0.0, 0.05]
1566
+ elif rock == "Latite":
1567
+ qz_limits = [0.0, 0.2]
1568
+ kfs_limits = [0.28, 0.65]
1569
+ pl_limits = [0.28, 0.65]
1570
+ bt_limits = [0.0, 0.05]
1571
+ elif rock == "Andesite":
1572
+ qz_limits = [0.0, 0.2]
1573
+ kfs_limits = [0.0, 0.35]
1574
+ pl_limits = [0.52, 1.0]
1575
+ bt_limits = [0.0, 0.05]
1576
+ elif rock == "Basalt":
1577
+ qz_limits = [0.0, 0.2]
1578
+ kfs_limits = [0.0, 0.35]
1579
+ pl_limits = [0.52, 1.0]
1580
+ bt_limits = [0.0, 0.05]
1581
+ #
1582
+ ## LOWER STRECKEISEN DIAGRAM
1583
+ #
1584
+ elif rock == "Foid-bearing Trachyte":
1585
+ upper_streckeisen = False
1586
+ nph_limits = [0.0, 0.1]
1587
+ kfs_limits = [0.58, 1.0]
1588
+ pl_limits = [0.0, 0.35]
1589
+ bt_limits = [0.0, 0.05]
1590
+ elif rock == "Foid-bearing Latite":
1591
+ upper_streckeisen = False
1592
+ nph_limits = [0.0, 0.1]
1593
+ kfs_limits = [0.32, 0.65]
1594
+ pl_limits = [0.35, 0.68]
1595
+ bt_limits = [0.0, 0.05]
1596
+ elif rock == "Foid-bearing Andesite":
1597
+ upper_streckeisen = False
1598
+ nph_limits = [0.0, 0.1]
1599
+ kfs_limits = [0.0, 0.35]
1600
+ pl_limits = [0.58, 1.0]
1601
+ bt_limits = [0.0, 0.05]
1602
+ elif rock == "Foid-bearing Basalt":
1603
+ upper_streckeisen = False
1604
+ nph_limits = [0.0, 0.1]
1605
+ kfs_limits = [0.0, 0.35]
1606
+ pl_limits = [0.58, 1.0]
1607
+ bt_limits = [0.0, 0.05]
1608
+ elif rock == "Phonolite":
1609
+ upper_streckeisen = False
1610
+ nph_limits = [0.1, 0.6]
1611
+ kfs_limits = [0.2, 0.9]
1612
+ pl_limits = [0.0, 0.45]
1613
+ bt_limits = [0.0, 0.05]
1614
+ elif rock == "Tephrite":
1615
+ upper_streckeisen = False
1616
+ nph_limits = [0.1, 0.6]
1617
+ kfs_limits = [0.0, 0.45]
1618
+ pl_limits = [0.2, 0.9]
1619
+ bt_limits = [0.0, 0.05]
1620
+ elif rock == "Foidite":
1621
+ upper_streckeisen = False
1622
+ nph_limits = [0.6, 1.0]
1623
+ kfs_limits = [0.0, 0.4]
1624
+ pl_limits = [0.0, 0.4]
1625
+ bt_limits = [0.0, 0.05]
1626
+
1627
+ if upper_streckeisen == True:
1628
+ phi_qz = round(rd.uniform(qz_limits[0], qz_limits[1]), 4)
1629
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1.0 - phi_qz)), 4)
1630
+ phi_pl = round(rd.uniform(0.0, (1.0 - phi_qz - phi_kfs)), 4)
1631
+ phi_bt = round(1 - phi_qz - phi_kfs - phi_pl, 4)
1632
+ phi_total = phi_qz + phi_kfs + phi_pl + phi_bt
1633
+ #
1634
+ if np.isclose(phi_total, 1.0000) == True:
1635
+ if qz_limits[0] <= phi_qz <= qz_limits[1] \
1636
+ and kfs_limits[0] <= phi_kfs <= kfs_limits[1] \
1637
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
1638
+ and bt_limits[0] <= phi_bt <= bt_limits[1]:
1639
+ condition_2 = True
1640
+ #
1641
+ elif upper_streckeisen == False:
1642
+ phi_nph = round(rd.uniform(nph_limits[0], nph_limits[1]), 4)
1643
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1.0 - phi_nph)), 4)
1644
+ phi_pl = round(rd.uniform(0.0, (1.0 - phi_nph - phi_kfs)), 4)
1645
+ phi_bt = round(1 - phi_nph - phi_kfs - phi_pl, 4)
1646
+ phi_total = phi_nph + phi_kfs + phi_pl + phi_bt
1647
+ #
1648
+ if np.isclose(phi_total, 1.0000) == True:
1649
+ if nph_limits[0] <= phi_nph <= nph_limits[1] \
1650
+ and kfs_limits[0] <= phi_kfs <= kfs_limits[1] \
1651
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
1652
+ and bt_limits[0] <= phi_bt <= bt_limits[1]:
1653
+ condition_2 = True
1654
+ #
1655
+ if upper_streckeisen == True:
1656
+ phi_minerals["Qz"] = phi_qz
1657
+ elif upper_streckeisen == False:
1658
+ phi_minerals["Nph"] = phi_nph
1659
+ #
1660
+ phi_minerals["Kfs"] = phi_kfs
1661
+ phi_minerals["Pl"] = phi_pl
1662
+ phi_minerals["Bt"] = phi_bt
1663
+ #
1664
+ rho_s = 0
1665
+ for key, value in phi_minerals.items():
1666
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
1667
+ for element, value in mineralogy[key]["chemistry"].items():
1668
+ if element not in elements_list:
1669
+ elements_list.append(element)
1670
+ w_elements[element] = 0.0
1671
+ #
1672
+ if elements_list[0] not in results_container["chemistry"]:
1673
+ for element in elements_list:
1674
+ results_container["chemistry"][element] = []
1675
+ #
1676
+ rho_s = round(rho_s, 3)
1677
+ for key, value in phi_minerals.items():
1678
+ if key == "Urn":
1679
+ n_digits = 6
1680
+ else:
1681
+ n_digits = 6
1682
+ #
1683
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
1684
+ #
1685
+ if self.porosity == None:
1686
+ var_porosity = round(rd.uniform(0.0, 0.1), 4)
1687
+ else:
1688
+ var_porosity = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
1689
+ #
1690
+ if self.fluid == "water":
1691
+ data_fluid = self.data_water
1692
+ elif self.fluid == "oil":
1693
+ data_fluid = self.data_oil
1694
+ elif self.fluid == "gas":
1695
+ data_fluid = self.data_gas
1696
+ #
1697
+ rho = round((1 - var_porosity)*rho_s + var_porosity*data_fluid[2]/1000, 3)
1698
+ #
1699
+ old_index = elements_list.index("O")
1700
+ elements_list += [elements_list.pop(old_index)]
1701
+ #
1702
+ w_elements_total = 0.0
1703
+ for element in elements_list:
1704
+ if element != "O":
1705
+ for mineral, w_mineral in w_minerals.items():
1706
+ if element in mineralogy[mineral]["chemistry"]:
1707
+ if element == "U":
1708
+ n_digits = 6
1709
+ else:
1710
+ n_digits = 6
1711
+ #
1712
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1713
+ w_elements[element] += value
1714
+ w_elements_total += value
1715
+ #
1716
+ w_elements[element] = round(w_elements[element], n_digits)
1717
+ elif element == "O":
1718
+ w_elements[element] += round(1 - w_elements_total, 6)
1719
+ #
1720
+ w_elements[element] = round(w_elements[element], 6)
1721
+ #
1722
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
1723
+ for key, value in w_minerals.items():
1724
+ w_minerals[key] = abs(value)
1725
+ #
1726
+ for key, value in w_elements.items():
1727
+ w_elements[key] = abs(value)
1728
+ #
1729
+ condition = True
1730
+ #
1731
+ bulk_mod = 0.0
1732
+ shear_mod = 0.0
1733
+ gamma_ray = 0.0
1734
+ photoelectricity = 0.0
1735
+ #
1736
+ K_list = []
1737
+ G_list = []
1738
+ phi_list = []
1739
+ for key, value in phi_minerals.items():
1740
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
1741
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
1742
+ #
1743
+ gamma_ray = round(gamma_ray, 3)
1744
+ photoelectricity = round(photoelectricity, 3)
1745
+ #
1746
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
1747
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
1748
+ phi_list.append(phi_minerals[key])
1749
+ #
1750
+ K_geo = elast.calc_geometric_mean(self, phi_list, K_list)
1751
+ G_geo = elast.calc_geometric_mean(self, phi_list, G_list)
1752
+ #
1753
+ # anisotropic_factor = round(rd.uniform(1.0, 2.0), 4)
1754
+ anisotropic_factor = 1.0
1755
+ #
1756
+ bulk_mod = K_geo/anisotropic_factor
1757
+ shear_mod = G_geo/anisotropic_factor
1758
+ #
1759
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
1760
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 6)
1761
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
1762
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
1763
+ vPvS = round(vP/vS, 6)
1764
+ # Composition data
1765
+ for key, value in w_minerals.items():
1766
+ results_container["mineralogy"][key].append(value)
1767
+
1768
+ amounts = []
1769
+ for key, value in w_elements.items():
1770
+ results_container["chemistry"][key].append(value)
1771
+ chem_data = PeriodicSystem(name=key).get_data()
1772
+ amounts.append([key, chem_data[1], value])
1773
+
1774
+ list_elements = list(w_elements.keys())
1775
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
1776
+ composition_oxides = {}
1777
+ for var_oxide in list_oxides:
1778
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1779
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1780
+
1781
+ if list_oxides[0] not in results_container["compounds"]:
1782
+ for oxide in list_oxides:
1783
+ results_container["compounds"][oxide] = []
1784
+
1785
+ for key, value in composition_oxides.items():
1786
+ results_container["compounds"][key].append(value)
1787
+
1788
+ results_container["mineralogy"] = dict(sorted(
1789
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1790
+ results_container["chemistry"] = dict(sorted(
1791
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1792
+ results_container["compounds"] = dict(sorted(
1793
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1794
+
1795
+ # Results
1796
+ results_container["phi"].append(var_porosity)
1797
+ results_container["rho_s"].append(rho_s)
1798
+ results_container["rho"].append(rho)
1799
+ results_container["vP"].append(vP)
1800
+ results_container["vS"].append(vS)
1801
+ results_container["vP/vS"].append(vPvS)
1802
+ results_container["K"].append(bulk_mod)
1803
+ results_container["G"].append(shear_mod)
1804
+ results_container["E"].append(youngs_mod)
1805
+ results_container["nu"].append(poisson_rat)
1806
+ results_container["GR"].append(gamma_ray)
1807
+ results_container["PE"].append(photoelectricity)
1808
+ #
1809
+ n += 1
1810
+ #
1811
+ return results_container
1812
+ #
1813
+ def create_basaltic_rock_yoder_tilley(self, rock="Basalt", number=1, composition=None, enrichment_pl=None):
1814
+ results_container = {}
1815
+ results_container["rock"] = rock
1816
+ results_container["mineralogy"] = {}
1817
+ results_container["chemistry"] = {}
1818
+ results_container["compounds"] = {}
1819
+ results_container["phi"] = []
1820
+ results_container["fluid"] = self.fluid
1821
+ results_container["rho_s"] = []
1822
+ results_container["rho"] = []
1823
+ results_container["vP"] = []
1824
+ results_container["vS"] = []
1825
+ results_container["vP/vS"] = []
1826
+ results_container["K"] = []
1827
+ results_container["G"] = []
1828
+ results_container["E"] = []
1829
+ results_container["nu"] = []
1830
+ results_container["GR"] = []
1831
+ results_container["PE"] = []
1832
+ #
1833
+ n = 0
1834
+ while n < number:
1835
+ data_olivine = Nesosilicates(impurity="pure", data_type=True).create_olivine()
1836
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase(
1837
+ enrichment=enrichment_pl)
1838
+ data_nepheline = Tectosilicates(impurity="pure", data_type=True).create_nepheline()
1839
+ data_orthopyroxene = Inosilicates(mineral="Orthopyroxene", data_type=True,
1840
+ traces_list=[]).generate_dataset(number=1)
1841
+ data_augite = Inosilicates(impurity="pure", data_type=True).create_augite()
1842
+ #
1843
+ mineralogy = {"Qz": self.data_quartz, "Pl": data_plagioclase, "Nph": data_nepheline,
1844
+ "Opx": data_orthopyroxene, "Aug": data_augite, "Ol": data_olivine}
1845
+ #
1846
+ minerals_list = list(mineralogy.keys())
1847
+ #
1848
+ if minerals_list[0] not in results_container["mineralogy"]:
1849
+ for mineral in minerals_list:
1850
+ results_container["mineralogy"][mineral] = []
1851
+ #
1852
+ condition = False
1853
+ #
1854
+ while condition == False:
1855
+ elements_list = []
1856
+ phi_minerals = {}
1857
+ w_minerals = {}
1858
+ w_elements = {}
1859
+ #
1860
+ if composition != None:
1861
+ phi_qz = composition["Qz"]
1862
+ phi_nph = composition["Nph"]
1863
+ #
1864
+ phi_opx = composition["Opx"]
1865
+ phi_pl = composition["Pl"]
1866
+ phi_ol = composition["Ol"]
1867
+ phi_aug = composition["Aug"]
1868
+ #
1869
+ phi_minerals["Qz"] = phi_qz
1870
+ phi_minerals["Nph"] = phi_nph
1871
+ phi_minerals["Opx"] = phi_opx
1872
+ phi_minerals["Pl"] = phi_pl
1873
+ phi_minerals["Ol"] = phi_ol
1874
+ phi_minerals["Aug"] = phi_aug
1875
+ #
1876
+ else:
1877
+ condition_2 = False
1878
+ while condition_2 == False:
1879
+ magicnumber = rd.randint(0, 2)
1880
+ if magicnumber == 0: # Quartz-Tholeiite
1881
+ qz_limits = [0.0, 1.0]
1882
+ nph_limits = [0.0, 0.0]
1883
+ opx_limits = [0.0, 1.0]
1884
+ pl_limits = [0.0, 1.0]
1885
+ ol_limits = [0.0, 0.0]
1886
+ aug_limits = [0.0, 1.0]
1887
+ elif magicnumber == 1: # Olivine-Tholeiite
1888
+ qz_limits = [0.0, 0.0]
1889
+ nph_limits = [0.0, 0.0]
1890
+ opx_limits = [0.0, 1.0]
1891
+ pl_limits = [0.0, 1.0]
1892
+ ol_limits = [0.0, 1.0]
1893
+ aug_limits = [0.0, 1.0]
1894
+ elif magicnumber == 2: # Alkaline Basalt
1895
+ qz_limits = [0.0, 0.0]
1896
+ nph_limits = [0.0, 1.0]
1897
+ opx_limits = [0.0, 0.0]
1898
+ pl_limits = [0.0, 1.0]
1899
+ ol_limits = [0.0, 1.0]
1900
+ aug_limits = [0.0, 1.0]
1901
+ #
1902
+ phi_aug = round(rd.uniform(aug_limits[0], aug_limits[1]), 4)
1903
+ phi_pl = round(rd.uniform(pl_limits[0], (1.0 - phi_aug)), 4)
1904
+ phi_qz = round(rd.uniform(qz_limits[0], (1.0 - phi_aug - phi_pl)), 4)
1905
+ phi_nph = round(rd.uniform(nph_limits[0], (1.0 - phi_aug - phi_pl - phi_qz)), 4)
1906
+ phi_opx = round(rd.uniform(opx_limits[0], (1.0 - phi_aug - phi_pl - phi_qz - phi_nph)), 4)
1907
+ phi_ol = round(1.0 - phi_aug - phi_pl - phi_qz - phi_nph - phi_opx, 4)
1908
+ #
1909
+ phi_total = phi_aug + phi_pl + phi_qz + phi_nph + phi_opx + phi_ol
1910
+ #
1911
+ if np.isclose(phi_total, 1.0000) == True:
1912
+ if aug_limits[0] <= phi_aug <= aug_limits[1] \
1913
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
1914
+ and qz_limits[0] <= phi_qz <= qz_limits[1] \
1915
+ and nph_limits[0] <= phi_nph <= nph_limits[1] \
1916
+ and opx_limits[0] <= phi_opx <= opx_limits[1] \
1917
+ and ol_limits[0] <= phi_ol <= ol_limits[1]:
1918
+ condition_2 = True
1919
+ #
1920
+ phi_minerals["Qz"] = phi_qz
1921
+ phi_minerals["Nph"] = phi_nph
1922
+ #
1923
+ phi_minerals["Aug"] = phi_aug
1924
+ phi_minerals["Pl"] = phi_pl
1925
+ phi_minerals["Ol"] = phi_ol
1926
+ phi_minerals["Opx"] = phi_opx
1927
+ #
1928
+ rho_s = 0
1929
+ for key, value in phi_minerals.items():
1930
+ try:
1931
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
1932
+ except:
1933
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"][0]
1934
+ for element, value in mineralogy[key]["chemistry"].items():
1935
+ if element not in elements_list:
1936
+ elements_list.append(element)
1937
+ w_elements[element] = 0.0
1938
+ #
1939
+ if elements_list[0] not in results_container["chemistry"]:
1940
+ for element in elements_list:
1941
+ results_container["chemistry"][element] = []
1942
+ #
1943
+ rho_s = round(rho_s, 3)
1944
+ for key, value in phi_minerals.items():
1945
+ if key == "Urn":
1946
+ n_digits = 6
1947
+ else:
1948
+ n_digits = 6
1949
+ #
1950
+ try:
1951
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
1952
+ except:
1953
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"][0])/rho_s, n_digits)
1954
+ #
1955
+ if self.porosity == None:
1956
+ var_porosity = round(rd.uniform(0.0, 0.1), 4)
1957
+ else:
1958
+ var_porosity = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
1959
+ #
1960
+ if self.fluid == "water":
1961
+ data_fluid = self.data_water
1962
+ elif self.fluid == "oil":
1963
+ data_fluid = self.data_oil
1964
+ elif self.fluid == "gas":
1965
+ data_fluid = self.data_gas
1966
+ #
1967
+ rho = round((1 - var_porosity)*rho_s + var_porosity*data_fluid[2]/1000, 3)
1968
+ #
1969
+ old_index = elements_list.index("O")
1970
+ elements_list += [elements_list.pop(old_index)]
1971
+ #
1972
+ w_elements_total = 0.0
1973
+ for element in elements_list:
1974
+ if element != "O":
1975
+ for mineral, w_mineral in w_minerals.items():
1976
+ if element in mineralogy[mineral]["chemistry"]:
1977
+ if element == "U":
1978
+ n_digits = 6
1979
+ else:
1980
+ n_digits = 6
1981
+ #
1982
+ try:
1983
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1984
+ except:
1985
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element][0], n_digits)
1986
+ w_elements[element] += value
1987
+ w_elements_total += value
1988
+ #
1989
+ w_elements[element] = round(w_elements[element], n_digits)
1990
+ elif element == "O":
1991
+ w_elements[element] += round(1 - w_elements_total, 6)
1992
+ #
1993
+ w_elements[element] = round(w_elements[element], 6)
1994
+ #
1995
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
1996
+ for key, value in w_minerals.items():
1997
+ w_minerals[key] = abs(value)
1998
+ #
1999
+ for key, value in w_elements.items():
2000
+ w_elements[key] = abs(value)
2001
+ #
2002
+ condition = True
2003
+ #
2004
+ bulk_mod = 0.0
2005
+ shear_mod = 0.0
2006
+ gamma_ray = 0.0
2007
+ photoelectricity = 0.0
2008
+ #
2009
+ K_list = []
2010
+ G_list = []
2011
+ phi_list = []
2012
+ for key, value in phi_minerals.items():
2013
+ try:
2014
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
2015
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
2016
+ #
2017
+ gamma_ray = round(gamma_ray, 3)
2018
+ photoelectricity = round(photoelectricity, 3)
2019
+ #
2020
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
2021
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
2022
+ phi_list.append(phi_minerals[key])
2023
+ except:
2024
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"][0]
2025
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"][0]
2026
+ #
2027
+ gamma_ray = round(gamma_ray, 3)
2028
+ photoelectricity = round(photoelectricity, 3)
2029
+ #
2030
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"][0], 3))
2031
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"][0], 3))
2032
+ phi_list.append(phi_minerals[key])
2033
+ #
2034
+ K_geo = elast.calc_geometric_mean(self, phi_list, K_list)
2035
+ G_geo = elast.calc_geometric_mean(self, phi_list, G_list)
2036
+ #
2037
+ # anisotropic_factor = round(rd.uniform(1.0, 2.0), 4)
2038
+ anisotropic_factor = 1.0
2039
+ #
2040
+ bulk_mod = K_geo/anisotropic_factor
2041
+ shear_mod = G_geo/anisotropic_factor
2042
+ #
2043
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
2044
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 6)
2045
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
2046
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
2047
+ vPvS = round(vP/vS, 6)
2048
+ # Composition data
2049
+ for key, value in w_minerals.items():
2050
+ results_container["mineralogy"][key].append(value)
2051
+
2052
+ amounts = []
2053
+ for key, value in w_elements.items():
2054
+ results_container["chemistry"][key].append(value)
2055
+ chem_data = PeriodicSystem(name=key).get_data()
2056
+ amounts.append([key, chem_data[1], value])
2057
+
2058
+ list_elements = list(w_elements.keys())
2059
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
2060
+ composition_oxides = {}
2061
+ for var_oxide in list_oxides:
2062
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
2063
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
2064
+
2065
+ if list_oxides[0] not in results_container["compounds"]:
2066
+ for oxide in list_oxides:
2067
+ results_container["compounds"][oxide] = []
2068
+
2069
+ for key, value in composition_oxides.items():
2070
+ results_container["compounds"][key].append(value)
2071
+
2072
+ # Results
2073
+ results_container["phi"].append(var_porosity)
2074
+ results_container["rho_s"].append(rho_s)
2075
+ results_container["rho"].append(rho)
2076
+ results_container["vP"].append(vP)
2077
+ results_container["vS"].append(vS)
2078
+ results_container["vP/vS"].append(vPvS)
2079
+ results_container["K"].append(bulk_mod)
2080
+ results_container["G"].append(shear_mod)
2081
+ results_container["E"].append(youngs_mod)
2082
+ results_container["nu"].append(poisson_rat)
2083
+ results_container["GR"].append(gamma_ray)
2084
+ results_container["PE"].append(photoelectricity)
2085
+ #
2086
+ n += 1
2087
+ #
2088
+ return results_container
2089
+
2090
+ class Pyroclastic:
2091
+ #
2092
+ def __init__(self, fluid, actualThickness):
2093
+ self.fluid = fluid
2094
+ self.actualThickness = actualThickness
2095
+ #
2096
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
2097
+ self.data_water = Water.water("")
2098
+ #
2099
+ def create_pyroclastic_rock(self, number=1, composition=None, porosity=None):
2100
+ data_olivine = Nesosilicates(impurity="pure", data_type=True).create_olivine()
2101
+ data_orthopyroxene = Inosilicates(impurity="pure", data_type=True).create_orthopyroxene()
2102
+ data_nepheline = Tectosilicates(impurity="pure", data_type=True).create_nepheline()
2103
+ #
2104
+ mineralogy = {"Qz": self.data_quartz, "Ol": data_olivine, "Opx": data_orthopyroxene, "Nph": data_nepheline}
2105
+ #
2106
+ condition = False
2107
+ #
2108
+ while condition == False:
2109
+ elements_list = []
2110
+ phi_minerals = {}
2111
+ w_minerals = {}
2112
+ w_elements = {}
2113
+ #
2114
+ if composition != None:
2115
+ phi_qz = composition["Qz"]
2116
+ phi_Ol = composition["Ol"]
2117
+ phi_Opx = composition["Opx"]
2118
+ phi_Nph = composition["Nph"]
2119
+ #
2120
+ phi_minerals["Qz"] = phi_qz
2121
+ phi_minerals["Ol"] = phi_Ol
2122
+ phi_minerals["Opx"] = phi_Opx
2123
+ phi_minerals["Nph"] = phi_Nph
2124
+ else:
2125
+ condition_2 = False
2126
+ while condition_2 == False:
2127
+ x = rd.randint(0, 1)
2128
+ phi_qz = round(x*rd.uniform(0.2, 0.6), 4)
2129
+ phi_nph = round((1 - x)*rd.uniform(0.2, 0.6), 4)
2130
+ phi_ol = round(rd.uniform(0.25, (1.0 - phi_qz)), 4)
2131
+ phi_opx = round(1 - phi_qz - phi_ol - phi_nph, 4)
2132
+ phi_total = phi_qz + phi_ol + phi_opx + phi_nph
2133
+ #
2134
+ if np.isclose(phi_total, 1.0000) == True:
2135
+ if 0.0 <= phi_qz <= 0.6 and 0.25 <= phi_ol <= 0.75 and 0.05 <= phi_opx <= 0.15 and 0.0 <= phi_nph <= 0.6:
2136
+ condition_2 = True
2137
+ #
2138
+ phi_minerals["Qz"] = phi_qz
2139
+ phi_minerals["Ol"] = phi_ol
2140
+ phi_minerals["Opx"] = phi_opx
2141
+ phi_minerals["Nph"] = phi_nph
2142
+ #
2143
+ rho_s = 0
2144
+ for key, value in phi_minerals.items():
2145
+ rho_s += phi_minerals[key] * mineralogy[key]["rho"]
2146
+ for element, value in mineralogy[key]["chemistry"].items():
2147
+ if element not in elements_list:
2148
+ elements_list.append(element)
2149
+ w_elements[element] = 0.0
2150
+ rho_s = round(rho_s, 3)
2151
+ for key, value in phi_minerals.items():
2152
+ w_minerals[key] = round((phi_minerals[key] * mineralogy[key]["rho"]) / rho_s, 4)
2153
+ #
2154
+ if porosity == None:
2155
+ porosity = round(rd.uniform(0.1, 0.5), 4)
2156
+ rho = round((1 - porosity) * rho_s + porosity * self.data_water[2] / 1000, 3)
2157
+ #
2158
+ old_index = elements_list.index("O")
2159
+ elements_list += [elements_list.pop(old_index)]
2160
+ #
2161
+ w_elements_total = 0.0
2162
+ for element in elements_list:
2163
+ if element != "O":
2164
+ for mineral, w_mineral in w_minerals.items():
2165
+ if element in mineralogy[mineral]["chemistry"]:
2166
+ value = round(w_mineral * mineralogy[mineral]["chemistry"][element], 4)
2167
+ w_elements[element] += value
2168
+ w_elements_total += value
2169
+ #
2170
+ w_elements[element] = round(w_elements[element], 4)
2171
+ elif element == "O":
2172
+ w_elements[element] += round(1 - w_elements_total, 4)
2173
+ #
2174
+ w_elements[element] = round(w_elements[element], 4)
2175
+ #
2176
+ if sum(w_minerals.values()) == 1.0 and sum(w_elements.values()) == 1.0:
2177
+ condition = True
2178
+ #
2179
+ bulk_mod = 0.0
2180
+ shear_mod = 0.0
2181
+ gamma_ray = 0.0
2182
+ photoelectricity = 0.0
2183
+ for key, value in phi_minerals.items():
2184
+ bulk_mod += phi_minerals[key] * mineralogy[key]["K"]
2185
+ shear_mod += phi_minerals[key] * mineralogy[key]["G"]
2186
+ gamma_ray += phi_minerals[key] * mineralogy[key]["GR"]
2187
+ photoelectricity += phi_minerals[key] * mineralogy[key]["PE"]
2188
+ #
2189
+ bulk_mod = round(bulk_mod, 3)
2190
+ shear_mod = round(shear_mod, 3)
2191
+ gamma_ray = round(gamma_ray, 3)
2192
+ photoelectricity = round(photoelectricity, 3)
2193
+ #
2194
+ youngs_mod = round((9 * bulk_mod * shear_mod) / (3 * bulk_mod + shear_mod), 3)
2195
+ poisson_rat = round((3 * bulk_mod - 2 * shear_mod) / (6 * bulk_mod + 2 * shear_mod), 4)
2196
+ vP = round(((bulk_mod * 10 ** 9 + 4 / 3 * shear_mod * 10 ** 9) / (rho)) ** 0.5, 3)
2197
+ vS = round(((shear_mod * 10 ** 9) / (rho)) ** 0.5, 3)
2198
+ vPvS = round(vP / vS, 3)
2199
+ #
2200
+ results = {}
2201
+ results["rock"] = "Pyroclastic Rock"
2202
+ if number > 1:
2203
+ results["mineralogy"] = w_minerals
2204
+ results["chemistry"] = w_elements
2205
+ results["phi"] = porosity
2206
+ results["fluid"] = "water"
2207
+ results["rho_s"] = rho_s
2208
+ results["rho"] = rho
2209
+ results["vP"] = vP
2210
+ results["vS"] = vS
2211
+ results["vP/vS"] = vPvS
2212
+ results["K"] = bulk_mod
2213
+ results["G"] = shear_mod
2214
+ results["E"] = youngs_mod
2215
+ results["nu"] = poisson_rat
2216
+ results["GR"] = gamma_ray
2217
+ results["PE"] = photoelectricity
2218
+ else:
2219
+ single_amounts_mineralogy = {}
2220
+ single_amounts_chemistry = {}
2221
+ for mineral, value in w_minerals.items():
2222
+ single_amounts_mineralogy[mineral] = value
2223
+ for element, value in w_elements.items():
2224
+ single_amounts_chemistry[element] = value
2225
+ results["mineralogy"] = single_amounts_mineralogy
2226
+ results["chemistry"] = single_amounts_chemistry
2227
+ results["phi"] = porosity
2228
+ results["fluid"] = "water"
2229
+ results["rho_s"] = rho_s
2230
+ results["rho"] = rho
2231
+ results["vP"] = vP
2232
+ results["vS"] = vS
2233
+ results["vP/vS"] = vPvS
2234
+ results["K"] = bulk_mod
2235
+ results["G"] = shear_mod
2236
+ results["E"] = youngs_mod
2237
+ results["nu"] = poisson_rat
2238
+ results["GR"] = gamma_ray
2239
+ results["PE"] = photoelectricity
2240
+ #
2241
+ return results