{
 "metadata": {
  "name": "",
  "signature": "sha256:13df1b90ea06630bb54a561fa81d4ebbaaa2d68a225d0631603576a208acfb40"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "CHAPTER13:Gas Mixtures"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13.3:Pg-533"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques3\n",
      "#calculating humidity ratio, dew point,mass of air, mass of vapor\n",
      "\n",
      "r=0.70;#relative humidity\n",
      "Pg=5.628;#saturation pressure in kPa\n",
      "Pv=r*Pg;#vapour pressure in kPa\n",
      "P=100;#net pressure kPa \n",
      "Pa=P-Pv;#Partial pressure of air\n",
      "w=0.622*Pv/Pa;#humidity ratio formula\n",
      "V=100;#volume in m^3\n",
      "Ra=0.287;#gas constant for water vapour\n",
      "T=308.2;#Temperature in K\n",
      "ma=Pa*V/(Ra*T);#mass in kg\n",
      "mv=w*ma;#mass of vapour\n",
      "print\" Mass of vapour is\",round(mv,3),\"Kg \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass of vapour is 2.77 Kg \n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13.3E:Pg-533"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques3\n",
      "#calculating humidity ratio, dew point,mass of air, mass of vapor\n",
      "\n",
      "r=0.70;#relative humidity\n",
      "Pg=0.6988 ;#saturation pressure in lbf/in^2\n",
      "Pv=r*Pg;#vapour pressure in lbf/in^2\n",
      "P=14.7;#net pressure in lbf/in^2\n",
      "Pa=P-Pv;#Partial pressure of air\n",
      "w=0.622*Pv/Pa;#humidity ratio formula\n",
      "V=2000;#volume in ft^3\n",
      "Ra=53.34;#gas constant for water vapour\n",
      "T=70;#Temperature in F\n",
      "ma=Pa*V*144/(Ra*(T+480));#mass in lbm\n",
      "mv=w*ma;#mass of vapour\n",
      "print\" Mass of vapour is\",round(mv,2),\"lbm\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Mass of vapour is 2.99 lbm\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13.4:Pg-534"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques4 \n",
      "#calculating amount of water vapour condensed on cooling\n",
      "\n",
      "#from example 3\n",
      "w1=0.0255;#w1=w, humidity ratio at initial temperature\n",
      "ma=108.6;#mass of air in kg\n",
      "P=100;#kPa net pressure\n",
      "#at 5 C mixture is saturated so Pv2=Pg2\n",
      "Pg2=0.8721;\n",
      "Pv2=Pg2;\n",
      "w2=0.622*Pv2/(P-Pg2);\n",
      "mc=ma*(w1-w2);\n",
      "print\"Mass of vapour condense is \",round(mc,3),\"kg \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of vapour condense is  2.175 kg \n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13.4E:Pg-535"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques4 \n",
      "#calculating amount of water vapour condensed on cooling\n",
      "\n",
      "#from example 3 \n",
      "w1=0.02135;#w1=w, humidity ratio at initial temperature\n",
      "ma=139.6;#mass of air in lbm\n",
      "P=14.7;#net pressure in lbf/in^2\n",
      "#at 40 degree F mixture is saturated so Pv2=Pg2\n",
      "Pg2=0.1217 # lbf/in^2\n",
      "Pv2=Pg2;\n",
      "w2=0.622*Pv2/(P-Pg2);# humidity ratio at final temperature\n",
      "mc=ma*(w1-w2); #Mass of vapour condense in lbm\n",
      "print\"Mass of vapour condense is \",round(mc,3),\"lbm \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Mass of vapour condense is  2.256 lbm \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13.5:Pg-536"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques5\n",
      "#calculating heat transfer per kilogram of dry air\n",
      "\n",
      "#1-inlet state\n",
      "#2-Exit state\n",
      "r1=0.80;#realtive humidity at state 1\n",
      "Pg1=4.246;#saturation pressure of vapour in kPa\n",
      "P1=105.0;#net pressure at state 1 in kPa\n",
      "P2=100.0;#net pressure at state 2 in kPa\n",
      "Pv1=r1*Pg1;#partial pressure of vapour in kPa\n",
      "w1=0.622*Pv1/(P1-Pv1);#humidity ratio at state 1\n",
      "r2=0.95;#relative humidity at state 2\n",
      "Pg2=1.7051;#saturation pressure of vapour in kPa\n",
      "Pv2=r2*Pg2;#partial pressure of vapour in kPa\n",
      "w2=0.622*Pv2/(P2-Pv2);#humidity ratio at state 2\n",
      "T1=30.0;#C\n",
      "T2=15.0;#C\n",
      "Cp=1.004;#specific heat of water vapour in kJ/kg\n",
      "hv2=2528.9;#enthalpy of vapourisation of vapour in kJ/kg\n",
      "hv1=2556.3;#enthalpy of vapourisation of vapour in kJ/kg\n",
      "hl2=62.99;#enthalpy of \n",
      "q=Cp*(T2-T1)+w2*hv2-w1*hv1+hl2*(w1-w2);#kJ/kg\n",
      "print\" Heat transferred per unit mass =\",round(q,1),\"kJ/kg of dry air\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Heat transferred per unit mass = -41.7 kJ/kg of dry air\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13.6:Pg-537"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques6\n",
      "#calculating heat transferred in gas vapour mixture\n",
      "\n",
      "#n-Nitrogen\n",
      "#v-water vapour\n",
      "Pn2=1995;#Pressure of nitrogen in kPa\n",
      "V=0.5;#Volume in m^3\n",
      "Rn2=0.2968;#Gas constant for nitrogen in kJ/kg.K\n",
      "Rv=0.4615;#gas constant for vapour\n",
      "T1=323.2;#Temperature in K\n",
      "T2=283.2;#Temperature in K\n",
      "Pv1=5;#Pressure of water vapour in kPa at state 1\n",
      "Pv2=1.2276;#Pressure of water vapour in kPa at state 2\n",
      "mn2=Pn2*V/(Rn2*T1);#mass of nitrogen\n",
      "mv1=Pv1*V/(Rv*T1);#mass of vapour in kg\n",
      "mv2=Pv2*V/(Rv*T2);#mass of vapour in kg\n",
      "ml2=mv1-mv2;#mass of liquid condensed n kg\n",
      "uv1=2443.1;#specific internal energy of vapour in kJ/kg at state 1\n",
      "uv2=2389.2;#specific internal energy of vapour in kJ/kg at state 2\n",
      "ul2=42.0;#specific internal energy of liquid water in kJ/kg\n",
      "Cv=0.745;#specific heat at constant volume in kJ/kg.K\n",
      "Q=mn2*Cv*(T2-T1)+mv2*uv2+ml2*ul2-mv1*uv1;\n",
      "print\"Heat transferred =\",round(Q,2),\"kJ \"\n",
      "\n",
      "#the answer is different in book due to intermediate approximization "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat transferred = -339.1 kJ \n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13.7:Pg-539"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques7\n",
      "#calculating humidity ratio and relative humidity \n",
      "\n",
      "#1-Inlet state\n",
      "#2-Exit state\n",
      "P=100;#net pressure in kPa \n",
      "#it is steady state adiabatic process\n",
      "#water vapour leaving is saturated so Pv2=Pg2\n",
      "Pg2=2.339;#saturation pressure of vapour in kPa\n",
      "Pv2=Pg2;#partial pressure of vapour\n",
      "w2=0.622*Pv2/(P-Pg2);\n",
      "Cpa=1.004;#specific heat n kJ/kg/K\n",
      "T2=20;# final temp in C\n",
      "T1=30;# initial temp in C\n",
      "Hfg2=2454.1;#specific heat difference at state 2 in kJ/kg\n",
      "hv1=2556.3;#enthalpy of water vapour at state 1 in kJ/kg\n",
      "hl2=83.96;#enthalpy of liquid water in kJ/kg\n",
      "w1=(Cpa*(T2-T1)+w2*Hfg2)/(hv1-hl2);\n",
      "print \" Relative humidity =\",round(w1,4)\n",
      "#also w1=0.622*Pv1/(100-Pv2)\n",
      "Pv1=100*w1/(0.622+w1);\n",
      "Pg1=4.246;#saturation pressure at state 1 in kPa\n",
      "r=Pv1/Pg1;#humidity ratio\n",
      "print\" Humidity ratio =\",round(r,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Relative humidity = 0.0107\n",
        " Humidity ratio = 0.3993\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex13.7E:Pg-540"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#ques7\n",
      "#calculating humidity ratio and relative humidity \n",
      "\n",
      "#1-Inlet state\n",
      "#2-Exit state\n",
      "P=14.7;#net pressure in lbf/in^2\n",
      "#it is steady state adiabatic process\n",
      "#water vapour leaving is saturated so Pv2=Pg2\n",
      "Pg2=0.3632;#saturation pressure of vapour in lbf/in^2\n",
      "Pv2=Pg2;#partial pressure of vapour\n",
      "w2=0.622*Pv2/(P-Pg2);\n",
      "Cpa=0.24;#specific heat n Btu/lbm/F\n",
      "T2=70;# final temp in F\n",
      "T1=84;# initial temp in F\n",
      "Hfg2=1054.0;#specific heat difference at state 2 in Btu/lbm\n",
      "hv1=1098.1;#enthalpy of water vapour at state 1 in Btu/lbm\n",
      "hl2=38.1;#enthalpy of liquid water in Btu/lbm\n",
      "w1=(Cpa*(T2-T1)+w2*Hfg2)/(hv1-hl2);\n",
      "print \" Relative humidity =\",round(w1,4)\n",
      "#also w1=0.622*Pv1/(100-Pv2)\n",
      "Pv1=14.7*w1/(0.622+w1);\n",
      "Pg1=0.584;#saturation pressure at state 1 in lbf/in^2\n",
      "r=Pv1/Pg1;#humidity ratio\n",
      "print\" Humidity ratio =\",round(r,4)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " Relative humidity = 0.0125\n",
        " Humidity ratio = 0.4958\n"
       ]
      }
     ],
     "prompt_number": 18
    }
   ],
   "metadata": {}
  }
 ]
}