{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 7 : Thermodynamic property relations"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.10  Page No : 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "import math \n",
      "\n",
      "# Variables\n",
      "T2 = 150.   \t\t\t #temperature at which water it is desired to boil water in degree celsius\n",
      "P1 = 0.10133\t\t\t #ambient pressure in MPa\n",
      "T1 = 100.\t    \t\t #temperature at which water boils corresponding at pressure P1 in degree celsius\n",
      "del_hv = 2256.94\t\t #enthalpy of vaporization in kJ/kg\n",
      "R = 8.314;\t\t    \t #universal gas constant in J/molK\n",
      "M = 18*10**-3;\t\t\t #molar mass of water in kg/mol\n",
      "\n",
      "# Calculations\n",
      "T1 = T1+273.15\n",
      "T2 = T2+273.15\n",
      "P2 = P1*(math.exp(((del_hv*10**3*M)*((1./T1)-(1./T2)))/(R)))\n",
      "\n",
      "# Results\n",
      "print \" The approximate pressure at which the boiler is to be operated = %0.3f MPa\"%(P2);\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The approximate pressure at which the boiler is to be operated = 0.476 MPa\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.11  Page No : 259"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "m = 60.         \t\t\t #mass of the person who wants to skate in kg\n",
      "T = -2.\t\t\t             #temperature of the ice in degree celsius\n",
      "A = 15.\t\t\t             #area of contact between the skate edges and ice in mm**2\n",
      "vs = 1.091*10**-3;\t\t\t #specific volume of ice in m**3/kg (at Tref)\n",
      "vf = 1.0*10**-3;\t\t\t #specific volume of water in m**3/kg (at Tref)\n",
      "del_hf = 6.002;\t\t    \t #enthalpy of melting of ice in kJ/mol\n",
      "g = 9.81;\t\t\t         #accleration due to gravity in m/s**2\n",
      "Tref = 0.       \t\t\t #reference temperature at which the specific enthalpy of ice and water are taken in degree celsius\n",
      "\n",
      "# Calculations\n",
      "Tref = Tref+273.15\n",
      "del_P = ((m*g)/(A*10**-6))*10**-6\n",
      "del_v = (vf-vs)*(18*10**-3);\t\n",
      "del_T = (del_P*10**6)/((del_hf*10**3)/(Tref*del_v));\t\t\t \n",
      "\n",
      "# Results\n",
      "print \" The temperature of ice originally  =  %d degree celsius \"%(T);\n",
      "print \" The reduction in melting point of ice due to the additional pressure,computed using the Clayperon equation  =  %0.2f degree celsius \"%(del_T);\n",
      "if del_T<T :\n",
      "    print  \" The ice can melt due to the additional pressure and therefore it will be possible to skate \"\n",
      "else:\n",
      "    print  \" The ice will not melt and therefore it will be difficult to skate \"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The temperature of ice originally  =  -2 degree celsius \n",
        " The reduction in melting point of ice due to the additional pressure,computed using the Clayperon equation  =  -2.93 degree celsius \n",
        " The ice can melt due to the additional pressure and therefore it will be possible to skate \n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.12  Page No : 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 100.\t    \t\t #temperature of water in degree celsius\n",
      "del_hv1 = 2256.94;\t\t\t #enthalpy of vaporization at T1 in kJ/kg\n",
      "T2 = 150.   \t\t\t #temperature at which the enthalpy of vaporization is to be determined in degree celsius\n",
      "Cp_f = 4.26\t    \t\t #isobaric heat capacity of liquid in kJ/kgK\n",
      "Cp_g = 1.388\t\t\t #isobaric heat capacity of vapour in kJ/kgK\n",
      "\n",
      "# Calculations\n",
      "del_hv2 = ((Cp_g-Cp_f)*(T2-T1))+del_hv1\n",
      "\n",
      "# Results\n",
      "print \" The enthalpy of vaporization at 150 degree celsius = %0.2f kJ/kg\"%(del_hv2);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The enthalpy of vaporization at 150 degree celsius = 2113.34 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.13  Page No : 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "T1 = 100.           \t\t\t #temperature of water in degree celsius\n",
      "del_hv1 = 2256.94   \t\t\t #enthalpy of vaporization at T1 in kJ/kg\n",
      "T2 = 150.   \t\t        \t #temperature at which the enthalpy of vaporization is to be determined in degree celsius\n",
      "del_hv_kirchoff = 2113.34\t\t\t #enthalpy of vaporization predicted by the Kirchhoff relation taken from Example 7.12 for comparison, in kJ/kg\n",
      "del_hv_steam_tables = 2113.25\t\t\t #enthalpy of vaporization taken from the steam tables corresponding to T2,for comparison, in kJ/kg\n",
      "Tc = 647.3          \t\t\t #critical temperature of water in K\n",
      "\n",
      "# Calculations\n",
      "T1 = T1+273.15\n",
      "T2 = T2+273.15\n",
      "Tr1 = T1/Tc\n",
      "Tr2 = T2/Tc\n",
      "del_hv2 = del_hv1*(((1-Tr2)/(1-Tr1))**0.38)\n",
      "\n",
      "# Results\n",
      "print \" The enthalpy of vaporization at 150 degree celsius using \";\n",
      "print \" Watson correlation \\t  =  %f kJ/kg\"%(del_hv2);\n",
      "print \" Kirchhoffs relation \\t  =  %f kJ/kg\"%(del_hv_kirchoff);\n",
      "print \" From steam tables \\t  =  %f kJ/kg\"%(del_hv_steam_tables);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The enthalpy of vaporization at 150 degree celsius using \n",
        " Watson correlation \t  =  2090.687877 kJ/kg\n",
        " Kirchhoffs relation \t  =  2113.340000 kJ/kg\n",
        " From steam tables \t  =  2113.250000 kJ/kg\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 7.14  Page No : 262"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# Variables\n",
      "T = 373.15  \t\t\t #normal boiling point of water in K (temperature at which the enthalpy of vaporization is to be determined)\n",
      "Pc = 221.2\t    \t\t #critical pressure of water in bar\n",
      "Tc = 647.3\t\t    \t #critical temperature of water in K\n",
      "R = 8.314\t\t\t     #universal gas constant in J/molK\n",
      "del_hvn_steam_tables = 2256.94\t\t\t #enthalpy of vaporization at the normal boiling point taken from the steam tables, for comparison, in kJ/kg\n",
      "\n",
      "# Calculations\n",
      "Tbr = T/Tc\t\t\t\n",
      "del_hvn = ((1.093*R*Tc*(Tbr*((math.log(Pc)-1.013)/(0.930-Tbr))))*10**-3)/(18*10**-3);\n",
      "err = abs((del_hvn-del_hvn_steam_tables)/del_hvn_steam_tables)*100\n",
      "\n",
      "# Results\n",
      "print \" The enthalpy of vaporization at the normal boiling point \";\n",
      "print \" Using Riedels correlation \\t  =  %f kJ/kg\"%(del_hvn);\n",
      "print \" From the steam tables \\t \\t  =  %f kJ/kg\"%(del_hvn_steam_tables);\n",
      "print \" Error \\t \\t \\t \\t  =  %f %% \"%(err);\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The enthalpy of vaporization at the normal boiling point \n",
        " Using Riedels correlation \t  =  2337.179008 kJ/kg\n",
        " From the steam tables \t \t  =  2256.940000 kJ/kg\n",
        " Error \t \t \t \t  =  3.555212 % \n"
       ]
      }
     ],
     "prompt_number": 7
    }
   ],
   "metadata": {}
  }
 ]
}