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
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
|
{
"metadata": {
"name": "",
"signature": "sha256:62da0bbd390eac5357f5f997103c8800ba34f828bad9afe3f011ec1444ac1334"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter19-Chemical reactions"
]
},
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Example1-pg 404"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#caluclate fuel ratio and excess air and emass air-fuel ratio\n",
"##initialisation of variables\n",
"pN2= 79. ##percent\n",
"VN2= 82.3 ##m^3\n",
"VCO2= 8. ##m^3\n",
"VCO= 0.9 ##m^3\n",
"M= 32. ##gms\n",
"M1= 28. ##gms\n",
"##CALCULATIONS\n",
"P= (pN2/(100-pN2))\n",
"z= VN2/P\n",
"x= VCO2+VCO\n",
"w= VCO2+(VCO/2)+(VCO2/10)\n",
"y= 2*w\n",
"r= y/x\n",
"TO= x+(y/4)\n",
"X= (z/TO)-1\n",
"AF= z*(M+P*M1)/(12*x+y)\n",
"##RESULTS\n",
"print'%s %.3f %s'%('fuel ratio=',r,'')\n",
"print'%s %.3f %s'%('excess air=',X,'')\n",
"print'%s %.2f %s'%('emass air-fuel ratio=',AF,'')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"fuel ratio= 2.079 \n",
"excess air= 0.618 \n",
"emass air-fuel ratio= 23.98 \n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example2-pg 410"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate heat interaction\n",
"##initialisation of variables\n",
"m1= 24. ##kg\n",
"M1= 32. ##kg\n",
"m2= 28. ##kg\n",
"M2= 28. ##kg\n",
"e= 0.5\n",
"T3= 1800. ##C\n",
"T0= 25. ##C\n",
"T1= 25. ##C\n",
"T2= 100. ##C\n",
"R= 8.314 ##Jmol K\n",
"cp= 4.57 ##J/mol K\n",
"cp1= 3.5 ##J/mol K\n",
"cp2= 3.5 ##J/mol K\n",
"hCO2= -393522. ##J\n",
"hCO= -110529. ##J\n",
"##CALCULATIONS\n",
"n1= m1/M1\n",
"n2= m2/M2\n",
"N= n1-0.5*e\n",
"N1= n2-e\n",
"N2= e\n",
"N3= N+N1+N2\n",
"y1= N/N3\n",
"Q= ((N*cp+N1*cp1+N2*cp2)*R*(T3-T0)-(n1*cp*(T1-T0)+n2*cp2*(T2-T1))+N*(hCO2-hCO))/60.\n",
"##RESULTS\n",
"print'%s %.f %s'%(' Heat interaction=',Q,'kW ')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
" Heat interaction= -940 kW \n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example3-pg 412"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate adiabatic flame temperature\n",
"##initialisation of variables\n",
"T0= 25. ##C\n",
"T1= 220. ##C\n",
"hCO2= -393520 ##kJ/kg\n",
"hH2O= -241830 ##kJ/kg\n",
"hC3H8= -103850 ##kJ/kg= 1.4\n",
"R= 8.314 ##Jmol K\n",
"k= 1.4\n",
"k1= 1.29\n",
"##CALCULATIONS\n",
"T= T0+((15*(R*(k/(k-1)))*4.762*(T1-T0)-(3*hCO2+4*hH2O-hC3H8))/(R*((3+4)*(k1/(k1-1))+(10+56.43)*(k/(k-1)))))\n",
"##RESULTS\n",
"print'%s %.1f %s'%('adiabatic flame temperature=',T,'C ')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"adiabatic flame temperature= 1142.4 C \n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example5-pg 415"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate enthalpy formation\n",
"##initialisation of variables\n",
"T= 25. ##C\n",
"hfT= -241820 ##kJ/kmol\n",
"R= 8.314 ##J/mol K\n",
"k= 1.4\n",
"cpH2O= 4.45\n",
"cpO2= 3.5\n",
"T1= 1000. ##C\n",
"##CALCULATIONS\n",
"S= (cpH2O-k*cpO2)\n",
"hfT1= hfT+S*(T1-T)\n",
"##RESULTS\n",
"print'%s %.f %s'%('enthalpy formation=',hfT1,'kJ/kmol ')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"enthalpy formation= -242259 kJ/kmol \n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example6-pg 418"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate equlibrium constant at K and KT1\n",
"##initialisation of variables\n",
"R= 8.314 ##J/mol K\n",
"T= 25. ##C\n",
"gf= 16590. ##kJ/kmol\n",
"T1= 500. ##C\n",
"Cp= 4.157 ##J/mol K\n",
"hf= -46190 ##kJ/kmol\n",
"e=0.5\n",
"##CALCULATIONS\n",
"K=math.pow(math.e,gf/(R*(273.15+T)))\n",
"r= (1-((273.15+T)/(273.15+T1)))*((hf/(R*(273.15+T)))+(R/Cp))-2*math.log((273.15+T1)/(273.15+T))+0.6\n",
"KT1= K*math.pow(math.e,r)\n",
"##RESULTS\n",
"print'%s %.1f %s'%('equilibrium constant=',K,'bar^-1 ')\n",
"print'%s %.5f %s'%('equilibrium constant=',KT1,'bar^-1 ')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"equilibrium constant= 806.5 bar^-1 \n",
"equilibrium constant= 0.00797 bar^-1 \n"
]
}
],
"prompt_number": 9
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example7-pg 419"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#what equilibrium constant at T1 and T2\n",
"##initialisation of variables\n",
"uCO2= -394374 ##J/mol\n",
"uCO= -137150 ##J/mol\n",
"uO2= 0.\n",
"R= 8.314 ##J/mol K\n",
"T= 25. ##C\n",
"cpCO2= 4.57 ##J/mol K\n",
"cpCO= 3.5 ##J/mol K\n",
"cpO2= 3.5 ##J/mol K\n",
"T1= 1500. ##C\n",
"hf= -393522 ##kJ/kmol\n",
"gf= -110529 ##kJ/kmol\n",
"T2= 2500. ##C\n",
"##CALCULATIONS\n",
"r= -(uCO2-uCO-0.5*uO2)/(R*(273.15+T))\n",
"s= (cpCO2-cpCO-0.5*cpO2)\n",
"r1= (1-((273.15+T)/(273.15+T1)))*((hf-gf)/(R*(273.15+T))-s)+s*math.log((273.15+T1)/(273.15+T))\n",
"KT1= math.pow(math.e,r+r1)\n",
"r2= (1-((273.15+T)/(273.15+T2)))*((hf-gf)/(R*(273.15+T))-s)+s*math.log((273.15+T2)/(273.15+T))\n",
"KT2= math.pow(math.e,r+r2)\n",
"##RESULTS\n",
"print'%s %.f %s'%('equilibrium constant at T1=',KT1,'C ')\n",
"print'%s %.3f %s'%('equilibrium constant at T2=',KT2,'C ')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"equilibrium constant at T1= 3477 C \n",
"equilibrium constant at T2= 2.635 C \n"
]
}
],
"prompt_number": 10
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example8-pg422"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#what is maximum work of given variable \n",
"##initialisation of variables\n",
"Wc= 12. ##kg\n",
"hf= -393520 ##kJ/kmol\n",
"gf= -394360 ##kJ/kmol\n",
"##CALCULATIONS\n",
"Wmax= -gf/Wc\n",
"##RESULTS\n",
"print'%s %.f %s'%('maximum work=',Wmax,'kJ/kg of carbon ')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"maximum work= 32863 kJ/kg of carbon \n"
]
}
],
"prompt_number": 11
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example9-pg423"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate the outlet temperature and energy of formation and energy out let and energy of the products\n",
"##initialisation of variables\n",
"T= 25 ##C\n",
"R= 8.314 ##Jmol K\n",
"k= 1.27\n",
"k1= 1.34\n",
"hf= -393520 ##kJ/kmol\n",
"M= 28 ##gms\n",
"gf= -394360 ##kJ/kmol\n",
"M= 12 ##gms\n",
"##CALCULATIONS\n",
"T1= T+(-hf/((R)*((k/(k-1))+(0.2+4.5144)*(k1/(k1-1)))))\n",
"Bin= 0\n",
"dh= (k1*R/(k1-1))*(T1-T)\n",
"dh1= (k1*R/(k1-1))*math.log((273.15+T1)/(273.15+T))\n",
"H= dh-(273.15+T)*dh1\n",
"h= (k*R/(k-1))*(T1-T)+hf\n",
"h1= (k*R/(k-1))*math.log((273.15+T1)/(273.15+T))+((hf-gf)/(273.15+T))\n",
"h2= h-(273.15+T)*h1\n",
"Bout= (h2+(0.2+4.5144)*H)/M\n",
"##RESULTS\n",
"print'%s %.2f %s'%('outlet temperature=',T1,'C')\n",
"print'%s %.f %s'%('energy of formation=',Bin,'J')\n",
"print'%s %.f %s'%('energy at outlet=',H,'kJ/kmol')\n",
"print'%s %.f %s'%('energy of the products=',Bout,'k')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"outlet temperature= 2057.82 C\n",
"energy of formation= 0 J\n",
"energy at outlet= 46519 kJ/kmol\n",
"energy of the products= -9961 k\n"
]
}
],
"prompt_number": 12
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example10-pg427"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"#calculate the change in energy and amount of air and gas and netchange in energy and percent change in energy\n",
"##initialisation of variables\n",
"b= 1475.30 ##kJ/kg\n",
"b0= 144.44 ##kJ/kg\n",
"h2= 3448.6 ##kJkg\n",
"h1= 860.5 ##kJ/kg\n",
"k= 1.27 \n",
"k1= 1.34\n",
"R= 8.314 ##J/mol K\n",
"hf= -393520 ##kJ/kmol\n",
"hg= 72596 ##kJ/kmol\n",
"Mc= 12 ##kg\n",
"n= 1.2 ##moles\n",
"n1= 3.76 ##moles\n",
"M= 32. ##gms\n",
"M1= 28. ##gms\n",
"M2= 44. ##gms\n",
"n2= 0.2 ##moles\n",
"n3= 4.512 ##moles\n",
"B1= 25592. ##kJ/kmol C\n",
"B2= 394360. ##kJ/kmol C\n",
"e= 0.008065\n",
"##CALCULATIONS\n",
"B= b-b0\n",
"Q= h2-h1\n",
"CpCO2= k*R/(k-1)\n",
"CpO2= k1*R/(k1-1)\n",
"Qcoal= (hg+hf)/Mc\n",
"mcoal= Q/(-Qcoal)\n",
"ncoal= mcoal/Mc\n",
"r= (n*M+n1*M1)/Mc\n",
"r1= (M2+n2*M+n3*M1)/Mc\n",
"mair= r*mcoal\n",
"mgas= r1*mcoal\n",
"Bfuel= (B1-B2)*e\n",
"Bnet= Bfuel+B\n",
"p= B*100/(-Bfuel)\n",
"##RESULTS\n",
"print'%s %.2f %s'% ('change in energy=',B,'kJ/kg ')\n",
"print'%s %.3f %s'%('amount of air=',mair,'kg/kg ')\n",
"print'%s %.3f %s'%('amount of gas=',mgas,'kg/kg ')\n",
"print'%s %.3f %s'%('net change in energy=',Bnet,'kg/kg steam ')\n",
"print'%s %.2f %s'%('percent energy in original fuel=',p,'percent ')\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"change in energy= 1330.86 kJ/kg \n",
"amount of air= 1.159 kg/kg \n",
"amount of gas= 1.425 kg/kg \n",
"net change in energy= -1643.254 kg/kg steam \n",
"percent energy in original fuel= 44.75 percent \n"
]
}
],
"prompt_number": 13
}
],
"metadata": {}
}
]
}
|