PetThermoTools 0.2.39__py3-none-any.whl → 0.2.41__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.
- PetThermoTools/Barom.py +701 -575
- PetThermoTools/GenFuncs.py +18 -2
- PetThermoTools/Liq.py +0 -8
- PetThermoTools/MELTS.py +85 -57
- PetThermoTools/Melting.py +12 -1
- PetThermoTools/Path.py +239 -139
- PetThermoTools/Path_wrappers.py +448 -259
- PetThermoTools/PhaseDiagrams.py +50 -98
- PetThermoTools/Saturation.py +353 -2
- PetThermoTools/_version.py +1 -1
- {PetThermoTools-0.2.39.dist-info → PetThermoTools-0.2.41.dist-info}/METADATA +2 -2
- PetThermoTools-0.2.41.dist-info/RECORD +20 -0
- PetThermoTools-0.2.39.dist-info/RECORD +0 -20
- {PetThermoTools-0.2.39.dist-info → PetThermoTools-0.2.41.dist-info}/LICENSE.txt +0 -0
- {PetThermoTools-0.2.39.dist-info → PetThermoTools-0.2.41.dist-info}/WHEEL +0 -0
- {PetThermoTools-0.2.39.dist-info → PetThermoTools-0.2.41.dist-info}/top_level.txt +0 -0
PetThermoTools/GenFuncs.py
CHANGED
@@ -11,6 +11,8 @@ from PetThermoTools.MELTS import *
|
|
11
11
|
|
12
12
|
Names = {'liquid1': '_Liq',
|
13
13
|
'liquid2': '_Liq2',
|
14
|
+
'liquid3': '_Liq3',
|
15
|
+
'liquid4': '_Liq4',
|
14
16
|
'olivine1': '_Ol',
|
15
17
|
'olivine2': '_Ol2',
|
16
18
|
'clinopyroxene1': '_Cpx',
|
@@ -33,6 +35,9 @@ Names = {'liquid1': '_Liq',
|
|
33
35
|
'apatite2': '_Apa2'}
|
34
36
|
|
35
37
|
Names_MM = {'liq1': '_Liq',
|
38
|
+
'liq2': '_Liq2',
|
39
|
+
'liq3': '_Liq3',
|
40
|
+
'liq4': '_Liq4',
|
36
41
|
'ol1': '_Ol',
|
37
42
|
'ol2': '_Ol2',
|
38
43
|
'cpx1': '_Cpx',
|
@@ -43,8 +48,19 @@ Names_MM = {'liq1': '_Liq',
|
|
43
48
|
'g2': '_Grt2',
|
44
49
|
'fsp1': '_Plag',
|
45
50
|
'fsp2': '_Plag2',
|
46
|
-
'
|
47
|
-
'
|
51
|
+
'spl1': '_Sp',
|
52
|
+
'spl2': '_Sp2'}
|
53
|
+
|
54
|
+
def to_float(x):
|
55
|
+
if x is None:
|
56
|
+
return None
|
57
|
+
if isinstance(x, (int, float)):
|
58
|
+
return float(x)
|
59
|
+
if isinstance(x, (list, tuple)):
|
60
|
+
return [float(v) for v in x]
|
61
|
+
if isinstance(x, np.ndarray):
|
62
|
+
return x.astype(float)
|
63
|
+
return x # leave unchanged if unexpected type
|
48
64
|
|
49
65
|
def label_results(Result,label):
|
50
66
|
Results = Result.copy()
|
PetThermoTools/Liq.py
CHANGED
@@ -353,24 +353,16 @@ def equilibrate_multi(cores = None, Model = None, bulk = None, T_C = None, P_bar
|
|
353
353
|
if copy_columns is not None:
|
354
354
|
if type(copy_columns) == str:
|
355
355
|
Combined.insert(0, copy_columns, comp[copy_columns])
|
356
|
-
# Af_Combined.insert(0, copy_columns, comp[copy_columns])
|
357
356
|
elif type(copy_columns) == list:
|
358
357
|
j = 0
|
359
358
|
for i in copy_columns:
|
360
359
|
Combined.insert(j, i, comp[i])
|
361
|
-
# Af_Combined.insert(j, i, comp[i])
|
362
360
|
j = j + 1
|
363
361
|
|
364
362
|
Af_Combined = Af_Combined.add_suffix('_affinity')
|
365
363
|
Combined = pd.concat([Combined, Af_Combined], axis = 1)
|
366
|
-
# Affinity = Af_Combined.copy()
|
367
364
|
return Combined
|
368
365
|
else:
|
369
|
-
# import julia
|
370
|
-
# from julia.api import Julia
|
371
|
-
# jl = Julia(compiled_modules=False)
|
372
|
-
# from julia import MAGEMinCalc
|
373
|
-
## Output = MM.equilibrate_multi(P_bar = P_bar, T_C = T_C, comp = comp)
|
374
366
|
from juliacall import Main as jl, convert as jlconvert
|
375
367
|
|
376
368
|
jl.seval("using MAGEMinCalc")
|
PetThermoTools/MELTS.py
CHANGED
@@ -37,7 +37,6 @@ def equilibrate_MELTS(Model = None, P_bar = None, T_C = None, comp = None,
|
|
37
37
|
if Suppress == "All":
|
38
38
|
melts.engine.pressure = np.random.normal(P_bar, P_bar/10)
|
39
39
|
melts.engine.temperature = T_C + 500
|
40
|
-
# melts.engine.setBulkComposition(bulk)
|
41
40
|
PL = melts.engine.calcSaturationState()
|
42
41
|
for p in PL:
|
43
42
|
if p != "fluid":
|
@@ -73,12 +72,6 @@ def equilibrate_MELTS(Model = None, P_bar = None, T_C = None, comp = None,
|
|
73
72
|
return Results
|
74
73
|
|
75
74
|
SolidPhase = melts.engine.solidNames
|
76
|
-
# if np.isnan(melts.engine.getProperty('mass', 'liquid1')):
|
77
|
-
# PhaseList = SolidPhase
|
78
|
-
# elif len(SolidPhase) > 0:
|
79
|
-
# PhaseList = ['liquid1'] + SolidPhase
|
80
|
-
# else:
|
81
|
-
# PhaseList = ['Liquid1']
|
82
75
|
if SolidPhase is not None:
|
83
76
|
PhaseList = ['liquid1'] + SolidPhase
|
84
77
|
else:
|
@@ -104,17 +97,9 @@ def equilibrate_MELTS(Model = None, P_bar = None, T_C = None, comp = None,
|
|
104
97
|
|
105
98
|
for pr in Results[phase + '_prop']:
|
106
99
|
Results[phase + '_prop'][pr].loc[0] = melts.engine.getProperty(pr, phase)
|
107
|
-
|
108
|
-
# if PhaseList is not None:
|
109
|
-
# for p in PhaseList:
|
110
|
-
# PhaseComp[p] = melts.engine.getProperty('dispComposition', p)
|
111
|
-
# PhaseProp[p] = {}
|
112
|
-
# for i in Props:
|
113
|
-
# PhaseProp[p][i] = melts.engine.getProperty(i, p)
|
114
100
|
|
115
101
|
PhaseList = melts.engine.calcSaturationState()
|
116
102
|
Affinity_raw = melts.engine.getProperty('affinity', PhaseList)
|
117
|
-
# Affinity = {'orthopyroxene': Affinity_raw}
|
118
103
|
Affinity = {Phase: float_value for Phase, float_value in zip(PhaseList, Affinity_raw)}
|
119
104
|
|
120
105
|
return Results, Affinity
|
@@ -1205,7 +1190,7 @@ def path_MELTS(Model = None, comp = None, Frac_solid = None, Frac_fluid = None,
|
|
1205
1190
|
else:
|
1206
1191
|
return Results
|
1207
1192
|
|
1208
|
-
def findSatPressure_MELTS_multi(Model = None, comp = None, fO2_buffer = None, fO2_offset = None, P_bar = None, T_fixed_C = None):
|
1193
|
+
def findSatPressure_MELTS_multi(Model = None, comp = None, fO2_buffer = None, fO2_offset = None, P_bar = None, T_fixed_C = None, index = None):
|
1209
1194
|
out = pd.DataFrame(columns = ['Sample_ID_Liq', 'SiO2_Liq', 'TiO2_Liq', 'Al2O3_Liq', 'Cr2O3_Liq', 'FeOt_Liq', 'MnO_Liq', 'MgO_Liq', 'CaO_Liq', 'Na2O_Liq', 'K2O_Liq', 'P2O5_Liq', 'H2O_Liq', 'CO2_Liq', 'Fe3Fet_Liq', 'P_bar', 'T_Liq'])
|
1210
1195
|
|
1211
1196
|
from meltsdynamic import MELTSdynamic
|
@@ -1219,11 +1204,14 @@ def findSatPressure_MELTS_multi(Model = None, comp = None, fO2_buffer = None, fO
|
|
1219
1204
|
elif Model == "MELTSv1.2.0":
|
1220
1205
|
melts = MELTSdynamic(4)
|
1221
1206
|
|
1222
|
-
melts.engine.setSystemProperties("Suppress", "rutile")
|
1223
|
-
melts.engine.setSystemProperties("Suppress", "tridymite")
|
1207
|
+
# melts.engine.setSystemProperties("Suppress", "rutile")
|
1208
|
+
# melts.engine.setSystemProperties("Suppress", "tridymite")
|
1224
1209
|
|
1225
1210
|
if "Sample_ID_Liq" not in comp.keys():
|
1226
|
-
|
1211
|
+
if index is not None:
|
1212
|
+
comp.loc[:, "Sample_ID_Liq"] = index
|
1213
|
+
else:
|
1214
|
+
comp.loc[:,"Sample_ID_Liq"] = np.linspace(0, len(comp['SiO2_Liq'])-1, len(comp['SiO2_Liq']))
|
1227
1215
|
|
1228
1216
|
for i in range(len(T_fixed_C)):
|
1229
1217
|
bulk = [comp.loc[i,'SiO2_Liq'], comp.loc[i,'TiO2_Liq'], comp.loc[i,'Al2O3_Liq'],
|
@@ -1329,7 +1317,8 @@ def findSatPressure_MELTS_multi(Model = None, comp = None, fO2_buffer = None, fO
|
|
1329
1317
|
|
1330
1318
|
return out
|
1331
1319
|
|
1332
|
-
def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar_init = None,
|
1320
|
+
def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar_init = None,
|
1321
|
+
comp = None, fO2_buffer = None, fO2_offset = None, trial = None, melts = None, suppressed = None):
|
1333
1322
|
"""
|
1334
1323
|
Calculates the volatile saturation pressure and temperature of a given chemical composition (including volatiles) using the MELTS model.
|
1335
1324
|
|
@@ -1352,6 +1341,8 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1352
1341
|
'P_bar': the saturation pressure in bars.
|
1353
1342
|
'T_Liq': the temperature in degrees Celsius at which the saturation pressure is calculated.
|
1354
1343
|
"""
|
1344
|
+
if trial is not None:
|
1345
|
+
trial = False
|
1355
1346
|
|
1356
1347
|
if P_bar_init is None:
|
1357
1348
|
P_bar_init = 5000
|
@@ -1361,32 +1352,31 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1361
1352
|
if T_C_init is None:
|
1362
1353
|
T_C_init = 1200
|
1363
1354
|
|
1364
|
-
|
1365
|
-
|
1366
|
-
if Model is None or Model == "MELTSv1.0.2":
|
1367
|
-
melts = MELTSdynamic(1)
|
1368
|
-
elif Model == "pMELTS":
|
1369
|
-
melts = MELTSdynamic(2)
|
1370
|
-
elif Model == "MELTSv1.1.0":
|
1371
|
-
melts = MELTSdynamic(3)
|
1372
|
-
elif Model == "MELTSv1.2.0":
|
1373
|
-
melts = MELTSdynamic(4)
|
1355
|
+
if melts is None:
|
1356
|
+
from meltsdynamic import MELTSdynamic
|
1374
1357
|
|
1375
|
-
|
1376
|
-
|
1358
|
+
if Model is None or Model == "MELTSv1.0.2":
|
1359
|
+
melts = MELTSdynamic(1)
|
1360
|
+
elif Model == "pMELTS":
|
1361
|
+
melts = MELTSdynamic(2)
|
1362
|
+
elif Model == "MELTSv1.1.0":
|
1363
|
+
melts = MELTSdynamic(3)
|
1364
|
+
elif Model == "MELTSv1.2.0":
|
1365
|
+
melts = MELTSdynamic(4)
|
1377
1366
|
|
1378
1367
|
bulk = [comp['SiO2_Liq'], comp['TiO2_Liq'], comp['Al2O3_Liq'], comp['Fe3Fet_Liq']*((159.59/2)/71.844)*comp['FeOt_Liq'], comp['Cr2O3_Liq'], (1- comp['Fe3Fet_Liq'])*comp['FeOt_Liq'], comp['MnO_Liq'], comp['MgO_Liq'], 0.0, 0.0, comp['CaO_Liq'], comp['Na2O_Liq'], comp['K2O_Liq'], comp['P2O5_Liq'], comp['H2O_Liq'], comp['CO2_Liq'], 0.0, 0.0, 0.0]
|
1379
1368
|
bulk = list(100*np.array(bulk)/np.sum(bulk))
|
1380
1369
|
|
1381
1370
|
if T_fixed_C is not None:
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
if p != "
|
1389
|
-
|
1371
|
+
if suppressed is None:
|
1372
|
+
melts.engine.pressure = P_bar_init
|
1373
|
+
melts.engine.temperature = T_fixed_C + 500
|
1374
|
+
melts.engine.setBulkComposition(bulk)
|
1375
|
+
PL = melts.engine.calcSaturationState()
|
1376
|
+
for p in PL:
|
1377
|
+
if p != "fluid":
|
1378
|
+
if p != "water":
|
1379
|
+
melts.engine.setSystemProperties("Suppress", p)
|
1390
1380
|
|
1391
1381
|
melts.engine.pressure = P_bar_init
|
1392
1382
|
melts.engine.temperature = T_fixed_C
|
@@ -1394,8 +1384,12 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1394
1384
|
try:
|
1395
1385
|
melts.engine.calcEquilibriumState(1,0)
|
1396
1386
|
except:
|
1397
|
-
|
1398
|
-
|
1387
|
+
if trial is not None:
|
1388
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1389
|
+
return out, trial
|
1390
|
+
else:
|
1391
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1392
|
+
return out
|
1399
1393
|
|
1400
1394
|
for i in range(2):
|
1401
1395
|
if len(melts.engine.solidNames) > 0:
|
@@ -1405,13 +1399,18 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1405
1399
|
P_bar = P_bar*1.1
|
1406
1400
|
else:
|
1407
1401
|
P_bar = P_bar*1.5
|
1402
|
+
|
1408
1403
|
melts.engine.pressure = P_bar
|
1409
1404
|
try:
|
1410
1405
|
melts = melts.addNodeAfter()
|
1411
1406
|
melts.engine.calcEquilibriumState(1,0)
|
1412
1407
|
except:
|
1413
|
-
|
1414
|
-
|
1408
|
+
if trial is not None:
|
1409
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1410
|
+
return out, trial
|
1411
|
+
else:
|
1412
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1413
|
+
return out
|
1415
1414
|
|
1416
1415
|
if len(melts.engine.solidNames) == 0:
|
1417
1416
|
P_high = P_bar
|
@@ -1425,8 +1424,12 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1425
1424
|
melts = melts.addNodeAfter()
|
1426
1425
|
melts.engine.calcEquilibriumState(1,0)
|
1427
1426
|
except:
|
1428
|
-
|
1429
|
-
|
1427
|
+
if trial is not None:
|
1428
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1429
|
+
return out, trial
|
1430
|
+
else:
|
1431
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1432
|
+
return out
|
1430
1433
|
|
1431
1434
|
if len(melts.engine.solidNames) == 0:
|
1432
1435
|
P_low = P_bar
|
@@ -1438,8 +1441,12 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1438
1441
|
melts = melts.addNodeAfter()
|
1439
1442
|
melts.engine.calcEquilibriumState(1,0)
|
1440
1443
|
except:
|
1441
|
-
|
1442
|
-
|
1444
|
+
if trial is not None:
|
1445
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1446
|
+
return out, trial
|
1447
|
+
else:
|
1448
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1449
|
+
return out
|
1443
1450
|
|
1444
1451
|
if len(melts.engine.solidNames) > 0:
|
1445
1452
|
P_low = P_bar
|
@@ -1466,6 +1473,7 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1466
1473
|
'T_Liq': T_fixed_C}
|
1467
1474
|
|
1468
1475
|
else:
|
1476
|
+
|
1469
1477
|
Liq_Results = findLiq_MELTS(Model = Model, P_bar = P_bar, comp = bulk, melts = melts,
|
1470
1478
|
fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, T_C_init = T_C_init, Step = np.array([5,1]))
|
1471
1479
|
|
@@ -1476,13 +1484,21 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1476
1484
|
if Liq_Results['fluid_saturated'] == "Yes":
|
1477
1485
|
while Liq_Results['fluid_saturated'] == "Yes":
|
1478
1486
|
P_low = P_bar
|
1479
|
-
P_bar
|
1487
|
+
if P_bar > 5000:
|
1488
|
+
P_bar = P_bar*1.2
|
1489
|
+
else:
|
1490
|
+
P_bar = P_bar*1.6
|
1491
|
+
|
1480
1492
|
Liq_Results = findLiq_MELTS(Model = Model, P_bar = P_bar, comp = bulk, melts = melts,
|
1481
1493
|
fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, T_C_init = Liq_Results['T_Liq'], Step = np.array([5,1]))
|
1482
1494
|
|
1483
1495
|
if Liq_Results['T_Liq'] == 0.0:
|
1484
|
-
|
1485
|
-
|
1496
|
+
if trial is not None:
|
1497
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1498
|
+
return out, trial
|
1499
|
+
else:
|
1500
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1501
|
+
return out
|
1486
1502
|
|
1487
1503
|
if Liq_Results['fluid_saturated'] == "No":
|
1488
1504
|
P_high = P_bar
|
@@ -1496,21 +1512,29 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1496
1512
|
fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, T_C_init = Liq_Results['T_Liq'], Step = np.array([5,1]))
|
1497
1513
|
|
1498
1514
|
if Liq_Results['T_Liq'] == 0.0:
|
1499
|
-
|
1500
|
-
|
1515
|
+
if trial is not None:
|
1516
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1517
|
+
return out, trial
|
1518
|
+
else:
|
1519
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1520
|
+
return out
|
1501
1521
|
|
1502
1522
|
if Liq_Results['fluid_saturated'] == "Yes":
|
1503
1523
|
P_low = P_bar
|
1504
1524
|
break
|
1505
1525
|
|
1506
|
-
|
1526
|
+
for jj in range(5):
|
1507
1527
|
P_new = P_low + (P_high - P_low)/2
|
1508
1528
|
Liq_Results = findLiq_MELTS(Model = Model, P_bar = P_new, comp = bulk, melts = melts,
|
1509
1529
|
fO2_buffer = fO2_buffer, fO2_offset = fO2_offset, T_C_init = Liq_Results['T_Liq'], Step = np.array([3,1]))
|
1510
1530
|
|
1511
1531
|
if Liq_Results['T_Liq'] == 0.0:
|
1512
|
-
|
1513
|
-
|
1532
|
+
if trial is not None:
|
1533
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1534
|
+
return out, trial
|
1535
|
+
else:
|
1536
|
+
out = {'SiO2_Liq': 0.0, 'TiO2_Liq': 0.0, 'Al2O3_Liq': 0.0, 'FeOt_Liq': 0.0, 'MnO_Liq': 0.0, 'MgO_Liq': 0.0, 'CaO_Liq': 0.0, 'Na2O_Liq': 0.0, 'K2O_Liq': 0.0, 'P2O5_Liq': 0.0, 'H2O_Liq': 0.0, 'CO2_Liq': 0.0, 'Fe3Fet_Liq': 0.0, 'P_bar': 0.0, 'T_Liq': 0.0}
|
1537
|
+
return out
|
1514
1538
|
break
|
1515
1539
|
|
1516
1540
|
if Liq_Results['fluid_saturated'] == "Yes":
|
@@ -1542,7 +1566,11 @@ def findSatPressure_MELTS(Model = None, T_C_init = None, T_fixed_C = None, P_bar
|
|
1542
1566
|
'P_bar': P_bar,
|
1543
1567
|
'T_Liq': Liq_Results['T_Liq']}
|
1544
1568
|
|
1545
|
-
|
1569
|
+
if trial is not None:
|
1570
|
+
trial = True
|
1571
|
+
return out, trial
|
1572
|
+
else:
|
1573
|
+
return out
|
1546
1574
|
|
1547
1575
|
def AdiabaticDecompressionMelting_MELTS(Model = None, comp = None, Tp_C = None, P_path_bar = None, P_start_bar = None, P_end_bar = None, dp_bar = None, Frac = False, fO2_buffer = None, fO2_offset = None):
|
1548
1576
|
try:
|
PetThermoTools/Melting.py
CHANGED
@@ -49,6 +49,17 @@ def AdiabaticDecompressionMelting(cores = multiprocessing.cpu_count(),
|
|
49
49
|
P_path_bar = None, Frac = False, prop = None,
|
50
50
|
fO2_buffer = None, fO2_offset = None, Fe3Fet = None, MELTS_filter = True):
|
51
51
|
|
52
|
+
Tp_C = to_float(Tp_C)
|
53
|
+
|
54
|
+
P_path_bar = to_float(P_path_bar)
|
55
|
+
P_start_bar= to_float(P_start_bar)
|
56
|
+
P_end_bar = to_float(P_end_bar)
|
57
|
+
dp_bar = to_float(dp_bar)
|
58
|
+
|
59
|
+
Fe3Fet = to_float(Fe3Fet)
|
60
|
+
fO2_offset = to_float(fO2_offset)
|
61
|
+
|
62
|
+
|
52
63
|
if Tp_Method == "pyMelt":
|
53
64
|
try:
|
54
65
|
import pyMelt as m
|
@@ -265,7 +276,7 @@ def AdiabaticMelt(q, index, *, Model = None, comp_1 = None, comp_2 = None, comp_
|
|
265
276
|
if type(comp_1) == dict:
|
266
277
|
comp_julia = jl.seval("Dict")(comp_1)
|
267
278
|
else:
|
268
|
-
comp_new = comp_1.loc[
|
279
|
+
comp_new = comp_1.loc[0].to_dict()
|
269
280
|
comp_julia = jl.seval("Dict")(comp_new)
|
270
281
|
|
271
282
|
Output_jl = jl.MAGEMinCalc.AdiabaticDecompressionMelting(comp = comp_julia, P_start_kbar = P_start_bar/1000.0,
|