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