diff options
Diffstat (limited to 'Thermodynamics_by_Gaggioli_and_Obert/ch16.ipynb')
-rw-r--r-- | Thermodynamics_by_Gaggioli_and_Obert/ch16.ipynb | 797 |
1 files changed, 797 insertions, 0 deletions
diff --git a/Thermodynamics_by_Gaggioli_and_Obert/ch16.ipynb b/Thermodynamics_by_Gaggioli_and_Obert/ch16.ipynb new file mode 100644 index 00000000..5fcd8569 --- /dev/null +++ b/Thermodynamics_by_Gaggioli_and_Obert/ch16.ipynb @@ -0,0 +1,797 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Chapter 16 Combustion" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.1 Pg:738" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Molecule is C7 H17\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "per=85\n", + "#calculations\n", + "a=per/12\n", + "b=100-per\n", + "ad=1.13*a\n", + "bd=1.13*b\n", + "#results\n", + "print \"Molecule is C%d H%d\"%(ad,bd+1)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.2 Pg:738" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Oxygen = 8.74 and Nitrogen = 32.90\n", + "\n", + "Equation is C7.333 H6 + 8.74 O2 + 32.85 N2 = 7.333 CO2 + 3 H2O + 0.03120 SO2 + 32.90 N2\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "per=0.071 #mass fraction of nitrogen\n", + "#calculations\n", + "O2=8.74\n", + "N2=per/2 + 3.76*O2\n", + "Nin=32.85\n", + "CO2=7.333\n", + "H2o=3\n", + "So2=0.0312\n", + "#results\n", + "print \"Oxygen = %.2f and Nitrogen = %.2f\"%(O2,N2)\n", + "print \"\\nEquation is C%.3f H%d + %.2f O2 + %.2f N2 = %.3f CO2 + %d H2O + %.5f SO2 + %.2f N2\"%(CO2,2*H2o,O2,Nin,CO2,H2o,So2,N2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.3 Pg:739" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 12.06 lbm air/lbm fuel\n", + "\n", + "In dry air, Air-fuel ratio = 9.9 lbm air/lbm fuel as fired\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "M=29\n", + "m1=8.74\n", + "m2=32.85\n", + "fuel=100 #lbm\n", + "#calculations\n", + "mass=M*(m1+m2)\n", + "AF=mass/fuel\n", + "a2=9.75\n", + "b2=12.19\n", + "AF2=mass/(fuel+a2+b2)\n", + "#results\n", + "print \"Air fuel ratio = %.2f lbm air/lbm fuel\"%(AF)\n", + "print \"\\nIn dry air, Air-fuel ratio = %.1f lbm air/lbm fuel as fired\"%(AF2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.4 Pg:740" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Mass of dry flue gases = 12.50 lbm dry flue gas/lbm fuel ash and moisture free\n", + "\n", + " Mass of dry flue gases = 10.25 lbm dry flue gas/lbm fuel as fired \n", + "\n", + " Energy carried away = 187079.8 btu/mol coal as fired which is same as = 1534.2 Btu/lbm mol coal \n", + "The answers are a bit different due to rounding off errors in textbook\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "m1=322.3 #Mass of Co2\n", + "m2=2 #Mass of SO2\n", + "m3=926 #Mass of N2\n", + "basis=121.94 #Basis taken\n", + "#calculations\n", + "m=m1+m2+m3\n", + "ratio=m/basis\n", + "dh=5777 #Btu/mol\n", + "h1=dh*7.364\n", + "h2=14037\n", + "h3=130501\n", + "H=h1+h2+h3\n", + "hrat=H/basis\n", + "#results\n", + "print \"Mass of dry flue gases = %.2f lbm dry flue gas/lbm fuel ash and moisture free\"%(m/100)\n", + "print \"\\n Mass of dry flue gases = %.2f lbm dry flue gas/lbm fuel as fired \"%(ratio)\n", + "print \"\\n Energy carried away = %.1f btu/mol coal as fired which is same as = %.1f Btu/lbm mol coal \"%(H, hrat)\n", + "print \"The answers are a bit different due to rounding off errors in textbook\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.6 Pg:741" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Final orsat composition is 1 CO2 + 0.22 H20 + 7.52 N2\n", + "\n", + " Percentage of co2 on a wet basis = 11.4 percent\n", + "\n", + " percentage of co2 on a dry basis = 11.74 percent\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "p=14.7 #psia\n", + "ps=0.363 #psia\n", + "n2=7.52 #moles\n", + "n1=1 #moles\n", + "#calculations\n", + "x= (n1+n2)*ps/p /(1-ps/p)\n", + "n=n1+n2+x\n", + "y1=n1/n\n", + "y2=n1/(n1+n2)\n", + "#results\n", + "print \"Final orsat composition is %d CO2 + %.2f H20 + %.2f N2\"%(n1, x, n2)\n", + "print \"\\n Percentage of co2 on a wet basis = %.1f percent\"%(y1*100)\n", + "print \"\\n percentage of co2 on a dry basis = %.2f percent\"%(y2*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.7 Pg:742" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.3 lbm air/lbm fuel\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "N2=78.1\n", + "M=29\n", + "co2=8.7\n", + "co=8.9\n", + "x4=0.3\n", + "x5=3.7\n", + "x6=14.7\n", + "#calculations\n", + "O2=N2/3.76\n", + "Z=(co2+co+x4)/8\n", + "AF=(O2+N2)*M/(Z*113)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.8 Pg:743" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 10.2 lbm air/lbm fuel as fired\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "basis=100 #lbm\n", + "x1=0.6\n", + "ash=12 #lbm\n", + "N2=79.7\n", + "M=29\n", + "#calculations\n", + "x=ash/x1\n", + "C=(1-x1)*x\n", + "O2=N2/3.76\n", + "a= (14.6+0.2)/(5.83-0.66)\n", + "AF=(O2+N2)*M/(a*100)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel as fired\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.9 Pg:744" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.4 lbm air/lbm fuel\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "N2=78.1 #Moles of Nitrogen\n", + "M=29 #Molar mass of Air\n", + "ba=2.12 #Basis\n", + "x4=0.3 #Moles of Ch4\n", + "x5=3.7 #Moles of H2\n", + "x6=14.7 #moles of H2o\n", + "#calculations\n", + "O2=N2/3.76\n", + "O2=N2/3.76\n", + "Z=(x4*4+x5*2+x6*2)/17\n", + "AF=(O2+N2)*M/(Z*113)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.10 Pg:745" + ] + }, + { + "cell_type": "code", + "execution_count": 13, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.3 lbm air/lbm fuel\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "N2=78.1 #Moles of Nitrogen\n", + "M=29 #Molar mass of Air\n", + "ba=2.12 #Basis\n", + "x4=0.3 #Moles of Ch4\n", + "x5=3.7 #Moles of H2\n", + "x6=14.7 #moles of H2o\n", + "#calculations\n", + "O2=N2/3.76\n", + "c=14.7\n", + "b= x4*4 + x5*2 + x6*2\n", + "a=b/ba\n", + "AF=(O2+N2)*M/(a*12 + b)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.11 Pg:746" + ] + }, + { + "cell_type": "code", + "execution_count": 14, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.3 lbm air/lbm fuel\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "co2=8.7 #Moles of CO2\n", + "co=8.9 #Moles of CO\n", + "N2=78.1 #Moles of Nitrogen\n", + "M=29 #Molar mass of Air\n", + "ba=2.12 #Basis\n", + "x4=0.3 #Moles of Ch4\n", + "x5=3.7 #Moles of H2\n", + "x6=14.7 #moles of H2o\n", + "#calculations\n", + "O2=N2/3.76\n", + "c=14.7\n", + "Z=2.238\n", + "X=(Z*17-x4*4-x5*2)/2\n", + "a=co2+co/2+x4+x6/2\n", + "b=3.764*a\n", + "AF=(O2+N2)*M/(Z*113)\n", + "#results\n", + "print \"Air fuel ratio = %.1f lbm air/lbm fuel\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.12 Pg:747" + ] + }, + { + "cell_type": "code", + "execution_count": 15, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Air fuel ratio = 11.37\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "x1=8.7 #Moles of Co2\n", + "x2=8.9 #Moles of CO\n", + "x3=0.3 #Moles of O2\n", + "N=78.1 #Moles of N2\n", + "z=113 #Af factor\n", + "M=29 #Molar mass of air\n", + "#calculations\n", + "co2=(x1+x2+x3)*100/(N+x1+x2+x3)\n", + "a=2.325\n", + "AF=103*M/(a*z)\n", + "#results\n", + "print \"Air fuel ratio = %.2f\"%(AF)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.13 Pg:748" + ] + }, + { + "cell_type": "code", + "execution_count": 17, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Nitrogen = 87.1 percent\n", + "\n", + "Equation is a(96 CH4 + 3 H2+ 1 CO) + 87.1/3.76 O2 + 87.1 N2 = 10.8 CO2 + 1.2 CO + 0.6 H2 + 0.3 CH4 + 87.1 N2\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "co=1.2 #Moles of CO\n", + "co2=10.8 #Moles of CO2\n", + "#calculations\n", + "H2=co/2\n", + "ch4=0.3\n", + "N2=88-H2-ch4\n", + "#results\n", + "print \"Nitrogen = %.1f percent\"%(N2)\n", + "print \"\\nEquation is a(96 CH4 + 3 H2+ 1 CO) + %.1f/3.76 O2 + %.1f N2 = %.1f CO2 + %.1f CO + %.1f H2 + %.1f CH4 + %.1f N2\"%(N2,N2,co2,co,H2,ch4,N2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.14 Pg:748" + ] + }, + { + "cell_type": "code", + "execution_count": 18, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Higher heating value = -2363996 Btu\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "dH=-2369859 #Btu\n", + "r=1.986 #Gas constant\n", + "dn=5.5 #Change in number of moles\n", + "T=536.7 #R\n", + "#calculations\n", + "dQ=dH+dn*r*T\n", + "#results\n", + "print \"Higher heating value = %d Btu\"%(dQ)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.15 Pg:749" + ] + }, + { + "cell_type": "code", + "execution_count": 19, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from steam tables,\n", + "Lower heating value = -2203398 Btu/lbm\n", + "The answers are a bit different due to rounding off error in textbook.\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "M2=18 #Molar mass of water\n", + "M=170 #Molar mass of octane\n", + "p=0.4593 #Pressure of octane #psia\n", + "print \"from steam tables,\"\n", + "vfg=694.9 \n", + "J=778.2\n", + "m=9*18 #Mass of water\n", + "u1=-2363996 #Btu\n", + "#calculations\n", + "hfg=1050.4 #Btu/lbm\n", + "ufg= hfg- p*vfg*144/J\n", + "dU=ufg*m \n", + "Lhv=u1+dU\n", + "#results\n", + "print \"Lower heating value = %d Btu/lbm\"%(Lhv)\n", + "print \"The answers are a bit different due to rounding off error in textbook.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.16 Pg:750" + ] + }, + { + "cell_type": "code", + "execution_count": 20, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "From Table B-10,\n", + "Heat of reaction = -2202154 Btu\n", + "The answers are a bit different due to rounding off error in textbook.\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "n1=8 #Moles of CO2\n", + "n2=9 #Moles of H2O\n", + "n3=1 #Moles of Octane\n", + "n4=12.5 #Moles of Oxygen\n", + "print \"From Table B-10,\"\n", + "U11=3852 #Internal energy at 1000 R of CO2\n", + "U12=115 #Internal energy at 537 R of CO2\n", + "U21=3009 #Internal energy at 1000 R of H2O\n", + "U22=101 #Internal energy at 537 R of H2O\n", + "U31=24773 #Internal energy at 1000 R of Octane\n", + "U32=640 #Internal energy at 537 R of Octane\n", + "U41=2539 #Internal energy at 1000 R of Oxygen\n", + "U42=83 #Internal energy at 537 R of Oxygen\n", + "H=-2203389 #heat Btu\n", + "#calculations\n", + "dU1=n1*(U11-U12)+n2*(U21-U22)\n", + "dU2=n3*(U31-U32)+n4*(U41-U42)\n", + "Q=H+dU1-dU2\n", + "#results\n", + "print \"Heat of reaction = %d Btu\"%(Q)\n", + "print \"The answers are a bit different due to rounding off error in textbook.\"" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.17 Pg:751" + ] + }, + { + "cell_type": "code", + "execution_count": 21, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "from table B-10,\n", + "Upon interpolating, T2 = 5271 R\n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "n1=8 #Moles of CO2\n", + "n2=9 #Moles of H2O\n", + "n3=47 #Moles of N2\n", + "print \"from table B-10,\"\n", + "h1=118 #Enthalpy of CO2\n", + "h2=104 #Enthalpy of H2O\n", + "h3=82.5 #Enthalpy of N2\n", + "Q=2203279 #Btu\n", + "#calculations\n", + "U11=n1*h1+n2*h2+n3*h3\n", + "U12=U11+Q\n", + "T2=5271 #R\n", + "#results\n", + "print \"Upon interpolating, T2 = %d R\"%(T2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.18 Pg:752" + ] + }, + { + "cell_type": "code", + "execution_count": 23, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "In case 1, Equilibrium constant = 38.5 \n", + "\n", + "In case 2, Equilibrium constant = 1480.1 \n" + ] + } + ], + "source": [ + "#Initialization of variables\n", + "n1=0.95\n", + "n2=0.05\n", + "n3=0.025\n", + "P=147 #psia\n", + "pa=14.7 #psia\n", + "#calculations\n", + "n=n1+n2+n3\n", + "p1=n1/n *P/pa\n", + "p2=n2/n *P/pa\n", + "p3=n3/n *P/pa\n", + "Kp1= p1/(p2*p3**0.5)\n", + "Kp2= p1**2 /(p2**2 *p3)\n", + "#results\n", + "print \"In case 1, Equilibrium constant = %.1f \"%(Kp1)\n", + "print \"\\nIn case 2, Equilibrium constant = %.1f \"%(Kp2)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "## Ex:16.19 Pg:753" + ] + }, + { + "cell_type": "code", + "execution_count": 38, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "percentage of dissociation = 34.3 percent\n", + "\n", + " If pressure =10 . Degree of dissociation = 18 percent\n" + ] + } + ], + "source": [ + "from sympy.abc import x,y\n", + "from sympy import solve,N\n", + "#Initialization of variables\n", + "kp=5 \n", + "#calculations\n", + "vec=solve(24*x**3 + 3*x-2,x)\n", + "x=N(vec[2],6)\n", + "vec2=solve(249*y**3 +3*y-2,y)\n", + "y=N(vec2[2],6)\n", + "#results\n", + "print \"percentage of dissociation = %.1f percent\"%(x*100)\n", + "print \"\\n If pressure =10 . Degree of dissociation = %d percent\"%(y*100)" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "# Ex:16.20 Pg:754" + ] + }, + { + "cell_type": "code", + "execution_count": 41, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Extent of reaction= 78 percent\n" + ] + } + ], + "source": [ + "from sympy.abc import x,y\n", + "from sympy import solve,N\n", + "\n", + "#Initialization of variables\n", + "vec=solve(24*x**3 +48*x**2 + 7*x -4,x)\n", + "x=N(vec[1],6) *100\n", + "#results\n", + "print \"Extent of reaction= %d percent\"%(100-x)" + ] + } + ], + "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 +} |