This page was generated from
docs/Examples/BarometryTests/MELTS_geobarometry_example3.ipynb.
Interactive online version:
.
MELTS geobarometry part 3 - multi-phase saturation in mafic magmas
[1]:
import numpy as np
import sys
import matplotlib.pyplot as plt
import petthermotools as ptt
ptt.__version__
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.
[1]:
'1.3.4'
[2]:
ptt.activate_petthermotools_env()
Initializing MAGEMin environment and workers...
Julia environment detected.
Detected IPython. Loading juliacall extension. See https://juliapy.github.io/PythonCall.jl/stable/compat/#IPython
Activating project at `~/.petthermotools_julia_env`
Using libMAGEMin.dylib from MAGEMin_jll
Activating project at `~/.petthermotools_julia_env`
From worker 4: Activating project at `~/.petthermotools_julia_env`
From worker 5: Activating project at `~/.petthermotools_julia_env`
From worker 2: Activating project at `~/.petthermotools_julia_env`
From worker 3: Activating project at `~/.petthermotools_julia_env`
From worker 5: Using libMAGEMin.dylib from MAGEMin_jll
From worker 2: Using libMAGEMin.dylib from MAGEMin_jll
From worker 3: Using libMAGEMin.dylib from MAGEMin_jll
From worker 4: Using libMAGEMin.dylib from MAGEMin_jll
Julia Environment and Workers Ready.
MAGEMinCalc v0.6.4, MAGEMin_C v2.2.6
To demonstrate how PetThermoTools can be used to estimate the pressure of storage for any magma saturated in multiple solid phases we’ll use the compsition of an olivine, clinopyroxene, and plagioclase saturated melt from experiment Y0174-12 of Neave et al. (2019). We’ll also perform these minimizations using the Green et al. (2025) thermodynamic model implemented through MAGEMin (see installation instructions for how to run MAGEMin calculations).
[3]:
bulk = {'SiO2_Liq': 49.47,
'TiO2_Liq': 1.09,
'Al2O3_Liq': 15.58,
'FeOt_Liq': 12.60,
'MgO_Liq': 7.56,
'CaO_Liq': 11.63,
'Na2O_Liq': 1.84,
'K2O_Liq': 0.13,
'H2O_Liq': 1.0,
'Fe3Fet_Liq': 0.18}
Before we run the barometry calculations there are several other things that need to be specified:
The oxygen fugacity of the system. At the moment we cannot run these calculations at an fO2 buffer, instead the Fe redox state can be specified in the ``bulk`` variable above. This is due to a small bug that I’m trying to fix as soon as possible
The water content (also set in the
bulkvariable above).The pressure range and number of steps.
The phases of interest.
The thermodynamic model we want to use for the calculations.
[4]:
# fO2_offset = 0.8 # offset from FMQ buffer
P_bar = np.linspace(250.0,7500.0,24) #bars
phases = ['olivine1', 'plagioclase1', 'clinopyroxene1']
Model = "Green2025" # calculations performed using the rhyolite-MELTS v1.0.2 thermodynamic model as in Harmon et al. (2018)
Now we can use these parameters to calculate pressure. Note, with a natural glass data the H\(_2\)O content and oxygen fugacity may not be known, which leads to additional uncertainty in the calculation as these parameters have a notable influence on the saturation curves investigated here.
Notably, in the example below we’ll also specify a maximum temperaure interval on 50 degrees Celsius below the liquidus and a temperature step for each calculatio of 1 degree Celsius.
[5]:
minimum, xstal = ptt.mineral_cosaturation(bulk = bulk,
Model = Model,
phases = phases,
P_bar = P_bar,
T_initial_C = 1150.0,
dt_C = 1.0, # temperature interval for each calculation
T_maxdrop_C = 50.0, # maximum temperature below the liquidus the code will search for 3 phase saturation
timeout = 300,
T_cut_C = 25.0)
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:10
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:10
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:10
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:10
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:10
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:10
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:10
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:12
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:12
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:12
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:12
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:11
Computing 51 points... 100%|█████████████████████████████| Time: 0:00:12
To investigate the results, we can use in-built plotting functions to look at the position of the saturation curves in P-T space:
[6]:
ptt.plot_surfaces(Results = minimum, P_bar = P_bar, phases = phases)
[6]:
(<Figure size 500x400 with 1 Axes>,
<Axes: xlabel='P (bars)', ylabel='T ($\\degree$C)'>)
We can also investigate the temperature residual between the curves using the plottin function below.
[7]:
ptt.residualT_plot(Results = minimum, P_bar = P_bar, phases = phases, interpolate = True, ylim = [0, 100])
[ ]:
[ ]: