.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_main_model_runs.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code. .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_main_model_runs.py: Main Model Runs =============== This notebook demonstrates how to use the Empirical Redox Model to reproduce the main model runs in Birner et al. (2024). ***To run this code interactively in your web browser, click the "Launch Binder" button below:*** (Note that the file may take a long time to load, and outputs will not be saved.) .. image:: https://mybinder.org/badge_logo.svg :target: https://mybinder.org/v2/gl/skbirner%2Fempiricalredoxmodel/main?urlpath=%2Fdoc%2Ftree%2F.%2Fdoc%2Fsource%2Fauto_examples%2Fplot_main_model_runs.ipynb .. GENERATED FROM PYTHON SOURCE LINES 15-17 Import Statements ----------------- .. GENERATED FROM PYTHON SOURCE LINES 17-37 .. code-block:: Python # --------------------------------------------------------------------------------------------------------------------- # General import statements # --------------------------------------------------------------------------------------------------------------------- import numpy as np import matplotlib.pyplot as plt # --------------------------------------------------------------------------------------------------------------------- # These notebooks contain the functions and classes necessary for running the model # --------------------------------------------------------------------------------------------------------------------- from empirical_redox_model import input_composition as input_comp from empirical_redox_model import main from empirical_redox_model import plotting_and_saving # Suppress deprecation warnings in Binder script import warnings warnings.filterwarnings("ignore", category=DeprecationWarning) .. GENERATED FROM PYTHON SOURCE LINES 38-40 Input Parameters ---------------- .. GENERATED FROM PYTHON SOURCE LINES 40-68 .. code-block:: Python # --------------------------------------------------------------------------------------------------------------------- # Initial composition # --------------------------------------------------------------------------------------------------------------------- initial_assemblage = input_comp.get_WH05_starting_comp(bulk_Fe2O3=0.3, display=False) # Initial oxides/modes from Workman and Hart (2005) # --------------------------------------------------------------------------------------------------------------------- # Initial pressure # --------------------------------------------------------------------------------------------------------------------- PGPa_0 = 4.0 # --------------------------------------------------------------------------------------------------------------------- # Potential temperatures and colors for plotting # --------------------------------------------------------------------------------------------------------------------- pot_TC_vals = [1350, 1400, 1450, 1500, 1550] colors = plt.cm.inferno(np.linspace(0.175, 0.825, 5)) pot_TC_cols = { 1350: colors[0], 1400: colors[1], 1450: colors[2], 1500: colors[3], 1550: colors[4] } .. GENERATED FROM PYTHON SOURCE LINES 69-71 Projection to Garnet Field -------------------------- .. GENERATED FROM PYTHON SOURCE LINES 71-77 .. code-block:: Python initial_assemblages_gt_field = {} for pot_TC in pot_TC_vals: new_assemblage = input_comp.garnet_project(initial_assemblage, pot_TC, PGPa_0, spl_final=0.05, display=False) initial_assemblages_gt_field[pot_TC] = new_assemblage .. GENERATED FROM PYTHON SOURCE LINES 78-80 Model Runs (Liquid and Garnet present) -------------------------------------- .. GENERATED FROM PYTHON SOURCE LINES 80-104 .. code-block:: Python run_parameters = { 'P_range_GPa': [PGPa_0, 0.1], 'P_step': -0.01, 'melting': True, 'melting_method': 'fractional', 'gt_out_P_range_GPa': [3.0, 2.8-0.001], 'gt_out_rxn_wts': {'gt_olv__spl_pyx':1, 'gt__pyx_pyxTs':2}, 'debug': 0, 'run_model': True } empirical = {} for pot_TC in pot_TC_vals: empirical[pot_TC] = main.ModelRun( label = f'Tp = {pot_TC}°C', color = pot_TC_cols[pot_TC], potential_temperature_C = pot_TC, initial_assemblage = initial_assemblages_gt_field[pot_TC], **run_parameters ) .. rst-class:: sphx-glr-script-out .. code-block:: none Tp = 1350°C : Successful run! /Users/suzannebirner/Gitlab repos/empiricalredoxmodel/empirical_redox_model/empirical_redox_model/reactions.py:568: RuntimeWarning: The iteration is not making good progress, as measured by the improvement from the last ten iterations. soln = opt.fsolve(fun_Ts, 0, args=(assemblage,Ts_exchange,phase)) Tp = 1400°C : Successful run! Tp = 1450°C : Successful run! Tp = 1500°C : Successful run! Tp = 1550°C : Successful run! .. GENERATED FROM PYTHON SOURCE LINES 105-107 Results ------- .. GENERATED FROM PYTHON SOURCE LINES 107-110 .. code-block:: Python fig, ax = plotting_and_saving.plot_model_runs(empirical, title='Evolution of $f_{O2}$ during peridotite \ndecompression and melting', legend='upper_right') .. image-sg:: /auto_examples/images/sphx_glr_plot_main_model_runs_001.png :alt: Evolution of $f_{O2}$ during peridotite decompression and melting :srcset: /auto_examples/images/sphx_glr_plot_main_model_runs_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 14.846 seconds) .. _sphx_glr_download_auto_examples_plot_main_model_runs.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_main_model_runs.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_main_model_runs.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_main_model_runs.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_