{
 "metadata": {
  "name": "",
  "signature": "sha256:5f6a0af8f766f00e3dc6895c71340c9032268be4509d3ee5581830a21a93add3"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5 : Properties of Liquids and Gases"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.1  Page No : 182"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "p = 0.6988; \t\t\t#Unit:psia \t\t\t#absolute pressure\n",
      "vg = 467.7; \t\t\t#Unit:ft**3/lbm \t\t\t#Saturated vapour specific volume\n",
      "ug = 1040.2; \t\t\t#Unit:Btu/lbm \t\t\t#Saturated vapour internal energy\n",
      "J = 778; \t\t\t#J = Conversion factor\n",
      "# 1 Btu  =  778 ft*LBf\n",
      "#h = u+(p*v)/J \n",
      "hg = ug+((p*vg*144)/J); \t\t\t#The enthalpy of saturated steam \t\t\t#1 ft**2 = 144 in**2 \t\t\t#Btu/lbm\n",
      "\n",
      "# Results\n",
      "print \"The enthalpy of saturated steam at 90 F is %.2f Btu/lbm\"%(hg); \t\t\t#The value is matched with the value in table 1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy of saturated steam at 90 F is 1100.69 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.2  Page No : 187"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# given data\n",
      "p = 4.246; \t\t\t#Unit:kPa \t\t\t#absolute pressure\n",
      "vg = 32.894; \t\t\t#Unit:m**3/kg \t\t\t#specific volume\n",
      "ug = 2416.6; \t\t\t#Unit:kJ/kg \t\t\t#internal energy\n",
      "J = 778; \t\t\t#J = Conversion factor\n",
      "# 1 Btu  =  778 ft*LBf\n",
      "#h = u+(p*v)\n",
      "hg = ug+(p*vg); \t\t\t#The enthalpy of saturated steam \t\t\t#1 ft**2 = 144 in**2 \t\t\t#unit:kJ/kg\n",
      "\n",
      "# Results\n",
      "print \"The enthalpy of saturated steam at 30 C is %.2f kJ/kg\"%(hg); \t\t\t#The value is matched with the value in table 1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy of saturated steam at 30 C is 2556.27 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.3  Page No : 188"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#The necessary interpolations are best done in tabular forms as shown:\n",
      "#  p    hg\n",
      "# 115  1190.4  table 2\n",
      "# 118  1190.8  (hg)118 = 1190.8\n",
      "# 120  1191.1\n",
      "hg = 1190.4+(3./5)*(1191.1-1190.4); \t\t\t#Btu/lbm \t\t\t#enthaply\n",
      "print \"The enthalpy of saturated steam at 118 psia is %.2f Btu/lbm\"%(hg);\n",
      "\n",
      "#  p    vg\n",
      "# 115  3.884  table 2\n",
      "# 118  3.792  (vg)118 = 3.790\n",
      "# 120  3.730\n",
      "vg = 3.884-(3./5)*(3.884-3.730); \t\t\t#ft**3/lbm \t\t\t#specific volume\n",
      "print \"The specific volume of saturated steam at 118 psia is %.2f ft**3/lbm\"%(vg);\n",
      "\n",
      "#  p    sg\n",
      "# 115  1.5921  table 2\n",
      "# 118  1.5900  (sg)118 = 1.5900\n",
      "# 120  1.5886\n",
      "sg = 1.5921-(3./5)*(1.5921-1.5886); \t\t\t#entropy\n",
      "print \"The entropy of saturated steam at 118 psia is %.2f\"%(sg);\n",
      "\n",
      "#  p    ug\n",
      "# 115  1107.7  table 2\n",
      "# 118  1108.06  (ug)118 = 1180.1\n",
      "# 120  1108.3\n",
      "ug = 1107.7-(3./5)*(1108.3-1107.7); \t\t\t#internal energy\n",
      "print \"The internal energy of saturated steam at 118 psia is %.2f\"%(ug);\n",
      "#The interpolation process that was done in tabular form for this problem can also be demonstated by refering to figure 5.8 for the specific volume.It will be \n",
      "#seen that the results of this problem and the tabulated values are essentially in exact agreement and that linear interpolation is satisfactory in these tables.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy of saturated steam at 118 psia is 1190.82 Btu/lbm\n",
        "The specific volume of saturated steam at 118 psia is 3.79 ft**3/lbm\n",
        "The entropy of saturated steam at 118 psia is 1.59\n",
        "The internal energy of saturated steam at 118 psia is 1107.34\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.4  Page No : 189"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#By defination,\n",
      "#hg = ug+(p*vg)/J\n",
      "#hf = uf+(p*vf)/J\n",
      "#hfg  =  hg-hf  =  (ug-uf) + p*(vg-vf)/J  =  ufg + p*(vg-vf)/J\n",
      "#From table 2 at 115 psia,\n",
      "p = 115; \t\t\t#Unit:psia \t\t\t#absolute pressure\n",
      "ufg = 798.8; \t\t\t#Unit:Btu/lbm \t\t\t#Evap. internal energy\n",
      "ug = 3.884; \t\t\t#Unit:ft**3/lbm \t\t\t#Saturated vapour internal energy\n",
      "vf = 0.017850; \t\t\t#Unit:ft**3/lbm \t\t\t#Saturated liquid specific volume\n",
      "J = 778; \t\t\t#J = Conversion factor \t\t\t#Unit:ft*lbf/Btu\n",
      "#1 ft**2 = 144 in**2\n",
      "hfg = ufg+(p*144*(ug-vf))/J; \t\t\t#Evap. Enthalpy \t\t\t#Unit:Btu/lbm\n",
      "\n",
      "# Results\n",
      "print \"hfg for saturated steam at 115 psia is %.2f Btu/lbm\"%(hfg); \t\t\t#The tabulated values are matched\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "hfg for saturated steam at 115 psia is 881.09 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.5  Page No : 190"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#From table 2 at 1.0 MPa,\n",
      "p = 1000; \t\t\t#Unit:kN/m**2 \t\t\t#absolute pressure\n",
      "ufg = 1822.0; \t\t\t#Unit:kJ/kg \t\t\t#Evap. internal energy\n",
      "vf = 0.0011273; \t\t\t#Unit:m**3/kg \t\t\t#Saturated liquid specific volume\n",
      "vg = 0.19444; \t\t\t#Unit:m**3/kg \t\t\t#Saturated vapour specific volume\n",
      "\n",
      "# Calculations\n",
      "vfg = vg-vf;  \t\t\t#Evap. specific volume \t\t\t#m**3/kg\n",
      "hfg = ufg+(p*vfg); \t\t\t#Evap. Enthalpy \t\t\t#Unit:kJ/kg\n",
      "\n",
      "# Results\n",
      "print \"hfg for saturated steam at 1.0 MPa is %.2f kJ/kg\"%(hfg); \t\t\t#The tabulated values are matched\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "hfg for saturated steam at 1.0 MPa is 2015.31 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.6  Page No : 190"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#For constant-temperature,reversible vaporization, hfg = deltah = T*deltas = T*sfg\n",
      "hfg = (388.12+460)*(1.1042); \t\t\t#Evap. Enthalpy \t\t\t#Unit:Btu/lbm\n",
      "\n",
      "# Results\n",
      "print \"By considering the process to be a reversible, \\\n",
      "\\nconstant-temperature, hfg for saturated steam at 115 psia is %.2f Btu/lbm\"%(hfg); \t\t\t#ans is wrong in the book\n",
      "#Values are matched with tabulated values.Use of -459.67 F for absolute zero,which is the value used in table,gives almost exact agreement.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "By considering the process to be a reversible, \n",
        "constant-temperature, hfg for saturated steam at 115 psia is 936.49 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.7  Page No : 192"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Umath.sing Table 2 ans a quality of 80%(x = 0.8),we have\n",
      "#at 120 psia\n",
      "x = 0.8;\n",
      "sf = 0.49201; \t\t\t#saturated liquid entropy \t\t\t#Unit:Btu/lbm*R\n",
      "sfg = 1.0966; \t\t\t#Evap. Entropy \t\t\t#Unit:Btu/lbm*R \n",
      "hf = 312.67; \t\t\t#saturated liquid enthalpy \t\t\t#Unit:Btu/lbm \n",
      "hfg = 878.5; \t\t\t#Evap. Enthalpy \t\t\t#Unit:Btu/lbm\n",
      "uf = 312.27; \t\t\t#saturated liquid internal energy \t\t\t#Unit:Btu/lbm \n",
      "ufg = 796.0; \t\t\t#Unit:Btu/lbm \t\t\t#Evap. internal energy\n",
      "vf = 0.017886; \t\t\t#Saturated liquid specific volume \t\t\t#Unit:ft**3/lbm \n",
      "vfg = (3.730-0.017886); \t\t\t#evap. specific volume \t\t\t#Unit:ft**3/lbm \n",
      "sx = sf+(x*sfg); \t\t\t#entropy \t\t\t#Btu/lbm*R\n",
      "print \"Entropy of a wet steam mixture at 120 psia is %.2f Btu/lbm*R\"%(sx);\n",
      "hx = hf+(x*hfg); \t\t\t#enthalpy  \t\t\t#Btu/lbm*R\n",
      "print \"Enthalpy of a wet steam mixture at 120 psia is %.2f Btu/lbm\"%(hx);\n",
      "ux = uf+(x*ufg); \t\t\t#internal energy \t\t\t#Btu/lbm*R\n",
      "print \"Internal energy of a wet steam mixture at 120 psia is %.2f Btu/lbm\"%(ux);\n",
      "vx = vf+(x*vfg); \t\t\t#/specific volume \t\t\t#ft**3/lbm\n",
      "print \"Specific Volume of a wet steam mixture at 120 psia is %.2f ft**3/lbm\"%(vx);\n",
      "#As a check,\n",
      "J = 778; \t\t\t#ft*lbf/Btu \t\t\t#Conversion factor\n",
      "px = 120; \t\t\t#psia \t\t\t#pressure\n",
      "ux = hx-((px*vx*144)/J); \t\t\t#1 ft**2 = 144 in**2 \t\t\t#internal energy\n",
      "print \"As a check\"\n",
      "print \"Internal energy of a wet steam mixture at 120 psia is %.2f Btu/lbm\"%(ux);\n",
      "print \"Which agrees with the values obtained above\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Entropy of a wet steam mixture at 120 psia is 1.37 Btu/lbm*R\n",
        "Enthalpy of a wet steam mixture at 120 psia is 1015.47 Btu/lbm\n",
        "Internal energy of a wet steam mixture at 120 psia is 949.07 Btu/lbm\n",
        "Specific Volume of a wet steam mixture at 120 psia is 2.99 ft**3/lbm\n",
        "As a check\n",
        "Internal energy of a wet steam mixture at 120 psia is 949.11 Btu/lbm\n",
        "Which agrees with the values obtained above\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.8  Page No : 193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Using Table 2 ans a quality of 85%(x = 0.85),we have\n",
      "#at 1.0 MPa\n",
      "x = 0.85;\n",
      "sf = 2.1387; \t\t\t#saturated liquid entropy \t\t\t#Unit:kJ/kg*K\n",
      "sfg = 4.4487; \t\t\t#Evap. Entropy \t\t\t#Unit:kJ/kg*K \n",
      "hf = 762.81; \t\t\t#saturated liquid enthalpy \t\t\t#Unit:kJ/kg\n",
      "hfg = 2015.3; \t\t\t#Evap. Enthalpy \t\t\t#Unit:kJ/kg\n",
      "uf = 761.68; \t\t\t#saturated liquid internal energy \t\t\t#Unit:kJ/kg\n",
      "ufg = 1822.0; \t\t\t#Unit:kJ/kg \t\t\t#Evap. internal energy\n",
      "vf = 1.1273; \t\t\t#Saturated liquid specific volume \t\t\t#Unit:m**3/kg \n",
      "vfg = (194.44-1.1273); \t\t\t#evap. specific volume \t\t\t#Unit:m**3/kg \n",
      "sx = sf+(x*sfg); \t\t\t#entropy \t\t\t#kJ/kg*K\n",
      "print \"Entropy of a wet steam mixture at 1.0 MPa  is %.2f kJ/kg*K\"%(sx);\n",
      "hx = hf+(x*hfg); \t\t\t#enthalpy \t\t\t#kJ/kg*K\n",
      "print \"Enthalpy of a wet steam mixture at 1.0 MPa is %.2f kJ/kg\"%(hx);\n",
      "ux = uf+(x*ufg); \t\t\t#internal energy  \t\t\t#kJ/kg*K\n",
      "print \"Internal energy of a wet steam mixture at 1.0 MPa is %.2f kJ/kg\"%(ux);\n",
      "vx = (vf+(x*vfg))*(0.001); \t\t\t#specific volume \t\t\t#m**3/kg\n",
      "print \"Specific Volume of a wet steam mixture at 1.0 MPa is %.2f m**3/kg\"%(vx);\n",
      "#As a check,\n",
      "px = 10**6; \t\t\t#psia \t\t\t#pressure\n",
      "ux = hx-((px*vx)/10**3); \t\t\t#1 ft**2 = 144 in**2 \t\t\t#internal energy\n",
      "print \"As a check%\"\n",
      "print \"Internal energy of a wet steam mixture at 120 psia is %.2f kJ/kg\"%(ux);\n",
      "print \"Which agrees with the values obtained above\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Entropy of a wet steam mixture at 1.0 MPa  is 5.92 kJ/kg*K\n",
        "Enthalpy of a wet steam mixture at 1.0 MPa is 2475.81 kJ/kg\n",
        "Internal energy of a wet steam mixture at 1.0 MPa is 2310.38 kJ/kg\n",
        "Specific Volume of a wet steam mixture at 1.0 MPa is 0.17 m**3/kg\n",
        "As a check%\n",
        "Internal energy of a wet steam mixture at 120 psia is 2310.37 kJ/kg\n",
        "Which agrees with the values obtained above\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.9  Page No : 193"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#For the wet mixture,hx = hf+(x*hfg),solving for x gives us\n",
      "#Using table 1,we have,\n",
      "hx = 900; \t\t\t#Btu/lbm \t\t\t#Enthalpy of wet mixture at 90F\n",
      "hf = 58.07; \t\t\t#Btu/lbm \t\t\t#saturated liquid enthalpy\n",
      "hfg = 1042.7; \t\t\t#Btu/lbm \t\t\t#Evap. Enthalpy\n",
      "\n",
      "# Calculations\n",
      "x = (hx-hf)/hfg; \t\t\t#quality\n",
      "\n",
      "# Results\n",
      "print \"The quality is %.2f percentage of a wet steam at 90F\"%(x*100);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The quality is 80.75 percentage of a wet steam at 90F\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.10  Page No : 194"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#For the wet mixture,hx = hf+(x*hfg),solving for x gives us\n",
      "#Using table 1,we have,\n",
      "hx = 2000; \t\t\t#kJ/kg \t\t\t#Enthalpy of wet mixture at 30 C\n",
      "hf = 125.79; \t\t\t#kJ/kg \t\t\t#saturated liquid enthalpy\n",
      "hfg = 2430.5; \t\t\t# \t\t\t#Evap. Enthalpy \t\t\t#kJ/kg\n",
      "\n",
      "# Calculations\n",
      "x = (hx-hf)/hfg; \t\t\t#quality\n",
      "\n",
      "# Results\n",
      "print \"The quality is %.2f percentage of a wet steam at 30 C\"%(x*100);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The quality is 77.11 percentage of a wet steam at 30 C\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.11  Page No : 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#The values of temperature and pressure are listed in Table 3(Figure 5.10) and can be read directly.\n",
      "print \"Specific volume of superheated steam at 330 psia and 450F is v = 1.4691 ft**3/lbm\";\n",
      "print \"Internal Energy of superheated steam at 330 psia and 450F is u = 1131.8 Btu/lbm\";\n",
      "print \"Enthalpy of superheated steam at 330 psia and 450F is h = 1221.5 Btu/lbm\";\n",
      "print \"Entropy of superheated steam at 330 psia and 450F is s = 1.5219 Btu/lbm*R\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific volume of superheated steam at 330 psia and 450F is v = 1.4691 ft**3/lbm\n",
        "Internal Energy of superheated steam at 330 psia and 450F is u = 1131.8 Btu/lbm\n",
        "Enthalpy of superheated steam at 330 psia and 450F is h = 1221.5 Btu/lbm\n",
        "Entropy of superheated steam at 330 psia and 450F is s = 1.5219 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.12  Page No : 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#The values of temperature and pressure are listed in Table 3(Figure 5.10) and can be read directly.\n",
      "print \"Specific volume of superheated steam at 2.0 MPa and 240 C is v = 0.10845 m**3/lbm\";\n",
      "print \"Internal Energy of superheated steam at 2.0 MPa and 240 C is u = 2659.6 kJ/kg\";\n",
      "print \"Enthalpy of superheated steam at 2.0 MPa and 240 C is h = 2876.5 kJ/kg\";\n",
      "print \"Entropy of superheated steam at 2.0 MPa and 240 C is s = 6.4952 kJ/kg*K\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific volume of superheated steam at 2.0 MPa and 240 C is v = 0.10845 m**3/lbm\n",
        "Internal Energy of superheated steam at 2.0 MPa and 240 C is u = 2659.6 kJ/kg\n",
        "Enthalpy of superheated steam at 2.0 MPa and 240 C is h = 2876.5 kJ/kg\n",
        "Entropy of superheated steam at 2.0 MPa and 240 C is s = 6.4952 kJ/kg*K\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.13  Page No : 197"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#The necessary interpolations(between 450F and 460F at 330 psia) are best done in tabular forms as shown:\n",
      "#  t    v\n",
      "# 460  1.4945  \n",
      "# 455  1.4818  \n",
      "# 450  1.4691\n",
      "v = 1.4691+(1./2)*(1.4945-1.4691); \t\t\t#ft**3/lbm \t\t\t#specific volume\n",
      "print \"The specific volume of saturated steam at 330 psia & 455F is %.2f ft**3/lbm\"%(v);\n",
      "\n",
      "#  t    u\n",
      "# 460  1137.0  \n",
      "# 455  1134.4  \n",
      "# 450  1131.8 \n",
      "u = 1131.8+(1./2)*(1137.0-1131.8); \t\t\t#Btu/lbm \t\t\t#internal energy\n",
      "print \"The internal energy of saturated steam at 330 psia & 455F is %.2f Btu/lbm\"%(u);\n",
      "\n",
      "#  t    h\n",
      "# 460  1228.2  \n",
      "# 455  1224.9  \n",
      "# 450  1221.5\n",
      "h = 1221.5+(1./2)*(1228.2-1221.5); \t\t\t#enthaply \t\t\t#Btu/lbm\n",
      "print \"The enthalpy of saturated steam at 330 psia & 455F is %.2f Btu/lbm\"%(h);\n",
      "\n",
      "#  t    s\n",
      "# 460  1.5293  \n",
      "# 455  1.5256  \n",
      "# 450  1.5219\n",
      "s = 1.5219+(1./2)*(1.5293-1.5219); \t\t\t#entropy \t\t\t#Btu/lbm*R\n",
      "print \"The entropy of saturated steam at 330 psia & 455F is %.2f Btu/lbm*R\"%(s);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The specific volume of saturated steam at 330 psia & 455F is 1.48 ft**3/lbm\n",
        "The internal energy of saturated steam at 330 psia & 455F is 1134.40 Btu/lbm\n",
        "The enthalpy of saturated steam at 330 psia & 455F is 1224.85 Btu/lbm\n",
        "The entropy of saturated steam at 330 psia & 455F is 1.53 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.14  Page No : 198"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#From Table3, we first obtain the properties at 337 psia and 460 F and then 337 psia and 470 F.\n",
      "#The necessary interpolations are best done in tabular forms as shown:\n",
      "#Proceeding with the calculation,at 460 F,\n",
      "#  p    v                                     \t\t\t#  p    h\n",
      "# 340  1.4448                                 \t\t\t# 340  1226.7\n",
      "# 337  1.4595                                 \t\t\t# 337  1227.2\n",
      "# 335  1.4693                                 \t\t\t# 335  1227.5\n",
      "v = 1.4696-(2./5)*(1.4693-1.4448);                \n",
      "h = 1227.5-(2./5)*(1227.5-1226.7);\n",
      "#ft**3/lbm \t\t\t#specific volume                   \t\t\t#Btu/lbm \t\t\t#enthaply\n",
      "\n",
      "#And at 470 F,\n",
      "#  p    v                                     \t\t\t#  p    h\n",
      "# 340  1.4693                                 \t\t\t# 340  1233.4\n",
      "# 337  1.4841                                 \t\t\t# 337  1233.9\n",
      "# 335  1.4940                                 \t\t\t# 335  1234.2\n",
      "v = 1.4640-(2./5)*(1.4640-1.4693);                \n",
      "h = 1234.2-(2./5)*(1234.2-1233.4);\n",
      "#ft**3/lbm \t\t\t#specific volume                   \t\t\t#Btu/lbm \t\t\t#enthaply\n",
      "\n",
      "#Therefore,at 337 psia and 465 F\n",
      "#  t    v                                    \t\t\t#  t    h\n",
      "# 470  1.4841                                \t\t\t# 470  1233.9\n",
      "# 465  1.4718                                \t\t\t# 465  1230.7\n",
      "# 460  1.4595                                \t\t\t# 460  1227.5\n",
      "v = 1.4595+(1./2)*(1.4841-1.4595);               \n",
      "h = 1227.5+(1./2)*(1233.9-1227.5);\n",
      "#ft**3/lbm \t\t\t#specific volume                  \t\t\t#Btu/lbm \t\t\t#enthaply\n",
      "print \"At 465 F and 337 psia, specific volume = %.2f ft**3/lbm and enthalpy = %.2f Btu/lbm\"%(v,h);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "At 465 F and 337 psia, specific volume = 1.47 ft**3/lbm and enthalpy = 1230.70 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.15  Page No : 202"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#The values of temperature and pressure are listed in Table 4(Figure 5.10) and can be read directly.\n",
      "print \"Specific volume of subcooled water at 1000 psia and 300F is v = 0.017379 ft**3/lbm\";\n",
      "print \"Internal Energy of subcooled water at 1000 psia and 300F is u = 268.24 Btu/lbm\";\n",
      "print \"Enthalpy of subcooled water at 1000 psia and 300F is h = 271.46 Btu/lbm\";\n",
      "print \"Entropy of subcooled water at 1000 psia and 300F is s = 0.43552 Btu/lbm*R\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Specific volume of subcooled water at 1000 psia and 300F is v = 0.017379 ft**3/lbm\n",
        "Internal Energy of subcooled water at 1000 psia and 300F is u = 268.24 Btu/lbm\n",
        "Enthalpy of subcooled water at 1000 psia and 300F is h = 271.46 Btu/lbm\n",
        "Entropy of subcooled water at 1000 psia and 300F is s = 0.43552 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.16  Page No : 202"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#It is necessary to ontain the saturation values corresponding to 300 F.This is done by reading Table A.1 in Appendix 3,which gives\n",
      "pf = 66.98; \t\t\t#psia \t\t\t#pressure\n",
      "vf = 0.017448; \t\t\t#ft**3/lbm \t\t\t#specific volume\n",
      "hf = 269.73; \t\t\t#Btu/lbm \t\t\t#enthaply\n",
      "#Now,\n",
      "p = 1000; \t\t\t#psia \t\t\t#pressure\n",
      "J = 778; \t\t\t#Conversion factor \t\t\t#ft*lbf/Btu\n",
      "#From eq.5.5,\n",
      "h = hf+((p-pf)*vf*144)/J; \t\t\t#1ft**2 = 144 in**2 \t\t\t#The enthalpy of subcooled water \t\t\t#Btu/lbm\n",
      "print \"The enthalpy of subcooled water is %.2f Btu/lbm\"%(h);\n",
      "#The difference between this value and the value found in problem 5.15,expressed as a percentage is\n",
      "percentoferror = (h-271.46)/271.46;\n",
      "print \"Percent of error is %.2f\"%(percentoferror*100);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy of subcooled water is 272.74 Btu/lbm\n",
        "Percent of error is 0.47\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.25  Page No : 211"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#On a chart in Appendix 3,it is necessary to estimate the 90 F point on the saturation line.From the chart or the table in the upper left of the chart,we note that 90 F is between 1.4 and 1.5 in. of mercury.Estimating the intersection of this value with the saturation curve yields\n",
      "print \"Enthalpy of saturated steam hg = 1100 Btu/lbm\";\n",
      "#This is a good agreement with results of problem 5.1\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Enthalpy of saturated steam hg = 1100 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.26  Page No : 212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#The Mollier chart has lines of constant moisture in the wet region which correspond to (1-x).Therefore,we read at 20% moisture(80% Quality) and 120 psia,\n",
      "print \"The enthalpy of a wet steam mixture at 120 psia having quality 80 percent is 1015 Btu/lbm\";\n",
      "#Which also agrees well with the calculated value in problem 5.7\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy of a wet steam mixture at 120 psia having quality 80 percent is 1015 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.27  Page No : 213"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Entering the Mollier chart at 900 Btu/lbm and estimating 90 F(near the 1.5-in. Hg dashed line) yields a constant moisture percent of 19.2%.\n",
      "print \"The quality is %.2f percent\"%((1-0.192)*100);\n",
      "#We show good agreement with the calculated value.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The quality is 80.80 percent\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.28  Page No : 214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#From the chart,\n",
      "print \"The enthalpy of steam at 330 psia is h = 1220 Btu/lbm\";\n",
      "#Compared to 1221.5 Btu/lbm found in problem 5.11\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy of steam at 330 psia is h = 1220 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.29  Page No : 214"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#We note that the steam is superheated.From the Mollier chart in SI units,\n",
      "print \"The enthalpy h = 2876.5 kJ/kg and entropy s = 6.4952 kJ/kg*K\";\n",
      "#Values are matched with problem 5.12\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy h = 2876.5 kJ/kg and entropy s = 6.4952 kJ/kg*K\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.30  Page No : 215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Because neither pressure nor temperature is shown directly,it is necessary to estimate to obtain the desired value.\n",
      "print \"The enthalpy of steam is h = 1231 Btu/lbm\";\n",
      "#In problem 5.14,h = 1230.7 Btu/lbm,Which is matched here.\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy of steam is h = 1231 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.31  Page No : 215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Reading the chart at 30 C and saturation gives us,\n",
      "print \"The enthalpy of saturated steam is hg = 2556 kJ/kg\";\n",
      "#Which matches with value of problem 5.2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The enthalpy of saturated steam is hg = 2556 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.32  Page No : 215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Reading the chart in wet region at 1.0 MPa and x = 0.85(moisture of 15%) gives us\n",
      "print \"hx = 2476 kJ/kg and sx = 5.92 kJ/kg*K\";\n",
      "#The chart does not give ux or vx directly"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "hx = 2476 kJ/kg and sx = 5.92 kJ/kg*K\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.33  Page No : 215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Locate 30 C on the saturation line.Now follow a line of constant pressure,which is also a line of constant temperature in wet region,until an enthalpy of 2000kJ/kg is reached.\n",
      "print \"The moisture content is 23 percent or x = 77 percent\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The moisture content is 23 percent or x = 77 percent\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.34  Page No : 216"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#We enter the chart in the superheat region at 2.0MPa and 240 C to read the enthalpy and entropy.This procedure gives \n",
      "print \"Enthalpy h = 2877 kJ/kg and entropy s = 6.495 kJ/kg*K\";\n",
      "#The other properties cant be obtained directly from the chart\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Enthalpy h = 2877 kJ/kg and entropy s = 6.495 kJ/kg*K\n"
       ]
      }
     ],
     "prompt_number": 27
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.35  Page No : 218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#As already noted,h1 = h2 for this process.On the Mollier chart,h2 is found to be 1170 Btu/lbm at 14.7 psia and 250 F.Proceeding to the left on the chart,the constant-enthalpy value of 1170 Btu/lbm to 150 psia yields a moisture of 3% or a quality of 97%.\n",
      "#If we use the tables to obtain the solution to this problem,we would first obtain h2 from the superheated vapor tables as 1168.8 Btu/lbm.Because hx = hf+(x*hfg),we    obtain x as\n",
      "hx = 1168.8; \t\t\t#Btu/lbm \n",
      "hf = 330.75; \t\t\t#Btu/lbm \t\t\t#values of 150 psia\n",
      "hfg = 864.2; \t\t\t#Btulbm \t\t\t#values of 150 psia\n",
      "x = (hx-hf)/hfg; \t\t\t#Quality\n",
      "print \"Moisture in the steam flowing in the pipe is %.2f percent\"%((1-x)*100);\n",
      "print \"or quality of the steam is %.2f percent\"%(x*100);\n",
      "#very often,it is necessary to perform multiple interpolations if the tables are used,and the Mollier chart yields results within the rquired accuracy for most engineering problems and saves considerable time.\n",
      "#We can also use the computerised programs to solve this program.We first enter the 250F and 14.7 psia to obtain h of 1168.7 Btu/lbm.We then continue by entering h of 1168.7 Btu/lbm and p of 150 psia.The printout gives us x of 0.9699 or 97%.While the computer solution is quick and easy to use,you should still sketch out the    problem on an h-s or T-s diagram to show the path of the process.\n",
      "\n",
      "# Saturation Properties\n",
      "#--------------------------\n",
      "# T = 250.00 degF\n",
      "# P = 29.814 psia\n",
      "#       z         z1        zg\n",
      "# v(ft**3/lbm)   0.01700   13.830\n",
      "# h(Btu/lbm)     218.62   1164.1\n",
      "# s(Btu/lbm*F)  0.3678    1.7001\n",
      "# u(Btu/lbm)    218.52    1087.8\n",
      "\n",
      "#Thermo Properties\n",
      "#------------------------\n",
      "# T =  250.00 degF\n",
      "# P =  14.700 psia\n",
      "# v =  28.417 ft**3/lbm\n",
      "# h =  1168.7 Btu/lbm\n",
      "# s =  1.7831 Btu/lbm*F\n",
      "# u =  1091.4 Btu/lbm\n",
      "\n",
      "# Saturation Properties\n",
      "#--------------------------\n",
      "# T = 340.06 degF\n",
      "# P = 118.00 psia\n",
      "#       z        z1        zg\n",
      "# v(ft**3/lbm)   0.01787   3.7891\n",
      "# h(Btu/lbm)    311.39    1190.7\n",
      "# s(Btu/lbm*F)  0.4904    1.5899\n",
      "# u(Btu/lbm)    311.00    1108.0\n",
      "\n",
      "#Thermo Properties\n",
      "#------------------------\n",
      "# T =  358.49 degF\n",
      "# P =  150.00 psia\n",
      "# v =  2.9248 ft**3/lbm\n",
      "# h =  1168.7 Btu/lbm\n",
      "# s =  1.5384 Btu/lbm*F\n",
      "# u =  1087.5 Btu/lbm\n",
      "# x =  0.9699\n",
      "\n",
      "#Region:Saturated\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Moisture in the steam flowing in the pipe is 3.03 percent\n",
        "or quality of the steam is 96.97 percent\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.36  Page No : 219"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Because the math.tank volume is 10 ft**3,the final specific volume of the steam is 10 ft**3/lbm.Interpolations in Table A.2 yield a final pressure of 42 psia.The heat    added is simply difference in internal energy between the two states.\n",
      "u2 = 1093.0; \t\t\t#internal energy \t\t\t#Btu/lbm\n",
      "u1 = 117.95; \t\t\t#internal energy \t\t\t#Btu/lbm\n",
      "\n",
      "# Calculations\n",
      "q = u2-u1; \t\t\t#heat added \t\t\t#Btu/lbm\n",
      "\n",
      "# Results\n",
      "print \"The final pressure is 42 psia and the heat added is %.2f Btu/lbm\"%(q);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The final pressure is 42 psia and the heat added is 975.05 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.37  Page No : 220"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#The mass in the math.tank is constant,and the heat added will be the change in internal energy of the contents of the math.tank between the two states.The initial mass in     the math.tank is found as follows:\n",
      "Vf = 45; \t\t\t#volume of water \t\t\t#ft**2\n",
      "vf = 0.016715;\n",
      "Vg = 15; \t\t\t#Volume of steam \t\t\t#ft**2\n",
      "vg = 26.80;\n",
      "mf = Vf/vf; \t\t\t#lbm\n",
      "mg = Vg/vg; \t\t\t#lbm\n",
      "total = mf+mg; \t\t\t#total mass\n",
      "#The internal energy is the sum of the internal energy of the liquid plus vapor:\n",
      "ug = 1077.6;\n",
      "uf = 180.1;\n",
      "Ug = mg*ug; \t\t\t#Btu\n",
      "Uf = mf*uf; \t\t\t#Btu\n",
      "Total = Ug+Uf; \t\t\t#total internal energy\n",
      "print \"The total internal energy is %.2f Btu\"%(Total);\n",
      "#Because the mass in the math.tank is constant,the final specific volume must equal the initial specific volume,or\n",
      "vx = (Vf+Vg)/(mf+mg); \t\t\t#ft**3/lbm\n",
      "#But vx = vf+(x*vfg).Therefore Using table A.2 at 800 psia,\n",
      "vx = 0.022282;\n",
      "vf = 0.02087;\n",
      "vfg = 0.5691-0.02087;\n",
      "x = (vx-vf)/vfg;\n",
      "print \"The final amount of vapor is %.2f lbm\"%(x*total);  \t\t\t#x*total mass \n",
      "mg = x*total;\n",
      "print \"The final amount of liquid is %.2f lbm\"%(total-x*total); \t\t\t#total mass minus final amount of vapor \n",
      "mf = total-(x*total);\n",
      "#The final internal energy is found as before:\n",
      "ug = 1115.0;\n",
      "uf = 506.6;\n",
      "Ug = mg*ug; \t\t\t#Btu\n",
      "Uf = mf*uf; \t\t\t#Btu\n",
      "Total1 = Ug+Uf;\n",
      "difference = Total1-Total; \t\t\t#final internal energy-initial internal energy\n",
      "#per unit mass heat added is,\n",
      "print \"The heat added per unit is %.2f Btu/lbm\"%(difference/total); \t\t\t#the difference of internal energy/total mass\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The total internal energy is 485467.03 Btu\n",
        "The final amount of vapor is 6.94 lbm\n",
        "The final amount of liquid is 2685.82 lbm\n",
        "The heat added per unit is 327.88 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.38  Page No : 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#As shown in Fig. 5.21b,the process dscribed in this problem is a vertical line on the Mollier Chart.For 800 psia and 600F,the Mollier chart yeilds h1 = 1270 Btu/lbm and s1 = 1.485.Proceeding vertically down the chart at constant s to 200 psia yields a final enthalpy h2 = 1148 Btu/lbm.The change in enthaly Using the process is        1270-1148 = 122 Btu/lbm.\n",
      "#We may also solve this problem Using the steam tables in Appendix 3.Thus,the enthalpy at 800 psia and 600 F is 1270.4 Btu/lbm,and its entropy is 1.4861 Btu/lbm*R.\n",
      "#Because the process is isentropic,the final entropy at 200psia must be 1.4861.From the saaturation table,the entropy of saturated steam at 200 psia is 1.5464,which indicates the final steam condition must be wet because the entropy of the final steam is less than the entropy of saturation.Using the wet steam relation yields,\n",
      "#sx = sf+(x*sfg)\n",
      "h1 = 1270.4; \n",
      "sx = 1.4861; \n",
      "sf = 0.5440; \n",
      "sfg = 1.0025 ;\n",
      "hf = 355.6; \n",
      "hfg = 843.7;\n",
      "\n",
      "# Calculations\n",
      "x = (sx-sf)/sfg; \t\t\t#Quality\n",
      "#Therefore,the final enthalpy is\n",
      "hx = hf+(x*hfg); \t\t\t#Btu/lbm\n",
      "\n",
      "# Results\n",
      "print \"The final enthalpy is %.2f Btu/lbm\"%(hx);\n",
      "print \"The change in enthalpy is %.2f Btu/lbm\"%(h1-hx); \t\t\t#Note the agreement with the Mollier chart solution\n",
      "#we can also use the computer program to solve this problem.For 600F and 800 psia, h = 1270. Btu/lbm and s = 1.4857 Btu/lbm*R.Now Using p = 200 psia and s = 1.4857,we obtain\n",
      "#h = 1148.1 Btu/lbm.The change in enthalpy is 1270.0-1148.1 = 121.9 Btu/lbm.Note the effort saved Using either the Mollier chart or the computer program. \n",
      "\n",
      "# Saturation Properties\n",
      "#--------------------------\n",
      "# T = 600.00 degF\n",
      "# P = 1541.7 psia\n",
      "#       z        z1         zg\n",
      "# v(ft**3/lbm)   0.02362   0.2675\n",
      "# h(Btu/lbm)    616.59    1166.2\n",
      "# s(Btu/lbm*F)  0.8129    1.3316\n",
      "# u(Btu/lbm)    609.85    1089.9\n",
      "\n",
      "#Thermo Properties\n",
      "#------------------------\n",
      "# T =  600.00 degF\n",
      "# P =  800.00 psia\n",
      "# v =  0. ft**3/lbm\n",
      "# h =  1168.7 Btu/lbm\n",
      "# s =  1.5384 Btu/lbm*F\n",
      "# u =  1087.5 Btu/lbm\n",
      "#Region:Superheated\n",
      "\n",
      "# Saturation Properties\n",
      "#--------------------------\n",
      "# T = 381.87 degF\n",
      "# P = 200.00 psia\n",
      "#       z        z1        zg\n",
      "# v(ft**3/lbm)   0.01839   2.2883\n",
      "# h(Btu/lbm)    355.60    1199.0\n",
      "# s(Btu/lbm*F)  0.5440    1.5462\n",
      "# u(Btu/lbm)    354.92    1114.3\n",
      "\n",
      "#Thermo Properties\n",
      "#------------------------\n",
      "# T =  381.87 degF\n",
      "# P =  200.00 psia\n",
      "# v =  2.1512 ft**3/lbm\n",
      "# h =  1148.1 Btu/lbm\n",
      "# s =  1.4857 Btu/lbm*F\n",
      "# u =  1068.5 Btu/lbm\n",
      "# x =  0.9396\n",
      "\n",
      "#Region:Saturated\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The final enthalpy is 1148.47 Btu/lbm\n",
        "The change in enthalpy is 121.93 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.39  Page No : 226"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#As refering to figure 5.21,it will be seen that the final temperature and enthalpy will both be higher than for the isentropic case.\n",
      "#80% of the isentropic enthalpy difference\n",
      "deltah = 0.8*122; \t\t\t#change in enthalpy \t\t\t#Btu/lbm\n",
      "h1 = 1270; \t\t\t#Btu/lbm \t\t\t#initial enthalpy\n",
      "h2 = h1-deltah; \t\t\t#the final enthalpy \t\t\t#Btu/lbm\n",
      "print \"The final enthalpy is %.2f Btu/lbm\"%(h2);\n",
      "print \"and the final pressure is 200 psia\";\n",
      "print \"The Mollier chart indicates the final state to be in the wet region\"\n",
      "print \"with 3.1percent moisture content and an entropy of 1.514 Btu/lbm*R\";\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The final enthalpy is 1172.40 Btu/lbm\n",
        "and the final pressure is 200 psia\n",
        "The Mollier chart indicates the final state to be in the wet region\n",
        "with 3.1percent moisture content and an entropy of 1.514 Btu/lbm*R\n"
       ]
      }
     ],
     "prompt_number": 33
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.40  Page No : 226"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#Using the Mollier chart,\n",
      "h1 = 2942; \t\t\t#kJ/kg \t\t\t#initial enthalpy\n",
      "#Proceeding as shown in figure 5.21b,that is,vertically at constant entropy to a pressure of 0.1 MPa,gives us\n",
      "h2 = 2512; \t\t\t#kJ/kg \t\t\t#final enthalpy\n",
      "\n",
      "# Results\n",
      "print \"Neglecting kinetic & potential energy, The change in enthalpy of the steam is %.2f kJ/kg\"%(h1-h2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Neglecting kinetic & potential energy, The change in enthalpy of the steam is 430.00 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 35
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.41  Page No : 226"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#From the conditions given in problem 5.38,the isentropic change in enthalpy is 122 Btu/lbm\n",
      "#So,\n",
      "h1minush2 = 122; \t\t\t#Btu/lbm \t\t\t#change in enthalpy\n",
      "J = 778; \t\t\t#Conversion factor\n",
      "gc = 32.17; \t\t\t#lbm*ft/lbf*s**2 \t\t\t#constant of proportionality\n",
      "\n",
      "# Calculations\n",
      "V2 = math.sqrt(2*gc*J*(h1minush2)); \t\t\t#final velocity \t\t\t#ft/s\n",
      "\n",
      "# Results\n",
      "print \"As the steam leaves the nozzle, The final velocity is %.2f ft/s\"%(V2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "As the steam leaves the nozzle, The final velocity is 2471.21 ft/s\n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.42  Page No : 227"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Because the process is irreversible,we cannot show it on the Mollier diagram.However,the analysis of problem 3.22 for the nozzle is still valid,and all that is      needed is the enthalpy at the beginning and the end of the expansion.From the problem 5.38,\n",
      "h1 = 1270; \t\t\t#Btu/lbm \t\t\t#initial enthalpy\n",
      "#For h2 we locate the state point on the Mollier diagram as being saturated vapor at 200 psia.This gives us\n",
      "h2 = 1199; \t\t\t#Btu/lbm \t\t\t#final enthalpy\n",
      "J = 778; \t\t\t#Conversion factor\n",
      "gc = 32.17; \t\t\t#lbm*ft/lbf*s**2 \t\t\t#constant of proportionality\n",
      "V2 = math.sqrt(2*gc*J*(h1-h2)); \t\t\t#final velocity \t\t\t#Ft/s\n",
      "print \"As the steam leaves the nozzle, The final velocity is %.2f ft/s\"%(V2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "As the steam leaves the nozzle, The final velocity is 1885.21 ft/s\n"
       ]
      }
     ],
     "prompt_number": 40
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.43  Page No : 229"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#From the saturation table,500 psia corresponds to a temperature of 467.13F,and the saturated vapor has an enthalpy of 1205.3 Btu/lbm.At 500 psia and 800 F,the       saturated vapor has an enthalpy of 1412.1 Btu/lbm.Because this process is a steady-flow process at constant pressure,the energy equation becomes q = h2-h1,assuming    that differences in the kinetic energy and potential energy terms are negligible.Therefore,\n",
      "h2 = 1412.1; \t\t\t#Btu/lbm \t\t\t#final enthalpy\n",
      "h1 = 1205.3; \t\t\t#Btu/lbm \t\t\t#initial enthalpy\n",
      "\n",
      "# Calculations\n",
      "q = h2-h1; \t\t\t#heat added \t\t\t#Btu/lbm\n",
      "\n",
      "# Results\n",
      "print \"%.2f Btu/lbm heat per pound of steam was added\"%(q);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "206.80 Btu/lbm heat per pound of steam was added\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5.44  Page No : 229"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "#From the saturation table at 1 psia,\n",
      "hf = 69.74; \t\t\t#Btu/lbm \t\t\t#saturated liquid enthalpy\n",
      "hfg = 1036.0; \t\t\t#Btu/lbm \t\t\t#Evap. Enthalpy\n",
      "hg = 1105.8; \t\t\t#Btu/lbm \t\t\t#The enthalpy of saturated steam\n",
      "x = 0.97; \t\t\t#Quality\n",
      "\n",
      "# Calculations and Results\n",
      "#Because the condensation process is carried out at constant pressure,the energy equation is q = deltah.\n",
      "hx = hf+(x*hfg); \t\t\t#the initial enthalpy \t\t\t#Btu/lbm\n",
      "print \"The initial enthalpy is %.2f Btu/lbm\"%(hx);\n",
      "#The final enthalpy is hf = 69.74.So,\n",
      "deltah = hx-hf; \t\t\t#The enthalpy difference \t\t\t#Btu/lbm\n",
      "print \"At 1 psia, The enthalpy difference is %.2f Btu/lbm\"%(deltah);\n",
      "print \"By the computer solution,the enthalpy difference is 1004.6 Btu/lbm\";\n",
      "# Saturation Properties\n",
      "#--------------------------\n",
      "# T = 101.71 degF\n",
      "# P = 1.0000 psia\n",
      "#       z        z1         zg\n",
      "# v(ft**3/lbm)   0.01614   333.55\n",
      "# h(Btu/lbm)    69.725    1105.4\n",
      "# s(Btu/lbm*F)  0.1326    1.9774\n",
      "# u(Btu/lbm)    69.722    1043.6\n",
      "\n",
      "#Thermo Properties\n",
      "#------------------------\n",
      "# T =  101.71 degF\n",
      "# P =  1.0000 psia\n",
      "# v =  323.55 ft**3/lbm\n",
      "# h =  1074.3 Btu/lbm\n",
      "# s =  1.9221 Btu/lbm*F\n",
      "# u =  1014.4 Btu/lbm\n",
      "# x =  0.9700\n",
      "\n",
      "#Region:Saturated\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The initial enthalpy is 1074.66 Btu/lbm\n",
        "At 1 psia, The enthalpy difference is 1004.92 Btu/lbm\n",
        "By the computer solution,the enthalpy difference is 1004.6 Btu/lbm\n"
       ]
      }
     ],
     "prompt_number": 44
    }
   ],
   "metadata": {}
  }
 ]
}