summaryrefslogtreecommitdiff
path: root/Introduction_To_Chemical_Engineering_Thermodynamics_by_G._Halder/Ch4.ipynb
blob: c3a0a66f464e8aafb0724b12989a869a4f40cc12 (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
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 4  - Heat effects"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.1 Page: 118"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.1 - Page: 118\n",
      "\n",
      "\n",
      "Value of Qv is -326.40 kcal\n",
      "\n"
     ]
    }
   ],
   "source": [
    "from __future__ import division\n",
    "print \"Example: 4.1 - Page: 118\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "Qp = -327## [kcal]\n",
    "T = 27 + 273## [K]\n",
    "R = 2*10**(-3)## [kcal/K mol]\n",
    "#*************#\n",
    "\n",
    "# The reaction involved is:\n",
    "# C2H5OH(l) + 3O2(g) = 2CO2(g) + 3H2O(l)\n",
    "deltan = 2 - 3#\n",
    "Qv = Qp - deltan*R*T## [kcal]\n",
    "print \"Value of Qv is %.2f kcal\\n\"%(Qv)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.2 Page: 119"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.2 - Page: 119\n",
      "\n",
      "\n",
      "Heat produced in the reaction is -1019.9 kcal\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.2 - Page: 119\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "# Mg + (1/2)O2 = MgO ...............(1)\n",
    "deltaH1 = -610.01## [kcal]\n",
    "# 2Fe + (3/2)O2 = Fe2O3 ............(2)\n",
    "deltaH2 = -810.14## [kcal]\n",
    "#*************#\n",
    "\n",
    "# 3Mg + Fe2O3 = 3MgO + 2Fe .........(3)\n",
    "# Multiplying (1) by 3 and substracting from (2), we get (3):\n",
    "deltaH = 3*deltaH1 - deltaH2## [kcal]\n",
    "print \"Heat produced in the reaction is %.1f kcal\\n\"%(deltaH)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.3 Page: 121"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.3 - Page: 121\n",
      "\n",
      "\n",
      "The standard heat of formation of methane is -74.75 kJ/gmol\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.3 - Page: 121\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "# 2H2(g) + O2(g) ---------------> 2H2O .....................(1)\n",
    "deltaH1 = -241.8*2## [kJ/gmol H2]\n",
    "# C(graphite) + O2(g) =---------> CO2(g) ...................(2)\n",
    "deltaH2 = -393.51## [kJ/gmol C]\n",
    "# CH4(g) + 2O2(g) ---------------> CO2(g) + 2H2O(l) ........(3)\n",
    "deltaH3 = -802.36## [kJ/mol CH4]\n",
    "#*************#\n",
    "\n",
    "# For standard heat of formation of methane, (a) + (b) - (c)\n",
    "# C + 2H2 ------------------------> CH4\n",
    "deltaHf = deltaH1 + deltaH2 - deltaH3## [kJ/gmol]\n",
    "print \"The standard heat of formation of methane is %.2f kJ/gmol\\n\"%(deltaHf)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.4 Page: 122"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.4 - Page: 122\n",
      "\n",
      "\n",
      "Energy supplied by reaction A is -69.2 kJ\n",
      "\n",
      "Energy supplied by reaction B is -2802.8 kJ\n",
      "\n",
      "Reaction B supplies more energy to the organism\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.4 - Page: 122\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "deltaH_C6H12O6 = -1273## [kcal]\n",
    "deltaH_C2H5OH = -277.6## [kcal]\n",
    "deltaH_CO2 = -393.5## [kcal]\n",
    "deltaH_H2O = -285.8## [kcal]\n",
    "#**************#\n",
    "\n",
    "# C6H12O6(s) = 2C2H5OH(l) + 2CO2(g) ..........................(A)\n",
    "deltaH_A = 2*deltaH_C2H5OH + 2*deltaH_CO2 - deltaH_C6H12O6## [kJ]\n",
    "# C6H12O6(s) + 6O2(g) = 6CO2(g) + 6H2O(l) ...................(B)\n",
    "deltaH_B = 6*deltaH_CO2 + 6*deltaH_H2O - deltaH_C6H12O6## [kJ]\n",
    "print \"Energy supplied by reaction A is %.1f kJ\\n\"%(deltaH_A)#\n",
    "print \"Energy supplied by reaction B is %.1f kJ\\n\"%(deltaH_B)#\n",
    "if deltaH_A < deltaH_B:\n",
    "    print \"Reaction A supplies more energy to the organism\\n\"\n",
    "else:\n",
    "     print \"Reaction B supplies more energy to the organism\\n\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.5 Page: 122"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.5 - Page: 122\n",
      "\n",
      "\n",
      "Heat of formation of ZnSO4 is -233.48 kcal/kmol\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.5 - Page: 122\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "# Zn + S = ZnS ....................................................(A)\n",
    "deltaH_A = -44## [kcal/kmol]\n",
    "# ZnS + 3O2 = 2ZnO + 2SO2 .........................................(B)\n",
    "deltaH_B = -221.88## [kcal/kmol]\n",
    "# 2SO2 + O2 = 2SO3 ................................................(C)\n",
    "deltaH_C = -46.88## [kcal/kmol]\n",
    "# ZnO + SO3 = ZnSO4 ...............................................(D)\n",
    "deltaH_D = -55.10## [kcal/kmol]\n",
    "#***************#\n",
    "\n",
    "# Multiplying (A) by 2 & (D) by (2) and adding (A), (B), (C) & (D)\n",
    "# Zn + S + 2O2 = ZnSO4\n",
    "deltaH = 2*deltaH_A + deltaH_B + deltaH_C + 2*deltaH_D## [kcal/kmol for 2 kmol of ZnSO4]\n",
    "print \"Heat of formation of ZnSO4 is %.2f kcal/kmol\\n\"%(deltaH/2)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.6 Page: 124"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.6 - Page: 124\n",
      "\n",
      "\n",
      "Standard Heat of formation of NH3 is -11.8 kcal\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.6 - Page: 124\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "# HC : Heat of Combustion\n",
    "HC_NH3 = -90.6## [kcal]\n",
    "HC_H2 = -68.3## [kcal]\n",
    "#*************#\n",
    "\n",
    "# Heat of combustion of NH3:\n",
    "# 2NH3 + 3O = N2 + 3H2O ............................ (A)\n",
    "# Heat of combustion of H2:\n",
    "# H2 + O = H2O ..................................... (B)\n",
    "# Multiplying (B) by 3 & substracting from (A), we get:\n",
    "# 2NH3 = N2 + 3H2 .................................. (C)\n",
    "# Hf : Heat of Formation\n",
    "Hf_NH3 = -(2*HC_NH3 - 3*HC_H2)/2## [kcal]\n",
    "print \"Standard Heat of formation of NH3 is %.1f kcal\"%(Hf_NH3)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.7 Page: 125"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.7 - Page: 125\n",
      "\n",
      "\n",
      "The maximum attainable temperature is 2566.2 K\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.7 - Page: 125\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "# HC : Heat of Combustion\n",
    "HC_C2H2 = -310600# # [cal]\n",
    "#**************#\n",
    "\n",
    "# C2H2 + (5/2)O2 = 2CO2 + H2O\n",
    "Q = -HC_C2H2## [cal]\n",
    "# The gases present in the flame zone after combustion are carbon dioxide, water vapor and the unreacted nitrogen of the air.\n",
    "# Since (5/2) mole of oxygen were required for combustion, nitrogen required would be 10 mol.\n",
    "# Hence the composition of the resultant gas would be 2 mol CO2, 1  ol H2 & 10 mol N2.\n",
    "# Q = integrate('Cp(T)','T',T,298)#\n",
    "# On integrating we get:\n",
    "# Q = 84.52*(T - 298) + 18.3*10**(-3)*(T**2 - 298**2)\n",
    "#deff('[y] = f(T)','y = Q - 84.52*(T - 298) - 18.3*10**(-3)*(T**2 - 298**2)')#\n",
    "def f(T):\n",
    "    y = Q - 84.52*(T - 298) - 18.3*10**(-3)*(T**2 - 298**2)\n",
    "    return y\n",
    "from scipy.optimize import fsolve\n",
    "T = fsolve(f,7)## [K]\n",
    "print \"The maximum attainable temperature is %.1f K\"%(T)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.8 Page: 126"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.8 - Page: 126\n",
      "\n",
      "\n",
      "The theoretical temperature of combustion is 1906 degree Celsius\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.8 - Page: 126\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "Cp_CO2 = 54.56## [kJ/mol K]\n",
    "Cp_O2 = 35.20## [kJ/mol K]\n",
    "Cp_steam = 43.38## [kJ/mol K]\n",
    "Cp_N2 = 33.32## [kJ/mol K]\n",
    "# 2C2H6(g) + 7O2(g) = 4CO2(g) + 6H2O(g)\n",
    "deltaH_273 = -1560000## [kJ/kmol]\n",
    "#************#\n",
    "\n",
    "# Since the air is 25% in excess of the amount required,the combustion may be written as:\n",
    "# C2H6(g) + (7/2)O2(g) = 2CO2(g) + 3H2O(g)\n",
    "# 25% excess air is supplied.\n",
    "# Since the air contains N2 = 79% and O2 = 21%\n",
    "# C2H6(g) + 3.5O2(g) + 0.25*3.5O2(g) + (4.375*(79/21))N2 = 2CO2 + 3H2O + 0.875O2 + 16.46N2 .................. (A)\n",
    "# Considering the reaction (A),\n",
    "# Amount of O2:\n",
    "O2 = 3.5 + 3.5*0.25## [mol]\n",
    "# Amount of N2 required:\n",
    "N2 = 4.375*(79/21)## [mol]\n",
    "# Let the initial temperature of ethane and air be 0 OC and the temperature of products of combustion be T OC\n",
    "# Since heat librated by combustion = heat accumulated by combustion products\n",
    "Q = -deltaH_273## [kJ/mol K]\n",
    "T = Q/(2*Cp_CO2 + 3*Cp_steam + 0.875*Cp_O2 + N2*Cp_N2)## [OC]\n",
    "print \"The theoretical temperature of combustion is %d degree Celsius\"%(T)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.9 Page: 129"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.9 - Page: 129\n",
      "\n",
      "\n",
      "Laten heat of ice at -20 OC is 1266 cal/mol\n",
      "\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.9 - Page: 129\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "T1 = 273## [K]\n",
    "T2 = 253## [K]\n",
    "deltaH_273 = 1440## [cal/mol]\n",
    "Cp = 8.7## [cal/mol]\n",
    "#**************#\n",
    "\n",
    "deltaH_253 = deltaH_273 + Cp*(T2 - T1)## [cal/mol]\n",
    "print \"Laten heat of ice at -20 OC is %d cal/mol\\n\"%(deltaH_253)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.10 Page: 129"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.10 - Page: 129\n",
      "\n",
      "\n",
      "Heat of formation at 1273 K is -11172 cal\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.10 - Page: 129\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "T2 = 1273## [K]\n",
    "T1 = 300## [K]\n",
    "deltaH_300 = -11030## [cal/mol]\n",
    "#*************#\n",
    "\n",
    "# The chemical reaction involved is:\n",
    "# N2 + 3H2 = 2NH3\n",
    "# (1/2)N2 + (3/2)H2 = NH3\n",
    "# deltaH_1273 = deltaH_300 + integrate('Cp_NH3(T) - (1/2)*Cp_N2(T) - (1/2)*Cp_H2(T)','T',1273,300)#\n",
    "from sympy.mpmath import quad\n",
    "deltaH_1273 = deltaH_300 + quad(lambda T:(6.2 + 7.8*10**(-3)*T - 7.2*10**(-6)*T**2) - (1/2)*(6.45 + 1.4*10**(-3)*T) - (1/2)*(6.94 - 0.2*10**(-3)*T),[1273,300])## [cal]\n",
    "print \"Heat of formation at 1273 K is %d cal\"%(deltaH_1273)#"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example: 4.11 Page: 130"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Example: 4.11 - Page: 130\n",
      "\n",
      "\n",
      "Percent of excess air supplied is 39.9 %\n"
     ]
    }
   ],
   "source": [
    "print \"Example: 4.11 - Page: 130\\n\\n\"\n",
    "\n",
    "# Solution\n",
    "\n",
    "#*****Data*****#\n",
    "CO2 = 13.4## [percent by volume]\n",
    "N2 = 80.5## [percent by volume]\n",
    "O2 = 6.1## [percent by volume]\n",
    "#*************#\n",
    "\n",
    "# Basis : 100 cubic m of flue gas.\n",
    "Vol_N2_flue = N2## [Volume of Nitrogen in flue gas, cubic m]\n",
    "Vol_O2_flue = O2## [Volume of O2 in flue gas, cubic m]\n",
    "Vol_Air = N2/0.79## [Volume of air supplied, cubic m]\n",
    "Vol_O2 = Vol_Air*0.21## [Volume of O2 in air supply, cubic m]\n",
    "Vol_O2_cumbustion = Vol_O2 - Vol_O2_flue## [Volume of O2 used up in cumbustion of the fuel, cubic m]\n",
    "Excess_Air = Vol_O2_flue/Vol_O2_cumbustion * 100## [percent of excess air supplied]\n",
    "print \"Percent of excess air supplied is %.1f %%\"%(Excess_Air)#"
   ]
  }
 ],
 "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
}