This page was generated from docs/Examples/4b. sol_const.ipynb. Interactive online version: Binder badge.

Python Notebook Download

4b. Calculate solubility constants

This allows you to calculate the solubility constants for all volatile-bearing melt species in the CHOSX system at a given P, T, and melt composition.

It can be run for multiple sets of conditions defined in the input data frame or loaded from a csv file.

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).

[2]:
# Install VolFe on your machine. Don't remove the # from this line!
# 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 matplotlib.pyplot as plt
import VolFe as vf

Define the inputs

This example is for a single set of conditions defined in a dataframe.

This composition is from Brounce et al. (2014) with the updated Fe3+/FeT from Cottrell et al. (2021).

[3]:
# Define the melt composition, fO2 estimate, and T as a dictionary.
my_analysis = {'Sample':'Sari15-04-33',
           'T_C': 1200., # Temperature in 'C
           'P_bar': 1000., # Pressure in bar
           'SiO2': 47.89, # wt%
           'TiO2': 0.75, # wt%
           'Al2O3': 16.74, # wt%
           'FeOT': 9.43, # wt%
           'MnO': 0.18, # wt%
           'MgO': 5.92, # wt%
           'CaO': 11.58, # wt%
           'Na2O': 2.14, # wt%
           'K2O': 0.63, # wt%
           'P2O5': 0.17, # wt%
           'H2O': 4.17, # wt%
           'CO2ppm': 1487., # ppm
           'STppm': 1343.5, # ppm
           'Xppm': 0., # ppm
           'Fe3FeT': 0.177}

# Turn the dictionary into a pandas dataframe, setting the index to 0.
my_analysis = pd.DataFrame(my_analysis, index=[0])

We’ll use the default options

[4]:
# 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

And this runs the calculation

[5]:
vf.calc_sol_consts(my_analysis)
[5]:
Sample Pressure (bar) T ('C) SiO2 TiO2 Al2O3 FeOT MnO MgO CaO ... hydrogen opt sulfide opt sulfate opt hydrogen sulfide opt methane opt carbon monoxide opt species X solubility opt Cspeccomp opt Hspeccomp opt Date
0 Sari15-04-33 1000.0 1200.0 47.948689 0.750919 16.760515 9.441557 0.180221 5.927255 11.594191 ... Basalt_Hughes24 ONeill21dil ONeill22dil Basalt_Hughes24 Basalt_Ardia13 Basalt_Hughes24 Ar_Basalt_HughesIP Basalt MORB_HughesIP 2025-02-02 10:19:37.073547

1 rows × 45 columns