summaryrefslogtreecommitdiff
path: root/Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter9.ipynb
diff options
context:
space:
mode:
Diffstat (limited to 'Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter9.ipynb')
-rw-r--r--Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter9.ipynb929
1 files changed, 929 insertions, 0 deletions
diff --git a/Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter9.ipynb b/Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter9.ipynb
new file mode 100644
index 00000000..91d540ce
--- /dev/null
+++ b/Basic_And_Applied_Thermodynamics_by_P._K._Nag/Chapter9.ipynb
@@ -0,0 +1,929 @@
+{
+ "cells": [
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "# Chapter 09:Properties of pure substances"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.1:pg-302"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.1\n",
+ "\n",
+ " At 1 MPa, \n",
+ " saturation temperature is 179.91 degree celcius\n",
+ "\n",
+ " Changes in specific volume is 0.193313 m**3/kg\n",
+ "\n",
+ " Change in entropy during evaporation is 4.4478 kJ/kg K\n",
+ "\n",
+ " The latent heat of vaporization is 2015.3 kJ/kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "# At 1 MPa\n",
+ "tsat = 179.91 # Saturation temperature in degree Celsius\n",
+ "vf = 0.001127 # Specific volume of fluid in m**3/kg\n",
+ "vg = 0.19444 # Specific volume of gas in m**3/kg \n",
+ "sf = 2.1387 # Specific entropy of fluid in kJ/kgK\n",
+ "sg = 6.5865# Specific entropy of gas in kJ/kgK\n",
+ "print \"\\n Example 9.1\"\n",
+ "vfg = vg-vf # Change in specific volume due to evaporation\n",
+ "sfg = sg-sf# Change in specific entropy due to evaporation\n",
+ "hfg = 2015.3\n",
+ "print \"\\n At 1 MPa, \\n saturation temperature is \",tsat ,\" degree celcius\"\n",
+ "print \"\\n Changes in specific volume is \",vfg ,\" m**3/kg\"\n",
+ "print \"\\n Change in entropy during evaporation is \",sfg ,\" kJ/kg K\"\n",
+ "print \"\\n The latent heat of vaporization is \",hfg ,\" kJ/kg\"\n",
+ "# Data is given in the table A.1(b) in Appendix in the book\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.2:pg-302"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.2\n",
+ "\n",
+ " pressure = 0.6 Mpa\n",
+ " Temperature = 158.85 degree centigrade\n",
+ " Specific volume = 0.3156 m**3/kg\n",
+ " enthalpy = 2756.8 kJ/kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "# Given that\n",
+ "s = 6.76 # Entropy of saturated steam in kJ/kgK\n",
+ "print \"\\n Example 9.2\"\n",
+ "# From the table A.1(b) given in the book at s= 6.76 kJ/kgK\n",
+ "p = 0.6\n",
+ "t=158.85\n",
+ "v_g=0.3156\n",
+ "h_g=2756.8\n",
+ "print \"\\n pressure = \",p ,\" Mpa\\n Temperature = \",t ,\" degree centigrade\\n Specific volume = \",v_g ,\" m**3/kg\\n enthalpy = \",h_g ,\" kJ/kg\"\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.3:pg-302"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.3\n",
+ "\n",
+ " The enthalpy and entropy of the system are\n",
+ " 2614.55463998 kW and 5.96006442363 kJ/kg and kJ/kg K respectively.\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "v = 0.09 # Specific volume of substance at a point in m**3/kg\n",
+ "vf = 0.001177 # Specific volume of fluid in m**3/kg\n",
+ "vg = 0.09963 # Specific volume of gas in m**3/kg\n",
+ "hf = 908.79 # Specific enthalpy of fluid in kJ/kg\n",
+ "hfg = 1890.7 # Latent heat of substance in kJ/kg\n",
+ "sf = 2.4474 # Specific entropy of fluid in kJ/kgK\n",
+ "sfg = 3.8935 # Entropy change due to vaporization\n",
+ "\n",
+ "print \"\\n Example 9.3\"\n",
+ "x = (v-vf)/(vg-vf) # steam quality\n",
+ "h = hf+(x*hfg) # Specific enthalpy of substance at a point in kJ/kg\n",
+ "s = sf+(x*sfg) # Specific entropy of substance at a point in kJ/kgK\n",
+ "\n",
+ "print \"\\n The enthalpy and entropy of the system are\\n \",h ,\" kW and \",s ,\" kJ/kg and kJ/kg K respectively.\"\n",
+ "#The answers vary due to round off error\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.5:pg-303"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.5\n",
+ "\n",
+ " The pressure is 3.973 MPa\n",
+ "\n",
+ " The total mass of mixture is 9.57329343706 kg\n",
+ "\n",
+ " Specific volume is 0.00417829039327 m3/kg\n",
+ "\n",
+ " Enthalpy is is 1188.13405609 kJ/kg\n",
+ "\n",
+ " The entropy is 2.9891336667 kJ/kg K\n",
+ "\n",
+ " The internal energy is 1171.53370836 kJ/kg\n",
+ "\n",
+ " At 250 degree Celsius, internal energy is 1171.53445483 kJ/kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "Psat = 3.973 # Saturation pressure in MPa\n",
+ "vf = 0.0012512 # specific volume of fluid in m**3/kg\n",
+ "vg = 0.05013 # Specific volume of gas in m**3/kg\n",
+ "hf = 1085.36 # Specific enthalpy of fluid in kJ/kg\n",
+ "hfg = 1716.2 # Latent heat of vaporization in kJ/kg\n",
+ "sf = 2.7927 # Specific entropy of fluid in kJ/kgK\n",
+ "sfg = 3.2802 # Entropy change due to vaporization in kJ/kgK\n",
+ "mf = 9.0 # Mass of liquid in kg\n",
+ "V = 0.04 # Volume of vessel in m**3\n",
+ "# at T = 250\n",
+ "uf = 1080.39 #Specific internal energy in kJ/kg \n",
+ "ufg = 1522.0# Change in internal energy due to vaporization in kJ/kg\n",
+ "\n",
+ "print \"\\n Example 9.5\"\n",
+ "Vf = mf*vf # volume of fluid\n",
+ "Vg = V-Vf # volume of gas\n",
+ "mg = Vg/vg # mass of gas\n",
+ "m = mf+mg # mass if mixture\n",
+ "x = mg/m # quality of steam\n",
+ "v = vf+x*(vg-vf) # specific volume of mixture\n",
+ "h = hf+x*hfg # enthalpy of mixture\n",
+ "s = sf+(x*sfg) # entropy of mixture\n",
+ "u = h-Psat*1e6*v*1e-03 # Internal energy of mixture\n",
+ "u_ = uf+x*ufg # Internal energy at 250 degree Celsius\n",
+ "print \"\\n The pressure is \",Psat ,\" MPa\"\n",
+ "print \"\\n The total mass of mixture is \",m ,\" kg\"\n",
+ "print \"\\n Specific volume is \",v ,\" m3/kg\"\n",
+ "print \"\\n Enthalpy is is \",h ,\" kJ/kg\"\n",
+ "print \"\\n The entropy is \",s ,\" kJ/kg K\"\n",
+ "print \"\\n The internal energy is \",u ,\" kJ/kg\"\n",
+ "print \"\\n At 250 degree Celsius, internal energy is \",u_ ,\"kJ/kg\" #The answer provided in the textbook is wrong\n",
+ "\n",
+ "#The answers vary due to round off error\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.7:pg-305"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 11,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.7\n",
+ "\n",
+ " The ideal work output of the turbine is 882.40804932 kJ/Kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "# At T = 40 degree\n",
+ "Psat = 7.384 # Saturation pressure in kPa\n",
+ "sf = 0.5725 # Entropy of fluid in kJ/kgK\n",
+ "sfg = 7.6845 # Entropy change due to vaporization in kJ/kgK\n",
+ "hf = 167.57 # Enthalpy of fluid in kJ/kg\n",
+ "hfg = 2406.7 # Latent heat of vaporization in kJ/kg\n",
+ "s1 = 6.9189 # Entropy at turbine inlet in kJ/kgK\n",
+ "h1 = 3037.6 # Enthalpy at turbine inlet in kJ/kg\n",
+ "print \"\\n Example 9.7\"\n",
+ "x2 = (s1-sf)/sfg # Steam quality\n",
+ "h2 = hf+(x2*hfg) # Enthalpy at turbine exit\n",
+ "W = h1-h2 # Net work done\n",
+ "print \"\\n The ideal work output of the turbine is \",W ,\" kJ/Kg\"\n",
+ "#The answers vary due to round off error\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.9:pg-308"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.9\n",
+ "\n",
+ " The quality of steam in pipe line is 0.96097673702\n",
+ "\n",
+ " Maximum moisture content that can be determined is 5.47886817645 percent\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "h2 = 2716.2 # Enthalpy at turbine inlet in kJ/kg\n",
+ "hf = 844.89 # Enthalpy of fluid in kJ/kg\n",
+ "hfg = 1947.3 # Latent heat of vaporization in kJ/kg\n",
+ "h3 = 2685.5 # Enthalpy at turbine exit in kJ/kg\n",
+ "print \"\\n Example 9.9\"\n",
+ "x1 = (h2-hf)/hfg\n",
+ "x4 = (h3-hf)/hfg\n",
+ "print \"\\n The quality of steam in pipe line is \",x1 #The answers vary due to round off error\n",
+ "print \"\\n Maximum moisture content that can be determined is \",100-(x4*100) ,\" percent\"#The answer provided in the textbook is wrong\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.10:pg-309"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.10\n",
+ "\n",
+ " The quality of the steam in the pipe line is 0.909544295341\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "# At 0.1Mpa, 110 degree\n",
+ "h2 = 2696.2 # Enthalpy at turbine inlet in kJ/kg\n",
+ "hf = 844.89 # Enthalpy of fluid in kJ/kg\n",
+ "hfg = 1947.3 # Latent heat of vaporization in kJ/kg\n",
+ "vf = 0.001023 # at T = 70 degree\n",
+ "V = 0.000150 # In m3\n",
+ "m2 = 3.24 # mass of condensed steam in kg\n",
+ "\n",
+ "print \"\\n Example 9.10\"\n",
+ "x2 = (h2-hf)/hfg # Quality of steam at turbine inlet\n",
+ "m1 = V/vf # mass of moisture collected in separator\n",
+ "x1 = (x2*m2)/(m1+m2) # quality of the steam\n",
+ "print \"\\n The quality of the steam in the pipe line is \",x1 \n",
+ "#The answers vary due to round off error\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.11:pg-310"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.11\n",
+ "\n",
+ " The heat transfer during the process is 1788.19203218 MJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "# P = 1MPa\n",
+ "vf = 0.001127 # specific volume of fluid in m**3/kg\n",
+ "vg = 0.1944# specific volume of gas in m**3/kg\n",
+ "hg = 2778.1 # specific enthalpy of gas in kJ/kg\n",
+ "uf = 761.68 # Specific internal energy of fluid in kJ/kg\n",
+ "ug = 2583.6 # Specific internal energy of gas in kJ/kg\n",
+ "ufg = 1822 # Change in specific internal energy due to phase change in kJ/kg \n",
+ "# Initial anf final mass\n",
+ "Vif = 5 # Initial volume of water in m**3 \n",
+ "Viw = 5# Initial volume of gas in m**3 \n",
+ "Vff = 6 # Final volume of gas in m**3 \n",
+ "Vfw = 4 # Final volume of water in m**3 \n",
+ "\n",
+ "\n",
+ "print \"\\n Example 9.11\"\n",
+ "ms = ((Viw/vf)+(Vif/vg)) - ((Vfw/vf)+(Vff/vg)) \n",
+ "U1 = ((Viw*uf/vf)+(Vif*ug/vg))\n",
+ "Uf = ((Vfw*uf/vf)+(Vff*ug/vg))\n",
+ "Q = Uf-U1+(ms*hg)\n",
+ "print \"\\n The heat transfer during the process is \",Q/1e3 ,\" MJ\"\n",
+ "#The answer provided in the textbook is wrong\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.12:pg-311"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.12\n"
+ ]
+ },
+ {
+ "ename": "NameError",
+ "evalue": "name 'math' is not defined",
+ "output_type": "error",
+ "traceback": [
+ "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
+ "\u001b[1;31mNameError\u001b[0m Traceback (most recent call last)",
+ "\u001b[1;32m<ipython-input-5-4824fe7bf0c8>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 14\u001b[0m \u001b[1;32mprint\u001b[0m \u001b[1;34m\"\\n Example 9.12\"\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 15\u001b[0m \u001b[0mV1\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mm\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0mv1\u001b[0m \u001b[1;31m# total volume at point 1\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 16\u001b[1;33m \u001b[0mVd\u001b[0m \u001b[1;33m=\u001b[0m \u001b[1;33m(\u001b[0m\u001b[0mmath\u001b[0m\u001b[1;33m.\u001b[0m\u001b[0mpi\u001b[0m\u001b[1;33m/\u001b[0m\u001b[1;36m4\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m*\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0md\u001b[0m\u001b[1;33m*\u001b[0m\u001b[1;36m1e-3\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m**\u001b[0m\u001b[1;36m2\u001b[0m\u001b[1;33m*\u001b[0m\u001b[0ml\u001b[0m\u001b[1;33m*\u001b[0m\u001b[1;36m1e-3\u001b[0m \u001b[1;31m# displaced volume\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 17\u001b[0m \u001b[0mV2\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mV1\u001b[0m\u001b[1;33m+\u001b[0m\u001b[0mVd\u001b[0m \u001b[1;31m# Total volume at point 2\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 18\u001b[0m \u001b[0mn\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mlog\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mP1\u001b[0m\u001b[1;33m/\u001b[0m\u001b[0mP2\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m/\u001b[0m\u001b[0mlog\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mV2\u001b[0m\u001b[1;33m/\u001b[0m\u001b[0mV1\u001b[0m\u001b[1;33m)\u001b[0m \u001b[1;31m# polytropic index\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
+ "\u001b[1;31mNameError\u001b[0m: name 'math' is not defined"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "m = 0.02 # Mass of steam in Kg\n",
+ "d = 280 # diameter of piston in mm\n",
+ "l = 305 # Stroke length in mm\n",
+ "P1 = 0.6 # Initial pressure in MPa\n",
+ "P2 = 0.12 # Final pressure in MPa\n",
+ "# At 0.6MPa, t = 200 degree\n",
+ "v1 = 0.352 # Specific volume in m**3/kg\n",
+ "h1 = 2850.1 # Specific enthalpy in kJ/kg\n",
+ "vf = 0.0010476 # specific volume of fluid in m**3/kg\n",
+ "vfg = 1.4271 # Specific volume change due to vaporization in m**3/kg\n",
+ "uf = 439.3 # specific enthalpy of fluid\n",
+ "ug = 2512.0 # Specific enthalpy of gas\n",
+ "print \"\\n Example 9.12\"\n",
+ "V1 = m*v1 # total volume at point 1\n",
+ "Vd = (math.pi/4)*(d*1e-3)**2*l*1e-3 # displaced volume\n",
+ "V2 = V1+Vd # Total volume at point 2\n",
+ "n = log(P1/P2)/log(V2/V1) # polytropic index\n",
+ "W12 = ((P1*V1)-(P2*V2))*1e6/(n-1) # work done\n",
+ "print \"\\n The value of n is \",n\n",
+ "print \"\\n The work done by the steam is \",W12/1e3 ,\"kJ \"\n",
+ "#The answers vary due to round off error\n",
+ "v2 = V2/m # specific volume\n",
+ "x2 = (v2-vf)/vfg # Steam quality\n",
+ "# At 0.12MPa\n",
+ "u2 = uf + (x2*(ug-uf)) # Internal energy \n",
+ "u1 = h1-(P1*1e6*v1*1e-03) # Internal energy\n",
+ "Q12 = m*(u2-u1)+ (W12/1e3) # Heat transfer\n",
+ "print \"\\n The heat transfer is \",Q12 ,\"kJ \"\n",
+ "#The answers vary due to round off error\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.13:pg-312"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.13\n",
+ "\n",
+ " Final pressure is 3.5 bar\n",
+ "\n",
+ " Steam quality is 0.87 \n",
+ " Entropy change during the process is 0.4227 kJ/K\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "x1 = 1 # Steam quality in first vessel\n",
+ "x2 = 0.8 # Steam quality in second vessel\n",
+ "# at 0.2MPa\n",
+ "vg = 0.8857 # Specific volume of gas in m**3/kg\n",
+ "h1 = 2706.7 # Enthalpy in first vessel in kJ/kg\n",
+ "v1 = vg # Specific volume of gas in first vessel in m**3/kg\n",
+ "hg = h1 # Enthalpy in first vessel 1 in kJ/kg\n",
+ "m1 = 5 # mass in first vessel in kg\n",
+ "V1 = m1*v1 # Volume of first vessel in m**3\n",
+ "# at 0.5MPa\n",
+ "m2 = 10 # mass in second vessel in kg\n",
+ "hf = 640.23 # Enthalpy in second vessel in kJ/kg\n",
+ "hfg = 2108.5 # Latent heat of vaporization in kJ/kg\n",
+ "vf = 0.001093 # Specific volume of fluid in second vessel in m**3/kg\n",
+ "vfg = 0.3749 # Change in specific volume in second vessel due to evaporation of gas in m**3/kg\n",
+ "v2 = vf+(x2*vfg) # Specific volume of gas in second vessel\n",
+ "V2 = m2*v2 # Volume of second vessel in m**3\n",
+ "#\n",
+ "Vm = V1+V2 # Total volume \n",
+ "m = m1+m2 # Total mass\n",
+ "vm = Vm/m # net specific volume\n",
+ "u1 = h1 # Internal energy\n",
+ "h2 = hf+(x2*hfg) # Enthalpy calculation\n",
+ "u2 = h2 # Internal energy calculation\n",
+ "m3 = m # Net mass calculation\n",
+ "h3 = ((m1*u1)+(m2*u2))/m3 # Resultant enthalpy calculation\n",
+ "u3 = h3 # Resultant internal energy calculation\n",
+ "v3 = vm # resultant specific volume calculation\n",
+ "# From Mollier diagram\n",
+ "x3 = 0.870 # Steam quality \n",
+ "p3 = 3.5 # Pressure in MPa\n",
+ "s3 = 6.29 # Entropy at state 3 in kJ/kgK\n",
+ "s1 = 7.1271 # Entropy at state 1 in kJ/kgK\n",
+ "sf = 1.8607 # Entropy in liquid state in kJ/kgK\n",
+ "sfg = 4.9606 # Entropy change due to vaporization in kJ/kgK\n",
+ "s2 = sf+(x2*sfg) # Entropy calculation\n",
+ "E = m3*s3-((m1*s1)+(m2*s2)) # Entropy change during process\n",
+ "\n",
+ "print \"\\n Example 9.13\"\n",
+ "print \"\\n Final pressure is \",p3 ,\" bar\"\n",
+ "print \"\\n Steam quality is \",x3 ,\n",
+ "print \"\\n Entropy change during the process is \",E ,\" kJ/K\"\n",
+ "#The answers vary due to round off error\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.14:pg-314"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.14\n",
+ "\n",
+ " The availability of the steam before the throttle valve 1263.6894 kJ/kg\n",
+ "\n",
+ " The availability of the steam after the throttle valve 1237.5538 kJ/kg\n",
+ "\n",
+ " The availability of the steam at the turbine exhaust 601.851036792 kJ/kg\n",
+ "\n",
+ " The specific work output from the turbine is 546.253422512 kJ/kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "# At 6 MPa, 400 degree\n",
+ "h1 = 3177.2 # Enthalpy in kJ/kg\n",
+ "s1 = 6.5408 #Entropy in kJ/kgK\n",
+ "# At 20 degree\n",
+ "h0= 83.96 # Enthalpy in kJ/kg \n",
+ "s0 = 0.2966#Entropy in kJ/kgK\n",
+ "T0 = 20 # Surrounding temperature in degree Celsius \n",
+ "f1 = (h1-h0)-(T0+273)*(s1-s0) # Availability before throttling\n",
+ "# By interpolation at P= 5MPa, h= 3177.2\n",
+ "s2 = 6.63 #Entropy in kJ/kgK\n",
+ "h2 = h1 # Throttling\n",
+ "f2 = (h2-h0)-(T0+273)*(s2-s0) # Availability after throttling\n",
+ "df = f1-f2 # Change in availability\n",
+ "x3s = (s2-1.5301)/(7.1271-1.5301) #Entropy at state 3 in kJ/kgK\n",
+ "h3s = 504.7+(x3s*2201.9) #Enthalpy at state 3 in kJ/kg\n",
+ "eis = 0.82 # isentropic efficiency\n",
+ "h3 = h2-eis*(h1-h3s) # Enthalpy at state 3 in kJ/kgK\n",
+ "x3 = (h3-504.7)/2201.7 # Steam quality at state 3\n",
+ "s3 = 1.5301+(x3*5.597) # Entropy at state 3\n",
+ "f3 = (h3-h0)-(T0+273)*(s3-s0) # Availability at state 3\n",
+ "\n",
+ "print \"\\n Example 9.14\"\n",
+ "print \"\\n The availability of the steam before the throttle valve \",f1 ,\" kJ/kg\"\n",
+ "print \"\\n The availability of the steam after the throttle valve \",f2 ,\" kJ/kg\"\n",
+ "print \"\\n The availability of the steam at the turbine exhaust \",f3 ,\" kJ/kg\"\n",
+ "print \"\\n The specific work output from the turbine is \",h2-h3 ,\" kJ/kg\"\n",
+ "#The answers vary due to round off error\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.15:pg-316"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 8,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.15\n",
+ "\n",
+ " Availability of steam entering is 1057.4864 kJ/kg\n",
+ "\n",
+ " Availability of steam leaving the turbine is 656.7062 kJ/kg\n",
+ "\n",
+ " Maximum work is 741.14568 kJ/kg\n",
+ "\n",
+ " Irreversibility is 21.36505104 kJ/kg\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "# At 25 bar, 350 degree\n",
+ "h1 = 3125.87 # Enthalpy in kJ/kg\n",
+ "s1 = 6.8481# Entropy in kJ/kgK\n",
+ "# 30 degree\n",
+ "h0 = 125.79 # Enthalpy in kJ/kg\n",
+ "s0 = 0.4369# Entropy in kJ/kgK\n",
+ "# At 3 bar, 200 degree\n",
+ "h2 = 2865.5 # Enthalpy in kJ/kg\n",
+ "s2 = 7.3115 #Entropy in kJ/kgK\n",
+ "# At 0.2 bar 0.95 dry\n",
+ "hf = 251.4 # Enthalpy of liquid in kJ/kg\n",
+ "hfg = 2358.3 # Latent heat of vaporization in kJ/kg\n",
+ "sf = 0.8320 # Entropy of liquid in kJ/kgK\n",
+ "sg = 7.0765# Entropy of liquid in kJ/kgK\n",
+ "h3 = hf+0.92*hfg # Enthalpy at state 3 in kJ/kg\n",
+ "s3 = sf+(0.92*sg) # Entropy at state 3 in kJ/kgK\n",
+ "# Part (a)\n",
+ "T0 = 30 # Atmospheric temperature in degree Celsius\n",
+ "f1 = (h1-h0)-((T0+273)*(s1-s0)) # Availability at steam entering turbine\n",
+ "f2 = (h2-h0)-((T0+273)*(s2-s0)) # Availability at state 2\n",
+ "f3 = (h3-h0)-((T0+273)*(s3-s0))# Availability at state 3\n",
+ "\n",
+ "print \"\\n Example 9.15\"\n",
+ "print \"\\n Availability of steam entering is \",f1 ,\" kJ/kg\"\n",
+ "print \"\\n Availability of steam leaving the turbine is \",f2 ,\" kJ/kg\"\n",
+ "\n",
+ "# Part (b)\n",
+ "m2m1 = 0.25 # mass ratio\n",
+ "m3m1 = 0.75 # mass ratio\n",
+ "Wrev = f1-(m2m1*f2)-(m3m1*f3) # Maximum work\n",
+ "print \"\\n Maximum work is \",Wrev ,\" kJ/kg\"\n",
+ "\n",
+ "# Part (c)\n",
+ "w1 = 600 # mass flow at inlet of turbine in kg/h\n",
+ "w2 = 150 # mass flow at state 2 in turbine in kg/h\n",
+ "w3 = 450# mass flow at state 2 in turbine in kg/h\n",
+ "Q = -10 # Heat loss rate kJ/s\n",
+ "I = ((T0+273)*(w2*s2+w3*s3-w1*s1)-Q*3600)*103/600\n",
+ "print \"\\n Irreversibility is \",I/1e3 ,\" kJ/kg\"\n",
+ "#The answer provided in the textbook is wrong\n",
+ "\n",
+ "\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.16:pg-317"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 9,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.16\n",
+ "\n",
+ " Energy of system in Part (a) is 73.2 kJ\n",
+ "\n",
+ " Energy of system in Part (b) is 197.3474 kJ\n",
+ "\n",
+ " Energy of system in Part (c) is 498.2624 kJ\n",
+ "\n",
+ " Energy of system in Part (d) is 121.8 kJ\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "# At dead state of 1 bar, 300K\n",
+ "u0 = 113.1 # Internal energy in kJ/kg\n",
+ "h0 = 113.2 # Enthalpy in kJ/kg\n",
+ "v0 = 0.001005 # Specific volume in m**3/kg\n",
+ "s0 = 0.395 # Entropy in kJ/kg\n",
+ "T0 = 300 # Atmospheric temperature in K\n",
+ "P0 = 1 # Atmospheric pressure in bar \n",
+ "K = h0-T0*s0\n",
+ "# Part (a)\n",
+ "# At 1bar and 90 degree Celsius \n",
+ "u = 376.9 # Internal energy in kJ/kg\n",
+ "h = 377 # Enthalpy in kJ/kg\n",
+ "v = 0.001035 # specific volume in m**3/kg\n",
+ "s = 1.193 # Entropy in kJ/kgK\n",
+ "m = 3 # Mass of water in kg\n",
+ "fi = m*(h-(T0*s)-K) #Energy of system\n",
+ "\n",
+ "print \"\\n Example 9.16\"\n",
+ "print \"\\n Energy of system in Part (a) is \",fi ,\" kJ\"\n",
+ "#The answers vary due to round off error\n",
+ "\n",
+ "# Part (b)\n",
+ "# At P = 4 Mpa, t = 500 degree\n",
+ "u = 3099.8# Internal energy in kJ/kg \n",
+ "h = 3446.3 # Enthalpy in kJ/kg \n",
+ "v = 0.08637 # specific volume in m**3/kg \n",
+ "s = 7.090 # Entropy in kJ/kgK\n",
+ "m = 0.2 # Mass of steam in kg \n",
+ "fib = m*(u+P0*100*v-T0*s-K) # Energy of system\n",
+ "print \"\\n Energy of system in Part (b) is \",fib ,\" kJ\"\n",
+ "\n",
+ "# Part (c) # P = 0.1 bar\n",
+ "m = 0.4 # Mass of wet steam in kg \n",
+ "x = 0.85 # Quality\n",
+ "u = 192+x*2245 # Internal energy \n",
+ "h = 192+x*2392# Enthalpy\n",
+ "s = 0.649+x*7.499 # Entropy\n",
+ "v = 0.001010+x*14.67 # specific volume\n",
+ "fic = m*(u+P0*100*v-T0*s-K) # Energy of system\n",
+ "print \"\\n Energy of system in Part (c) is \",fic ,\" kJ\"\n",
+ "\n",
+ "# Part (d) \n",
+ "# P = 1 Bar, t = -10 degree Celsius\n",
+ "m = 3 # Mass of ice in kg \n",
+ "h = -354.1 # Enthalpy in kJ/kg \n",
+ "s = -1.298 # at 1000kPa, -10 degree\n",
+ "fid = m*((h-h0)-T0*(s-s0)) # Energy of system\n",
+ "\n",
+ "print \"\\n Energy of system in Part (d) is \",fid ,\" kJ\" #The answer provided in the textbook is wrong\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.17:pg-318"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 10,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.17\n",
+ "\n",
+ " In parallel flow\n",
+ "\n",
+ " The rate of irreversibility is 10.98 kW\n",
+ "\n",
+ " The Second law efficiency is 24.275862069 percent\n",
+ "\n",
+ "\n",
+ " In counter flow\n",
+ "\n",
+ " The rate of irreversibility is 10.9454545455 kW\n",
+ "\n",
+ " The Second law efficiency is 32.1594684385 percent\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "# Given\n",
+ "th1 = 90.0 # Inlet temperature of hot water in degree Celsius\n",
+ "tc1 = 25.0# Inlet temperature of cold water in degree Celsius\n",
+ "tc2 = 50.0# Exit temperature of cold water in degree Celsius\n",
+ "mc = 1.0 # mass flow rate of cold water in kg/s\n",
+ "T0 = 300.0 # Atmospheric temperature in K\n",
+ "th2p = 60.0 # Temperature limit in degree Celsius for parallel flow\n",
+ "th2c = 35.0 # Temperature limit in degree Celsius for counter flow\n",
+ "mhp = (tc2-tc1)/(th1-th2p) # mass flow rate of hot water in kg/s for parallel flow\n",
+ "mhc = (tc2-tc1)/(th1-th2c) # mass flow rate of hot water in kg/s for counter flow\n",
+ "# At 300 K\n",
+ "h0 = 113.2 # ENthalpy in kJ/kg\n",
+ "s0 = 0.395 # ENtropy in kJ/kgK\n",
+ "T0 = 300.0 # temperature in K\n",
+ "# At 90 degree celsius\n",
+ "h1 = 376.92 # Enthalpy in kJ/kg \n",
+ "s1 = 1.1925 # Entropy in kJ/kgK\n",
+ "af1 = mhp*((h1-h0)-T0*(s1-s0)) # Availability\n",
+ "# Parallel Flow\n",
+ "# At 60 degree\n",
+ "h2 = 251.13 # Enthalpy in kJ/kg \n",
+ "s2 =0.8312 # Entropy in kJ/kgK\n",
+ " # At 25 degree\n",
+ "h3 = 104.89 # Enthalpy in kJ/kg \n",
+ "s3 = 0.3674 # Entropy in kJ/kgK\n",
+ "# At 50 degree\n",
+ "h4 = 209.33 # Enthalpy in kJ/kg \n",
+ "s4 = 0.7038 # Entropy in kJ/kgK\n",
+ "REG = mc*((h4-h3)-T0*(s4-s3)) # Rate of energy gain\n",
+ "REL = mhp*((h1-h2)-T0*(s1-s2)) # Rate of energy loss\n",
+ "Ia = REL-REG # Energy destruction\n",
+ "n2a = REG/REL # Second law efficiency\n",
+ "\n",
+ "print \"\\n Example 9.17\"\n",
+ "print \"\\n In parallel flow\"\n",
+ "print \"\\n The rate of irreversibility is \",Ia ,\" kW\"\n",
+ "print \"\\n The Second law efficiency is \",n2a*100 ,\" percent\"\n",
+ "#The answers vary due to round off error\n",
+ "\n",
+ "\n",
+ "# Counter flow\n",
+ "h2_ = 146.68 \n",
+ "sp = 0.5053 # At 35 degree\n",
+ "REG_b = REG # Rate of energy gain by hot water is same in both flows\n",
+ "REL_b = mhc*((h1-h2_)-T0*(s1-sp))\n",
+ "Ib = mhc*((h1-h2_)-(T0*(s1-sp))) # Energy destruction\n",
+ "n2b = REG_b/Ib # Second law efficiency\n",
+ "print \"\\n\\n In counter flow\"\n",
+ "print \"\\n The rate of irreversibility is \",Ib ,\" kW\"\n",
+ "print \"\\n The Second law efficiency is \",n2b*100 ,\" percent\"\n",
+ "#The answers vary due to round off error\n"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "## Ex9.18:pg-320"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 26,
+ "metadata": {
+ "collapsed": false
+ },
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ " Example 9.18\n",
+ "\n",
+ " The maximum cooling rate is 106.207042424 kW\n"
+ ]
+ }
+ ],
+ "source": [
+ "\n",
+ "m = 50.0# mass flow rate in kg/h\n",
+ "Th = 23.0 # Home temperature in degree Celsius\n",
+ "# State 1\n",
+ "T1 = 150.0 # Saturated vapor temperature in degree Celsius\n",
+ "h1 = 2746.4 # Saturated vapor enthalpy in kJ/kg\n",
+ "s1 = 6.8387 #Saturated vapor entropy in kJ/kgK\n",
+ "# State 2\n",
+ "h2 = 419.0 # Saturated liquid enthalpy in kJ/kg\n",
+ "s2 = 1.3071 #Saturated liquid entropy in kJ/kg \n",
+ "T0 = 45.0 # Atmospheric temperature in degree Celsius\n",
+ "#\n",
+ "b1 = h1-((T0+273)*s1) # Availability at point 1\n",
+ "b2 = h2-((T0+273)*s2) # Availability at point 2\n",
+ "Q_max = m*(b1-b2)/((T0+273)/(Th+273)-1) # maximum cooling rate\n",
+ "\n",
+ "print \"\\n Example 9.18\"\n",
+ "print \"\\n The maximum cooling rate is \",Q_max/3600 ,\" kW\"\n",
+ "\n"
+ ]
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 2",
+ "language": "python",
+ "name": "python2"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 2
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython2",
+ "version": "2.7.11"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 0
+}