{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "*This notebook contains course material from [CBE20255](https://jckantor.github.io/CBE20255)\n", "by Jeffrey Kantor (jeff at nd.edu); the content is available [on Github](https://github.com/jckantor/CBE20255.git).\n", "The text is released under the [CC-BY-NC-ND-4.0 license](https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode),\n", "and code is released under the [MIT license](https://opensource.org/licenses/MIT).*" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Energy Balances on a Classroom](http://nbviewer.jupyter.org/github/jckantor/CBE20255/blob/master/notebooks/08.01-Energy-Balances-on-a-Classroom.ipynb) | [Contents](toc.ipynb) | [Basic Energy Computations](http://nbviewer.jupyter.org/github/jckantor/CBE20255/blob/master/notebooks/08.03-Basic-Energy-Calculations.ipynb) >

\"Open" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "Z6IKRI4FKZI0" }, "source": [ "# Water and Steam Calculator\n", "\n", "This notebook provides a convenient calculator front-end to the IAPWS IF97 standard for the thermodynamic properties of water and steam. The following cell installs the iapws package for water." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": {}, "colab_type": "code", "id": "nPo0kqizJygz" }, "outputs": [], "source": [ "!pip install iapws -q" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "i0vZiA0EMZxV" }, "source": [ "## Properties of Steam\n", "\n", "Execute the following the cell to estimate the properties of water at specified temperature and pressure." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "colab": { "base_uri": "https://localhost:8080/", "height": 136 }, "colab_type": "code", "id": "eAl41DxvVQKc", "outputId": "7b1e08d3-4b65-4ce1-c09c-3780f41c651e" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Superheated Vapor:\n", " h [kJ/kg] = 2855.9\n", " u [kJ/kg] = 2643.4\n", " v [m3/kg] = 0.42503\n", " s [kJ/kg/K] = 7.061\n", "\n", "At this pressure Tsat [deg C] = 151.84\n" ] } ], "source": [ "#@title Properties of Water { run: \"auto\", vertical-output: true }\n", "#@markdown Enter pressure [bar]\n", "P = 5.0 #@param {type:\"number\"}\n", "#@markdown Enter temperature [deg C]\n", "T = 200 #@param {type:\"number\"}\n", "\n", "from iapws import IAPWS97\n", "\n", "water = IAPWS97(P = P/10, T = T + 273.15)\n", "sat_liq = IAPWS97(P = P/10, x = 0)\n", "\n", "if sat_liq.T < T + 273.15:\n", " print('Superheated Vapor:')\n", "elif sat_liq.T > T + 273.15:\n", " print('Supercooled Liquid:')\n", "\n", "print(\" h [kJ/kg] =\", round(water.h,1))\n", "print(\" u [kJ/kg] =\", round(water.u,1))\n", "print(\" v [m3/kg] =\", round(water.v,5))\n", "print(\" s [kJ/kg/K] =\", round(water.s,3))\n", "print()\n", "print(\"At this pressure Tsat [deg C] =\", round(sat_liq.T - 273.15, 2))\n", "\n", "\n", "\n", "\n", "\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "R7RYTQEmqSnJ" }, "source": [ "## Saturation Conditions at a Specified Pressure\n", "\n", "Execute the following cell to estimate the properties of saturated liquid water and water vapor at a specified pressure." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "colab": { "base_uri": "https://localhost:8080/", "height": 238 }, "colab_type": "code", "id": "WhfUiJT8nSx7", "outputId": "7bf5900a-3455-4a8e-f3ff-870208d7a06c" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "T [deg C] = 126.62\n", "\n", "Saturated Liquid:\n", " h [kJ/kg] = 531.9\n", " u [kJ/kg] = 531.7\n", " v [m3/kg] = 0.00107\n", " s [kJ/kg/K] = 1.599\n", "\n", "Saturated Vapor:\n", " h [kJ/kg] = 2715.4\n", " u [kJ/kg] = 2536.0\n", " v [m3/kg] = 0.73524\n", " s [kJ/kg/K] = 7.061\n" ] } ], "source": [ "#@title Water Liquid/Vapor Saturation (Pressure) { run: \"auto\", vertical-output: true }\n", "#@markdown Enter pressure [bar]\n", "P = 2.44 #@param {type:\"number\"}\n", "\n", "from iapws import IAPWS97\n", "\n", "sat_liq = IAPWS97(P = P/10, x = 0)\n", "sat_vap = IAPWS97(P = P/10, x = 1)\n", "\n", "print(\"T [deg C] =\", round(sat_liq.T - 273.15, 2))\n", "print(\"\\nSaturated Liquid:\")\n", "print(\" h [kJ/kg] =\", round(sat_liq.h,1))\n", "print(\" u [kJ/kg] =\", round(sat_liq.u,1))\n", "print(\" v [m3/kg] =\", round(sat_liq.v,5))\n", "print(\" s [kJ/kg/K] =\", round(sat_liq.s,3))\n", "\n", "print(\"\\nSaturated Vapor:\")\n", "print(\" h [kJ/kg] =\", round(sat_vap.h,1))\n", "print(\" u [kJ/kg] =\", round(sat_vap.u,1))\n", "print(\" v [m3/kg] =\", round(sat_vap.v,5))\n", "print(\" s [kJ/kg/K] =\", round(sat_vap.s,3))\n", "\n" ] }, { "cell_type": "markdown", "metadata": { "colab_type": "text", "id": "lKMfGwyVqe5X" }, "source": [ "## Saturation Conditions at a Specified Temperature\n", "\n", "Execute the following cell to estimate the properties of saturated liquid water and water vapor at a specified temperature." ] }, { "cell_type": "code", "execution_count": null, "metadata": { "cellView": "form", "colab": { "base_uri": "https://localhost:8080/", "height": 238 }, "colab_type": "code", "id": "SSj-p2Y5LXRE", "outputId": "c8cfe8f5-f084-4767-d832-2d47343d9b23" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "P [bar] = 0.49966\n", "\n", "Saturated Liquid:\n", " h [kJ/kg] = 340.4\n", " u [kJ/kg] = 340.4\n", " v [m3/kg] = 0.00103\n", " s [kJ/kg/K] = 1.091\n", "\n", "Saturated Vapor:\n", " h [kJ/kg] = 2645.2\n", " u [kJ/kg] = 2483.2\n", " v [m3/kg] = 3.24219\n", " s [kJ/kg/K] = 7.593\n" ] } ], "source": [ "#@title Water Liquid/Vapor Saturation (Temperature) { run: \"auto\", vertical-output: true }\n", "#@markdown Enter temperature [deg C]\n", "T = 81.3 #@param {type:\"number\"}\n", "\n", "from iapws import IAPWS97\n", "\n", "sat_liq = IAPWS97(T = T+273.15, x = 0)\n", "sat_vap = IAPWS97(T = T+273.15, x = 1)\n", "\n", "print(\"P [bar] =\", round(10*sat_liq.P, 5))\n", "print(\"\\nSaturated Liquid:\")\n", "print(\" h [kJ/kg] =\", round(sat_liq.h,1))\n", "print(\" u [kJ/kg] =\", round(sat_liq.u,1))\n", "print(\" v [m3/kg] =\", round(sat_liq.v,5))\n", "print(\" s [kJ/kg/K] =\", round(sat_liq.s,3))\n", "\n", "print(\"\\nSaturated Vapor:\")\n", "print(\" h [kJ/kg] =\", round(sat_vap.h,1))\n", "print(\" u [kJ/kg] =\", round(sat_vap.u,1))\n", "print(\" v [m3/kg] =\", round(sat_vap.v,5))\n", "print(\" s [kJ/kg/K] =\", round(sat_vap.s,3))" ] }, { "cell_type": "code", "execution_count": null, "metadata": { "colab": {}, "colab_type": "code", "id": "FP-Ta_UlpWYi" }, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "\n", "< [Energy Balances on a Classroom](http://nbviewer.jupyter.org/github/jckantor/CBE20255/blob/master/notebooks/08.01-Energy-Balances-on-a-Classroom.ipynb) | [Contents](toc.ipynb) | [Basic Energy Computations](http://nbviewer.jupyter.org/github/jckantor/CBE20255/blob/master/notebooks/08.03-Basic-Energy-Calculations.ipynb) >

\"Open" ] } ], "metadata": { "colab": { "collapsed_sections": [], "name": "Water_and_Steam_Calculator.ipynb", "provenance": [], "toc_visible": true, "version": "0.3.2" }, "kernelspec": { "display_name": "Python 3", "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.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }