{ "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", " | S_Sulf | \n", "O_Sulf | \n", "Fe_Sulf | \n", "Ni_Sulf | \n", "Cu_Sulf | \n", "DNi | \n", "DCu | \n", "DAg | \n", "DPb | \n", "DZn | \n", "DCd | \n", "DTl | \n", "DMn | \n", "DIn | \n", "DTi | \n", "DGa | \n", "DSb | \n", "DCo | \n", "DV | \n", "DGe | \n", "DCr | \n", "DSe_B2015 | \n", "DTe_B2015 | \n", "
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n", "28.889774 | \n", "3.007096 | \n", "53.099130 | \n", "2.2 | \n", "12.804 | \n", "831.971727 | \n", "765.753580 | \n", "805.083251 | \n", "27.422926 | \n", "1.417481 | \n", "57.390194 | \n", "7.632734 | \n", "0.348569 | \n", "10.527493 | \n", "0.008983 | \n", "0.022206 | \n", "11.778163 | \n", "37.556741 | \n", "0.147699 | \n", "0.363550 | \n", "0.886372 | \n", "790.758001 | \n", "6933.354144 | \n", "
| 1 | \n", "28.798040 | \n", "3.063111 | \n", "53.134849 | \n", "2.2 | \n", "12.804 | \n", "828.505827 | \n", "765.752606 | \n", "806.073742 | \n", "27.017971 | \n", "1.390299 | \n", "56.714297 | \n", "7.527723 | \n", "0.342776 | \n", "10.322400 | \n", "0.009045 | \n", "0.021577 | \n", "11.417914 | \n", "36.983452 | \n", "0.145170 | \n", "0.350906 | \n", "0.866265 | \n", "766.086469 | \n", "6662.618410 | \n", "
| 2 | \n", "28.717732 | \n", "3.112149 | \n", "53.166119 | \n", "2.2 | \n", "12.804 | \n", "810.570719 | \n", "748.623170 | \n", "788.909667 | \n", "26.496807 | \n", "1.373343 | \n", "55.661209 | \n", "7.449138 | \n", "0.340263 | \n", "10.121148 | \n", "0.009152 | \n", "0.021600 | \n", "11.243449 | \n", "36.252072 | \n", "0.144834 | \n", "0.347752 | \n", "0.857510 | \n", "744.959829 | \n", "6430.392157 | \n", "
| 3 | \n", "28.730993 | \n", "3.104051 | \n", "53.160955 | \n", "2.2 | \n", "12.804 | \n", "806.475753 | \n", "743.475584 | \n", "783.348165 | \n", "26.498263 | \n", "1.378935 | \n", "55.607301 | \n", "7.467304 | \n", "0.341787 | \n", "10.139992 | \n", "0.009154 | \n", "0.021857 | \n", "11.331808 | \n", "36.256183 | \n", "0.145720 | \n", "0.351747 | \n", "0.862817 | \n", "748.418342 | \n", "6468.427547 | \n", "
| 4 | \n", "28.978200 | \n", "2.953101 | \n", "53.064699 | \n", "2.2 | \n", "12.804 | \n", "848.358523 | \n", "780.250434 | \n", "819.342051 | \n", "27.981626 | \n", "1.439479 | \n", "58.480965 | \n", "7.726977 | \n", "0.352340 | \n", "10.760029 | \n", "0.008895 | \n", "0.022365 | \n", "12.029887 | \n", "38.342135 | \n", "0.148752 | \n", "0.369913 | \n", "0.899370 | \n", "815.088357 | \n", "7199.689937 | \n", "