summaryrefslogtreecommitdiff
path: root/Heat_Transfer_Principles_And_Applications_by_Dutta/ch3.ipynb
blob: ba532e83f1140545f1953817ab99ca61873ee635 (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
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Chapter 3 : Heat transfer coefficient"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.1 Page No : 53"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The time required for melting the ice is 4274 s\n"
     ]
    }
   ],
   "source": [
    "# Variables\n",
    "di = 0.06        \t\t\t#m,initial diameter of iceball\n",
    "T1 = 30.          \t\t\t#C, room temp.\n",
    "T2 = 0.           \t\t\t#ice ball temp.\n",
    "h = 11.4         \t\t\t#W/m**2 C, heat transfer coefficient\n",
    "x = 40.           \t\t\t#% for reduction\n",
    "rho = 929.        \t\t\t#kg/m**3, density of ice\n",
    "Lv = 3.35*10**5   \t\t\t#j/kg, latent heat of fusion\n",
    "\n",
    "# Calculations\n",
    "# m = 4/3*math.pi*r**3      \t\t\t#kg,mass of ice ball\n",
    "#rate of melting = -dm/dt\n",
    "#rate of heat adsorption  = -4*math.pi*r**2*rho*dr/dt*lamda\n",
    "#at initial time t = 0\n",
    "C1 = di/2        \t\t\t#consmath.tant of integration\n",
    "#if the volume of the ball is reduced by 40% of the original volume \n",
    "r = ((1-x/100)*(di/2)**3)**(1./3)\n",
    "#time required for melting umath.sing eq. 1\n",
    "t = (di/2-r)/(h*(T1-T2)/(rho*Lv))\n",
    "\n",
    "# Results\n",
    "print \"The time required for melting the ice is %.0f s\"%(t)\n",
    "\n",
    "# note : rounding off error."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.2 Page No : 54"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The time required for the heating coil is 4.9 s\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "from scipy.integrate import quad \n",
    "#calculate the time required for the  heating coil.\n",
    "\n",
    "# Variables\n",
    "P = 1.*10**3           \t\t\t#W, electrical heating capacity\n",
    "V = 220.              \t\t\t#V, applied voltage\n",
    "d = 0.574*10**-3      \t\t\t#m, diameter of wire\n",
    "R = 4.167            \t\t\t#ohm, electrical resistance\n",
    "Tr = 21.              \t\t\t#C, room temp.\n",
    "h = 100.              \t\t\t#W/m**2 C, heat transfer coefficient\n",
    "rho = 8920.           \t\t\t#kg/m**3, density of wire\n",
    "cp = 384.             \t\t\t#j/kg C, specific heat of wire\n",
    "percent = 63.         \t\t\t#%, percent of the steady state\n",
    "\n",
    "#Calculation\n",
    "R_ = V**2/P           \t\t\t#ohm, total electrical resistance\n",
    "l = R_/R             \t\t\t#m, length of wire\n",
    "A = math.pi*d*l          \t\t\t#m**2, area of wire\n",
    "Tf = P/(h*A)+Tr      \t\t\t#final temp.\n",
    "dtf = Tf-Tr          \t\t\t#C. steady state temp. rise\n",
    "#temp. of wire after 63% rise\n",
    "T = Tr+(percent/100)*dtf   \n",
    "#rate of heat accumulation on the wire\n",
    "#d/dt(m*cp*T)                       (1)\n",
    "#rate of heat loss\n",
    "#h*A*(T-Tr).........................(2)\n",
    "#heat balance eq.       (1) = (2)\n",
    "m = math.pi*d**2*l*rho/4  \t\t\t#kg. mass of wire\n",
    "#integrating heat balance eq.\n",
    "\n",
    "def f6(T): \n",
    "    return 1/((P/(m*cp))-((h*A)/(m*cp))*(T-Tr))\n",
    "\n",
    "t =  quad(f6,21,322)[0]\n",
    "\n",
    "# Results\n",
    "print \"The time required for the heating coil is %.1f s\"%(t)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.3 Page No : 56"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " the heat transfer coefficient is 11.63 W/m**2 C \n",
      "So there is no heat flow at other surface of the wall \n",
      "average volumetric rate of heat generation is 6396 W/m**3\n"
     ]
    }
   ],
   "source": [
    "# Variables\n",
    "t = 0.2           \t\t\t#m, thickness of wall\n",
    "k = 1.163         \t\t\t#W/m C, thermal conductivity of material\n",
    "Ta = 30           \t\t\t#C, ambient temp\n",
    "\n",
    "# Calculations and Results\n",
    "#(a) at x = 0.2   let T = T1 at x = x1\n",
    "x1 = 0.2\n",
    "T1 = 250-2750*x1**2\n",
    "#let     D = dT/dx\n",
    "D = -5500*0.2     \t\t\t#C/m, at x = 0.2\n",
    "h = -k*D/(T1-Ta)\n",
    "print \" the heat transfer coefficient is %.2f W/m**2 C \"%(h)\n",
    "\n",
    "#(b)at other surface of wall, x = 0 = x2 (say)\n",
    "x2 = 0\n",
    "a = -5500*0\n",
    "print \"So there is no heat flow at other surface of the wall \"\n",
    "\n",
    "#(c)\n",
    "A = 1            \t\t\t#m**2, area\n",
    "Vw = A*x1        \t\t\t#m**3, volume of wall\n",
    "HL = h*(T1-Ta)   \t\t\t#W, heat loss from unit area\n",
    "Vav = HL/x1\n",
    "print \"average volumetric rate of heat generation is %.0f W/m**3\"%(Vav)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.4 Page No : 61"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The rate of heat loss is 150.9 W\n"
     ]
    }
   ],
   "source": [
    "from scipy.optimize import fsolve \n",
    "import math\n",
    "# Variables\n",
    "id_ = 97.*10**-3         \t\t\t#m,internal diameter of steam pipe\n",
    "od = 114.*10**-3        \t\t\t#m,outer diameter of steam pipe\n",
    "pr = 30.               \t\t\t#bar, absolute pressure os saturated steam\n",
    "Ti = 234.                \t\t\t#C, temp. at 30 bar absolute pressure\n",
    "Ts = 55.               \t\t\t#C, skin temp.\n",
    "To = 30.               \t\t\t#C, ambient temp.\n",
    "kc = 0.1              \t\t\t#W/m C, thermal conductivity of wool\n",
    "kw = 43.               \t\t\t#W/m C, thermal conductivity of pipe\n",
    "h = 8.                 \t\t\t#W/m**2 C, external air film coefficient \n",
    "L = 1.                 \t\t\t#m, assume length\n",
    "\n",
    "#Calculation\n",
    "ri = id_/2             \t\t\t#m, \n",
    "r1 = (114.*10**-3)/2        \t\t\t#m,outer radius of steam pipe\n",
    "\n",
    "#thermal resistance of insulation\n",
    "#Ri = math.log(ro/r1)/(2*math.pi*L*kc)\n",
    "#Thermal resistance of pipe wall\n",
    "Rp = math.log(r1/ri)/(2*math.pi*L*kw)\n",
    "#RT = Ri+Rp\n",
    "DF = Ti-Ts            \t\t\t#C, driving force\n",
    "#At steady state the rate of heat flow through the insulation\n",
    "# and the outer air film are equ\n",
    "\n",
    "#by trial and error method :\n",
    "def f(ro): \n",
    "    return (Ti-Ts)/(math.log(ro/r1)/kc+math.log(r1/ri)/kw)-(h*ro*(Ts-To))\n",
    "ro = fsolve(f,0.1)\n",
    "th = ro-r1        \t\t\t#m, required thickness of insulation\n",
    "Q = 2*math.pi*ro*h*L*(Ts-To)\n",
    "\n",
    "# Results\n",
    "print \"The rate of heat loss is %.1f W\"%(Q)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.5 Page No : 62"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "effective thickness of air  is 0.75 mm\n",
      "effective thickness of liquid films is 2.6 mm.\n",
      "the overall heat transfer coefficient based on i.d of pipe is 2.707 W/m**2 C\n",
      "the overall heat transfer coefficient based on od of pipe is 1.025 W/m**2 C\n",
      "the percentage of total resistance  offered by air film. is 10.25 percent\n",
      "Rate of heat loss is 21.2 W\n",
      "insulation skin temp.is 32.8 C\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Variables\n",
    "w1 = 8.            \t\t\t#%, solubility of alcohol\n",
    "w2 = 92.           \t\t\t#%, solubility of water\n",
    "k1 = 0.155        \t\t\t#W/m C, thermal conductivity of alcohol\n",
    "k2 = 0.67         \t\t\t#W/m C thermal conductivity of water\n",
    "ka = 0.0263       \t\t\t#W/m C thermal conductivity of air\n",
    "kw = 45.           \t\t\t#W/m Cthermal conductivity of pipe wall\n",
    "ki = 0.068        \t\t\t#W/m C , thermal cond. of glass\n",
    "id_ = 53.*10**-3     \t\t\t#m, internal diameter of pipe\n",
    "od = 60.*10**-3     \t\t\t#m, outer  diameter of pipe\n",
    "t = 0.04          \t\t\t#m, thickness of insulation\n",
    "hi = 800.          \t\t\t#W/m**2 C, liquid film coefficient\n",
    "ho = 10.           \t\t\t#W/m**2 C, air film coefficient\n",
    "L = 1.             \t\t\t#m, length of pipe\n",
    "T1 = 75.           \t\t\t#C, initial temp.\n",
    "T2 = 28.           \t\t\t#C, ambient air temp.\n",
    "\n",
    "# Calculations and Results\n",
    "#(a)\n",
    "km = (w1/100)*k1+(w2/100)*k2-0.72*(w1/100)*(w2/100)*(-(k1-k2))\n",
    "deli = km/hi     \t\t\t#m, effective thickness of liquid film\n",
    "delo = ka/ho     \t\t\t#m, effective thickness of air film\n",
    "print \"effective thickness of air  is %.2f mm\"%(deli*10**3)\n",
    "print \"effective thickness of liquid films is %.1f mm.\"%(delo*10**3)\n",
    "\n",
    "#(b)\n",
    "Ai = 2*math.pi*id_/2*L      \t\t\t#m**2, inside area\n",
    "ri = id_/2                    \t\t\t#m,inside radius of pipe\n",
    "r_ = od/2                      \t\t\t#m, outside radius of pipe\n",
    "ro = r_+t              \t        \t\t#m, outer radius of insulation\n",
    "Ao = 2*math.pi*ro*L        \t\t    \t#m**2, outer area\n",
    "#from eq. 3.11, overall heat transfer coefficient\n",
    "Ui = 1/(1/hi+(Ai*math.log(r_/ri))/(2*math.pi*L*kw)+(Ai*math.log(ro/r_))/(2*math.pi*L*ki)+Ai/(Ao*ho))\n",
    "print \"the overall heat transfer coefficient based on i.d of pipe is %.3f W/m**2 C\"%(Ui)\n",
    "\n",
    "#(c)\n",
    "#frim eq. 3.14\n",
    "Uo = Ui*Ai/Ao  \n",
    "print \"the overall heat transfer coefficient based on od of pipe is %.3f W/m**2 C\"%(Uo)\n",
    "\n",
    "#(d)\n",
    "R = 1/(Ui*Ai)          \t\t\t#C/W, total heat transfer resistance\n",
    "Rair = 1/(Ao*ho)       \t\t\t#C/W, heat transfer resistance of air film\n",
    "p = Rair/R\n",
    "print \"the percentage of total resistance  offered by air film. is %.2f percent\"%(p*100)\n",
    "\n",
    "#(e)\n",
    "Q = Ui*Ai*(T1-T2)\n",
    "print \"Rate of heat loss is %.1f W\"%(Q)\n",
    "\n",
    "#(f)\n",
    "Ts = Uo*Ao*(T1-T2)/(ho*Ao)+T2\n",
    "print \"insulation skin temp.is %.1f C\"%(Ts)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.6 Page No : 64"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Inlet liquid temp. should be 82 C \n",
      " the insulation skin temp. at the flat top surface is 35 C \n",
      "similarly  the insulation skin temp at cylindrical surface is 38 C\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Variables\n",
    "id_ = 1.5                \t\t\t#m, internal diameter of math.tank\n",
    "h = 2.5                 \t\t\t#m, height of math.tank\n",
    "t1 = 0.006              \t\t\t#m, thickness of wall\n",
    "t2 = 0.04               \t\t\t#m, thickness of insulation\n",
    "Ta = 25.                 \t\t\t#C, ambient temp.\n",
    "T1 = 80.                 \t\t\t#C, outlet temp. of liquid\n",
    "cp = 2000.               \t\t\t#j/kg C, specific heat of liquid\n",
    "FR = 700./3600           \t\t\t#KG/s, Liquid flow rate\n",
    "\n",
    "# Calculations and Results\n",
    "ri = id_/2+t1            \t\t\t#m, inner radius of insulation\n",
    "ro = ri+t2              \t\t\t#m, outer radius of insulation\n",
    "ki = 0.05               \t\t\t#W/m C, thermal conductivity of insulation\n",
    "hc = 4                  \t\t\t#W/m**2 C, heat transfer coefficient at cylindrical surface\n",
    "ht = 5.5                \t\t\t#W/m**2 C, heat transfer coefficient at flat surface\n",
    "l = h+t1+t2             \t\t\t#m, height of the top of insulation\n",
    "#fromm eq. 3.10\n",
    "#heat transfer resistance of cylindrical wall\n",
    "Rc = math.log(ro/ri)/(2*math.pi*l*ki)+1/(2*math.pi*ro*l*hc)\n",
    "#heat transfer resistance of flat insulated top surface\n",
    "Ri = (1/(math.pi*ro**2))*((ro-ri)/ki+1/ht)\n",
    "tdf = T1-Ta             \t\t\t#C, temp. driving force\n",
    "Q = tdf/Rc + tdf/Ri       \t\t\t#W, total rate of heat loss\n",
    "Tt = Q/(FR*cp)+T1        \t\t\t#C, inlet temp. of liquid\n",
    "print \"Inlet liquid temp. should be %.0f C \"%(Tt)\n",
    "Q1 = tdf/Ri   \t\t\t#W, rate of heat loss from flat surface\n",
    "T1 = Q1/(math.pi*ro**2*ht)+Ta    \n",
    "print \" the insulation skin temp. at the flat top surface is %.0f C \"%(T1)\n",
    "#similarly\n",
    "T2 = 38\n",
    "print \"similarly  the insulation skin temp at cylindrical surface is %.0f C\"%(T2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.7 Page No : 66"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the heat imput to the boiling.is 191.2 W\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "# Variables\n",
    "id_ = 2.5*10**-2              \t\t\t#m, internal diameter of glass tube\n",
    "t = 0.3*10**-2               \t\t\t#m, thickness of wall\n",
    "l = 2.5                     \t\t\t#m, length of nichrome wire\n",
    "L = 0.12                    \t\t\t#m, length of steel covered with heating coil\n",
    "Re = 16.7                   \t\t\t#ohm, electrical resistance\n",
    "ti = 2.5*10**-2              \t\t\t#m, thickness of layer of insulation\n",
    "kg = 1.4                    \t\t\t#W/m C, thermal conductivity of glass\n",
    "ki = 0.041                  \t\t\t#W/m C, thermal conductivity of insulation\n",
    "T1 = 91.                     \t\t\t#C, boiling temp. of liquid\n",
    "T2 = 27.                     \t\t\t#C, ambient temp.\n",
    "ho = 5.8                    \t\t\t#W/m **2 C outside air film coefficient\n",
    "V = 90.                      \t\t\t#V,  voltage\n",
    "\n",
    "#Calculation\n",
    "Rc = Re*l                   \t\t\t#ohm, resistance of heating coil\n",
    "Q = V**2/Rc                  \t\t\t#W, rate of heat generation\n",
    "ri = id_/2                   \t\t\t#m, inner radius of glass tube\n",
    "r_ = ri+t                   \t\t\t#m, outer radius of glass tube\n",
    "ro = r_+ti                   \t\t\t#m,outer radius of insulation\n",
    "#heat transfer resistance of glass wall\n",
    "Rg = math.log(r_/ri)/(2*math.pi*L*kg)\n",
    "#combined resistance of insulation and outer air film\n",
    "Rt = math.log(ro/r_)/(2*math.pi*L*ki)+1/(2*math.pi*ro*L*ho)\n",
    "#Rate of heat input to the boiling liquid in steel = Q1 = (Ts-T1)/Rg\n",
    "#Rate of heat loss through insulation ,Q2 = (Ts-To)/(Rt)\n",
    "#Q1+Q2 = Q\n",
    "Ts = (Q+ T1/Rg +T2/Rt)/(1/Rg +1/Rt)\n",
    "Q1 = (Ts-T1)/Rg\n",
    "Q2 = Q-Q1\n",
    "\n",
    "# Results\n",
    "print \"the heat imput to the boiling.is %.1f W\"%(Q1)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.8 Page No : 68"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "maximum allowable current is 54.04 A\n",
      "remp. at the centre of wire is 90.005 C\n",
      "The temprature at the outer surface of insulation is 80.3 C\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "# Variables\n",
    "ri = 1.3*10**-3            \t\t\t#m, radius of 10 gauge wire\n",
    "t = 1.3*10**-3             \t\t\t#m, thickness of rubber insulation\n",
    "Ti = 90.                   \t\t\t#C, temp. 0f insulation\n",
    "To = 30.                   \t\t\t#C, ambient temp.\n",
    "h = 15.                    \t\t\t#W/m**2 C, air film coefficient\n",
    "km = 380.                  \t\t\t#W/m C, thermal cond. of copper\n",
    "kc = 0.14                 \t\t\t#W/m C, thermal cond. of rubber(insulation)\n",
    "Rc = 0.422/100            \t\t\t#ohm/m, eletrical resistance of copper wire\n",
    "\n",
    "# Calculations and Results\n",
    "Tcmax = 90.                \t\t\t#X, the maximum temp. in insulation\n",
    "ro = ri+t                 \t\t\t#m, outside radius of 10 gauge wire\n",
    "Sv = ((Tcmax-To)*(2*kc/ri**2))/(math.log(ro/ri)+kc/(h*ro))\n",
    "I = (math.pi*ri**2*Sv/Rc)**0.5      \t\t\t#A, Current strength\n",
    "print \"maximum allowable current is %.2f A\"%(I)\n",
    "\n",
    "#(b) at r = 0\n",
    "Tm = To+(ri**2*Sv/2)*(1/km+(math.log(ro/ri))/kc+1/(h*ro))\n",
    "print \"remp. at the centre of wire is %.3f C\"%(Tm)\n",
    "\n",
    "#at r = ro\n",
    "Tc = 30+(ri**2*Sv/(2*kc))*(kc/(h*ro))\n",
    "print \"The temprature at the outer surface of insulation is %.1f C\"%(Tc)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.9 Page No : 72"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "At x = 0.1 the temp. at the surface of slab A  is 430 C\n",
      "At x = 0.35 the temp. at the surface of slab A  is 318 C\n",
      " the maximum Temp. in A occurs at  0.2045 m\n",
      " the maximum Temp. in A is 550.2 TAmax \n",
      "temp. gradient at interface 2 of the slabs A is 2300 C/W\n",
      "temp. gradient at interface 3 of the slabs A is -3200 C/W\n",
      "temp. gradient at interface 2 of the slabs B is 3450 C/W\n",
      "temp. gradient at interface 1 of the slabs B is 3450 C/W\n",
      "temp. gradient at interface 3 of the slabs C is -1600 C/W\n",
      "temp. gradient at interface 4 of the slabs C is -1600 C/W\n",
      "The  heat transfer coefficient at one surface of solid fluid interface is 766.7 W/m**2 C\n",
      "The  heat transfer coefficient at other surface of solid fluid interface is 1129 W/m**2 C\n"
     ]
    }
   ],
   "source": [
    "# Variables\n",
    "tA = 0.25          \t\t\t#m, thickness of slab A\n",
    "tB = 0.1           \t\t\t#m, thickness of slab B\n",
    "tC = 0.15          \t\t\t#m, thickness of slab C\n",
    "kA = 15.            \t\t\t#W/m C, thermal comductivity of slab A\n",
    "kB = 10.            \t\t\t#W/m C, thermal comductivity of slab B\n",
    "kC = 30.            \t\t\t#W/m C, thermal comductivity of slab C\n",
    "#Temprature distribution in slab A\n",
    "T1 = 40.            \t\t\t#C, fluid temp.\n",
    "T2 = 35.            \t\t\t#C, medium temp.\n",
    "\n",
    "# Calculations and Results\n",
    "#(a)\n",
    "x1 = tB           \n",
    "TA1 = 90.+4500*x1-11000*x1**2\n",
    "#similarly at the right surface\n",
    "x2 = tA+tB\n",
    "TA2 = 90.+4500*x2-11000*x2**2\n",
    "#let dTA/dx = D\n",
    "D = 0              \t\t\t#for maximum temp.\n",
    "x3 = 4500./22000\n",
    "TAmax = 90.+4500*x3-11000*x3**2\n",
    "print \"At x = 0.1 the temp. at the surface of slab A  is %.0f C\"%(TA1)\n",
    "print \"At x = 0.35 the temp. at the surface of slab A  is %.0f C\"%(TA2)\n",
    "print \" the maximum Temp. in A occurs at  %.4f m\"%(x3)\n",
    "print \" the maximum Temp. in A is %.1f TAmax \"%(TAmax)\n",
    "\n",
    "#(b)\n",
    "#At the interface 2\n",
    "D1 = 4500-2.*11000*x1       \t\t\t#C/W, D1 = dTA/dx, at x = 0.1\n",
    "#At the interface 3\n",
    "D2 = 4500-2.*11000*x2       \t\t\t#D12 = dTA/dx, at x = 0.35\n",
    "#Temprature gradient in slab B and C\n",
    "#by umath.sing the continuity of heat flux at interface (2)\n",
    "D3 = -kA*D1/(-kB)          \t\t\t#D3 = dTB/dx,  at x = 0.1\n",
    "#at interface (1)\n",
    "D4 = D3                    \t\t\t#D4 = dTB/dx  at x = 0\n",
    "#similarly \n",
    "D5 = -1600.                 \t\t\t#C/W, dTB/dx, x = 0.35\n",
    "D6 = D5                    \t\t\t#at interface 4\n",
    "print \"temp. gradient at interface 2 of the slabs A is %.0f C/W\"%(D1)\n",
    "print \"temp. gradient at interface 3 of the slabs A is %.0f C/W\"%(D2)\n",
    "print \"temp. gradient at interface 2 of the slabs B is %.0f C/W\"%(D3)\n",
    "print \"temp. gradient at interface 1 of the slabs B is %.0f C/W\"%(D4)\n",
    "print \"temp. gradient at interface 3 of the slabs C is %.0f C/W\"%(D5)\n",
    "print \"temp. gradient at interface 4 of the slabs C is %.0f C/W\"%(D6)\n",
    "\n",
    "#(c)\n",
    "#from D3 = 3450  and TB = beeta1*x+beeta2\n",
    "beeta1 = 3450.\n",
    "beeta2 = 85.\n",
    "x = 0.\n",
    "TB = beeta1*x+beeta2\n",
    "#similary\n",
    "TC = 877.5-1600*x\n",
    "h1 = -kB*D4/(T1-TB)\n",
    "#similarly\n",
    "h2 = 1129.\n",
    "print \"The  heat transfer coefficient at one surface of solid fluid interface is %.1f W/m**2 C\"%(h1)\n",
    "print \"The  heat transfer coefficient at other surface of solid fluid interface is %.0f W/m**2 C\"%(h2)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.10 Page No : 79"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the percentage increase in the rate of heat transfer is 103.6 percent \n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "# Variables\n",
    "id_ = 78.*10**-3       \t\t\t#m, actual internal dia of pipe\n",
    "tw = 5.5*10**-3      \t\t\t#m, wall thickness\n",
    "nl = 8.              \t\t\t#no. of longitudinal fins\n",
    "tf = 1.5*10**-3      \t\t\t#m, thickness of fin\n",
    "w = 30.*10**-3        \t\t\t#m,breadth of fin\n",
    "kf = 45.             \t\t\t#W/m C, thermal conductivity of fin \n",
    "Tw = 150.            \t\t\t#C, wall temp.\n",
    "To = 28.             \t\t\t#C, ambient temp.\n",
    "h = 75.              \t\t\t#W/m**2C, surface heat transfer coefficient\n",
    "\n",
    "#Calculation\n",
    "#from eq. 3.27\n",
    "e = math.sqrt(2*h/(kf*tf))    \n",
    "n = (1./(e*w))*math.tanh(e*w)  \t\t\t#efficiency of fin\n",
    "L = 1.              \t\t\t#m, length of fin\n",
    "Af = 2.*L*w         \t\t\t#m**2, area of  math.single fin\n",
    "Atf = nl*Af          \t\t\t#m**2 total area of fin\n",
    "Qmax = h*Atf*(Tw-To)   \t\t\t#W, maximum rate of heat transfer\n",
    "Qa = n*Qmax           \t\t\t#W, actual rate of heat transfer\n",
    "Afw = L*tf            \t\t\t#m**2, area of contact of fin with pipe wall\n",
    "Atfw = Afw*nl         \t\t\t#m**2 , area of contact of all fin with pipe wall\n",
    "ro = id_/2+tw          \t\t\t#m, outer  pipe radius\n",
    "A = 2*math.pi*L*ro        \t\t\t#m**2  area per meter\n",
    "Afree = A-Atfw        \t\t\t#m**2, free outside area of finned pipe\n",
    "#Rate of heat transfer from free area of pipe wall\n",
    "Q1 = h*Afree*(Tw-To)  \t\t\t#W, \n",
    "#total rate of hewat gtransfer from finned pipe\n",
    "Qtotal = Qa+Q1        \t\t\t#W\n",
    "#Rate of heat transfer fromm unfinned pipe\n",
    "Q2 = h*A*(Tw-To)\n",
    "per = (Qtotal-Q2)/Q2\n",
    "\n",
    "# Results\n",
    "print \"the percentage increase in the rate of heat transfer is %.1f percent \"%(per*100)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.11 Page No : 80"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Rate of heat transfer in the absence of contact resistance is 11.585 KW\n",
      "The actual rate of heat loss is 5.18kW is much less than this value. So there is a thermal contact resistance at the interface between the layers \n",
      "The contact resistance is 0.001067 C/W \n",
      "contact heat transfer coefficient is 298.2 W/m**2 C \n",
      "The temprature jump is 5.5 C\n"
     ]
    }
   ],
   "source": [
    "import math\n",
    "\n",
    "# Variables\n",
    "id_ = 90.*10**-2       \t\t\t#m, internal diameter of steel\n",
    "od = 110.*10**-2      \t\t\t#m, outer diameter of steel\n",
    "Ti = 180.            \t\t\t#C, inside temp. of steel\n",
    "To = 170.            \t\t\t#C, outside temp. of steel\n",
    "k = 37.             \t\t\t#W/m C, thermal conductivity of alloy\n",
    "Q = 5.18*10**3       \t\t\t#W, Rate of heat loss\n",
    "\n",
    "# Calculations and Results\n",
    "ri = id_/2           \t\t\t#m, inside radius of shell\n",
    "ro = od/2           \t\t\t#m, outside radius of shell\n",
    "r_ = 0.5            \t\t\t#m, boundary between the layers\n",
    "L = 1               \t\t\t#m, length of shell\n",
    "#Rate of heat transfer in the absence of contact resistance\n",
    "Q1 = 2*math.pi*L*k*(Ti-To)/(math.log(ro/ri))             \n",
    "print \"Rate of heat transfer in the absence of contact resistance is %.3f KW\"%(Q1/1000)\n",
    "print \"The actual rate of heat loss is 5.18kW is much less than this value\\\n",
    ". So there is a thermal contact resistance at the interface between the layers \"\n",
    "\n",
    "#(b)\n",
    "Ri = (math.log(r_/ri)/(2*math.pi*L*k))  \t\t\t#C/W, resistance of inner layer\n",
    "Ro = (math.log(ro/r_)/(2*math.pi*L*k))  \t\t\t#C/W, resistance of outer layer\n",
    "Rc = ((Ti-To)/(Q))-(Ri+Ro)     \t\t\t#C/W, contact resistance\n",
    "print \"The contact resistance is %f C/W \"%(Rc)\n",
    "Ac = 2*math.pi*L*r_                \t\t\t#m**2, area of contact surface of shell\n",
    "hc = 1/(Ac*Rc)                 \t\t\t    #W/m**2 c, contact heat transfer coefficient\n",
    "print \"contact heat transfer coefficient is %.1f W/m**2 C \"%(hc)\n",
    "\n",
    "#(c)\n",
    "dt = Q/(hc*Ac)\n",
    "print \"The temprature jump is %.1f C\"%(dt)\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.12 Page No : 84"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "the critical thickness is 35.29 mm\n"
     ]
    }
   ],
   "source": [
    "# Variables\n",
    "d = 5.2*10**-3       \t\t\t#m, diameter of copper wire\n",
    "ri = d/2            \t\t\t#inner radius of insulation\n",
    "kc = 0.43           \t\t\t#W/m C, thermal conductivity of PVC\n",
    "Tw = 60.             \t\t\t#C, temp. 0f wire\n",
    "h = 11.35           \t\t\t#W/m**2 C, film coefficient\n",
    "To = 21.             \t\t\t#C, ambient temp.\n",
    "\n",
    "#calculation\n",
    "Ro = kc/h           \t\t\t#m,critical outer radius of insulation\n",
    "t = Ro-ri\n",
    "\n",
    "# Results\n",
    "print \"the critical thickness is %.2f mm\"%(t*10**3)\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.13 Page No : 85"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ro =  3.5 cm \n",
      "Radius of bare pipe is larger than outer radius of insulation  So critical   insulation thickness does not exist \n"
     ]
    }
   ],
   "source": [
    "# calculate the critical  insulation thickness.\n",
    "\n",
    "# Variables\n",
    "d = 15.*10**-2        \t\t\t#m, length of steam main\n",
    "t = 10.*10**-2        \t\t\t#m, thickness  of insulation\n",
    "ki = 0.035          \t\t\t#W/m C, thermal conductivity of insulation\n",
    "h = 10.              \t\t\t#W/m**2 C, heat transfer coefficient\n",
    "\n",
    "#calculation\n",
    "#from eq. 3.29\n",
    "ro = ki/h\n",
    "\n",
    "# Results\n",
    "print \"ro =  %.1f cm \"%(ro*10**3)\n",
    "print \"Radius of bare pipe is larger than outer radius of insulation  So critical \\\n",
    "  insulation thickness does not exist \"\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Example 3.14 Page No : 87"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "The optimum insulation thickness is 71 mm\n"
     ]
    }
   ],
   "source": [
    "from scipy.optimize import fsolve\n",
    "import math\n",
    "\n",
    "# Variables\n",
    "Ti = 172.           \t\t\t#C, saturation temp.\n",
    "To = 20.            \t\t\t#C, ambient temp.\n",
    "Cs = 700.           \t\t\t#per ton, math.cost of steam\n",
    "Lv = 487.           \t\t\t#kcal/kg, latent heat of steam\n",
    "ho = 10.32           \t\t\t#kcal/h m**2 C, outer heat transfer coefficient\n",
    "kc = 0.031             \t\t\t#W/m C, thermal conductivity of insulation\n",
    "n = 5.              \t\t\t#yr, service life of insulation\n",
    "i = 0.18            \t\t\t#Re/(yr)(Re), interest rate\n",
    "\n",
    "#Calculation\n",
    "di = 0.168           \t\t\t#m, inner diameter of insulation\n",
    "#Cost of insulation\n",
    "Ci = 17360.-(1.91*10**4)*di         \t\t\t#Rs/m**3\n",
    "Ch = Cs/(1000*Lv)                 \t\t\t#Rs/cal, math.cost of heat energy in steam\n",
    "sm = 1./(1+i)+1/(1+i)**2+1/(1+i)**3+1/(1+i)**4+1/(1+i)**n\n",
    "#from eq. 3.33\n",
    "ri = di/2         \t\t\t#m  inner radius of insulation\n",
    "L = 1             \t\t\t#m, length of pipe\n",
    "#Pt = Ch*sm*2*math.pi*ri*L*( 1/(((ri/kc)*('math.log(ro/ri)'))+ri/(ho*ro)))*7.2*10**3*(Ti-To)+math.pi*(ro**2-ri**2)*L*Ci\n",
    "#On differentiating , dpt/dro = -957.7*((1/ro)-(0.003/ro**2))/(math.log(ro)+(0.003/ro)+2.477)**2\n",
    "def f(ro): \n",
    "    return -957.7*((1/ro)-(0.003/ro**2))/(math.log(ro)+(0.003/ro)+2.477)**2+98960*ro\n",
    "ro = fsolve(f,0.1)\n",
    "t = ro-ri\n",
    "\n",
    "# Results\n",
    "print \"The optimum insulation thickness is %.0f mm\"%(t*1000)\n"
   ]
  }
 ],
 "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
}