MagmaForge: Equilibrium Crystallization#

Demonstrates how to run an equilibrium crystallization routine using MagmaForge.

Open this code in an executable MyBinder instance (MyBinder links may be slow to load– please be patient!):

https://mybinder.org/badge_logo.svg

Initialization#

Import necessary packages:

import thermoengine
from thermoengine import magmaforge

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

Define a bulk composition:

morb_oxides = pd.Series({
            'SiO2':  48.68,
            'TiO2':   1.01,
            'Al2O3': 17.64,
            'Fe2O3':  0.89,
            'Cr2O3':  0.0425,
            'FeO':    7.59,
            'MgO':    9.10,
            'CaO':   12.45,
            'Na2O':   2.65,
            'K2O':    0.03,
            'P2O5':   0.08,
            'H2O':    0.2},)

System and Calculations#

Define system using magmaforge:

sys = magmaforge.System(comp=morb_oxides,
                        T_C = 1350,
                        P_bar=1000.0,
                        logfO2 = ('NNO',-1),
                        database='MELTS_v1_0',
                        )
/workspaces/ThermoEngineLite/thermoengine/thermoengine/magmaforge/system.py:265: UserWarning: Warning! Setting an fO2 value will overwrite the FeO and Fe2O3 values given.
  warnings.warn('Warning! Setting an fO2 value will overwrite the FeO and Fe2O3 values given.')

Crystallize system:

sys.crystallize(method='equil',
                #calc_args={'debug':1, 'stats':False},
                Tstep=5,
                fix_fO2=True,
                #Tfinal=1100.0,
                )
Bad phase composition for Liquid: [ 1.01085067e-06  3.05711726e-06  1.20955749e-07  7.61190593e-07
  6.02572646e-09 -4.63481658e-04  0.00000000e+00  7.95935977e-05
  0.00000000e+00  0.00000000e+00  2.39062853e-06  0.00000000e+00
  2.51786668e-06  5.61132182e-04  3.70025303e-05]
/workspaces/ThermoEngineLite/thermoengine/thermoengine/magmaforge/system.py:618: UserWarning: Warning: Unsuccessful cooling step ended equilibrium calculation.
  warnings.warn("Warning: Unsuccessful cooling step ended equilibrium calculation.")

<thermoengine.magmaforge.system.System object at 0xffff7ec217e0>

Output#

Magma Evolution plot

magmaforge.plot.magma_evolution(sys.history)
plot magmaforge crystallization

Total running time of the script: (0 minutes 16.417 seconds)

Gallery generated by Sphinx-Gallery