{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Chapter 11 The ideal gas and mixture relationship" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.1 Pg:415" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Work done = -58682 ft-lbf/lbm\n", "The answer is a bit different due to rounding off error in textbook\n" ] } ], "source": [ "#Initialization of variables\n", "n=1.3\n", "T1=460+60 #R\n", "P1=14.7 #psia\n", "P2=125 #psia\n", "R=1545\n", "M=29\n", "#calculations\n", "T2=T1*(P2/P1)**((n-1)/n)\n", "wrev=R/M *(T2-T1)/(1-n)\n", "#results\n", "print \"Work done = %d ft-lbf/lbm\"%(wrev)\n", "print \"The answer is a bit different due to rounding off error in textbook\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.2 Pg:415" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Change in kinetic energy = 52.3 Btu/lbm\n" ] } ], "source": [ "#Initialization of variables\n", "P2=10 #psia\n", "P1=100 #psia\n", "T1=900 #R\n", "w=50 #Btu/lbm\n", "k=1.39\n", "cp=0.2418\n", "#calculations\n", "T2=T1*(P2/P1)**((k-1)/k)\n", "T2=477\n", "KE=-w-cp*(T2-T1)\n", "#results\n", "print \"Change in kinetic energy = %.1f Btu/lbm\"%(KE)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.3 Pg:416" ] }, { "cell_type": "code", "execution_count": 3, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From table B-9\n", "Final temperature = 468 R \n" ] } ], "source": [ "#Initialization of variables\n", "T1=900 #R\n", "P1=100 #psia\n", "P2=10 #psia\n", "#calculations\n", "print \"From table B-9\"\n", "pr1=8.411\n", "pr2=pr1*P2/P1\n", "T2=468 #R\n", "#results\n", "print \"Final temperature = %d R \"%(T2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.4 Pg:417" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "from table b-9\n", "final temperature = 1050 R\n", "\n", " final pressure = 177.7 psia\n", "\n", " work done = -92.85 Btu/lbm\n", "\n", " final enthalpy = 253.4 Btu/lbm\n" ] } ], "source": [ "#Initialization of variables\n", "cr=6\n", "p1=14.7 #psia\n", "t1=60.3 #F\n", "M=29\n", "R=1.986\n", "#calculations\n", "print \"from table b-9\"\n", "vr1=158.58 \n", "u1=88.62 #Btu/lbm\n", "pr1=1.2147\n", "vr2=vr1/cr\n", "T2=1050 #R\n", "u2=181.47 #Btu/lbm\n", "pr2=14.686\n", "p2=p1*(pr2/pr1)\n", "dw=u1-u2\n", "h2=u2+T2*R/M\n", "#results\n", "print \"final temperature = %d R\"%(T2)\n", "print \"\\n final pressure = %.1f psia\"%(p2)\n", "print \"\\n work done = %.2f Btu/lbm\"%(dw)\n", "print \"\\n final enthalpy = %.1f Btu/lbm\"%(h2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.5 Pg:417" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "part a\n", "Mole fractions of oxygen and nitrogen are 0.369 and 0.631 respectively\n", "part b\n", "Average molecular weight = 29.5 \n", "part c\n", "specific gas constant = 0.3639 psia ft**3/lbm R\n", "part d\n", "volume of mixture = 94.6 ft**3\n", "density of mixture is 0.00896 mole/ft**3 and 0.26 lbm/ft**3\n", "part e\n", "partial pressures of oxygen and nitrogen are 18.43 psia and 31.57 psia respectively\n", "part a\n", "Mole fractions of oxygen and nitrogen are 0.369 and 0.631 respectively\n", "part b\n", "Average molecular weight = 29.5 \n", "part c\n", "specific gas constant = 52.3960 lbf ft/lbm R\n", "part d\n", "volume of mixture = 94.6 ft**3\n", "\n", " density of mixture is 0.00896 mole/ft**3 and 0.264 lbm/ft**3\n", "part e\n", "partial pressures of oxygen and nitrogen are 18.43 psia and 31.57 psia respectively\n", "\n", " partial volumes of oxygen and nitrogen are 34.87 ft**3 and 59.74 ft**3 respectively\n", "\n", " Net partial pressure in case of oxygen = 50.00 psia\n", "\n", " Net partial volume =94.61 ft**3\n" ] } ], "source": [ "from __future__ import division\n", "#Initialization of variables\n", "m1=10 #lbm\n", "m2=15 #lnm\n", "p=50 #psia\n", "t=60+460 #R\n", "M1=32\n", "M2=28.02\n", "R0=10.73 \n", "#calculations\n", "n1=m1/M1\n", "n2=m2/M2\n", "x1=n1/(n1+n2)\n", "x2=n2/(n1+n2)\n", "M=x1*M1+x2*M2\n", "R=R0/M\n", "V=(n1+n2)*R0*t/p\n", "rho=p/(R0*t)\n", "rho2=M*rho\n", "p1=x1*p\n", "p2=x2*p\n", "v1=x1*V\n", "v2=x2*V\n", "#results\n", "print \"part a\"\n", "print \"Mole fractions of oxygen and nitrogen are %.3f and %.3f respectively\"%(x1,x2)\n", "print \"part b\"\n", "print \"Average molecular weight = %.1f \"%(M)\n", "print \"part c\"\n", "print \"specific gas constant = %.4f psia ft**3/lbm R\"%(R)\n", "print \"part d\"\n", "print \"volume of mixture = %.1f ft**3\"%(V)\n", "print \"density of mixture is %.5f mole/ft**3 and %.2f lbm/ft**3\"%(rho,rho2)\n", "print \"part e\"\n", "print \"partial pressures of oxygen and nitrogen are %.2f psia and %.2f psia respectively\"%(p1,p2)\n", "#Initialization of variables\n", "m1=10 #lbm\n", "m2=15 #lnm\n", "p=50 #psia\n", "t=60+460 #R\n", "M1=32\n", "M2=28.02\n", "R0=10.73 \n", "#calculations\n", "n1=m1/M1\n", "n2=m2/M2\n", "x1=n1/(n1+n2)\n", "x2=n2/(n1+n2)\n", "M=x1*M1+x2*M2\n", "R=1545/M\n", "V=(n1+n2)*R0*t/p\n", "rho=p/(R0*t)\n", "rho2=M*rho\n", "p1=x1*p\n", "p2=x2*p\n", "v1=x1*V\n", "v2=x2*V\n", "pt=p1+p2\n", "vt=v1+v2\n", "#results\n", "print \"part a\"\n", "print \"Mole fractions of oxygen and nitrogen are %.3f and %.3f respectively\"%(x1,x2)\n", "print \"part b\"\n", "print \"Average molecular weight = %.1f \"%(M)\n", "print \"part c\"\n", "print \"specific gas constant = %.4f lbf ft/lbm R\"%(R)\n", "print \"part d\"\n", "print \"volume of mixture = %.1f ft**3\"%(V)\n", "print \"\\n density of mixture is %.5f mole/ft**3 and %.3f lbm/ft**3\"%(rho,rho2)\n", "print \"part e\"\n", "print \"partial pressures of oxygen and nitrogen are %.2f psia and %.2f psia respectively\"%(p1,p2)\n", "print \"\\n partial volumes of oxygen and nitrogen are %.2f ft**3 and %.2f ft**3 respectively\"%(v1,v2)\n", "print \"\\n Net partial pressure in case of oxygen = %.2f psia\"%(pt)\n", "print \"\\n Net partial volume =%.2f ft**3\"%(vt)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.6 Pg:418" ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "From gravimetric analysis, co2 = 17.6 percent , o2 = 4.3 percent and n2 = 78.2 percent\n", "\n", " From ultimate analysis, co2 = 0.00 percent , o2 = 4.26 percent and n2 = 78.19 percent\n", "\n", " Sum in case 1 = 100.0 percent\n", "\n", " Sum in case 2 = 82.4 percent\n" ] } ], "source": [ "#Initialization of variables\n", "m1=5.28\n", "m2=1.28\n", "m3=23.52\n", "#calculations\n", "m=m1+m2+m3\n", "x1=m1/m\n", "x2=m2/m\n", "x3=m3/m\n", "C=12/44 *m1/ m\n", "O=(32/44 *m1 + m2)/m\n", "N=m3/m\n", "sum1=(x1+x2+x3)*100\n", "sum2=(C+N+O)*100\n", "#results\n", "print \"From gravimetric analysis, co2 = %.1f percent , o2 = %.1f percent and n2 = %.1f percent\"%(x1*100,x2*100,x3*100)\n", "print \"\\n From ultimate analysis, co2 = %.2f percent , o2 = %.2f percent and n2 = %.2f percent\"%(C*100,O*100,N*100)\n", "print \"\\n Sum in case 1 = %.1f percent\"%(sum1)\n", "print \"\\n Sum in case 2 = %.1f percent\"%(sum2)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.7 Pg:419" ] }, { "cell_type": "code", "execution_count": 5, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Entropy of mixture = 8.27 Btu/R\n", "\n", " the answer given in textbook is wrong. please check using a calculator\n" ] } ], "source": [ "from __future__ import division\n", "from scipy import log\n", "#Initialization of variables\n", "x1=1/3\n", "n1=1\n", "n2=2\n", "x2=2/3\n", "p=12.7 #psia\n", "cp1=7.01 #Btu/mole R\n", "cp2=6.94 #Btu/mole R\n", "R0=1.986\n", "T2=460+86.6 #R\n", "T1=460 #R\n", "p0=14.7 #psia\n", "#calculations\n", "p1=x1*p\n", "p2=x2*p\n", "ds1= cp1*log(T2/T1) - R0*log(p1/p0)\n", "ds2= cp2*log(T2/T1) - R0*log(p2/p0)\n", "S=n1*ds1+n2*ds2\n", "#results\n", "print \"Entropy of mixture = %.2f Btu/R\"%(S)\n", "print \"\\n the answer given in textbook is wrong. please check using a calculator\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.8 Pg:420" ] }, { "cell_type": "code", "execution_count": 6, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Change in internal energy = -547 Btu\n", "\n", " Change in entropy = -1.037 Btu/R\n" ] } ], "source": [ "from __future__ import division\n", "from scipy import log\n", "\n", "#Initialization of variables\n", "c1=4.97 #Btu/mol R\n", "c2=5.02 #Btu/mol R\n", "n1=2\n", "n2=1\n", "T1=86.6+460 #R\n", "T2=50+460 #R\n", "#calculations\n", "du=(n1*c1+n2*c2)*(T2-T1)\n", "ds=(n1*c1+n2*c2)*log(T2/T1)\n", "#results\n", "print \"Change in internal energy = %d Btu\"%(du)\n", "print \"\\n Change in entropy = %.3f Btu/R\"%(ds)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.9 Pg:420" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Pressure of mixture = 12.7 psia\n", "\n", " Mixing temperature = 86.6 F\n" ] } ], "source": [ "from __future__ import division\n", "\n", "#Initialization of variables\n", "n1=1\n", "n2=2\n", "c1=5.02\n", "c2=4.97\n", "t1=60 #F\n", "t2=100 #F\n", "R0=10.73\n", "p1=30 #psia\n", "p2=10 #psia\n", "#calcualtions\n", "t=(n1*c1*t1+n2*c2*t2)/(n1*c1+n2*c2)\n", "V1= n1*R0*(t1+460)/p1\n", "V2=n2*R0*(t2+460)/p2\n", "V=V1+V2\n", "pm=(n1+n2)*R0*(t+460)/V\n", "#results\n", "print \"Pressure of mixture = %.1f psia\"%(pm)\n", "print \"\\n Mixing temperature = %.1f F\"%(t)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.10 Pg:421" ] }, { "cell_type": "code", "execution_count": 8, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Change in entropy for gas 1 = 4.242 Btu/R\n", "\n", " Change in entropy for gas 1 = 0.331 Btu/R\n", "\n", " Net change in entropy = 4.572 Btu/R\n", "\n", " In case 2, change in entropy = 4.572 Btu/R\n", "The answer is a bit different due to rounding off error in the textbook\n" ] } ], "source": [ "from __future__ import division\n", "from scipy import log\n", "\n", "#Initialization of variables\n", "T2=546.6 #R\n", "T1=520 #R\n", "T3=560 #R\n", "v2=1389.2\n", "v1=186.2\n", "R0=1.986\n", "c1=5.02\n", "c2=4.97\n", "n1=1\n", "n2=2\n", "v3=1203\n", "#calculations\n", "ds1=n1*c1*log(T2/T1) + n1*R0*log(v2/v1)\n", "ds2=n2*c2*log(T2/T3)+n2*R0*log(v2/v3)\n", "ds=ds1+ds2\n", "ds3=n1*c1*log(T2/T1)+n2*c2*log(T2/T3)\n", "ds4=n2*R0*log(v2/v3)+ n1*R0*log(v2/v1)\n", "dss=ds3+ds4\n", "#results\n", "print \"Change in entropy for gas 1 = %.3f Btu/R\"%(ds1)\n", "print \"\\n Change in entropy for gas 1 = %.3f Btu/R\"%(ds2)\n", "print \"\\n Net change in entropy = %.3f Btu/R\"%(ds)\n", "print \"\\n In case 2, change in entropy = %.3f Btu/R\"%(dss)\n", "print \"The answer is a bit different due to rounding off error in the textbook\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.11 Pg:42" ] }, { "cell_type": "code", "execution_count": 9, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Final remperature = 851 R\n", "\n", " Change in entropy of air = -0.115 btu/mole R and -0.00395 Btu/R\n", "\n", " Change in entropy of water = 0.0757 btu/mole R and 0.00395 Btu/R\n", "The answers are a bit different due to rounding off error in textbook\n" ] } ], "source": [ "from __future__ import division\n", "from scipy import log\n", "\n", "#Initialization of variables\n", "m1=1 #lbm\n", "m2=0.94 #lbm\n", "M1=29\n", "M2=18\n", "p1=50 #psia\n", "p2=100 #psia\n", "t1=250 +460 #R\n", "R0=1.986\n", "cpa=6.96\n", "cpb=8.01\n", "#calculations\n", "xa = (m1/M1)/((m1/M1)+ m2/M2)\n", "xb=1-xa\n", "t2=t1*(p2/p1)**(R0/(xa*cpa+xb*cpb))\n", "d=R0/(xa*cpa+xb*cpb)\n", "k=1/(1-d)\n", "dsa=cpa*log(t2/t1) -R0*log(p2/p1)\n", "dSa=(m1/M1)*dsa\n", "dSw=-dSa\n", "dsw=dSw*M2/m2\n", "#results\n", "print \"Final remperature = %d R\"%(t2)\n", "print \"\\n Change in entropy of air = %.3f btu/mole R and %.5f Btu/R\"%(dsa,dSa)\n", "print \"\\n Change in entropy of water = %.4f btu/mole R and %.5f Btu/R\"%(dsw,dSw)\n", "print \"The answers are a bit different due to rounding off error in textbook\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.12 Pg:423" ] }, { "cell_type": "code", "execution_count": 11, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "In case 1, volume occupied = 13.02 ft**3\n", "\n", " In case 1, mass of steam = 0.94 lbm steam\n", "\n", " In case 2, mass of steam = 0.918 lbm steam\n" ] } ], "source": [ "from __future__ import division\n", "\n", "#Initialization of variables\n", "T=250 + 460 #R\n", "p=29.825 #psia\n", "pt=50 #psia\n", "vg=13.821 #ft**3/lbm\n", "M=29\n", "R=10.73\n", "#calculations\n", "pa=pt-p\n", "V=1/M *R*T/pa\n", "ma=V/vg\n", "xa=p/pt\n", "mb=xa/M *18/(1-xa)\n", "#results\n", "print \"In case 1, volume occupied = %.2f ft**3\"%(V)\n", "print \"\\n In case 1, mass of steam = %.2f lbm steam\"%(ma)\n", "print \"\\n In case 2, mass of steam = %.3f lbm steam\"%(mb)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.13 Pg:424" ] }, { "cell_type": "code", "execution_count": 12, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "percentage = 65.0 percent\n" ] } ], "source": [ "from __future__ import division\n", "\n", "#Initialization of variables\n", "ps=0.64 #psia\n", "p=14.7 #psia\n", "M=29\n", "M2=46\n", "#calculations\n", "xa=ps/p\n", "mb=xa*9/M *M2/(1-xa)\n", "#results\n", "print \"percentage = %.1f percent\"%(mb*100)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Ex:11.14 Pg:424" ] }, { "cell_type": "code", "execution_count": 13, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "partial pressure of water vapor = 0.317 psia\n" ] } ], "source": [ "from __future__ import division\n", "\n", "#Initialization of variables\n", "ps=0.5069 #psia\n", "p=20 #psia\n", "m1=0.01\n", "m2=1\n", "M1=18\n", "M2=29\n", "#calculations\n", "xw= (m1/M1)/(m1/M1+m2/M2)\n", "pw=xw*p\n", "#results\n", "print \"partial pressure of water vapor = %.3f psia\"%(pw)" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.9" } }, "nbformat": 4, "nbformat_minor": 0 }