diff options
Diffstat (limited to 'Thermodynamics_for_Engineers/Chapter_13_1.ipynb')
-rwxr-xr-x | Thermodynamics_for_Engineers/Chapter_13_1.ipynb | 667 |
1 files changed, 0 insertions, 667 deletions
diff --git a/Thermodynamics_for_Engineers/Chapter_13_1.ipynb b/Thermodynamics_for_Engineers/Chapter_13_1.ipynb deleted file mode 100755 index 388f458f..00000000 --- a/Thermodynamics_for_Engineers/Chapter_13_1.ipynb +++ /dev/null @@ -1,667 +0,0 @@ -{
- "metadata": {
- "name": "",
- "signature": "sha256:390a761bad4c193a32a4fcd413c61db0b9a1c29b46bfad9c3be94c1204cb558b"
- },
- "nbformat": 3,
- "nbformat_minor": 0,
- "worksheets": [
- {
- "cells": [
- {
- "cell_type": "heading",
- "level": 1,
- "metadata": {},
- "source": [
- "Chapter 13 - Nonreactive and reactive gaseous mixtures"
- ]
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 1 - Pg 271"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the mass and partial volumes of of oxygen, nitrogen\n",
- "#Initialization of variables\n",
- "P=70. #psia\n",
- "Pt=110. #psia\n",
- "V=20. #cu ft\n",
- "R0=1545. #Universal gas constant\n",
- "T=540. #R\n",
- "M=32. #Molecular weight of Oxygen\n",
- "M2=28. #Molecular weight of Nitrgoen\n",
- "#calculations\n",
- "N=P*V*144/(R0*T)\n",
- "mo=M*N\n",
- "Pn=Pt-P\n",
- "N2=Pn*V*144/(R0*T)\n",
- "mn=N2*M2\n",
- "Vo=N*R0*T/(144*Pt)\n",
- "Vn=N2*R0*T/(144*Pt)\n",
- "Vn2=V-Vo\n",
- "#results\n",
- "print '%s %.2f %s' %(\"Mass of oxygen =\",mo,\" lb\")\n",
- "print '%s %.2f %s' %(\"\\n Mass of nitrogen =\",mn,\" lb\")\n",
- "print '%s %.2f %s' %(\"\\n Partial volume of oxygen =\",Vo,\" cu ft\")\n",
- "print '%s %.2f %s' %(\"\\n Partial volume of nitrogen =\",Vn,\" cu ft\")\n",
- "print '%s %.2f %s' %(\"\\n In case 2, Partial volume of nitrogen =\",Vn2,\" cu ft\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Mass of oxygen = 7.73 lb\n",
- "\n",
- " Mass of nitrogen = 3.87 lb\n",
- "\n",
- " Partial volume of oxygen = 12.73 cu ft\n",
- "\n",
- " Partial volume of nitrogen = 7.27 cu ft\n",
- "\n",
- " In case 2, Partial volume of nitrogen = 7.27 cu ft\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 2 - Pg 274"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the change in entropy\n",
- "#Initialization of variables\n",
- "import math\n",
- "P=50. #psia\n",
- "V=4. #cu ft\n",
- "dv=3. #cu ft\n",
- "J=778.\n",
- "T=560. #R\n",
- "#calculation\n",
- "ds= 144*P*V*math.log((V+dv)/V) /(J*T)\n",
- "#results\n",
- "print '%s %.3f %s' %(\"Change in entropy =\",ds,\"unit\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Change in entropy = 0.037 unit\n"
- ]
- }
- ],
- "prompt_number": 15
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 3 - Pg 275"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate the change in entropy\n",
- "#Initialization of variables\n",
- "import math\n",
- "p1=50. #psia\n",
- "t1=100+460. #R\n",
- "R1=48.3\n",
- "R2=55.2\n",
- "v1=4. #cu ft\n",
- "p2=100. #psia\n",
- "v2=3. #cu ft\n",
- "t2=200.+460 #R\n",
- "cv1=0.157\n",
- "cv2=0.177\n",
- "cpm=0.219\n",
- "J=778.\n",
- "#calculations\n",
- "m1=144*p1*v1/(R1*t1)\n",
- "m2=144*p2*v2/(R2*t2)\n",
- "tf=(m1*cv1*(t1-460) + m2*cv2*(t2-460))/(m1*cv1+m2*cv2)\n",
- "Po2=v1/(v1+v2) *(tf+460)/t1 *p1\n",
- "ds=cpm*math.log((tf+460)/t1) - R1/J *math.log(Po2/p1)\n",
- "dss=ds*m1\n",
- "#results\n",
- "print '%s %.4f %s' %(\"Change in entropy =\",dss,\"unit\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Change in entropy = 0.0528 unit\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 4 - Pg 277"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#Calculate the change in entropy\n",
- "#Initialization of variables\n",
- "import math\n",
- "p1=30 #psia\n",
- "t1=80.+460 #R\n",
- "R1=48.3\n",
- "R2=55.2\n",
- "m1=20. #lb/min\n",
- "p2=50. #psia\n",
- "m2=35. #lb/min\n",
- "t2=160.+460 #R\n",
- "cp1=0.219\n",
- "cp2=0.248\n",
- "J=778\n",
- "#calculations\n",
- "tf=(m1*cp1*(t1-460) + m2*cp2*(t2-460))/(m1*cp1+m2*cp2)\n",
- "Po2=m1/32/(m1/32+m2/28) *p1\n",
- "ds=cp1*math.log((tf+460)/t1) - R1/J *math.log(Po2/p1)\n",
- "dss=ds*m1\n",
- "#results\n",
- "print '%s %.4f %s' %(\"Change in entropy =\",dss,\"units/min\")\n",
- "print '%s' %(\"The answer is a bit different fromm textbook due to rounding off error in textbook\")"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Change in entropy = 1.7754 units/min\n",
- "The answer is a bit different fromm textbook due to rounding off error in textbook\n"
- ]
- }
- ],
- "prompt_number": 1
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 5 - Pg 278"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the weight per mole and also the gas constant\n",
- "#Initialization of variables\n",
- "import numpy\n",
- "x=([0.15, 0.08, 0.77])\n",
- "M=([44, 32, 28])\n",
- "#calculations\n",
- "b=len(x)\n",
- "y=numpy.zeros(b)\n",
- "yt=numpy.zeros(b)\n",
- "mt=numpy.zeros(b)\n",
- "per=numpy.zeros(b)\n",
- "wt=numpy.zeros(b)\n",
- "R=numpy.zeros(b)\n",
- "for i in range (0,b):\n",
- "\ty[i]=x[i]/M[i]\n",
- "\n",
- "yt=sum(y)\n",
- "for i in range (0,b):\n",
- "\tmt[i]=y[i]/yt\n",
- "\tper[i]=mt[i]*100\n",
- "\n",
- "wt=1. /yt\n",
- "R=1545. /wt\n",
- "\n",
- "#results\n",
- "print '%s' %(\"Volumetric analysis\")\n",
- "print '%s' %('percent by volume')\n",
- "print (per)\n",
- "print '%s %.1f %s' %(\"Weight per mole =\",wt,\" lb\")\n",
- "print '%s %.1f' %(\"\\n Gas constant =\",R)\n",
- "print '%s' %(\"The answer is a bit different fromm textbook due to rounding off error in textbook\")"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Volumetric analysis\n",
- "percent by volume\n",
- "[ 10.20408163 7.4829932 82.31292517]\n",
- "Weight per mole = 29.9 lb\n",
- "\n",
- " Gas constant = 51.6\n",
- "The answer is a bit different fromm textbook due to rounding off error in textbook\n"
- ]
- }
- ],
- "prompt_number": 2
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 6 - Pg 283"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the theoretical air and amount of nitrogen\n",
- "#Initialization of variables\n",
- "x1=0.885 #mole fraction of Ch4\n",
- "x2=0.115 #mole fraction of c2h6\n",
- "x3=0.4/100. #mole fraction of N2\n",
- "n1=2. #Moles of Ch4\n",
- "n2=3.5 #Moles of c2h6\n",
- "n3=1. #moles of ch4 in case 2\n",
- "n4=2. #moles of c2h6 in case 2\n",
- "#calculations\n",
- "y1=n1*x1\n",
- "y2=n2*x2\n",
- "y=y1+y2\n",
- "vec2=([y1, y2])\n",
- "air=y/0.21\n",
- "y3=n3*x1\n",
- "y4=n4*x2\n",
- "yy=y3+y4\n",
- "vec3=([y3 ,y4])\n",
- "air2=y/0.21 *0.79\n",
- "#results\n",
- "print '%s %.2f %s' %(\"Theoretical air =\",air,\" moles of air per mole of fuel\")\n",
- "print '%s' %(\"Oxygen analysis\")\n",
- "print(vec2)\n",
- "print '%s %.2f %s' %(\"\\n Amount of nitrogen =\",air2,\" moles of nitrogen per mole of fuel\")\n",
- "print '%s' %(\"Dry analysis\")\n",
- "print(vec3)\n",
- "print '%s %.3f %s' %(\"total =\",yy,\" moles\")\n",
- "print '%s' %(\"The answer is a bit different fromm textbook due to rounding off error in textbook\")"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Theoretical air = 10.35 moles of air per mole of fuel\n",
- "Oxygen analysis\n",
- "[1.77, 0.4025]\n",
- "\n",
- " Amount of nitrogen = 8.17 moles of nitrogen per mole of fuel\n",
- "Dry analysis\n",
- "[0.885, 0.23]\n",
- "total = 1.115 moles\n",
- "The answer is a bit different fromm textbook due to rounding off error in textbook\n"
- ]
- }
- ],
- "prompt_number": 3
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 7 - Pg 283"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the theoretical air fuel ratio\n",
- "#Initialization of variables\n",
- "import numpy\n",
- "x=([0.74, 0.06, 0.01]) #mole fraction of C, H and S respectively\n",
- "y=([8./3., 8, 1]) #Pounds O2 per pound substance of C,H and S respectively\n",
- "oxy=0.08 #Oxygen in coal\n",
- "z=0.232 #mass of coal\n",
- "#calculations\n",
- "b=len(x)\n",
- "pou = numpy.zeros(b)\n",
- "for i in range (0,b):\n",
- "\tpou[i]=x[i]*y[i]\n",
- "\n",
- "tot=sum(pou)\n",
- "oxy2=tot-oxy\n",
- "air=oxy2/z\n",
- "#results\n",
- "print '%s %.2f %s' %(\"Theoretical air fuel ratio =\",air,\"lb of air per pound of coal\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Theoretical air fuel ratio = 10.27 lb of air per pound of coal\n"
- ]
- }
- ],
- "prompt_number": 8
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 8 - Pg 284"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate air fuel ratio and also molal analysis\n",
- "#Initialization of variables\n",
- "o2=12.5 #moles of O2\n",
- "h20=9 #moles of H2O\n",
- "x=0.21 #Mole fraction of Oxygen in air\n",
- "M=28.97 #Molar mass of air\n",
- "M2=56. #molar mass of C4H8\n",
- "M1=8*12+18. #molecular mass of c8h18\n",
- "#calculations\n",
- "air=o2/x\n",
- "pound=air*M\n",
- "AR=pound/M1\n",
- "y1=h20/M2 *100.\n",
- "y2=o2*(79./21) /M2 *100.\n",
- "#results\n",
- "print '%s %.2f %s' %(\"Air fuel ratio =\",AR,\"lb of air per pound of fuel\")\n",
- "print '%s %.2f %s %.2f %s' %(\"\\n Molal or volumetric analysis is\",y1, \"percent of CO2 and\",y2, \"percent N2\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Air fuel ratio = 15.13 lb of air per pound of fuel\n",
- "\n",
- " Molal or volumetric analysis is 16.07 percent of CO2 and 83.97 percent N2\n"
- ]
- }
- ],
- "prompt_number": 9
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 9 - Pg 285"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the volumetric analysis and also volume of wet products\n",
- "#Initialization of variables\n",
- "x=18.5 #Moles of O2\n",
- "c=12. #Moles of CO2\n",
- "vap=13. #moles of H2O\n",
- "P=15. #psia\n",
- "R=1545. #Universal gas constant\n",
- "#calculations\n",
- "excess=x*0.5\n",
- "M=12*12+2*vap\n",
- "n2=(x+excess)*79/21.\n",
- "nt=n2+excess+c\n",
- "dry=([c, x/2, n2]) \n",
- "b= len(dry)\n",
- "for i in range(0,b):\n",
- "\tdry[i] = dry[i] /nt *100\n",
- "\n",
- "wet=nt+vap\n",
- "fue=100./(M)\n",
- "mol=wet*fue\n",
- "vol=mol*R*1460./(144*P)\n",
- "#results\n",
- "print '%s' %(\"Volumetric analysis in percentage\")\n",
- "print (' CO2 O2 N2')\n",
- "print (dry)\n",
- "print '%s %d %s' %(\"Volume of wet products =\",vol,\"cfm\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Volumetric analysis in percentage\n",
- " CO2 O2 N2\n",
- "[9.55088118249005, 7.362137578169414, 83.08698123934053]\n",
- "Volume of wet products = 85167 cfm\n"
- ]
- }
- ],
- "prompt_number": 10
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 10 - Pg 286"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the volumetric analysis\n",
- "#Initialization of variables\n",
- "import numpy\n",
- "from numpy import linalg\n",
- "from numpy.linalg import inv\n",
- "A=numpy.array([[1, 1], [0.5, 1]])\n",
- "B=numpy.array([[1],[ 0.9]])\n",
- "x=0.9\n",
- "#calculations\n",
- "N2=x*79./21.\n",
- "C=numpy.linalg.solve(A,B)\n",
- "vec= ([ C[0], C[1], N2])\n",
- "su=sum(vec)\n",
- "b= len(vec)\n",
- "vec2=numpy.zeros(b)\n",
- "for i in range (0,b):\n",
- "\tvec2[i]=vec[i]/su *100.;\n",
- "\n",
- "#results\n",
- "print '%s' %(\"Volumetric analysis\")\n",
- "print '%s' %('CO CO2 N2')\n",
- "print (vec2)\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Volumetric analysis\n",
- "CO CO2 N2\n",
- "[ 4.56026059 18.24104235 77.19869707]\n"
- ]
- }
- ],
- "prompt_number": 11
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 11 - Pg 288"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the Moles of dry products per pound of coal\n",
- "#Initialization of variables\n",
- "c=0.74\n",
- "ref=0.02\n",
- "co2=0.12\n",
- "co=0.1/100.\n",
- "M=12.\n",
- "#calcualtions\n",
- "carbon=c-ref\n",
- "car2=co2+co\n",
- "wt=car2*M\n",
- "amount=carbon/wt\n",
- "#results\n",
- "print '%s %.3f %s' %(\"Moles of dry products per pound of coal =\",amount,\" mole\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Moles of dry products per pound of coal = 0.496 mole\n"
- ]
- }
- ],
- "prompt_number": 12
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 12 - Pg 289"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the Number of moles of dry products per pound of fuel\n",
- "#Initialization of variables\n",
- "x1=0.128\n",
- "x2=0.035\n",
- "x3=0.002\n",
- "M=12.\n",
- "N=26.\n",
- "#calculations\n",
- "c=x1+x3\n",
- "mole=12./c\n",
- "wt=M*M+N\n",
- "num=mole/wt\n",
- "#results\n",
- "print '%s %.3f %s' %(\"Number of moles of dry products per pound of fuel =\",num,\" mole\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Number of moles of dry products per pound of fuel = 0.543 mole\n"
- ]
- }
- ],
- "prompt_number": 13
- },
- {
- "cell_type": "heading",
- "level": 2,
- "metadata": {},
- "source": [
- "Example 13 - Pg 289"
- ]
- },
- {
- "cell_type": "code",
- "collapsed": false,
- "input": [
- "#calculate the weight of air and excess air percentage\n",
- "#Initialization of variables\n",
- "c=0.74\n",
- "ref=0.02\n",
- "co2=0.12\n",
- "co=0.1/100.\n",
- "o2=0.065\n",
- "M=12\n",
- "x=0.79\n",
- "M=28.97\n",
- "#calcualtions\n",
- "n2=1-(co2+co+o2)\n",
- "mol=n2/x\n",
- "wt=mol*M\n",
- "wt2=0.496\n",
- "pou=wt2*wt\n",
- "ta=10.27\n",
- "EA=(pou-ta)/ta *100\n",
- "#results\n",
- "print '%s %.2f %s' %(\"Weight of air per pound of fuel =\",pou,\"lb\")\n",
- "print '%s %.1f %s' %(\"\\n Excess air percentage =\",EA,\"percent\")\n"
- ],
- "language": "python",
- "metadata": {},
- "outputs": [
- {
- "output_type": "stream",
- "stream": "stdout",
- "text": [
- "Weight of air per pound of fuel = 14.81 lb\n",
- "\n",
- " Excess air percentage = 44.2 percent\n"
- ]
- }
- ],
- "prompt_number": 14
- }
- ],
- "metadata": {}
- }
- ]
-}
\ No newline at end of file |