VolFe 0.4.1__tar.gz → 0.4.2__tar.gz
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.
- {volfe-0.4.1 → volfe-0.4.2}/PKG-INFO +3 -3
- {volfe-0.4.1 → volfe-0.4.2}/pyproject.toml +1 -1
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe/__init__.py +8 -8
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe/batch_calculations.py +98 -51
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe/calculations.py +83 -87
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe/equilibrium_equations.py +64 -12
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe/isotopes.py +50 -1
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe/model_dependent_variables.py +112 -39
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe.egg-info/PKG-INFO +3 -3
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe.egg-info/requires.txt +1 -1
- {volfe-0.4.1 → volfe-0.4.2}/tests/test_S2fO2_functions.py +5 -5
- {volfe-0.4.1 → volfe-0.4.2}/tests/test_degassing_functions.py +62 -54
- {volfe-0.4.1 → volfe-0.4.2}/README.md +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/setup.cfg +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe/differential_equations.py +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe/melt_gas.py +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe.egg-info/SOURCES.txt +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe.egg-info/dependency_links.txt +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/src/VolFe.egg-info/top_level.txt +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/tests/test_model_options.py +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/tests/test_other_functions.py +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/tests/test_pvsat_functions.py +0 -0
- {volfe-0.4.1 → volfe-0.4.2}/tests/test_user_warnings.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: VolFe
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.2
|
|
4
4
|
Summary: VolFe
|
|
5
5
|
Author: Pip Liggins, Penny Wieser
|
|
6
6
|
Author-email: Ery Hughes <ery.c.hughes@gmail.com>
|
|
@@ -15,7 +15,7 @@ Requires-Dist: gmpy2==2.2.1
|
|
|
15
15
|
Requires-Dist: numpy<2
|
|
16
16
|
Requires-Dist: pandas==2.2.3
|
|
17
17
|
Requires-Dist: PySulfSat==1.0.6
|
|
18
|
-
Requires-Dist: scipy
|
|
18
|
+
Requires-Dist: scipy>=1.13.1
|
|
19
19
|
Requires-Dist: tqdm==4.67.1
|
|
20
20
|
Provides-Extra: dev
|
|
21
21
|
Requires-Dist: pytest; extra == "dev"
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
__author__ = "Ery Hughes, Pip Liggins, Penny Wieser"
|
|
2
|
-
__version__ = "0.4.
|
|
2
|
+
__version__ = "0.4.2"
|
|
3
3
|
|
|
4
4
|
# functions for calculating properties of the melt and gas
|
|
5
|
-
from .melt_gas import *
|
|
5
|
+
from .melt_gas import * # noqa F401 F403
|
|
6
6
|
|
|
7
7
|
# functions for variables that can be model depedent (e.g., solubility constants,
|
|
8
8
|
# fugacity coefficients)
|
|
9
|
-
from .model_dependent_variables import *
|
|
9
|
+
from .model_dependent_variables import * # noqa F401 F403
|
|
10
10
|
|
|
11
11
|
# functions for calculating equilibrium speciation and concentration between melt ± gas
|
|
12
12
|
# at given P and T
|
|
13
|
-
from .equilibrium_equations import *
|
|
14
|
-
from .differential_equations import *
|
|
13
|
+
from .equilibrium_equations import * # noqa F401 F403
|
|
14
|
+
from .differential_equations import * # noqa F401 F403
|
|
15
15
|
|
|
16
16
|
# functions to calculate equilibrium isotope fractionation given melt ± gas composition
|
|
17
|
-
from .batch_calculations import *
|
|
17
|
+
from .batch_calculations import * # noqa F401 F403
|
|
18
18
|
|
|
19
19
|
# functions to run a calculations
|
|
20
|
-
from .calculations import *
|
|
20
|
+
from .calculations import * # noqa F401 F403
|
|
21
21
|
|
|
22
22
|
# functions to run calculations in batch mode
|
|
23
|
-
from .batch_calculations import *
|
|
23
|
+
from .batch_calculations import * # noqa F401 F403
|
|
@@ -1173,9 +1173,15 @@ def calc_gassing(
|
|
|
1173
1173
|
P_sat_, P_sat_H2O_CO2_result = c.P_sat_H2O_CO2(
|
|
1174
1174
|
PT, melt_wf, models, psat_tol, nr_step, nr_tol
|
|
1175
1175
|
)
|
|
1176
|
+
wm_H2Omol_, wm_OH_ = mg.wm_H2Omol_OH(PT, melt_wf, models)
|
|
1177
|
+
wm_CO2carb_, wm_CO2mol_ = mg.wm_CO32_CO2mol(PT, melt_wf, models)
|
|
1176
1178
|
conc = {
|
|
1177
1179
|
"wm_H2O": P_sat_H2O_CO2_result["wm_H2O"],
|
|
1178
1180
|
"wm_CO2": P_sat_H2O_CO2_result["wm_CO2"],
|
|
1181
|
+
"wm_OH": wm_OH_,
|
|
1182
|
+
"wm_H2Omol": wm_H2Omol_,
|
|
1183
|
+
"wm_CO2mol": wm_CO2mol_,
|
|
1184
|
+
"wm_CO2carb": wm_CO2carb_,
|
|
1179
1185
|
"wm_H2": 0.0,
|
|
1180
1186
|
"wm_CO": 0.0,
|
|
1181
1187
|
"wm_CH4": 0.0,
|
|
@@ -1732,6 +1738,7 @@ def calc_gassing(
|
|
|
1732
1738
|
}
|
|
1733
1739
|
if dp_step < 1.0 or dp_step == 1.0:
|
|
1734
1740
|
if PT["P"] <= 10.0:
|
|
1741
|
+
print("P < 10 bar, trying P = 1 bar")
|
|
1735
1742
|
PT["P"] = 1.0
|
|
1736
1743
|
with warnings.catch_warnings():
|
|
1737
1744
|
warnings.simplefilter(
|
|
@@ -1768,7 +1775,7 @@ def calc_gassing(
|
|
|
1768
1775
|
)
|
|
1769
1776
|
print(
|
|
1770
1777
|
"solver failed, calculation aborted at P = ",
|
|
1771
|
-
|
|
1778
|
+
last_successful_P,
|
|
1772
1779
|
datetime.datetime.now(),
|
|
1773
1780
|
)
|
|
1774
1781
|
return results
|
|
@@ -1873,7 +1880,7 @@ def calc_gassing(
|
|
|
1873
1880
|
)
|
|
1874
1881
|
print(
|
|
1875
1882
|
"solver failed, calculation aborted at P = ",
|
|
1876
|
-
|
|
1883
|
+
last_successful_P,
|
|
1877
1884
|
datetime.datetime.now(),
|
|
1878
1885
|
)
|
|
1879
1886
|
return results
|
|
@@ -2153,13 +2160,13 @@ def calc_gassing(
|
|
|
2153
2160
|
results_me = mg.melt_elements(melt_wf, bulk_wf, gas_mf)
|
|
2154
2161
|
if models.loc["gassing_direction", "option"] == "degas":
|
|
2155
2162
|
Wt_ = bulk_wf["Wt"]
|
|
2156
|
-
if results_me["wm_C"] < 1.0e-
|
|
2163
|
+
if results_me["wm_C"] < 1.0e-7: # 0.1 ppm C
|
|
2157
2164
|
results_me["wm_C"] = 0.0
|
|
2158
|
-
if results_me["wm_H"] < 1.0e-
|
|
2165
|
+
if results_me["wm_H"] < 1.0e-7: # 0.1 ppm H
|
|
2159
2166
|
results_me["wm_H"] = 0.0
|
|
2160
|
-
if results_me["wm_S"] < 1.0e-
|
|
2167
|
+
if results_me["wm_S"] < 1.0e-7: # 0.1 ppm S
|
|
2161
2168
|
results_me["wm_S"] = 0.0
|
|
2162
|
-
if results_me["wm_X"] < 1.0e-
|
|
2169
|
+
if results_me["wm_X"] < 1.0e-7: # 0.1 ppm X
|
|
2163
2170
|
results_me["wm_X"] = 0.0
|
|
2164
2171
|
bulk_wf = {
|
|
2165
2172
|
"C": results_me["wm_C"],
|
|
@@ -2211,7 +2218,7 @@ def calc_gassing(
|
|
|
2211
2218
|
"Wt": wt_ * (1.0 - Xst),
|
|
2212
2219
|
}
|
|
2213
2220
|
|
|
2214
|
-
tqdmsteps.update(dp_step)
|
|
2221
|
+
tqdmsteps.update(abs(dp_step))
|
|
2215
2222
|
|
|
2216
2223
|
if models.loc["gassing_direction", "option"] == "regas":
|
|
2217
2224
|
if (PT["P"] + dp_step) >= final:
|
|
@@ -2768,26 +2775,26 @@ def calc_melt_S_oxybarometer(
|
|
|
2768
2775
|
results_values_table_melt_vol = pd.DataFrame(
|
|
2769
2776
|
[
|
|
2770
2777
|
[
|
|
2771
|
-
|
|
2772
|
-
|
|
2773
|
-
|
|
2774
|
-
|
|
2778
|
+
melt_wf["H2OT"] * 100.0,
|
|
2779
|
+
melt_wf["CO2"] * 1000000.0,
|
|
2780
|
+
melt_wf["ST"] * 1000000.0,
|
|
2781
|
+
melt_wf["X"] * 1000000.0,
|
|
2775
2782
|
]
|
|
2776
2783
|
]
|
|
2777
2784
|
)
|
|
2778
2785
|
results_headers_table_sulfsat = pd.DataFrame(
|
|
2779
2786
|
[
|
|
2780
2787
|
[
|
|
2781
|
-
"P_bar_sulf",
|
|
2782
2788
|
"SCSS_ppm",
|
|
2783
2789
|
"sulfide saturated",
|
|
2790
|
+
"P_bar_sulf",
|
|
2784
2791
|
"fO2_DFMQ_sulf",
|
|
2785
2792
|
"fO2_bar_sulf",
|
|
2786
2793
|
"Fe3+/FeT_sulf",
|
|
2787
2794
|
"S6+/ST_sulf",
|
|
2788
|
-
"P_bar_anh",
|
|
2789
2795
|
"SCAS_ppm",
|
|
2790
2796
|
"anhydrite saturated",
|
|
2797
|
+
"P_bar_anh",
|
|
2791
2798
|
"fO2_DFMQ_anh",
|
|
2792
2799
|
"fO2_bar_anh",
|
|
2793
2800
|
"Fe3+/FeT_anh",
|
|
@@ -2798,16 +2805,16 @@ def calc_melt_S_oxybarometer(
|
|
|
2798
2805
|
results_values_table_sulfsat = pd.DataFrame(
|
|
2799
2806
|
[
|
|
2800
2807
|
[
|
|
2801
|
-
sulfsat_results["P_sat_sulf"],
|
|
2802
2808
|
sulfsat_results["SCSS"],
|
|
2803
2809
|
sulfsat_results["sulf_sat"],
|
|
2810
|
+
sulfsat_results["P_sat_sulf"],
|
|
2804
2811
|
sulfsat_results["DFMQ_sulf"],
|
|
2805
2812
|
sulfsat_results["fO2_sulf"],
|
|
2806
2813
|
sulfsat_results["Fe3T_sulf"],
|
|
2807
2814
|
sulfsat_results["S6T_sulf"],
|
|
2808
|
-
sulfsat_results["P_sat_anh"],
|
|
2809
2815
|
sulfsat_results["SCAS"],
|
|
2810
2816
|
sulfsat_results["anh_sat"],
|
|
2817
|
+
sulfsat_results["P_sat_anh"],
|
|
2811
2818
|
sulfsat_results["DFMQ_anh"],
|
|
2812
2819
|
sulfsat_results["fO2_anh"],
|
|
2813
2820
|
sulfsat_results["Fe3T_anh"],
|
|
@@ -2968,12 +2975,12 @@ def calc_comp_error(setup, run, iterations=100, models=mdv.default_models):
|
|
|
2968
2975
|
|
|
2969
2976
|
sd[Fe_opt] = setup.loc[run, Fe_opt + "_sd"]
|
|
2970
2977
|
if Fe_opt + "_sd_type" in setup:
|
|
2971
|
-
sd_type[Fe_opt] = setup.loc[run, Fe_opt + "
|
|
2978
|
+
sd_type[Fe_opt] = setup.loc[run, Fe_opt + "_sd_type"]
|
|
2972
2979
|
else:
|
|
2973
2980
|
sd_type[Fe_opt] = "A"
|
|
2974
2981
|
sd[fO2_opt] = setup.loc[run, fO2_opt + "_sd"]
|
|
2975
2982
|
if fO2_opt + "_sd_type" in setup:
|
|
2976
|
-
sd_type[fO2_opt] = setup.loc[run, fO2_opt + "
|
|
2983
|
+
sd_type[fO2_opt] = setup.loc[run, fO2_opt + "_sd_type"]
|
|
2977
2984
|
else:
|
|
2978
2985
|
sd_type[fO2_opt] = "A"
|
|
2979
2986
|
|
|
@@ -2998,7 +3005,7 @@ def calc_comp_error(setup, run, iterations=100, models=mdv.default_models):
|
|
|
2998
3005
|
else:
|
|
2999
3006
|
sd[x] = ""
|
|
3000
3007
|
if x + "_sd_type" in setup:
|
|
3001
|
-
sd_type[x] = setup.loc[run, Fe_opt + "
|
|
3008
|
+
sd_type[x] = setup.loc[run, Fe_opt + "_sd_type"]
|
|
3002
3009
|
else:
|
|
3003
3010
|
if x + "_sd" in setup:
|
|
3004
3011
|
sd_type[x] = "A"
|
|
@@ -3177,46 +3184,81 @@ def calc_comp_error_function(
|
|
|
3177
3184
|
return False
|
|
3178
3185
|
|
|
3179
3186
|
if last_row is None:
|
|
3180
|
-
last_row = len(setup)
|
|
3187
|
+
last_row = len(setup)
|
|
3181
3188
|
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
+
with tqdm.tqdm(total=(last_row - first_row)) as tqdmsteps:
|
|
3190
|
+
for n in range(first_row, last_row, 1):
|
|
3191
|
+
run = n
|
|
3192
|
+
comp = calc_comp_error(setup, run, iterations=iterations, models=models)
|
|
3193
|
+
if function == "calc_Pvsat":
|
|
3194
|
+
result = calc_Pvsat(
|
|
3195
|
+
comp, models=models, first_row=4, last_row=len(comp) - 1
|
|
3196
|
+
)
|
|
3189
3197
|
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
|
|
3198
|
+
elif function == "calc_melt_S_oxybarometer":
|
|
3199
|
+
result = calc_melt_S_oxybarometer(
|
|
3200
|
+
comp, first_row=4, last_row=len(comp) - 1, models=models
|
|
3201
|
+
)
|
|
3202
|
+
av_results = {}
|
|
3203
|
+
headers = result.columns.tolist()
|
|
3204
|
+
for x in headers:
|
|
3205
|
+
if x == "sample":
|
|
3206
|
+
av_results[x] = setup.loc[run, "Sample"]
|
|
3207
|
+
elif x == "Date":
|
|
3208
|
+
av_results[x] = result.loc[0, x]
|
|
3209
|
+
elif x == "sulfide saturated" or x == "anhydrite saturated":
|
|
3210
|
+
if (
|
|
3211
|
+
"False" in result[x].tolist()
|
|
3212
|
+
and "possible" in result[x].tolist()
|
|
3213
|
+
):
|
|
3204
3214
|
av_results[x] = "Both"
|
|
3205
3215
|
else:
|
|
3206
3216
|
av_results[x] = result.loc[0, x]
|
|
3207
|
-
|
|
3217
|
+
elif x in [
|
|
3218
|
+
"P_bar_sulf",
|
|
3219
|
+
"fO2_DFMQ_sulf",
|
|
3220
|
+
"fO2_bar_sulf",
|
|
3221
|
+
"Fe3+/FeT_sulf",
|
|
3222
|
+
"S6+/ST_sulf",
|
|
3223
|
+
]:
|
|
3224
|
+
if av_results["sulfide saturated"] == "False":
|
|
3225
|
+
av_results[x] = result.loc[0, x]
|
|
3226
|
+
av_results[x + "_sd"] = ""
|
|
3227
|
+
else:
|
|
3228
|
+
if av_results["sulfide saturated"] == "Both":
|
|
3229
|
+
result[x] = result[x].apply(pd.to_numeric, errors="coerce")
|
|
3230
|
+
av_results[x] = result[x].mean()
|
|
3231
|
+
av_results[x + "_sd"] = result[x].std()
|
|
3232
|
+
elif x in [
|
|
3233
|
+
"P_bar_anh",
|
|
3234
|
+
"fO2_DFMQ_anh",
|
|
3235
|
+
"fO2_bar_anh",
|
|
3236
|
+
"Fe3+/FeT_anh",
|
|
3237
|
+
"S6+/ST_anh",
|
|
3238
|
+
]:
|
|
3239
|
+
if av_results["anhydrite saturated"] == "False":
|
|
3240
|
+
av_results[x] = result.loc[0, x]
|
|
3241
|
+
av_results[x + "_sd"] = ""
|
|
3242
|
+
else:
|
|
3243
|
+
if av_results["anhydrite saturated"] == "Both":
|
|
3244
|
+
result[x] = result[x].apply(pd.to_numeric, errors="coerce")
|
|
3245
|
+
av_results[x] = result[x].mean()
|
|
3246
|
+
av_results[x + "_sd"] = result[x].std()
|
|
3247
|
+
elif is_number(result.loc[0, x]) is False:
|
|
3208
3248
|
av_results[x] = result.loc[0, x]
|
|
3249
|
+
else:
|
|
3250
|
+
result[x] = result[x].apply(pd.to_numeric, errors="coerce")
|
|
3251
|
+
av_results[x] = result[x].mean()
|
|
3252
|
+
av_results[x + "_sd"] = result[x].std()
|
|
3253
|
+
av_results["iterations"] = iterations
|
|
3254
|
+
av_results_all1 = pd.DataFrame(av_results, index=[0])
|
|
3255
|
+
if n == first_row:
|
|
3256
|
+
av_results_all = av_results_all1
|
|
3209
3257
|
else:
|
|
3210
|
-
|
|
3211
|
-
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
if n == first_row:
|
|
3215
|
-
av_results_all = av_results_all1
|
|
3216
|
-
else:
|
|
3217
|
-
av_results_all = pd.concat([av_results_all, av_results_all1])
|
|
3218
|
-
if models.loc["print status", "option"] == "True":
|
|
3219
|
-
print(iterations, setup.loc[run, "Sample"])
|
|
3258
|
+
av_results_all = pd.concat([av_results_all, av_results_all1])
|
|
3259
|
+
if models.loc["print status", "option"] == "True":
|
|
3260
|
+
print(iterations, setup.loc[run, "Sample"])
|
|
3261
|
+
tqdmsteps.update(1)
|
|
3220
3262
|
|
|
3221
3263
|
av_results_all.reset_index(drop=True, inplace=True)
|
|
3222
3264
|
if models.loc["output csv", "option"] == "True":
|
|
@@ -3559,6 +3601,11 @@ def calc_isotopes_gassing(
|
|
|
3559
3601
|
else:
|
|
3560
3602
|
results = pd.concat([results, all_values])
|
|
3561
3603
|
|
|
3604
|
+
if models.loc["gassing_style", "option"] == "open":
|
|
3605
|
+
R_i["C"] = R_m_g_C["R_m"]
|
|
3606
|
+
R_i["H"] = R_m_g_H["R_m"]
|
|
3607
|
+
R_i["S"] = R_m_g_S["R_m"]
|
|
3608
|
+
|
|
3562
3609
|
results.columns = results.iloc[0]
|
|
3563
3610
|
results = results[1:]
|
|
3564
3611
|
results.reset_index(drop=True, inplace=True)
|
|
@@ -99,7 +99,7 @@ def P_sat(PT, melt_wf, models, Ptol, nr_step, nr_tol):
|
|
|
99
99
|
difference = abs(guess - mg.p_tot(PT, melt_wf, models))
|
|
100
100
|
return difference
|
|
101
101
|
|
|
102
|
-
guess0 =
|
|
102
|
+
guess0 = 1.0 # initial guess for pressure
|
|
103
103
|
PT["P"] = guess0
|
|
104
104
|
melt_wf1["Fe3FeT"] = mg.Fe3FeT_i(PT, melt_wf1, models)
|
|
105
105
|
melt_wf2["Fe3FeT"] = mg.Fe3FeT_i(PT, melt_wf2, models)
|
|
@@ -193,13 +193,15 @@ def P_sat_H2O_CO2(
|
|
|
193
193
|
}
|
|
194
194
|
|
|
195
195
|
else:
|
|
196
|
-
guess0 =
|
|
196
|
+
guess0 = 1.0 # initial guess for pressure
|
|
197
197
|
PT["P"] = guess0
|
|
198
198
|
delta1 = Pdiff(guess0, melt_wf, models)
|
|
199
199
|
while delta1 > Ptol:
|
|
200
200
|
delta1 = Pdiff(guess0, melt_wf, models)
|
|
201
201
|
guess0 = p_tot_H2O_CO2(PT, melt_wf, models)
|
|
202
202
|
guess0 = float(guess0)
|
|
203
|
+
# if guess0 > 1.0e7:
|
|
204
|
+
# guess0 = 1.0
|
|
203
205
|
PT["P"] = guess0
|
|
204
206
|
else:
|
|
205
207
|
P_sat = guess0
|
|
@@ -908,96 +910,74 @@ def P_sat_sulf_anh(PT, melt_wf, models, Ptol, nr_step, nr_tol):
|
|
|
908
910
|
S62 = S6p / S2m
|
|
909
911
|
S6T = S6p / ST
|
|
910
912
|
if S62 < 0.0:
|
|
911
|
-
|
|
913
|
+
is_sat = "False"
|
|
914
|
+
fO2 = ""
|
|
915
|
+
Fe3T = ""
|
|
916
|
+
DFMQ = ""
|
|
917
|
+
S6T = ""
|
|
912
918
|
else:
|
|
919
|
+
is_sat = "possible"
|
|
913
920
|
fO2 = mg.S6S2_2_fO2(S62, melt_wf, PT, models)
|
|
914
921
|
Fe3T = mdv.fO22Fe3FeT(fO2, PT, melt_wf, models)
|
|
915
922
|
DFMQ = mg.fO22Dbuffer(PT, fO2, "FMQ", models)
|
|
916
|
-
|
|
923
|
+
return is_sat, Fe3T, fO2, S6T, DFMQ, Ssat
|
|
917
924
|
|
|
918
|
-
|
|
919
|
-
|
|
925
|
+
for phase in ["sulf", "anh"]:
|
|
926
|
+
guess0 = 1.0 # initial guess for pressure
|
|
927
|
+
PT["P"] = guess0
|
|
928
|
+
melt_wf["Fe3FeT"] = 0.1
|
|
920
929
|
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
PT, melt_wf, models, "sulf"
|
|
925
|
-
)
|
|
926
|
-
if Fe3T_sulf == "not possible":
|
|
927
|
-
P_sat_sulf = ""
|
|
928
|
-
Fe3T_sulf = ""
|
|
929
|
-
sulfide_sat = "False"
|
|
930
|
-
else:
|
|
931
|
-
melt_wf["Fe3FeT"] = Fe3T_sulf
|
|
932
|
-
ms_conc = eq.melt_speciation(PT, melt_wf, models, nr_step, nr_tol)
|
|
933
|
-
melt_wf["H2OT"] = ms_conc["wm_H2O"]
|
|
934
|
-
melt_wf["CO2"] = ms_conc["wm_CO2"]
|
|
935
|
-
melt_wf["S2-"] = ms_conc["wm_S2m"]
|
|
936
|
-
melt_wf["ST"] = ST
|
|
937
|
-
delta1 = Pdiff(guess0, melt_wf, models)
|
|
938
|
-
while delta1 > Ptol:
|
|
939
|
-
delta1 = Pdiff(guess0, melt_wf, models)
|
|
940
|
-
guess0 = mg.p_tot(PT, melt_wf, models)
|
|
941
|
-
guess0 = float(guess0)
|
|
942
|
-
PT["P"] = guess0
|
|
943
|
-
Fe3T_sulf, fO2_sulf, S6T_sulf, DFMQ_sulf, SCSS_ = S62_2_Fe3T(
|
|
944
|
-
PT, melt_wf, models, "sulf"
|
|
945
|
-
)
|
|
946
|
-
if Fe3T_sulf == "not possible":
|
|
947
|
-
P_sat_sulf = ""
|
|
948
|
-
Fe3T_sulf = ""
|
|
949
|
-
sulfide_sat = "False"
|
|
950
|
-
else:
|
|
951
|
-
melt_wf["Fe3FeT"] = Fe3T_sulf
|
|
952
|
-
ms_conc = eq.melt_speciation(PT, melt_wf, models, nr_step, nr_tol)
|
|
953
|
-
melt_wf["H2OT"] = ms_conc["wm_H2O"]
|
|
954
|
-
melt_wf["CO2"] = ms_conc["wm_CO2"]
|
|
955
|
-
melt_wf["S2-"] = ms_conc["wm_S2m"]
|
|
930
|
+
is_sat, Fe3T, fO2, S6T, DFMQ, Ssat = S62_2_Fe3T(PT, melt_wf, models, phase)
|
|
931
|
+
if is_sat == "False":
|
|
932
|
+
P_sat = ""
|
|
956
933
|
else:
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
# assume it is anhydrite saturated
|
|
964
|
-
Fe3T_anh, fO2_anh, S6T_anh, DFMQ_anh, SCAS_ = S62_2_Fe3T(PT, melt_wf, models, "anh")
|
|
965
|
-
if Fe3T_anh == "not possible":
|
|
966
|
-
P_sat_anh = ""
|
|
967
|
-
Fe3T_anh = ""
|
|
968
|
-
anhydrite_sat = "False"
|
|
969
|
-
else:
|
|
970
|
-
melt_wf["Fe3FeT"] = Fe3T_anh
|
|
971
|
-
ms_conc = eq.melt_speciation(PT, melt_wf, models, nr_step, nr_tol)
|
|
972
|
-
melt_wf["H2OT"] = ms_conc["wm_H2O"]
|
|
973
|
-
melt_wf["CO2"] = ms_conc["wm_CO2"]
|
|
974
|
-
melt_wf["S2-"] = ms_conc["wm_S2m"]
|
|
975
|
-
melt_wf["ST"] = ST
|
|
976
|
-
delta1 = Pdiff(guess0, melt_wf, models)
|
|
977
|
-
while delta1 > Ptol:
|
|
934
|
+
melt_wf["Fe3FeT"] = Fe3T
|
|
935
|
+
ms_conc = eq.melt_speciation(PT, melt_wf, models, nr_step, nr_tol)
|
|
936
|
+
melt_wf["H2OT"] = ms_conc["wm_H2O"]
|
|
937
|
+
melt_wf["CO2"] = ms_conc["wm_CO2"]
|
|
938
|
+
melt_wf["S2-"] = ms_conc["wm_S2m"]
|
|
939
|
+
melt_wf["ST"] = ST
|
|
978
940
|
delta1 = Pdiff(guess0, melt_wf, models)
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
PT
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
941
|
+
while delta1 > Ptol:
|
|
942
|
+
delta1 = Pdiff(guess0, melt_wf, models)
|
|
943
|
+
guess0 = mg.p_tot(PT, melt_wf, models)
|
|
944
|
+
guess0 = float(guess0)
|
|
945
|
+
PT["P"] = guess0
|
|
946
|
+
is_sat, Fe3T, fO2, S6T, DFMQ, Ssat = S62_2_Fe3T(
|
|
947
|
+
PT, melt_wf, models, phase
|
|
948
|
+
)
|
|
949
|
+
if is_sat == "False":
|
|
950
|
+
P_sat = ""
|
|
951
|
+
else:
|
|
952
|
+
melt_wf["Fe3FeT"] = Fe3T
|
|
953
|
+
ms_conc = eq.melt_speciation(PT, melt_wf, models, nr_step, nr_tol)
|
|
954
|
+
melt_wf["H2OT"] = ms_conc["wm_H2O"]
|
|
955
|
+
melt_wf["CO2"] = ms_conc["wm_CO2"]
|
|
956
|
+
melt_wf["S2-"] = ms_conc["wm_S2m"]
|
|
989
957
|
else:
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
958
|
+
if is_sat == "False":
|
|
959
|
+
P_sat = ""
|
|
960
|
+
else:
|
|
961
|
+
P_sat = guess0
|
|
962
|
+
is_sat, Fe3T, fO2, S6T, DFMQ, Ssat = S62_2_Fe3T(
|
|
963
|
+
PT, melt_wf, models, phase
|
|
964
|
+
)
|
|
965
|
+
if phase == "sulf":
|
|
966
|
+
P_sat_sulf = P_sat
|
|
967
|
+
SCSS_ = Ssat
|
|
968
|
+
sulfide_sat = is_sat
|
|
969
|
+
DFMQ_sulf = DFMQ
|
|
970
|
+
Fe3T_sulf = Fe3T
|
|
971
|
+
fO2_sulf = fO2
|
|
972
|
+
S6T_sulf = S6T
|
|
973
|
+
elif phase == "anh":
|
|
974
|
+
P_sat_anh = P_sat
|
|
975
|
+
SCAS_ = Ssat
|
|
976
|
+
anhydrite_sat = is_sat
|
|
977
|
+
DFMQ_anh = DFMQ
|
|
978
|
+
Fe3T_anh = Fe3T
|
|
979
|
+
fO2_anh = fO2
|
|
980
|
+
S6T_anh = S6T
|
|
1001
981
|
|
|
1002
982
|
result = {
|
|
1003
983
|
"P_sat_sulf": P_sat_sulf,
|
|
@@ -1563,9 +1543,7 @@ def conc_insolubles(PT, melt_wf, models):
|
|
|
1563
1543
|
S2m = melt_wf["S2-"] # weight fraction of S2-
|
|
1564
1544
|
S6p = (
|
|
1565
1545
|
mg.C_SO4(PT, melt_wf, models) * mdv.f_O2(PT, melt_wf, models) ** 2 * S2m
|
|
1566
|
-
) / mg.C_S(
|
|
1567
|
-
PT, melt_wf, models
|
|
1568
|
-
) # weight fraction S6+
|
|
1546
|
+
) / mg.C_S(PT, melt_wf, models) # weight fraction S6+
|
|
1569
1547
|
H2S = (
|
|
1570
1548
|
mg.C_H2S(PT, melt_wf, models) * mg.f_H2S(PT, melt_wf, models)
|
|
1571
1549
|
) / 1000000.0 # weight fraction H2S
|
|
@@ -1658,9 +1636,27 @@ def compositions_within_error(run, setup):
|
|
|
1658
1636
|
if x + "_sd_type" in setup:
|
|
1659
1637
|
if setup.loc[run, x + "_sd_type"] == "R": # relative
|
|
1660
1638
|
sd = setup.loc[run, x + "_sd"] * setup.loc[run, x]
|
|
1661
|
-
|
|
1639
|
+
else:
|
|
1640
|
+
sd = setup.loc[run, x + "_sd"]
|
|
1641
|
+
elif x + "_sd" in setup:
|
|
1662
1642
|
sd = setup.loc[run, x + "_sd"]
|
|
1643
|
+
else:
|
|
1644
|
+
sd = 0.0
|
|
1663
1645
|
value = float(np.random.normal(setup.loc[run, x], sd, 1))
|
|
1646
|
+
|
|
1647
|
+
if x in ["Fe3FeT", "S6ST"]:
|
|
1648
|
+
if value < 0.001:
|
|
1649
|
+
value = 0.001
|
|
1650
|
+
if value > 0.999:
|
|
1651
|
+
value = 0.999
|
|
1652
|
+
if (x != "DFMQ") is True and (x != "DNNO") is True:
|
|
1653
|
+
if value < 0.0:
|
|
1654
|
+
value = 0.0
|
|
1655
|
+
if x == "STppm":
|
|
1656
|
+
if value == 0.0:
|
|
1657
|
+
if "S6ST" in setup:
|
|
1658
|
+
value = 1.0
|
|
1659
|
+
|
|
1664
1660
|
result[x] = value
|
|
1665
1661
|
else:
|
|
1666
1662
|
result[x] = 0.0
|