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
|
{
"metadata": {
"name": ""
},
"nbformat": 3,
"nbformat_minor": 0,
"worksheets": [
{
"cells": [
{
"cell_type": "heading",
"level": 1,
"metadata": {},
"source": [
"Chapter 4: Energy Analysis of Closed Systems"
]
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-2 ,Page No.169"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#Given values\n",
"m=10;#mass in lbm\n",
"Po=60;#steam oressure in psia\n",
"T1=320;#intial temp in F\n",
"T2=400;#final temp in F\n",
"\n",
"#from Table A\u20136E\n",
"v1=7.4863;#at 60 psia and 320 F\n",
"v2=8.3548;#at 60 psia and 400 F\n",
"\n",
"#calculations\n",
"#W = P dV which on integrating gives W = m * P * (V2 - V1)\n",
"W=m*Po*(v2-v1)/5.404;#coverting into Btu from psia-ft^3\n",
"print'work done by the steam during this process %f Btu'%round(W,1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"work done by the steam during this process 96.400000 Btu\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-3 ,Page No.170"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import log\n",
"#given data\n",
"P1=100;#pressure in kPa\n",
"V1=0.4;#intial vol in m^3\n",
"V2=0.1;#final vol in m^3\n",
"\n",
"#calculations\n",
"#for isothermal W = P1*V1* ln(V2/V1)\n",
"W=P1*V1*log(V2/V1);\n",
"print'the work done during this process %f kJ'%round(W,1)"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the work done during this process -55.500000 kJ\n"
]
}
],
"prompt_number": 1
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-4 ,Page No.171"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"V1=0.05;#Volumne of gas in m^3\n",
"P1=200;#Pressure in kPa\n",
"k=150;#Spring constant in kN/m\n",
"A=0.25;#Cross-sectional area in m^2\n",
"\n",
"#calculations\n",
"\n",
"#Part - a\n",
"V2=2*V1;\n",
"x2=(V2-V1)/A;#printlacement of spring\n",
"F=k*x2;#compression force\n",
"P2=P1+F/A;#additional pressure is equivalent the compression of spring\n",
"print'the final pressure inside the cylinder %i kPa'%P2;\n",
"\n",
"#Part - b\n",
"#work done is equivalent to the area of the P-V curve of Fig 4-10\n",
"W=(P1+P2)/2*(V2-V1);#area of trapezoid = 1/2 * sum of parallel sides * dist. b/w them\n",
"print'the total work done by the gas %i kJ'%W;\n",
"\n",
"#Part - c\n",
"x1=0;#intial compression of spring\n",
"Wsp=0.5*k*(x2**2-x1**2);\n",
"print'the fraction of this work done against the spring to compress it %i kJ'%Wsp\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the final pressure inside the cylinder 320 kPa\n",
"the total work done by the gas 13 kJ\n",
"the fraction of this work done against the spring to compress it 3 kJ\n"
]
}
],
"prompt_number": 2
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-5 ,Page No.174"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given values\n",
"m=0.025;#mass of saturated water vapor in kg\n",
"V=120;#rated voltage of heater in V\n",
"I=0.2;#rated current in A\n",
"t=300;#total time taken in sec\n",
"P1=300;#constant pressure in kPa\n",
"Qout=3.7;#heat lost in kJ\n",
"\n",
"#from Table A\u20135\n",
"#at P1 the conditon is sat. vap\n",
"h1=2724.9;\n",
"\n",
"#Calculations\n",
"\n",
"#Part - a\n",
"#therotical proving\n",
"\n",
"#Part - b\n",
"We=V*I*t/1000;#electrical work in kJ\n",
"#from eqn 4 -18 i.e derived in earler part\n",
"#it states it Ein - Eout = Esystem\n",
"# it applies as Win - Qout = H = m (h2 - h1)\n",
"h2=(We-Qout)/m+h1;\n",
"##from Table A\u20135\n",
"#at h2 we get\n",
"P2=300;\n",
"T=200;\n",
"print'the final temperature of the steam %i C'%T\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the final temperature of the steam 200 C\n"
]
}
],
"prompt_number": 8
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-6 ,Page No.176"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"m=5.0;#mass of water in kg\n",
"P1=200;#pressure on one side in kPa\n",
"T=25;#temperature in C\n",
"\n",
"#from Table A\u20134\n",
"#the liq. is in compressed state at 200 kPa and 25 C\n",
"vf=0.001;\n",
"vg=43.340;\n",
"uf=104.83;\n",
"ufg=2304.3;\n",
"v1=vf;\n",
"u1=uf;\n",
"\n",
"#calculations\n",
"\n",
"#Part - a\n",
"V1=m*v1;\n",
"Vtank=2*V1;\n",
"print'the volume of the tank %f m^3'%round(Vtank,2);\n",
"\n",
"#Part - b\n",
"V2=Vtank;\n",
"v2=V2/m;\n",
"#from Table A\u20134 \n",
"# at T=25 vf=0.101003 m^3/kg and vg=43.340 m^3/kg\n",
"# vf<v2<vg therefore it is saturated liquid\u2013vapor mixture\n",
"P2=3.1698;\n",
"print'the final pressure %f kPa'%round(P2,4);\n",
"\n",
"#Part - c\n",
"#Ein - Eout = Esystem\n",
"#Qin= dU = m(u2 - u1)\n",
"x2=(v2-vf)/(vg-vf);\n",
"u2=uf+x2*ufg;\n",
"Qin=m*(u2-u1);\n",
"print'the heat transfer for this process %f kJ'%Qin\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the volume of the tank 0.010000 m^3\n",
"the final pressure 3.169800 kPa\n",
"the heat transfer for this process 0.265846 kJ\n"
]
}
],
"prompt_number": 16
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-7 ,Page No.183"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"import math\n",
"from scipy.integrate import quad \n",
"from pylab import *\n",
"\n",
"#given data\n",
"T1=300;#intial temp of air in K\n",
"P=200;#pressure in kPa\n",
"T2=600;#final temp in K\n",
"M=28.97;#molecular weight in kg/kmol\n",
"Ru=8.314;\n",
"\n",
"#Part - a\n",
"#from Table A\u201317\n",
"u1=214.07;\n",
"u2=434.78;\n",
"du=u2-u1;#change in internal energy\n",
"print'change in internal energy from data from the air table %f kJ/kg'%round(du,2);\n",
"\n",
"#Part - b\n",
"#from Table A\u20132c\n",
"a=28.11;\n",
"b=0.1967*10**-2;\n",
"c=0.4802*10**-5;\n",
"d=-1.966*10**-9;\n",
"# by equation Cp(T)=a+bT+cT^2+dT^3\n",
"def intgrnd1(T): \n",
" return ((a-Ru)+b*T+c*T**2+d*T**3)\n",
"dU, err = quad(intgrnd1, T1, T2) \n",
"du=dU/M;\n",
"print'change in internal energy the functional form of the specific heat %f kJ/kg'%round(du,1); \n",
"\n",
"#Part - c\n",
"#from Table A\u20132b\n",
"Cavg=0.733;\n",
"du=Cavg*(T2-T1);\n",
"print'change in internal energy the functional form the average specific heat value %i kJ/kg'%round(du,0);\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"change in internal energy from data from the air table 220.710000 kJ/kg\n",
"change in internal energy the functional form of the specific heat 222.500000 kJ/kg\n",
"change in internal energy the functional form the average specific heat value 220 kJ/kg\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-8 ,Page No.184"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"m=1.5;#mass in lbm\n",
"T1=80;#temperature in F\n",
"P1=50;#pressure in psia\n",
"W=0.02;#power rating in hp\n",
"t=30.0/60;#converting into hrs from min\n",
"\n",
"#from Table A\u20132Ea\n",
"Cv=0.753;\n",
"\n",
"#calculations\n",
"\n",
"#part a\n",
"Wsh=W*t*2545;#in Btu\n",
"#Ein - Eout = Esystem\n",
"#Wsh = dU = m (u2 - u1) = m * Cv * (T2 - T1)\n",
"T2= Wsh/(m*Cv)+T1;\n",
"print'the final temperature %f F'%round(T2,1);\n",
"\n",
"#part b\n",
"#using ideal gas eqn\n",
"# P1 * V1 / T1 = P2 * T2 /V2\n",
"P2= 50 * (T2 +460)/ (T1+460);\n",
"# temp should in R therefore + 460\n",
"print'the final pressure %f psia'%round(P2,1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the final temperature 102.500000 F\n",
"the final pressure 52.100000 psia\n"
]
}
],
"prompt_number": 21
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-9 ,Page No.185"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"V1=0.5;#volumne of nitrogen gas in m^3\n",
"P=400;#pressure in kPa\n",
"T1=27;#temp in C\n",
"I=2;#rated current in A\n",
"t=5*60;#converting into s from min\n",
"V=120;#rated voltage in V\n",
"Qout=2800/1000;#in kJ\n",
"R=0.297;\n",
"\n",
"#from Table A\u20132a\n",
"Cp=1.039;\n",
" \n",
"#calculations\n",
"P1=P;\n",
"We=V*I*t/1000;#in kJ\n",
"m=P1*V1/(R*(T1+273));\n",
"#Ein - Eout = Esystem\n",
"# We,in - Qout = dH = m (h2 - h1) = m * Cp * (T2 - T1)\n",
"T2=(We-Qout)/(m*Cp)+T1;\n",
"print'the final temperature of nitrogen in %i C'%T2\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the final temperature of nitrogen in 57 C\n"
]
}
],
"prompt_number": 25
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-10 ,Page No.187"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"P1=150;#initially air pressure in kPa\n",
"P2=350;#final pressure in kPa\n",
"T1=27+273;#temperatuere in K\n",
"V1=400.0/1000;#volumne in m^3\n",
"R=0.287;\n",
"\n",
"#from Table A\u201317\n",
"u1=214.07;\n",
"u2=1113.52;\n",
"\n",
"#calculations\n",
"\n",
"#part a\n",
"V2=2*V1;\n",
"#using ideal gas eqn\n",
"# P1 * V1 / T1 = P2 * T2 /V2\n",
"T2=P2*V2*T1/(P1*V1);\n",
"print'the final temperature %i K'%T2;\n",
"\n",
"#part b\n",
"# Work done is Pdv\n",
"W=P2*(V2-V1);\n",
"print'the work done by the air %i kJ'%W;\n",
"\n",
"#part c\n",
"#Ein - Eout = Esystem\n",
"#Qin - Wout = dU = m(u2 - u1)\n",
"m= P1* V1 /(T1 * R);\n",
"Q= m*(u2 - u1)+ W;\n",
"print'the total heat transferred to the air %i kJ'%round(Q)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the final temperature 1400 K\n",
"the work done by the air 140 kJ\n",
"the total heat transferred to the air 767 kJ\n"
]
}
],
"prompt_number": 3
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-11 ,Page No.190"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"T=100;#twmperature of liquid water in C\n",
"P=15;#pressure in MPa\n",
"\n",
"#from Table A\u20137\n",
"#at P=15 mPa and T = 100 C\n",
"hg=430.39;\n",
"hf=419.17\n",
"vf=0.001;\n",
"Psat=101.42;#in kPa\n",
"\n",
"#calculations\n",
"\n",
"#part a\n",
"h=hg;\n",
"print'enthalpy of liquid water by using compressed liquid tables %f kJ/kg'%round(h,2);\n",
"\n",
"#part b\n",
"#Approximating the compressed liquid as a saturated liquid at 100\u00b0C\n",
"h=hf;\n",
"print'enthalpy of liquid water by approximating it as a saturated liquid %f kJ/kg'%round(h,2);\n",
"\n",
"#part c\n",
"h=hf + vf*(P*1000 - Psat );\n",
"print'enthalpy of liquid water by using the correction given by Eq. 4\u201338 %f kJ/kg'%round(h,2);\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"enthalpy of liquid water by using compressed liquid tables 430.390000 kJ/kg\n",
"enthalpy of liquid water by approximating it as a saturated liquid 419.170000 kJ/kg\n",
"enthalpy of liquid water by using the correction given by Eq. 4\u201338 434.070000 kJ/kg\n"
]
}
],
"prompt_number": 4
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-12 ,Page No.191"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#suffix i for iron\n",
"#suffix w for water\n",
"#given data\n",
"mi=50;#mass in Kg\n",
"T1i=80;#temperature in C \n",
"Vw=0.5;#volumne in m^3\n",
"T1w=25;#temperature in C \n",
"v=0.001;#specific volume of liquid water at or about room temperature\n",
"\n",
"#from Table A\u20133\n",
"ci=0.45;\n",
"cw=4.18;\n",
"\n",
"#calculations\n",
"mw=Vw/v;\n",
"#Ein - Eout = Esystem\n",
"# du = 0 i.e (mcdT)iron + (mcdT)water = 0\n",
"# mi * ci * (T - T1i) + mw *cw * (T-T1w)\n",
"#on rearranging above equn\n",
"T= (mi*ci*T1i + mw*cw*T1w)/(mi*ci+mw*cw);\n",
"print'the temperature when thermal equilibrium is reached %f C'%round(T,1)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the temperature when thermal equilibrium is reached 25.600000 C\n"
]
}
],
"prompt_number": 5
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-13 ,Page No.191"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"from math import sqrt\n",
"\n",
"#given data\n",
"maf=0.15;#mass of affected tissue in kg\n",
"caf=3.8;#specific heat of the tissue in kJ/Kg C\n",
"dTaf=1.8;#suffix af for affected tissue\n",
"mh=1.2;#suffix h for hand ; mass of hand in kg\n",
"\n",
"#calculations\n",
"#Ein - Eout = Esystem\n",
"#dUaffected tissue - KEhand = 0\n",
"#from above equation we can deduce that\n",
"Vhand= sqrt(2*maf*caf*dTaf*1000/mh);#for conversion factor mutiplying by 1000 to get m^2/s^2\n",
"print'the velocity of the hand just before impact %f m/s'%round(Vhand,1);"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"the velocity of the hand just before impact 41.400000 m/s\n"
]
}
],
"prompt_number": 7
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-14 ,Page No.199"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"m=90;#mass of man in kg\n",
"\n",
"#from Tables 4\u20131 and 4\u20132\n",
"Ehb=275;#hamburger\n",
"Ef=250;#fries\n",
"Ec=87;#cola\n",
"\n",
"#calculation\n",
"\n",
"#part a\n",
"Ein=2*Ehb+Ef+Ec;\n",
"#The rate of energy output for a 68-kg man watching TV is to be 72 Calories/h\n",
"Eout=m*72.0/68;\n",
"t=Ein/Eout;\n",
"print'by watching TV %f hours'%round(t,1);\n",
"\n",
"#part b\n",
"#The rate of energy output for a 68-kg man watching TV is to be 860 Calories/h\n",
"Eout=m*860.0/68;\n",
"t=Ein/Eout*60#converting in min\n",
"t=ceil(t);\n",
"print'by fast swimming %f mins'%t;\n",
"\n",
"#for last question\n",
"print('answers be for a 45-kg man energy takes twice as long in each case');\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"by watching TV 9.300000 hours\n",
"by fast swimming 47.000000 mins\n",
"answers be for a 45-kg man energy takes twice as long in each case\n"
]
}
],
"prompt_number": 37
},
{
"cell_type": "heading",
"level": 2,
"metadata": {},
"source": [
"Example 4-15 ,Page No.199"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
"#given data\n",
"E=75;#in Cal/day\n",
"\n",
"#calculation\n",
"Ereduced=E*365.0;\n",
"#The metabolizable energy content of 1 kg of body fat is 33,100 kJ\n",
"Ec=33100.0;\n",
"mfat=Ereduced/Ec*4.1868;\n",
"print'weight this person will lose in one year %f kg'%round(mfat,2)\n"
],
"language": "python",
"metadata": {},
"outputs": [
{
"output_type": "stream",
"stream": "stdout",
"text": [
"weight this person will lose in one year 3.460000 kg\n"
]
}
],
"prompt_number": 41
}
],
"metadata": {}
}
]
}
|