This page was generated from
docs/Examples/1a. pvsat 1MI_df.ipynb.
Interactive online version:
.
1a. Calculate Pvsat for a single melt composition from a dataframe using default options
Python set-up
You need to install VolFe once on your machine, if you haven’t yet. Then we need to import a few Python packages (including VolFe).
[1]:
# Install VolFe on your machine.
# pip install VolFe # Remove the first # in this line if you have not installed VolFe on your machine before.
# import python packages
import pandas as pd
import VolFe as vf
Define the inputs
At a minimum to run a Pvsat calculations, we need a dataframe of the melt composition, an estimate of oxygen fugacity and Fe in the melt [note 1], and temperature:
Sample is just the name for this analysis.
Temperature is in °C.
Volatile-free melt composition is in wt% oxides [note 2]. All these oxides must be present in the dataframe, so set them to 0. if you have no data for them (although see [note 1] around FeOT).
H2O is all hydrogen in the melt reported as H2O in wt% [note 3].
CO2ppm is all carbon in the melt reported as CO2 in ppm [note 3].
STppm is all sulfur in the melt reported as S in ppm [note 3].
Xppm is all “X” in the melt reported as “X” in ppm [note 3]. “X” is an unreactive melt species whose identity can be changed - this is explored in Example 1d.
Fe3+FeT is the ratio of Fe3+ to FeT in the melt.
[note 1] In this example we specify oxygen fugacity using Fe3+/FeT and Fe in the melt as FeOT as is quite common for melt inclusion and matrix glass analyses - other options are possible, shown later in the notebook.
[note 2] It does not matter what the non-volatile oxides sum too - they are renormalised to 100 wt% minus the total of the volatiles (i.e., H2O + CO2 + ST + X).
[note 3] The volatile concentrations are absolute for the melt = i.e., the non-volatile melt composition is normalised to 100 wt% minus the volatiles. The volatiles are not added to the oxides and then renormalised.
The following composition is analysis TN273-01D-01-01 from Brounce et al. (2014) with the updated Fe3+/FeT from Cottrell et al. (2021), with a temperature chosen as 1200 °C.
[2]:
# Define the melt composition, fO2 estimate, and T as a dictionary.
my_analysis = {'Sample':'TN273-01D-01-01',
'T_C': 1200., # Temperature in 'C
'SiO2': 56.98, # wt%
'TiO2': 1.66, # wt%
'Al2O3': 15.52, # wt%
'FeOT': 9.47, # wt%
'MnO': 0.24, # wt%
'MgO': 2.96, # wt%
'CaO': 6.49, # wt%
'Na2O': 4.06, # wt%
'K2O': 0.38, # wt%
'P2O5': 0.22, # wt%
'H2O': 1.88, # wt%
'CO2ppm': 13., # ppm
'STppm': 362.83, # ppm
'Fe3FeT': 0.155} # mole or weight fraction (they're the same)
# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])
# Show the DataFrame.
print(my_analysis)
Sample T_C SiO2 TiO2 Al2O3 FeOT MnO MgO CaO Na2O \
0 TN273-01D-01-01 1200.0 56.98 1.66 15.52 9.47 0.24 2.96 6.49 4.06
K2O P2O5 H2O CO2ppm STppm Fe3FeT
0 0.38 0.22 1.88 13.0 362.83 0.155
For this example we will use the default options in VolFe, which can be found below:
[3]:
# print default options in VolFe
print(vf.default_models)
option
type
COH_species yes_H2_CO_CH4_melt
H2S_m True
species X Ar
Hspeciation none
fO2 Kress91A
... ...
error 0.1
print status False
output csv True
setup False
high precision False
[78 rows x 1 columns]
Run the calculation
Define fO2 using Fe3+/FeT
And below runs the calculation - it outputs a dataframe of the full results.
[4]:
# runs the calculation
vf.calc_Pvsat(my_analysis)
[4]:
| sample | T_C | P_bar | SiO2_wtpc | TiO2_wtpc | Al2O3_wtpc | FeOT_wtpc | MnO_wtpc | MgO_wtpc | CaO_wtpc | ... | KHOSg opt | KOSg opt | KOSg2 opt | KCOg opt | KCOHg opt | KOCSg opt | KCOs opt | carbonylsulfide opt | density opt | Date | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | TN273-01D-01-01 | 1200.0 | 328.128601 | 57.03956 | 1.661735 | 15.536223 | 9.479899 | 0.240251 | 2.963094 | 6.496784 | ... | Ohmoto97 | Ohmoto97 | ONeill22 | Ohmoto97 | Ohmoto97 | Moussallam19 | Holloway92 | COS | DensityX | 2025-03-07 16:37:48.271042 |
1 rows × 173 columns
Define fO2 using ΔFMQ
Alternatively, we can define the oxygen fugacity using ΔFMQ and total iron from Fe2O3,T …
[ ]:
# Define the melt composition, fO2 estimate, and T as a dictionary.
my_analysis = {'Sample':'TN273-01D-01-01',
'T_C': 1200.,
'SiO2': 56.98,
'TiO2': 1.66,
'Al2O3': 15.52,
'Fe2O3T': 9.47, # <-- Fe2O3T instead of FeOT
'MnO': 0.24,
'MgO': 2.96,
'CaO': 6.49,
'Na2O': 4.06,
'K2O': 0.38,
'P2O5': 0.22,
'H2O': 1.88,
'CO2ppm': 13.,
'STppm': 362.83,
'DFMQ': 0.} # <-- DFMQ instead of Fe3+/FeT
# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])
# runs the calculation
vf.calc_Pvsat(my_analysis)
| sample | T_C | P_bar | SiO2_wtpc | TiO2_wtpc | Al2O3_wtpc | FeOT_wtpc | MnO_wtpc | MgO_wtpc | CaO_wtpc | ... | KHOSg opt | KOSg opt | KOSg2 opt | KCOg opt | KCOHg opt | KOCSg opt | KCOs opt | carbonylsulfide opt | density opt | Date | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | TN273-01D-01-01 | 1200.0 | 322.471098 | 57.597308 | 1.677984 | 15.68814 | 8.61352 | 0.2426 | 2.992068 | 6.560311 | ... | Ohmoto97 | Ohmoto97 | ONeill22 | Ohmoto97 | Ohmoto97 | Moussallam19 | Holloway92 | COS | DensityX | 2025-02-18 13:16:18.593337 |
1 rows × 173 columns
Define fO2 using FeO and Fe2O3
… or FeO and Fe2O3 …
[ ]:
# Define the melt composition, fO2 estimate, and T as a dictionary.
my_analysis = {'Sample':'TN273-01D-01-01',
'T_C': 1200.,
'SiO2': 56.98,
'TiO2': 1.66,
'Al2O3': 15.52,
'FeO': 8.03, # <-- FeO and Fe2O3 to contraint total Fe and fO2
'Fe2O3': 2.57, # <-- ^
'MnO': 0.24,
'MgO': 2.96,
'CaO': 6.49,
'Na2O': 4.06,
'K2O': 0.38,
'P2O5': 0.22,
'H2O': 1.88,
'CO2ppm': 13.,
'STppm': 362.83}
# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])
# runs the calculation
vf.calc_Pvsat(my_analysis)
| sample | T_C | P_bar | SiO2_wtpc | TiO2_wtpc | Al2O3_wtpc | FeOT_wtpc | MnO_wtpc | MgO_wtpc | CaO_wtpc | ... | KHOSg opt | KOSg opt | KOSg2 opt | KCOg opt | KCOHg opt | KOCSg opt | KCOs opt | carbonylsulfide opt | density opt | Date | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | TN273-01D-01-01 | 1200.0 | 401.474722 | 52.288592 | 1.523325 | 14.242172 | 16.859825 | 0.22024 | 2.716291 | 5.95565 | ... | Ohmoto97 | Ohmoto97 | ONeill22 | Ohmoto97 | Ohmoto97 | Moussallam19 | Holloway92 | COS | DensityX | 2025-02-18 13:16:19.183230 |
1 rows × 173 columns
Define fO2 using ΔNNO
… ΔNNO and FeOT …
[ ]:
# Define the melt composition, fO2 estimate, and T as a dictionary.
my_analysis = {'Sample':'TN273-01D-01-01',
'T_C': 1200.,
'SiO2': 56.98,
'TiO2': 1.66,
'Al2O3': 15.52,
'FeOT': 9.47, # <--
'MnO': 0.24,
'MgO': 2.96,
'CaO': 6.49,
'Na2O': 4.06,
'K2O': 0.38,
'P2O5': 0.22,
'H2O': 1.88,
'CO2ppm': 13.,
'STppm': 362.83,
'DNNO': 1.} # <--
# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])
# runs the calculation
vf.calc_Pvsat(my_analysis)
| sample | T_C | P_bar | SiO2_wtpc | TiO2_wtpc | Al2O3_wtpc | FeOT_wtpc | MnO_wtpc | MgO_wtpc | CaO_wtpc | ... | KHOSg opt | KOSg opt | KOSg2 opt | KCOg opt | KCOHg opt | KOCSg opt | KCOs opt | carbonylsulfide opt | density opt | Date | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | TN273-01D-01-01 | 1200.0 | 437.868827 | 57.03956 | 1.661735 | 15.536223 | 9.479899 | 0.240251 | 2.963094 | 6.496784 | ... | Ohmoto97 | Ohmoto97 | ONeill22 | Ohmoto97 | Ohmoto97 | Moussallam19 | Holloway92 | COS | DensityX | 2025-02-18 13:16:19.868705 |
1 rows × 173 columns
Define fO2 using S6+/ST
… or S6+/ST and FeOT …
[ ]:
# Define the melt composition, fO2 estimate, and T as a dictionary.
my_analysis = {'Sample':'TN273-01D-01-01',
'T_C': 1200.,
'SiO2': 56.98,
'TiO2': 1.66,
'Al2O3': 15.52,
'FeOT': 9.47, # <--
'MnO': 0.24,
'MgO': 2.96,
'CaO': 6.49,
'Na2O': 4.06,
'K2O': 0.38,
'P2O5': 0.22,
'H2O': 1.88,
'CO2ppm': 13.,
'STppm': 362.83,
'S6ST': 0.23} # <--
# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])
# runs the calculation
vf.calc_Pvsat(my_analysis)
| sample | T_C | P_bar | SiO2_wtpc | TiO2_wtpc | Al2O3_wtpc | FeOT_wtpc | MnO_wtpc | MgO_wtpc | CaO_wtpc | ... | KHOSg opt | KOSg opt | KOSg2 opt | KCOg opt | KCOHg opt | KOCSg opt | KCOs opt | carbonylsulfide opt | density opt | Date | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | TN273-01D-01-01 | 1200.0 | 390.067172 | 57.03956 | 1.661735 | 15.536223 | 9.479899 | 0.240251 | 2.963094 | 6.496784 | ... | Ohmoto97 | Ohmoto97 | ONeill22 | Ohmoto97 | Ohmoto97 | Moussallam19 | Holloway92 | COS | DensityX | 2025-02-18 13:16:21.882443 |
1 rows × 173 columns
Potential error: defining fO2 in too many ways
If we try to specify too many variables to constrain total Fe and fO2, we’ll get a warning from VolFe telling you it is only using one of the options to calculate things.
[ ]:
# Define the melt composition, fO2 estimate, and T as a dictionary.
my_analysis = {'Sample':'TN273-01D-01-01',
'T_C': 1200.,
'SiO2': 56.98,
'TiO2': 1.66,
'Al2O3': 15.52,
'FeOT': 9.47, # <--
'MnO': 0.24,
'MgO': 2.96,
'CaO': 6.49,
'Na2O': 4.06,
'K2O': 0.38,
'P2O5': 0.22,
'H2O': 1.88,
'CO2ppm': 13.,
'STppm': 362.83,
'DNNO': 1., # <--
'Fe3FeT':0.155} # <--
# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])
# runs the calculation
vf.calc_Pvsat(my_analysis)
C:\Users\ehughes\projects\VolFe\src\VolFe\melt_gas.py:1782: UserWarning: you entered more than one way to infer iron speciation, note that this calcualtion is only considering the entered Fe3+/FeT
w.warn('you entered more than one way to infer iron speciation, note that this calcualtion is only considering the entered Fe3+/FeT')
| sample | T_C | P_bar | SiO2_wtpc | TiO2_wtpc | Al2O3_wtpc | FeOT_wtpc | MnO_wtpc | MgO_wtpc | CaO_wtpc | ... | KHOSg opt | KOSg opt | KOSg2 opt | KCOg opt | KCOHg opt | KOCSg opt | KCOs opt | carbonylsulfide opt | density opt | Date | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | TN273-01D-01-01 | 1200.0 | 327.89713 | 57.03956 | 1.661735 | 15.536223 | 9.479899 | 0.240251 | 2.963094 | 6.496784 | ... | Ohmoto97 | Ohmoto97 | ONeill22 | Ohmoto97 | Ohmoto97 | Moussallam19 | Holloway92 | COS | DensityX | 2025-02-18 13:16:22.574874 |
1 rows × 173 columns