{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 14 : Real Gases Compressiblity"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 14.1  Page No. 442\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "T1f = 125. ;\t\t\t# Temperature of NH3 -[degree F] \n",
      "T1 =  460. +T1f ;\t\t\t# Temperature NH3 -[degree Rankine] \n",
      "Pg =  292. ;\t\t\t# Pressure of NH3 -[psig]\n",
      "Pa =  Pg+14.7 ;\t\t\t#Pressure of NH3 -[psia]\n",
      "R = 10.73 ;\t\t\t#Universal gas constant-[(psia*cubic feet)/(lb mol*R)]\n",
      "mw_NH3 = 17. ;\t\t# Molecular wt. 1 lb mol NH3-[lb]\n",
      "n = 1/17. ;\t\t\t#[mol]\n",
      "V_tank = 120. ;\t\t# Volume of tank-[cubic feet]\n",
      "\n",
      "# Calculations\n",
      "V_id = (n*R*T1)/Pa ;\t# Specific volume of NH3 treating it ideal gas-[cubic feet/lb]\n",
      "Tc = 729.9 ;\t\t\t#[degree R]\n",
      "Pc = 1636. ;\t\t\t#[psia]\n",
      "Tr =  T1/Tc;\n",
      "Pr =  Pa/Pc;\n",
      "\n",
      "z_real = 0.855;\n",
      "z_ideal = 1.;\n",
      "V_real =  V_id*z_real/z_ideal;\t\t\t# Specific volume of NH3 treating it real gas-[cubic feet/lb]\n",
      "NH3 = V_tank/V_real ;\t\t\t        # Actual amt. of NH3 in tank-[lb]\n",
      "\n",
      "# Results\n",
      "print 'Actual amt. of NH3 in tank is %.0f lb. Therefore , boss is wrong.'%NH3\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Actual amt. of NH3 in tank is 117 lb. Therefore , boss is wrong.\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 14.2  Page No. 444\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "Tc = 154.4 ;\t\t\t#[K]\n",
      "Pc1 = 49.7 ;\t\t\t# [atm]\n",
      "Pc = 101.3 * Pc1;\t\t#[kPa]\n",
      "\n",
      "T_O21 = -25 ;\t\t\t# Temperature-[degree C]\n",
      "T_O2 =  273+T_O21;\t\t#Temperature -[K]\n",
      "R = 8.134 ;\t\t\t    # gas constant-[(cubic metre * kPa)/(kg mol * K)]\n",
      "V_tank = 0.0284 ;\t\t# Volume of tank-[cubic metre]\n",
      "mol_O2 = 32 ;\t\t\t# Kmol. wt. of O2-[kg]\n",
      "m_O2 =  3.5 ;\t\t\t# Mass of liquid O2-[kg]\n",
      "\n",
      "# Calculations\n",
      "V_sp = V_tank * mol_O2/m_O2 ;\t\t\t# Specific molar volume-[m**3/kg]\n",
      "Vc = R * Tc/Pc ;\t\t\t            # [cubic metre/kg mol]\n",
      "Vr = V_sp/Vc;\n",
      "Tr = T_O2/Tc;\n",
      "\n",
      "Pr = 1.43 ;\t\t\t# [kPa]\n",
      "P_O2 = Pr * Pc ;\t# The pressure in the tank -[kPa]\n",
      "\n",
      "# Results\n",
      "print 'The pressure in the tank is %.2f  kPa.'%P_O2\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The pressure in the tank is 7199.49  kPa.\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      " Example 14.3  Page No. 448\n"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# Variables\n",
      "Tc = 100. ;\t\t\t# Temperature  -[degree C] \n",
      "T   =  273 +Tc ;\t# Temperature -[K] \n",
      "P   =  90. ;\t\t# Pressure [atm]\n",
      "R = 82.06 ;\t\t\t# gas constant-[(cubic centimetre * atm)/(g mol * K)]\n",
      "Y_CH4  = 20./100 ;\t\t\t# [mole fraction]\n",
      "Y_C2H4 = 30./100 ;\t\t\t# [mole fraction]\n",
      "Y_N2   =  50./100 ;\t\t\t#[mole fraction]\n",
      "\n",
      "#Additional information from appendix D\n",
      "Tc_CH4 = 191. ;\t\t\t#[K]\n",
      "Pc_CH4 = 45.8 ;\t\t\t# [atm]\n",
      "Tc_C2H4 = 283. ;\t\t#[K]\n",
      "Pc_C2H4 = 50.5 ;\t\t# [atm]\n",
      "Tc_N2 = 126. ;\t\t\t#[K]\n",
      "Pc_N2 = 33.5 ;\t\t\t# [atm]\n",
      "\n",
      "# Calculations & Results\n",
      "#(a)-Ideal gas law\n",
      "V_sp1 = R * T/P ;\t\t\t# Molar volume-[cubic centimetre/g mol]\n",
      " \n",
      "print '(a) The volume per mole of mixture by ideal gas law is %.1f cubic centimetre/g mol.'%V_sp1\n",
      "\n",
      "\t\t\t#(b)\n",
      "Pc_mix = Pc_CH4 * Y_CH4+Pc_C2H4 * Y_C2H4+Pc_N2 * Y_N2;\t\t\t# [atm]\n",
      "Tc_mix = Tc_CH4 * Y_CH4+Tc_C2H4 * Y_C2H4+Tc_N2 * Y_N2 ;\t\t\t# [K]\n",
      "Pr_mix = P/Pc_mix;\n",
      "Tr_mix = T/Tc_mix;\n",
      "\t\t\t# With 2 parameters(Pr_mix and Tr_mix) , you can find from figure 14.4b that z * Tr_mix = 1.91\n",
      "z = 1.91/Tr_mix;\n",
      "V_sp2 = z * R * T/P ;\t\t\t# Molar volume-[cubic centimetre/g mol]\n",
      "print '(b) The volume per mole of mixture by treating it to be real gas is %.1f cubic centimetre/g mol.'%V_sp2\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) The volume per mole of mixture by ideal gas law is 340.1 cubic centimetre/g mol.\n",
        "(b) The volume per mole of mixture by treating it to be real gas is 324.1 cubic centimetre/g mol.\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "code",
     "collapsed": true,
     "input": [],
     "language": "python",
     "metadata": {},
     "outputs": []
    }
   ],
   "metadata": {}
  }
 ]
}