gebpy 1.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. gebpy/__init__.py +55 -0
  2. gebpy/__pycache__/__init__.cpython-310.pyc +0 -0
  3. gebpy/adapters/__init__.py +0 -0
  4. gebpy/cli/__init__.py +0 -0
  5. gebpy/core/__init__.py +0 -0
  6. gebpy/core/chemistry/__init__.py +0 -0
  7. gebpy/core/chemistry/common.py +1369 -0
  8. gebpy/core/chemistry/elements.py +317 -0
  9. gebpy/core/chemistry/geochemistry.py +1728 -0
  10. gebpy/core/fluids/__init__.py +0 -0
  11. gebpy/core/io/__init__.py +0 -0
  12. gebpy/core/mathematics/__init__.py +0 -0
  13. gebpy/core/minerals/__init__.py +0 -0
  14. gebpy/core/minerals/carbonates.py +412 -0
  15. gebpy/core/minerals/common.py +555 -0
  16. gebpy/core/minerals/config.py +77 -0
  17. gebpy/core/minerals/cyclosilicates.py +0 -0
  18. gebpy/core/minerals/halides.py +0 -0
  19. gebpy/core/minerals/inosilicates.py +0 -0
  20. gebpy/core/minerals/nesosilicates.py +0 -0
  21. gebpy/core/minerals/organics.py +0 -0
  22. gebpy/core/minerals/oxides.py +589 -0
  23. gebpy/core/minerals/phosphates.py +0 -0
  24. gebpy/core/minerals/phospides.py +0 -0
  25. gebpy/core/minerals/phyllosilicates.py +436 -0
  26. gebpy/core/minerals/sorosilicates.py +0 -0
  27. gebpy/core/minerals/sulfates.py +0 -0
  28. gebpy/core/minerals/sulfides.py +459 -0
  29. gebpy/core/minerals/synthesis.py +201 -0
  30. gebpy/core/minerals/tectosilicates.py +433 -0
  31. gebpy/core/physics/__init__.py +0 -0
  32. gebpy/core/physics/common.py +53 -0
  33. gebpy/core/physics/geophysics.py +351 -0
  34. gebpy/core/rocks/__init__.py +0 -0
  35. gebpy/core/rocks/anisotropic_rocks.py +395 -0
  36. gebpy/core/rocks/common.py +95 -0
  37. gebpy/core/rocks/config.py +77 -0
  38. gebpy/core/rocks/isotropic_rocks.py +395 -0
  39. gebpy/core/rocks/sedimentary.py +385 -0
  40. gebpy/core/subsurface/__init__.py +0 -0
  41. gebpy/data_minerals/__init__.py +0 -0
  42. gebpy/data_minerals/albite.yaml +59 -0
  43. gebpy/data_minerals/anatase.yaml +43 -0
  44. gebpy/data_minerals/ankerite.yaml +47 -0
  45. gebpy/data_minerals/annite.yaml +57 -0
  46. gebpy/data_minerals/anorthite.yaml +59 -0
  47. gebpy/data_minerals/antigorite.yaml +53 -0
  48. gebpy/data_minerals/aragonite.yaml +48 -0
  49. gebpy/data_minerals/argutite.yaml +43 -0
  50. gebpy/data_minerals/arsenolite.yaml +40 -0
  51. gebpy/data_minerals/au3oxide.yaml +46 -0
  52. gebpy/data_minerals/avicennite.yaml +40 -0
  53. gebpy/data_minerals/azurite.yaml +53 -0
  54. gebpy/data_minerals/baddeleyite.yaml +49 -0
  55. gebpy/data_minerals/bismite.yaml +49 -0
  56. gebpy/data_minerals/boehmite.yaml +48 -0
  57. gebpy/data_minerals/brookite.yaml +46 -0
  58. gebpy/data_minerals/brucite.yaml +45 -0
  59. gebpy/data_minerals/bunsenite.yaml +40 -0
  60. gebpy/data_minerals/calcite.yaml +45 -0
  61. gebpy/data_minerals/cassiterite.yaml +43 -0
  62. gebpy/data_minerals/cerussite.yaml +48 -0
  63. gebpy/data_minerals/chamosite.yaml +56 -0
  64. gebpy/data_minerals/chlorite.yaml +75 -0
  65. gebpy/data_minerals/chromite.yaml +42 -0
  66. gebpy/data_minerals/chrysotile.yaml +53 -0
  67. gebpy/data_minerals/claudetite.yaml +49 -0
  68. gebpy/data_minerals/clinochlore.yaml +55 -0
  69. gebpy/data_minerals/cochromite.yaml +42 -0
  70. gebpy/data_minerals/corundum.yaml +43 -0
  71. gebpy/data_minerals/crocoite.yaml +51 -0
  72. gebpy/data_minerals/cuprite.yaml +40 -0
  73. gebpy/data_minerals/cuprospinel.yaml +42 -0
  74. gebpy/data_minerals/diaspore.yaml +48 -0
  75. gebpy/data_minerals/dolomite.yaml +47 -0
  76. gebpy/data_minerals/eastonite.yaml +57 -0
  77. gebpy/data_minerals/eskolaite.yaml +43 -0
  78. gebpy/data_minerals/fechlorite.yaml +61 -0
  79. gebpy/data_minerals/fecolumbite.yaml +48 -0
  80. gebpy/data_minerals/ferberite.yaml +51 -0
  81. gebpy/data_minerals/fetantalite.yaml +48 -0
  82. gebpy/data_minerals/franklinite.yaml +42 -0
  83. gebpy/data_minerals/gahnite.yaml +42 -0
  84. gebpy/data_minerals/galaxite.yaml +42 -0
  85. gebpy/data_minerals/geikielite.yaml +45 -0
  86. gebpy/data_minerals/gibbsite.yaml +51 -0
  87. gebpy/data_minerals/glauconite.yaml +69 -0
  88. gebpy/data_minerals/goethite.yaml +48 -0
  89. gebpy/data_minerals/groutite.yaml +48 -0
  90. gebpy/data_minerals/hematite.yaml +43 -0
  91. gebpy/data_minerals/hercynite.yaml +42 -0
  92. gebpy/data_minerals/huebnerite.yaml +51 -0
  93. gebpy/data_minerals/ikaite.yaml +53 -0
  94. gebpy/data_minerals/illite.yaml +55 -0
  95. gebpy/data_minerals/ilmenite.yaml +45 -0
  96. gebpy/data_minerals/jacobsite.yaml +42 -0
  97. gebpy/data_minerals/kalsilite.yaml +47 -0
  98. gebpy/data_minerals/kaolinite.yaml +59 -0
  99. gebpy/data_minerals/karelianite.yaml +43 -0
  100. gebpy/data_minerals/lime.yaml +40 -0
  101. gebpy/data_minerals/litharge.yaml +43 -0
  102. gebpy/data_minerals/magnesiochromite.yaml +42 -0
  103. gebpy/data_minerals/magnesioferrite.yaml +42 -0
  104. gebpy/data_minerals/magnesite.yaml +45 -0
  105. gebpy/data_minerals/magnetite.yaml +41 -0
  106. gebpy/data_minerals/malachite.yaml +53 -0
  107. gebpy/data_minerals/manganite.yaml +51 -0
  108. gebpy/data_minerals/manganochromite.yaml +42 -0
  109. gebpy/data_minerals/manganosite.yaml +40 -0
  110. gebpy/data_minerals/marialite.yaml +49 -0
  111. gebpy/data_minerals/massicot.yaml +46 -0
  112. gebpy/data_minerals/meionite.yaml +49 -0
  113. gebpy/data_minerals/mgchlorite.yaml +61 -0
  114. gebpy/data_minerals/mgcolumbite.yaml +48 -0
  115. gebpy/data_minerals/mgtantalite.yaml +48 -0
  116. gebpy/data_minerals/microcline.yaml +59 -0
  117. gebpy/data_minerals/minium.yaml +44 -0
  118. gebpy/data_minerals/mnchlorite.yaml +61 -0
  119. gebpy/data_minerals/mncolumbite.yaml +48 -0
  120. gebpy/data_minerals/mntantalite.yaml +48 -0
  121. gebpy/data_minerals/monteponite.yaml +40 -0
  122. gebpy/data_minerals/montmorillonite.yaml +77 -0
  123. gebpy/data_minerals/muscovite.yaml +55 -0
  124. gebpy/data_minerals/nanepheline.yaml +47 -0
  125. gebpy/data_minerals/nichlorite.yaml +61 -0
  126. gebpy/data_minerals/nichromite.yaml +42 -0
  127. gebpy/data_minerals/nimite.yaml +55 -0
  128. gebpy/data_minerals/nontronite.yaml +73 -0
  129. gebpy/data_minerals/orthoclase.yaml +53 -0
  130. gebpy/data_minerals/paratellurite.yaml +43 -0
  131. gebpy/data_minerals/pennantite.yaml +61 -0
  132. gebpy/data_minerals/periclase.yaml +40 -0
  133. gebpy/data_minerals/phlogopite.yaml +57 -0
  134. gebpy/data_minerals/plattnerite.yaml +43 -0
  135. gebpy/data_minerals/powellite.yaml +45 -0
  136. gebpy/data_minerals/pyrite.yaml +40 -0
  137. gebpy/data_minerals/pyrolusite.yaml +43 -0
  138. gebpy/data_minerals/pyrophanite.yaml +45 -0
  139. gebpy/data_minerals/pyrophyllite.yaml +59 -0
  140. gebpy/data_minerals/quartz.yaml +43 -0
  141. gebpy/data_minerals/rhodochrosite.yaml +45 -0
  142. gebpy/data_minerals/rutile.yaml +43 -0
  143. gebpy/data_minerals/saponite.yaml +77 -0
  144. gebpy/data_minerals/scheelite.yaml +45 -0
  145. gebpy/data_minerals/scrutinyite.yaml +46 -0
  146. gebpy/data_minerals/senarmontite.yaml +40 -0
  147. gebpy/data_minerals/siderite.yaml +45 -0
  148. gebpy/data_minerals/siderophyllite.yaml +57 -0
  149. gebpy/data_minerals/smithsonite.yaml +45 -0
  150. gebpy/data_minerals/spinel.yaml +42 -0
  151. gebpy/data_minerals/stishovite.yaml +43 -0
  152. gebpy/data_minerals/stolzite.yaml +45 -0
  153. gebpy/data_minerals/talc.yaml +53 -0
  154. gebpy/data_minerals/tistarite.yaml +43 -0
  155. gebpy/data_minerals/trevorite.yaml +42 -0
  156. gebpy/data_minerals/ulvoespinel.yaml +42 -0
  157. gebpy/data_minerals/uraninite.yaml +40 -0
  158. gebpy/data_minerals/valentinite.yaml +46 -0
  159. gebpy/data_minerals/vermiculite.yaml +69 -0
  160. gebpy/data_minerals/wulfenite.yaml +45 -0
  161. gebpy/data_minerals/wustite.yaml +40 -0
  162. gebpy/data_minerals/zincite.yaml +43 -0
  163. gebpy/data_minerals/zincochromite.yaml +42 -0
  164. gebpy/data_rocks/__init__.py +0 -0
  165. gebpy/data_rocks/dolostone.yaml +40 -0
  166. gebpy/data_rocks/limestone.yaml +40 -0
  167. gebpy/data_rocks/marl.yaml +50 -0
  168. gebpy/data_rocks/sandstone.yaml +39 -0
  169. gebpy/data_rocks/shale.yaml +50 -0
  170. gebpy/gebpy_app.py +8732 -0
  171. gebpy/gui/__init__.py +0 -0
  172. gebpy/lib/images/GebPy_Header.png +0 -0
  173. gebpy/lib/images/GebPy_Icon.png +0 -0
  174. gebpy/lib/images/GebPy_Logo.png +0 -0
  175. gebpy/main.py +29 -0
  176. gebpy/modules/__init__.py +0 -0
  177. gebpy/modules/__pycache__/__init__.cpython-310.pyc +0 -0
  178. gebpy/modules/__pycache__/metamorphics.cpython-310.pyc +0 -0
  179. gebpy/modules/__pycache__/silicates.cpython-310.pyc +0 -0
  180. gebpy/modules/carbonates.py +2658 -0
  181. gebpy/modules/chemistry.py +1369 -0
  182. gebpy/modules/core.py +1805 -0
  183. gebpy/modules/elements.py +317 -0
  184. gebpy/modules/evaporites.py +1299 -0
  185. gebpy/modules/exploration.py +1145 -0
  186. gebpy/modules/fluids.py +339 -0
  187. gebpy/modules/geochemistry.py +1727 -0
  188. gebpy/modules/geophysics.py +351 -0
  189. gebpy/modules/gui.py +9093 -0
  190. gebpy/modules/gui_elements.py +145 -0
  191. gebpy/modules/halides.py +485 -0
  192. gebpy/modules/igneous.py +2241 -0
  193. gebpy/modules/metamorphics.py +3222 -0
  194. gebpy/modules/mineralogy.py +442 -0
  195. gebpy/modules/minerals.py +7954 -0
  196. gebpy/modules/ore.py +1648 -0
  197. gebpy/modules/organics.py +530 -0
  198. gebpy/modules/oxides.py +9057 -0
  199. gebpy/modules/petrophysics.py +98 -0
  200. gebpy/modules/phosphates.py +589 -0
  201. gebpy/modules/phospides.py +194 -0
  202. gebpy/modules/plotting.py +619 -0
  203. gebpy/modules/pyllosilicates.py +380 -0
  204. gebpy/modules/sedimentary_rocks.py +908 -0
  205. gebpy/modules/sequences.py +2166 -0
  206. gebpy/modules/series.py +1625 -0
  207. gebpy/modules/silicates.py +11102 -0
  208. gebpy/modules/siliciclastics.py +1846 -0
  209. gebpy/modules/subsurface_2d.py +179 -0
  210. gebpy/modules/sulfates.py +1629 -0
  211. gebpy/modules/sulfides.py +4786 -0
  212. gebpy/plotting/__init__.py +0 -0
  213. gebpy/ui_nb/__init__.py +0 -0
  214. gebpy/user_data/.gitkeep +0 -0
  215. gebpy-1.1.3.dist-info/LICENSE +165 -0
  216. gebpy-1.1.3.dist-info/METADATA +207 -0
  217. gebpy-1.1.3.dist-info/RECORD +254 -0
  218. gebpy-1.1.3.dist-info/WHEEL +5 -0
  219. gebpy-1.1.3.dist-info/entry_points.txt +2 -0
  220. gebpy-1.1.3.dist-info/top_level.txt +1 -0
  221. modules/__init__.py +0 -0
  222. modules/carbonates.py +2658 -0
  223. modules/chemistry.py +1369 -0
  224. modules/core.py +1805 -0
  225. modules/elements.py +317 -0
  226. modules/evaporites.py +1299 -0
  227. modules/exploration.py +765 -0
  228. modules/fluids.py +339 -0
  229. modules/geochemistry.py +1727 -0
  230. modules/geophysics.py +337 -0
  231. modules/gui.py +9093 -0
  232. modules/gui_elements.py +145 -0
  233. modules/halides.py +485 -0
  234. modules/igneous.py +2196 -0
  235. modules/metamorphics.py +2699 -0
  236. modules/mineralogy.py +442 -0
  237. modules/minerals.py +7954 -0
  238. modules/ore.py +1628 -0
  239. modules/organics.py +530 -0
  240. modules/oxides.py +9057 -0
  241. modules/petrophysics.py +98 -0
  242. modules/phosphates.py +589 -0
  243. modules/phospides.py +194 -0
  244. modules/plotting.py +619 -0
  245. modules/pyllosilicates.py +380 -0
  246. modules/sedimentary_rocks.py +908 -0
  247. modules/sequences.py +2166 -0
  248. modules/series.py +1625 -0
  249. modules/silicates.py +11102 -0
  250. modules/siliciclastics.py +1830 -0
  251. modules/subsurface_2d.py +179 -0
  252. modules/sulfates.py +1629 -0
  253. modules/sulfides.py +4786 -0
  254. notebooks/__init__.py +0 -0
@@ -0,0 +1,2699 @@
1
+ #!/usr/bin/env python
2
+ # -*-coding: utf-8 -*-
3
+
4
+ # -----------------------------------------------
5
+
6
+ # Name: metamorphics.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
+ import random as rd
16
+ from modules.chemistry import PeriodicSystem, OxideCompounds
17
+ from modules.oxides import Oxides
18
+ from modules.silicates import Tectosilicates, Nesosilicates, Sorosilicates, Phyllosilicates, Inosilicates
19
+ from modules.fluids import Water
20
+ from modules.geophysics import Elasticity as elast
21
+
22
+ #######################
23
+ ## METAMORPHIC ROCKS ##
24
+ #######################
25
+ class GranuliteFacies:
26
+ #
27
+ def __init__(self, fluid="water", actual_thickness=100, porosity=None):
28
+ self.fluid = fluid
29
+ self.actualThickness = actual_thickness
30
+ self.porosity = porosity
31
+ #
32
+ ## Minerals
33
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
34
+ self.data_kyanite = Nesosilicates(impurity="pure", data_type=True).create_kyanite()
35
+ self.data_sillimanite = Nesosilicates(impurity="pure", data_type=True).create_sillimanite()
36
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
37
+ #
38
+ ## Fluids
39
+ self.data_water = Water.water("")
40
+ #
41
+ def create_granulite(self, number=1, composition=None, classification="felsic"):
42
+ #
43
+ results_container = {}
44
+ results_container["rock"] = "Granulite"
45
+ results_container["mineralogy"] = {}
46
+ results_container["chemistry"] = {}
47
+ results_container["compounds"] = {}
48
+ results_container["phi"] = []
49
+ results_container["fluid"] = self.fluid
50
+ results_container["rho_s"] = []
51
+ results_container["rho"] = []
52
+ results_container["vP"] = []
53
+ results_container["vS"] = []
54
+ results_container["vP/vS"] = []
55
+ results_container["K"] = []
56
+ results_container["G"] = []
57
+ results_container["E"] = []
58
+ results_container["nu"] = []
59
+ results_container["GR"] = []
60
+ results_container["PE"] = []
61
+ #
62
+ n = 0
63
+ while n < number:
64
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
65
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
66
+ data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
67
+ data_clinopyroxene = Inosilicates(
68
+ mineral="Clinopyroxene", data_type=True, traces_list=[]).generate_dataset(
69
+ number=1)
70
+ data_orthopyroxene = Inosilicates(
71
+ mineral="Orthopyroxene", data_type=True, traces_list=[]).generate_dataset(
72
+ number=1)
73
+ #
74
+ mineralogy = {"Qz": self.data_quartz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
75
+ "Grt": data_garnet_al, "Opx": data_orthopyroxene, "Cpx": data_clinopyroxene}
76
+ #
77
+ minerals_list = list(mineralogy.keys())
78
+ #
79
+ if minerals_list[0] not in results_container["mineralogy"]:
80
+ for mineral in minerals_list:
81
+ results_container["mineralogy"][mineral] = []
82
+ #
83
+ condition = False
84
+ #
85
+ while condition == False:
86
+ elements_list = []
87
+ phi_minerals = {}
88
+ w_minerals = {}
89
+ w_elements = {}
90
+ #
91
+ if composition != None:
92
+ phi_qz = composition["Qz"]
93
+ phi_kfs = composition["Kfs"]
94
+ phi_pl = composition["Pl"]
95
+ phi_grt = composition["Grt"]
96
+ phi_opx = composition["Opx"]
97
+ phi_cpx = composition["Cpx"]
98
+ #
99
+ phi_minerals["Qz"] = phi_qz
100
+ phi_minerals["Kfs"] = phi_kfs
101
+ phi_minerals["Pl"] = phi_pl
102
+ phi_minerals["Grt"] = phi_grt
103
+ phi_minerals["Opx"] = phi_opx
104
+ phi_minerals["Cpx"] = phi_cpx
105
+ #
106
+ else:
107
+ condition_2 = False
108
+ while condition_2 == False:
109
+ if classification == "felsic":
110
+ qz_limits = [0.1, 0.26]
111
+ kfs_limits = [0.2, 0.52]
112
+ pl_limits = [0.2, 0.52]
113
+ grt_limits = [0.02, 0.08]
114
+ opx_limits = [0.0, 0.05]
115
+ cpx_limits = [0.0, 0.05]
116
+ #
117
+ phi_qz = round(rd.uniform(qz_limits[0], qz_limits[1]), 4)
118
+ phi_kfs = round(rd.uniform(kfs_limits[0], (1 - phi_qz)), 4)
119
+ phi_pl = round(rd.uniform(pl_limits[0], (1 - phi_qz - phi_kfs)), 4)
120
+ phi_grt = round(rd.uniform(grt_limits[0], (1 - phi_qz - phi_kfs - phi_pl)), 4)
121
+ phi_opx = round(rd.uniform(opx_limits[0], (1 - phi_qz - phi_kfs - phi_pl - phi_grt)), 4)
122
+ phi_cpx = round(1 - phi_qz - phi_kfs - phi_pl - phi_grt - phi_opx, 4)
123
+ #
124
+ elif classification == "mafic":
125
+ qz_limits = [0.0, 0.12]
126
+ kfs_limits = [0.0, 0.04]
127
+ pl_limits = [0.05, 0.25]
128
+ grt_limits = [0.02, 0.08]
129
+ opx_limits = [0.2, 0.52]
130
+ cpx_limits = [0.2, 0.52]
131
+ #
132
+ phi_qz = round(rd.uniform(qz_limits[0], qz_limits[1]), 4)
133
+ phi_opx = round(rd.uniform(opx_limits[0], (1 - phi_qz)), 4)
134
+ phi_cpx = round(rd.uniform(cpx_limits[0], (1 - phi_qz - phi_opx)), 4)
135
+ phi_grt = round(rd.uniform(grt_limits[0], (1 - phi_qz - phi_opx - phi_cpx)), 4)
136
+ phi_pl = round(rd.uniform(pl_limits[0], (1 - phi_qz - phi_opx - phi_cpx - phi_grt)), 4)
137
+ phi_kfs = round(1 - phi_qz - phi_opx - phi_cpx - phi_grt - phi_pl, 4)
138
+ #
139
+ phi_total = phi_qz + phi_kfs + phi_pl + phi_grt + phi_opx + phi_cpx
140
+ #
141
+ if np.isclose(phi_total, 1.0000) == True:
142
+ if qz_limits[0] <= phi_qz <= qz_limits[1] \
143
+ and kfs_limits[0] <= phi_kfs <= kfs_limits[1] \
144
+ and pl_limits[0] <= phi_pl <= pl_limits[1] \
145
+ and grt_limits[0] <= phi_grt <= grt_limits[1] \
146
+ and opx_limits[0] <= phi_opx <= opx_limits[1] \
147
+ and cpx_limits[0] <= phi_cpx <= cpx_limits[1]:
148
+ condition_2 = True
149
+ #
150
+ phi_minerals["Qz"] = phi_qz
151
+ phi_minerals["Kfs"] = phi_kfs
152
+ phi_minerals["Pl"] = phi_pl
153
+ phi_minerals["Grt"] = phi_grt
154
+ phi_minerals["Opx"] = phi_opx
155
+ phi_minerals["Cpx"] = phi_cpx
156
+ #
157
+ rho_s = 0
158
+ for key, value in phi_minerals.items():
159
+ try:
160
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
161
+ except:
162
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"][0]
163
+ #
164
+ for element, value in mineralogy[key]["chemistry"].items():
165
+ if element not in elements_list:
166
+ elements_list.append(element)
167
+ w_elements[element] = 0.0
168
+ #
169
+ if elements_list[0] not in results_container["chemistry"]:
170
+ for element in elements_list:
171
+ results_container["chemistry"][element] = []
172
+ #
173
+ rho_s = round(rho_s, 3)
174
+ for key, value in phi_minerals.items():
175
+ if key == "Urn":
176
+ n_digits = 4
177
+ else:
178
+ n_digits = 4
179
+ #
180
+ try:
181
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
182
+ except:
183
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"][0])/rho_s, n_digits)
184
+ #
185
+ if self.porosity == None:
186
+ var_porosity = round(rd.uniform(0.0, 0.1), 4)
187
+ else:
188
+ var_porosity = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
189
+ #
190
+ if self.fluid == "water":
191
+ data_fluid = self.data_water
192
+ #
193
+ rho = round((1 - var_porosity)*rho_s + var_porosity*data_fluid[2]/1000, 3)
194
+ #
195
+ old_index = elements_list.index("O")
196
+ elements_list += [elements_list.pop(old_index)]
197
+ #
198
+ w_elements_total = 0.0
199
+ for element in elements_list:
200
+ if element != "O":
201
+ for mineral, w_mineral in w_minerals.items():
202
+ if element in mineralogy[mineral]["chemistry"]:
203
+ if element == "U":
204
+ n_digits = 4
205
+ else:
206
+ n_digits = 4
207
+ #
208
+ try:
209
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
210
+ except:
211
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element][0], n_digits)
212
+ #
213
+ w_elements[element] += value
214
+ w_elements_total += value
215
+ #
216
+ w_elements[element] = round(w_elements[element], n_digits)
217
+ elif element == "O":
218
+ w_elements[element] += round(1 - w_elements_total, 4)
219
+ #
220
+ w_elements[element] = round(w_elements[element], 4)
221
+ #
222
+ total_w_minerals = round(sum(w_minerals.values()), 4)
223
+ total_w_elements = round(sum(w_elements.values()), 4)
224
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
225
+ for key, value in w_minerals.items():
226
+ w_minerals[key] = abs(value)
227
+ #
228
+ for key, value in w_elements.items():
229
+ w_elements[key] = abs(value)
230
+ #
231
+ condition = True
232
+ #
233
+ gamma_ray = 0.0
234
+ photoelectricity = 0.0
235
+ #
236
+ K_list = []
237
+ G_list = []
238
+ phi_list = []
239
+ for key, value in phi_minerals.items():
240
+ try:
241
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
242
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
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"], 3))
248
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
249
+ phi_list.append(phi_minerals[key])
250
+ except:
251
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"][0]
252
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"][0]
253
+ #
254
+ gamma_ray = round(gamma_ray, 3)
255
+ photoelectricity = round(photoelectricity, 3)
256
+ #
257
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"][0], 3))
258
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"][0], 3))
259
+ phi_list.append(phi_minerals[key])
260
+ #
261
+ K_geo = elast.calc_geometric_mean(self, phi_list, K_list)
262
+ G_geo = elast.calc_geometric_mean(self, phi_list, G_list)
263
+ #
264
+ anisotropic_factor = round(rd.uniform(0.415, 0.425), 2)
265
+ #
266
+ bulk_mod = K_geo/anisotropic_factor
267
+ shear_mod = G_geo/anisotropic_factor
268
+ #
269
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
270
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 6)
271
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
272
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
273
+ vPvS = round(vP/vS, 6)
274
+
275
+ for key, value in w_minerals.items():
276
+ results_container["mineralogy"][key].append(value)
277
+
278
+ amounts = []
279
+ for key, value in w_elements.items():
280
+ results_container["chemistry"][key].append(value)
281
+ chem_data = PeriodicSystem(name=key).get_data()
282
+ amounts.append([key, chem_data[1], value])
283
+
284
+ list_elements = list(w_elements.keys())
285
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
286
+ composition_oxides = {}
287
+
288
+ for var_oxide in list_oxides:
289
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
290
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
291
+
292
+ if list_oxides[0] not in results_container["compounds"]:
293
+ for oxide in list_oxides:
294
+ results_container["compounds"][oxide] = []
295
+
296
+ for key, value in composition_oxides.items():
297
+ results_container["compounds"][key].append(value)
298
+
299
+ results_container["mineralogy"] = dict(sorted(
300
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
301
+ results_container["chemistry"] = dict(sorted(
302
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
303
+ results_container["compounds"] = dict(sorted(
304
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
305
+
306
+ results_container["phi"].append(var_porosity)
307
+ results_container["rho_s"].append(rho_s)
308
+ results_container["rho"].append(rho)
309
+ results_container["vP"].append(vP)
310
+ results_container["vS"].append(vS)
311
+ results_container["vP/vS"].append(vPvS)
312
+ results_container["K"].append(bulk_mod)
313
+ results_container["G"].append(shear_mod)
314
+ results_container["E"].append(youngs_mod)
315
+ results_container["nu"].append(poisson_rat)
316
+ results_container["GR"].append(gamma_ray)
317
+ results_container["PE"].append(photoelectricity)
318
+ #
319
+ n += 1
320
+ #
321
+ return results_container
322
+ #
323
+ class MetamorphicRocks:
324
+ #
325
+ def __init__(self, fluid="water", actualThickness=100):
326
+ self.fluid = fluid
327
+ self.actualThickness = actualThickness
328
+ #
329
+ ## Minerals
330
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
331
+ self.data_kyanite = Nesosilicates(impurity="pure", data_type=True).create_kyanite()
332
+ self.data_sillimanite = Nesosilicates(impurity="pure", data_type=True).create_sillimanite()
333
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
334
+ #
335
+ ## Fluids
336
+ self.data_water = Water.water("")
337
+ #
338
+ def create_granulite(self, number, porosity=None):
339
+ #
340
+ self.data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
341
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
342
+ self.data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
343
+ #
344
+ assemblage = [self.data_quartz, self.data_alkalifeldspar, self.data_plagioclase, self.data_garnet_al,
345
+ self.data_kyanite, self.data_sillimanite]
346
+ #
347
+ amounts_mineralogy = {}
348
+ amounts_chemistry = {}
349
+ bulk_properties = {}
350
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
351
+ for property in properties:
352
+ bulk_properties[property] = []
353
+ mineral_list = []
354
+ elements = []
355
+ for mineral in assemblage:
356
+ amounts_mineralogy[mineral["mineral"]] = []
357
+ mineral_list.append(mineral["mineral"])
358
+ elements_mineral = list(mineral["chemistry"].keys())
359
+ for element in elements_mineral:
360
+ if element not in elements:
361
+ elements.append(element)
362
+ amounts_chemistry[element] = []
363
+ mineral_list.sort()
364
+ elements.sort()
365
+ #
366
+ n = 0
367
+ amounts_helper = []
368
+ while n < number:
369
+ w_total = 0
370
+ n_minerals = 0
371
+ #x = round(rd.uniform(0.0, 1.0), 4)
372
+ for mineral in mineral_list:
373
+ if mineral == "Qz":
374
+ if n_minerals < len(mineral_list)-1:
375
+ value = round(rd.uniform(0.25, 0.65), 4)
376
+ #value = round(0.65 - 0.35*x, 4)
377
+ else:
378
+ value = round(1-w_total, 4)
379
+ if value >= 0.0 and 0.25 <= value <= 0.65:
380
+ amounts_helper.append(value)
381
+ w_total += value
382
+ n_minerals += 1
383
+ elif mineral == "Kfs":
384
+ if n_minerals < len(mineral_list)-1:
385
+ value = round(rd.uniform(0.0, 0.60), 4)
386
+ #value = round(0.10 + 0.50*x, 4)
387
+ else:
388
+ value = round(1-w_total, 4)
389
+ if value >= 0.0 and 0.0 <= value <= 0.60:
390
+ amounts_helper.append(value)
391
+ w_total += value
392
+ n_minerals += 1
393
+ elif mineral == "Pl":
394
+ if n_minerals < len(mineral_list)-1:
395
+ value = round(rd.uniform(0.0, 0.60), 4)
396
+ #value = round(0.15 - 0.5*x, 4)
397
+ else:
398
+ value = round(1-w_total, 4)
399
+ if value >= 0.0 and 0.0 <= value <= 0.60:
400
+ amounts_helper.append(value)
401
+ w_total += value
402
+ n_minerals += 1
403
+ elif mineral == "Grt":
404
+ if n_minerals < len(mineral_list)-1:
405
+ value = round(rd.uniform(0.0, 0.05), 4)
406
+ #value = round(0.05*(1-x), 4)
407
+ else:
408
+ value = round(1-w_total, 4)
409
+ if value >= 0.0 and 0.0 <= value <= 0.05:
410
+ amounts_helper.append(value)
411
+ w_total += value
412
+ n_minerals += 1
413
+ elif mineral == "Ky":
414
+ if n_minerals < len(mineral_list)-1:
415
+ value = round(rd.uniform(0.0, 0.03), 4)
416
+ #value = round(0.025*(1-x), 4)
417
+ else:
418
+ value = round(1-w_total, 4)
419
+ if value >= 0.0 and 0.0 <= value <= 0.025:
420
+ amounts_helper.append(value)
421
+ w_total += value
422
+ n_minerals += 1
423
+ elif mineral == "Sil":
424
+ if n_minerals < len(mineral_list)-1:
425
+ value = round(1-w_total, 4)
426
+ #value = round(0.025*(1-x), 4)
427
+ else:
428
+ value = round(1-w_total, 4)
429
+ if value >= 0.0 and 0.0 <= value <= 0.025:
430
+ amounts_helper.append(value)
431
+ w_total += value
432
+ n_minerals += 1
433
+ #
434
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
435
+ for index, mineral in enumerate(mineral_list):
436
+ amounts_mineralogy[mineral].append(amounts_helper[index])
437
+ n += 1
438
+ amounts_helper.clear()
439
+ else:
440
+ n += 0
441
+ amounts_helper.clear()
442
+ #
443
+ n = 0
444
+ amounts_helper = {}
445
+ while n < number:
446
+ w_total = 0
447
+ n_elements = 0
448
+ rho_s_helper = 0
449
+ rho_helper = 0
450
+ bulkmod_helper = 0
451
+ shearmod_helper = 0
452
+ youngsmod_helper = 0
453
+ poisson_helper = 0
454
+ vP_helper = 0
455
+ vS_helper = 0
456
+ vPvS_helper = 0
457
+ gr_helper = 0
458
+ pe_helper = 0
459
+ if porosity == None:
460
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
461
+ else:
462
+ phi_helper = porosity
463
+ self.data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
464
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
465
+ self.data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
466
+ for element in elements:
467
+ amounts_helper[element] = 0
468
+ if element in self.data_quartz["chemistry"]:
469
+ if n_elements < len(elements)-1:
470
+ value = round(amounts_mineralogy["Qz"][n]*self.data_quartz["chemistry"][element], 4)
471
+ else:
472
+ value = round(1-w_total, 4)
473
+ amounts_helper[element] += value
474
+ w_total += value
475
+ if element in self.data_alkalifeldspar["chemistry"]:
476
+ if n_elements < len(elements)-1:
477
+ value = round(amounts_mineralogy["Kfs"][n]*self.data_alkalifeldspar["chemistry"][element], 4)
478
+ else:
479
+ value = round(1-w_total, 4)
480
+ amounts_helper[element] += value
481
+ w_total += value
482
+ if element in self.data_plagioclase["chemistry"]:
483
+ if n_elements < len(elements)-1:
484
+ value = round(amounts_mineralogy["Pl"][n]*self.data_plagioclase["chemistry"][element], 4)
485
+ else:
486
+ value = round(1-w_total, 4)
487
+ amounts_helper[element] += value
488
+ w_total += value
489
+ if element in self.data_garnet_al["chemistry"]:
490
+ if n_elements < len(elements)-1:
491
+ value = round(amounts_mineralogy["Grt"][n]*self.data_garnet_al["chemistry"][element], 4)
492
+ else:
493
+ value = round(1-w_total, 4)
494
+ amounts_helper[element] += value
495
+ w_total += value
496
+ if element in self.data_kyanite["chemistry"]:
497
+ if n_elements < len(elements)-1:
498
+ value = round(amounts_mineralogy["Ky"][n]*self.data_kyanite["chemistry"][element], 4)
499
+ else:
500
+ value = round(1-w_total, 4)
501
+ amounts_helper[element] += value
502
+ w_total += value
503
+ if element in self.data_sillimanite["chemistry"]:
504
+ if n_elements < len(elements)-1:
505
+ value = round(amounts_mineralogy["Sil"][n]*self.data_sillimanite["chemistry"][element], 4)
506
+ else:
507
+ value = round(1-w_total, 4)
508
+ amounts_helper[element] += value
509
+ w_total += value
510
+ n_elements += 1
511
+ if sum(amounts_helper.values()) == 1.0:
512
+ for key, value in amounts_helper.items():
513
+ amounts_chemistry[key].append(round(value, 4))
514
+ for mineral in mineral_list:
515
+ if mineral == "Qz":
516
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["rho"], 3)
517
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["K"], 3)
518
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_quartz["G"], 3)
519
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["GR"], 3)
520
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["PE"], 3)
521
+ elif mineral == "Kfs":
522
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["rho"], 3)
523
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["K"], 3)
524
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["G"], 3)
525
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["GR"], 3)
526
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_alkalifeldspar["PE"], 3)
527
+ elif mineral == "Pl":
528
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["rho"], 3)
529
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["K"], 3)
530
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_plagioclase["G"], 3)
531
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["GR"], 3)
532
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["PE"], 3)
533
+ elif mineral == "Grt":
534
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_garnet_al["rho"], 3)
535
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_garnet_al["K"], 3)
536
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_garnet_al["G"], 3)
537
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_garnet_al["GR"], 3)
538
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_garnet_al["PE"], 3)
539
+ elif mineral == "Ky":
540
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_kyanite["rho"], 3)
541
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_kyanite["K"], 3)
542
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_kyanite["G"], 3)
543
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_kyanite["GR"], 3)
544
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_kyanite["PE"], 3)
545
+ elif mineral == "Sil":
546
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_sillimanite["rho"], 3)
547
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_sillimanite["K"], 3)
548
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_sillimanite["G"], 3)
549
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_sillimanite["GR"], 3)
550
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_sillimanite["PE"], 3)
551
+ #
552
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
553
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
554
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
555
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
556
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
557
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
558
+ #
559
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
560
+ bulk_properties["rho"].append(rho_helper)
561
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
562
+ bulk_properties["G"].append(round(shearmod_helper, 3))
563
+ bulk_properties["E"].append(youngsmod_helper)
564
+ bulk_properties["nu"].append(poisson_helper)
565
+ bulk_properties["vP"].append(vP_helper)
566
+ bulk_properties["vS"].append(vS_helper)
567
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
568
+ bulk_properties["GR"].append(round(gr_helper, 3))
569
+ bulk_properties["PE"].append(round(pe_helper, 3))
570
+ bulk_properties["phi"].append(round(phi_helper, 3))
571
+ n += 1
572
+ #
573
+ # for key, value in amounts_mineralogy.items():
574
+ # print("Mineral:", key, "Mean:", round(np.mean(value)*100, 4), "STD:", round(np.std(value, ddof=1)*100, 4))
575
+ # print("")
576
+ # for key, value in amounts_chemistry.items():
577
+ # print("Element:", key, "Mean:", round(np.mean(value)*100, 4), "STD:", round(np.std(value, ddof=1)*100, 4))
578
+ # print("")
579
+ # for key, value in bulk_properties.items():
580
+ # print("Property:", key, "Mean:", round(np.mean(value), 4), "STD:", round(np.std(value, ddof=1), 4))
581
+ #
582
+ results = {}
583
+ results["rock"] = "Granulite"
584
+ if number > 1:
585
+ results["mineralogy"] = amounts_mineralogy
586
+ results["chemistry"] = amounts_chemistry
587
+ results["phi"] = bulk_properties["phi"]
588
+ results["fluid"] = "water"
589
+ results["rho_s"] = bulk_properties["rho_s"]
590
+ results["rho"] = bulk_properties["rho"]
591
+ results["vP"] = bulk_properties["vP"]
592
+ results["vS"] = bulk_properties["vS"]
593
+ results["vP/vS"] = bulk_properties["vPvS"]
594
+ results["K"] = bulk_properties["K"]
595
+ results["G"] = bulk_properties["G"]
596
+ results["E"] = bulk_properties["E"]
597
+ results["nu"] = bulk_properties["nu"]
598
+ results["GR"] = bulk_properties["GR"]
599
+ results["PE"] = bulk_properties["PE"]
600
+ else:
601
+ single_amounts_mineralogy = {}
602
+ single_amounts_chemistry = {}
603
+ for mineral, value in amounts_mineralogy.items():
604
+ single_amounts_mineralogy[mineral] = value[0]
605
+ for element, value in amounts_chemistry.items():
606
+ single_amounts_chemistry[element] = value[0]
607
+ results["mineralogy"] = single_amounts_mineralogy
608
+ results["chemistry"] = single_amounts_chemistry
609
+ results["phi"] = bulk_properties["phi"][0]
610
+ results["fluid"] = "water"
611
+ results["rho_s"] = bulk_properties["rho_s"][0]
612
+ results["rho"] = bulk_properties["rho"][0]
613
+ results["vP"] = bulk_properties["vP"][0]
614
+ results["vS"] = bulk_properties["vS"][0]
615
+ results["vP/vS"] = bulk_properties["vPvS"][0]
616
+ results["K"] = bulk_properties["K"][0]
617
+ results["G"] = bulk_properties["G"][0]
618
+ results["E"] = bulk_properties["E"][0]
619
+ results["nu"] = bulk_properties["nu"][0]
620
+ results["GR"] = bulk_properties["GR"][0]
621
+ results["PE"] = bulk_properties["PE"][0]
622
+ #
623
+ return results
624
+ #
625
+ class GreenschistFacies:
626
+ #
627
+ def __init__(self, fluid="water", actual_thickness=100, porosity=None):
628
+ self.fluid = fluid
629
+ self.actualThickness = actual_thickness
630
+ self.porosity = porosity
631
+ #
632
+ ## Minerals
633
+ self.data_brucite = Oxides(impurity="pure", data_type=True).create_brucite()
634
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
635
+ self.data_kyanite = Nesosilicates(impurity="pure", data_type=True).create_kyanite()
636
+ self.data_sillimanite = Nesosilicates(impurity="pure", data_type=True).create_sillimanite()
637
+ self.data_diopside = Inosilicates(impurity="pure", data_type=True).create_diopside()
638
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
639
+ self.data_epidote = Sorosilicates(impurity="pure", data_type=True).create_epidote()
640
+ self.data_chrysotile = Phyllosilicates(impurity="pure", data_type=True).create_chrysotile()
641
+ self.data_pyrophyllite = Phyllosilicates(impurity="pure", data_type=True).create_pyrophyllite()
642
+ self.data_talc = Phyllosilicates(impurity="pure", data_type=True).create_talc()
643
+ #
644
+ ## Fluids
645
+ self.data_water = Water.water("")
646
+ #
647
+ def create_greenschist_basaltic_alt(self, number=1, composition=None):
648
+ results_container = {}
649
+ results_container["rock"] = "Greenschist"
650
+ results_container["mineralogy"] = {}
651
+ results_container["chemistry"] = {}
652
+ results_container["compounds"] = {}
653
+ results_container["phi"] = []
654
+ results_container["fluid"] = self.fluid
655
+ results_container["rho_s"] = []
656
+ results_container["rho"] = []
657
+ results_container["vP"] = []
658
+ results_container["vS"] = []
659
+ results_container["vP/vS"] = []
660
+ results_container["K"] = []
661
+ results_container["G"] = []
662
+ results_container["E"] = []
663
+ results_container["nu"] = []
664
+ results_container["GR"] = []
665
+ results_container["PE"] = []
666
+ #
667
+ n = 0
668
+ while n < number:
669
+ data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
670
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
671
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
672
+ #
673
+ mineralogy = {"Chl": data_chlorite, "Act": data_actinolite, "Pl": data_plagioclase, "Ep": self.data_epidote}
674
+ #
675
+ minerals_list = list(mineralogy.keys())
676
+ #
677
+ if minerals_list[0] not in results_container["mineralogy"]:
678
+ for mineral in minerals_list:
679
+ results_container["mineralogy"][mineral] = []
680
+ #
681
+ if self.porosity == None:
682
+ phi_helper = round(rd.uniform(0.0, 0.4), 4)
683
+ else:
684
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
685
+ #
686
+ #
687
+ condition = False
688
+ #
689
+ while condition == False:
690
+ elements_list = []
691
+ phi_minerals = {}
692
+ w_minerals = {}
693
+ w_elements = {}
694
+ #
695
+ if composition != None:
696
+ phi_chl = composition["Chl"]
697
+ phi_act = composition["Act"]
698
+ phi_pl = composition["Pl"]
699
+ phi_ep = composition["Ep"]
700
+ #
701
+ phi_minerals["Chl"] = phi_chl
702
+ phi_minerals["Act"] = phi_act
703
+ phi_minerals["Pl"] = phi_pl
704
+ phi_minerals["Ep"] = phi_ep
705
+ else:
706
+ condition_2 = False
707
+ while condition_2 == False:
708
+ phi_act = round(rd.uniform(0.20, 0.30), 4)
709
+ phi_chl = round(rd.uniform(0.25, (1.0 - phi_act)), 4)
710
+ phi_pl = round(rd.uniform(0.2, (1.0 - phi_act - phi_chl)), 4)
711
+ phi_ep = round(1 - phi_act - phi_chl - phi_pl, 4)
712
+ phi_total = phi_act + phi_chl + phi_pl + phi_ep
713
+ #
714
+ if np.isclose(phi_total, 1.0000) == True:
715
+ if 0.2 <= phi_act <= 0.3 and 0.25 <= phi_chl <= 0.5 and 0.2 <= phi_pl <= 0.55 \
716
+ and 0.0 <= phi_ep <= 0.05:
717
+ condition_2 = True
718
+ #
719
+ phi_minerals["Chl"] = phi_chl
720
+ phi_minerals["Act"] = phi_act
721
+ phi_minerals["Pl"] = phi_pl
722
+ phi_minerals["Ep"] = phi_ep
723
+ #
724
+ rho_s = 0
725
+ velocities_minerals = {}
726
+ for key, value in phi_minerals.items():
727
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
728
+ #
729
+ velocities_minerals[key] = {}
730
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
731
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
732
+ #
733
+ for element, value in mineralogy[key]["chemistry"].items():
734
+ if element not in elements_list:
735
+ elements_list.append(element)
736
+ w_elements[element] = 0.0
737
+ #
738
+ if elements_list[0] not in results_container["chemistry"]:
739
+ for element in elements_list:
740
+ results_container["chemistry"][element] = []
741
+ #
742
+ rho_s = round(rho_s, 3)
743
+ #
744
+ for key, value in phi_minerals.items():
745
+ if key == "Urn":
746
+ n_digits = 4
747
+ else:
748
+ n_digits = 4
749
+ #
750
+ w_minerals[key] = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
751
+ #
752
+ if self.fluid == "water":
753
+ data_fluid = self.data_water
754
+ elif self.fluid == "oil":
755
+ data_fluid = self.data_oil
756
+ elif self.fluid == "gas":
757
+ data_fluid = self.data_gas
758
+ #
759
+ old_index = elements_list.index("O")
760
+ elements_list += [elements_list.pop(old_index)]
761
+ #
762
+ w_elements_total = 0.0
763
+ for element in elements_list:
764
+ if element != "O":
765
+ for mineral, w_mineral in w_minerals.items():
766
+ if element in mineralogy[mineral]["chemistry"]:
767
+ if element == "U":
768
+ n_digits = 4
769
+ else:
770
+ n_digits = 4
771
+ #
772
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
773
+ w_elements[element] += value
774
+ w_elements_total += value
775
+ #
776
+ w_elements[element] = round(w_elements[element], n_digits)
777
+ elif element == "O":
778
+ w_elements[element] += round(1 - w_elements_total, 4)
779
+ #
780
+ w_elements[element] = round(w_elements[element], 4)
781
+ #
782
+ total_w_minerals = round(sum(w_minerals.values()), 4)
783
+ total_w_elements = round(sum(w_elements.values()), 4)
784
+ if total_w_minerals == 1.0 and total_w_elements == 1.0:
785
+ for key, value in w_minerals.items():
786
+ w_minerals[key] = abs(value)
787
+ #
788
+ for key, value in w_elements.items():
789
+ w_elements[key] = abs(value)
790
+ #
791
+ condition = True
792
+ #
793
+ gamma_ray = 0.0
794
+ photoelectricity = 0.0
795
+ #
796
+ K_list = []
797
+ G_list = []
798
+ bulk_mod = 0
799
+ shear_mod = 0
800
+ phi_list = []
801
+ for key, value in phi_minerals.items():
802
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
803
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
804
+ #
805
+ gamma_ray = round(gamma_ray, 3)
806
+ photoelectricity = round(photoelectricity, 3)
807
+ #
808
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
809
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
810
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
811
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
812
+ phi_list.append(phi_minerals[key])
813
+ #
814
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
815
+ bulk_mod = round(bulk_mod, 3)
816
+ shear_mod = round(shear_mod, 3)
817
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
818
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
819
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
820
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
821
+ vPvS = round(vP/vS, 3)
822
+
823
+ ## RESULTS
824
+ for key, value in w_minerals.items():
825
+ results_container["mineralogy"][key].append(value)
826
+
827
+ amounts = []
828
+ for key, value in w_elements.items():
829
+ results_container["chemistry"][key].append(value)
830
+ chem_data = PeriodicSystem(name=key).get_data()
831
+ amounts.append([key, chem_data[1], value])
832
+
833
+ list_elements = list(w_elements.keys())
834
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
835
+ composition_oxides = {}
836
+
837
+ for var_oxide in list_oxides:
838
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
839
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
840
+
841
+ if list_oxides[0] not in results_container["compounds"]:
842
+ for oxide in list_oxides:
843
+ results_container["compounds"][oxide] = []
844
+
845
+ for key, value in composition_oxides.items():
846
+ results_container["compounds"][key].append(value)
847
+
848
+ results_container["mineralogy"] = dict(sorted(
849
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
850
+ results_container["chemistry"] = dict(sorted(
851
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
852
+ results_container["compounds"] = dict(sorted(
853
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
854
+
855
+ results_container["phi"].append(phi_helper)
856
+ results_container["rho_s"].append(rho_s)
857
+ results_container["rho"].append(rho)
858
+ results_container["vP"].append(vP)
859
+ results_container["vS"].append(vS)
860
+ results_container["vP/vS"].append(vPvS)
861
+ results_container["K"].append(bulk_mod)
862
+ results_container["G"].append(shear_mod)
863
+ results_container["E"].append(youngs_mod)
864
+ results_container["nu"].append(poisson_rat)
865
+ results_container["GR"].append(gamma_ray)
866
+ results_container["PE"].append(photoelectricity)
867
+ #
868
+ n += 1
869
+ #
870
+ return results_container
871
+ #
872
+ def create_greenschist_ultramafic_alt(self, number=1, composition=None):
873
+ results_container = {}
874
+ results_container["rock"] = "Greenschist"
875
+ results_container["mineralogy"] = {}
876
+ results_container["chemistry"] = {}
877
+ results_container["compounds"] = {}
878
+ results_container["phi"] = []
879
+ results_container["fluid"] = self.fluid
880
+ results_container["rho_s"] = []
881
+ results_container["rho"] = []
882
+ results_container["vP"] = []
883
+ results_container["vS"] = []
884
+ results_container["vP/vS"] = []
885
+ results_container["K"] = []
886
+ results_container["G"] = []
887
+ results_container["E"] = []
888
+ results_container["nu"] = []
889
+ results_container["GR"] = []
890
+ results_container["PE"] = []
891
+ #
892
+ n = 0
893
+ while n < number:
894
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
895
+ #
896
+ mineralogy = {"Chl": data_chlorite, "Ctl": self.data_chrysotile, "Tlc": self.data_talc,
897
+ "Tr": self.data_tremolite, "Di": self.data_diopside, "Bru": self.data_brucite}
898
+ #
899
+ minerals_list = list(mineralogy.keys())
900
+ #
901
+ if minerals_list[0] not in results_container["mineralogy"]:
902
+ for mineral in minerals_list:
903
+ results_container["mineralogy"][mineral] = []
904
+ #
905
+ if self.porosity == None:
906
+ phi_helper = round(rd.uniform(0.0, 0.1), 4)
907
+ else:
908
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
909
+ #
910
+ #
911
+ condition = False
912
+ #
913
+ while condition == False:
914
+ elements_list = []
915
+ phi_minerals = {}
916
+ w_minerals = {}
917
+ w_elements = {}
918
+ #
919
+ if composition != None:
920
+ phi_chl = composition["Chl"]
921
+ phi_ctl = composition["Ctl"]
922
+ phi_tlc = composition["Tlc"]
923
+ phi_tr = composition["Tr"]
924
+ phi_di = composition["Di"]
925
+ phi_bru = composition["Bru"]
926
+ #
927
+ phi_minerals["Chl"] = phi_chl
928
+ phi_minerals["Ctl"] = phi_ctl
929
+ phi_minerals["Tlc"] = phi_tlc
930
+ phi_minerals["Tr"] = phi_tr
931
+ phi_minerals["Di"] = phi_di
932
+ phi_minerals["Bru"] = phi_bru
933
+ #
934
+ else:
935
+ condition_2 = False
936
+ #
937
+ while condition_2 == False:
938
+ phi_chl = round(rd.uniform(0.25, 0.50), 4)
939
+ phi_ctl = round(rd.uniform(0.25, (1.0 - phi_chl)), 4)
940
+ phi_tlc = round(rd.uniform(0.15, (1.0 - phi_chl - phi_ctl)), 4)
941
+ phi_tr = round(rd.uniform(0.1, (1.0 - phi_chl - phi_ctl - phi_tlc)), 4)
942
+ phi_di = round(rd.uniform(0.0, (1.0 - phi_chl - phi_ctl - phi_tlc - phi_tr)), 4)
943
+ phi_bru = round(1 - phi_chl - phi_ctl - phi_tlc - phi_tr - phi_di, 4)
944
+ #
945
+ phi_total = phi_chl + phi_ctl + phi_tlc + phi_tr + phi_di + phi_bru
946
+ #
947
+ if np.isclose(phi_total, 1.0000) == True:
948
+ if 0.25 <= phi_chl <= 0.5 and 0.25 <= phi_ctl <= 0.5 and 0.15 <= phi_tlc <= 0.2 \
949
+ and 0.1 <= phi_tr <= 0.2 and 0.0 <= phi_di <= 0.05 and 0.0 <= phi_bru <= 0.05:
950
+ condition_2 = True
951
+ #
952
+ phi_minerals["Chl"] = phi_chl
953
+ phi_minerals["Ctl"] = phi_ctl
954
+ phi_minerals["Tlc"] = phi_tlc
955
+ phi_minerals["Tr"] = phi_tr
956
+ phi_minerals["Di"] = phi_di
957
+ phi_minerals["Bru"] = phi_bru
958
+ #
959
+ rho_s = 0
960
+ velocities_minerals = {}
961
+ for key, value in phi_minerals.items():
962
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
963
+ #
964
+ velocities_minerals[key] = {}
965
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
966
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
967
+ #
968
+ for element, value in mineralogy[key]["chemistry"].items():
969
+ if element not in elements_list:
970
+ elements_list.append(element)
971
+ w_elements[element] = 0.0
972
+ #
973
+ if elements_list[0] not in results_container["chemistry"]:
974
+ for element in elements_list:
975
+ results_container["chemistry"][element] = []
976
+ #
977
+ rho_s = round(rho_s, 3)
978
+ #
979
+ n_minerals = len(minerals_list)
980
+ w_minerals_total = 0
981
+ for index, (key, value) in enumerate(phi_minerals.items()):
982
+ if key == "Urn":
983
+ n_digits = 4
984
+ else:
985
+ n_digits = 4
986
+ #
987
+ if index < n_minerals - 1:
988
+ result = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
989
+ w_minerals[key] = result
990
+ w_minerals_total += result
991
+ else:
992
+ w_minerals[key] = round(1 - w_minerals_total, n_digits)
993
+ #
994
+ total_w_minerals = round(sum(w_minerals.values()), 4)
995
+ #
996
+ if self.fluid == "water":
997
+ data_fluid = self.data_water
998
+ #
999
+ old_index = elements_list.index("O")
1000
+ elements_list += [elements_list.pop(old_index)]
1001
+ #
1002
+ w_elements_total = 0.0
1003
+ for element in elements_list:
1004
+ if element != "O":
1005
+ for mineral, w_mineral in w_minerals.items():
1006
+ if element in mineralogy[mineral]["chemistry"]:
1007
+ if element == "U":
1008
+ n_digits = 4
1009
+ else:
1010
+ n_digits = 4
1011
+ #
1012
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1013
+ w_elements[element] += value
1014
+ w_elements_total += value
1015
+ #
1016
+ w_elements[element] = round(w_elements[element], n_digits)
1017
+ #
1018
+ elif element == "O":
1019
+ w_elements[element] += round(1 - w_elements_total, 4)
1020
+ #
1021
+ w_elements[element] = round(w_elements[element], 4)
1022
+ #
1023
+ total_w_elements = round(sum(w_elements.values()), 4)
1024
+ #
1025
+ if np.isclose(total_w_minerals, 1.00) == True and np.isclose(total_w_elements, 1.00) == True:
1026
+ for key, value in w_minerals.items():
1027
+ w_minerals[key] = abs(value)
1028
+ #
1029
+ for key, value in w_elements.items():
1030
+ w_elements[key] = abs(value)
1031
+ #
1032
+ condition = True
1033
+ #
1034
+ gamma_ray = 0.0
1035
+ photoelectricity = 0.0
1036
+ #
1037
+ K_list = []
1038
+ G_list = []
1039
+ bulk_mod = 0
1040
+ shear_mod = 0
1041
+ phi_list = []
1042
+ for key, value in phi_minerals.items():
1043
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
1044
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
1045
+ #
1046
+ gamma_ray = round(gamma_ray, 3)
1047
+ photoelectricity = round(photoelectricity, 3)
1048
+ #
1049
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
1050
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
1051
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
1052
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
1053
+ phi_list.append(phi_minerals[key])
1054
+ #
1055
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
1056
+ bulk_mod = round(bulk_mod, 3)
1057
+ shear_mod = round(shear_mod, 3)
1058
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
1059
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
1060
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
1061
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
1062
+ vPvS = round(vP/vS, 3)
1063
+
1064
+ ## RESULTS
1065
+ for key, value in w_minerals.items():
1066
+ results_container["mineralogy"][key].append(value)
1067
+
1068
+ amounts = []
1069
+ for key, value in w_elements.items():
1070
+ results_container["chemistry"][key].append(value)
1071
+ chem_data = PeriodicSystem(name=key).get_data()
1072
+ amounts.append([key, chem_data[1], value])
1073
+
1074
+ list_elements = list(w_elements.keys())
1075
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
1076
+ composition_oxides = {}
1077
+
1078
+ for var_oxide in list_oxides:
1079
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1080
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1081
+
1082
+ if list_oxides[0] not in results_container["compounds"]:
1083
+ for oxide in list_oxides:
1084
+ results_container["compounds"][oxide] = []
1085
+
1086
+ for key, value in composition_oxides.items():
1087
+ results_container["compounds"][key].append(value)
1088
+
1089
+ results_container["mineralogy"] = dict(sorted(
1090
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1091
+ results_container["chemistry"] = dict(sorted(
1092
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1093
+ results_container["compounds"] = dict(sorted(
1094
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1095
+
1096
+ results_container["phi"].append(phi_helper)
1097
+ results_container["rho_s"].append(rho_s)
1098
+ results_container["rho"].append(rho)
1099
+ results_container["vP"].append(vP)
1100
+ results_container["vS"].append(vS)
1101
+ results_container["vP/vS"].append(vPvS)
1102
+ results_container["K"].append(bulk_mod)
1103
+ results_container["G"].append(shear_mod)
1104
+ results_container["E"].append(youngs_mod)
1105
+ results_container["nu"].append(poisson_rat)
1106
+ results_container["GR"].append(gamma_ray)
1107
+ results_container["PE"].append(photoelectricity)
1108
+ #
1109
+ n += 1
1110
+ #
1111
+ return results_container
1112
+ #
1113
+ def create_greenschist_pelitic_alt(self, number=1, composition=None):
1114
+ results_container = {}
1115
+ results_container["rock"] = "Greenschist"
1116
+ results_container["mineralogy"] = {}
1117
+ results_container["chemistry"] = {}
1118
+ results_container["compounds"] = {}
1119
+ results_container["phi"] = []
1120
+ results_container["fluid"] = self.fluid
1121
+ results_container["rho_s"] = []
1122
+ results_container["rho"] = []
1123
+ results_container["vP"] = []
1124
+ results_container["vS"] = []
1125
+ results_container["vP/vS"] = []
1126
+ results_container["K"] = []
1127
+ results_container["G"] = []
1128
+ results_container["E"] = []
1129
+ results_container["nu"] = []
1130
+ results_container["GR"] = []
1131
+ results_container["PE"] = []
1132
+ #
1133
+ n = 0
1134
+ while n < number:
1135
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar()
1136
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1137
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1138
+ data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite()
1139
+ data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
1140
+ #
1141
+ mineralogy = {"Qz": self.data_quartz, "Kfs": data_alkalifeldspar, "Pl": data_plagioclase,
1142
+ "Chl": data_chlorite, "Ms": data_muscovite, "Grt": data_garnet_al,
1143
+ "Prl": self.data_pyrophyllite}
1144
+ #
1145
+ minerals_list = list(mineralogy.keys())
1146
+ #
1147
+ if minerals_list[0] not in results_container["mineralogy"]:
1148
+ for mineral in minerals_list:
1149
+ results_container["mineralogy"][mineral] = []
1150
+ #
1151
+ if self.porosity == None:
1152
+ phi_helper = round(rd.uniform(0.0, 0.1), 4)
1153
+ else:
1154
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
1155
+ #
1156
+ #
1157
+ condition = False
1158
+ #
1159
+ while condition == False:
1160
+ elements_list = []
1161
+ phi_minerals = {}
1162
+ w_minerals = {}
1163
+ w_elements = {}
1164
+ #
1165
+ if composition != None:
1166
+ phi_qz = composition["Qz"]
1167
+ phi_kfs = composition["Kfs"]
1168
+ phi_pl = composition["Pl"]
1169
+ phi_chl = composition["Chl"]
1170
+ phi_ms = composition["Ms"]
1171
+ phi_grt = composition["Grt"]
1172
+ phi_prl = composition["Prl"]
1173
+ #
1174
+ phi_minerals["Qz"] = phi_qz
1175
+ phi_minerals["Kfs"] = phi_kfs
1176
+ phi_minerals["Pl"] = phi_pl
1177
+ phi_minerals["Chl"] = phi_chl
1178
+ phi_minerals["Ms"] = phi_ms
1179
+ phi_minerals["Grt"] = phi_grt
1180
+ phi_minerals["Prl"] = phi_prl
1181
+ #
1182
+ else:
1183
+ condition_2 = False
1184
+ #
1185
+ while condition_2 == False: # Qz (0.25, 0.7), Kfs (0.05, 0.15), Pl (0.05, 0.15), Chl (0.15, 0.3), Ms (0, 0.1), Grt (0, 0.05), Prl (0, 0.05)
1186
+ phi_qz = round(rd.uniform(0.25, 0.7), 4)
1187
+ phi_chl = round(rd.uniform(0.15, (1.0 - phi_qz)), 4)
1188
+ phi_kfs = round(rd.uniform(0.05, (1.0 - phi_qz - phi_chl)), 4)
1189
+ phi_pl = round(rd.uniform(0.05, (1.0 - phi_qz - phi_chl - phi_kfs)), 4)
1190
+ phi_ms = round(rd.uniform(0.0, (1.0 - phi_qz - phi_chl - phi_kfs - phi_pl)), 4)
1191
+ phi_grt = round(rd.uniform(0.0, (1.0 - phi_qz - phi_chl - phi_kfs - phi_pl - phi_ms)), 4)
1192
+ phi_prl = round(1 - phi_qz - phi_chl - phi_kfs - phi_pl - phi_ms - phi_grt, 4)
1193
+ #
1194
+ phi_total = phi_qz + phi_chl + phi_kfs + phi_pl + phi_ms + phi_grt + phi_prl
1195
+ #
1196
+ if np.isclose(phi_total, 1.0000) == True:
1197
+ if 0.25 <= phi_qz <= 0.7 and 0.15 <= phi_chl <= 0.3 and 0.05 <= phi_kfs <= 0.15 \
1198
+ and 0.05 <= phi_pl <= 0.15 and 0.0 <= phi_ms <= 0.1 and 0.0 <= phi_grt <= 0.05 \
1199
+ and 0.0 <= phi_prl <= 0.05:
1200
+ condition_2 = True
1201
+ #
1202
+ phi_minerals["Qz"] = phi_qz
1203
+ phi_minerals["Kfs"] = phi_kfs
1204
+ phi_minerals["Pl"] = phi_pl
1205
+ phi_minerals["Chl"] = phi_chl
1206
+ phi_minerals["Ms"] = phi_ms
1207
+ phi_minerals["Grt"] = phi_grt
1208
+ phi_minerals["Prl"] = phi_prl
1209
+ #
1210
+ rho_s = 0
1211
+ velocities_minerals = {}
1212
+ for key, value in phi_minerals.items():
1213
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
1214
+ #
1215
+ velocities_minerals[key] = {}
1216
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
1217
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
1218
+ #
1219
+ for element, value in mineralogy[key]["chemistry"].items():
1220
+ if element not in elements_list:
1221
+ elements_list.append(element)
1222
+ w_elements[element] = 0.0
1223
+ #
1224
+ if elements_list[0] not in results_container["chemistry"]:
1225
+ for element in elements_list:
1226
+ results_container["chemistry"][element] = []
1227
+ #
1228
+ rho_s = round(rho_s, 3)
1229
+ #
1230
+ n_minerals = len(minerals_list)
1231
+ w_minerals_total = 0
1232
+ for index, (key, value) in enumerate(phi_minerals.items()):
1233
+ if key == "Urn":
1234
+ n_digits = 4
1235
+ else:
1236
+ n_digits = 4
1237
+ #
1238
+ if index < n_minerals - 1:
1239
+ result = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
1240
+ w_minerals[key] = result
1241
+ w_minerals_total += result
1242
+ else:
1243
+ w_minerals[key] = round(1 - w_minerals_total, n_digits)
1244
+ #
1245
+ total_w_minerals = round(sum(w_minerals.values()), 4)
1246
+ #
1247
+ if self.fluid == "water":
1248
+ data_fluid = self.data_water
1249
+ #
1250
+ old_index = elements_list.index("O")
1251
+ elements_list += [elements_list.pop(old_index)]
1252
+ #
1253
+ w_elements_total = 0.0
1254
+ for element in elements_list:
1255
+ if element != "O":
1256
+ for mineral, w_mineral in w_minerals.items():
1257
+ if element in mineralogy[mineral]["chemistry"]:
1258
+ if element == "U":
1259
+ n_digits = 4
1260
+ else:
1261
+ n_digits = 4
1262
+ #
1263
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
1264
+ w_elements[element] += value
1265
+ w_elements_total += value
1266
+ #
1267
+ w_elements[element] = round(w_elements[element], n_digits)
1268
+ #
1269
+ elif element == "O":
1270
+ w_elements[element] += round(1 - w_elements_total, 4)
1271
+ #
1272
+ w_elements[element] = round(w_elements[element], 4)
1273
+ #
1274
+ total_w_elements = round(sum(w_elements.values()), 4)
1275
+ #
1276
+ if np.isclose(total_w_minerals, 1.00) == True and np.isclose(total_w_elements, 1.00) == True:
1277
+ for key, value in w_minerals.items():
1278
+ w_minerals[key] = abs(value)
1279
+ #
1280
+ for key, value in w_elements.items():
1281
+ w_elements[key] = abs(value)
1282
+ #
1283
+ condition = True
1284
+ #
1285
+ gamma_ray = 0.0
1286
+ photoelectricity = 0.0
1287
+ #
1288
+ K_list = []
1289
+ G_list = []
1290
+ bulk_mod = 0
1291
+ shear_mod = 0
1292
+ phi_list = []
1293
+ for key, value in phi_minerals.items():
1294
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
1295
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
1296
+ #
1297
+ gamma_ray = round(gamma_ray, 3)
1298
+ photoelectricity = round(photoelectricity, 3)
1299
+ #
1300
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
1301
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
1302
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
1303
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
1304
+ phi_list.append(phi_minerals[key])
1305
+ #
1306
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
1307
+ bulk_mod = round(bulk_mod, 3)
1308
+ shear_mod = round(shear_mod, 3)
1309
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
1310
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
1311
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
1312
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
1313
+ vPvS = round(vP/vS, 3)
1314
+
1315
+ ## RESULTS
1316
+ for key, value in w_minerals.items():
1317
+ results_container["mineralogy"][key].append(value)
1318
+
1319
+ amounts = []
1320
+ for key, value in w_elements.items():
1321
+ results_container["chemistry"][key].append(value)
1322
+ chem_data = PeriodicSystem(name=key).get_data()
1323
+ amounts.append([key, chem_data[1], value])
1324
+
1325
+ list_elements = list(w_elements.keys())
1326
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
1327
+ composition_oxides = {}
1328
+
1329
+ for var_oxide in list_oxides:
1330
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
1331
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
1332
+
1333
+ if list_oxides[0] not in results_container["compounds"]:
1334
+ for oxide in list_oxides:
1335
+ results_container["compounds"][oxide] = []
1336
+
1337
+ for key, value in composition_oxides.items():
1338
+ results_container["compounds"][key].append(value)
1339
+
1340
+ results_container["mineralogy"] = dict(sorted(
1341
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1342
+ results_container["chemistry"] = dict(sorted(
1343
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1344
+ results_container["compounds"] = dict(sorted(
1345
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
1346
+
1347
+ results_container["phi"].append(phi_helper)
1348
+ results_container["rho_s"].append(rho_s)
1349
+ results_container["rho"].append(rho)
1350
+ results_container["vP"].append(vP)
1351
+ results_container["vS"].append(vS)
1352
+ results_container["vP/vS"].append(vPvS)
1353
+ results_container["K"].append(bulk_mod)
1354
+ results_container["G"].append(shear_mod)
1355
+ results_container["E"].append(youngs_mod)
1356
+ results_container["nu"].append(poisson_rat)
1357
+ results_container["GR"].append(gamma_ray)
1358
+ results_container["PE"].append(photoelectricity)
1359
+ #
1360
+ n += 1
1361
+ #
1362
+ return results_container
1363
+ #
1364
+ def create_greenschist(self, number, porosity=None):
1365
+ #
1366
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1367
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
1368
+ self.data_epidote = Sorosilicates(impurity="pure", data_type=True).create_epidote()
1369
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1370
+ self.data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite()
1371
+ self.data_antigorite = Phyllosilicates(impurity="pure", data_type=True).create_antigorite()
1372
+ #
1373
+ assemblage = [self.data_quartz, self.data_plagioclase, self.data_chlorite, self.data_antigorite,
1374
+ self.data_epidote, self.data_muscovite]
1375
+ #
1376
+ amounts_mineralogy = {}
1377
+ amounts_chemistry = {}
1378
+ bulk_properties = {}
1379
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
1380
+ for property in properties:
1381
+ bulk_properties[property] = []
1382
+ mineral_list = []
1383
+ elements = []
1384
+ for mineral in assemblage:
1385
+ amounts_mineralogy[mineral["mineral"]] = []
1386
+ mineral_list.append(mineral["mineral"])
1387
+ elements_mineral = list(mineral["chemistry"].keys())
1388
+ for element in elements_mineral:
1389
+ if element not in elements:
1390
+ elements.append(element)
1391
+ amounts_chemistry[element] = []
1392
+ mineral_list.sort()
1393
+ elements.sort()
1394
+ #
1395
+ n = 0
1396
+ amounts_helper = []
1397
+ while n < number:
1398
+ w_total = 0
1399
+ n_minerals = 0
1400
+ for mineral in mineral_list:
1401
+ if mineral == "Qz":
1402
+ if n_minerals < len(mineral_list)-1:
1403
+ value = round(1-w_total, 4)
1404
+ else:
1405
+ value = round(1-w_total, 4)
1406
+ if value >= 0.0 and 0.05 <= value <= 0.25:
1407
+ amounts_helper.append(value)
1408
+ w_total += value
1409
+ n_minerals += 1
1410
+ elif mineral == "Pl":
1411
+ if n_minerals < len(mineral_list)-1:
1412
+ value = round(rd.uniform(0.20, 0.50), 4)
1413
+ else:
1414
+ value = round(1-w_total, 4)
1415
+ if value >= 0.0 and 0.20 <= value <= 0.50:
1416
+ amounts_helper.append(value)
1417
+ w_total += value
1418
+ n_minerals += 1
1419
+ elif mineral == "Chl":
1420
+ if n_minerals < len(mineral_list)-1:
1421
+ value = round(rd.uniform(0.15, 0.30), 4)
1422
+ else:
1423
+ value = round(1-w_total, 4)
1424
+ if value >= 0.0 and 0.10 <= value <= 0.25:
1425
+ amounts_helper.append(value)
1426
+ w_total += value
1427
+ n_minerals += 1
1428
+ elif mineral == "Ant":
1429
+ if n_minerals < len(mineral_list)-1:
1430
+ value = round(rd.uniform(0.05, 0.20), 4)
1431
+ else:
1432
+ value = round(1-w_total, 4)
1433
+ if value >= 0.0 and 0.05 <= value <= 0.20:
1434
+ amounts_helper.append(value)
1435
+ w_total += value
1436
+ n_minerals += 1
1437
+ elif mineral == "Ep":
1438
+ if n_minerals < len(mineral_list)-1:
1439
+ value = round(rd.uniform(0.05, 0.20), 4)
1440
+ else:
1441
+ value = round(1-w_total, 4)
1442
+ if value >= 0.0 and 0.05 <= value <= 0.20:
1443
+ amounts_helper.append(value)
1444
+ w_total += value
1445
+ n_minerals += 1
1446
+ elif mineral == "Ms":
1447
+ if n_minerals < len(mineral_list)-1:
1448
+ value = round(rd.uniform(0.0, 0.05), 4)
1449
+ else:
1450
+ value = round(1-w_total, 4)
1451
+ if value >= 0.0 and 0.0 <= value <= 0.05:
1452
+ amounts_helper.append(value)
1453
+ w_total += value
1454
+ n_minerals += 1
1455
+ #
1456
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
1457
+ for index, mineral in enumerate(mineral_list):
1458
+ amounts_mineralogy[mineral].append(amounts_helper[index])
1459
+ n += 1
1460
+ amounts_helper.clear()
1461
+ else:
1462
+ n += 0
1463
+ amounts_helper.clear()
1464
+ #
1465
+ n = 0
1466
+ amounts_helper = {}
1467
+ while n < number:
1468
+ w_total = 0
1469
+ n_elements = 0
1470
+ rho_s_helper = 0
1471
+ bulkmod_helper = 0
1472
+ shearmod_helper = 0
1473
+ gr_helper = 0
1474
+ pe_helper = 0
1475
+ if porosity == None:
1476
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
1477
+ else:
1478
+ phi_helper = porosity
1479
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1480
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1481
+ self.data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite()
1482
+ for element in elements:
1483
+ amounts_helper[element] = 0
1484
+ if element in self.data_quartz["chemistry"]:
1485
+ if n_elements < len(elements)-1:
1486
+ value = round(amounts_mineralogy["Qz"][n]*self.data_quartz["chemistry"][element], 4)
1487
+ else:
1488
+ value = round(1-w_total, 4)
1489
+ amounts_helper[element] += value
1490
+ w_total += value
1491
+ if element in self.data_plagioclase["chemistry"]:
1492
+ if n_elements < len(elements)-1:
1493
+ value = round(amounts_mineralogy["Pl"][n]*self.data_plagioclase["chemistry"][element], 4)
1494
+ else:
1495
+ value = round(1-w_total, 4)
1496
+ amounts_helper[element] += value
1497
+ w_total += value
1498
+ if element in self.data_chlorite["chemistry"]:
1499
+ if n_elements < len(elements)-1:
1500
+ value = round(amounts_mineralogy["Chl"][n]*self.data_chlorite["chemistry"][element], 4)
1501
+ else:
1502
+ value = round(1-w_total, 4)
1503
+ amounts_helper[element] += value
1504
+ w_total += value
1505
+ if element in self.data_antigorite["chemistry"]:
1506
+ if n_elements < len(elements)-1:
1507
+ value = round(amounts_mineralogy["Ant"][n]*self.data_antigorite["chemistry"][element], 4)
1508
+ else:
1509
+ value = round(1-w_total, 4)
1510
+ amounts_helper[element] += value
1511
+ w_total += value
1512
+ if element in self.data_muscovite["chemistry"]:
1513
+ if n_elements < len(elements)-1:
1514
+ value = round(amounts_mineralogy["Ms"][n]*self.data_muscovite["chemistry"][element], 4)
1515
+ else:
1516
+ value = round(1-w_total, 4)
1517
+ amounts_helper[element] += value
1518
+ w_total += value
1519
+ if element in self.data_epidote["chemistry"]:
1520
+ if n_elements < len(elements)-1:
1521
+ value = round(amounts_mineralogy["Ep"][n]*self.data_epidote["chemistry"][element], 4)
1522
+ else:
1523
+ value = round(1-w_total, 4)
1524
+ amounts_helper[element] += value
1525
+ w_total += value
1526
+ n_elements += 1
1527
+ if sum(amounts_helper.values()) == 1.0:
1528
+ for key, value in amounts_helper.items():
1529
+ amounts_chemistry[key].append(round(value, 4))
1530
+ for mineral in mineral_list:
1531
+ if mineral == "Qz":
1532
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["rho"], 3)
1533
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["K"], 3)
1534
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_quartz["G"], 3)
1535
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["GR"], 3)
1536
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_quartz["PE"], 3)
1537
+ elif mineral == "Pl":
1538
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["rho"], 3)
1539
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["K"], 3)
1540
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_plagioclase["G"], 3)
1541
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["GR"], 3)
1542
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["PE"], 3)
1543
+ elif mineral == "Chl":
1544
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["rho"], 3)
1545
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["K"], 3)
1546
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_chlorite["G"], 3)
1547
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["GR"], 3)
1548
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["PE"], 3)
1549
+ elif mineral == "Ant":
1550
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_antigorite["rho"], 3)
1551
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_antigorite["K"], 3)
1552
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_antigorite["G"], 3)
1553
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_antigorite["GR"], 3)
1554
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_antigorite["PE"], 3)
1555
+ elif mineral == "Ep":
1556
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["rho"], 3)
1557
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["K"], 3)
1558
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_epidote["G"], 3)
1559
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["GR"], 3)
1560
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["PE"], 3)
1561
+ elif mineral == "Ms":
1562
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_muscovite["rho"], 3)
1563
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_muscovite["K"], 3)
1564
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_muscovite["G"], 3)
1565
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_muscovite["GR"], 3)
1566
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_muscovite["PE"], 3)
1567
+ #
1568
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
1569
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
1570
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
1571
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
1572
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
1573
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
1574
+ #
1575
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
1576
+ bulk_properties["rho"].append(rho_helper)
1577
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
1578
+ bulk_properties["G"].append(round(shearmod_helper, 3))
1579
+ bulk_properties["E"].append(youngsmod_helper)
1580
+ bulk_properties["nu"].append(poisson_helper)
1581
+ bulk_properties["vP"].append(vP_helper)
1582
+ bulk_properties["vS"].append(vS_helper)
1583
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
1584
+ bulk_properties["GR"].append(round(gr_helper, 3))
1585
+ bulk_properties["PE"].append(round(pe_helper, 3))
1586
+ bulk_properties["phi"].append(round(phi_helper, 3))
1587
+ n += 1
1588
+ #
1589
+ results = {}
1590
+ results["rock"] = "Greenschist"
1591
+ if number > 1:
1592
+ results["mineralogy"] = amounts_mineralogy
1593
+ results["chemistry"] = amounts_chemistry
1594
+ results["phi"] = bulk_properties["phi"]
1595
+ results["fluid"] = "water"
1596
+ results["rho_s"] = bulk_properties["rho_s"]
1597
+ results["rho"] = bulk_properties["rho"]
1598
+ results["vP"] = bulk_properties["vP"]
1599
+ results["vS"] = bulk_properties["vS"]
1600
+ results["vP/vS"] = bulk_properties["vPvS"]
1601
+ results["K"] = bulk_properties["K"]
1602
+ results["G"] = bulk_properties["G"]
1603
+ results["E"] = bulk_properties["E"]
1604
+ results["nu"] = bulk_properties["nu"]
1605
+ results["GR"] = bulk_properties["GR"]
1606
+ results["PE"] = bulk_properties["PE"]
1607
+ else:
1608
+ single_amounts_mineralogy = {}
1609
+ single_amounts_chemistry = {}
1610
+ for mineral, value in amounts_mineralogy.items():
1611
+ single_amounts_mineralogy[mineral] = value[0]
1612
+ for element, value in amounts_chemistry.items():
1613
+ single_amounts_chemistry[element] = value[0]
1614
+ results["mineralogy"] = single_amounts_mineralogy
1615
+ results["chemistry"] = single_amounts_chemistry
1616
+ results["phi"] = bulk_properties["phi"][0]
1617
+ results["fluid"] = "water"
1618
+ results["rho_s"] = bulk_properties["rho_s"][0]
1619
+ results["rho"] = bulk_properties["rho"][0]
1620
+ results["vP"] = bulk_properties["vP"][0]
1621
+ results["vS"] = bulk_properties["vS"][0]
1622
+ results["vP/vS"] = bulk_properties["vPvS"][0]
1623
+ results["K"] = bulk_properties["K"][0]
1624
+ results["G"] = bulk_properties["G"][0]
1625
+ results["E"] = bulk_properties["E"][0]
1626
+ results["nu"] = bulk_properties["nu"][0]
1627
+ results["GR"] = bulk_properties["GR"][0]
1628
+ results["PE"] = bulk_properties["PE"][0]
1629
+ #
1630
+ return results
1631
+ #
1632
+ def create_greenschist_basaltic(self, number, porosity=None):
1633
+ #
1634
+ self.data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
1635
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1636
+ self.data_epidote = Sorosilicates(impurity="pure", data_type=True).create_epidote()
1637
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
1638
+ #
1639
+ assemblage = [self.data_chlorite, self.data_actinolite, self.data_plagioclase, self.data_epidote]
1640
+ #
1641
+ amounts_mineralogy = {}
1642
+ amounts_chemistry = {}
1643
+ bulk_properties = {}
1644
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
1645
+ for property in properties:
1646
+ bulk_properties[property] = []
1647
+ mineral_list = []
1648
+ elements = []
1649
+ for mineral in assemblage:
1650
+ amounts_mineralogy[mineral["mineral"]] = []
1651
+ mineral_list.append(mineral["mineral"])
1652
+ elements_mineral = list(mineral["chemistry"].keys())
1653
+ for element in elements_mineral:
1654
+ if element not in elements:
1655
+ elements.append(element)
1656
+ amounts_chemistry[element] = []
1657
+ mineral_list.sort()
1658
+ elements.sort()
1659
+ #
1660
+ n = 0
1661
+ amounts_helper = []
1662
+ while n < number:
1663
+ w_total = 0
1664
+ n_minerals = 0
1665
+ for mineral in mineral_list:
1666
+ if mineral == "Act":
1667
+ if n_minerals < len(mineral_list)-1:
1668
+ value = round(rd.uniform(0.20, 0.30), 4)
1669
+ else:
1670
+ value = round(1-w_total, 4)
1671
+ if value >= 0.0 and 0.20 <= value <= 0.30:
1672
+ amounts_helper.append(value)
1673
+ w_total += value
1674
+ n_minerals += 1
1675
+ elif mineral == "Chl":
1676
+ if n_minerals < len(mineral_list)-1:
1677
+ value = round(rd.uniform(0.25, 0.50), 4)
1678
+ else:
1679
+ value = round(1-w_total, 4)
1680
+ if value >= 0.0 and 0.25 <= value <= 0.50:
1681
+ amounts_helper.append(value)
1682
+ w_total += value
1683
+ n_minerals += 1
1684
+ elif mineral == "Ep":
1685
+ if n_minerals < len(mineral_list)-1:
1686
+ value = round(rd.uniform(0.0, 0.05), 4)
1687
+ else:
1688
+ value = round(1-w_total, 4)
1689
+ if value >= 0.0 and 0.0 <= value <= 0.05:
1690
+ amounts_helper.append(value)
1691
+ w_total += value
1692
+ n_minerals += 1
1693
+ elif mineral == "Pl":
1694
+ if n_minerals < len(mineral_list)-1:
1695
+ value = round(1-w_total, 4)
1696
+ else:
1697
+ value = round(1-w_total, 4)
1698
+ if value >= 0.0 and 0.20 <= value <= 0.55:
1699
+ amounts_helper.append(value)
1700
+ w_total += value
1701
+ n_minerals += 1
1702
+ #
1703
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
1704
+ for index, mineral in enumerate(mineral_list):
1705
+ amounts_mineralogy[mineral].append(amounts_helper[index])
1706
+ n += 1
1707
+ amounts_helper.clear()
1708
+ else:
1709
+ n += 0
1710
+ amounts_helper.clear()
1711
+ #
1712
+ n = 0
1713
+ amounts_helper = {}
1714
+ while n < number:
1715
+ w_total = 0
1716
+ n_elements = 0
1717
+ rho_s_helper = 0
1718
+ bulkmod_helper = 0
1719
+ shearmod_helper = 0
1720
+ gr_helper = 0
1721
+ pe_helper = 0
1722
+ if porosity == None:
1723
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
1724
+ else:
1725
+ phi_helper = porosity
1726
+ #
1727
+ x = rd.uniform(0.9, 1.0)
1728
+ self.data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase(x_value=x)
1729
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1730
+ self.data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
1731
+ for element in elements:
1732
+ amounts_helper[element] = 0
1733
+ if element in self.data_actinolite["chemistry"]:
1734
+ if n_elements < len(elements)-1:
1735
+ value = round(amounts_mineralogy["Act"][n]*self.data_actinolite["chemistry"][element], 4)
1736
+ else:
1737
+ value = round(1-w_total, 4)
1738
+ amounts_helper[element] += value
1739
+ w_total += value
1740
+ if element in self.data_chlorite["chemistry"]:
1741
+ if n_elements < len(elements)-1:
1742
+ value = round(amounts_mineralogy["Chl"][n]*self.data_chlorite["chemistry"][element], 4)
1743
+ else:
1744
+ value = round(1-w_total, 4)
1745
+ amounts_helper[element] += value
1746
+ w_total += value
1747
+ if element in self.data_epidote["chemistry"]:
1748
+ if n_elements < len(elements)-1:
1749
+ value = round(amounts_mineralogy["Ep"][n]*self.data_epidote["chemistry"][element], 4)
1750
+ else:
1751
+ value = round(1-w_total, 4)
1752
+ amounts_helper[element] += value
1753
+ w_total += value
1754
+ if element in self.data_plagioclase["chemistry"]:
1755
+ if n_elements < len(elements)-1:
1756
+ value = round(amounts_mineralogy["Pl"][n]*self.data_plagioclase["chemistry"][element], 4)
1757
+ else:
1758
+ value = round(1-w_total, 4)
1759
+ amounts_helper[element] += value
1760
+ w_total += value
1761
+ #
1762
+ n_elements += 1
1763
+ if sum(amounts_helper.values()) == 1.0:
1764
+ for key, value in amounts_helper.items():
1765
+ amounts_chemistry[key].append(round(value, 4))
1766
+ for mineral in mineral_list:
1767
+ if mineral == "Act":
1768
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_actinolite["rho"], 3)
1769
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_actinolite["K"], 3)
1770
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_actinolite["G"], 3)
1771
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_actinolite["GR"], 3)
1772
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_actinolite["PE"], 3)
1773
+ elif mineral == "Pl":
1774
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["rho"], 3)
1775
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["K"], 3)
1776
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_plagioclase["G"], 3)
1777
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["GR"], 3)
1778
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_plagioclase["PE"], 3)
1779
+ elif mineral == "Chl":
1780
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["rho"], 3)
1781
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["K"], 3)
1782
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_chlorite["G"], 3)
1783
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["GR"], 3)
1784
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["PE"], 3)
1785
+ elif mineral == "Ep":
1786
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["rho"], 3)
1787
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["K"], 3)
1788
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_epidote["G"], 3)
1789
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["GR"], 3)
1790
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_epidote["PE"], 3)
1791
+ #
1792
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
1793
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
1794
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
1795
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
1796
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
1797
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
1798
+ #
1799
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
1800
+ bulk_properties["rho"].append(rho_helper)
1801
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
1802
+ bulk_properties["G"].append(round(shearmod_helper, 3))
1803
+ bulk_properties["E"].append(youngsmod_helper)
1804
+ bulk_properties["nu"].append(poisson_helper)
1805
+ bulk_properties["vP"].append(vP_helper)
1806
+ bulk_properties["vS"].append(vS_helper)
1807
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
1808
+ bulk_properties["GR"].append(round(gr_helper, 3))
1809
+ bulk_properties["PE"].append(round(pe_helper, 3))
1810
+ bulk_properties["phi"].append(round(phi_helper, 3))
1811
+ n += 1
1812
+ #
1813
+ results = {}
1814
+ results["rock"] = "Greenschist"
1815
+ if number > 1:
1816
+ results["mineralogy"] = amounts_mineralogy
1817
+ results["chemistry"] = amounts_chemistry
1818
+ results["phi"] = bulk_properties["phi"]
1819
+ results["fluid"] = "water"
1820
+ results["rho_s"] = bulk_properties["rho_s"]
1821
+ results["rho"] = bulk_properties["rho"]
1822
+ results["vP"] = bulk_properties["vP"]
1823
+ results["vS"] = bulk_properties["vS"]
1824
+ results["vP/vS"] = bulk_properties["vPvS"]
1825
+ results["K"] = bulk_properties["K"]
1826
+ results["G"] = bulk_properties["G"]
1827
+ results["E"] = bulk_properties["E"]
1828
+ results["nu"] = bulk_properties["nu"]
1829
+ results["GR"] = bulk_properties["GR"]
1830
+ results["PE"] = bulk_properties["PE"]
1831
+ else:
1832
+ single_amounts_mineralogy = {}
1833
+ single_amounts_chemistry = {}
1834
+ for mineral, value in amounts_mineralogy.items():
1835
+ single_amounts_mineralogy[mineral] = value[0]
1836
+ for element, value in amounts_chemistry.items():
1837
+ single_amounts_chemistry[element] = value[0]
1838
+ results["mineralogy"] = single_amounts_mineralogy
1839
+ results["chemistry"] = single_amounts_chemistry
1840
+ results["phi"] = bulk_properties["phi"][0]
1841
+ results["fluid"] = "water"
1842
+ results["rho_s"] = bulk_properties["rho_s"][0]
1843
+ results["rho"] = bulk_properties["rho"][0]
1844
+ results["vP"] = bulk_properties["vP"][0]
1845
+ results["vS"] = bulk_properties["vS"][0]
1846
+ results["vP/vS"] = bulk_properties["vPvS"][0]
1847
+ results["K"] = bulk_properties["K"][0]
1848
+ results["G"] = bulk_properties["G"][0]
1849
+ results["E"] = bulk_properties["E"][0]
1850
+ results["nu"] = bulk_properties["nu"][0]
1851
+ results["GR"] = bulk_properties["GR"][0]
1852
+ results["PE"] = bulk_properties["PE"][0]
1853
+ #
1854
+ return results
1855
+ #
1856
+ def create_greenschist_ultramafic(self, number, porosity=None):
1857
+ #
1858
+ self.data_brucite = Oxides(impurity="pure", data_type=True).create_brucite()
1859
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1860
+ self.data_chrysotile = Phyllosilicates(impurity="pure", data_type=True).create_chrysotile()
1861
+ self.data_diopside = Inosilicates(impurity="pure", data_type=True).create_diopside()
1862
+ self.data_talc = Phyllosilicates(impurity="pure", data_type=True).create_talc()
1863
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
1864
+ #
1865
+ assemblage = [self.data_chlorite, self.data_chrysotile, self.data_talc, self.data_tremolite,
1866
+ self.data_diopside, self.data_brucite]
1867
+ #
1868
+ amounts_mineralogy = {}
1869
+ amounts_chemistry = {}
1870
+ bulk_properties = {}
1871
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
1872
+ for property in properties:
1873
+ bulk_properties[property] = []
1874
+ mineral_list = []
1875
+ elements = []
1876
+ for mineral in assemblage:
1877
+ amounts_mineralogy[mineral["mineral"]] = []
1878
+ mineral_list.append(mineral["mineral"])
1879
+ elements_mineral = list(mineral["chemistry"].keys())
1880
+ for element in elements_mineral:
1881
+ if element not in elements:
1882
+ elements.append(element)
1883
+ amounts_chemistry[element] = []
1884
+ mineral_list.sort()
1885
+ elements.sort()
1886
+ #
1887
+ n = 0
1888
+ amounts_helper = []
1889
+ while n < number:
1890
+ w_total = 0
1891
+ n_minerals = 0
1892
+ for mineral in mineral_list:
1893
+ if mineral == "Bru":
1894
+ if n_minerals < len(mineral_list)-1:
1895
+ value = round(rd.uniform(0.0, 0.05), 4) # Bru (0.0, 0.05), Chl (0.25, 0.50), Ctl (0.25, 0.50), Tlc (0.15, 0.20), Tr (0.10, 0.20), Di (0.0, 0.05)
1896
+ else:
1897
+ value = round(1-w_total, 4)
1898
+ if value >= 0.0 and 0.0 <= value <= 0.05:
1899
+ amounts_helper.append(value)
1900
+ w_total += value
1901
+ n_minerals += 1
1902
+ elif mineral == "Chl":
1903
+ if n_minerals < len(mineral_list)-1:
1904
+ value = round(rd.uniform(0.25, 0.50), 4)
1905
+ else:
1906
+ value = round(1-w_total, 4)
1907
+ if value >= 0.0 and 0.25 <= value <= 0.50:
1908
+ amounts_helper.append(value)
1909
+ w_total += value
1910
+ n_minerals += 1
1911
+ elif mineral == "Ctl":
1912
+ if n_minerals < len(mineral_list)-1:
1913
+ value = round(rd.uniform(0.25, 0.50), 4)
1914
+ else:
1915
+ value = round(1-w_total, 4)
1916
+ if value >= 0.0 and 0.25 <= value <= 0.50:
1917
+ amounts_helper.append(value)
1918
+ w_total += value
1919
+ n_minerals += 1
1920
+ elif mineral == "Tlc":
1921
+ if n_minerals < len(mineral_list)-1:
1922
+ value = round(rd.uniform(0.15, 0.20), 4)
1923
+ else:
1924
+ value = round(1-w_total, 4)
1925
+ if value >= 0.0 and 0.15 <= value <= 0.20:
1926
+ amounts_helper.append(value)
1927
+ w_total += value
1928
+ n_minerals += 1
1929
+ elif mineral == "Tr":
1930
+ if n_minerals < len(mineral_list)-1:
1931
+ value = round(1-w_total, 4)
1932
+ else:
1933
+ value = round(1-w_total, 4)
1934
+ if value >= 0.0 and 0.10 <= value <= 0.20:
1935
+ amounts_helper.append(value)
1936
+ w_total += value
1937
+ n_minerals += 1
1938
+ elif mineral == "Di":
1939
+ if n_minerals < len(mineral_list)-1:
1940
+ value = round(rd.uniform(0.0, 0.05), 4)
1941
+ else:
1942
+ value = round(1-w_total, 4)
1943
+ if value >= 0.0 and 0.0 <= value <= 0.05:
1944
+ amounts_helper.append(value)
1945
+ w_total += value
1946
+ n_minerals += 1
1947
+ #
1948
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
1949
+ for index, mineral in enumerate(mineral_list):
1950
+ amounts_mineralogy[mineral].append(amounts_helper[index])
1951
+ n += 1
1952
+ amounts_helper.clear()
1953
+ else:
1954
+ n += 0
1955
+ amounts_helper.clear()
1956
+ #
1957
+ n = 0
1958
+ amounts_helper = {}
1959
+ while n < number:
1960
+ w_total = 0
1961
+ n_elements = 0
1962
+ rho_s_helper = 0
1963
+ bulkmod_helper = 0
1964
+ shearmod_helper = 0
1965
+ gr_helper = 0
1966
+ pe_helper = 0
1967
+ if porosity == None:
1968
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
1969
+ else:
1970
+ phi_helper = porosity
1971
+ #
1972
+ self.data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
1973
+ #
1974
+ for element in elements:
1975
+ amounts_helper[element] = 0
1976
+ if element in self.data_brucite["chemistry"]:
1977
+ if n_elements < len(elements)-1:
1978
+ value = round(amounts_mineralogy["Bru"][n]*self.data_brucite["chemistry"][element], 4)
1979
+ else:
1980
+ value = round(1-w_total, 4)
1981
+ amounts_helper[element] += value
1982
+ w_total += value
1983
+ if element in self.data_chlorite["chemistry"]:
1984
+ if n_elements < len(elements)-1:
1985
+ value = round(amounts_mineralogy["Chl"][n]*self.data_chlorite["chemistry"][element], 4)
1986
+ else:
1987
+ value = round(1-w_total, 4)
1988
+ amounts_helper[element] += value
1989
+ w_total += value
1990
+ if element in self.data_chrysotile["chemistry"]:
1991
+ if n_elements < len(elements)-1:
1992
+ value = round(amounts_mineralogy["Ctl"][n]*self.data_chrysotile["chemistry"][element], 4)
1993
+ else:
1994
+ value = round(1-w_total, 4)
1995
+ amounts_helper[element] += value
1996
+ w_total += value
1997
+ if element in self.data_diopside["chemistry"]:
1998
+ if n_elements < len(elements)-1:
1999
+ value = round(amounts_mineralogy["Di"][n]*self.data_diopside["chemistry"][element], 4)
2000
+ else:
2001
+ value = round(1-w_total, 4)
2002
+ amounts_helper[element] += value
2003
+ w_total += value
2004
+ if element in self.data_talc["chemistry"]:
2005
+ if n_elements < len(elements)-1:
2006
+ value = round(amounts_mineralogy["Tlc"][n]*self.data_talc["chemistry"][element], 4)
2007
+ else:
2008
+ value = round(1-w_total, 4)
2009
+ amounts_helper[element] += value
2010
+ w_total += value
2011
+ if element in self.data_tremolite["chemistry"]:
2012
+ if n_elements < len(elements)-1:
2013
+ value = round(amounts_mineralogy["Tr"][n]*self.data_tremolite["chemistry"][element], 4)
2014
+ else:
2015
+ value = round(1-w_total, 4)
2016
+ amounts_helper[element] += value
2017
+ w_total += value
2018
+ #
2019
+ n_elements += 1
2020
+ if sum(amounts_helper.values()) == 1.0:
2021
+ for key, value in amounts_helper.items():
2022
+ amounts_chemistry[key].append(round(value, 4))
2023
+ for mineral in mineral_list:
2024
+ if mineral == "Bru":
2025
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_brucite["rho"], 3)
2026
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_brucite["K"], 3)
2027
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_brucite["G"], 3)
2028
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_brucite["GR"], 3)
2029
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_brucite["PE"], 3)
2030
+ elif mineral == "Chl":
2031
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["rho"], 3)
2032
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["K"], 3)
2033
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_chlorite["G"], 3)
2034
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["GR"], 3)
2035
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_chlorite["PE"], 3)
2036
+ elif mineral == "Ctl":
2037
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_chrysotile["rho"], 3)
2038
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_chrysotile["K"], 3)
2039
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_chrysotile["G"], 3)
2040
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_chrysotile["GR"], 3)
2041
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_chrysotile["PE"], 3)
2042
+ elif mineral == "Di":
2043
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_diopside["rho"], 3)
2044
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_diopside["K"], 3)
2045
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_diopside["G"], 3)
2046
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_diopside["GR"], 3)
2047
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_diopside["PE"], 3)
2048
+ elif mineral == "Tlc":
2049
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_talc["rho"], 3)
2050
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_talc["K"], 3)
2051
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_talc["G"], 3)
2052
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_talc["GR"], 3)
2053
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_talc["PE"], 3)
2054
+ elif mineral == "Tr":
2055
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*self.data_tremolite["rho"], 3)
2056
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*self.data_tremolite["K"], 3)
2057
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*self.data_tremolite["G"], 3)
2058
+ gr_helper += round(amounts_mineralogy[mineral][n]*self.data_tremolite["GR"], 3)
2059
+ pe_helper += round(amounts_mineralogy[mineral][n]*self.data_tremolite["PE"], 3)
2060
+ #
2061
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
2062
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
2063
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
2064
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2065
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2066
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
2067
+ #
2068
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
2069
+ bulk_properties["rho"].append(rho_helper)
2070
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
2071
+ bulk_properties["G"].append(round(shearmod_helper, 3))
2072
+ bulk_properties["E"].append(youngsmod_helper)
2073
+ bulk_properties["nu"].append(poisson_helper)
2074
+ bulk_properties["vP"].append(vP_helper)
2075
+ bulk_properties["vS"].append(vS_helper)
2076
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
2077
+ bulk_properties["GR"].append(round(gr_helper, 3))
2078
+ bulk_properties["PE"].append(round(pe_helper, 3))
2079
+ bulk_properties["phi"].append(round(phi_helper, 3))
2080
+ n += 1
2081
+ #
2082
+ results = {}
2083
+ results["rock"] = "Greenschist"
2084
+ if number > 1:
2085
+ results["mineralogy"] = amounts_mineralogy
2086
+ results["chemistry"] = amounts_chemistry
2087
+ results["phi"] = bulk_properties["phi"]
2088
+ results["fluid"] = "water"
2089
+ results["rho_s"] = bulk_properties["rho_s"]
2090
+ results["rho"] = bulk_properties["rho"]
2091
+ results["vP"] = bulk_properties["vP"]
2092
+ results["vS"] = bulk_properties["vS"]
2093
+ results["vP/vS"] = bulk_properties["vPvS"]
2094
+ results["K"] = bulk_properties["K"]
2095
+ results["G"] = bulk_properties["G"]
2096
+ results["E"] = bulk_properties["E"]
2097
+ results["nu"] = bulk_properties["nu"]
2098
+ results["GR"] = bulk_properties["GR"]
2099
+ results["PE"] = bulk_properties["PE"]
2100
+ else:
2101
+ single_amounts_mineralogy = {}
2102
+ single_amounts_chemistry = {}
2103
+ for mineral, value in amounts_mineralogy.items():
2104
+ single_amounts_mineralogy[mineral] = value[0]
2105
+ for element, value in amounts_chemistry.items():
2106
+ single_amounts_chemistry[element] = value[0]
2107
+ results["mineralogy"] = single_amounts_mineralogy
2108
+ results["chemistry"] = single_amounts_chemistry
2109
+ results["phi"] = bulk_properties["phi"][0]
2110
+ results["fluid"] = "water"
2111
+ results["rho_s"] = bulk_properties["rho_s"][0]
2112
+ results["rho"] = bulk_properties["rho"][0]
2113
+ results["vP"] = bulk_properties["vP"][0]
2114
+ results["vS"] = bulk_properties["vS"][0]
2115
+ results["vP/vS"] = bulk_properties["vPvS"][0]
2116
+ results["K"] = bulk_properties["K"][0]
2117
+ results["G"] = bulk_properties["G"][0]
2118
+ results["E"] = bulk_properties["E"][0]
2119
+ results["nu"] = bulk_properties["nu"][0]
2120
+ results["GR"] = bulk_properties["GR"][0]
2121
+ results["PE"] = bulk_properties["PE"][0]
2122
+ #
2123
+ return results
2124
+ #
2125
+ def create_greenschist_pelitic(self, number, porosity=None):
2126
+ #
2127
+ data_quartz = Oxides(impurity="pure", data_type=True).create_quartz() # fixed
2128
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar() # variable
2129
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase() # variable
2130
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite() # variable
2131
+ data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite() # variable
2132
+ data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet() # variable
2133
+ data_pyrophyllite = Phyllosilicates(impurity="pure", data_type=True).create_pyrophyllite() # fixed
2134
+ #
2135
+ assemblage = [data_quartz, data_alkalifeldspar, data_plagioclase, data_chlorite, data_muscovite,
2136
+ data_garnet_al, data_pyrophyllite]
2137
+ #
2138
+ amounts_mineralogy = {}
2139
+ amounts_chemistry = {}
2140
+ bulk_properties = {}
2141
+ properties = ["rho_s", "rho", "K", "G", "E", "nu", "vP", "vS", "vPvS", "GR", "PE", "phi"]
2142
+ for property in properties:
2143
+ bulk_properties[property] = []
2144
+ mineral_list = []
2145
+ elements = []
2146
+ for mineral in assemblage:
2147
+ amounts_mineralogy[mineral["mineral"]] = []
2148
+ mineral_list.append(mineral["mineral"])
2149
+ elements_mineral = list(mineral["chemistry"].keys())
2150
+ for element in elements_mineral:
2151
+ if element not in elements:
2152
+ elements.append(element)
2153
+ amounts_chemistry[element] = []
2154
+ mineral_list.sort()
2155
+ elements.sort()
2156
+ #
2157
+ n = 0
2158
+ amounts_helper = []
2159
+ while n < number:
2160
+ w_total = 0
2161
+ n_minerals = 0
2162
+ for mineral in mineral_list:
2163
+ if mineral == "Qz": # Qz (0.25, 0.7), Kfs (0.05, 0.15), Pl (0.05, 0.15), Chl (0.15, 0.3), Ms (0, 0.1), Grt (0, 0.05), Prl (0, 0.05)
2164
+ if n_minerals < len(mineral_list)-1:
2165
+ value = round(1-w_total, 4)
2166
+ else:
2167
+ value = round(1-w_total, 4)
2168
+ if value >= 0.0 and 0.25 <= value <= 0.70:
2169
+ amounts_helper.append(value)
2170
+ w_total += value
2171
+ n_minerals += 1
2172
+ elif mineral == "Kfs":
2173
+ if n_minerals < len(mineral_list)-1:
2174
+ value = round(rd.uniform(0.05, 0.15), 4)
2175
+ else:
2176
+ value = round(1-w_total, 4)
2177
+ if value >= 0.0 and 0.05 <= value <= 0.15:
2178
+ amounts_helper.append(value)
2179
+ w_total += value
2180
+ n_minerals += 1
2181
+ elif mineral == "Pl":
2182
+ if n_minerals < len(mineral_list)-1:
2183
+ value = round(rd.uniform(0.05, 0.15), 4)
2184
+ else:
2185
+ value = round(1-w_total, 4)
2186
+ if value >= 0.0 and 0.05 <= value <= 0.15:
2187
+ amounts_helper.append(value)
2188
+ w_total += value
2189
+ n_minerals += 1
2190
+ elif mineral == "Chl":
2191
+ if n_minerals < len(mineral_list)-1:
2192
+ value = round(rd.uniform(0.15, 0.30), 4)
2193
+ else:
2194
+ value = round(1-w_total, 4)
2195
+ if value >= 0.0 and 0.15 <= value <= 0.30:
2196
+ amounts_helper.append(value)
2197
+ w_total += value
2198
+ n_minerals += 1
2199
+ elif mineral == "Ms":
2200
+ if n_minerals < len(mineral_list)-1:
2201
+ value = round(rd.uniform(0.0, 0.10), 4)
2202
+ else:
2203
+ value = round(1-w_total, 4)
2204
+ if value >= 0.0 and 0.0 <= value <= 0.10:
2205
+ amounts_helper.append(value)
2206
+ w_total += value
2207
+ n_minerals += 1
2208
+ elif mineral == "Grt":
2209
+ if n_minerals < len(mineral_list)-1:
2210
+ value = round(rd.uniform(0.0, 0.05), 4)
2211
+ else:
2212
+ value = round(1-w_total, 4)
2213
+ if value >= 0.0 and 0.0 <= value <= 0.05:
2214
+ amounts_helper.append(value)
2215
+ w_total += value
2216
+ n_minerals += 1
2217
+ elif mineral == "Prl":
2218
+ if n_minerals < len(mineral_list)-1:
2219
+ value = round(rd.uniform(0.0, 0.05), 4)
2220
+ else:
2221
+ value = round(1-w_total, 4)
2222
+ if value >= 0.0 and 0.0 <= value <= 0.05:
2223
+ amounts_helper.append(value)
2224
+ w_total += value
2225
+ n_minerals += 1
2226
+ #
2227
+ if np.sum(amounts_helper) == 1.0 and n_minerals == len(mineral_list):
2228
+ for index, mineral in enumerate(mineral_list):
2229
+ amounts_mineralogy[mineral].append(amounts_helper[index])
2230
+ n += 1
2231
+ amounts_helper.clear()
2232
+ else:
2233
+ n += 0
2234
+ amounts_helper.clear()
2235
+ #
2236
+ n = 0
2237
+ amounts_helper = {}
2238
+ while n < number:
2239
+ w_total = 0
2240
+ n_elements = 0
2241
+ rho_s_helper = 0
2242
+ bulkmod_helper = 0
2243
+ shearmod_helper = 0
2244
+ gr_helper = 0
2245
+ pe_helper = 0
2246
+ if porosity == None:
2247
+ phi_helper = round(rd.uniform(0.0, 0.05), 4)
2248
+ else:
2249
+ phi_helper = porosity
2250
+ #
2251
+ x_kfs = rd.uniform(0.9, 1.0)
2252
+ x_pl = rd.uniform(0.9, 1.0)
2253
+ data_alkalifeldspar = Tectosilicates(impurity="pure", data_type=True).create_alkalifeldspar(x_value=x_kfs)
2254
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase(x_value=x_pl)
2255
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
2256
+ data_muscovite = Phyllosilicates(impurity="pure", data_type=True).create_muscovite()
2257
+ data_garnet_al = Nesosilicates(impurity="pure", data_type=True).create_aluminium_garnet()
2258
+ #
2259
+ for element in elements:
2260
+ amounts_helper[element] = 0
2261
+ if element in data_quartz["chemistry"]:
2262
+ if n_elements < len(elements)-1:
2263
+ value = round(amounts_mineralogy["Qz"][n]*data_quartz["chemistry"][element], 4)
2264
+ else:
2265
+ value = round(1-w_total, 4)
2266
+ amounts_helper[element] += value
2267
+ w_total += value
2268
+ if element in data_alkalifeldspar["chemistry"]:
2269
+ if n_elements < len(elements)-1:
2270
+ value = round(amounts_mineralogy["Kfs"][n]*data_alkalifeldspar["chemistry"][element], 4)
2271
+ else:
2272
+ value = round(1-w_total, 4)
2273
+ amounts_helper[element] += value
2274
+ w_total += value
2275
+ if element in data_plagioclase["chemistry"]:
2276
+ if n_elements < len(elements)-1:
2277
+ value = round(amounts_mineralogy["Pl"][n]*data_plagioclase["chemistry"][element], 4)
2278
+ else:
2279
+ value = round(1-w_total, 4)
2280
+ amounts_helper[element] += value
2281
+ w_total += value
2282
+ if element in data_chlorite["chemistry"]:
2283
+ if n_elements < len(elements)-1:
2284
+ value = round(amounts_mineralogy["Chl"][n]*data_chlorite["chemistry"][element], 4)
2285
+ else:
2286
+ value = round(1-w_total, 4)
2287
+ amounts_helper[element] += value
2288
+ w_total += value
2289
+ if element in data_muscovite["chemistry"]:
2290
+ if n_elements < len(elements)-1:
2291
+ value = round(amounts_mineralogy["Ms"][n]*data_muscovite["chemistry"][element], 4)
2292
+ else:
2293
+ value = round(1-w_total, 4)
2294
+ amounts_helper[element] += value
2295
+ w_total += value
2296
+ if element in data_garnet_al["chemistry"]:
2297
+ if n_elements < len(elements)-1:
2298
+ value = round(amounts_mineralogy["Grt"][n]*data_garnet_al["chemistry"][element], 4)
2299
+ else:
2300
+ value = round(1-w_total, 4)
2301
+ amounts_helper[element] += value
2302
+ w_total += value
2303
+ if element in data_pyrophyllite["chemistry"]:
2304
+ if n_elements < len(elements)-1:
2305
+ value = round(amounts_mineralogy["Prl"][n]*data_pyrophyllite["chemistry"][element], 4)
2306
+ else:
2307
+ value = round(1-w_total, 4)
2308
+ amounts_helper[element] += value
2309
+ w_total += value
2310
+ #
2311
+ n_elements += 1
2312
+ if sum(amounts_helper.values()) == 1.0:
2313
+ for key, value in amounts_helper.items():
2314
+ amounts_chemistry[key].append(round(value, 4))
2315
+ for mineral in mineral_list:
2316
+ if mineral == "Qz":
2317
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_quartz["rho"], 3)
2318
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_quartz["K"], 3)
2319
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_quartz["G"], 3)
2320
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_quartz["GR"], 3)
2321
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_quartz["PE"], 3)
2322
+ elif mineral == "Kfs":
2323
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_alkalifeldspar["rho"], 3)
2324
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_alkalifeldspar["K"], 3)
2325
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_alkalifeldspar["G"], 3)
2326
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_alkalifeldspar["GR"], 3)
2327
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_alkalifeldspar["PE"], 3)
2328
+ elif mineral == "Pl":
2329
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_plagioclase["rho"], 3)
2330
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_plagioclase["K"], 3)
2331
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_plagioclase["G"], 3)
2332
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_plagioclase["GR"], 3)
2333
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_plagioclase["PE"], 3)
2334
+ elif mineral == "Chl":
2335
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_chlorite["rho"], 3)
2336
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_chlorite["K"], 3)
2337
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_chlorite["G"], 3)
2338
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_chlorite["GR"], 3)
2339
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_chlorite["PE"], 3)
2340
+ elif mineral == "Ms":
2341
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_muscovite["rho"], 3)
2342
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_muscovite["K"], 3)
2343
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_muscovite["G"], 3)
2344
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_muscovite["GR"], 3)
2345
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_muscovite["PE"], 3)
2346
+ elif mineral == "Grt":
2347
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_garnet_al["rho"], 3)
2348
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_garnet_al["K"], 3)
2349
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_garnet_al["G"], 3)
2350
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_garnet_al["GR"], 3)
2351
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_garnet_al["PE"], 3)
2352
+ elif mineral == "Prl":
2353
+ rho_s_helper += round(amounts_mineralogy[mineral][n]*data_pyrophyllite["rho"], 3)
2354
+ bulkmod_helper += round(amounts_mineralogy[mineral][n]*data_pyrophyllite["K"], 3)
2355
+ shearmod_helper += round(0.67*amounts_mineralogy[mineral][n]*data_pyrophyllite["G"], 3)
2356
+ gr_helper += round(amounts_mineralogy[mineral][n]*data_pyrophyllite["GR"], 3)
2357
+ pe_helper += round(amounts_mineralogy[mineral][n]*data_pyrophyllite["PE"], 3)
2358
+ #
2359
+ rho_helper = round((1-phi_helper)*rho_s_helper + phi_helper*self.data_water[2]/1000, 3)
2360
+ youngsmod_helper = round((9*bulkmod_helper*shearmod_helper)/(3*bulkmod_helper + shearmod_helper), 3)
2361
+ poisson_helper = round((3*bulkmod_helper - 2*shearmod_helper)/(6*bulkmod_helper + 2*shearmod_helper), 3)
2362
+ vP_helper = round(((bulkmod_helper*10**9 + 4/3*shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2363
+ vS_helper = round(((shearmod_helper*10**9)/(rho_helper))**0.5, 3)
2364
+ vPvS_helper_helper = round(vP_helper/vS_helper, 3)
2365
+ #
2366
+ bulk_properties["rho_s"].append(round(rho_s_helper, 3))
2367
+ bulk_properties["rho"].append(rho_helper)
2368
+ bulk_properties["K"].append(round(bulkmod_helper, 3))
2369
+ bulk_properties["G"].append(round(shearmod_helper, 3))
2370
+ bulk_properties["E"].append(youngsmod_helper)
2371
+ bulk_properties["nu"].append(poisson_helper)
2372
+ bulk_properties["vP"].append(vP_helper)
2373
+ bulk_properties["vS"].append(vS_helper)
2374
+ bulk_properties["vPvS"].append(vPvS_helper_helper)
2375
+ bulk_properties["GR"].append(round(gr_helper, 3))
2376
+ bulk_properties["PE"].append(round(pe_helper, 3))
2377
+ bulk_properties["phi"].append(round(phi_helper, 3))
2378
+ n += 1
2379
+ #
2380
+ results = {}
2381
+ results["rock"] = "Greenschist"
2382
+ if number > 1:
2383
+ results["mineralogy"] = amounts_mineralogy
2384
+ results["chemistry"] = amounts_chemistry
2385
+ results["phi"] = bulk_properties["phi"]
2386
+ results["fluid"] = "water"
2387
+ results["rho_s"] = bulk_properties["rho_s"]
2388
+ results["rho"] = bulk_properties["rho"]
2389
+ results["vP"] = bulk_properties["vP"]
2390
+ results["vS"] = bulk_properties["vS"]
2391
+ results["vP/vS"] = bulk_properties["vPvS"]
2392
+ results["K"] = bulk_properties["K"]
2393
+ results["G"] = bulk_properties["G"]
2394
+ results["E"] = bulk_properties["E"]
2395
+ results["nu"] = bulk_properties["nu"]
2396
+ results["GR"] = bulk_properties["GR"]
2397
+ results["PE"] = bulk_properties["PE"]
2398
+ else:
2399
+ single_amounts_mineralogy = {}
2400
+ single_amounts_chemistry = {}
2401
+ for mineral, value in amounts_mineralogy.items():
2402
+ single_amounts_mineralogy[mineral] = value[0]
2403
+ for element, value in amounts_chemistry.items():
2404
+ single_amounts_chemistry[element] = value[0]
2405
+ results["mineralogy"] = single_amounts_mineralogy
2406
+ results["chemistry"] = single_amounts_chemistry
2407
+ results["phi"] = bulk_properties["phi"][0]
2408
+ results["fluid"] = "water"
2409
+ results["rho_s"] = bulk_properties["rho_s"][0]
2410
+ results["rho"] = bulk_properties["rho"][0]
2411
+ results["vP"] = bulk_properties["vP"][0]
2412
+ results["vS"] = bulk_properties["vS"][0]
2413
+ results["vP/vS"] = bulk_properties["vPvS"][0]
2414
+ results["K"] = bulk_properties["K"][0]
2415
+ results["G"] = bulk_properties["G"][0]
2416
+ results["E"] = bulk_properties["E"][0]
2417
+ results["nu"] = bulk_properties["nu"][0]
2418
+ results["GR"] = bulk_properties["GR"][0]
2419
+ results["PE"] = bulk_properties["PE"][0]
2420
+ #
2421
+ return results
2422
+
2423
+ def create_greenstone(self, number):
2424
+ pass
2425
+
2426
+
2427
+ #
2428
+ class AmphiboliteFacies:
2429
+ #
2430
+ def __init__(self, fluid="water", actual_thickness=100, porosity=None):
2431
+ self.fluid = fluid
2432
+ self.actualThickness = actual_thickness
2433
+ self.porosity = porosity
2434
+ #
2435
+ ## Minerals
2436
+ self.data_quartz = Oxides(impurity="pure", data_type=True).create_quartz()
2437
+ self.data_kyanite = Nesosilicates(impurity="pure", data_type=True).create_kyanite()
2438
+ self.data_sillimanite = Nesosilicates(impurity="pure", data_type=True).create_sillimanite()
2439
+ self.data_tremolite = Inosilicates(impurity="pure", data_type=True).create_tremolite()
2440
+ #
2441
+ ## Fluids
2442
+ self.data_water = Water.water("")
2443
+ #
2444
+ def create_amphibolite_ortho(self, number=1, composition=None):
2445
+ results_container = {}
2446
+ results_container["rock"] = "Ortho-Amphibolite"
2447
+ results_container["mineralogy"] = {}
2448
+ results_container["chemistry"] = {}
2449
+ results_container["compounds"] = {}
2450
+ results_container["phi"] = []
2451
+ results_container["fluid"] = self.fluid
2452
+ results_container["rho_s"] = []
2453
+ results_container["rho"] = []
2454
+ results_container["vP"] = []
2455
+ results_container["vS"] = []
2456
+ results_container["vP/vS"] = []
2457
+ results_container["K"] = []
2458
+ results_container["G"] = []
2459
+ results_container["E"] = []
2460
+ results_container["nu"] = []
2461
+ results_container["GR"] = []
2462
+ results_container["PE"] = []
2463
+ #
2464
+ n = 0
2465
+ while n < number:
2466
+ data_actinolite = Inosilicates(impurity="pure", data_type=True).create_actinolite()
2467
+ data_plagioclase = Tectosilicates(impurity="pure", data_type=True).create_plagioclase()
2468
+ data_biotite = Phyllosilicates(impurity="pure", data_type=True).create_biotite()
2469
+ data_chlorite = Phyllosilicates(impurity="pure", data_type=True).create_chlorite()
2470
+ #
2471
+ mineralogy = {"Tr": self.data_tremolite, "Act": data_actinolite, "Pl": data_plagioclase, "Bt": data_biotite,
2472
+ "Qz": self.data_quartz, "Chl": data_chlorite}
2473
+ #
2474
+ minerals_list = list(mineralogy.keys())
2475
+ #
2476
+ if minerals_list[0] not in results_container["mineralogy"]:
2477
+ for mineral in minerals_list:
2478
+ results_container["mineralogy"][mineral] = []
2479
+ #
2480
+ if self.porosity == None:
2481
+ phi_helper = round(rd.uniform(0.0, 0.1), 4)
2482
+ else:
2483
+ phi_helper = round(rd.uniform(self.porosity[0], self.porosity[1]), 4)
2484
+ #
2485
+ #
2486
+ condition = False
2487
+ #
2488
+ while condition == False:
2489
+ elements_list = []
2490
+ phi_minerals = {}
2491
+ w_minerals = {}
2492
+ w_elements = {}
2493
+ #
2494
+ if composition != None:
2495
+ phi_tr = composition["Tr"]
2496
+ phi_act = composition["Act"]
2497
+ phi_pl = composition["Pl"]
2498
+ phi_bt = composition["Bt"]
2499
+ phi_qz = composition["Qz"]
2500
+ phi_chl = composition["Chl"]
2501
+ #
2502
+ phi_minerals["Tr"] = phi_tr
2503
+ phi_minerals["Act"] = phi_act
2504
+ phi_minerals["Pl"] = phi_pl
2505
+ phi_minerals["Bt"] = phi_bt
2506
+ phi_minerals["Qz"] = phi_qz
2507
+ phi_minerals["Chl"] = phi_chl
2508
+ #
2509
+ else:
2510
+ condition_2 = False
2511
+ #
2512
+ while condition_2 == False:
2513
+ phi_tr = round(rd.uniform(0.0, 0.5), 4)
2514
+ phi_act = round(rd.uniform(0.0, (1.0 - phi_tr)), 4)
2515
+ phi_pl = round(rd.uniform(0.15, (1.0 - phi_tr - phi_act)), 4)
2516
+ phi_bt = round(rd.uniform(0.0, (1.0 - phi_tr - phi_act - phi_pl)), 4)
2517
+ phi_qz = round(rd.uniform(0.0, (1.0 - phi_tr - phi_act - phi_pl - phi_bt)), 4)
2518
+ phi_chl = round(1 - phi_tr - phi_act - phi_pl - phi_bt - phi_qz, 4)
2519
+ #
2520
+ phi_total = phi_tr + phi_act + phi_pl + phi_bt + phi_qz + phi_chl
2521
+ #
2522
+ if np.isclose(phi_total, 1.0000) == True:
2523
+ if 0.0 <= phi_tr <= 0.5 and 0.0 <= phi_act <= 0.5 and 0.15 <= phi_pl <= 0.4 \
2524
+ and 0.0 <= phi_bt <= 0.2 and 0.0 <= phi_qz <= 0.2 and 0.0 <= phi_chl <= 0.1:
2525
+ condition_2 = True
2526
+ #
2527
+ phi_minerals["Tr"] = phi_tr
2528
+ phi_minerals["Act"] = phi_act
2529
+ phi_minerals["Pl"] = phi_pl
2530
+ phi_minerals["Bt"] = phi_bt
2531
+ phi_minerals["Qz"] = phi_qz
2532
+ phi_minerals["Chl"] = phi_chl
2533
+ #
2534
+ rho_s = 0
2535
+ velocities_minerals = {}
2536
+ for key, value in phi_minerals.items():
2537
+ rho_s += phi_minerals[key]*mineralogy[key]["rho"]
2538
+ #
2539
+ velocities_minerals[key] = {}
2540
+ velocities_minerals[key]["vP"] = mineralogy[key]["vP"]
2541
+ velocities_minerals[key]["vS"] = mineralogy[key]["vS"]
2542
+ #
2543
+ for element, value in mineralogy[key]["chemistry"].items():
2544
+ if element not in elements_list:
2545
+ elements_list.append(element)
2546
+ w_elements[element] = 0.0
2547
+ #
2548
+ if elements_list[0] not in results_container["chemistry"]:
2549
+ for element in elements_list:
2550
+ results_container["chemistry"][element] = []
2551
+ #
2552
+ rho_s = round(rho_s, 3)
2553
+ #
2554
+ n_minerals = len(minerals_list)
2555
+ w_minerals_total = 0
2556
+ for index, (key, value) in enumerate(phi_minerals.items()):
2557
+ if key == "Urn":
2558
+ n_digits = 4
2559
+ else:
2560
+ n_digits = 4
2561
+ #
2562
+ if index < n_minerals - 1:
2563
+ result = round((phi_minerals[key]*mineralogy[key]["rho"])/rho_s, n_digits)
2564
+ w_minerals[key] = result
2565
+ w_minerals_total += result
2566
+ else:
2567
+ w_minerals[key] = round(1 - w_minerals_total, n_digits)
2568
+ #
2569
+ total_w_minerals = round(sum(w_minerals.values()), 4)
2570
+ #
2571
+ if self.fluid == "water":
2572
+ data_fluid = self.data_water
2573
+ #
2574
+ old_index = elements_list.index("O")
2575
+ elements_list += [elements_list.pop(old_index)]
2576
+ #
2577
+ w_elements_total = 0.0
2578
+ for element in elements_list:
2579
+ if element != "O":
2580
+ for mineral, w_mineral in w_minerals.items():
2581
+ if element in mineralogy[mineral]["chemistry"]:
2582
+ if element == "U":
2583
+ n_digits = 4
2584
+ else:
2585
+ n_digits = 4
2586
+ #
2587
+ value = round(w_mineral*mineralogy[mineral]["chemistry"][element], n_digits)
2588
+ w_elements[element] += value
2589
+ w_elements_total += value
2590
+ #
2591
+ w_elements[element] = round(w_elements[element], n_digits)
2592
+ #
2593
+ elif element == "O":
2594
+ w_elements[element] += round(1 - w_elements_total, 4)
2595
+ #
2596
+ w_elements[element] = round(w_elements[element], 4)
2597
+ #
2598
+ total_w_elements = round(sum(w_elements.values()), 4)
2599
+ #
2600
+ if np.isclose(total_w_minerals, 1.00) == True and np.isclose(total_w_elements, 1.00) == True:
2601
+ for key, value in w_minerals.items():
2602
+ w_minerals[key] = abs(value)
2603
+ #
2604
+ for key, value in w_elements.items():
2605
+ w_elements[key] = abs(value)
2606
+ #
2607
+ condition = True
2608
+ #
2609
+ gamma_ray = 0.0
2610
+ photoelectricity = 0.0
2611
+ #
2612
+ K_list = []
2613
+ G_list = []
2614
+ bulk_mod = 0
2615
+ shear_mod = 0
2616
+ phi_list = []
2617
+ for key, value in phi_minerals.items():
2618
+ gamma_ray += phi_minerals[key]*mineralogy[key]["GR"]
2619
+ photoelectricity += phi_minerals[key]*mineralogy[key]["PE"]
2620
+ #
2621
+ gamma_ray = round(gamma_ray, 3)
2622
+ photoelectricity = round(photoelectricity, 3)
2623
+ #
2624
+ bulk_mod += phi_minerals[key]*mineralogy[key]["K"]
2625
+ shear_mod += phi_minerals[key]*mineralogy[key]["G"]
2626
+ K_list.append(round(phi_minerals[key]*mineralogy[key]["K"], 3))
2627
+ G_list.append(round(phi_minerals[key]*mineralogy[key]["G"], 3))
2628
+ phi_list.append(phi_minerals[key])
2629
+ #
2630
+ rho = round((1 - phi_helper)*rho_s + phi_helper*data_fluid[2]/1000, 3)
2631
+ bulk_mod = round(bulk_mod, 3)
2632
+ shear_mod = round(shear_mod, 3)
2633
+ youngs_mod = round((9*bulk_mod*shear_mod)/(3*bulk_mod + shear_mod), 3)
2634
+ poisson_rat = round((3*bulk_mod - 2*shear_mod)/(6*bulk_mod + 2*shear_mod), 4)
2635
+ vP = round(((bulk_mod*10**9 + 4/3*shear_mod*10**9)/(rho))**0.5, 3)
2636
+ vS = round(((shear_mod*10**9)/(rho))**0.5, 3)
2637
+ vPvS = round(vP/vS, 3)
2638
+
2639
+ ## RESULTS
2640
+ for key, value in w_minerals.items():
2641
+ results_container["mineralogy"][key].append(value)
2642
+
2643
+ for key, value in w_elements.items():
2644
+ results_container["chemistry"][key].append(value)
2645
+
2646
+ amounts = []
2647
+ for key, value in w_elements.items():
2648
+ results_container["chemistry"][key].append(value)
2649
+ chem_data = PeriodicSystem(name=key).get_data()
2650
+ amounts.append([key, chem_data[1], value])
2651
+
2652
+ list_elements = list(w_elements.keys())
2653
+ list_oxides = OxideCompounds(var_list_elements=list_elements).find_oxides()
2654
+ composition_oxides = {}
2655
+
2656
+ for var_oxide in list_oxides:
2657
+ oxide_data = OxideCompounds(var_compound=var_oxide, var_amounts=amounts).get_composition()
2658
+ composition_oxides[var_oxide] = round(oxide_data["Oxide"][1], 4)
2659
+
2660
+ if list_oxides[0] not in results_container["compounds"]:
2661
+ for oxide in list_oxides:
2662
+ results_container["compounds"][oxide] = []
2663
+
2664
+ for key, value in composition_oxides.items():
2665
+ results_container["compounds"][key].append(value)
2666
+
2667
+ results_container["mineralogy"] = dict(sorted(
2668
+ results_container["mineralogy"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
2669
+ results_container["chemistry"] = dict(sorted(
2670
+ results_container["chemistry"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
2671
+ results_container["compounds"] = dict(sorted(
2672
+ results_container["compounds"].items(), key=lambda item: sum(item[1])/len(item[1]), reverse=True))
2673
+
2674
+ results_container["phi"].append(phi_helper)
2675
+ results_container["rho_s"].append(rho_s)
2676
+ results_container["rho"].append(rho)
2677
+ results_container["vP"].append(vP)
2678
+ results_container["vS"].append(vS)
2679
+ results_container["vP/vS"].append(vPvS)
2680
+ results_container["K"].append(bulk_mod)
2681
+ results_container["G"].append(shear_mod)
2682
+ results_container["E"].append(youngs_mod)
2683
+ results_container["nu"].append(poisson_rat)
2684
+ results_container["GR"].append(gamma_ray)
2685
+ results_container["PE"].append(photoelectricity)
2686
+ #
2687
+ n += 1
2688
+ #
2689
+ return results_container
2690
+ #
2691
+ ## TEST
2692
+ # print("Test: Granulite")
2693
+ # print(MetamorphicRocks().create_granulite(number=1))
2694
+ # print(MetamorphicRocks().create_granulite(number=10)
2695
+ # print("Test: Greenschist")
2696
+ # print(MetamorphicRocks().create_greenschist(number=1))
2697
+ # print(MetamorphicRocks().create_greenschist(number=10))
2698
+ # print("Test: Amphibolite")
2699
+ # print(MetamorphicRocks().create_amphibolite_ortho(number=1))