{ "cells": [ { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "# Carbon-dioxide solubility in brines with different salinity and temperature\n", "\n", "
Written by Svetlana Kyas (ETH Zurich) on Mar 30th, 2022
\n", "\n", "```{attention}\n", "Always make sure you are using the [latest version of Reaktoro](https://anaconda.org/conda-forge/reaktoro). Otherwise, some new features documented on this website will not work on your machine and you may receive unintuitive errors. Follow these [update instructions](updating_reaktoro_via_conda) to get the latest version of Reaktoro!\n", "```\n", "\n", "Salting out is usually used to precipitate large biomolecules such as proteins or DNA. A specific salt concentration can be used to precipitate a target protein. This method is also used to concentrate dilute solutions of proteins. If necessary, the salt can be removed by dialysis.\n", "\n", "|![Salting in vs. salting out](../../images/applications/salting-out-and-in.png)|\n", "|:--:|\n", "|Salting in vs. salting out, Source: wikipedia.org|\n", "\n", "This tutorial shows how to simulate the solubility of CO2 gas in NaCl brine and its dependence on brine salinity (also called the salting-out effect) and temperature. To perform such a study, we need a chemical system consisting of an aqueous and a gaseous phase. The corresponding equilibrium solvent will also be initialized in the following." ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "from reaktoro import *\n", "\n", "# Initialize a thermodynamic database\n", "db = PhreeqcDatabase(\"phreeqc.dat\")\n", "\n", "# Create an aqueous phase automatically selecting all species with provided elements\n", "aqueousphase = AqueousPhase(speciate(\"H O C Na Cl\"))\n", "aqueousphase.set(ActivityModelPhreeqc(db))\n", "\n", "# Create a gaseous phase with CO2(g)\n", "gaseousphase = GaseousPhase(\"CO2(g)\")\n", "gaseousphase.set(ActivityModelPengRobinsonPhreeqcOriginal())\n", "\n", "# Create the chemical system\n", "system = ChemicalSystem(db, aqueousphase, gaseousphase)\n", "\n", "# Create the equilibrium solver\n", "solver = EquilibriumSolver(system)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Next, the temperature and salinity ranges, as well as the pressure for the calculation of the CO2 solubilities, are defined. The resulting `pandas.DataFrame` contains the amount of carbon dissolved in the aqueous solution as a function of the respective temperature and NaCl concentration." ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import numpy as np\n", "import pandas as pd\n", "\n", "temperatures = np.arange(25.0, 90.0, 5.0)\n", "molsNaCl = np.array([1.0, 2.0, 4.0])\n", "P = 100.0\n", "\n", "df = pd.DataFrame(columns=[\"T\", \"amountNaCl\", \"amountCaq\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In a loop, we perform equilibrium calculations for different input temperatures and different brine concentrations." ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "for molNaCl in molsNaCl:\n", " for T in temperatures:\n", "\n", " # Initial amount of the CO2 gas\n", " n0CO2g = 10.0\n", "\n", " # Define initial chemical state corresponding to the NaCl-brine of the given concentration\n", " state = ChemicalState(system)\n", " state.setTemperature(T, \"celsius\")\n", " state.setPressure(P, \"bar\")\n", " state.set(\"H2O\" , 1.0 , \"kg\")\n", " state.set(\"CO2(g)\", n0CO2g, \"mol\")\n", " state.set(\"Na+\" , molNaCl , \"mol\")\n", " state.set(\"Cl-\" , molNaCl , \"mol\")\n", "\n", " # Calculate equilibrium state\n", " res = solver.solve(state)\n", " # Stop if the equilibration did not converge or failed\n", " if not res.succeeded(): continue\n", "\n", " # Fetch resulting aqueous properties of the chemical state\n", " aqprops = AqueousProps(state)\n", "\n", " # Update value [\"T\", \"amountNaCl\", \"amountCaq\"] in the dataframe\n", " df.loc[len(df)] = [T, molNaCl, float(aqprops.elementMolality(\"C\"))]" ] }, { "attachments": {}, "cell_type": "markdown", "metadata": {}, "source": [ "Below, we plot the solubility of CO2(g) as a function of temperature for NaCl brines with different salinities." ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "data": { "text/html": [ " \n", " " ] }, "metadata": {}, "output_type": "display_data" }, { "data": { "application/vnd.plotly.v1+json": { "config": { "plotlyServerURL": "https://plot.ly" }, "data": [ { "mode": "lines+markers", "name": "1.0 mol of NaCl", "type": "scatter", "x": [ 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85 ], "y": [ 1.1622790828766796, 1.1015789255060857, 1.0477692335314648, 0.9985616883016072, 0.951614334202426, 0.9060230028793812, 0.863289882379663, 0.8245131999529183, 0.789890417335122, 0.7592399376117182, 0.7322536561573892, 0.708596239604871, 0.6879447226010268 ] }, { "mode": "lines+markers", "name": "2.0 mol of NaCl", "type": "scatter", "x": [ 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85 ], "y": [ 0.9236099517309148, 0.8753902037261594, 0.8326422016656025, 0.7935482708127458, 0.7562480648300921, 0.7200235204290591, 0.6860684155950638, 0.6552555651399314, 0.6277420913072214, 0.6033839171916359, 0.5819364216132238, 0.5631333206663641, 0.5467181317147662 ] }, { "mode": "lines+markers", "name": "4.0 mol of NaCl", "type": "scatter", "x": [ 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85 ], "y": [ 0.5833956919191005, 0.5529646732169305, 0.5259834360890536, 0.5013051139426203, 0.477755803239191, 0.45488268205187876, 0.4334399018814006, 0.4139789570277842, 0.3965994513171914, 0.381210771707726, 0.3676587713054035, 0.35577557649410335, 0.345399458314003 ] } ], "layout": { "template": { "data": { "scatter": [ { "line": { "width": 4 }, "marker": { "size": 10, "symbol": "circle" }, "type": "scatter" } ] }, "layout": { "colorway": [ "#4C78A8", "#F58518", "#E45756", "#72B7B2", "#54A24B", "#EECA3B", "#B279A2", "#FF9DA6", "#9D755D", "#BAB0AC" ], "font": { "color": "#2e2e2e", "family": "Arial", "size": 16 }, "legend": { "title": { "text": "" } }, "margin": { "b": 100, "l": 100, "pad": 5, "r": 100, "t": 100 }, "paper_bgcolor": "#f7f7f7", "plot_bgcolor": "#f7f7f7", "title": { "font": { "color": "#636363", "size": 24 }, "x": 0, "xref": "paper", "yanchor": "middle", "yref": "paper" }, "xaxis": { "exponentformat": "power", "showexponent": "last", "title": { "font": { "size": 20 } }, "zerolinecolor": "#2e2e2e", "zerolinewidth": 0 }, "yaxis": { "exponentformat": "power", "showexponent": "last", "title": { "font": { "size": 20 } }, "zerolinecolor": "#2e2e2e", "zerolinewidth": 0 } } }, "title": { "text": "SOLUBILITY OF CO2 IN NACL BRINES" }, "xaxis": { "title": { "text": "TEMPERATURE [°C]" } }, "yaxis": { "title": { "text": "AMOUNT OF DISSOLVED CO2 [mol/kgw]" } } } }, "text/html": [ "