This page was generated from docs/Examples/Saturation_Pressure/SatP_example.ipynb. Interactive online version: Binder badge.

Python Notebook Download

Calculating saturation pressure of melt inclusion records

  • With the release of the MagmaSat model (Ghiorso and Gualda, 2015; 10.1007/s00410-015-1141-8), incorporating mixed H2O-CO2 fluids into the rhyolite-MELTS framework, calculating melt inclusion saturation pressures through rhyolite-MELTS (v1.2.0) thermodynamic models has become possible.

PetThermoTools uses the rhyolite-MELTS v1.2.0 model to calculate melt inclusion saturation pressures (or the saturation pressure of any melt phase with known H2O and CO2 contents) in 2 separate ways:

  1. Specified temperature: user provides a known temperature (usually calculated through an empirical thermometer) and ptt calculates the pressure of fluid saturation at that give temperature (all solid phases are disabled for these calculations)

  2. Initial temperature guess: if no known temperature is provided the code instead requires an initial ‘guess’ (keyword arguement T_init_C instead of T_fixed_C). The code then co-solves for the liquidus temperature and the pressure of saturation, using rhyolite-MELTS v1.2.0 as both a thermometer and barometer.

Before any calculations can be run users need to download the alphaMELTS for Python files. Please see the installation guide on ReadTheDocs.

[1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import petthermotools as ptt
alphaMELTS for Python files successfully located.
If you are planning on using the Green et al. (2025) or Weller et al. (2024) thermodynamic models through MAGEMin for crystallization, melting, or phase diagram calculations
you will need to run `ptt.activate_petthermotools_env()` at the start of each notebook, prior to any calculations, every time you restart the kernel.
This step establishes the python-julia connection and sets up the julia workers. Expect it to take about 20-40s on most machines.

Load data - Wieser et al. 2021

For this example we’ll look at olivine-hosted melt inclusions from Hawai’i. Specifically the data of Wieser et al. (2021; https://doi.org/10.1029/2020GC009364). The data provided in the spreadsheet available on GitHub associated with this example represents olivine hosted melt inclusion major and volatile element data that has been corrected for the influence of post-entrapment crystallization. Let’s load the data and have a look at what information is available to us!

[2]:
Haw = pd.read_excel('Wieser2021_olivines.xlsx')
Haw.head()
[2]:
Label SiO2 TiO2 Al2O3 FeO Fe2O3 MnO MgO CaO Na2O K2O P2O5 H2O CO2 Temp SaturationP_bars_VESIcal XH2O_fl_VESIcal
0 LLD_LL1_80 51.423 3.229 13.392 9.68660 1.899333 0.149 6.191 9.859 2.636 0.675 0.337 0.533371 0.025772 1138.4391 420 0.132780
1 LLD_LL1_103 51.375 3.343 13.202 10.09460 1.979333 0.134 6.001 9.729 2.602 0.635 0.364 0.546140 0.021389 1134.6201 360 0.160732
2 LLE_LL4_19b 50.793 2.550 13.523 9.63645 1.889500 0.179 7.432 10.594 2.303 0.429 0.378 0.500000 0.040292 1163.3832 640 0.082606
3 LLE_LL4_19c 51.117 2.512 13.435 9.71890 1.905666 0.239 7.526 10.170 2.435 0.382 0.276 0.500000 0.022817 1165.2726 370 0.132469
4 LLE_LL4_33b 51.649 2.758 13.747 9.63730 1.889666 0.282 6.020 10.397 2.435 0.496 0.347 0.500000 0.024655 1135.0020 420 0.115698

You can see the major element composition of these samples (PEC corrected) which includes an estimate for the ferric to ferrous iron ratio of each inclusion. There is also an estimated temperature (see Wieser et al. 2021 for how this is determied), and the saturation pressure and fluid chemistry predicted by the MagmaSat model as applied through VESIcal (Iacovino et al. 2021; https://doi.org/10.1029/2020EA001584).

Method 1 - fixed temperature

First, let’s ‘recreate’ the VESIcal calculations. We can use the function ptt.saturation_pressure with the argument T_fixed_C set to the temperatures provided in the spreadsheet above to calculate the pressure of fluid saturation for each inclusion at the specified temperature with all solid phases disabled (this is very similar to the method applied in VESIcal).

The code requires an initial pressure guess (this can be either a single value or an array the same length as the number of samples), and the Model is set to rhyolite-MELTS v1.2.0 by default. The code will attempt all calculations, starting at the initial pressure guess and then iterate into the point where fluid first appears in the system. If the code hits an error for any particular sample it will retry it with a different initial pressure guess (initially higher, and then lower if that also doesn’t work) to try and get the code to converge on a solution.

[3]:
fixed_T = ptt.saturation_pressure(
    Model = "MELTSv1.2.0",
    bulk = Haw, T_fixed_C = Haw['Temp'],
    P_init_bar = 1000)
saturation_pressure_v2: 149/149 converged, 0 did not (any failure is retried up to 1 time(s), at 2.0x timeout and a perturbed starting guess each round).

Looking at the results we can see the composition of each inclusion (renormalized to a hydrous total of 100 wt%), alongside the pressure, temperature, and fluid composition predicted.

[4]:
fixed_T.head()
[4]:
SiO2_Liq TiO2_Liq Al2O3_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_C X_H2O X_CO2
0 51.404619 3.227846 13.387213 11.391547 0.148947 6.188787 9.855476 2.635058 0.674759 0.336880 0.533161 0.025449 0.149972 421.875 1138.4391 0.132177 0.867823
1 51.361443 3.342118 13.198516 11.872470 0.133965 5.999416 9.726433 2.601313 0.634832 0.363904 0.545990 0.021307 0.149972 359.375 1134.6201 0.160905 0.839095
2 50.667867 2.543718 13.489685 11.308693 0.178559 7.413691 10.567901 2.297326 0.427943 0.377069 0.498758 0.039916 0.149972 640.625 1163.3832 0.082165 0.917835
3 50.994997 2.506004 13.402934 11.406330 0.238430 7.508037 10.145727 2.429188 0.381088 0.275341 0.498798 0.022620 0.149972 375.000 1165.2726 0.130331 0.869669
4 51.554905 2.752975 13.721955 11.316967 0.281486 6.009033 10.378059 2.430564 0.495096 0.346368 0.499083 0.024496 0.149972 421.875 1135.0020 0.114864 0.885136

Comparing these results to the published VESIcal estimates we see, unsurprisingly, a very strong agreement!

[5]:
f, a = plt.subplots(1,1)
a.plot(fixed_T['P_bar'], Haw['SaturationP_bars_VESIcal'], 'ok')
a.set_xlabel('Pressure (bar) ptt')
a.set_ylabel('Pressure (bar) VESIcal')
[5]:
Text(0, 0.5, 'Pressure (bar) VESIcal')
../../_images/Examples_Saturation_Pressure_SatP_example_10_1.png

We also see a reasonable match in the predicted fluid composition with some scatter at higher H2O mole fractions, the origin of this scatter we are still investigating!

[6]:
f, a = plt.subplots(1,1)
a.plot(fixed_T['X_H2O'], Haw['XH2O_fl_VESIcal'], 'ok')
a.set_xlabel('X$_{H2O}$ ptt')
a.set_ylabel('X$_{H2O}$ VESIcal')
[6]:
Text(0, 0.5, 'X$_{H2O}$ VESIcal')
../../_images/Examples_Saturation_Pressure_SatP_example_12_1.png

Method 2 - unknown temperature

Let’s imagine you’re working in an area that isn’t as well studied as Hawai’i and, perhaps, you don’t have an easy to use or reliable empirical thermometer to calculate the tempetature of melt inclusion entrapment. petthermotools provides an option for this scenario to use the rhyolite-MELTS v1.2.0 model as the thermometer as well as the barometer, meaning no prior knowledge of the system temperature is required. All that we need to change from the function above is we need to remove the key-word argument T_fixed_C and replace it with T_init_C:

[7]:
Unknown_T = ptt.saturation_pressure(Model = "MELTSv1.2.0", bulk = Haw, T_init_C = 1100,
                          P_init_bar = 500)
saturation_pressure_v2: 149/149 converged, 0 did not (any failure is retried up to 1 time(s), at 2.0x timeout and a perturbed starting guess each round).

This calculation probably took a bit longer! That’s to be expected, we’re having to iterate across 2 parameters not just 1. Looking at the results, however, we see that for these Hawaiian samples there is little-to-no difference in the estimated saturation pressures regardless of which method we use!

[8]:
f, a = plt.subplots(1,1)
a.plot(Unknown_T['P_bar'], fixed_T['P_bar'], 'ok')
a.set_xlabel('Pressure (bar) solving for T')
a.set_ylabel('Pressure (bar) fixed T')
[8]:
Text(0, 0.5, 'Pressure (bar) fixed T')
../../_images/Examples_Saturation_Pressure_SatP_example_16_1.png

What about temperature? Well, as indicated in the liquidus calculation example, rhyolite-MELTS isn’t the most accurate thermometer available. Comparing the two temperature estimates (empirical calc from Wieser et al. and the rhyolite-MELTS liquidus temperature) we can see that there is an offset between the two calculations especially at temperatures above 1200 \(^o\)C.

[9]:
f, a = plt.subplots(1,1)
a.plot(Unknown_T['T_Liq_C'], fixed_T['T_Liq_C'], 'ok')
a.plot([1100,1350],[1100,1350], '-r')
a.set_xlabel('Pressure ($^o$C) solving for T')
a.set_ylabel('Temperature ($^o$C) fixed T (empirical calc)')
[9]:
Text(0, 0.5, 'Temperature ($^o$C) fixed T (empirical calc)')
../../_images/Examples_Saturation_Pressure_SatP_example_18_1.png
[ ]: