summaryrefslogtreecommitdiff
path: root/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter9_2.ipynb
blob: 9448e892592f279fee670165e5463dd459679c8d (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
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
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
{
 "metadata": {
  "name": "",
  "signature": "sha256:7e02442740cf50f0beae7f1fd9dfdf2fb7a16b9c0848a48a17d80c7a19de3f3d"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 9:Combustion"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.1:PG-229"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "\n",
      "AFactual=20 # air fuel ratio actual\n",
      "# The energy balance is done from equation\n",
      "\n",
      "# C4H10 + 6.5(O2+3.76N2)-----> 4CO2 + 5H2O + 24.44N2\n",
      "\n",
      "P=100 # atmospheic preesure in kPa\n",
      "mair=6.5*(1+3.76)*29 # mass of air\n",
      "mfuel=1*58 # mass of fuel\n",
      "AFth=mair/mfuel # theoritical air-fuel ratio\n",
      "Pexcessair=(AFactual-AFth)*100/AFth\n",
      "\n",
      "print \"The % excess air is\",round(Pexcessair,2),\"% \\n\"\n",
      "\n",
      "# NOW THE REACTION IS\n",
      "# C4H10+ (1+%excessair/100)*6.5*(O2+3.76N2) -----> 4CO2 + 5H2O + 1.903O2 + 31.6N2\n",
      "\n",
      "PCO2=4/42.5*100 # VOLUME % OF CO2\n",
      "\n",
      "print \"The volume % of CO2 is\",round(PCO2,2),\"% \\n\"\n",
      "\n",
      "# NOW WE FIND DEW POINT\n",
      "Nv=5 # moles of water\n",
      "N=42.5 # moles of air\n",
      "Pv=P*(Nv/N) # partial pressure of vapour\n",
      "Tdp=49# dew point temperature in degree celsius from table C.2\n",
      "\n",
      "print \"The Dew point temperature is\",round(Tdp,2),\"degree celsius\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The % excess air is 29.28 % \n",
        "\n",
        "The volume % of CO2 is 9.41 % \n",
        "\n",
        "The Dew point temperature is 49.0 degree celsius\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.2:PG-231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "\n",
      "Pair=0.9 # 90% air is used for combustion\n",
      "\n",
      "# THE REACTION IS\n",
      "# C4H10 + 0.9*6.5*(O2+3.76N2)----> aCO2 + 5H20 + bCO\n",
      "# a and b are calculated by atomic balance\n",
      "a=2.7\n",
      "b=1.3\n",
      "PCO=b*100/31 # volume % of CO\n",
      "\n",
      "print \"The volume % of CO is\",round(PCO,2),\"% \\n\"\n",
      "\n",
      "mair=6.5*Pair*4.76*29 # mass of air in kg\n",
      "mfuel=1*58 # mass of fuel butane in kg\n",
      "AF=mair/mfuel # air-fuel ratio\n",
      "\n",
      "print \"The air to fuel ratio is\",round(AF,2),\"kg air/ kg fuel \"\n",
      "# THE SOLUTION IS CORRECT BUT  THERE ARE SOME PRINTING MISTAKES IN TEXTBOOK\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The volume % of CO is 4.19 % \n",
        "\n",
        "The air to fuel ratio is 13.92 kg air/ kg fuel \n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.3:PG-231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "\n",
      "# THE REACTION IS\n",
      "# aC4H10 + b(O2+3.76N2)----> CO2 + 1CO + 3.5H20 + 84.6N2 + cH2O\n",
      "# a, b and c are calculated by atomic balance\n",
      "# on balancing the equations we get a=3 b=22.5 c=15\n",
      "# Now equation becomes\n",
      "#C4H10 + 7.5(O2+3.76N2)----> 3.67CO2 + 0.33CO + 1.17H20 + 28.17N2 + 5H2O\n",
      "#MOLES OF AIR in this equation is 7.5 moles\n",
      "mairactual=7.5 # in moles\n",
      "#MOLES OF AIR in standard equation of Ex.9 is 6.5\n",
      "mairtheoritical=6.5\n",
      "Ptheoriticalair=100*(mairactual/mairtheoritical) \n",
      "print \"The % theoritical air is\",round(Ptheoriticalair,1),\"% \"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The % theoritical air is 115.4 % \n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.4:PG-232"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "# The reaction equation is \n",
      "#CaHb + c(O2+3.76N2)---> 10.4CO2 + 1.2CO + 2.8O2 + 85.6N2 + dH2O\n",
      "\n",
      "# using atomic balancing the equations become\n",
      "\n",
      "# C11.6H37.9 + 21.08(O2+3.76N2)---> 11.6CO2 + 18.95H2O + 79.26N2\n",
      "Ptheoriticalair=22.8*100/21.08 # theoritical air\n",
      "excessair=Ptheoriticalair-100\n",
      "\n",
      "print\"The excess air is\",round(excessair),\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The excess air is 8.0 %\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.5:PG-235"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "# The reaction equation is \n",
      "#C3H8 + 5(O2+3.76N2)---> 3CO2 + 18.8N2 + 4H2O\n",
      "\n",
      "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
      "hfCO2=-393520 # enthalpy associated with CO2\n",
      "hfH2O=-285830 # enthalpy associated with H2O(l)\n",
      "hfC3H8=-103850# ehthalpy associated with C3H8\n",
      "\n",
      "# by first law Q= Hproducts - Hreactants\n",
      "\n",
      "Qg=3*(hfCO2)+4*(hfH2O)-(hfC3H8) # enthalpy of combustion for gaseous propane\n",
      "\n",
      "print \" The enthalpy of combustion for gaseous propane is\",round(Qg),\"kJ\\n\"\n",
      "\n",
      "hv=15060 # enthalpy of vaporization for propane\n",
      "\n",
      "Ql=3*(hfCO2)+4*(hfH2O)-(hfC3H8-hv) # enthalpy of combustion for liquid propane\n",
      "\n",
      "print \" The enthalpy of combustion for liquid propane is\",round(Ql),\"kJ\\n\"\n",
      "\n",
      "#The answers are slightly different in textbook as they have approximated the result while in Python results are precise\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The enthalpy of combustion for gaseous propane is -2220030.0 kJ\n",
        "\n",
        " The enthalpy of combustion for liquid propane is -2204970.0 kJ\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.6:PG-235"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "# The reaction equation is \n",
      "#C3H8 + 5(O2+3.76N2)---> 3CO2 + 18.8N2 + 4H2O\n",
      "\n",
      "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
      "hfCO2=-393520 # enthalpy of formation associated with CO2\n",
      "hbarCO2=22280 #enthalpy associated with CO2 at 600K from table E.4\n",
      "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
      "\n",
      "hfH2O=-241820 # enthalpy of formation associated with gaseous H2O\n",
      "hbarH2O=20402 #enthalpy associated with H20 at 600K from table E.6\n",
      "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
      "\n",
      "hfC3H8=-103850# ehthalpy of formation associated with C3H8\n",
      "\n",
      "hbarN2=17563 #enthalpy associated with N2 at 600K from table E.2\n",
      "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
      "# by first law Q= Hproducts - Hreactants\n",
      "\n",
      "Qg=3*(hfCO2+hbarCO2-hdotbarCO2)+4*(hfH2O+hbarH2O-hdotbarH2O)+18.8*(hbarN2-hdotbarN2)-(hfC3H8) # enthalpy of combustion\n",
      "\n",
      "print\"The heat transfer required is\",round(Qg),\"kJ\\n\"\n",
      "\n",
      "#The answer is WRONG textbook as they have made an error in calculating Qg \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat transfer required is -1796043.0 kJ\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.7:PG-236"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "# initialization of variables\n",
      "# The reaction equation is \n",
      "\n",
      "#C8H18 + 12.5(O2+3.76N2)---> 8CO2 + 47N2 + 9H2O\n",
      "\n",
      "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
      "hfCO2=-393520 # enthalpy of formation associated with CO2\n",
      "hbarCO2=42769 #enthalpy associated with CO2 at 1000K from table E.4\n",
      "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
      "\n",
      "hfH2O=-241820 # enthalpy of formation associated with gaseous H2O\n",
      "hbarH2O=35882 #enthalpy associated with H20 at 1000K from table E.6\n",
      "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
      "hfC3H8=-103850# ehthalpy of formation associated with C3H8\n",
      "\n",
      "hbarN2p=(30784+29476)/2 #enthalpy associated with N2 at 1000K from table E.2 by averaging enthalpy at 1020K and 980K for product\n",
      "hbarN2r=17563 #enthalpy associated with N2 at 600K from table E.2 for reactant\n",
      "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
      "\n",
      "hfC8H18=-249910 # enthalpy of formation associated with octane taken from internet as not provided in textbook\n",
      "\n",
      "hbarO2=17929 # enthalpy associated with O2 at 600K table E.3\n",
      "hdotbarO2=8682#enthalpy associated with O2 at 298K table E.3\n",
      "\n",
      "# using first law and including kinetic energy change\n",
      "# 0=Hp-Hr+Mp*(V^2)/2\n",
      "\n",
      "Hp=8*(hfCO2+hbarCO2-hdotbarCO2)+9*(hfH2O+hbarH2O-hdotbarH2O)+47*(hbarN2p-hdotbarN2)\n",
      "# enthalpy of products\n",
      "\n",
      "Hr=(hfC8H18)+12.5*(hbarO2-hdotbarO2)+47*(hbarN2r-hdotbarN2)\n",
      "# enthalpy of reactants\n",
      "\n",
      "Mp=8*44+9*18+47*28 #(mass of products by multiplying molecular mass to number of moles)\n",
      "\n",
      "V=math.sqrt(2*1000*(Hr-Hp)/Mp)# exit velocity using energy balance\n",
      "\n",
      "print \"The exit velocity is\",round(V),\"m/s\"\n",
      "\n",
      "#The answers are slightly different in textbook as they have approximated the values while in Python results are precise\n",
      "\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The exit velocity is 2116.0 m/s\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.8:PG-237"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "\n",
      "# The reaction equation with theoritical air is \n",
      "# C8H18 + 12.5(O2+3.76N2)---> 8CO2 + 47N2 + 9H2O\n",
      "\n",
      "# for 400% theoritical air reaction is\n",
      "\n",
      "# C8H18 + 50(O2+3.76N2)---> 8CO2 + 188N2 + 9H2O + 37.5O2\n",
      "\n",
      "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
      "hfCO2=-393520 # enthalpy of formation associated with CO2\n",
      "hbarCO2=42769 #enthalpy associated with CO2 at 1000K from table E.4\n",
      "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
      "hfH2O=-241820 # enthalpy of formation associated with gaseous H2O\n",
      "hbarH2O=35882 #enthalpy associated with H20 at 1000K from table E.6\n",
      "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
      "hbarN2p=(30784+29476)/2 #enthalpy associated with N2 at 1000K from table E.2 by averaging enthalpy at 1020K and 980K \n",
      "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
      "\n",
      "hfC8H18=-249910 # enthalpy associated with octane taken from internet as not provided in textbook\n",
      "hbarO2=31389 # enthalpy associated with O2 at 1000K table E.3\n",
      "hdotbarO2=8682#enthalpy associated with O2 at 298K table E.3\n",
      "\n",
      "Hp=8*(hfCO2+hbarCO2-hdotbarCO2)+9*(hfH2O+hbarH2O-hdotbarH2O)+37.5*(hbarO2-hdotbarO2)+188*(hbarN2p-hdotbarN2)# enthalpy of products\n",
      "\n",
      "Hr=(hfC8H18)\n",
      "# enthalpy of reactants\n",
      "\n",
      "Q=Hp-Hr # using first law2\n",
      "\n",
      "print \" The heat transfer is\",round(Q),\"kJ\"\n",
      "\n",
      "#The answers are slightly different in textbook as they have approximated the values while in Python results are precise\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The heat transfer is 312593.0 kJ\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.9:PG-237"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "\n",
      "# The reaction equation is \n",
      "#C3H8 + 5O2---> 8CO2 + 4H2O\n",
      "\n",
      "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
      "hfCO2=-393520 # enthalpy associated with CO2\n",
      "hfH2O=-241820 # enthalpy associated with gaseous H2O\n",
      "hfC3H8=103850# enthalpy of formation associated with C3H8\n",
      "hfgC3H8=15060# enthalpy of vapourization associated with C3H8\n",
      "T=20+273 # temperature in kelvin\n",
      "Rbar=8.314 # universal gas constant\n",
      "Nr=6 # number of moles of reactants\n",
      "Np=7 # number of moles of products\n",
      "Hp=3*(hfCO2)+4*(hfH2O) # enthalpy of products\n",
      "\n",
      "Hr=hfC3H8+hfgC3H8 # enthalpy of reactants\n",
      "\n",
      "Q=(Hp-Hr-(Nr-Np)*Rbar*T)*10**(-3) # heat transfer from first law\n",
      "\n",
      "print \" The heat transfer is\",round(Q),\"MJ\"\n",
      "\n",
      "#The answers are slightly different in textbook as they have approximated the values while in Python results are precise\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The heat transfer is -2264.0 MJ\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.10:PG-239"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "\n",
      "# The reaction equation for theoritical air is \n",
      "#C3H8 + 5(O2 + 3.76N2) ---> 3CO2 + 4H2O + 18.8N2\n",
      "\n",
      "# for 250% theoritical air reaction becomes\n",
      "#C3H8 + 12.5(O2 + 3.76N2) ---> 3CO2 + 4H2O + 47N2 + 7.5O2\n",
      "\n",
      "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
      "\n",
      "Np=47+7.5+4+3 # number of moles of product\n",
      "hfCO2=-393520 # enthalpy of formation associated with CO2\n",
      "hbarCO2=(62963+65271)/2 #enthalpy associated with CO2 at 1380 K from table E.4\n",
      "hbarCO2dash=(58381+60666)/2 #enthalpy associated with CO2 at 1300 K by average from table E.4\n",
      "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
      "\n",
      "hfC3H8=-103850# ehthalpy of formation associated with C3H8\n",
      "\n",
      "hfH2O=-241820 # enthalpy of formation associated with gaseous H2O\n",
      "hbarH2O=(51521+53351)/2 #enthalpy associated with H20 at 1380 K by taking average from table E.6\n",
      "hbarH2Odash=48807 #enthalpy associated with H20 at 1300 K  from table E.6\n",
      "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
      "\n",
      "hbarN2=42920 #enthalpy associated with N2 at 1380K from table E.2 by interpolating enthalpy between 1020K and 980K \n",
      "hbarN2dash=40170 #enthalpy associated with N2 at 1300 K from table E.2 \n",
      "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
      "\n",
      "hfO2=(44198+45648)/2 # enthalpy associated with O2 at 1380 Kby taking average from table E.3\n",
      "hfO2dash=48807 # enthalpy associated with O2 at 1380 Kby taking average from table E.3\n",
      "hdotbarO2=8682#enthalpy associated with O2 at 298K table E.3\n",
      "\n",
      "# for adiabatic flame temperature first assume products composed only of nitrogen and Q=0 as adiabatic\n",
      "hp=(hfC3H8-3*(hfCO2)-4*(hfH2O))/Np +hdotbarN2\n",
      "# using hp we assume temp=1380 K\n",
      "# then energy for 1380 k is\n",
      "H1=3*(hfCO2+hbarCO2-hdotbarCO2)+4*(hfH2O+hbarH2O-hdotbarH2O)+7.5*(hfO2-hdotbarO2)+47*(hbarN2-hdotbarN2) # energy assuming temperature to be 1380 K\n",
      "\n",
      "#this is very large \n",
      "\n",
      "# now at 1300 K adiabatic temperature\n",
      "H2=3*(hfCO2+hbarCO2dash-hdotbarCO2)+4*(hfH2O+hbarH2Odash-hdotbarH2O)+7.5*(hfO2dash-hdotbarO2)+47*(hbarN2dash-hdotbarN2) # energy assuming temperature to be 1300 K\n",
      " \n",
      " # now interpolation between these two temperatures\n",
      "Tp=1300-((hp+H2)/(H1-H2))*(1380-1300) # adiabatic temperature by interpolation\n",
      "print \"The adiabatic flame temperature is\",round(Tp),\"K\"\n",
      "\n",
      "#The answers is different in textbook as they have printed the value of hfCO2 with positive sign while calculating H2\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The adiabatic flame temperature is 1311.0 K\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex9.11:PG-240"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "\n",
      "# The reaction equation for theoritical air is \n",
      "#C3H8 + 5(O2 + 3.76N2) ---> 3CO2 + 4H2O + 18.8N2\n",
      "\n",
      "# All the enthalpy of formation values are taken from Table B.5 with units in kJ/mol\n",
      "\n",
      "Np=18.8+4+3 # number of moles of product\n",
      "hfCO2=-393520 # enthalpy associated with CO2\n",
      "hbarCO2=137400 #enthalpy associated with CO2 at 2600 K from table E.4 by interpolation\n",
      "hbarCO2dash=125152 #enthalpy associated with CO2 at 2400 K from table E.4\n",
      "hdotbarCO2=9364#enthalpy associated with CO2 at 298K from table E.4\n",
      "\n",
      "hfC3H8=-103850# ehthalpy associated with C3H8\n",
      "\n",
      "hfH2O=-241820 # enthalpy associated with gaseous H2O\n",
      "hbarH2O=114273 #enthalpy associated with H20 at 2600 K from table E.6\n",
      "hbarH2Odash=103508 #enthalpy associated with H20 at 2400 K  from table E.6\n",
      "hdotbarH2O=9904#enthalpy associated with H20 at 298K from table E.6\n",
      "\n",
      "hbarN2=86600 #enthalpy associated with N2 at 2600 K from table E.2 by interpolation\n",
      "hbarN2dash=79320 #enthalpy associated with N2 at 2400 K from table E.2 \n",
      "hdotbarN2=8669#enthalpy associated with N2 at 298K from table E.2\n",
      "\n",
      "# for adiabatic flame temperature first assume products composed only of nitrogen and Q=0 as adiabatic\n",
      "hp=(hfC3H8-3*(hfCO2)-4*(hfH2O))/Np +hdotbarN2 \n",
      "\n",
      "# using hp we assume temp=2600 K\n",
      "# then energy for 2600 k is\n",
      "H1=3*(hfCO2+hbarCO2-hdotbarCO2)+4*(hfH2O+hbarH2O-hdotbarH2O)+18.8*(hbarN2-hdotbarN2) # energy assuming temperature to be 2600 K\n",
      "\n",
      "# now at 2400 K adiabatic temperature\n",
      "H2=3*(hfCO2+hbarCO2dash-hdotbarCO2)+4*(hfH2O+hbarH2Odash-hdotbarH2O)+18.8*(hbarN2dash-hdotbarN2) # energy assuming temperature to be 2400 K\n",
      " \n",
      " # now interpolation between these two temperatures\n",
      "Tp=2400-((hp+H2)/(H1-H2))*(2600-2400) # adiabatic temperature by interpolation\n",
      "print \"The adiabatic flame temperature is\",round(Tp),\"K\"\n",
      "\n",
      "#The answers are slightly different in textbook as they have approximated the values while in Python results are precise\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The adiabatic flame temperature is 2409.0 K\n"
       ]
      }
     ],
     "prompt_number": 27
    }
   ],
   "metadata": {}
  }
 ]
}