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