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
|
{
"metadata": {
"name": "",
"signature": "sha256:79d03e9c97c3d8ac9e7b819d4383e36696e6a2ea64bb801edb77a95675cdc73c"
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 02: Heat, Work, Internal Energy, Enthalpy, and The First Law of Thermodynamics"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 2.1, Page 18"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"\n",
"#Variable Declaration Part a\n",
"vi = 20.0 #Initial volume of ideal gas, L\n",
"vf = 85.0 #final volume of ideal gas, L\n",
"Pext = 2.5 #External Pressure against which work is done, bar\n",
"\n",
"#Calculations\n",
"w = -Pext*1e5*(vf-vi)*1e-3\n",
"\n",
"#Results\n",
"print 'Part a: Work done in expansion is %6.1f kJ'%(w/1000)\n",
"\n",
"#Variable Declaration Part b\n",
"ri = 1.00 #Initial diameter of bubble, cm\n",
"rf = 3.25 #final diameter of bubble, cm\n",
"sigm = 71.99 #Surface tension, N/m\n",
"\n",
"from math import pi\n",
"#Calculations\n",
"w = -2*sigm*4*pi*(rf**2-ri**2)*1e-4\n",
"\n",
"#Results\n",
"print 'Part b: Work done in expansion of bubble is %4.2f J'%w\n",
"\n",
"#Variable Declaration Part c\n",
"i = 3.20 #Current through heating coil, A \n",
"v = 14.5 #fVoltage applied across coil, volts\n",
"t = 30.0 #time for which current is applied,s\n",
"\n",
"from math import pi\n",
"#Calculations\n",
"w = v*i*t\n",
"\n",
"#Results\n",
"print 'Part c: Work done in paasing the cuurent through coil is %4.2f kJ'%(w/1000)\n",
"\n",
"#Variable Declaration Part d\n",
"k = 100.0 #Constant in F = -kx, N/cm \n",
"dl = -0.15 #stretch , cm\n",
"\n",
"from math import pi\n",
"#Calculations\n",
"w = -k*(dl**2-0)/2\n",
"\n",
"#Results\n",
"print 'Part d: Work done stretching th fiber is %4.2f J'%w"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Part a: Work done in expansion is -16.2 kJ\n",
"Part b: Work done in expansion of bubble is -1.73 J\n",
"Part c: Work done in paasing the cuurent through coil is 1.39 kJ\n",
"Part c: Work done stretching th fiber is -1.12 J\n"
]
}
],
"prompt_number": 15
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 2.2, Page Number 20"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Declaration \n",
"m = 100.0 #Mass of water, g \n",
"T = 100.0 #Temperature of water, \u00b0C\n",
"Pext = 1.0 #External Pressure on assembly, bar\n",
"x = 10.0 #percent of water vaporised at 1 bar,-\n",
"i = 2.00 #current through heating coil, A\n",
"v = 12.0 #Voltage applied, v\n",
"t = 1.0e3 #time for which current applied, s \n",
"rhol = 997 #Density of liquid, kg/m3\n",
"rhog = 0.59 #Density of vapor, kg/m3\n",
"\n",
"#Calculations\n",
"q = i*v*t\n",
"vi = m/(rhol*100)*1e-3\n",
"vf = m*(100-x)*1e-3/(rhol*100) + m*x*1e-3/(rhog*100)\n",
"w = -Pext*(vf-vi)*1e5\n",
"#Results\n",
"print 'Heat added to the water %4.2f kJ'%(q/1000)\n",
"print 'Work done in vaporizing liquid is %4.2f J'%w"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Heat added to the water 24.00 kJ\n",
"Work done in vaporizing liquid is -1703.84 J\n"
]
}
],
"prompt_number": 23
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 2.3, Page Number 22"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Declaration Part d\n",
"m = 1.5 #mass of water in surrounding, kg \n",
"dT = 14.2 #Change in temperature of water, \u00b0C or K\n",
"cp = 4.18 #Specific heat of water at constant pressure, J/(g.K)\n",
"\n",
"#Calculations\n",
"qp = m*cp*dT\n",
"\n",
"#Results\n",
"print 'Heat removed by water at constant pressure %4.2f kJ'%qp"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Heat removed by water at constant pressure 89.03 kJ\n"
]
}
],
"prompt_number": 26
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 2.4, Page Number 28"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import log\n",
"#Variable declaration\n",
"n = 2.0 #moles of ideal gas\n",
"R = 8.314 #Ideal gas constant, bar.L/(mol.K)\n",
"#For reverssible Isothermal expansion \n",
"Pi1 = 25.0 #Initial Pressure of ideal gas, bar\n",
"Vi1 = 4.50 #Initial volume of ideal gas, L\n",
"Pf1 = 4.50 #Fianl Pressure of ideal gas, bar\n",
"Pext = 4.50 #External pressure, bar \n",
"Pint = 11.0 #Intermediate pressure, bar\n",
"\n",
"#Calcualtions reverssible Isothermal expansion \n",
"T1 = Pi1*Vi1/(n*R)\n",
"Vf1 = n*R*T1/Pf1\n",
"w = -n*R*T1*log(Vf1/Vi1)\n",
"\n",
"#Results\n",
"print 'For reverssible Isothermal expansion'\n",
"print 'Work done = %4.2e J'%w\n",
"\n",
"#Calcualtions Single step irreverssible expansion \n",
"\n",
"w = -Pext*1e5*(Vf1-Vi1)*1e-3\n",
"\n",
"#Results\n",
"print 'For Single step reverssible expansion'\n",
"print 'Work done = %4.2e J'%w\n",
"\n",
"#Calcualtions Two step irreverssible expansion \n",
"Vint = n*R*T1/(Pint)\n",
"w = -Pint*1e5*(Vint-Vi1)*1e-3 - Pf1*1e5*(Vf1-Vint)*1e-3\n",
"\n",
"#Results\n",
"print 'For Two step reverssible expansion'\n",
"print 'Work done = %4.2e J'%w\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"For reverssible Isothermal expansion\n",
"Work done = -1.93e+02 J\n",
"For Single step reverssible expansion\n",
"Work done = -9.22e+03 J\n",
"For Twi step reverssible expansion\n",
"Work done = -1.29e+04 J\n"
]
}
],
"prompt_number": 6
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 2.5, Page Number 32"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import log\n",
"\n",
"#Variable declaration\n",
"n = 2.5 #moles of ideal gas\n",
"R = 0.08314 #Ideal gas constant, bar.L/(mol.K)\n",
"cvm = 20.79 #Heat Capacity at constant volume, J/(mol.K)\n",
"\n",
"p1 = 16.6 #Pressure at point 1, bar\n",
"v1 = 1.00 #Volume at point 1, L\n",
"p2 = 16.6 #Pressure at point 2, bar\n",
"v2 = 25.0 #Volume at point 2, L \n",
"v3 = 25.0 #Volume at point 3, L\n",
"\n",
"#Calculations\n",
"T1 = p1*v1/(n*R)\n",
"T2 = p2*v2/(n*R)\n",
"T3 = T1 #from problem statement\n",
" #for path 1-2\n",
"DU12 = n*cvm*(T2-T1)\n",
"w12 = -p1*1e5*(v2-v1)*1e-3\n",
"q12 = DU12 - w12\n",
"DH12 = DU12 + n*R*(T2-T1)*1e2\n",
"\n",
" #for path 2-3\n",
"w23 = 0.0\n",
"DU23 = q23 = n*cvm*(T3-T2)\n",
"DH23 = -DH12\n",
"\n",
"\n",
" #for path 3-1\n",
"DU31 = 0.0 #Isothemal process\n",
"DH31 = 0.0\n",
"w31 = -n*R*1e2*T1*log(v1/v3)\n",
"q31 = -w31\n",
"\n",
"DU = DU12+DU23+DU31\n",
"w = w12+w23+w31\n",
"q = q12+q23+q31\n",
"DH = DH12+DH23+DH31\n",
"\n",
"#Results\n",
"print 'For Path q w DU DH '\n",
"print '1-2 %7.2f %7.2f %7.2f %7.2f'%(q12,w12,DU12,DH12)\n",
"print '2-3 %7.2f %7.2f %7.2f %7.2f'%(q23,w23,DU23,DH23)\n",
"print '3-1 %7.2f %7.2f %7.2f %7.2f'%(q31,w31,DU31,DH31)\n",
"print 'Overall %7.2f %7.2f %7.2f %7.2f'%(q,w,DU,DH)\n",
"print 'all values are in J'"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"For Path q w DU DH \n",
"1-2 139463.96 -39840.00 99623.96 139463.96\n",
"2-3 -99623.96 0.00 -99623.96 -139463.96\n",
"3-1 -5343.33 5343.33 0.00 0.00\n",
"Overall 34496.67 -34496.67 0.00 0.00\n",
"all values are in J\n"
]
}
],
"prompt_number": 47
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 2.6, Page Number 34"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"n = 2.5 #moles of ideal gas\n",
"R = 8.314 #Ideal gas constant, J/(mol.K)\n",
"cvm = 12.47 #Heat Capacity at constant volume, J/(mol.K)\n",
"\n",
"pext = 1.00 #External Pressure, bar\n",
"Ti = 325. #Initial Temeprature, K\n",
"pi = 2.50 #Initial Pressure, bar\n",
"pf = 1.25 #Final pressure, bar \n",
"\n",
"#Calculations Adiabatic process q = 0; DU = w\n",
"q = 0.0 \n",
"Tf = Ti*(cvm + R*pext/pi)/(cvm + R*pext/pf )\n",
"DU = w = n*cvm*(Tf-Ti)\n",
"DH = DU + n*R*(Tf-Ti)\n",
"\n",
"#Results\n",
"print 'The final temperature at end of adiabatic procees is %4.1f K'%Tf\n",
"print 'The enthalpy change of adiabatic procees is %4.1f J'%DH\n",
"print 'The Internal energy change of adiabatic procees is %4.1f J'%DU\n",
"print 'The work done in expansion of adiabatic procees is %4.1f J'%w\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"The final temperature at end of adiabatic procees is 268.5 K\n",
"The enthalpy change of adiabatic procees is -2937.0 J\n",
"The Internal energy change of adiabatic procees is -1762.2 J\n",
"The work done in expansion of adiabatic procees is -1762.2 J\n"
]
}
],
"prompt_number": 51
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example Problem 2.7, Page Number 35"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Variable Declaration Part d\n",
"h1 = 1000.0 #initial Altitude of cloud, m \n",
"hf = 3500.0 #Final Altitude of cloud, m \n",
"p1 = 0.802 #Pressure at h1, atm \n",
"pf = 0.602 #Pressure at hf, atm\n",
"T1 = 288.0 #Initial temperature of cloud, K\n",
"cp = 28.86 #Specific heat of air, J/mol.K\n",
"R = 8.314 #Gas constant, J/mol.K\n",
"\n",
"from math import log, exp\n",
"\n",
"#Calculations\n",
"Tf = exp(-(cp/(cp-R)-1)/(cp/(cp-R))*log(p1/pf))*T1\n",
"#Results\n",
"print 'Final temperature of cloud %4.1f K'%Tf\n",
"if Tf < 273:\n",
" print 'You can expect cloud'\n",
"else:\n",
" print 'You can not expect cloud'\n",
" "
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"Final temperature of cloud 265.2 K\n",
"You can expect cloud\n"
]
}
],
"prompt_number": 34
}
],
"metadata": {}
}
]
}
|