summaryrefslogtreecommitdiff
path: root/Heat_Transfer_in_SI_units_by_Holman/Chapter10.ipynb
blob: b6a504f0e31c3b864bfa65ba32fc5269fc251928 (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
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 10 Heat Exchangers "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hi is: 1409.0\n",
      "% reduction because of fouling factor is  28.0\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.3\n",
    "# influence of fouling factor\n",
    "\n",
    "#Variable declaration\n",
    "\t\n",
    "\t\n",
    "Rf = 0.0002 \n",
    "\t# using Rf=(1/hi-1/h_clean)\n",
    "h_clean = 1961.0 \t\t\t# [W/square meter degree celsius]\n",
    "\t# we obtain \n",
    "\n",
    "#Calculation\n",
    "\n",
    "hi = 1/(Rf+(1/h_clean)) \t\t# [W/square meter degree celsius]\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"hi is:\",round(hi)\n",
    "print \"% reduction because of fouling factor is \",round((h_clean-hi)*100/h_clean) \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Area of heat-exchanger is 15.81 square meter\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.4\n",
    "# calculation of heat exchanger size from known temperatures\n",
    "\n",
    "#Variable declaration\n",
    "import math\n",
    "m_dot = 68.0 \t\t\t# [kg/min] water flow rate \n",
    "U = 320.0 \t\t\t# [W/sq m degree C] overall heat transfer coefficient\n",
    "T1 = 35.0 \t\t\t# [degree celsius] initial temperature \n",
    "T2 = 75.0 \t\t\t# [degree celsius] final temperature\n",
    "Toe = 110.0 \t\t\t# [degree celsius] oil entering temperature \n",
    "Tol = 75.0 \t\t\t# [degree celsius] oil leaving temperature\n",
    "Cw = 4180.0 \t\t\t# [J/kg degree celsius] water specific heat capacity\n",
    "\t# the total heat transfer is determined from the energy absorbed by the water:\n",
    "\n",
    "#Claculation\n",
    "\n",
    "q = m_dot*Cw*(T2-T1) \t\t# [J/min]\n",
    "q = q/60 \t\t\t# [W]\n",
    "\t# since all the fluid temperatures are known, the LMTD can be calculated by \t\tusing the temperature scheme in figure 10-7b\n",
    "dT_m = ((Toe-Tol)-(T2-T1))/(math.log((Toe-Tol)/(T2-T1))) \t# [degree celsius]\n",
    "\t\t\t\t# then, since  q = U*A*dT_m\n",
    "A = q/(U*dT_m) \t\t\t# [square meter] area of heat-exchanger\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Area of heat-exchanger is\",round(A,2),\"square meter\" "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Area required for this exchanger is 19.53 square meter\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.5\n",
    "# shell-and-tube heat exchanger\n",
    "\n",
    "# Variable declaration\n",
    "\t\n",
    "\t# determine a correction factor from figure 10-8 to be used \n",
    "\t# the parameters according to figure 10-8(page no.-532) are \n",
    "T1 = 35 \t\t\t# [degree celsius]\n",
    "T2 = 75 \t\t\t# [degree celsius]\n",
    "t1 = 110 \t\t\t# [degree celsius]\n",
    "t2 = 75 \t\t\t# [degree celsius]\n",
    "P = (t2-t1)/(T1-t1) \n",
    "R = (T1-T2)/(t2-t1) \n",
    "\t# so the correction factor is \n",
    "F = 0.81 \t\t\t# from figure 10-10(page no.-534)\n",
    "\t# and the heat transfer is q = U*A*F*dT_m\n",
    "\t# so that. from example 10-4 we have \n",
    "U = 320 \t\t\t# [W/sq m deg C] overall heat transfer coefficient\n",
    "q = 189493.33 \t\t\t# [W]\n",
    "\n",
    "#Calculation\n",
    "\n",
    "dT_m = 37.44 \t\t\t# [degree celsius]\n",
    "A = q/(U*F*dT_m) \t\t# [square meter]\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Area required for this exchanger is\",round(A,2),\"square meter\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.6"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Number of tubes per pass 37.0\n",
      "Number of passes = 2\n",
      "Length of tube per pass = 1.708 m\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.6\n",
    "# design of shell-and-tube heat exchanger\n",
    "\n",
    "# Variable declaration\n",
    "\n",
    "import math\n",
    "m_dot_c = 3.8 \t\t\t# [kg/s] water flow rate\n",
    "Ti = 38 \t\t\t# [degree celsius] initial temperature of water\n",
    "Tf = 55 \t\t\t# [degree celsius] final temperature of water\n",
    "m_dot_h = 1.9 \t\t\t# [kg/s] water flow rate entering the exchanger\n",
    "Te = 93 \t\t\t# [degree celsius] entering water temperature\n",
    "U = 1419 \t\t\t# [W/sq m degree C] overall heat transfer coefficient\n",
    "d = 0.019 \t\t\t# [m] diameter of tube\n",
    "v_avg = 0.366 \t\t\t# [m/s] average water velocity in exchanger\n",
    "Cc = 4180 \t\t\t# [] specific heat of water\n",
    "Ch = Cc \t\t\t# [] specific heat \n",
    "rho = 1000 \t\t\t# [kg/cubic meter] density of water\n",
    "\t# we first assume one tube pass and check to see if it satisfies the \t\t\tconditions of this problem. the exit temperature of the hot water is \t\t\tcalculated from\n",
    "\n",
    "#Calculation\n",
    "\n",
    "dTh = m_dot_c*Cc*(Tf-Ti)/(m_dot_h*Ch) \t# [degree celsius]\n",
    "Th_exit = Te-dTh \t\t\t# [degree celsius]\n",
    "\t# the total required heat transfer is obtained for the cold fluid is \n",
    "q = m_dot_c*Cc*(Tf-Ti) \t\t\t# [W]\n",
    "\t# for a counterflow exchanger, with the required temperature \n",
    "LMTD = ((Te-Tf)-(Th_exit-Ti))/math.log((Te-Tf)/(Th_exit-Ti)) \t# [degree celsius]\n",
    "dTm = LMTD \t\t\t\t# [degree celsius]\n",
    "A = q/(U*dTm) \t\t\t\t# [square meter]\n",
    "\n",
    "\n",
    "\t#calculate the total area with\n",
    "A1 = m_dot_c/(rho*v_avg) \t\t# [square meter]\n",
    "\t# this area is the product of number of tubes and the flow area per tube:\n",
    "n = A1*4/(math.pi*d**(2)) \t\t# no. of tubes\n",
    "n = round(n) \t\n",
    "\t# rounding of value of n because no. of pipe is an integer value\n",
    "\t# the surface area per tube per meter of length is \n",
    "S = math.pi*d \t\t\t\t# [square meter/tube meter]\n",
    "\t# total surface area required for a one tube pass exchanger\t\t  was \t\tcalculated above .\n",
    "\t# we may thus compute the length of tube for this type of exchanger from \n",
    "L = A/(S*n) \t\t\t\t# [m]\n",
    "\t# this length is greater than the allowable 2.438 m, so we must use more than \t\tone tube pass.\n",
    "\t\n",
    "\t# we next try two tube passes. from figure 10-8(page no.-532) \n",
    "F = 0.88 \n",
    "A_total = q/(U*F*dTm) \t\t\t# [square meter]\n",
    "\t# the number of tubes per pass is still 37 because of the velocity \t\t\trequirement. for the two pass exchanger the total surface area is now related \t\tto the length by\n",
    "L1 = A_total/(2*S*n) \t\t\t# [m]\n",
    "\t# this length is within the 2.438 m requirement, so the final design choice is \n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Number of tubes per pass\",n \n",
    "print \"Number of passes = 2\" \n",
    "print \"Length of tube per pass =\",round(L1,3),\"m\" \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.7"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Surface area of heat exchanger is  10.84 square meter\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.7\n",
    "# cross flow exchanger with one fluid mixed \n",
    "\n",
    "# Variable declaration\n",
    "import math\n",
    "\n",
    "m_dot = 5.2 \t\t\t# [kg/s] mass flow rate\n",
    "T1 = 130.0 \t\t\t# [degree celsius] temperature of entering steam\n",
    "T2 = 110.0 \t\t\t# [degree celsius] temperature of leaving steam\n",
    "t1 = 15.0 \t\t\t# [degree celsius] temperature of entering oil\n",
    "t2 = 85.0 \t\t\t# [degree celsius] temperature of leaving oil\n",
    "c_oil = 1900.0 \t\t\t# [J/kg degree celsius] heat capacity of oil\n",
    "c_steam = 1860.0\t\t# [J/kg degree celsius] heat capacity of steam\n",
    "U = 275 \t\t\t# [W/sq m deg C] overall heat transfer coefficient\n",
    "\t#the total heat transfer may be obtained from an energy balance on the steam \n",
    "\n",
    "#Calculation\n",
    "\n",
    "q = m_dot*c_steam*(T1-T2) \t\t\t\t# [W]\n",
    "\t# we can solve for the area from equation (10-13). the value of dT_m is \t\tcalculated as if the exchanger were counterflow double pipe,thus\n",
    "dT_m = ((T1-t2)-(T2-t1))/math.log((T1-t2)/(T2-t1)) \t# [degree celsius]\n",
    "\n",
    "\t# t1,t2 is representing the unmixed fluid(oil) and T1,T2 is representing the \t\tmixed fluid(steam) so that:\n",
    "\t# we calculate \n",
    "\n",
    "R = (T1-T2)/(t2-t1) \n",
    "P = (t2-t1)/(T1-t1) \n",
    "\t# consulting figure 10-11(page no.-534) we find \n",
    "F = 0.97 \n",
    "\t# so the area is calculated from \n",
    "A = q/(U*F*dT_m) \t\t\t\t\t# [square meter]\n",
    "\n",
    "#Result\n",
    "print \"Surface area of heat exchanger is \",round(A,2),\"square meter\" \n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.8"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the objective of this example is to show that an iterative procedure is required when the inlet and outlet temperatures are not known or easily calculated\n",
      "there is no need to go through this iteration because it can be avoided by using the techniques described in section 10-6\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.8\n",
    "# effects of off-design flow rates for exchanger in example 10-7 \n",
    "# Variable declaration\n",
    "\n",
    "# we did not calculate the oil flow in example 10-7 but can do so now from \n",
    "q = 193 # [kW]\n",
    "c_oil = 1.9 # [J/kg degree celsius] heat capacity of oil\n",
    "t1 = 15 # [degree celsius] temperature of entering oil\n",
    "t2 = 85 # [degree celsius] temperature of leaving oil\n",
    "m_dot_o = q/(c_oil*(t2-t1)) # [kg/s]\n",
    "# the new flow rate will be half this value \n",
    "m_dot_o = m_dot_o/2 # [kg/s]\n",
    "# we are assuming the inlet temperatures remain the same at 130 degree celsius for the steam and 15 degree celsius for the oil.\n",
    "# the new relation for the heat transfer is q = m_dot_o*c_oil*(Teo-15) = m_dot_s*cp*(130-Tes)                       (a)\n",
    "# but the exit temperatures, Teo and Tes are unknown. furthermore, dT_m is unknown without these temperatures, as are the values of R and P from figure  10-11(page no.-535). this means we must use an iterative procedure to solve for the exit temperatures using equation (a) and   q = U*A*F*dT_m          (b)\n",
    "# the general procedure is to assume values of the exit temperatures until the q's agree between equations(a) and (b).\n",
    "print \"the objective of this example is to show that an iterative procedure is required when the inlet and outlet temperatures are not known or easily calculated\" \n",
    "print \"there is no need to go through this iteration because it can be avoided by using the techniques described in section 10-6\" \n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.9"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "A Reduction in the oil flow rate of 50 % causes a reduction in heat transfer of only  34.0 percent\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.9\n",
    "# off-design calculation using E-NTU method \n",
    " \n",
    "#Variable declaration\t\n",
    "import math\n",
    "m_dot_o = 0.725 \t\t\t# [kg/s] oil flow rate\n",
    "m_dot_s = 5.2 \t\t\t\t# [kg/s] steam flow rate\n",
    "t1 = 15 \t\t\t\t# [degree celsius] temperature of entering oil\n",
    "T1 = 130 \t\t\t\t# [deg C] temperature of entering steam\n",
    "c_oil = 1900 \t\t\t\t# [J/kg degree celsius] heat capacity of oil\n",
    "c_steam = 1860 \t\t\t\t# [J/kg degree celsius] heat capacity of steam\n",
    "\t# for the steam \n",
    "Cs = m_dot_s*c_steam \t\t\t# [W/degree celsius]\n",
    "\t# for the oil\n",
    "Co = m_dot_o*c_oil \t\t\t# [W/degree celsius]\n",
    "\t# so the oil is minium fluid. we thus have\n",
    "C_min_by_C_max = Co/Cs \n",
    "U = 275 \t\t\t\t# [W/sq m deg C] overall heat transfer \t\t\t\t\t\t\t  coefficient\n",
    "A = 10.83 \t\t\t\t# [sq meter] surface area of heat exchanger\n",
    "NTU = U*A/Co \n",
    "\t# we choose to use the table and note that Co(minimum) is unmixed and \t\t\tCs(maximum) is mixed so that the first relation in the table 10-3 applies.\n",
    "\t# we therfore calculate E(effectiveness) as \n",
    "\n",
    "E = (1/C_min_by_C_max)*(1-math.exp(-C_min_by_C_max*(1-math.exp(-NTU)))) \n",
    "\t# if we were using figure 10-14(page no.-544) we would have to evaluate \n",
    "C_mixed_by_C_unmixed = Cs/Co \n",
    "\t# and would still determine \n",
    "E = 0.8 # approximately\n",
    "\t# now, using the effectiveness we can determine the temperature difference of \t\tthe minimum fluid(oil as)\n",
    "dT_o = E*(T1-t1) \t\t\t# [degree celsius]\n",
    "\t# so that heat transfer is \n",
    "q = m_dot_o*c_oil*(dT_o) \t\t# [W]\n",
    "q_initial = 193440 \t\t\t# [W] heat transfer when oilrate is 100 %\n",
    "print \"A Reduction in the oil flow rate of 50 % causes a reduction in heat transfer of only \",round((q_initial-q)*100/q_initial),\"percent\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.10"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Exit water temperature is 90.8 degree celcius\n",
      "The total heat transfer under the new flow conditions is 155.5 kW\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.10\n",
    "# off-design calculation of exchanger in example 10-4  \n",
    "\n",
    "# Variable declaration\n",
    "\n",
    "m_dot_c = 68 \t\t\t# [kg/min] water flow rate\n",
    "\n",
    "T1 = 35 \t\t\t# [degree celsius] initial temperature \n",
    "T2 = 75 \t\t\t# [degree celsius] final temperature\n",
    "Toe = 110 \t\t\t# [degree celsius] oil entering temperature \n",
    "Tol = 75 \t\t\t# [degree celsius] oil leaving temperature\n",
    "Cc = 4180 \t\t\t# [J/kg degree celsius] water specific heat capacity\n",
    "Ch = 1900 \t\t\t# [J/kg degree celsius] heat capacity of oil\n",
    "U = 320 \t\t\t# [W/squ m deg C] overall heat transfer coefficient\n",
    "A = 15.814568 \t\t\t# [sq m] area of heat exchanger (from example 10-4)\n",
    "\t# the flow rate of oil is calculated from the energy balance for the original \t\tproblem:\n",
    "\n",
    "#Calculation\n",
    "m_dot_h = m_dot_c*Cc*(T2-T1)/(Ch*(Toe-Tol)) \t# [kg/min]\n",
    "\t# the capacity rates for the new conditions are calculated as \n",
    "C_h = m_dot_h*Ch/60 \t\t\t\t# [W/degree celsius]\n",
    "C_c = m_dot_c*Cc/60 \t\t\t\t# [W/degree celsius]\n",
    "\t# so that the water (cold fluid) is the minimum fluid, and \n",
    "C_min_by_C_max = C_c/C_h \n",
    "NTU_max = U*A/C_c \n",
    "\t# from figure 10-13(page no.-542) or table 10-3(page no.-543) the \t\teffectiveness is \n",
    "E = 0.744 \n",
    "\t# and because the cold fluid is the minimum, we can write \n",
    "dT_cold = E*(Toe-T1) \t\t\t\t# [degree celsius]\n",
    "\t\t\t\t\t\t# and the exit water temperature is \n",
    "Tw_exit = T1+dT_cold \t\t\t\t# [degree celsius]\n",
    "\t# the total heat transfer under the new flow conditions is calculated  as \n",
    "m_dot_c = 40 \t\t\t\t\t# [kg/min]\n",
    "q = m_dot_c*Cc*dT_cold/60 \t\t\t# [W]\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Exit water temperature is\",Tw_exit,\"degree celcius\" \n",
    "print \"The total heat transfer under the new flow conditions is\",round(q/1000,1),\"kW\"\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.11"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The exit water temperature is 21.1 degree celsius\n",
      "the heat transfer is 40.33 kW\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.11\n",
    "# cross-flow exchanger with both fluid unmixed \n",
    " \n",
    "# Variable declaration\n",
    "\n",
    "pa = 101325 \t\t\t# [Pa] pressure of air\n",
    "Ti = 15.55 \t\t\t# [degree celsius] initial temperature of air\n",
    "Tf = 29.44 \t\t\t# [degree celsius] final temperature of air\n",
    "Thw = 82.22 \t\t\t# [degree celsius] hot water temperature\n",
    "U = 227 \t\t\t# [W/sq m deg C] overall heat transfer coefficient\n",
    "S = 9.29 \t\t\t# [square meter] total surface area of heat exchanger\n",
    "R = 287 \t\t\t# [] universal gas constant\n",
    "Cc = 1006 \t\t\t# [J/kg degree celsius] specific heat of air \n",
    "Ch = 4180 \t\t\t# [J/kg degree celsius] specific heat of water\n",
    "\t# the heat transfer is calculated from the energy balance on the air. first, \t\tthe inlet air density is \n",
    "rho = pa/(R*(Ti+273.15)) \t# [kg/cubic meter]\n",
    "\t# so the mass flow of air (the cold fluid) is \n",
    "mdot_c = 2.36*rho \t\t# [kg/s]\n",
    "\t# the heat transfer is then \n",
    "q = mdot_c*Cc*(Tf-Ti) \t\t# [W]\n",
    "\t# from the statement of the problem we do not know whether the air or water is \tthe minimum fluid. a trial and error procedur must be used \n",
    "\t# we assume that the air is the minimum fluid and then check out our \t\tassumption.then\n",
    "Cmin = mdot_c*Cc \t\t# [W/degree celsius]\n",
    "NTU_max = U*S/Cmin \n",
    "\t# and the effectiveness based on the air as the minimum fluid is \n",
    "E = (Tf-Ti)/(Thw-Ti) \n",
    "\t# we must assume values for the water flow rate until we are able to match the \tperformance as given by figure 10-15 or table 10-3. we first note that\n",
    "Cmax = mdot_c*Cc \t\t# [W/degree celsius]           (a)\n",
    "\t\t\t\t# NTU_max = U*S/Cmin                             (b)\n",
    "\t\t\t\t# E = dT_h/(Thw-Ti)                             (c)\n",
    "\t\t\t\t# dT_h = q/Cmin                                 (d)\n",
    "\n",
    "\t# now we assume different values for Cmin abd calculate different-different \t\tvalues for NTU_max, dT_h, and E\n",
    "\n",
    "\t# for \n",
    "Cmin_by_Cmax1 = 0.5 \n",
    "Cmin1 = Cmin_by_Cmax1*Cmax \t\t\t# [W/degree celsius]\n",
    "NTU_max1 = U*S/Cmin1 \n",
    "dT_h1 = q/Cmin1 \t\t\t\t# [degree celsius]\n",
    "E1_c1 = dT_h1/(Thw-Ti) \t\t\t\t# calculated\n",
    "E1_t1 = 0.65 \t\t\t\t\t# from table \n",
    "\n",
    "\t# for \n",
    "Cmin_by_Cmax2 = 0.25 \n",
    "Cmin2 = Cmin_by_Cmax2*Cmax \t\t\t# [W/degree celsius]\n",
    "NTU_max2 = U*S/Cmin2 \n",
    "dT_h2 = q/Cmin2 \t\t\t\t# [degree celsius]\n",
    "E1_c2 = dT_h2/(Thw-Ti) \t\t\t\t# calculated\n",
    "E1_t2 = 0.89 \t\t\t\t\t# from table \n",
    "\n",
    "\t# for \n",
    "Cmin_by_Cmax3 = 0.22 \n",
    "Cmin3 = Cmin_by_Cmax3*Cmax \t\t\t# [W/degree celsius]\n",
    "NTU_max3 = U*S/Cmin3 \n",
    "dT_h3 = q/Cmin3 \t\t\t\t# [degree celsius]\n",
    "E1_c3 = dT_h3/(Thw-Ti) \t\t\t\t# calculated\n",
    "E1_t3 = 0.92 \t\t\t\t\t# from table \n",
    "\n",
    "\t# we estimate the water-flow rate as about\n",
    "Cmin = 660 \t\t\t\t\t# [W/degree celsius]\n",
    "mdot_h = Cmin/Ch \t\t\t\t# [kg/s]\n",
    "\t# the exit water temperature is accordingly\n",
    "Tw_exit = Thw-q/Cmin \t\t\t\t# [degree celsius]\n",
    "\n",
    "print \"The exit water temperature is\",round(Tw_exit,1),\"degree celsius\" \n",
    "print \"the heat transfer is\",round(q/1000,2),\"kW\" "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.13"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Area required for the heat exchanger is 20.09 square meter\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.13\n",
    "# shell and tube exchangeras air heater\n",
    "  \n",
    "# Variable declaration\n",
    "\n",
    "import math\n",
    "To = 100.0 \t\t\t\t# [degree celsius] temperature of hot oil\n",
    "m_dot_a = 2.0 \t\t\t\t# [kg/s] flow rate of air\n",
    "T1 = 20.0 \t\t\t\t# [degree celsius] initial temperature of air \n",
    "T2 = 80.0 \t\t\t\t# [degree celsius] final temperature of air\n",
    "Cp_o = 2100.0 \t\t\t\t# [J/kg deg C] specific heat of the oil\n",
    "Cp_a = 1009.0 \t\t\t\t# [J/kg deg C] specific heat of the air\n",
    "m_dot_o = 3 \t\t\t\t# [kg/s] flow rate of oil\n",
    "U = 200.0 \t\t\t\t# [W/sq m] overall heat transfer coefficient\n",
    "\t# the basic energy balance is m_dot_o*Cp_o*(To-Toe) = m_dot_a*Cp_a*(T2-T1)\n",
    "#Calculation\n",
    "Toe = To-m_dot_a*Cp_a*(T2-T1)/(m_dot_o*Cp_o) # [degree celsius]\n",
    "\n",
    "\t# we have\n",
    "m_dot_h_into_Ch = m_dot_o*Cp_o \t\t# [W/degree celsius]\n",
    "m_dot_c_into_Cc = m_dot_a*Cp_a \t\t# [W/degree celsius]\n",
    "\t# so the air is minimum fluid\n",
    "C = m_dot_c_into_Cc/m_dot_h_into_Ch \n",
    "\t# the effectiveness is \n",
    "E = (T2-T1)/(To-T1) \n",
    "\t# now we may use figure 10-16  to obtain NTU. \n",
    "NTU = -(1+C**(2))**(-1.0/2.0)*math.log((2/E-1-C-(1+C**2)**(1.0/2.0))/(2/E-1-C+(1+C**2)**(1.0/2.0))) \n",
    "\t# now, we calcuate the area as \n",
    "A = NTU*m_dot_c_into_Cc/U \t\t# [square meter]\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Area required for the heat exchanger is\",round(A,2),\"square meter\" "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.14"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Area to achieve a heat exchanger effectiveness of 60% with an exit water temperature of 40 degree celsius is 9.16 square meter\n",
      "by reducing the flow rate we have lowered the heat transfer by 37.0  percent\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.14\n",
    "# ammonia condenser  \n",
    "\n",
    "#Variable declaration\n",
    "\n",
    "Ta = 50 \t\t\t# [degree C] temperature of entering ammonia vapour\n",
    "Tw1 = 20 \t\t\t# [degree celsius] temperature of entering water\n",
    "q = 200 \t\t\t# [kW] total heat transfer required\n",
    "U = 1 \t\t\t\t# [kW/sq m deg C] overall heat transfer coefficient\n",
    "Tw2 = 40 \t\t\t# [deg C] temperature of exiting water\n",
    "Cw = 4.18 \t\t\t# [kJ/kg degree celsius] specific heat of water\n",
    "\t# the mass flow can be calculated from the heat transfer with\n",
    "m_dot_w = q/(Cw*(Tw2-Tw1)) \t# [kg/s]\n",
    "\t# because this is the condenser the water is the minimum fluid and \n",
    "C_min = m_dot_w*Cw # [kW/degree celsius]\n",
    "\t# the value of NTU is obtained from the last entry of table 10-4\n",
    "E = 0.6 \t\t\t# effectiveness\n",
    "\n",
    "#Calculation\n",
    "\n",
    "import math\n",
    "NTU = -math.log(1-E) \n",
    "\n",
    "\t# so that area is calculated as \n",
    "A = C_min*NTU/U \t\t# [square meter]\n",
    "\n",
    "\t# when the flow rate is reduced in half the new value of NTU is \n",
    "NTU1 = U*A/(C_min/2) \n",
    "\n",
    "\t# and the effectiveness is computed from the last entry of table 10-3\n",
    "E1 = 1-math.exp(-NTU1) \n",
    "\n",
    "\t# the new water temperature difference is computed as \n",
    "dT_w = E1*(Ta-Tw1) \t\t# [degree celsius]\n",
    "\n",
    "\t# so that the heat transfer is \n",
    "q1 = C_min*dT_w/2 \t\t# [kW]\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Area to achieve a heat exchanger effectiveness of 60% with an exit water temperature of 40 degree celsius is\",round(A,2),\"square meter\" \n",
    "print \"by reducing the flow rate we have lowered the heat transfer by\",(q-q1)*100/q,\" percent\""
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Exa 10.16"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Heat-transfer coefficient is 174.0 W/square meter degree celsius\n"
     ]
    }
   ],
   "source": [
    "#Example Number 10.16 \n",
    "# heat-transfer coefficient in compact exchanger   \n",
    "\n",
    "# Variable declaration\n",
    "\n",
    "p = 101325.0 \t\t\t# [Pa] pressure of air\n",
    "T = 300.0\t\t\t# [K] temperature of entering air\n",
    "u = 15.0 \t\t\t\t# [m/s] velocity of air\n",
    "\t# we obtain the air properties from table A-5\n",
    "rho = 1.774 \t\t\t# [kg/cubic meter] density of air\n",
    "Cp = 1005.7 \t\t\t# [J/kg degree celsius] specific heat of air\n",
    "mu = 1.983*10**(-5) \t\t# [kg/m s] viscosity of air\n",
    "Pr = 0.708 \t\t\t# prandtl number\n",
    "\t# from figure 10-19 we have\n",
    "Ac_by_A = 0.697 \n",
    "sigma = 0.697 \n",
    "\n",
    "#Calculation\n",
    "\n",
    "Dh = 3.597*10**(-3) \t\t# [m] \n",
    "\n",
    "\t\t\t\t# the mass velocity is thus \n",
    "G = ((rho*u)/sigma) \t\t# [kg/square meter s]\n",
    "\n",
    "\n",
    "\t# and the reynolds number is \n",
    "Re = Dh*G/mu \n",
    "\n",
    "\t# from figure 10-19(page no.-557) we can read\n",
    "\n",
    "St_into_Pr_exp_2_by_3 = 0.0036\n",
    " \n",
    "\t# and the heat transfer coefficient is \n",
    "\n",
    "h = St_into_Pr_exp_2_by_3*G*Cp*(Pr)**(-2.0/3.0) \t# [W/sq m deg C]\n",
    "\n",
    "#Result\n",
    "\n",
    "print \"Heat-transfer coefficient is\",round(h),\"W/square meter degree celsius\""
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 2",
   "language": "python",
   "name": "python2"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}