{ "cells": [ { "cell_type": "markdown", "id": "908a2a81", "metadata": {}, "source": [ "# Solubility of the table salt with water\n", "\n", "Importing the **reaktoro** package:" ] }, { "cell_type": "code", "execution_count": null, "id": "7d3ae09c", "metadata": {}, "outputs": [], "source": [ "from reaktoro import *" ] }, { "cell_type": "markdown", "id": "8a0290eb", "metadata": {}, "source": [ "Initialize a thermodynamic database:" ] }, { "cell_type": "code", "execution_count": null, "id": "1be4b4c7", "metadata": {}, "outputs": [], "source": [ "db = Database(\"supcrt98.xml\")" ] }, { "cell_type": "markdown", "id": "540706f3", "metadata": {}, "source": [ "Initializing chemical editor:" ] }, { "cell_type": "code", "execution_count": null, "id": "afe4744a", "metadata": {}, "outputs": [], "source": [ "editor = ChemicalEditor(db)\n", "editor.addAqueousPhaseWithElements(\"H O Na Cl\")\n", "editor.addMineralPhase(\"Halite\") # sodium chloride (solid)" ] }, { "cell_type": "markdown", "id": "be831651", "metadata": {}, "source": [ "Initializing chemical system:" ] }, { "cell_type": "code", "execution_count": null, "id": "d2fa2403", "metadata": {}, "outputs": [], "source": [ "system = ChemicalSystem(editor)" ] }, { "cell_type": "markdown", "id": "03964d41", "metadata": {}, "source": [ "To evaluate the content of the chemical system:" ] }, { "cell_type": "code", "execution_count": null, "id": "3a73a149", "metadata": {}, "outputs": [], "source": [ "print(\"system = \", system)" ] }, { "cell_type": "markdown", "id": "cafd0b0e", "metadata": {}, "source": [ "Initializing chemical problem:" ] }, { "cell_type": "code", "execution_count": null, "id": "694ca977", "metadata": {}, "outputs": [], "source": [ "problem = EquilibriumProblem(system)\n", "problem.setTemperature(25, \"celsius\")\n", "problem.setPressure(1, \"bar\")\n", "problem.add(\"H2O\", 1.0, \"kg\") # water\n", "problem.add(\"NaCl\", 1.0, \"mg\") # sodium chloride / table salt" ] }, { "cell_type": "markdown", "id": "d5b7c711", "metadata": {}, "source": [ "After mixing water and salt, the following reactions start:\n", "\n", "\\begin{alignat}{4}\n", "{\\rm NaCl(s)} & \\rightleftharpoons {\\rm Na}^+ + {\\rm Cl}^- &\\qquad& (1) \\\\\n", "{\\rm Na}^+ + {\\rm Cl}^- & \\rightleftharpoons {\\rm NaCl(aq)} &\\qquad& (2) \\\\\n", "{\\rm H_2O} & \\rightleftharpoons {\\rm H}^+ + {\\rm 0H}^- &\\qquad& (3) \\\\\n", "\\end{alignat}\n", "\n", "Reaction (1) corresponds to dissolution of solid sodium chloride provides ions of sodium and chloride.\n", "In (2), ions of sodium and chloride combine aqueous sodium chloride, NaCl(aq).\n", "In reaction (3), water provides solvent species for other solutions.\n", "Another species that can be forming are: HCl(aq), NaOH(aq) by the following reactions:\n", "$${\\rm H}^{+} + {\\rm Cl}^- \\rightleftharpoons {\\rm HCl(aq)} \\quad \\mbox{or} \\quad {\\rm Na}^{+} + {\\rm OH}^- \\rightleftharpoons {\\rm NaOH(aq)}.$$\n", "\n", "We equilibrate the above-defined problem:" ] }, { "cell_type": "code", "execution_count": null, "id": "3d754748", "metadata": {}, "outputs": [], "source": [ "state = equilibrate(problem)" ] }, { "cell_type": "markdown", "id": "942dcea4", "metadata": {}, "source": [ "To evaluate the result of equilibration, we use `print` function to output the `state`\n", "to the console" ] }, { "cell_type": "code", "execution_count": null, "id": "839ab947", "metadata": {}, "outputs": [], "source": [ "print(\"state = \", state)" ] }, { "cell_type": "markdown", "id": "04cc2bc3", "metadata": {}, "source": [ "We see that the Halite mineral has practically zero amount and `under stable` state\n", "in the resulting mixture, which indicates that it was completely dissolved in water.\n", "However, let us add some more salt:" ] }, { "cell_type": "code", "execution_count": null, "id": "616fd8a4", "metadata": {}, "outputs": [], "source": [ "problem.add(\"NaCl\", 1.0, \"kg\") # additional 1kg of salt\n", "state = equilibrate(problem)\n", "print(\"state = \", state)" ] }, { "cell_type": "markdown", "id": "40fee0ac", "metadata": {}, "source": [ "We see that with more added salt, we obtained 4.08036 mol of the precipitated halite. It is also confirmed by the\n", "stability of the mineral phase. To evaluate the amount of a particular species, one can use:" ] }, { "cell_type": "code", "execution_count": null, "id": "c53c24c3", "metadata": {}, "outputs": [], "source": [ "print(f\"Amount of NaCl(s) : {state.speciesAmount('Halite')}\")" ] } ], "metadata": {}, "nbformat": 4, "nbformat_minor": 5 }