summaryrefslogtreecommitdiff
path: root/A_Textbook_Of_Chemical_Engineering_Thermodynamics/ch3.ipynb
blob: 6803c96ba01f5bbbb82d92e3432234932dd8762b (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
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
{
 "metadata": {
  "name": "",
  "signature": "sha256:2261ff03ab51ed2922b0b6d063ddc383a313c6be373040c779faf21d1a2afd0b"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 3 : PVT Behaviour And Heat Effects"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.1, , Page no:45"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "#Given:\n",
      "T = 350.; \t\t\t#temperature in K\n",
      "P = 10.**5; \t\t\t#pressure in N/m**2\n",
      "R = 8.314; \t\t\t#ideal gas constant\n",
      "\n",
      "# Calculations\n",
      "#To find the molar volume of air\n",
      "V = (R*T)/P; \t\t\t#molar volume in m**3\n",
      "\n",
      "# Results\n",
      "print 'Molar volume of air is %3.2e cubic m/mol'%V\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Molar volume of air is 2.91e-02 cubic m/mol\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.3, Page no:50"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "#Given:\n",
      "Cp = 29.3; \t\t\t#specific heat at constant pressure(kJ/kmol K)\n",
      "R = 8.314; \t\t\t#ideal gas constant\n",
      "\n",
      "# Calculations and Results\n",
      "#To determine heat and work effects for each step\n",
      "#Step 1: Gas is heated at constant volume\n",
      "T1 = 300.;   \t\t    \t#temperature in K\n",
      "P1 = 1.; \t    \t\t    #initial pressure in bar\n",
      "P2 = 2.; \t\t    \t    #final pressure in bar\n",
      "T2 = (P2/P1)*T1; \t\t\t#final temperature in K\n",
      "Cv = Cp-R; \t    \t    \t#specific heat at constant volume\n",
      "W1 = 0; \t\t    \t    #work done is zero as volume remains constant\n",
      "Q1 = Cv*(T2-T1); \t\t\t#heat supplied in kJ/kmol\n",
      "print 'For step 1'\n",
      "print 'Work done in step 1 is %i'%W1\n",
      "print 'Heat supplied in step 1 is %f kJ/kmol'%Q1\n",
      "\n",
      "#Step 2: The process is adiabatic\n",
      "Q2 = 0.; \t\t\t#the process is adiabatic\n",
      "P3 = 1.; \t\t\t#pressure after step 2 in bar\n",
      "gama = (Cp/Cv);\n",
      "T3 = ((P3/P2)**((gama-1)/gama))*T2; \t\t\t#temperature after step 2\n",
      "W2 = (Cv*(T2-T3)); \t\t\t#work done by system\n",
      "print 'For step 2'\n",
      "print 'Heat supplied in step 2 is %i'%Q2\n",
      "print 'Work done by system in step 2 is %f kJ/kmol'%W2\n",
      "\n",
      "#Step 3: The process is isobaric\n",
      "T4 = 300.; \t\t\t#temperature after step 3 (K)\n",
      "Q3 = Cp*(T4-T3); \t\t\t#heat supplied during step 3(kJ/kmol)\n",
      "U = (Cv*(T4-T3)); \t\t\t#change in internal energy during step 3(kJ/kmol)\n",
      "W3 = Q3-U; \t\t\t#Using first law of thermodynamics\n",
      "print 'For step 3'\n",
      "print 'Heat given out by the system in step 3 is %f kJ/kmol'%Q3\n",
      "print 'Work done on the system in step 3 is %f kJ/kmol'%W3\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "For step 1\n",
        "Work done in step 1 is 0\n",
        "Heat supplied in step 1 is 6295.800000 kJ/kmol\n",
        "For step 2\n",
        "Heat supplied in step 2 is 0\n",
        "Work done by system in step 2 is 2248.222546 kJ/kmol\n",
        "For step 3\n",
        "Heat given out by the system in step 3 is -5651.101658 kJ/kmol\n",
        "Work done on the system in step 3 is -1603.524204 kJ/kmol\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.4, Page no:51"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#Given:\n",
      "R = 8.314; \t\t\t#ideal gas constant\n",
      "Cp = 30.; \t\t\t#specific heat at constant pressure(J/mol K)\n",
      "\n",
      "# Calculations and Results\n",
      "#To calculate change in internal energy change in enthalpy work done and heat supplied\n",
      "import math\n",
      "#(a): Gas is expanded isothermally\n",
      "T = 600.; \t\t\t#temperature in K\n",
      "P1 = 5.; \t\t\t#initial pressure in bar\n",
      "P2 = 4.; \t\t\t#final pressure in bar\n",
      "U1 = 0; \t\t\t#since the process is isothermal\n",
      "H1 = 0; \t\t\t#since the process is isothermal\n",
      "W1 = (R*T*math.log(P1/P2)); \t\t\t#work done during the process\n",
      "Q1 = W1; \t\t\t#heat supplied during the process\n",
      "print 'When gas is expanded isothermally'\n",
      "print 'Change in internal energy in isothermal process is %i'%U1\n",
      "print 'Change in enthalpy in isothermal process is %i'%H1\n",
      "print \"Work done during the process is %f kJ/kmol\"%W1\n",
      "print 'Heat supplied during the process is %f kJ/kmol'%Q1\n",
      "\n",
      "#(b): Gas is heated at constant volume\n",
      "V = 0.1; \t\t\t#volume (m**3)\n",
      "P1 = 1.; \t\t\t#initial pressure(bar)\n",
      "T1 = 298.; \t\t\t#initial temperature(K)\n",
      "T2 = 400.; \t\t\t#final temperature(K)\n",
      "n = ((P1*V*10**5)/(R*T1)); \t\t\t#number of moles of gas\n",
      "Cv = Cp-R; \t\t\t#specific heat at constant volume(J/mol K)\n",
      "ans = round(Cv*(T2-T1))\n",
      "n = round(n,2)\n",
      "U2 = n*ans #Cv*round(T2-T1); \t\t\t#change in internal energy(J)\n",
      "H2 = n*Cp*(T2-T1); \t\t\t#change in enthalpy(J)\n",
      "W2 = 0; \t\t\t#isochoric process\n",
      "Q2 = U2+W2; \t\t\t#heat supplied(J)\n",
      "print '\\nWhen gas is heated at constant volume'\n",
      "print 'Change in internal energy is %.0f J'%U2\n",
      "print 'Change in enthalpy is %f J'%H2\n",
      "print 'Work done during the process is %i '% W2\n",
      "print 'Heat supplied during the process is %.0f J'%Q2\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "When gas is expanded isothermally\n",
        "Change in internal energy in isothermal process is 0\n",
        "Change in enthalpy in isothermal process is 0\n",
        "Work done during the process is 1113.129291 kJ/kmol\n",
        "Heat supplied during the process is 1113.129291 kJ/kmol\n",
        "\n",
        "When gas is heated at constant volume\n",
        "Change in internal energy is 8936 J\n",
        "Change in enthalpy is 12362.400000 J\n",
        "Work done during the process is 0 \n",
        "Heat supplied during the process is 8936 J\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.5, Page no:52"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "from scipy.integrate import quad\n",
      "\n",
      "\n",
      "def Cv(T):\n",
      "    y = 27.4528+(6.1839*(10**-3)*T)-(8.9932*(10**-7)*(T**2))-R;\n",
      "    return y\n",
      "\n",
      "# Variables\n",
      "m = 20.; \t\t\t#mass of air(kg)\n",
      "n = 1.25; \t\t\t#polytropic constant\n",
      "P1 = 1.; \t\t\t#initial pressure(bar)\n",
      "P2 = 5.; \t\t\t#final pressure(bar)\n",
      "T1 = 300.; \t\t\t#temperature(K)\n",
      "R = 8.314; \t\t\t#ideal gas constant\n",
      "M = 29.; \t\t\t#molecular wt of air\n",
      "\n",
      "# Calculations\n",
      "#To determine work done and amount of heat transferred\n",
      "#(a): Work done by the compressor per cycle\n",
      "n_mole = m/M; \t\t\t#moles of air(kmol)\n",
      "V1 = ((n_mole*10**3*R*T1)/(P1*10**5)); \t\t\t#initial volume(m**3)\n",
      "V2 = (V1*((P1/P2)**(1/n))); \t\t\t        #final volume(m**3)\n",
      "\n",
      "#Since the process is polytropic P(V**n)=c(say constant)\n",
      "c = P1*10**5*(V1**n); \n",
      "\t\t\t#function[z] = f(V);\n",
      "\t\t\t#    z = c/(V**1.25);\n",
      "\t\t\t#W1 = intg(V1,V2,f); so\n",
      "W = (c/(1-n))*((V2**(-n+1))-(V1**(-n+1)))/1000;\n",
      "print 'Work done by compressor is %4.3e J'%(W*1000);\n",
      "\n",
      "#(b): Amount of heat transferred to surrounding\n",
      "T2 = ((T1*V2*P2)/(V1*P1)); \t\t\t#final temp in K\n",
      "U1 = quad(Cv,T1,T2)[0];\n",
      "U = U1*n_mole; \t\t\t            #change in internal energy(kJ)\n",
      "Q = U+W; \t\t\t                #heat supplied\n",
      "\n",
      "# Results\n",
      "print 'Chnage in internal energy is %f kJ'%U\n",
      "print 'Heat supplied is %f kJ'%Q\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Work done by compressor is -2.613e+06 J\n",
        "Chnage in internal energy is 1667.979893 kJ\n",
        "Heat supplied is -944.769684 kJ\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.6, Page no:55"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "#Given:\n",
      "V = 0.3821*10**-3 \t\t\t#molar volume(m**3/mol)\n",
      "T = 313.; \t\t\t#temperature (K)\n",
      "R = 8.314; \t\t\t#ideal gas constant\n",
      "a = 0.365; b = 4.28*10**-5; \t\t\t#Vander Waals constant\n",
      "\n",
      "\n",
      "# Calculations and Results\n",
      "#To compare the pressures\n",
      "#(a): Ideal gas equation\n",
      "P = ((R*T)/(V*10**5)); \t\t\t#pressure in bar\n",
      "print 'Pressure obtained by ideal gas equation is %f bar'%P\n",
      "\n",
      "#(b): Van der Waals equation\n",
      "P = ((((R*T)/(V-b))-(a/(V**2)))/(10**5));\n",
      "print 'Pressure obtained by Van der Waals equation is %f bar'%P\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Pressure obtained by ideal gas equation is 68.104737 bar\n",
        "Pressure obtained by Van der Waals equation is 51.695679 bar\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.7, Page no:56"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#To find Approx Value\n",
      "def approx(V,n):\n",
      "  A=round(V*10**n)/10**n;\t\t\t#V-Value  n-To what place\n",
      "  return A\n",
      "\n",
      "# Variables\n",
      "#Given:\n",
      "T = 300.; \t\t\t#temperature(K)\n",
      "P = 100.; \t\t\t#pressure(bar)\n",
      "R = 8.314; \t\t\t#ideal gas constant\n",
      "a = 0.1378\n",
      "b = 3.18*10**-5; \t\t\t#Van der waals constant\n",
      "\n",
      "# Calculations and Results\n",
      "#(a): Ideal gas equation\n",
      "V_ideal = approx(((R*T)/(P*10**5)),6);\n",
      "print 'Volume calculated by ideal gas equation is %4.2e cubic m'%V_ideal\n",
      "\n",
      "#(b): Van der Waals equation\n",
      "def f(V):\n",
      "    y=((P*10**5)+(a/(V**2)))*(V-b)-(R*T); \t\t\t#function to calculate difference between calculated and assumed volume\n",
      "    return y\n",
      "    \n",
      "V_real = 0;\n",
      "i = 0.20\n",
      "while i<=.30:  \t\t\t#Van der waals volume should be nearly equal to Ideal gas valoume\n",
      "    res = approx(f(i*10**-3),0);\n",
      "    for j in range(-5,6):\n",
      "        if(j==res): \t\t\t#for very small difference i may be taken as exact volume\n",
      "            V_real = i*10**-3;\n",
      "    i += 0.01\n",
      "\n",
      "print 'Volume calculated by Van der Waals equation is %3.2e cubic m'%V_real\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Volume calculated by ideal gas equation is 2.49e-04 cubic m\n",
        "Volume calculated by Van der Waals equation is 2.30e-04 cubic m\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.9, Page no:59 "
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "#To find Approx Value\n",
      "def approx(V,n):\n",
      "  A=round(V*10**n)/10**n;\t\t\t#V-Value  n-To what place\n",
      "  return A\n",
      "\n",
      "\n",
      "# Variables\n",
      "#Given:\n",
      "T = 500.; \t\t\t#temperature (K)\n",
      "P = 10.; \t\t\t#pressure(bar)\n",
      "R = 8.314; \t\t\t#ideal gas constant\n",
      "B = -2.19*10**-4; C=-1.73*10**-8; \t\t\t#Virial coeffecients\n",
      "Tc = 512.6; \t\t\t#critical temperature\n",
      "Pc = 81.; \t\t\t#critical pressure\n",
      "\n",
      "#To calculate compressibility factor and molar volume\n",
      "\n",
      "# Calculations and Results\n",
      "#(a): Truncated form of virial equation\n",
      "V_ideal = approx(((R*T)/(P*10**5)),7); \t\t\t#ideal gas volume\n",
      "def f1(V):\n",
      "    z = (((R*T)/(P*10**5))*(1+(B/V)+(C/(V**2)))); \t\t\t#function for obtaining volume by virial equation\n",
      "    return z\n",
      "\n",
      "#loop for hit and trial method\n",
      "flag = 1;\n",
      "while(flag==1):\n",
      "    V_virial = approx(f1(V_ideal),7);\n",
      "    if(approx(V_ideal,5)==approx(V_virial,5)):\n",
      "        flag = 0;\n",
      "        break;\n",
      "    else:\n",
      "        V_ideal = V_virial;\n",
      "\n",
      "\n",
      "Z = approx(((P*10**5*V_virial)/(T*R)),3); \t\t\t#compressibility factor\n",
      "print 'Compressibilty factor for virial equation is %f '%Z\n",
      "\n",
      "#(b): Redlich Kwong Equation\n",
      "#Constants in Redlich Kwong equation\n",
      "a = approx(((0.4278*(R**2)*(Tc**2.5))/(Pc*10**5)),4);\n",
      "b = approx(((0.0867*R*Tc)/(Pc*10**5)),9);\n",
      "\n",
      "V_ideal = approx(((R*T)/(P*10**5)),7); \t\t\t#ideal gas volume\n",
      "\n",
      "#Function to find volume by Redlich Kwong equation \n",
      "def f2(V):\n",
      "    x = ((R*T)/(P*10**5))+b-((a*(V-b))/((T**0.5)*(P*10**5)*V*(V+b)));\n",
      "    return x\n",
      "\n",
      "#loop for hit and trial method\n",
      "flag = 1;\n",
      "while(flag==1):\n",
      "    V_redlich = approx(f2(V_ideal),7);\n",
      "    if(approx(V_ideal,5)==approx(V_redlich,5)):\n",
      "        flag = 0;\n",
      "        break;\n",
      "    else:\n",
      "\t    V_ideal = V_redlich;\n",
      "\n",
      "print 'Volume obtained by Redlich Kwong Equation is %4.3e cubic m/mol'%V_redlich\n",
      "Z = approx(((P*10**5*V_redlich)/(T*R)),3); \t\t\t#compressibility factor\n",
      "print 'Compressbility factor by Redlich Kwong equation is %f'%Z\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Compressibilty factor for virial equation is 0.943000 \n",
        "Volume obtained by Redlich Kwong Equation is 3.963e-03 cubic m/mol\n",
        "Compressbility factor by Redlich Kwong equation is 0.953000\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.10, Page no:64"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "#Given:\n",
      "Ha = -890.94; \t\t\t#standard heat for reaction a (kJ)\n",
      "Hb = -393.78; \t\t\t#standard heat for reaction b (kJ)\n",
      "Hc = -286.03; \t\t\t#standard heat for reaction c (kJ)\n",
      "\n",
      "# Calculations\n",
      "#To calculate heat of formation of methane gas\n",
      "#c*2 + b - a gives the formation of methane from elements\n",
      "Hf = (2*Hc)+Hb-Ha;\n",
      "\n",
      "# Results\n",
      "print 'Heat of formation of methane is %f kJ/mol'%Hf\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat of formation of methane is -74.900000 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 20
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.11, Page no:65"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "# Variables\n",
      "#Given:\n",
      "Ha = -509.93; \t\t\t#heat of combustion of reaction a (kJ) \n",
      "Hb = -296.03; \t\t\t#heat of combustion of reaction b (kJ)\n",
      "Hc = -393.78; \t\t\t#heat of combustion of reaction c (kJ)\n",
      "Hd = -167.57; \t\t\t#heat of combustion of reaction d (kJ)\n",
      "\n",
      "# Calculations\n",
      "#To calculate heat of formation of chloroform\n",
      "#c + (3*d) -a -b gives chloroform from its elements\n",
      "Hf = Hc+(3*Hd)-Ha-Hb;\n",
      "\n",
      "# Results\n",
      "print 'Heat of formation of chloroform is %f kJ/mol'%Hf"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat of formation of chloroform is -90.530000 kJ/mol\n"
       ]
      }
     ],
     "prompt_number": 21
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.12, Page no:67"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "#Given:\n",
      "Ho = -164987.; \t\t\t#standard heat of reaction at 298 K in J\n",
      "T1 = 298.;\n",
      "T2 = 773.; \t\t\t#temperature(K)\n",
      "\n",
      "# Calculations\n",
      "#To calculate standard heat of reaction at 773 K\n",
      "alpha = (2*29.16)+13.41-26.75-(4*26.88);\n",
      "betta = ((2*14.49)+77.03-42.26-(4*4.35))*10**-3;\n",
      "gama = ((2*-2.02)-18.74+14.25+(4*0.33))*10**-6;\n",
      "#Using equation 3.54 (Page no. 67)\n",
      "H1 = Ho-(alpha*T1)-(betta*(T1**2)/2)-(gama*(T1**3)/3);\n",
      "#At 773 K\n",
      "Hr = H1+(alpha*T2)+(betta*(T2**2)/2)+(gama*(T2**3)/3);\n",
      "\n",
      "# Results\n",
      "print 'Heat of reaction at 773 K is %f kJ'%(Hr/1000)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat of reaction at 773 K is -183.950273 kJ\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.13, Page no:68"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "#Given:\n",
      "To = 298.; \t\t\t#standard temperature(K)\n",
      "T1 = 400.; \t\t\t#temperature of reactants(K)\n",
      "T2 = 600.; \t\t\t#temperature of products (K)\n",
      "Ho = -283.028; \t\t\t#standard heat of reaction(kJ/mol)\n",
      "\n",
      "# Calculations\n",
      "#To determine heat added or removed\n",
      "#Basis:\n",
      "n_CO = 1.; \t\t\t#moles of CO reacted\n",
      "n_O2 = 1.;\t\t\t#moles of oxygen supplied\n",
      "n_N2 = 1.*79./21; \t\t\t#moles of nitrogen\n",
      "n1_O2 = 0.5; \t\t\t#moles of oxygen required\n",
      "n_CO2 = 1.; \t\t\t#moles of carbon di oxide formed\n",
      "\n",
      "H1 = ((n_O2*29.70)+(n_N2*29.10)+(n_CO*29.10))*(To-T1)/1000; \t\t\t#enthalpy of cooling of reactants\n",
      "H2 = ((n1_O2*29.70)+(n_N2*29.10)+(n_CO2*41.45))*(T2-To)/1000; \t\t\t#enthalpy of heating the products\n",
      "Hr = H1+Ho+H2;\n",
      "\n",
      "# Results\n",
      "print 'Heat supplied is %f kJ'%Hr\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat supplied is -250.128714 kJ\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 3.14, Page no:69"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "\n",
      "\n",
      "# Variables\n",
      "#Given:\n",
      "To = 298.; \t\t\t#standard temperature (K)\n",
      "T1 = 373.; \t\t\t#temperature of reactants (K)\n",
      "Ho = 283178.; \t\t\t#standard heat of combustion(J/mol)\n",
      "\n",
      "# Calculations\n",
      "#To calculate theoretical flame temperature\n",
      "#Basis:\n",
      "n_CO = 1.; \t\t\t#moles of CO\n",
      "n_O2 = 1.; \t\t\t#moles of oxygen supplied\n",
      "n1_O2 = 0.5; \t\t\t#moles of oxygen reacted\n",
      "n_CO2 = 1.; \t\t\t#moles of carbon di oxide formed\n",
      "n_N2 = 79./21; \t\t\t#moles of nitrogen\n",
      "\n",
      "H1 = ((n_O2*34.83)+(n_N2*33.03)+(n_CO*29.23))*(To-T1); \t\t\t#enthalpy of cooling of reactants\n",
      "#Using equation 3.55 (Page no. 69)\n",
      "H2 = Ho-H1;\n",
      "Tf = H2/((n1_O2*34.83)+(n_N2*33.03)+(n_CO2*53.59))+298; \t\t\t#flame temperature\n",
      "\n",
      "# Results\n",
      "print 'Theoretical flame temperature is %f K'%Tf\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Theoretical flame temperature is 1820.588298 K\n"
       ]
      }
     ],
     "prompt_number": 24
    }
   ],
   "metadata": {}
  }
 ]
}