summaryrefslogtreecommitdiff
path: root/Thermodynamics,_Statistical_Thermodynamics,_&_Kinetics/Chapter05.ipynb
blob: ce8818c7fb58cd3cd6a559f4a3dbc4775e3c0865 (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:2c9e6fedd22fa6b2ae65a19697803d5aa951ae2982e5a733c3ba66fccdc2f728"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 5: Enthalpy and the Second and Third Laws of Thermodynamics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 5.1, Page Number 84"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable Declaration\n",
      "Th, Tc = 500.,200.     #Temeperatures IN Which reversible heat engine works, K\n",
      "q = 1000.              #Heat absorbed by heat engine, J\n",
      "\n",
      "#Calcualtions\n",
      "eps = 1.-Tc/Th\n",
      "w = eps*q\n",
      "\n",
      "#Results\n",
      "print 'Efficiency of heat engine is %4.3f'%eps\n",
      "print 'Work done by heat engine is %4.1f J'%w"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency of heat engine is 0.600\n",
        "Work done by heat engine is 600.0 J\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 5.4, Page Number 87"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import integrate, symbols\n",
      "from math import log\n",
      "#Variable Declaration\n",
      "n = 1.0                #Number of moles of CO2\n",
      "Ti, Tf = 320.,650.     #Initial and final state Temeperatures of CO2, K\n",
      "vi, vf = 80.,120.      #Initial and final state volume of CO2, K\n",
      "A, B, C, D = 31.08,-0.01452,3.1415e-5,-1.4973e-8\n",
      "                       #Constants in constant volume Heat capacity equation in J, mol, K units\n",
      "R = 8.314              #Ideal Gas Constant, J/(mol.K) \n",
      "#Calcualtions\n",
      "T = symbols('T')\n",
      "dS1 = n*integrate( (A + B*T + C*T**2 + D*T**3)/T, (T,Ti,Tf)) \n",
      "dS2 = n*R*log(vf/vi)\n",
      "dS = dS1 + dS2\n",
      "#Results\n",
      "print 'Entropy change of process is %4.2f J/(mol.K)'%dS"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Entropy change of process is 24.43 J/(mol.K)\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 5.5, Page Number 88"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import integrate, symbols\n",
      "from math import log\n",
      "\n",
      "#Variable Declaration\n",
      "n = 2.5                #Number of moles of CO2\n",
      "Ti, Tf = 450.,800.     #Initial and final state Temeperatures of CO2, K\n",
      "pi, pf = 1.35,3.45     #Initial and final state pressure of CO2, K\n",
      "A, B, C, D = 18.86,7.937e-2,-6.7834e-5,2.4426e-8\n",
      "                       #Constants in constant pressure Heat capacity equation in J, mol, K units\n",
      "R = 8.314              #Ideal Gas Constant, J/(mol.K) \n",
      "#Calcualtions\n",
      "T = symbols('T')\n",
      "dS1 = n*integrate( (A + B*T + C*T**2 + D*T**3)/T, (T,Ti,Tf)) \n",
      "dS2 = n*R*log(pf/pi)\n",
      "dS = dS1 - dS2\n",
      "#Results\n",
      "print 'Entropy change of process is %4.2f J/(mol.K)'%dS"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Entropy change of process is 48.55 J/(mol.K)\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 5.6, Page Number 89"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "\n",
      "#Variable Declaration\n",
      "n = 3.0                #Number of moles of CO2\n",
      "Ti, Tf = 300.,600.     #Initial and final state Temeperatures of CO2, K\n",
      "pi, pf = 1.00,3.00     #Initial and final state pressure of CO2, K\n",
      "cpm = 27.98            #Specific heat of mercury, J/(mol.K)\n",
      "M = 200.59             #Molecualr wt of mercury, g/(mol)\n",
      "beta = 1.81e-4         #per K\n",
      "rho = 13.54            #Density of mercury, g/cm3\n",
      "R = 8.314              #Ideal Gas Constant, J/(mol.K) \n",
      "\n",
      "#Calcualtions\n",
      "dS1 = n*cpm*log(Tf/Ti)\n",
      "dS2 = n*(M/(rho*1e6))*beta*(pf-pi)*1e5\n",
      "dS = dS1 - dS2\n",
      "\n",
      "#Results\n",
      "print 'Entropy change of process is %4.1f J/(mol.K)'%dS\n",
      "print 'Ratio of pressure to temperature dependent term %3.1e\\nhence effect of pressure dependent term isvery less'%(dS2/dS1)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Entropy change of process is 58.2 J/(mol.K)\n",
        "Ratio of pressure to temperature dependent term 2.8e-05\n",
        "hence effect of pressure dependent term isvery less\n"
       ]
      }
     ],
     "prompt_number": 24
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 5.7, Page Number 93"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "\n",
      "#Variable Declaration\n",
      "n = 1.0                #Number of moles of CO2\n",
      "T = 300.0              #Temeperatures of Water bath, K\n",
      "vi, vf = 25.0,10.0     #Initial and final state Volume of Ideal Gas, L\n",
      "R = 8.314              #Ideal Gas Constant, J/(mol.K) \n",
      "\n",
      "#Calcualtions\n",
      "qrev = n*R*T*log(vf/vi)\n",
      "w = -qrev\n",
      "dSsys = qrev/T\n",
      "dSsur = -dSsys\n",
      "dS = dSsys + dSsur\n",
      "\n",
      "#Results\n",
      "print 'Entropy change of surrounding is %4.1f J/(mol.K)'%dSsur\n",
      "print 'Entropy change of system is %4.1f J/(mol.K)'%dSsys\n",
      "print 'Total Entropy changeis %4.1f J/(mol.K)'%dS"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Entropy change of surrounding is  7.6 J/(mol.K)\n",
        "Entropy change of system is -7.6 J/(mol.K)\n",
        "Total Entropy changeis  0.0 J/(mol.K)\n"
       ]
      }
     ],
     "prompt_number": 25
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 5.8, Page Number 93"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from math import log\n",
      "\n",
      "#Variable Declaration\n",
      "n = 1.0                #Number of moles of CO2\n",
      "T = 300.0              #Temeperatures of Water bath, K\n",
      "vi, vf = 25.0,10.0     #Initial and final state Volume of Ideal Gas, L\n",
      "R = 8.314              #Ideal Gas Constant, J/(mol.K) \n",
      "\n",
      "#Calcualtions\n",
      "pext = n*R*T/(vf/1e3)\n",
      "pi = n*R*T/(vi/1e3)\n",
      "q = pext*(vf-vi)/1e3\n",
      "qrev = n*R*T*log(vf/vi)\n",
      "w = -q\n",
      "dSsur = -q/T\n",
      "dSsys = qrev/T\n",
      "dS = dSsys + dSsur\n",
      "\n",
      "#Results\n",
      "print 'Constant external pressure and initial pressure are %4.3e J,and %4.3e J respectively'%(pext,pi)\n",
      "print 'Heat in reverssible and irreversible processes are %4.1f J,and %4.1f J respectively'%(qrev,q)\n",
      "print 'Entropy change of system is %4.1f J/(mol.K)'%dSsys\n",
      "print 'Entropy change of surrounding is %4.2f J/(mol.K)'%dSsur\n",
      "print 'Total Entropy changeis %4.2f J/(mol.K)'%dS"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Constant external pressure and initial pressure are 2.494e+05 J,and 9.977e+04 J respectively\n",
        "Heat in reverssible and irreversible processes are -2285.4 J,and -3741.3 J respectively\n",
        "Entropy change of system is -7.6 J/(mol.K)\n",
        "Entropy change of surrounding is 12.47 J/(mol.K)\n",
        "Total Entropy changeis 4.85 J/(mol.K)\n"
       ]
      }
     ],
     "prompt_number": 28
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 5.9, Page Number 96"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import integrate, symbols\n",
      "from math import log\n",
      "\n",
      "#Variable Declaration\n",
      "n = 1.0                #Number of moles of CO2\n",
      "pi, pf = 1.35,3.45     #Initial and final state pressure of CO2, K\n",
      "D1 = 2.11e-3           #Constants in constant pressure Heat capacity equation for K<T<12.97K, in J, mol, K units\n",
      "A2, B2, C2, D2 = -5.666,0.6927,-5.191e-3,9.943e-4\n",
      "        #Constants in constant pressure Heat capacity equation for 12.97<T<23.66, J, mol, K units\n",
      "A3, B3, C3, D3 = 31.70,-2.038,0.08384,-6.685e-4\n",
      "        #Constants in constant pressure Heat capacity equation for 23.66<T<43.76, J, mol, K units\n",
      "A4 = 46.094 #Constants in constant pressure Heat capacity equation for 43.76<T<54.39, J/(mol.K)\n",
      "A5, B5, C5, D5 = 81.268,-1.1467,0.01516,-6.407e-5\n",
      "        #Constants in constant pressure Heat capacity equation for 54.39<T<90.20K, J, mol, K units\n",
      "A6, B6, C6, D6 = 32.71,-0.04093,1.545e-4,-1.819e-7\n",
      "        #Constants in constant pressure Heat capacity equation for 90.20<T<298.15 KJ, mol, K units\n",
      "R = 8.314         #Ideal Gas Constant, J/(mol.K) \n",
      "Ltrans1 = 93.80   #Entalpy of transition at 23.66K, J/mol\n",
      "Ltrans2 = 743.0   #Entalpy of transition at 43.76K, J/mol\n",
      "Ltrans3 = 445.0   #Entalpy of transition at 54.39K, J/mol\n",
      "Ltrans4 = 6815.   #Entalpy of transition at 90.20K, J/mol\n",
      "T1 = 12.97        #Maximum applicabliltiy temeprature for first heat capacity equation, K\n",
      "T12 = 23.66       #Phase Change temperature from Solid III--II, K\n",
      "T23 = 43.76       #Phase Change temperature from Solid II--I, K\n",
      "T34 = 54.39       #Phase Change temperature from Solid I--liquid, K\n",
      "T45 = 90.20       #Phase Change temperature from liquid--gas, K\n",
      "Ts = 298.15       #Std. Temeprature, K\n",
      "#Calcualtions\n",
      "T = symbols('T')\n",
      "dS1 = n*integrate( (D1*T**3)/T, (T,0,T1)) \n",
      "dS2 = n*integrate( (A2 + B2*T + C2*T**2 + D2*T**3)/T, (T,T1,T12)) \n",
      "dS21 = Ltrans1/T12\n",
      "dS3 = n*integrate( (A3 + B3*T + C3*T**2 + D3*T**3)/T, (T,T12,T23)) \n",
      "dS31 = Ltrans2/T23\n",
      "dS4 = n*integrate( (A4)/T, (T,T23,T34)) \n",
      "dS41 = Ltrans3/T34\n",
      "dS5 = n*integrate( (A5 + B5*T + C5*T**2 + D5*T**3)/T, (T,T34,T45)) \n",
      "dS51 = Ltrans4/T45\n",
      "dS6 = n*integrate( (A6 + B6*T + C6*T**2 + D6*T**3)/T, (T,T45,Ts))\n",
      "#print dS1+dS2,dS21\n",
      "#print dS3, dS31\n",
      "#print dS4, dS41\n",
      "#print dS5, dS51\n",
      "#print dS6\n",
      "dS = dS1+dS2+dS21+dS3+dS31+dS4+dS41+dS5+dS51+dS6\n",
      "\n",
      "#Results\n",
      "print 'Entropy change Sm0 for O2 is %4.1f J/(mol.K)'%dS"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Entropy change Sm0 for O2 is 204.8 J/(mol.K)\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example Problem 5.10, Page Number 99"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "from sympy import integrate, symbols\n",
      "from math import log\n",
      "\n",
      "#Variable Declaration\n",
      "n = 1.0                #Number of moles of CO2 formed, mol\n",
      "p = 1.                 #Pressure of CO2, K\n",
      "\n",
      "A1, B1, C1, D1 = 18.86,7.937e-2,-6.7834e-5,2.4426e-8\n",
      "        #Constants in constant pressure Heat capacity equation for CO2, J/(mol.K)\n",
      "A2, B2, C2, D2 = 30.81,-1.187e-2,2.3968e-5, 0.0\n",
      "        #Constants in constant pressure Heat capacity equation for O2, J/(mol.K)\n",
      "A3, B3, C3, D3 =  31.08,-1.452e-2,3.1415e-5 ,-1.4793e-8          \n",
      "        #Constants in constant pressure Heat capacity equation for CO, J/(mol.K)\n",
      "DSr298CO = 197.67   #Std. Entropy change for CO, J/(mol.K)\n",
      "DSr298CO2 = 213.74  #Std. Entropy change for CO, J/(mol.K)\n",
      "DSr298O2 = 205.138  #Std. Entropy change for CO, J/(mol.K)\n",
      "Tr = 475.           #Reaction temperature, K\n",
      "Ts = 298.15         #Std. temperature, K\n",
      "#Calcualtions\n",
      "T = symbols('T')\n",
      "v1,v2,v3 = 1.,1./2,1.\n",
      "DSr = DSr298CO2*v1 - DSr298CO*v1 - DSr298O2*v2\n",
      "DA = v1*A1-v2*A2-v3*A3\n",
      "DB = v1*B1-v2*B2-v3*B3\n",
      "DC = v1*C1-v2*C2-v3*C3\n",
      "DD = v1*D1-v2*D2-v3*D3\n",
      "dS = DSr + n*integrate( (DA + DB*T + DC*T**2 + DD*T**3)/T, (T,Ts,Tr)) \n",
      "\n",
      "#Results\n",
      "print 'Entropy change for reaction at %4d K is %4.2f J/(mol.K)'%(Tr,dS)"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Entropy change Sm0 for O2 is 204.83 J/(mol.K)\n"
       ]
      }
     ],
     "prompt_number": 24
    }
   ],
   "metadata": {}
  }
 ]
}