summaryrefslogtreecommitdiff
path: root/Introduction_to_Heat_Transfer_by_S._K._Som/Chapter7.ipynb
blob: 85b7eec5a869709dbd18128445416c05bf035b86 (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
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "# Chapter 07:Principles of forced convection"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.1:pg-296"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 1\n",
      "First we check from reynolds no. that the flow is laminar or tubulent\n",
      "Reynold number is\n",
      "Re= 20000.0\n",
      "which is less than critical reynolds number,So the flow is laminar.\n",
      "The average nusselt number over the entire length under the situation is given by NuL=0.664*Re**0.5*Pr**(1/3)\n",
      "NuL= 93.9037805416\n",
      "Heat flux in W/(m**2*K) is\n",
      "h= 2.72320963571\n",
      "The rate of heat transfer per unit width in W is\n",
      "Q= 408.481445356\n"
     ]
    }
   ],
   "source": [
    " \n",
    "import math \n",
    " \n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 1\"\n",
    "#Engine oil at temprature,Tinf=60°C with a velocity of Uinf=1m/s flows over plate of length(L)=5m whose temprature(Tw)=30°C\n",
    "Tw=30;\n",
    "L=5;\n",
    "Uinf=1;\n",
    "Tinf=60;\n",
    "#The properties at a film temprature of 45°C are as follows density(rho=870kg/m**3),Prandtl number(Pr=2850),conductivity(k=0.145W/(m*°C)),kinematic viscosity(nu=250*10**-6m**2/s).\n",
    "rho=870;\n",
    "Pr=2850;\n",
    "k=0.145;\n",
    "nu=250*10**-6;\n",
    "print\"First we check from reynolds no. that the flow is laminar or tubulent\"\n",
    "#Reynolds number is given by Re=(Uinf*L)/nu\n",
    "print\"Reynold number is\"\n",
    "Re=(Uinf*L)/nu\n",
    "print\"Re=\",Re\n",
    "print\"which is less than critical reynolds number,So the flow is laminar.\"\n",
    "#NuL is the average nusselt number\n",
    "print\"The average nusselt number over the entire length under the situation is given by NuL=0.664*Re**0.5*Pr**(1/3)\"\n",
    "NuL=0.664*Re**0.5*Pr**(1/3)\n",
    "print\"NuL=\",NuL\n",
    "#Heat flux is given by h=(k/L)*NuL\n",
    "print\"Heat flux in W/(m**2*K) is\"\n",
    "h=(k/L)*NuL\n",
    "print\"h=\",h\n",
    "#The rate of heat transfer per unit width is Q=h*A*(Tinf-Tw)\n",
    "#Since unit width is considerd so B=1\n",
    "#Area(A)=L*B\n",
    "B=1;\n",
    "A=L*B;\n",
    "print\"The rate of heat transfer per unit width in W is\"\n",
    "Q=h*A*(Tinf-Tw)\n",
    "print\"Q=\",Q"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.2:pg-298"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 2\n",
      "The location x in m where the transition occurs\n",
      "x= 0.275\n",
      "The average Nusselt number for the laminar zone is\n",
      "Nux= 469.518902708\n",
      "Heat flux in W/(m**2*K) is\n",
      "h= 44.3908780742\n",
      "The reynolds number at L=2m is\n",
      "ReL= 3636363.63636\n",
      "The average heat transfer coefficient over L=2m in W/(m**2*K)\n",
      "hbarL= -11.322519\n",
      "The rate of heat transfer per unit width in W is\n",
      "Q= -2264.5038\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    " \n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 2\"\n",
    "#Atmospheric air at temprature,Tinf=300K and with a free stream Velocity Uinf=30m/s flows over a flat plate parallel to a side of length(L)=2m.\n",
    "Tinf=300;\n",
    "Uinf=30;\n",
    "L=2;\n",
    "#It is maintained at a uniform temprature of Tw=400K.\n",
    "Tw=400;\n",
    "#The properties of air at the film temprature of 350K are Prandtl number(Pr=0.705),conductivity(k=0.026W/(m*°C)),kinematic viscosity(nu=16.5*10**-6m**2/s)\n",
    "Pr=0.705; \n",
    "k=0.026;\n",
    "nu=16.5*10**-6;\n",
    "#We first find the location x(for reynolds number,Re=5*10**5) where the transition occurs\n",
    "#Rex is reynolds number\n",
    "print\"The location x in m where the transition occurs\"\n",
    "Rex=5*10**5;\n",
    "x=(nu*Rex)/Uinf\n",
    "print\"x=\",x\n",
    "#The average Nusselt number for the laminar zone is given by Nux=0.664*Re**0.5*Pr**(1/3)\n",
    "print\"The average Nusselt number for the laminar zone is\"\n",
    "Nux=0.664*Rex**0.5*Pr**(1/3)\n",
    "print\"Nux=\",Nux\n",
    "#Heat flux is given by h=(k/x)*Nux\n",
    "print\"Heat flux in W/(m**2*K) is\"\n",
    "h=(k/x)*Nux\n",
    "print\"h=\",h\n",
    "#Reynolds number is given by ReL=(Uinf*L)/nu\n",
    "print\"The reynolds number at L=2m is\"\n",
    "ReL=(Uinf*L)/nu\n",
    "print\"ReL=\",ReL\n",
    "#The average heat transfer coefficient over L=2m is determined from hbarL=(k/L)*(0.037*(ReL)**(4/5)-871)*Pr**(1/3)\n",
    "print\"The average heat transfer coefficient over L=2m in W/(m**2*K)\"\n",
    "hbarL=(k/L)*(0.037*(ReL)**(4/5)-871)*Pr**(1/3)\n",
    "print\"hbarL=\",hbarL\n",
    "#The rate of heat transfer per unit width is Q=h*A*(Tinf-Tw)\n",
    "#Since unit width is considerd so B=1\n",
    "#Area(A)=L*B\n",
    "B=1;\n",
    "A=L*B;\n",
    "print\"The rate of heat transfer per unit width in W is\"\n",
    "Q=hbarL*A*(Tw-Tinf)\n",
    "print\"Q=\",Q\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.3:pg-314"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 3\n",
      "(a)When the air flows parallel to the long side we have L=5 and the Reynolds no. becomes\n",
      "ReL= 1250000.0\n",
      "which is greater than critical Reynolds number.\n",
      "The average heat transfer coefficient over L=5m in W/(m**2*K)\n",
      "hbarL= -5.225778\n",
      "The rate of heat transfer per unit width in W is\n",
      "Q= -3135.4668\n",
      "(b)When the air flow is parallel to the 1m side we have L=1 an the Reynolds no. becomes \n",
      "which is less than critical Reynolds number.\n",
      "ReL= 250000.0\n",
      "Heat flux in W/(m**2*K) is\n",
      "h= 9.96\n",
      "The rate of heat transfer per unit width in W is\n",
      "Q= 5976.0\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    " \n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 3\"\n",
    "#Air at a pressure of 101kPa and temprature,Tinf=20°C flows with a velocity(Uinf) of 5m/s over a flat plate whose temprature is kept constant at Tw=140°C.\n",
    "Tw=140;\n",
    "Tinf=20;\n",
    "Uinf=5;\n",
    "#The properties at the film temprature of 80°C are Prandtl number(Pr=0.706),Conductivity(k=0.03W/(m*°C)),kinematic viscosity(nu=2*10**-5m**2/s)\n",
    "Pr=0.706;\n",
    "k=0.03;\n",
    "nu=2*10**-5;\n",
    "#ReL is reynolds number and L is length of flat plate\n",
    "print\"(a)When the air flows parallel to the long side we have L=5 and the Reynolds no. becomes\"\n",
    "L=5;\n",
    "ReL=(Uinf*L)/nu\n",
    "print\"ReL=\",ReL\n",
    "print\"which is greater than critical Reynolds number.\"\n",
    "#Thus we have combined laminar and tubulent flow.\n",
    "# So The average heat transfer coefficient over L=5m is determined from hbarL=(k/L)*(0.037*(ReL)**(4/5)-871)*Pr**(1/3)\n",
    "print\"The average heat transfer coefficient over L=5m in W/(m**2*K)\"\n",
    "hbarL=(k/L)*(0.037*(ReL)**(4/5)-871)*Pr**(1/3)\n",
    "print\"hbarL=\",hbarL\n",
    "#The rate of heat transfer per unit width is Q=h*A*(Tinf-Tw)\n",
    "#Since width is 1m so B=1\n",
    "#Area(A)=L*B\n",
    "B=1;\n",
    "A=L*B;\n",
    "#Q is the rate of heat transfer\n",
    "print\"The rate of heat transfer per unit width in W is\"\n",
    "Q=hbarL*A*(Tw-Tinf)\n",
    "print\"Q=\",Q\n",
    "#When the air flow is parallel to the 1m side we have L=1\n",
    "print\"(b)When the air flow is parallel to the 1m side we have L=1 an the Reynolds no. becomes \"\n",
    "L=1;\n",
    "ReL=(Uinf*L)/nu\n",
    "print\"which is less than critical Reynolds number.\"\n",
    "print\"ReL=\",ReL\n",
    "#Thus we have laminar flow\n",
    "#Heat flux is given by h=(k/L)*0.664*ReL**0.5*Pr**(1/3)\n",
    "print\"Heat flux in W/(m**2*K) is\"\n",
    "h=(k/L)*0.664*ReL**0.5*Pr**(1/3)\n",
    "print\"h=\",h\n",
    "#The rate of heat transfer per unit width is Q=h*A*(Tinf-Tw)\n",
    "#Now width is 5m so B=5\n",
    "#Area(A)=L*B\n",
    "B=5;\n",
    "A=L*B;\n",
    "#Q is the rate of heat transfer\n",
    "print\"The rate of heat transfer per unit width in W is\"\n",
    "Q=h*A*(Tw-Tinf)\n",
    "print\"Q=\",Q\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.4:pg-322"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 4\n",
      "(a)Reynolds number is\n",
      "ReL= 6000.0\n",
      "The boundary layer thickness in m is\n",
      "delta= 0.387298334621\n",
      "Prandtl no. is\n",
      "Pr= 831.024930748\n",
      "The thermal boundary layer thickness in m is\n",
      "deltaT= 0.387298334621\n",
      "(b)Since the prandtl number is high So Nusselt no. is\n",
      "NuL= 26.2588270873\n",
      "Heat flux in W/(m**2*K) is\n",
      "hL= 0.919058948055\n",
      "hbarL in W/(m**2*K) is\n",
      "hbarL= 1.83811789611\n",
      "(c)The rate of heat transfer in W is\n",
      "Q= 661.7224426\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    " \n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 4\"\n",
    "#Castor oil at temprature,Tinf=36°C flows over a heated plate of length,L=6m and breadth,B=1m at velocity,Uinf=0.06m/s\n",
    "Tinf=36;\n",
    "L=6;\n",
    "B=1;\n",
    "Uinf=0.06;\n",
    "#For a surface temprature at Tw=96°C\n",
    "Tw=96;\n",
    "#The properties at film temprature 66°C conductivity(k=0.21W/(m*K)),kinematic viscosity(nu=6*10**-5m**2/s),Thermal diffusivity(alpha=7.22*10**-8 m**2/s)\n",
    "nu=6*10**-5;\n",
    "k=0.21;\n",
    "alpha=7.22*10**-8;\n",
    "#ReL is reynolds number\n",
    "print\"(a)Reynolds number is\"\n",
    "ReL=(Uinf*L)/nu\n",
    "print\"ReL=\",ReL\n",
    "#Therefore the boundary layer is laminar over the entire plate.\n",
    "#delta is the boundary layer thickness\n",
    "print\"The boundary layer thickness in m is\"\n",
    "delta=(5*L)/(ReL)**0.5\n",
    "print\"delta=\",delta\n",
    "#Pr is prandtl number.\n",
    "print\"Prandtl no. is\"\n",
    "Pr=nu/alpha\n",
    "print\"Pr=\",Pr\n",
    "#deltaT is thermal boundary layer thickness\n",
    "print\"The thermal boundary layer thickness in m is\"\n",
    "deltaT=delta/(Pr**(1/3))#NOTE:Answer in the book is incorrect(calculation mistake)\n",
    "print\"deltaT=\",deltaT\n",
    "#NuL is the nusselt number\n",
    "print\"(b)Since the prandtl number is high So Nusselt no. is\"\n",
    "NuL=0.339*(ReL)**0.5*Pr**(1/3)\n",
    "print\"NuL=\",NuL\n",
    "#Heat flux is given by hL=(k/L)*NuL\n",
    "print\"Heat flux in W/(m**2*K) is\"\n",
    "hL=(k/L)*NuL\n",
    "print\"hL=\",hL\n",
    "#hbarL is the average heat flux over length L\n",
    "print\"hbarL in W/(m**2*K) is\"\n",
    "hbarL=2*hL\n",
    "print\"hbarL=\",hbarL\n",
    "#The rate of heat transfer is Q=h*A*(Tinf-Tw)\n",
    "#Area(A)=L*B\n",
    "A=L*B;\n",
    "print\"(c)The rate of heat transfer in W is\"\n",
    "Q=hbarL*A*(Tw-Tinf)\n",
    "print\"Q=\",Q\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.5:pg-322"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 5\n",
      "Reynolds number is\n",
      "ReL= 11181.8181818\n",
      "Therefore the flow is turbulent over the module \n",
      "The local heat transfer coefficient at L in W/(m**2*K)is\n",
      "hL= 8.32911955901e+30\n",
      "The required power generation in W/m**3 is\n",
      "qm= 1.6658239118e+31\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    " \n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 5\"\n",
    "#A flat plate of width B=1m is maintained at a uniform surface temprtaure(Tw)=225°C\n",
    "Tw=225;\n",
    "B=1;\n",
    "#Heating is done by rectangular modules of thickness t=10mm and length l=40mm.\n",
    "t=10;\n",
    "l=40;\n",
    "#atmospheric air at temprature,Tinf=25°C flows over the plate at velocity(Uinf)=30m/s.\n",
    "Tinf=25;\n",
    "Uinf=30;\n",
    "#The thermophysical properties of module are conductivity(km=5.2W/(m*K)),specific heat(cp=320J/(kg/K)),density(rho=2300kg/m**3).\n",
    "km=5.2;\n",
    "cp=320;\n",
    "rho=2300;\n",
    "#Assume the air properties at the film temprature of 125°C conductivity(ka=0.031W/(m*K)),kinematic viscosity(nu=22*10**-6m**2/s),Prandtl number(Pr=0.7)\n",
    "ka=0.031;\n",
    "nu=22*10**-6;\n",
    "Pr=0.7;\n",
    "#Module is placed at a distance of 800mm from the leading edge\n",
    "#The distance from leading edge to the centre-line of the module,L=800+20=820mm.\n",
    "L=0.0082;#in metre\n",
    "#ReL is the reynolds number \n",
    "print\"Reynolds number is\"\n",
    "ReL=(Uinf*L)/nu\n",
    "print\"ReL=\",ReL\n",
    "print\"Therefore the flow is turbulent over the module \"\n",
    "#The local heat transfer coefficient at L is calculated using hL=(k/L)*0.0296*(ReL)**(4/5)*(Pr)**(1/3)\n",
    "print\"The local heat transfer coefficient at L in W/(m**2*K)is\"\n",
    "hL=(ka/L)*0.0296*(ReL)**(4/0.5)*(Pr)**(1/0.3)\n",
    "print\"hL=\",hL\n",
    "#We consider that the local heat transfer coefficient at L=0.82m remains the same over the module which extends from L=0.80m to 0.84m \n",
    "#If qm be the power generation in W/m**2 within the module ,we can write from energy balance qm*(t/0.1000)*(l/0.1000)*(B)=hbarL*(t/0.1000)*(B)*(Tw-Tinf)\n",
    "print\"The required power generation in W/m**3 is\"\n",
    "qm=(hL*(l/0.1000)*(B)*(Tw-Tinf))/((t/0.1000)*(l/0.1000)*(B))\n",
    "print\"qm=\",qm\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.6:pg-327"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 6\n",
      "Reynolds number is\n",
      "ReL= 15000000.0\n",
      "Since ReL>Rec(=5*10**5) the flow is approximated as turbulent over the entire surface of the wing \n",
      "Nux= 0.0308\n",
      "Nusselt number is \n",
      "NubarL= 0.0308\n",
      "Average heat transfer coefficient in W/(m**2*K) is\n",
      "hbarL= 0.0003696\n",
      "Surface temprature of wing in kelvin is\n",
      "Tw= 1217800.46753\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    "\n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 6\"\n",
    "#An aircraft is moving at a velocity of Uinf=150m/s in air at an altitude where the pressure is 0.7bar and the temprature is Tinf=-5°C.\n",
    "Tinf=-5;\n",
    "Uinf=150;\n",
    "#The top surface of the wing absorbs solar radiation at a rate of Qr=900W/m**2.\n",
    "Qr=900;\n",
    "#Considering the wing as a flat plate of length(L)=2m and to be of solid construction with a single uniform surface temprature .\n",
    "L=2;\n",
    "#The properties of air at 268K and 0.7 bar are conductivity(k=0.024W/(m*K)),kinematic viscosity(nu=2*10**-5m**2/s),Prandtl number(Pr=0.72)\n",
    "k=0.024;\n",
    "nu=2*10**-5;\n",
    "Pr=0.72;\n",
    "#ReL is reynolds number\n",
    "print\"Reynolds number is\"\n",
    "ReL=Uinf*L/nu\n",
    "print\"ReL=\",ReL\n",
    "#Rec is critical reynolds number\n",
    "print\"Since ReL>Rec(=5*10**5) the flow is approximated as turbulent over the entire surface of the wing \"\n",
    "#Nusselt number is given by Nux=0.0308*ReL**(4/5)*Pr**(1/3)\n",
    "Nux=0.0308*ReL**(4/5)*Pr**(1/3);\n",
    "print\"Nux=\",Nux\n",
    "#NubarL is average nusselt number over length L\n",
    "print\"Nusselt number is \"\n",
    "NubarL=(5/4)*Nux\n",
    "print\"NubarL=\",NubarL\n",
    "#Average heat transfer coefficient is given by hbarL=(k/L)*NubarL\n",
    "print\"Average heat transfer coefficient in W/(m**2*K) is\"\n",
    "hbarL=(k/L)*NubarL\n",
    "print\"hbarL=\",hbarL\n",
    "#From an energy balance the airfoil at steady state,Qr*As=2*hbarL*As*(Tw-Tinf) where Qr=radiation flux,As=upper or lower surface area.\n",
    "#Therefore we can write Surface temprature of wing, Tw=Tinf+(Qr/(2*hbarL))\n",
    "print\"Surface temprature of wing in kelvin is\"\n",
    "Tw=(273+Tinf)+(Qr/(2*hbarL))\n",
    "print\"Tw=\",Tw\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.7:pg-331"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 7\n",
      "Reynolds number is\n",
      "Re= 141.176470588\n",
      "Nusselt number is\n",
      "NuD= 6.85819682626\n",
      "The average Heat transfer coefficient in W/(m**2*K) is\n",
      "hbar= 4629.28285773\n",
      "Heat transfer per unit length in W/m is\n",
      "qL= 14.5433210172\n",
      "If we use eq NuD=0.3+((0.62*Re**0.5*Pr**(1/3))/(1+(0.4/Pr**(2/3))**(1/4))*(1+(Re/282000)**(5/8))**(4/5)\n",
      "NuD= 7.66669771975\n",
      "The average Heat transfer coefficient in W/(m**2*K) is\n",
      "hbar= 5175.02096083\n",
      "Heat transfer per unit length in W/m is\n",
      "qL= 16.2578078327\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    " \n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 7\"\n",
    "#A fine wire having a diameter(D)=0.04mm is placed in an air stream at temprature,Tinf=25°C having a flow velocity of Uinf=60m/s perpendicular to wire.\n",
    "D=0.04;\n",
    "Tinf=25;\n",
    "Uinf=60;\n",
    "#An electric current is passed through the wire ,raising its surface temprature to Tw=50°C\n",
    "Tw=50;\n",
    "#For air at the film temprature of 37.5°C,conductivity(k=0.027 W/(m*K)),kinematic viscosity(nu=17*10**-6m**2/s) and Prandtl number(Pr=0.71)\n",
    "k=0.027;\n",
    "nu=17*10**-6;\n",
    "Pr=0.71;\n",
    "#Re is reynolds number\n",
    "print\"Reynolds number is\"\n",
    "Re=Uinf*(D*10**-3)/nu\n",
    "print\"Re=\",Re\n",
    "#C and n are constants\n",
    "#The values of C and n are found  for Re=141 are C=0.683 and n=0.466\n",
    "#NuD is nusselt number\n",
    "print\"Nusselt number is\"\n",
    "NuD=(0.683)*Re**0.466*Pr**(1/3)\n",
    "print\"NuD=\",NuD\n",
    "#hbar is the average Heat transfer coefficient\n",
    "print\"The average Heat transfer coefficient in W/(m**2*K) is\"\n",
    "hbar=(k/(D*10**-3))*NuD\n",
    "print\"hbar=\",hbar\n",
    "#Heat transfer per unit length(qL) is given by pi*D*hbar*(Tw-Tinf)\n",
    "print\"Heat transfer per unit length in W/m is\"\n",
    "qL=math.pi*(D*10**-3)*hbar*(Tw-Tinf)\n",
    "print\"qL=\",qL\n",
    "#NuD is nusselt number\n",
    "print\"If we use eq NuD=0.3+((0.62*Re**0.5*Pr**(1/3))/(1+(0.4/Pr**(2/3))**(1/4))*(1+(Re/282000)**(5/8))**(4/5)\"\n",
    "NuD=0.3+((0.62*Re**0.5*Pr**(1/3))/(1+(0.4/Pr)**(2/3))**(1/4))*(1+(Re/282000)**(5/8))**(4/5)\n",
    "print\"NuD=\",NuD\n",
    "#hbar is the average Heat transfer coefficient\n",
    "print\"The average Heat transfer coefficient in W/(m**2*K) is\"\n",
    "hbar=(k/(D*10**-3))*NuD\n",
    "print\"hbar=\",hbar\n",
    "#Heat transfer per unit length(qL) is given by pi*D*hbar*(Tw-Tinf)\n",
    "print\"Heat transfer per unit length in W/m is\"\n",
    "qL=math.pi*(D*10**-3)*hbar*(Tw-Tinf)\n",
    "print\"qL=\",qL\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.8:pg-334"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 8\n",
      "Reynolds number for mercury is\n",
      "ReHg= 1000.0\n",
      "Reynolds number for oil is\n",
      "Reoil= 15.3846153846\n",
      "The hydrodynamic entry length for mercury in m is\n",
      "LeHg= 1.25\n",
      "The hydrodynamic entry length for oil in m is\n",
      "Leoil= 0.0192307692308\n",
      "The thermal entry length for mercury in m is \n",
      "LtHg= 0.02375\n",
      "The thermal entry length for oil in m is\n",
      "Ltoil= 1.63461538462\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    "\n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 8\"\n",
    "#Mercury and a light oil flowing at Uinf=4mm/s in a smooth tube having diameter(D)=25mm at a bulk temprature of 80°C.\n",
    "Uinf=4*10**-3;#in metre\n",
    "D=25*10**-3;#in metre\n",
    "#The pertinent properties of the fluid at that temprature are kinematic viscosity of mercury(nuHg=1*10**-7m**2/s),kinematic viscosity of oil(nuoil=6.5*10**-6m**2/s)\n",
    "#Prandtl number of mercury(PrHg=0.019),Prandtl number of oil(Proil=85).\n",
    "nuHg=1*10**-7;\n",
    "nuoil=6.5*10**-6;\n",
    "PrHg=0.019;\n",
    "Proil=85;\n",
    "#ReHg is Reynolds number for mercury\n",
    "print\"Reynolds number for mercury is\"\n",
    "ReHg=Uinf*D/nuHg\n",
    "print\"ReHg=\",ReHg\n",
    "#Reoil is Reynolds number for oil\n",
    "print\"Reynolds number for oil is\"\n",
    "Reoil=Uinf*D/nuoil\n",
    "print\"Reoil=\",Reoil\n",
    "#The hydrodynamic length are given by L=0.05*Re*D\n",
    "#LeHg is the hydrodynamic entry length for mercury\n",
    "print\"The hydrodynamic entry length for mercury in m is\"\n",
    "LeHg=0.05*ReHg*D\n",
    "print\"LeHg=\",LeHg\n",
    "#Leoil the hydrodynamic entry length for oil\n",
    "print\"The hydrodynamic entry length for oil in m is\"\n",
    "Leoil=0.05*Reoil*D\n",
    "print\"Leoil=\",Leoil\n",
    "#The thermal entry length are given by L=0.05*Re*Pr*D\n",
    "#LtHg is the thermal entry length for mercury\n",
    "print\"The thermal entry length for mercury in m is \"\n",
    "LtHg=0.05*ReHg*PrHg*D\n",
    "print\"LtHg=\",LtHg\n",
    "#Ltoil is the thermal entry length for oil\n",
    "print\"The thermal entry length for oil in m is\"\n",
    "Ltoil=0.05*Reoil*Proil*D\n",
    "print\"Ltoil=\",Ltoil\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.9:pg-336"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 9\n",
      "Reynold number is\n",
      "Re= 348.623853211\n",
      "Therefore the flow is laminar.The hydrodynamic entrance length in m is\n",
      "Leh= 0.0697247706422\n",
      "The thermal entrance length in m is\n",
      "Let= 0.0488073394495\n",
      "The heat transfer coefficient in W/(m**2*K) is \n",
      "h= 32.7\n",
      "The mass flow rate of air in kg/s is\n",
      "mdot= 2.38761041673e-05\n",
      "Therefore the constant surface heat flux qw in W/m**2 is\n",
      "qw= 95.95\n",
      "The tube surface temprature at the exit plane in °C is \n",
      "Twe= 127.934250765\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    " \n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 9\"\n",
    "#Air at one atmospheric pressure and temprature(Tbi=75°C) enters a tube of internal diameter(D)=4.0mm with average velocity(U)=2m/s\n",
    "Tbi=75;\n",
    "D=4*10**-3;#in metre\n",
    "U=2;\n",
    "#The tube length is L=1.0m and a constant heat flux is imposed by the tube surface on the air over the entire length.\n",
    "L=1;\n",
    "#An exit bulk mean temprature(Tbo)=125°C is required.\n",
    "Tbo=125;\n",
    "#The properties of air 100°C are density(rho=0.95kg/m**3),Prandtl number(Pr=0.70),conductivity(k=0.03W/(m*K)),viscosity(mu=2.18*10**-5kg/(m*s)),specific heat(cp=1.01kJ/(kg/K))\n",
    "rho=0.95;\n",
    "Pr=0.70;\n",
    "k=0.03;\n",
    "mu=2.18*10**-5;\n",
    "cp=1.01*10**3;\n",
    "#Re is reynolds number\n",
    "print\"Reynold number is\"\n",
    "Re=rho*U*D/mu\n",
    "print\"Re=\",Re\n",
    "#Leh is the hydrodynamic entrance length\n",
    "print\"Therefore the flow is laminar.The hydrodynamic entrance length in m is\"\n",
    "Leh=0.05*Re*D\n",
    "print\"Leh=\",Leh\n",
    "#Let is the thermal entrance length\n",
    "print\"The thermal entrance length in m is\"\n",
    "Let=0.05*Re*Pr*D\n",
    "print\"Let=\",Let\n",
    "#The length of tube is given as 1m.A reasonable approach is to consider the flow to be fully developed for both velocity and tempratures over the entire profile lengths.\n",
    "#For a fully developed flow with constant surface heat flux,Nusselt number is Nu=4.36\n",
    "Nu=4.36;\n",
    "#h is the heat transfer coefficient\n",
    "print\"The heat transfer coefficient in W/(m**2*K) is \"\n",
    "h=Nu*(k/D)\n",
    "print\"h=\",h\n",
    "#Here h=hL Since the heat transfer coefficient is constant over the entire length of tube.\n",
    "#hL is the local heat transfer coefficient\n",
    "hL=h;\n",
    "#from an energy balance qw*pi*D*L=mdot*cp*(Tbo-Tbi)\n",
    "#mdot is mass flow rate\n",
    "print\"The mass flow rate of air in kg/s is\"\n",
    "mdot=rho*(math.pi/4)*D**2*U\n",
    "print\"mdot=\",mdot\n",
    "#qw is the constant surface heat flux\n",
    "print\"Therefore the constant surface heat flux qw in W/m**2 is\"\n",
    "qw=(mdot*cp*(Tbo-Tbi))/(math.pi*D*L)\n",
    "print\"qw=\",qw\n",
    "#Let Twe be the surface temprature at the exit plane.Then we can write hL*(Twe-Tbo)=qw\n",
    "print\"The tube surface temprature at the exit plane in °C is \"\n",
    "Twe=Tbo+(qw/hL)\n",
    "print\"Twe=\",Twe\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.10:pg-338"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Introduction to heat transfer by S.K.Som, Chapter 7, Example 10\n",
      "Reynold number is\n",
      "Re= 348.623853211\n",
      "Therefore the flow is laminar.The hydrodynamic entrance length in m is\n",
      "Leh= 0.0697247706422\n",
      "The thermal entrance length in m is\n",
      "Let= 0.0488073394495\n",
      "The thermal entrance length is greater than the tube length Therefore the flow is hydrodynamically developed but not thermally developed\n",
      "The inverse of graetz number Gr_1 is\n",
      "Gr_1= 0.040977443609\n",
      "Therefore the local heat transfer coefficient in W/(m**2*K) is\n",
      "hL= 35.25\n",
      "The mass flow rate of air in kg/s is\n",
      "mdot= 2.38761041673e-05\n",
      "Therefore surafce heat flux qw in W/m**2 is\n",
      "qw= 2398.75\n",
      "The tube surface temprature at the exit plane in °C is \n",
      "Twe= 193.04964539\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    " \n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 10\"\n",
    "#Air at one atmospheric pressure and temprature(Tbi=75°C) enters a tube of internal diameter(D)=4.0mm with average velocity(U)=2m/s\n",
    "Tbi=75;\n",
    "D=4*10**-3;\n",
    "U=2;\n",
    "#The heated tube length is L=0.04m and a constant heat flux is imposed by the tube surface on the air over the entire length.\n",
    "L=0.04;\n",
    "#An exit bulk mean temprature(Tbo)=125°C is required.\n",
    "Tbo=125;\n",
    "#The properties of air 100°C are density(rho=0.95kg/m**3),Prandtl number(Pr=0.70),conductivity(k=0.03W/(m*K)),viscosity(mu=2.18*10**-5kg/(m*s)),specific heat(cp=1.01kJ/(kg/K))\n",
    "rho=0.95;\n",
    "Pr=0.70;\n",
    "k=0.03;\n",
    "mu=2.18*10**-5;\n",
    "cp=1.01*10**3;\n",
    "#Re is the reynolds number \n",
    "print\"Reynold number is\"\n",
    "Re=rho*U*D/mu\n",
    "print\"Re=\",Re\n",
    "#Leh is the hydrodynamic entrance length\n",
    "print\"Therefore the flow is laminar.The hydrodynamic entrance length in m is\"\n",
    "Leh=0.05*Re*D\n",
    "print\"Leh=\",Leh\n",
    "#Let is thermal entrance length\n",
    "print\"The thermal entrance length in m is\"\n",
    "Let=0.05*Re*Pr*D\n",
    "print\"Let=\",Let\n",
    "print\"The thermal entrance length is greater than the tube length Therefore the flow is hydrodynamically developed but not thermally developed\" \n",
    "#We calculate the inverse graetz number at x=L=0.04m\n",
    "x=0.04;\n",
    "#Gr_1 is inverse of graetz number\n",
    "print\"The inverse of graetz number Gr_1 is\"\n",
    "Gr_1=(x/D)*(1/(Re*Pr))\n",
    "print\"Gr_1=\",Gr_1\n",
    "#For constant surface heat flux nusselt number is Nu=4.7 and Graetz number is Gr=4.1*10**-2\n",
    "Nu=4.7;\n",
    "Gr=4.1*10**-2;\n",
    "#hL is the local heat transfer coefficient\n",
    "print\"Therefore the local heat transfer coefficient in W/(m**2*K) is\"\n",
    "hL=Nu*(k/D)\n",
    "print\"hL=\",hL\n",
    "#from an energy balance qw*pi*D*L=mdot*cp*(Tbo-Tbi)\n",
    "#mdot is the mass flow rate\n",
    "print\"The mass flow rate of air in kg/s is\"\n",
    "mdot=rho*(math.pi/4)*D**2*U\n",
    "print\"mdot=\",mdot\n",
    "#qw is the surface heat flux\n",
    "print\"Therefore surafce heat flux qw in W/m**2 is\"\n",
    "qw=(mdot*cp*(Tbo-Tbi))/(math.pi*D*L)\n",
    "print\"qw=\",qw\n",
    "#Let Twe be the surface temprature at the exit plane.Then we can write hL*(Twe-Tbo)=qw\n",
    "print\"The tube surface temprature at the exit plane in °C is \"\n",
    "Twe=Tbo+(qw/hL)\n",
    "print\"Twe=\",Twe\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n",
    "\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Ex7.11:pg-339"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      " Introduction to heat transfer by S.K.Som, Chapter 7, Example 11\n",
      "Reynold number is\n",
      "Re1= 13541.3214942\n",
      "Nusselt number is\n",
      "Nubar1= 56.808608087\n",
      "The heat transfer transfer coefficient in W/(m**2*°C) \n",
      "hbar1= 522.6391944\n",
      "Outlet fluid temprature in first iteration is Tbo2 in °C is\n",
      "Tb2 in °C is\n",
      "Tb2= -30.4912413164\n",
      "Reynold number is\n",
      "Re2= 13938.8493187\n",
      "Nusselt number is\n",
      "The heat transfer transfer coefficient in W/(m**2*°C) \n",
      "hbar2= 784.03829067\n",
      "Outlet fluid temprature in second iteration is Tbo3 in °C is\n",
      "Tbo3= -16.646852652\n",
      "Tb3 in °C is\n",
      "The Exit fluid temprature after second iteration is obtained as Tbo=-16.67°C\n",
      "Tb3= -28.323426326\n"
     ]
    }
   ],
   "source": [
    " \n",
    " \n",
    " \n",
    " \n",
    " import math\n",
    " \n",
    "print\"Introduction to heat transfer by S.K.Som, Chapter 7, Example 11\"\n",
    "#Liquid sulphur di oxide in a saturated state flows inside a L=5m long tube and D=25mm internal diameter with a mass flow rate(mdot) of 0.15 kg/s.\n",
    "#The tube is heated at a constant surface temprature(Tw) of -10°C and the inlet fluid temprature is Tbi=-40°C\n",
    "Tw=-10;\n",
    "Tbi=-40;\n",
    "mdot=0.15;\n",
    "D=0.025;#in metre\n",
    "L=5;\n",
    "#The properties to be used shoud be estimated at a temprature which is arithmetic mean of Tbi and Tbo.\n",
    "#Since (outlet fluid temprature Tbo) is not known a priori,the solution has to be based on an iterative method starting with a guess value of Tb1=(Tbi+Tbo)/2\n",
    "#Here we denote bulk mean temprature as Tb.The superscript refers to the no. of trials\n",
    "#For first trial,guess Tbo1=-20°C;so Tb1=-30°C\n",
    "#We have the property values as follows at a temprature of -30°C.\n",
    "rhob1=1520.64;#density in kg/m**3\n",
    "nub1=0.371*10**-6;#kinematic viscosity in m**2/s\n",
    "kb1=0.23;#conductivity in W/(m*°C)\n",
    "Prb1=3.31;#Prandtl number\n",
    "mub1=nub1*rhob1;#viscosity in kg/(m*s)\n",
    "cpb1=1361.6;#specific heat in J/(kg*K)\n",
    "#muw=nuw*rhow at Tw=10°C\n",
    "nuw=0.288*10**-6;#kinematic viscosity at Tw in m**2/s\n",
    "rhow=1463.61;#density at Tw in kg/m**3\n",
    "muw=nuw*rhow;#viscosity at Tw in kg/(m*s)\n",
    "#The reynolds number is found as Re1=(4*mdot)/(math.pi*D*mub1)\n",
    "print\"Reynold number is\"\n",
    "Re1=(4*mdot)/(math.pi*D*mub1)\n",
    "print\"Re1=\",Re1\n",
    "#Hence the flow is turbulent\n",
    "#Now using equation, nusselt number is,Nubar1=0.027*(Re1)**0.8*Prb1**(1/3)*(mub1/muw)**0.14\n",
    "print\"Nusselt number is\"\n",
    "Nubar1=0.027*(Re1)**0.8*Prb1**(1/3)*(mub1/muw)**0.14\n",
    "print\"Nubar1=\",Nubar1\n",
    "#The heat transfer transfer coefficient hbar1=(kb1/D)*Nubar1\n",
    "print\"The heat transfer transfer coefficient in W/(m**2*°C) \"\n",
    "hbar1=(kb1/D)*Nubar1\n",
    "print\"hbar1=\",hbar1\n",
    "#The outlet fluid temprature can be found by making use of eqn Tbo2=Tw-(Tw-Tbi)*math.e((-math.pi*D*L*hbar1)/(mdot*cpb1))\n",
    "print\"Outlet fluid temprature in first iteration is Tbo2 in °C is\"\n",
    "Tbo2=Tw-(Tw-Tbi)*math.e**((-math.pi*D*L*hbar1)/(mdot*cpb1))\n",
    "#Tb2 is the bulk mean temprature.\n",
    "print\"Tb2 in °C is\"\n",
    "Tb2=(Tbi+Tbo2)/2\n",
    "print\"Tb2=\",Tb2\n",
    "#Since the value differs from the assumed value of Tb1=-30°C,WE require furtheriteration,Therfore we start second trial with Tb2=-28.36°C\n",
    "#We have the property value at a temprature of -28.36°C as follows\n",
    "rhob2=1514;#density in kg/m**3\n",
    "nub2=0.362*10**-6;#kinematic viscosity in m**2/s\n",
    "kb2=0.229;#conductivity in W/(m*°C)\n",
    "Prb2=3.23;#Prandtl number\n",
    "mub2=nub2*rhob2;#viscosity in kg/(m*s)\n",
    "cpb2=1362;#specific heat in J/(kg*K)\n",
    "#muw=nuw*rhow at Tw=10°C\n",
    "nuw=0.288*10**-6;#viscosity at Tw in m**2/s\n",
    "rhow=1463.61;#density at Tw in kg/m**3\n",
    "muw=nuw*rhow;#kinematic viscosity at Tw in kg/(m*s)\n",
    "#The reynolds number is found as Re2=(4*mdot)/(math.pi*D*mub2)\n",
    "print\"Reynold number is\"\n",
    "Re2=(4*mdot)/(math.pi*D*mub2)\n",
    "print\"Re2=\",Re2\n",
    "#Now using equation, nusselt number is,Nubar2=0.027*(Re2)**0.8*Prb2**(1/3.0)*(mub2/muw)**0.14\n",
    "print\"Nusselt number is\"\n",
    "Nubar2=0.027*(Re2)**0.8*Prb2**(1/3.0)*(mub2/muw)**0.14\n",
    "#The heat transfer transfer coefficient hbar2=(kb2/D)*Nubar2\n",
    "print\"The heat transfer transfer coefficient in W/(m**2*°C) \"\n",
    "hbar2=(kb2/D)*Nubar2\n",
    "print\"hbar2=\",hbar2\n",
    "#The outlet fluid temprature can be found by making use of eqn Tbo3=Tw-(Tw-Tbi)*math.e((-math.pi*D*L*hbar2)/(mdot*cpb2))\n",
    "print\"Outlet fluid temprature in second iteration is Tbo3 in °C is\"\n",
    "Tbo3=Tw-(Tw-Tbi)*math.e**((-math.pi*D*L*hbar2)/(mdot*cpb2))\n",
    "print\"Tbo3=\",Tbo3\n",
    "#Tb3 is the bulk mean temprature.\n",
    "print\"Tb3 in °C is\"\n",
    "Tb3=(Tbi+Tbo3)/2\n",
    "#We see that difference between Tbo2 and Tbo3 and that between Tb2 and Tb3 is marginal.Therfore we can stop iteration and present the result as Tbo=-16.67°C\n",
    "print\"The Exit fluid temprature after second iteration is obtained as Tbo=-16.67°C\"\n",
    "print\"Tb3=\",Tb3"
   ]
  }
 ],
 "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.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}