{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 17 :  Two Phase Gas Liquid Systems  Saturation Condensation and Vaporization"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 17.1   Page no. 511\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "F = 1. ;\t\t\t#H2C2O4- [mol]\n",
      "ex_O2 =  248. ;\t\t#Excess air- [%]\n",
      "f_C = 65/100. ;\t\t# Fraction of Carbon which convert to CO2\n",
      "P = 101.3 ;\t\t\t# Atmospheric pressure-[kPa]\n",
      "\n",
      "# Calculations\n",
      "O2_req = F*0.5 ;\t\t\t# O2 required by the above reaction-[mol]\n",
      "O2_in = (1. + ex_O2*F/100)*0.5 ;\t\t\t# Mol. of O2 entering\n",
      "\n",
      "# Use Elemental balance moles of species in output \n",
      "n_CO2 = f_C*2 ;\t\t\t# [mol]\n",
      "n_H2O = (2*F)/2. ;\t\t# From 2H balance-[mol]\n",
      "n_N2 = ((O2_in*0.79)/(0.21)) ;\t\t\t#  From 2N balance-[mol]\n",
      "n_CO = 2-n_CO2 ;\t\t\t             # From C balance-[mol]\n",
      "n_O2 = ((4 + O2_in*2)-(n_H2O + n_CO + 2*n_CO2))/2 ;\t\t\t# From O2 balance-[mol]\n",
      "total_mol = n_CO2 + n_H2O + n_N2 + n_CO + n_O2 ;\t\t\t# Total moles in output stream-[mol]\n",
      "y_H2O = n_H2O/total_mol ;\t# Mole fraction of H2O\n",
      "pp_H2O = y_H2O*P ;\t\t\t# Partial pressure of H2O-[kPa]\n",
      "\n",
      "\n",
      "# Results\n",
      "print 'Partial pressure of H2O %.2f kPa.'%pp_H2O\n",
      "print 'Use partial pressure of H2O to get dew point temperature T from steam table: T  = 316.5 K'\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Partial pressure of H2O 9.10 kPa.\n",
        "Use partial pressure of H2O to get dew point temperature T from steam table: T  = 316.5 K\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 17.2  Page no. 517\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "gas =  1. ;\t\t\t# Entering gas-[g mol]\n",
      "T = 26. ;\t\t\t# Temperature (for isothermal process)-[degree C]\n",
      "vp =  99.7 ;\t\t\t# vapour pressure of benzene at 26 C-[mm of Hg]\n",
      "\n",
      "# Analysis of entering gas \n",
      "f_C6H6 = 0.018 ;\t\t\t# Mol fraction of benzene\n",
      "f_air  =  0.982 ;\t\t\t# Mol fraction of air\n",
      "mol_C6H6 = 0.018*gas ;\t\t# Moles  of benzene-[g mol]\n",
      "mol_air  =  0.982*gas ;\t\t# Moles  of air-[g mol]\n",
      "\n",
      "# Calculations\n",
      "# Analysis of exit gas\n",
      "C6H6_rec =  95./100 ;\t\t\t# Fraction of benzene recovered\n",
      "C6H6_out  = 1-C6H6_rec ;\t\t#Fraction of benzene in exit stream\n",
      "C6H6_out = mol_C6H6*C6H6_out ;\t#Moles of benzene in exit stream-[g mol]\n",
      "air_out = mol_air ;\t\t\t    #Moles of air in exit stream-[g mol]\n",
      "total_mol = C6H6_out+air_out ;\t# Total moles in exit stream\n",
      "y_C6H6_out = C6H6_out/total_mol ;\t\t\t# Mole fraction of benzene in exit\n",
      "P = vp/y_C6H6_out ;\t\t\t                # Pressure total of exit\n",
      "\n",
      "# Results\n",
      "print ' Pressure total at exit of compressor %.2e mm of Hg.'%P\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Pressure total at exit of compressor 1.09e+05 mm of Hg.\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 17.3   Page no. 519\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "ex_air = .4 ;\t\t\t# Fraction of excess air required\n",
      "w_C = 12. ;\t\t\t    # Mol. wt. of C-[g]\n",
      "mol_C = 71./w_C ;\t\t#[kg mol]\n",
      "w_H2 = 2.016 ;\t\t\t# Mol. wt. of H2 - [g] \n",
      "mol_H2 = 5.6/w_H2;\n",
      "air_O2 = 0.21;\t\t\t# Fraction of O2 in air\n",
      "air_N2 = 0.79;\t\t\t# Fraction of N2 in air\n",
      "\n",
      "# Calculations\n",
      "CO2_1 = 1. ;\t\t\t#  By Eqn. (a) CO2 produced -[kg mol]\n",
      "H2O_1 = 2. ;\t\t\t# By Eqn. (a) H2O produced -[kg mol]\n",
      "Req_O2_1 = 2. ;\t\t\t# By Eqn. (a) -[kg mol]\n",
      "ex_O2_1 = Req_O2_1*ex_air  ;\t\t\t# Excess O2 required -[kg mol]\n",
      "O2_1 = Req_O2_1 + ex_O2_1 ;\t\t\t    # Total O2 required - [kg mol]\n",
      "N2_1 = O2_1*(air_N2/air_O2) ;\t\t\t#Total N2 required - [kg mol]\n",
      "Total_1 = CO2_1 + H2O_1 + N2_1 + ex_O2_1 ;\t\t\t# Total gas produced- [kg mol]\n",
      "\n",
      "CO2_2 = 1 ;\t\t\t#  By Eqn. (a) CO2 produced -[kg mol]\n",
      "H2O_2 = mol_H2/mol_C ;\t\t\t# By Eqn. (a) H2O produced -[kg mol]\n",
      "Req_O2_2 = 1 + (mol_H2/mol_C)*(1./2) ;\t\t\t# By Eqn. (b) and (c) -[kg mol]\n",
      "ex_O2_2 = Req_O2_2*ex_air  ;\t\t\t# Excess O2 required -[kg mol]\n",
      "O2_2 = Req_O2_2 + ex_O2_2; \t\t\t# Total O2 required - [kg mol]\n",
      "N2_2 = O2_2*(air_N2/air_O2); \t\t\t#Total N2 required - [kg mol]\n",
      "Total_2 = CO2_2 + H2O_2 + N2_2 + ex_O2_2 ;\t\t\t# Total gas produced- [kg mol]\n",
      "\n",
      "P = 100. ;\t\t\t# Total pressure -[kPa]\n",
      "p1 = P*(H2O_1/Total_1) ;\t\t\t# Partial pressure of water vapour in natural gas - [kPa]\n",
      "Eq_T1 = 52.5  ;\t\t\t# Equivalent temperature -[degree C]\n",
      "p2 = P*(H2O_2/Total_2) ;\t\t\t# Partial pressure of water vapour in coal - [kPa]\n",
      "Eq_T2 = 35  ;\t\t\t# Equivalent temperature -[degree C]\n",
      "\n",
      "# Results\n",
      "print '                                Natural gas                         Coal'\n",
      "print '                            ----------------------             --------------------'\n",
      "print 'Partial pressure:                %.1f kPa                            %.1f kPa'%(p1,p2 )\n",
      "print 'Equivalent temperature:          %.1f C                              %.1f C'%(Eq_T1,Eq_T2 );\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "                                Natural gas                         Coal\n",
        "                            ----------------------             --------------------\n",
        "Partial pressure:                14.0 kPa                            5.5 kPa\n",
        "Equivalent temperature:          52.5 C                              35.0 C\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 17.4  Page no. 522\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "F = 30. ;\t\t\t# Volume of initial gas-[m**3]\n",
      "P_F =  98.6 ;\t\t\t# Pressure of gas-[kPa]\n",
      "T_F =  273.+100 ;\t\t\t# Temperature of gas-[K]\n",
      "P_p = 109. ;\t\t\t#[kPa]\n",
      "T_p = 14.+273 ;\t\t\t# Temperature of gas-[K]\n",
      "R = 8.314 ;\t\t\t# [(kPa*m**3)/(k mol*K)] \n",
      "# Additional condition\n",
      "vpW_30 = 4.24 ;\t\t\t#Vapour pressure-[kPa]\n",
      "vpW_14 = 1.60 ;\t\t\t#Vapour pressure-[kPa]\n",
      "n_F = (P_F*F)/(R*T_F) ;\t\t\t# Number of moles in F\n",
      "\n",
      "# Calculations\n",
      "# Material balance to calculate  P & W\n",
      "P = (n_F*((P_F-vpW_30)/P_F))/((P_p-vpW_14)/P_p) ;\t\t\t# P from mat. bal. of air -[kg mol]\n",
      "W = (n_F*(vpW_30/P_F))- P*(vpW_14/P_p); \t\t\t# W from mat. bal. of water -[kg mol]\n",
      "iW = n_F*(vpW_30/P_F) ;\t\t\t# Initial amount of water -[kg mol]\n",
      "fr_con = W/iW ;\t\t\t#Fraction of water condenseed \n",
      "\n",
      "# Results\n",
      "print ' Fraction of water condenseed %.3f.'%fr_con\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Fraction of water condenseed 0.668.\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 17.5  Page no. 527\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "P =  100. ;\t\t\t# Pressure of air-[kPa]\n",
      "T =  20. + 273 ;\t\t\t# Temperature of air-[K]\n",
      "R = 8.314 ;\t\t\t# [(kPa*m**3)/(k mol*K)] \n",
      "EOH =  6 ;\t\t\t# Amount of ethyl alcohol to evaporate-[kg]\n",
      "mw_EOH = 46.07 ;\t\t\t# Mol.wt. of 1 k mol ethyl alcohol-[kg]\n",
      "\t\t\t\n",
      "# Calculations\n",
      "# Additional data needed\n",
      "vp_EOH = 5.93 ;\t\t\t# Partial pressure of alcohol at 20 C-[kPa]\n",
      "vp_air = P-vp_EOH ;\t\t\t# Partial pressure of air at 20 C-[kPa]\n",
      "n_EOH  = EOH/mw_EOH ;\t\t\t#Moles of ethyl alcohol -[kg mol]\n",
      "n_air = (n_EOH*vp_air)/vp_EOH ;\t\t\t# Moles of air -[kg mol]\n",
      "V_air = n_air*R*T/P ;\t\t\t# Volume of air required\n",
      "\n",
      "# Results\n",
      "print ' Volume of air required to evaporate 6 kg of ethyl alcohol is %.1f cubic metre . '%V_air\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Volume of air required to evaporate 6 kg of ethyl alcohol is 50.3 cubic metre . \n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 17.6  Page no. 529\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "# Variables\n",
      "P =  760. ;\t\t\t# Pressure -[ mm of Hg]\n",
      "vp = 40. ;\t\t\t# vapour pressure of n-heptane-[mm of Hg]\n",
      "\n",
      "# Calculations\n",
      "K = 10**((math.log10(vp/P)-0.16)/1.25) ;\n",
      "x = 0.5 ;\t\t\t# mole fraction after  t_half\n",
      "x0 = 1. ;\t\t\t# initial mole fraction \n",
      "t_half = (math.log(x/x0))/(-K);\t\t\t# Time required to reduce the concentration to one-half-[min]\n",
      "\n",
      "# Results\n",
      "print 'Time required to reduce the concentration to one-half is %.1f min. '%t_half\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Time required to reduce the concentration to one-half is 9.8 min. \n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "code",
     "collapsed": true,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}