summaryrefslogtreecommitdiff
path: root/Thermodynamics_for_Engineers/Chapter_14.ipynb
blob: 2bdb47a9327599b303794d22bba41e3f97d0a58f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
{
 "metadata": {
  "name": "",
  "signature": "sha256:57baf6d72b0852fbedefdd618b07a013f83f99bf6037a025a931e79491c28af0"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 14 - Energies associated with chemical reactions"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 1 - Pg 297"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the HHV and LHV at constant volume\n",
      "#Initalization of variables\n",
      "lhs=8.5 #moles of reactants\n",
      "rhs=6 #moles of CO2\n",
      "n=3. #moles of H2O\n",
      "R=1545. #Universal gas constant\n",
      "R2=18.016 #molar mass of water\n",
      "J=778. #Work conversion constant\n",
      "T=537. #R\n",
      "T2=1050.4 #R\n",
      "T3=991.3 #R\n",
      "Qhp=1417041. #Btu/mol\n",
      "#calculations\n",
      "Qhpv=(lhs-rhs)*R*T/J\n",
      "Qhv=Qhp-Qhpv\n",
      "hfg=(rhs-n)*R2*T2\n",
      "Qlp=Qhp-hfg\n",
      "Qlpv=(lhs-rhs-n)*R/J *T\n",
      "Qlv=Qlp-Qlpv\n",
      "Qhlv=(rhs-n)*R2*T3\n",
      "Qlv3=Qhv-Qhlv\n",
      "#results\n",
      "print '%s %d %s' %(\"Higher heating value at constant volume =\",Qhv,\"Btu/mol\")\n",
      "print '%s %d %s' %(\"\\n Lower heating value at constant pressure =\",Qlp,\"Btu/mol\")\n",
      "print '%s %d %s' %(\"\\n In case 1,Lower heating value at constant volume =\",Qlv,\" Btu/mol\")\n",
      "print '%s %d %s' %(\"\\n In case 2,Lower heating value at constant volume =\",Qlv3,\"Btu/mol\")\n",
      "print '%s' %(\"The answers might differ a bit from textbook due to rounding off error.\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Higher heating value at constant volume = 1414374 Btu/mol\n",
        "\n",
        " Lower heating value at constant pressure = 1360268 Btu/mol\n",
        "\n",
        " In case 1,Lower heating value at constant volume = 1360802  Btu/mol\n",
        "\n",
        " In case 2,Lower heating value at constant volume = 1360797 Btu/mol\n",
        "The answers might differ a bit from textbook due to rounding off error.\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 2 - Pg 301"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the change in chemical energy during complete combustion and LHV at constant volume\n",
      "#Initalization of variables\n",
      "print '%s' %(\"From table 5-4,\")\n",
      "no=7.5\n",
      "n1=3.\n",
      "n2=6.\n",
      "Q=1360805. #Btu/mol\n",
      "#calculations\n",
      "Uo=337+no*85\n",
      "Uf=n1*104+n2*118\n",
      "delo= Q-(Uo-Uf)\n",
      "Uo2=1656+no*402\n",
      "Uf2=n1*490+n2*570\n",
      "Qv=Uo2-Uf2+delo\n",
      "#results\n",
      "print '%s %d %s' %(\"Change in chemical energy during complete combustion =\",delo,\"Btu/mol\")\n",
      "print '%s %d %s' %(\"\\n Lower heating value at constant volume =\",Qv,\"Btu/mol\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 5-4,\n",
        "Change in chemical energy during complete combustion = 1360850 Btu/mol\n",
        "\n",
        " Lower heating value at constant volume = 1360631 Btu/mol\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 3 - Pg 302"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the heat removed in the process\n",
      "#Initalization of variables\n",
      "print '%s' %(\"From table 5-4,\")\n",
      "a=1 #moles of C6H6\n",
      "b=7.5 #moles of O2 in reactant\n",
      "c=1.875 #moles of excess O2\n",
      "d=35.27 #moles of N2\n",
      "e=3 #moles of H2O\n",
      "flow=40. #lb/min\n",
      "w=1360850. #Btu/mol\n",
      "#calculations\n",
      "U11=a*337\n",
      "U12=(b+c)*85\n",
      "U13=d*82\n",
      "U14=(a+b+c+d)*1066\n",
      "Ua1=U11+U12+U13+U14\n",
      "U21=c*2539\n",
      "U22=d*2416\n",
      "U23=e*3009\n",
      "U24=2*e*3852\n",
      "U25=(c+d+e+2*e)*1985\n",
      "Ua2=U21+U22+U23+U24+U25\n",
      "Q=Ua1+w-Ua2\n",
      "fuel=flow/(6*12+2.*e)\n",
      "Q2=Q*fuel\n",
      "#results\n",
      "print '%s %d %s' %(\"Heat removed =\",Q2,\"Btu/min\")\n",
      "print '%s' %(\"The answers might differ a bit from textbook due to rounding off error.\")"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 5-4,\n",
        "Heat removed = 615294 Btu/min\n",
        "The answers might differ a bit from textbook due to rounding off error.\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4 - Pg 305"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the furnace efficiency\n",
      "#Initalization of variables\n",
      "rate=10700. #lb/min\n",
      "t2=97.90 \n",
      "t1=33.05 \n",
      "r1=46. #lb/min\n",
      "#calculations\n",
      "print '%s' %(\"From steam tables,\")\n",
      "Hv=1417041.\n",
      "Qw=rate*(t2-t1)\n",
      "Q=r1/(12*6+6) *Hv\n",
      "eff=Qw/Q*100.\n",
      "#results\n",
      "print '%s %.1f %s' %(\"Furnace efficiency =\",eff,\"percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From steam tables,\n",
        "Furnace efficiency = 83.0 percent\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 5 - Pg 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the thermal efficiency\n",
      "#Initalization of variables\n",
      "rate=94. #lb/hr\n",
      "hp=197. #hp\n",
      "c=8.\n",
      "h=18.\n",
      "Lv=17730. #Btu/hr\n",
      "H=2368089. #Btu/hr\n",
      "#calculations\n",
      "amount=rate*c/12 +h\n",
      "amount=0.824\n",
      "Lvv=H-Lv\n",
      "eff=hp*2544/(amount*Lvv) *100\n",
      "#results\n",
      "print '%s %.2f %s' %(\"Thermal efficiency =\",eff,\" percent\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thermal efficiency = 25.88  percent\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 6 - Pg 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the thermal efficiency\n",
      "#Initalization of variables\n",
      "rate=94. #lb/hr\n",
      "hp=197. #hp\n",
      "c=8.\n",
      "h=18.\n",
      "mole=9.\n",
      "H=2350359. #Btu/hr\n",
      "#calculations\n",
      "amount=rate*c/12 +h\n",
      "amount=0.824\n",
      "Lvv=H-mole*18.016*1050.4\n",
      "eff=hp*2544/(amount*Lvv) *100\n",
      "#results\n",
      "print '%s %.2f %s' %(\"Thermal efficiency =\",eff,\"percent\")\n",
      "print '%s' %(\"The answer in the textbook is a different due to rounding off error\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Thermal efficiency = 27.90 percent\n",
        "The answer in the textbook is a different due to rounding off error\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 7 - Pg 307"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the total available energy\n",
      "#Initalization of variables\n",
      "import math\n",
      "hv=14000. #Btu/lb\n",
      "ef=0.4\n",
      "tmin=80. #F\n",
      "tmid=300. #F\n",
      "m=13. #lb\n",
      "c=0.27\n",
      "tmean=2300. #F\n",
      "#calculations\n",
      "heat=ef*hv\n",
      "Qavail=heat*(tmean-tmin)/(tmean+460)\n",
      "Q=m*c*(tmean-tmid)\n",
      "Q2=Q- (tmin+460)*m*c*math.log((tmean+460)/(tmid+460))\n",
      "tot=Qavail+Q2\n",
      "#results\n",
      "print '%s %d %s' %(\"Total available energy =\",tot,\" Btu/lb of fuel\")\n",
      "print '%s' %(\"The answer is a bit different due to rounding off error in textbook\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total available energy = 9079  Btu/lb of fuel\n",
        "The answer is a bit different due to rounding off error in textbook\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 8 - Pg 308"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#calculate the max amount of work available\n",
      "#Initalization of variables\n",
      "print '%s' %(\"From table 14-2,\")\n",
      "G1=55750. #Btu/mol\n",
      "co2=-169580. #Btu/mol\n",
      "h2o=-98290. #Btu/mol\n",
      "#calculations\n",
      "G2=6*co2+3*h2o\n",
      "avail=G1-G2\n",
      "#results\n",
      "print '%s %d %s' %(\"Max. amount of work =\",avail,\"Btu/mol\")\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "From table 14-2,\n",
        "Max. amount of work = 1368100 Btu/mol\n"
       ]
      }
     ],
     "prompt_number": 8
    }
   ],
   "metadata": {}
  }
 ]
}