{ "cells": [ { "cell_type": "markdown", "id": "aabeeb74-b14a-4968-a240-bd3a625c5a86", "metadata": {}, "source": [ "# Calculating partition coefficients\n", "- This workbook shows you how to calculate partition coefficients and sulfide compositions using the model of Kiseeva et al. (2015) and Brenan (2015)\n", "- You load in matrix glasses, calculate a temperature using the Python module Thermobar from this liquid composition, and then feed this into the calculate Kiseeva.... function\n", "You can download the excel file here:\n", "- https://github.com/PennyWieser/PySulfSat/blob/main/docs/Examples/Other_Useful_Functions/Glass_input_example.xlsx" ] }, { "cell_type": "markdown", "id": "98e41039-513f-4feb-8200-8d6d7b489085", "metadata": {}, "source": [ "### Here we load various python packages" ] }, { "cell_type": "code", "execution_count": 1, "id": "ba33d40c-ba34-441b-a19a-ce4cee4a6bbf", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "'0.0.17'" ] }, "execution_count": 1, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", "import PySulfSat as ss\n", "import Thermobar as pt\n", "pd.options.display.max_columns = None\n", "ss.__version__" ] }, { "cell_type": "markdown", "id": "54eb5fd7-0d85-4785-9b13-6f7f1970afe3", "metadata": {}, "source": [ "## Here we load our glass data using the Thermobar load structure\n", "- First, this looks for column headings for each phase.\n", "- Here, because we only have liquids, I haven't bothered to add \"_Liq\" after each oxide,\n", "so you just need to tell the function that. \n" ] }, { "cell_type": "code", "execution_count": 2, "id": "748ecbc2-7b60-48c8-bc74-3583de109e2e", "metadata": {}, "outputs": [], "source": [ "In=pt.import_excel('Glass_input_example.xlsx', suffix=\"_Liq\", sheet_name='Glass_input')\n", "Liqs=In['Liqs'] # This pulls out just the columns it needs for liquids" ] }, { "cell_type": "markdown", "id": "3d1a04f4-847a-46b5-90b7-49fb3282e6b0", "metadata": {}, "source": [ "## This calculates temperature using the Sugawara thermometer\n", "- At 3.2 kbar presure" ] }, { "cell_type": "code", "execution_count": 3, "id": "7ef00730-6822-42f2-8afa-67a994255ba6", "metadata": {}, "outputs": [], "source": [ "Sugawara_T=pt.calculate_liq_only_temp(liq_comps=Liqs, equationT=\"T_Sug2000_eq3_ol\", P=3.2)" ] }, { "cell_type": "markdown", "id": "e93b2df8-01a7-46f7-942f-792c5aa7f312", "metadata": {}, "source": [ "## This calculates the Kd using Kiseeva et al. and the sulfie composition, as well as the Kds from Brenan (2015) for Se and Te\n", "You need to tell it:\n", "- the Ni and Cu content of the sulfide\n", "- The FeOt content of the liquid\n", "- The temperature in Kelvin\n", "- The proportion of Fe3Fet in your liquid" ] }, { "cell_type": "code", "execution_count": 4, "id": "24430822-1ad4-4c82-ba9f-0ee9bbdac13e", "metadata": {}, "outputs": [], "source": [ "Calc_Kd=ss.calculate_sulf_kds(Ni_Sulf=2.2,\n", " Cu_Sulf=12.804, \n", " FeOt_Liq=Liqs['FeOt_Liq'], \n", " T_K=Sugawara_T, \n", " Fe3Fet_Liq=0)" ] }, { "cell_type": "code", "execution_count": 5, "id": "e8d375af-0c26-4c8b-927d-8b7b9f07a04c", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
S_SulfO_SulfFe_SulfNi_SulfCu_SulfDNiDCuDAgDPbDZnDCdDTlDMnDInDTiDGaDSbDCoDVDGeDCrDSe_B2015DTe_B2015
028.8897743.00709653.0991302.212.804831.971727765.753580805.08325127.4229261.41748157.3901947.6327340.34856910.5274930.0089830.02220611.77816337.5567410.1476990.3635500.886372790.7580016933.354144
128.7980403.06311153.1348492.212.804828.505827765.752606806.07374227.0179711.39029956.7142977.5277230.34277610.3224000.0090450.02157711.41791436.9834520.1451700.3509060.866265766.0864696662.618410
228.7177323.11214953.1661192.212.804810.570719748.623170788.90966726.4968071.37334355.6612097.4491380.34026310.1211480.0091520.02160011.24344936.2520720.1448340.3477520.857510744.9598296430.392157
328.7309933.10405153.1609552.212.804806.475753743.475584783.34816526.4982631.37893555.6073017.4673040.34178710.1399920.0091540.02185711.33180836.2561830.1457200.3517470.862817748.4183426468.427547
428.9782002.95310153.0646992.212.804848.358523780.250434819.34205127.9816261.43947958.4809657.7269770.35234010.7600290.0088950.02236512.02988738.3421350.1487520.3699130.899370815.0883577199.689937
\n", "
" ], "text/plain": [ " S_Sulf O_Sulf Fe_Sulf Ni_Sulf Cu_Sulf DNi DCu \\\n", "0 28.889774 3.007096 53.099130 2.2 12.804 831.971727 765.753580 \n", "1 28.798040 3.063111 53.134849 2.2 12.804 828.505827 765.752606 \n", "2 28.717732 3.112149 53.166119 2.2 12.804 810.570719 748.623170 \n", "3 28.730993 3.104051 53.160955 2.2 12.804 806.475753 743.475584 \n", "4 28.978200 2.953101 53.064699 2.2 12.804 848.358523 780.250434 \n", "\n", " DAg DPb DZn DCd DTl DMn DIn \\\n", "0 805.083251 27.422926 1.417481 57.390194 7.632734 0.348569 10.527493 \n", "1 806.073742 27.017971 1.390299 56.714297 7.527723 0.342776 10.322400 \n", "2 788.909667 26.496807 1.373343 55.661209 7.449138 0.340263 10.121148 \n", "3 783.348165 26.498263 1.378935 55.607301 7.467304 0.341787 10.139992 \n", "4 819.342051 27.981626 1.439479 58.480965 7.726977 0.352340 10.760029 \n", "\n", " DTi DGa DSb DCo DV DGe DCr \\\n", "0 0.008983 0.022206 11.778163 37.556741 0.147699 0.363550 0.886372 \n", "1 0.009045 0.021577 11.417914 36.983452 0.145170 0.350906 0.866265 \n", "2 0.009152 0.021600 11.243449 36.252072 0.144834 0.347752 0.857510 \n", "3 0.009154 0.021857 11.331808 36.256183 0.145720 0.351747 0.862817 \n", "4 0.008895 0.022365 12.029887 38.342135 0.148752 0.369913 0.899370 \n", "\n", " DSe_B2015 DTe_B2015 \n", "0 790.758001 6933.354144 \n", "1 766.086469 6662.618410 \n", "2 744.959829 6430.392157 \n", "3 748.418342 6468.427547 \n", "4 815.088357 7199.689937 " ] }, "execution_count": 5, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Calc_Kd.head()" ] }, { "cell_type": "code", "execution_count": null, "id": "a13630ef-65b7-4e8a-9aa2-747e8b84b130", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "576e07ca-2fb7-4bf3-8fb3-d2a3830cf10a", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "3e5a93be-11ba-408f-91df-fa28ba1a892d", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 5 }