summaryrefslogtreecommitdiff
path: root/Thermodynamics_Demystified_by_Merle_C._Potter/Chapter8_2.ipynb
blob: 2ab047498ca8cab8bb824ddbd04ad6c062b0a76f (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
{
 "metadata": {
  "name": "",
  "signature": "sha256:cd14818c82eb9353b8e2f9e12079fb0ba7b2a061c9a528ea53dea9dfa9a116ce"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 8:Psychrometrics"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8.1:PG-208"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialization of variables\n",
      "Ra=0.287 # specific gas constant for air\n",
      "P=100.0 # pressure of room in kPa\n",
      "V=150.0 # volume of room in m^3\n",
      "T=25+273 # temperature of air in kelvin\n",
      "phi=0.6 # relative humidity\n",
      "Pg=3.29 # saturation vapour pressure in kPa at 25 *C from table C.1\n",
      "Mv= 18 # molecular mass of water vapor\n",
      "Ma=28.97 # molecular mass of air\n",
      "\n",
      "Pv=Pg*phi # partial pressure of water vapour\n",
      "\n",
      "Pa=P-Pv # partial pressure of air\n",
      "\n",
      "w=0.622*(Pv/Pa) # humidity ratio in Kg of water/ Kg of dry air\n",
      "Tdp=17.4 # dew point temperature from interpolation in table C.2 corresponding to partial pressure Pv=1.98 kPa\n",
      "\n",
      "ma=Pa*V/(Ra*T) # mass of air\n",
      "mv=w*ma # mass of water vapour in  kg\n",
      "\n",
      "# now we find volume percentage\n",
      "Nv=mv/Mv # moles of vapour\n",
      "Na=ma/Ma # moles of air\n",
      "\n",
      "Vw= Nv/(Na+Nv) # fraction of volume occupied by water vapour\n",
      "\n",
      "print \"The humidity ratio is\",round(w,4),\"kg water/ kg of dry air \\n\"\n",
      "print \"The dew point is\",round(Tdp,1),\"degree celsius \\n \"\n",
      "print \"The mass of water vapour in the air is\",round(mv,3),\"kg \\n\"\n",
      "print \"The volume percentage of the room that is water vapor is\",round(Vw*100,2),\"%\"\n",
      "# The answers are correct within given limits \n",
      "# The variation in answers is due to approximations made by\n",
      "# textbook while python is precise\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The humidity ratio is 0.0125 kg water/ kg of dry air \n",
        "\n",
        "The dew point is 17.4 degree celsius \n",
        " \n",
        "The mass of water vapour in the air is 2.153 kg \n",
        "\n",
        "The volume percentage of the room that is water vapor is 1.98 %\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8.2:PG-209"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialization of variables\n",
      "Ra=0.287 # specific gas constant for air\n",
      "P=100.0 # pressure of room in kPa\n",
      "w1=0.0126 # old humidity ratio of example 8.1-\n",
      "Pg=3.29 # saturation vapour pressure in kPa at 25 *C from table C.1\n",
      "mv=2.17 # initial mass of water vapour in example 8.1\n",
      "T=25+273 # temperature after reheat\n",
      "V=150.0 # volume of room in m^3 \n",
      "Pv=1.228 # saturation vapour pressure in kPa @ 10 degree celsius from table C.1\n",
      "Pa=P-Pv # partial pressure of air\n",
      "w2=0.622*(Pv/Pa) # new humidity ratio in Kg of water/ Kg of dry air\n",
      "deltaw=w1-w2 # difference in humidity ratio\n",
      "ma=Pa*V/(Ra*T) # mass of air\n",
      "deltamv=deltaw*ma # mass of water vapour condensed\n",
      "X=deltamv*100/mv # percentage of water vapour condensed\n",
      "print \"The percentage that condenses is\",round(X,2),\"% \\n\"\n",
      "# AFTER REHEATING\n",
      "phi=1.608*w2*Pa/Pg\n",
      "print \"The relative humidity is\",round(phi*100,3),\"%\"\n",
      "\n",
      "# The answers are correct within given limits \n",
      "# The variation in answers is due to approximations made by\n",
      "# textbook while python is precise\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The percentage that condenses is 38.85 % \n",
        "\n",
        "The relative humidity is 37.332 %\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8.3:PG-212"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#initialization of variables\n",
      "T1=40 # dry bulb temperature in degree celsius\n",
      "T2=20 # wet bulb temperature in degree celsius\n",
      "Cp=1.0 # specific heat\n",
      "P=100 # pressure of air stream in kPa\n",
      "pg1=7.383 #saturation pressure @ 40 degree celsius\n",
      "hfg2=2454 # latent heat for 20 degree celsius\n",
      "Pg2=2.338 # saturation pressure @ 20 degree celsius\n",
      "w2=0.622*Pg2/(P-Pg2) # specific humidity for wet bulb condition\n",
      "hg1=2574 # specific enthalpy of saturated vapour @ 40 degree celsius\n",
      "hf2=83.9 #spedific enthalpy of saturated liquid @ 20 degree celsius\n",
      "w1=((w2*hfg2)+Cp*(T2-T1))/(hg1-hf2)# specific humidity for 40 degree celsius\n",
      "print \"The humidity ratio is\",round(w1,4),\"kg water/ Kg dry air \\n\"\n",
      "pv1=100*w1/(0.622+w1) # partial pressure of vapour\n",
      "phi=pv1/pg1 # relative humidity\n",
      "print \"The relative humidity is\",round(phi*100,1),\"% \\n\"\n",
      "\n",
      "hv=hg1 # temperature is at DBT=40 degree celsius\n",
      "h=Cp*T1+w1*hv # specific enthalpy  of air\n",
      "print \"The specific enthalpy is\",round(h,1),\"kJ/kg dry air\"\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The humidity ratio is 0.0066 kg water/ Kg dry air \n",
        "\n",
        "The relative humidity is 14.3 % \n",
        "\n",
        "The specific enthalpy is 57.1 kJ/kg dry air\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8.5:PG-215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "\n",
      "T1=40 # inlet temperature in degree celsius\n",
      "T2=27 # outlet temperature in degree celsius\n",
      "phi1= 10 # relative humidity at inlet\n",
      "# as no heat transfer takes place thus isenthalpic process\n",
      "\n",
      "#Thus following the enthalpy line at DBT=40 and Relative humidity=10\n",
      "\n",
      "phi2=45 # by interpolation of constant enthalpy line\n",
      "w1=0.0046# specific humidity @ T=40 and phi1=10\n",
      "w2=0.010 # specific humidity at outlet\n",
      "W=w2-w1 # amount of water added\n",
      "Tmin=18.5 # minimum temperature at 100% relative humidity\n",
      "\n",
      "print \"The relative humidity is\",round(phi2,1),\"% \\n \"\n",
      "print \"The added water is\",round(W,4),\"kg water/kg dry air \\n\"\n",
      "print \"The lowest possible temperature is\",round(Tmin,1),\"*C \"\n",
      "\n",
      "\n",
      " "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The relative humidity is 45.0 % \n",
        " \n",
        "The added water is 0.0054 kg water/kg dry air \n",
        "\n",
        "The lowest possible temperature is 18.5 *C \n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8.6:PG-215"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "T1=5+273.0 # outside air temperature in kelvin\n",
      "P=100.0 # pressure in kPa\n",
      "Ra=0.287 # specific gas constant for air\n",
      "phi=0.7 # relative humidity outside\n",
      "Qf=50.0/60.0 # volume flow rate in m**3/sec\n",
      "Pg1=0.872 # saturation pressure at 278 K\n",
      "Pv1=phi*Pg1 # partial pressure of water vapour\n",
      "Pa1=P-Pv1 # partial pressure of air\n",
      "\n",
      "rhoa=Pa1/(Ra*T1) # density of dry air\n",
      "\n",
      "mdota=Qf*rhoa # mass flow rate of dry air\n",
      "\n",
      "# using psychrometric chart at T1=5*C and phi1=70% \n",
      "h1=14 # inlet enthalpy in kJ/kg\n",
      "h2=35 # enthalpy after heating in kJ/kg\n",
      "\n",
      "Qdot=mdota*(h2-h1) # heat transfer rate\n",
      "# from psychrometric chart for T=25 *C and 35 kJ/kg enthalpy\n",
      "phi2=19 # realtive humidity\n",
      "\n",
      "print \"The heat transfer rate is\",round(Qdot,1),\"kJ/s \\n\"\n",
      "print \"The final relative humidity is\",round(phi2,4),\"% \"\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat transfer rate is 21.8 kJ/s \n",
        "\n",
        "The final relative humidity is 19.0 % \n"
       ]
      }
     ],
     "prompt_number": 31
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8.7:PG-216"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "#DATA TAKEN FROM PSYCHROMETRIC CHART\n",
      "T1=5+273.0 # outside temperature in kelvin\n",
      "h1=10# enthalpy in kJ/kg @ T=5 *C and 40 % relative humidity\n",
      "Pg1=0.872 # saturaion pressure in kPa for 5 degree celsius DBT\n",
      "phi1=0.4\n",
      "h2=33 # specific enthalpy at 25 *C and 40 % relatuve humidity\n",
      "h3=45.0 # specific enthalpy at state 3\n",
      "P=100.0 # atmospheric pressure in kPa\n",
      "Ra=0.287 # specific gas constant for air\n",
      "Qf=60.0/60.0 # volume flow rate in m**3/s\n",
      "Pv1=phi1*Pg1 # partial presure of water vapour \n",
      "Pa1=P-Pv1 # partial pressure of air\n",
      "w2=0.0021 # specific humidity @ 40 % relative humidity and 25*C temperature\n",
      "w3=0.008 # final specific humidity\n",
      "rhoa1=Pa1/(Ra*T1) # air density\n",
      "mdota=Qf*rhoa1 # mass flow rate of dry air\n",
      "\n",
      "Qdot=mdota*(h2-h1) # heat transfer rate\n",
      "\n",
      "# as the process is isothermal thus\n",
      "mdots=mdota*(w3-w2)# mass flow rate of steam by conservation of mass\n",
      "print \"the rate of steam supplied is\",round(mdots,4),\"kg/s \\n\"\n",
      "# also using energy balance\n",
      "hs=(mdota*(h3-h2))/mdots # enthalpy of steam\n",
      "hf=604.7 # enthalpy of saturated liquid @ 400 kPa\n",
      "hg=2738.5 # enthalpy of saturated vapour @ 400 kPa\n",
      "xs=(hs-hf)/(hg-hf)\n",
      "print \"The quality of steam is\",round(xs,2)\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the rate of steam supplied is 0.0074 kg/s \n",
        "\n",
        "The quality of steam is 0.67\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8.8:PG-217"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "# REFER TO FIG. 8.4\n",
      "T1=30 # outside temperature in degree celsius\n",
      "phi1=0.9 # outside relative humidity\n",
      "T2=23 # room temperature in degree celsius\n",
      "phi2=0.4 # relative humidity in room\n",
      "\n",
      "# using psychrometric chart\n",
      "w1=0.0245 # specific humidity @ 30 *C and relative humidity 0.9\n",
      "h1=93 # specific enthalpy @ 30 *C and relative humidity 0.9\n",
      "w2=w1 # during cooling humidity remains constant \n",
      "w3=0.007 # specific humidity @ 23 *C and relative humidity 0.4\n",
      "h4=41 # final specific enthalpy\n",
      "h3=26 # specific enthalpy @ 23 *C and relative humidity 0.4\n",
      "deltaw=w3-w2 # moisture removed\n",
      "print \" the amount of moisture removed is\",round(deltaw,4),\"kg \\n\"\n",
      "\n",
      "qout=h3-h1 # heat removed F-G-H process\n",
      "\n",
      "print \" the heat removed is\",round(qout,4),\"kJ/kg \\n \"\n",
      "\n",
      "qin=h4-h3 # heat added to bring to desired state\n",
      "\n",
      "print \" the heat added is\",round(qin,4),\"kJ/kg \""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " the amount of moisture removed is -0.0175 kg \n",
        "\n",
        " the heat removed is -67.0 kJ/kg \n",
        " \n",
        " the heat added is 15.0 kJ/kg \n"
       ]
      }
     ],
     "prompt_number": 38
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex8.9:PG-218"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "P=100 # atospheric pressure in kPa\n",
      "R=0.287 # specific gas constant for air\n",
      "T1=15+273 # outside temperature in kelvin\n",
      "phi1=0.4# outside air relative humidity\n",
      "Qf1=40 # outside air flow rate in m^3/min\n",
      "T2=32+273 # inside temperature in kelvin\n",
      "phi2=0.7 # inside air relative humidity\n",
      "Qf2=20 # outside air flow rate in m^3/min\n",
      "Ps1=1.7 # saturation pressure @ 15 degree celsius and 40% humidity\n",
      "Ps2=4.9 # saturation pressure @ 32 degree celsius and 70% humidity\n",
      "\n",
      "Pv1=Ps1*phi1 # partial pressure of water vapour outside\n",
      "\n",
      "Pv2=Ps2*phi2 # partial pressure of water vapour inside\n",
      "\n",
      "Pa1=P-Pv1 #partial pressure of dry air outside\n",
      "Pa2=P-Pv2 #partial pressure of dry air inside\n",
      "\n",
      "rhoa1=Pa1/(R*T1) # density of outside air\n",
      "mdota1=Qf1*rhoa1 # mass flow rate of air outside\n",
      "\n",
      "rhoa2=Pa2/(R*T2) # density of inside air\n",
      "mdota2=Qf2*rhoa2 # mass flow rate of inside air\n",
      " # using psychrometric chart locating state 1 and 2\n",
      "h1=37 # specific enthalpy @ DBT 15*C and 40 % humidity\n",
      "w1=0.0073 # specific humidity @ DBT 15*C and 40 % humidity\n",
      "h2=110 # specific enthalpy @ DBT 32*C and 70 % humidity\n",
      "w2=0.0302 # specific humidity @ DBT 32*C and 70 % humidity\n",
      "ratio=mdota1/mdota2 # ratio of distance between states \n",
      "#  using this ratio state 3 is located on psychrometric chart\n",
      "T3=(mdota1*T1+mdota2*T2)/(mdota1+mdota2)-273 # final temparature in celsius\n",
      "\n",
      "phi3=65# final relative humidity at T3 from psychrometric chart\n",
      "\n",
      "print \" The relative humidity is\",round(phi3,4),\"% \\n\"\n",
      "print \" The resultant temperature is\",round(T3),\"degree celsius\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " The relative humidity is 65.0 % \n",
        "\n",
        " The resultant temperature is 20.0 degree celsius\n"
       ]
      }
     ],
     "prompt_number": 41
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Ex7.10:PG-219"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "# initialization of variables\n",
      "mdotw3=10000.0 # mass flow rate of water entering in cooling tower in kg/min\n",
      "Tw1=40+273.0 # temperature of water entering cooling tower in kelvin\n",
      "Ta1=20+273.0 # temperature of air entering cooling tower in kelvin\n",
      "phi1=0.5# relative humidity of entering air\n",
      "Tw2=25+273.0 # temperature of water leaving cooling tower in kelvin\n",
      "Ta2=32+273 # temperature of air leaving cooling tower in kelvin\n",
      "phi2=0.98 # relative humidity of leaving air\n",
      "# from psychrometric chart\n",
      "h1=37.0# specific enthalpy of air @ 20*C DBT and 50% humidity\n",
      "w1=0.0073 # specific humidity of air @ 20*C DBT and 50% humidity\n",
      "h2=110.0 # specific enthalpy of air @ 32*C DBT and 98% humidity\n",
      "w2=0.030 # specific humidity of air @ 32*C DBT and 98% humidity\n",
      "\n",
      "h3=167.5 # specific enthalpy of water from steam table at 40 degree celsius\n",
      "h4=104.9 # specific enthalpy of water from steam table at 25 degree celsius\n",
      "\n",
      "mdota=(mdotw3*(h4-h3))/(h1-h2+(w2-w1)*h4) # by energy balance\n",
      "\n",
      "\n",
      "v1=0.84 # specific volume of air entering tower from psychrometric chart\n",
      "\n",
      "Qf=mdota*v1 # volume flow rate in m^3/min\n",
      "print \"The volume flow rate of air into the cooling tower is\",round(Qf),\" m^3/min \\n\"\n",
      "\n",
      "mdot4=mdotw3-(w2-w1)*mdota # by mass balance\n",
      "print \"The mass flow rate of water that leaves the cooling tower \",round(mdot4),\"kg/min\"\n",
      "# The answers is slightly different in textbook due to approximations in calculations while in python solution is precise\n",
      "\n",
      "\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The volume flow rate of air into the cooling tower is 7446.0  m^3/min \n",
        "\n",
        "The mass flow rate of water that leaves the cooling tower  9799.0 kg/min\n"
       ]
      }
     ],
     "prompt_number": 3
    }
   ],
   "metadata": {}
  }
 ]
}