summaryrefslogtreecommitdiff
path: root/Thermodynamics_An_Engineering_Approach/Chapter15.ipynb
diff options
context:
space:
mode:
authorhardythe12015-04-07 15:58:05 +0530
committerhardythe12015-04-07 15:58:05 +0530
commit92cca121f959c6616e3da431c1e2d23c4fa5e886 (patch)
tree205e68d0ce598ac5caca7de839a2934d746cce86 /Thermodynamics_An_Engineering_Approach/Chapter15.ipynb
parentb14c13fcc6bb6d01c468805d612acb353ec168ac (diff)
downloadPython-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.gz
Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.tar.bz2
Python-Textbook-Companions-92cca121f959c6616e3da431c1e2d23c4fa5e886.zip
added books
Diffstat (limited to 'Thermodynamics_An_Engineering_Approach/Chapter15.ipynb')
-rwxr-xr-xThermodynamics_An_Engineering_Approach/Chapter15.ipynb686
1 files changed, 686 insertions, 0 deletions
diff --git a/Thermodynamics_An_Engineering_Approach/Chapter15.ipynb b/Thermodynamics_An_Engineering_Approach/Chapter15.ipynb
new file mode 100755
index 00000000..c167fe73
--- /dev/null
+++ b/Thermodynamics_An_Engineering_Approach/Chapter15.ipynb
@@ -0,0 +1,686 @@
+{
+ "metadata": {
+ "name": ""
+ },
+ "nbformat": 3,
+ "nbformat_minor": 0,
+ "worksheets": [
+ {
+ "cells": [
+ {
+ "cell_type": "heading",
+ "level": 1,
+ "metadata": {},
+ "source": [
+ "Chapter 15: Chemical Reactions"
+ ]
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-1 ,Page No.755"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "nO2i=20;#intial moles of air \n",
+ "nC8H18i=1;#intial moles octane\n",
+ "\n",
+ "#from Table A-1\n",
+ "Mair=29;\n",
+ "MC=12;\n",
+ "MH=2;\n",
+ "\n",
+ "#calculations\n",
+ "# Chemical Reaction\n",
+ "# C8H18 + 20(O2+3.76N2)= xCO2 + yH2O + zO2 + wN2\n",
+ "#by elemental balance of moles\n",
+ "x=8;\n",
+ "y=18/2;\n",
+ "z=20*2-2*x-y;\n",
+ "w=20*3.76;\n",
+ "print'kmoles of CO2 %i'%x;\n",
+ "print'kmoles of H2O %i'%y;\n",
+ "print'kmoles of O2 %f'%round(z,1);\n",
+ "print'kmoles of N2 %f'%round(w,1);\n",
+ "#thus equn becomes\n",
+ "# C8H18 + 20(O2+3.76N2)= 8CO2 + 9H2O + 7.5O2 +75.2N2\n",
+ "AF=nO2i*4.76*Mair/(x*MC + y*MH);\n",
+ "print'air-fuel ratio of combustion process %f kg air/kg fuel'%round(AF,1)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "kmoles of CO2 8\n",
+ "kmoles of H2O 9\n",
+ "kmoles of O2 15.000000\n",
+ "kmoles of N2 75.200000\n",
+ "air-fuel ratio of combustion process 24.200000 kg air/kg fuel\n"
+ ]
+ }
+ ],
+ "prompt_number": 1
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-2 ,Page No.757"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P=100;#total pressure in kPa\n",
+ "\n",
+ "#from Table A-1\n",
+ "Mair=29.0;\n",
+ "MC=12.0;\n",
+ "MH=2.0;\n",
+ "\n",
+ "#calculations\n",
+ "#Chemical reaction\n",
+ "#C2H6 + 1.2at(1O2 + 3.76) =2CO2 + 3H2O + 0.2athO2 + (1.2*3.76)athN2\n",
+ "#ath is the stoichiometric coefficient for air\n",
+ "#Oxygen balance gives\n",
+ "# 1.2ath = 2 + 1.5 + 0.2ath\n",
+ "ath=(2+1.5)/(1.2-0.2);\n",
+ "AF=(1.2*ath)*4.76*Mair/(2*MC+3*MH);\n",
+ "print'air-fuel ratio of combustion process %f kg air/kg fuel'%round(AF,1);\n",
+ "#C2H6 + 4.2(O2 + 3.76N2) = 2CO2 + 3H2O + 0.7O2 + 15.79N2;\n",
+ "Nprod=2+3+0.7+15.79;\n",
+ "#for dew point water vapour condenses\n",
+ "Nv=3;\n",
+ "Pv=Nv/Nprod*P;\n",
+ "#at this Pv\n",
+ "Tdp=52.3;\n",
+ "print'the dew-point %f C'%Tdp\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "air-fuel ratio of combustion process 19.300000 kg air/kg fuel\n",
+ "the dew-point 52.300000 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-3 ,Page No.758"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "P=101.325;#total pressure in kPa\n",
+ "RH=0.8;#realtive humidity\n",
+ "T1=20;#tempearture of air in C\n",
+ "\n",
+ "#from Table A-4\n",
+ "Psat=2.3392;\n",
+ "\n",
+ "#calculations\n",
+ "#consedering 1 kmol of fuel\n",
+ "# 0.72CH4 + 0.09H2 + 0.14N2 + 0.02O2 + 0.03CO2 + ath(O2 + 3.76N2) = xCO2 + yH2O + zN2\n",
+ "#element balance\n",
+ "x=0.72+0.03\n",
+ "y=(0.72*4+0.09*2)/2;\n",
+ "ath=x+y/2-0.02-0.03;\n",
+ "z=0.14+3.76*ath;\n",
+ "Pv=RH*Psat;\n",
+ "# Nv,air = Pv,air/Ptotal * Ntotal\n",
+ "Nvair=Pv/P*6.97/(1-(Pv/P));\n",
+ "#0.72CH4 + 0.09H2 + 0.14N2 + 0.02O2 + 0.03CO2 + 1.465(O2 + 3.76N2) + 0.131H20 = 0.75CO2 + 1.661H2O + 5.648N2\n",
+ "Pvprod=1.661/8.059*P;\n",
+ "#at this Pvprod\n",
+ "Tdp=60.9;\n",
+ "print'the dew-point %f C'%Tdp"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the dew-point 60.900000 C\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-4 ,Page No.760"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "Pprod=100;#total pressure in kPa\n",
+ "\n",
+ "#from Table A-1\n",
+ "Mair=29;\n",
+ "MC=12;\n",
+ "MH=2;\n",
+ "\n",
+ "#from Table A-4\n",
+ "Psat=3.1698;\n",
+ "\n",
+ "#calculations\n",
+ "#consedering 100 kmol of dry products\n",
+ "# xC8H18 + a (O2 + 3.76N2) = 10.02CO2 + 0.88C0 + 84.48N2 + bH20\n",
+ "#from mass balamces\n",
+ "a=83.48/3.76;\n",
+ "x=(0.88+10.02)/8;\n",
+ "b=18*x/2;\n",
+ "# 1.36C8H18 + 22.2 (O2 + 3.76N2) = 10.02CO2 + 0.88C0 + 84.48N2 + 12.24H20\n",
+ "# 1 mol conversion\n",
+ "# C8H18 + 16.32 (O2 + 3.76N2) = 7.37CO2 + 4.13C0 + 61.38N2 + 9H20\n",
+ "AF= 16.32*4.76*Mair/(8*MC+9*MH);\n",
+ "print'air-fuel ratio of combustion process %f kg air/kg fuel'%round(AF,2);\n",
+ "# C8H18 + ath (O2 + 3.76N2) = 8CO2 + 9H2O + 3.76athN2\n",
+ "ath=8+4.5;\n",
+ "Pth=16.32/ath*4.76/4.76*100;\n",
+ "print'percentage of theoretical air is %i'%round(Pth);\n",
+ "Nprod=7.37+0.65+4.13+61.98+9;\n",
+ "# Nv/Nprod = Pv/Pprod\n",
+ "Pv=Psat;\n",
+ "Nw= (Nprod*Pv-9*Pprod)/(Pv-Pprod);\n",
+ "print'the amount of H2O that condenses as the products %f kmol'%round(Nw,2)\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "air-fuel ratio of combustion process 19.760000 kg air/kg fuel\n",
+ "percentage of theoretical air is 131\n",
+ "the amount of H2O that condenses as the products 6.570000 kmol\n"
+ ]
+ }
+ ],
+ "prompt_number": 5
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-5 ,Page No.764"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#there is a difference in the answer due to approximation in the textbook\n",
+ "\n",
+ "#given data\n",
+ "T=25;#temperature of octane in C\n",
+ "\n",
+ "#from Table A-6\n",
+ "HCO2=-393520;\n",
+ "HH2O=-285830;\n",
+ "HC8H18=-249950;\n",
+ "\n",
+ "#calculations\n",
+ "# C8H18 + ath (O2 + 3.76N2) = 8CO2 + 9H2O + 3.76athN2\n",
+ "#N2 and O2 are stable elements, and thus their enthalpy of formation is zero\n",
+ "#hc = Hprod - Hreact\n",
+ "hc= 8*HCO2 + 9*HH2O - HC8H18;\n",
+ "print'the enthalpy of combustion of liquid octane %i kJ/kmol'%hc\n",
+ "print 'or %i kJ/kg C8H18'%round(hc/114,0)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the enthalpy of combustion of liquid octane -5470680 kJ/kmol\n",
+ "or -47989 kJ/kg C8H18\n"
+ ]
+ }
+ ],
+ "prompt_number": 2
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-6 ,Page No.767"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#given data\n",
+ "mfuel=0.05;#mass flow rate in kg/min\n",
+ "\n",
+ "#from Table A-1\n",
+ "Mair=29;\n",
+ "MC=12;\n",
+ "MH=2;\n",
+ "\n",
+ "#calculation\n",
+ "#stochiometric reaction\n",
+ "#C3H8 + ath(O2 + 3.76N2) = 3CO2 + 4H2O + 3.76athN2\n",
+ "#O2 balance\n",
+ "ath=3+5;\n",
+ "#50 percent excess air and some CO in the products\n",
+ "#C3H8 + 7.5(O2 + 3.76N2) = 2.7CO2 + 0.3CO + 4H2O + 2.65O2+ 28.2N2\n",
+ "AF=7.5*4.76*Mair/(3*MC+4*MH);\n",
+ "mair=AF*mfuel;\n",
+ "print'the mass flow rate of air %f kg air/min'%round(mair,2);\n",
+ "#from property tables\n",
+ "#C3H8 designated as p\n",
+ "hfp=-118910;\n",
+ "#oxygen as o\n",
+ "hfo=0;\n",
+ "ho280=8150;\n",
+ "ho298=8682;\n",
+ "ho1500=49292;\n",
+ "#nitrogen as n\n",
+ "hfn=0;\n",
+ "hn280=8141;\n",
+ "hn298=8669;\n",
+ "hn1500=47073;\n",
+ "#water as w\n",
+ "hfw=-241820;\n",
+ "hw298=9904;\n",
+ "hw1500=57999;\n",
+ "#carbondioxode as c\n",
+ "hfc=-393520;\n",
+ "hc298=9364;\n",
+ "hc1500=71078;\n",
+ "#carbon monoxide as co\n",
+ "hfco=-110530;\n",
+ "hco298=8669;\n",
+ "hco1500=47517;\n",
+ "qout=1*(hfp)+7.5*(hfo+ho280-ho298)+28.2*(hfn+hn280-hn298)-2.7*(hfc+hc1500-hc298)-0.3*(hfco+hco1500-hco298)-4*(hfw+hw1500-hw298)-2.65*(hfo+ho1500-ho298)-28.2*(hfn+hn1500-hn298);\n",
+ "#for kg of propane\n",
+ "qout=qout/44;\n",
+ "Qout=mfuel*qout/60;\n",
+ "print'the rate of heat transfer from the combustion chamber %f kW'%round(Qout,2)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the mass flow rate of air 1.180000 kg air/min\n",
+ "the rate of heat transfer from the combustion chamber 6.890000 kW\n"
+ ]
+ }
+ ],
+ "prompt_number": 7
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-7 ,Page No.769"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#the 0.175% error in last part is due to the approximation in the textbook\n",
+ "\n",
+ "#given data\n",
+ "Preact=1.0;#total pressure in kPa\n",
+ "Treact=77+460.0;#reaction temperature in R\n",
+ "Tprod=1800.0;#final temperature in R\n",
+ "\n",
+ "#constants used\n",
+ "Ru=1.986;\n",
+ "\n",
+ "#calculation\n",
+ "#CH4 + 3O2 = CO2 + 2H2O + O2\n",
+ "Nreact=4;\n",
+ "Nprod=4;\n",
+ "Pprod=Preact*Nprod/Nreact*Tprod/Treact;\n",
+ "print'the final pressure in the tank %f atm'%round(Pprod,2);\n",
+ "#from std. values of heat of formation and ideal gasses in Appendix\n",
+ "#CH4 as m\n",
+ "hfm=-32210.0;\n",
+ "#O2 as o\n",
+ "hfo=0;\n",
+ "h537o=3725.1;\n",
+ "h1800o=13485.8;\n",
+ "#water as w\n",
+ "hfw=-104040.0;\n",
+ "h537w=4528.0;\n",
+ "h1800w=15433.0\n",
+ "#carbondioxide as c\n",
+ "hfc=-169300.0;\n",
+ "h537c=4027.5;\n",
+ "h1800c=18391.5;\n",
+ "Qout=1*(hfm-Ru*Treact)+3*(hfo-Ru*Treact)-1*(hfc+h1800c-h537c-Ru*Tprod)-2*(hfw+h1800w-h537w-Ru*Tprod)-1*(hfo+h1800o-h537o-Ru*Tprod);\n",
+ "print'the heat transfer during this process %i Btu/lbmol'%round(Qout)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the final pressure in the tank 3.350000 atm\n",
+ "the heat transfer during this process 309269 Btu/lbmol\n"
+ ]
+ }
+ ],
+ "prompt_number": 3
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-8 ,Page No.771"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#this invovles EES hence the below code explains a approach with approximation\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#part - a\n",
+ "#C8H18 + 12.5 (O2 + 3.76N2) = 8CO+ 9H2O + 47N2\n",
+ "#from std. values of heat of formation and ideal gasses in Appendix\n",
+ "#octane as oc\n",
+ "hfoc=-249950.0;\n",
+ "#oxygen as o\n",
+ "hfo=0;\n",
+ "h298o=8682.0;\n",
+ "#nitrogen as n\n",
+ "hfn=0;\n",
+ "h298n=8669.0;\n",
+ "#water as w\n",
+ "hfw=-241820.0;\n",
+ "h298w=9904.0;\n",
+ "#carbondioxide as c\n",
+ "hfc=-393520.0;\n",
+ "h298c=9364.0;\n",
+ "#x refers to 8hCO2 + 9hH20 + 47hN2\n",
+ "xac=1*(hfoc)+8*(h298c-hfc)+9*(h298w-hfw)+47*(h298n-hfn);\n",
+ "#from EES the Tprod is determined by trial and error\n",
+ "#at 2400K\n",
+ "x2400=5660828.0;\n",
+ "#at 2350K\n",
+ "x2350=5526654.0;\n",
+ "#the actual value of x is xac and T can be determined by interpolation\n",
+ "Tprod=(xac-x2350)*(2400.0-2350.0)/(x2400-x2350)+2350.0;\n",
+ "print'adiabatic flame temperature for complete combustion with 100 percent theoretical air %i K'%round(Tprod);\n",
+ "\n",
+ "#part - b\n",
+ "#C8H18 + 50 (O2 + 3.76N2) = 8CO+ 9H2O + 37.5O2 + 188N2\n",
+ "#solved similarly using EES and approximation and interpolation\n",
+ "#similarly we can solve the part - c \n",
+ "#the above concept is applied\n",
+ "\n"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "adiabatic flame temperature for complete combustion with 100 percent theoretical air 2395 K\n"
+ ]
+ }
+ ],
+ "prompt_number": 14
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-9 ,Page No.776"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "#from Table A-26E\n",
+ "#Gibbs function of formation at 77\u00b0F\n",
+ "gfc=0;#for carbon\n",
+ "gfo=0;#for oxygen\n",
+ "gfco=-169680;#for carbondioxide\n",
+ "\n",
+ "#calculations\n",
+ "# C + O2 = CO2\n",
+ "Wrev=1*gfc+1*gfo-1*gfco;\n",
+ "print'the reversible work for this process %i Btu'%round(Wrev) "
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the reversible work for this process 169680 Btu\n"
+ ]
+ }
+ ],
+ "prompt_number": 15
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-10 ,Page No.777"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log\n",
+ "\n",
+ "#given values\n",
+ "T0=298;#combustion chamber temperature in K\n",
+ "\n",
+ "#contansts used \n",
+ "Ru=8.314;#in kJ/kmol K\n",
+ "\n",
+ "#calculations\n",
+ "# CH4 + 3(O2 + 3.76N2) = CO2 + 2H2O + O2 + 11.28N2\n",
+ "#from std. values of heat of formation and ideal gasses in Appendix\n",
+ "#methane as m\n",
+ "hfm=-74850;\n",
+ "#oxygen as o\n",
+ "hfo=0;\n",
+ "h298o=8682;\n",
+ "#nitrogen as n\n",
+ "hfn=0;\n",
+ "h298n=8669;\n",
+ "#water as w\n",
+ "hfw=-241820;\n",
+ "h298w=9904;\n",
+ "#carbondioxide as c\n",
+ "hfc=-393520;\n",
+ "h298c=9364;\n",
+ "#x refers to hCO2 + 2hH2O + 11.28hN2\n",
+ "xac=1*(hfm)+1*(h298c-hfc)+2*(h298w-hfw)+11.28*(h298n-hfn);\n",
+ "#from EES the Tprod is determined by trial and error\n",
+ "Tprod=1789;\n",
+ "print'the temperature of the products %i K'%round(Tprod);\n",
+ "#entropy calculations by using table A-26\n",
+ "#Si = Ni*(si - Ruln yiPm\n",
+ "#reactants\n",
+ "Sm=1*(186.16-Ru*log(1*1));\n",
+ "So=3*(205.04-Ru*log(0.21*1));\n",
+ "Sn=11.28*(191.61-Ru*log(.79*1));\n",
+ "Sreact=Sm+So+Sn;\n",
+ "#products\n",
+ "Nt=1+2+1+11.28;#total moles\n",
+ "yc=1/Nt;\n",
+ "yw=2/Nt;\n",
+ "yo=1/Nt;\n",
+ "yn=11.28/Nt;\n",
+ "Sc=1*(302.517-Ru*log(yc*1));\n",
+ "Sw=2*(258.957-Ru*log(yw*1));\n",
+ "So=1*(264.471-Ru*log(yo*1));\n",
+ "Sn=11.28*(247.977-Ru*log(yn*1));\n",
+ "Sprod=Sc+Sw+So+Sn;\n",
+ "Sgen=Sprod-Sreact;\n",
+ "print'exergy destruction %i kJ/kmol - K'%round(Sgen);\n",
+ "Xdestroyed=T0*Sgen/1000;#factor of 1000 for converting kJ to MJ\n",
+ "print'%i MJ/kmol'%round(Xdestroyed);\n",
+ "#This process involves no actual work. Therefore, the reversible work and energy destroyed are identical\n",
+ "Wrev=Xdestroyed;\n",
+ "print'the reversible work %i MJ/kmol'%round(Wrev)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "the temperature of the products 1789 K\n",
+ "exergy destruction 966 kJ/kmol - K\n",
+ "288 MJ/kmol\n",
+ "the reversible work 288 MJ/kmol\n"
+ ]
+ }
+ ],
+ "prompt_number": 20
+ },
+ {
+ "cell_type": "heading",
+ "level": 2,
+ "metadata": {},
+ "source": [
+ "Example 15-11 ,Page No.778"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "collapsed": false,
+ "input": [
+ "from math import log\n",
+ "\n",
+ "#given values\n",
+ "Tsurr=298;#temperature of surroundings in K\n",
+ "\n",
+ "#contansts used \n",
+ "Ru=8.314;#in kJ/kmol K\n",
+ "\n",
+ "#calculations\n",
+ "\n",
+ "#part - a\n",
+ "# CH4 + 3(O2 + 3.76N2) = CO2 + 2H2O + O2 + 11.28N2\n",
+ "#The amount of water vapor that remains in the products is determined as in Example 15\u20133\n",
+ "Nv=0.43;#moles of water vapour\n",
+ "Nw=1.57;#moles of water in liquid\n",
+ "#hf values\n",
+ "#methane as m\n",
+ "hfm=-74850;\n",
+ "#carbondioxide as c\n",
+ "hfc=-393520;\n",
+ "#water vapour as v\n",
+ "hfv=-241820;\n",
+ "#water in liquid as w\n",
+ "hfw=-285830;\n",
+ "Qout=1*hfm-1*hfc-Nv*hfv-Nw*hfw;\n",
+ "print'Qout = %i kJ/kmol'%round(Qout)\n",
+ "\n",
+ "#part - b\n",
+ "#entropy calculations by using table A-26\n",
+ "#Si = Ni*(si - Ruln yiPm\n",
+ "#reactants\n",
+ "Sm=1*(186.16-Ru*log(1*1));\n",
+ "So=3*(205.04-Ru*log(0.21*1));\n",
+ "Sn=11.28*(191.61-Ru*log(.79*1));\n",
+ "Sreact=Sm+So+Sn;\n",
+ "#products\n",
+ "Nt=Nv+1+1+11.28;#total moles\n",
+ "yw=1;\n",
+ "yc=1/Nt;\n",
+ "yv=Nv/Nt;\n",
+ "yo=1/Nt;\n",
+ "yn=11.28/Nt;\n",
+ "Sw=Nw*(69.92-Ru*log(yw*1));\n",
+ "Sc=1*(213.80-Ru*log(yc*1));\n",
+ "Sv=Nv*(188.83-Ru*log(yv*1));\n",
+ "So=1*(205.04-Ru*log(yo*1));\n",
+ "Sn=11.28*(191.61-Ru*log(yn*1));\n",
+ "Sprod=Sc+Sw+So+Sn+Sv;\n",
+ "Sgen=Sprod-Sreact+Qout/Tsurr;\n",
+ "print'Sgen = %i kJ/kmol - K'%round(Sgen);\n",
+ "Xdestroyed=Tsurr*Sgen/1000;#factor of 1000 for converting kJ to MJ\n",
+ "print'exergy destruction %i MJ/kmol'%round(Xdestroyed);\n",
+ "#This process involves no actual work. Therefore, the reversible work and energy destroyed are identical\n",
+ "Wrev=Xdestroyed;\n",
+ "print'the reversible work %i MJ/kmol'%round(Wrev)"
+ ],
+ "language": "python",
+ "metadata": {},
+ "outputs": [
+ {
+ "output_type": "stream",
+ "stream": "stdout",
+ "text": [
+ "Qout = 871406 kJ/kmol\n",
+ "Sgen = 2746 kJ/kmol - K\n",
+ "exergy destruction 818 MJ/kmol\n",
+ "the reversible work 818 MJ/kmol\n"
+ ]
+ }
+ ],
+ "prompt_number": 4
+ }
+ ],
+ "metadata": {}
+ }
+ ]
+} \ No newline at end of file