summaryrefslogtreecommitdiff
path: root/TRANSPORT_PROCESSES_AND_UNIT_OPERATIONS/GeankoplisChapter04.ipynb
blob: 006f8bc04767b6f2f5f36dc8c5c397dcea9dba93 (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
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
{
 "metadata": {
  "name": "",
  "signature": "sha256:0fc1c228b620788d89524e97706118d770bd4b5cefa6e66c9b45d50f744933c6"
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 4: Principles of Steady-State Heat Transfer"
     ]
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.1-1, Page number 217"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat Loss Through Insulating Wall\n",
      "\n",
      "#Variable declaration\n",
      "L = 0.0254        #Thickness of fibre insulating board\n",
      "T1 = 352.7        #Temperature of hot face, \u00b0C\n",
      "T2 = 297.1        #Temperature of cold face, \u00b0C\n",
      "A = 1.0           #Suface area, m2\n",
      "k = 0.048         #Thermal conductivity of fibre insulating board, W/(m.K)\n",
      "\n",
      "#Calculation\n",
      "q = k*(T1-T2)/L\n",
      "\n",
      "#Result\n",
      "print \"Heat loss per unit area:\", round(q,1), \"W/m2\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat loss per unit area: 105.1 W/m2\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.2-1, Page number 222"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Length of tubing for Cooling Coil\n",
      "from math import log, pi\n",
      "\n",
      "#Variable declaration \n",
      "ri = 0.005       #Inside radius of tubing\n",
      "ro = 0.02        #Outside radius of tubing\n",
      "k = 0.151        #Thrmal conductivity of rubber tubing, W/mK\n",
      "Ti = 274.9       #Inside wall temaperature, K\n",
      "To = 297.1       #Outside wall temaperature, K\n",
      "Q = 14.65        #Total heat tranfer rate, W\n",
      "\n",
      "#Calculation\n",
      "Ai = 2*pi*ri*1.0\n",
      "Ao = 2*pi*ro*1.0\n",
      "Alm = (Ai-Ao)/(log(Ai/Ao))\n",
      "Q1 = k*Alm*(To-Ti)/(ro-ri)\n",
      "L = Q/Q1\n",
      "\n",
      "#Result\n",
      "print \"Length of tubing required \",round(L,3) , \"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Length of tubing required  0.964 m\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3-1, Page number 223"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat Flow Through an Insulated Wall of a Cold Sorage\n",
      "\n",
      "#Variable declaration\n",
      "L1 = 0.0127      #Thickness of inner wall, m\n",
      "L2 = 0.1016      #Thickness of middle wall, m\n",
      "L3 = 0.0762      #Thickness of outer wall, m\n",
      "k1 = 0.151       #Thermal conductivity of inner wall, W/mK\n",
      "k2 = 0.0433      #Thermal conductivity of middle wall, W/mK\n",
      "k3 = 0.768       #Thermal conductivity of outer wall, W/mK\n",
      "A = 1.0          #Heat Area area, m2\n",
      "Ti = 255.4       #Inner wall surface temperature, K\n",
      "To = 297.1       #outer wall surface temperature, k\n",
      "\n",
      "#Calculation\n",
      "R1 = L1/(k1*A)   # Resistance of the inner wall, K/W\n",
      "R2 = L2/(k2*A)   # Resistance of the middle wall, K/W\n",
      "R3 = L3/(k3*A)   # Resistance of the outer wall, K/W\n",
      "Rt = R1 + R2 + R3 \n",
      "q = (Ti-To)/Rt\n",
      "T2 = Ti - q*R1\n",
      "\n",
      "#Result\n",
      "print 'Resistance offered by 1st wall %5.4f K/W'%(R1)\n",
      "print 'Resistance offered by 2nd wall %5.4f K/W'%(R2)\n",
      "print 'Resistance offered by 3rd wall %5.4f K/W'%(R3)\n",
      "print 'Total Resistance of composite wall %5.4f K/W'%(Rt)\n",
      "print \"Heat loss\",round(q,2),'W/m2'\n",
      "print \"Temperature at interface between pine wood and cork\",round(T2,2), \"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Resistance offered by 1st wall 0.0841 K/W\n",
        "Resistance offered by 2nd wall 2.3464 K/W\n",
        "Resistance offered by 3rd wall 0.0992 K/W\n",
        "Total Resistance of composite wall 2.5297 K/W\n",
        "Heat loss -16.48 W/m2\n",
        "Temperature at interface between pine wood and cork 256.79 K\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3-2, Page number 225"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat Loss from an Insulated pipe\n",
      "from math import log, pi\n",
      "\n",
      "#Variable declaration\n",
      "ks = 21.63                 #Heat transfer coefficient of the pipe (W/K.m)\n",
      "ki = 0.2423                #Heat transfer coefficient of the insulation  (W/K.m)\n",
      "d1 = 0.0254                #Inner diameter of the pipe (m)\n",
      "d2 = 0.0508                #Inner diameter of the insulation (m)\n",
      "thks = 0.0254              \n",
      "T1 = 811                   #The wall temperature of the pipe (K)\n",
      "T3 = 310.8                 #The temperature of the outside wall of the insulation (k)\n",
      "L = .305                   #Length of the pipe (m)\n",
      "\n",
      "#Calculation\n",
      "r1 =d1/2.\n",
      "r2 = d2/2.\n",
      "r3 = r2 + thks\n",
      "A1 = 2*pi*r1*L\n",
      "A2 = 2*pi*r2*L\n",
      "A3 = 2*pi*r3*L\n",
      "A12lm = (A1-A2)/log(A1/A2)\n",
      "A23lm = (A2-A3)/log(A2/A3)\n",
      "R12 = (r2-r1)/(ks*A12lm)\n",
      "R23 = (r3-r2)/(ki*A23lm)\n",
      "Q = (T1-T3)/(R12+R23)\n",
      "T2 = T1 - Q*R12\n",
      "\n",
      "#Results\n",
      "print \"Temperature of Interface\", round(T2,1) ,\"K\"\n",
      "print \"Heat loss\", round(Q,1) ,\"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature of Interface 805.5 K\n",
        "Heat loss 331.4 W\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3-3, Page number 228"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat Loss by Convection and Conduction and Overall U\n",
      "from math import log, pi\n",
      "\n",
      "#Variable declaration\n",
      "di = 0.824                  #Inner diameter of the pipe (m)\n",
      "do = 1.05                   #Outer diameter of the pipe (m)\n",
      "thki = 1.5\n",
      "hi = 1000                   #Convective heat transfer coefficient (btu/h.ft2)\n",
      "ho = 2.                     #Convective heat transfer coefficient on the outside (btu/h.ft2) \n",
      "km = 26.                    #Mean thermal cunductivity of metal (btu/h.ft)\n",
      "ki = 0.037                  #Mean thermal cunductivity of insulation (btu/h.ft)\n",
      "Ts = 267                    #Surface temperature of the pipe (F)\n",
      "Ta = 80                     #Surrounding air temperature (F)\n",
      "L = 1.            \n",
      "\n",
      "#Calculation\n",
      "ri = di/(12.*2.)\n",
      "r1 = do/(12.*2.)\n",
      "ro = r1 + thki/12.\n",
      "Ai = 2*pi*ri*L\n",
      "A1 = 2*pi*r1*L\n",
      "Ao = 2*pi*ro*L\n",
      "Ai1lm = (Ai-A1)/log(Ai/A1)\n",
      "A1olm = (A1-Ao)/log(A1/Ao)\n",
      "Ri1 = (r1-ri)/(km*Ai1lm)\n",
      "R1o = (ro-r1)/(ki*A1olm)\n",
      "Ri = 1./(hi*Ai)\n",
      "Ro = 1./(ho*Ao)\n",
      "Rt = Ri+Ri1+R1o+Ro\n",
      "Q = (Ts-Ta)/(Rt)\n",
      "Ui = 1./(Ai*Rt)\n",
      "Q1 = Ui*Ai*(Ts-Ta)\n",
      "\n",
      "#Result\n",
      "print \"Heat lost to the surrounding using resistance\",round(Q,1), \"Btu/hr\"\n",
      "print \"Heat lost to the surrounding using Overall Heat TRansfer Coeff\",round(Q1,1), \"Btu/hr\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat lost to the surrounding using resistance 29.8 Btu/hr\n",
        "Heat lost to the surrounding using Overall Heat TRansfer Coeff 29.8 Btu/hr\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3-4, Page number 231"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat Generation in a cylinder\n",
      "from math import pi\n",
      "#Variable declaration\n",
      "i = 200.           #Current through the wire, A\n",
      "r = 0.001268       #radius of the wire, m\n",
      "L = 0.91           #Length of wire, m\n",
      "R = 0.126          #Resistance of stainless steel, ohm\n",
      "Tw = 422.1         #Wall temperature of the wire, K\n",
      "k = 22.5           #Thermal conductivity of steel, W/mK \n",
      "\n",
      "#Calculation\n",
      "Q = i**2*R\n",
      "qdot = Q/(pi*r**2*L)\n",
      "To = Tw + qdot*r**2/(4*k)\n",
      "\n",
      "#Result\n",
      "print \"Temperature at the centre of the wire\",round(To,1),\"K\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Temperature at the centre of the wire 441.7 K\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.3-5, Page number 232"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Insulating an Electrical Wire and Critical Radius\n",
      "from math import log, pi\n",
      "\n",
      "#Variable declaration\n",
      "d = 1.5         #Diameter of electrical wire, mm\n",
      "thki = 2.5      #Thickness of insulation, mm\n",
      "Ta = 300.       #Temrature of air, K\n",
      "ho = 20.        #Outside Heat transfer coefficient, W/m2.K\n",
      "ki = 0.4        #Thermal conductivity of insulation, W/mK\n",
      "Tw = 400.       #Surface temperature of the wire, K\n",
      "L = 1.          #Length of wire, m\n",
      "#Calculation\n",
      "r1 = d*1e-3/2.\n",
      "r2 = r1+thki*1e-3\n",
      "r2c = ki/ho\n",
      "A1 = 2*pi*r1*L\n",
      "Q = ho*A1*(Tw-Ta)\n",
      "\n",
      "Qi = 2*pi*L*(Tw-Ta)/(log(r2/r1)/ki + 1./(ho*r2))\n",
      "#Result\n",
      "print \"(a) Critical radius of insulation\",round(r2c*1e3,1),\"mm\"\n",
      "print \"(b) Heat Transfer rate without insulation\",round(Q,2),\"W/m\"\n",
      "print \"(c) Heat Transfer rate with insulation\",round(Qi,2),\"W/m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "(a) Critical radius of insulation 20.0 mm\n",
        "(b) Heat Transfer rate without insulation 9.42 W/m\n",
        "(c) Heat Transfer rate with insulation 32.98 W/m\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.4-1, Page number 235"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Two dimenssional conduction by Graphical Proceedure \n",
      "\n",
      "#Variable declaration\n",
      "T1 = 600.       #Inside temperature, K\n",
      "T2 = 400.       #Outside temperature, K\n",
      "k = 0.9         #Thermal conductivity, W/mK\n",
      "L = 5.          #Length of flue, m\n",
      "N = 4           #Number of temperature subdivisions\n",
      "M = 9.25        #\n",
      "#Calculation\n",
      "\n",
      "Q = 4*(M*k*L*(T1-T2)/4.)\n",
      "\n",
      "#Result\n",
      "print \"Heat Transfer Rate :\",round(Q), \"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat Transfer Rate : 8325.0 W\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5-1, Page number 240"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heating of Air in Turbulent Flow\n",
      "\n",
      "#Variable declaration\n",
      "Tc = 477.6       #Average temperature of air, K\n",
      "v = 7.62         #Velocity of air, m/s\n",
      "di = 0.0254      #inner diameter, m \n",
      "Ts = 488.7       #Steam temperature, K\n",
      "muab = 2.6e-5    #Viscosity of air, Pa.s\n",
      "ka = 0.03894     #Thermal conductivity of air, W/mK\n",
      "Npr = 0.686\n",
      "muw = 2.64e-5    #Viscosity of air at wall temperature, Pa.s\n",
      "P = 206.8        #Pressure, kPa  \n",
      "\n",
      "#Calculation\n",
      "\n",
      "rhoa =28.97*(1./22.414)*(P/101.325)*273.2/Tc\n",
      "Nre = di*v*rhoa/muab\n",
      "Nnu = 0.027*Nre**0.8*Npr**(1./3)*(muab/muw)**0.14\n",
      "hL = Nnu*ka/di\n",
      "q = hL*(Ts-Tc)\n",
      "\n",
      "#Result\n",
      "print \"Average Heat Transfer Coefficient for L/D > 60\", round(hL,2), \"W/m2.K\"\n",
      "print \"Heat Flux\", round(q,2), \"W/m2\"\n",
      "print 'The answers different than book, because of book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Average Heat Transfer Coefficient for L/D > 60 63.36 W/m2.K\n",
        "Heat Flux 703.33 W/m2\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5-2, Page number 241"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Water Heated by Steam, Trial and Error Solution\n",
      "from math import pi\n",
      "\n",
      "#Variable declaration\n",
      "di = 0.0266              #Inner diameter of the pipe (m)\n",
      "do = 0.0334              #Outer diameter of the pipe (m)\n",
      "L = 0.305                #Lenth of pipe, m\n",
      "T = 65.6                 #Average temperature of the steel pipe (deg C)\n",
      "v = 2.44                 #Velocity of the water flow (m/s)\n",
      "Ts = 107.8               #Temperature of the steam (deg C)\n",
      "ho = 10500.              #Heat transfer coefficient on the steam side (W/m2.K)\n",
      "# Properties of water at T=65.6\u00b0C\n",
      "Npr = 2.72               #Prandtl number\n",
      "rho = 980.               #Density of water (kg/m3)\n",
      "kw = 0.663               #Thermal conductivity of Water (W/m.K)\n",
      "mu = 4.32e-4             #Viscosity of water (Pa.s)\n",
      "k = 45.                  #Thermal conductivity of metal wall (W/m.K)\n",
      "# Properties of water at T=80\u00b0C\n",
      "muw = 3.56e-4\n",
      "\n",
      "#Calculation\n",
      "#Part A\n",
      "Nre = di*v*rho/mu\n",
      "Nnu = 0.027*(Nre**0.8)*(Npr**(1./3))*(mu/muw)**0.14\n",
      "hi = Nnu*kw/di\n",
      "\n",
      "#Part B\n",
      "Ai = pi*di*L\n",
      "Ao = pi*do*L\n",
      "Am = pi*L*(do+di)/2\n",
      "Ri = 1./(hi*Ai)\n",
      "Ro = 1./(ho*Ao)\n",
      "Rm = (do-di)/(2*k*Am)\n",
      "SR = Ri+Ro+Rm\n",
      "DelT = (Ts-T)\n",
      "DelTw = Ri*DelT/SR\n",
      "Tw = T + DelTw\n",
      "\n",
      "Ui = 1.0/(Ai*SR)\n",
      "Q = Ui*Ai*DelT\n",
      "#Result\n",
      "print \"Inside Heat Transfer Coefficient:\", round(hi), \"W/m2.K\"\n",
      "print \"The assumed temperature of water 80\u00b0C is comparable with Calculated\", round(Tw,2)\n",
      "print \"Heat Transfer Rate\", round(Q),\"W\"\n",
      "print 'The answers are different than book, because of book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Inside Heat Transfer Coefficient: 13153.0 W/m2.K\n",
        "The assumed temperature of water 80\u00b0C is comparable with Calculated 80.26\n",
        "Heat Transfer Rate 4914.0 W\n",
        "The answers are different than book, because of book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5-3, Page number 243"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Liquid-Metal Heat Transfer Inside a Tube\n",
      "from math import pi\n",
      "\n",
      "#Variable declaration\n",
      "mdot = 4.                    #Flowrate of liquid metal (kg/s)\n",
      "di = 0.05                    #Inner diameter of pipe (m)\n",
      "Ti = 500.                    #Initial temperature of liquid entering (K)\n",
      "To = 505.                    #Final temperature of liquid leaving (K)\n",
      "mu = 7.1e-4                  #Viscosity of the liquid (Pa.s) \n",
      "rho = 7400.                  #Density of the liquid (kg/m3)\n",
      "cp = 120.                    #Specific heat (J/kg.K)\n",
      "k = 13.                      #Heat transfer coefficient (W/m.K)\n",
      "delT = 30.\n",
      "\n",
      "#Calculation\n",
      "Ac = pi*di**2/4.\n",
      "G = mdot/Ac\n",
      "Nre = di*G/mu\n",
      "Npr = cp*mu/k\n",
      "Npe = Nre*Npr\n",
      "Nnu = 0.625*Npe**0.4\n",
      "hL = Nnu*k/di\n",
      "Q = mdot*cp*(To-Ti)\n",
      "As = Q/(hL*delT) \n",
      "L = As/(pi*di)\n",
      "\n",
      "#Result\n",
      "print \"Heat Transfer coefficient\",round(hL,2),\"W/m2.K\"\n",
      "print \"The Length of the tube required\",round(L,3),\"m\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat Transfer coefficient 2512.75 W/m2.K\n",
        "The Length of the tube required 0.203 m\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5-4, Page number 245"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat Transfer Area and Log Mean Temperature Difference\n",
      "from math import log\n",
      "#Variable declaration  \n",
      "cpm = 2300.                #Specific heat of the hydrocarbon oil (J/kg.K)\n",
      "Ti = 371.9                 #Initial temperature of the oil (K)\n",
      "To = 349.7                 #Final temperature of the oil (K)\n",
      "mdotoil = 3630.            #Flowrate of oil (kg/h)\n",
      "mdotw = 1450.              #Flowrate of water (kg/h)\n",
      "cpw = 4187.                #Specific heat of water (J/kg.K)\n",
      "Twi = 288.6                #Temperature of the inlet water (K)\n",
      "Ui = 340.                  #Overall heat tranfer coefficient (W/m2.K)\n",
      "\n",
      "#Calculations \n",
      "Q = mdotoil*cpm*(Ti-To)/3600\n",
      "Two = Twi + Q/((mdotw/3600)*cpw)\n",
      "    #Contercurrent\n",
      "delT1 = To - Twi\n",
      "delT2 = Ti - Two\n",
      "deltLM = (delT1-delT2)/log(delT1/delT2)\n",
      "Ai = Q/(Ui*deltLM)\n",
      "#Result\n",
      "print \"Heat lost by oil\",round(Q,1),\"W\"\n",
      "print \"Outlet Temperature of cooling water\",round(Two,1),\"K\"\n",
      "print \"Area required for cooling in Countercurrent flow:\",round(Ai,2),\"m2\"\n",
      "\n",
      "    #Co-current/Parallel flow\n",
      "delT1 = Ti - Twi\n",
      "delT2 = To - Two\n",
      "deltLM = (delT1-delT2)/log(delT1/delT2)\n",
      "Ai = Q/(Ui*deltLM)\n",
      "\n",
      "#Result\n",
      "print \"Area required for cooling in Co-current/Parallel flow:\",round(Ai,2),\"m2\"\n",
      "print 'The answers different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat lost by oil 51485.5 W\n",
        "Outlet Temperature of cooling water 319.1 K\n",
        "Area required for cooling in Countercurrent flow: 2.66 m2\n",
        "Area required for cooling in Co-current/Parallel flow: 2.88 m2\n",
        "The answers different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.5-5, Page number 246"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Laminar Heat Transfer and Trial and Error\n",
      "from scipy import interpolate\n",
      "from math import pi\n",
      "\n",
      "#Variable declaration SI Units \n",
      "Ti = 150.                     #Initial temperature of the hydrocarbon oil (F) \n",
      "di = 0.0303                   #Inside diameter of the pipe (ft)\n",
      "L = 15.                       #Length of the tube (ft)\n",
      "mdot = 80.                    #Flowrate of the oil (lbm/h)\n",
      "Tw = 350.                     #Inside wall temperature of the wall (F)\n",
      "Cp = 0.5                      #Specific heat of oil (btu/lbm)\n",
      "km = 0.083                    #Thermal conductivity, Btu/(h.ft.\u00b0F) \n",
      "T=[150,200,250,300,350]       #Temperature of hydrocarbon oil, \u00b0F\n",
      "mu=[6.5,5.05,3.8,2.82,1.95]   #Viscosity of hydrocarbon oil, \u00b0F\n",
      "cf = 2.4191                   #Specific Heat of hydrocarbon oil, \u00b0F\n",
      "\n",
      "#Calculations \n",
      "f = interpolate.interp1d(T,mu)\n",
      "muw = cf*f(Tw)\n",
      "Ac = pi*di**2/4.\n",
      "G = mdot/Ac\n",
      "Toass = 250.\n",
      "xx = 1.2\n",
      "#Calculation\n",
      "while(xx > 0.0001):\n",
      "    Tb = int((Ti+Toass)/2.)\n",
      "    mub = cf*f(Tb)\n",
      "    Nre = di*G/mub\n",
      "    Npr = Cp*mub/km\n",
      "    Nnu = 1.86*(Nre*Npr*di/L)**(1./3)*(mub/muw)**0.14\n",
      "    h = Nnu*km/di\n",
      "    tau = h*pi*di*L/(mdot*Cp)\n",
      "    tau2 = tau/(1+tau/2.)\n",
      "    To =  (tau*(Tw-Ti/2.)+Ti)/(1+tau/2.)\n",
      "    xx = abs((Toass - To)/Toass)\n",
      "    Toass = To\n",
      "\n",
      "#Result\n",
      "print \"The outlet temperature of the oil\",round(Toass,0),\"\u00b0F\"\n",
      "print \"The heat transfer coefficient calculated is\",round(h,2),\"Btu/(hr.ft2)\"\n",
      "print 'The answers are different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The outlet temperature of the oil 255.0 \u00b0F\n",
        "The heat transfer coefficient calculated is 20.03 Btu/(hr.ft2)\n",
        "The answers are different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6-1, Page number 248"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Cooling of Cooper Fin\n",
      "\n",
      "#Variable declaration\n",
      "l = 0.051       #length of square fin, m\n",
      "T = 82.2        #Temperature of fin, \u00b0C\n",
      "Ta = 15.6       #Temperature of air, \u00b0C\n",
      "P = 1.          #Absolute Pressure of air, atm\n",
      "v = 12.2        #Velocity of air, m/s\n",
      "k = 0.028       #Thermal conductivity of air at 48.9\u00b0C, W/(m.K)\n",
      "rho = 1.097     #Density of air at 48.9\u00b0C, kg/m3\n",
      "mu = 1.95e-5    #viscosity of air at 48.9\u00b0C, W/(m.K)\n",
      "Npr = 0.704     #Prandtl numbe for air at 48.9\u00b0C, W/(m.K)\n",
      "\n",
      "#Calculation\n",
      "Tf = (T+Ta)/2.\n",
      "Nre = l*v*rho/mu\n",
      "Nnu = 0.664*Nre**0.5*Npr**(1./3.)\n",
      "ha = Nnu*k/l\n",
      "\n",
      "Nnu = 0.0366*Nre**0.8*Npr**(1./3.)\n",
      "hb = Nnu*k/l\n",
      "#Result\n",
      "print \" A)  Heat Transfer Coeficient for Laminar Flow\", round(ha,1),\"W/(m2.K)\"\n",
      "print \" B)  Heat Transfer Coeficient for Turbulent Conditions\", round(hb,1),\"W/(m2.K)\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        " A)  Heat Transfer Coeficient for Laminar Flow 60.7 W/(m2.K)\n",
        " B)  Heat Transfer Coeficient for Turbulent Conditions 77.2 W/(m2.K)\n"
       ]
      }
     ],
     "prompt_number": 23
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6-2, Page number 249"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Cooling of Sphere\n",
      "\n",
      "#Variable declaration\n",
      "d = 0.051       #Diameter of sphere, m\n",
      "T = 82.2        #Temperature of fin, \u00b0C\n",
      "Ta = 15.6       #Temperature of air, \u00b0C\n",
      "P = 1.          #Absolute Pressure of air, atm\n",
      "v = 12.2        #Velocity of air, m/s\n",
      "k = 0.028       #Thermal conductivity of air at 48.9\u00b0C, W/(m.K)\n",
      "rho = 1.097     #Density of air at 48.9\u00b0C, kg/m3\n",
      "mu = 1.95e-5    #viscosity of air at 48.9\u00b0C, W/(m.K)\n",
      "Npr = 0.704     #Prandtl numbee for air at 48.9\u00b0C, W/(m.K)\n",
      "hflat = 77.2    #Film coeff for heat transfer from flat plate, W/(m2.K)\n",
      "\n",
      "#Calculation\n",
      "Tf = (T+Ta)/2.\n",
      "Nre = d*v*rho/mu\n",
      "Nnu = 2.+ 0.6*Nre**0.5*Npr**(1./3.)\n",
      "h = Nnu*k/d\n",
      "#Result\n",
      "print \"Reynolds number\", round(Nre)\n",
      "print \"Heat transfer coeffiecient\", round(h,1), \"W/(m2.K) is less than Heat Transfer coeff for flat plate in prevoius problem\"\n",
      "print 'The answers are different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reynolds number 35003.0\n",
        "Heat transfer coeffiecient 55.9 W/(m2.K) is less than Heat Transfer coeff for flat plate in prevoius problem\n",
        "The answers are different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 26
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.6-3, Page number 250"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heating of air by a bank of tubes\n",
      "from math import pi\n",
      "\n",
      "#Variable declaration\n",
      "do = 0.0254     #Outside Diameter of tube,m\n",
      "L  = 0.305      #Length of tube bank,m \n",
      "Sn = 0.0381     #Normal Tube spacing, m\n",
      "Sp = 0.0381     #Parallel tube spacing,m\n",
      "Nt = 40         #Number of tubes in bank\n",
      "Tw = 57.2       #Surface temperature of tubes, \u00b0C\n",
      "Ti = 15.6       #Air inlet temperature, \u00b0C\n",
      "To = 21.1       #Assumed oultet temperature of air, \u00b0C\n",
      "P  = 1.         #Air Pressure, atm abs \n",
      "v  = 7.62       #Velocity of air, m/s\n",
      "rho = 1.137     #Density of air, kg/m3\n",
      "mu  = 1.9e-5    #Viscosity of air, Pa.s\n",
      "Cp = 1004.8     #Specific heat of air, kJ/(kg.K)\n",
      "Npr = 0.705     #Prandtl number of air\n",
      "k =  0.027      #Thermal conductivity of air,W/(m.K)\n",
      "rho156 = 1.2224 #Density of air at 15.6\u00b0C, kg/m3\n",
      "#Calculation\n",
      "snd = Sn/do\n",
      "spd = Sp/do\n",
      "#From table 4.6-2 \n",
      "C, m = 0.278, 0.620\n",
      "er = 1.0\n",
      "while er >= 0.2:\n",
      "    Tb = (Ti+To)/2.\n",
      "    Tf = (Tw+Tb)/2.\n",
      "    vmax = v*Sn/(Sn-do)\n",
      "    Nre = do*vmax*rho/mu\n",
      "    Nnu = C*Nre**m*Npr**(1./3.)\n",
      "    h = Nnu*k/do\n",
      "    #Correction factor for heat transfer coefficient from table4.3-3 for four transverse tubes\n",
      "    #is 0.9 \n",
      "    hc = 0.9*h\n",
      "    A =Nt*pi*do*L\n",
      "    Q = hc*A*(Tw-Tb)\n",
      "    Af = 10*Sn*L               #Frontal Area\n",
      "    m = Af*v*rho156\n",
      "    delT = Q/(m*Cp)\n",
      "    Tout = Ti + delT\n",
      "    er = abs(To-Tout)\n",
      "    To = (To+Tout)/2\n",
      "    \n",
      "#Result\n",
      "print \"Total Heat transfer Rate\", round(Q),\"W\"\n",
      "print 'The calculated outlet bulk gas temperature is %4.2f \u00b0C'%To\n",
      "print 'The answers are different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total Heat transfer Rate 5852.0 W\n",
        "The calculated outlet bulk gas temperature is 21.04 \u00b0C\n",
        "The answers are different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 34
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7-1 Page Number 254"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Natural Convection from Vertical Wall of an Oven\n",
      "\n",
      "#Variable Declaration\n",
      "H = 1.                        #Height of the wall (ft)\n",
      "Tw = 450                      #Temperature of the wall (deg F)\n",
      "Tb = 100.                     #Temperature of the wall in contact (F)\n",
      "L = 1.                        #Length of the wall (m)\n",
      "k = 0.0198                    #Heat transfer cofficient of the wall (btu/h.ft.F)\n",
      "rho = 0.0541                  #Density of air (lbm/ft3)\n",
      "Pr = 0.69                     #Prandtl number\n",
      "mu = 0.0562                   #Viscosity of air (cp)\n",
      "g = 32.174                    #Graitational accleration (ft/s2)\n",
      "\n",
      "#Calculations\n",
      "    #English Units\n",
      "Tf = (Tw+Tb)/2.\n",
      "beta = 1./(460.+Tf)\n",
      "delT = Tw - Tb\n",
      "Gr = L**3*rho**2*g*beta*3600**2*delT/(mu**2)\n",
      "a = 0.59\n",
      "m = 1./4.\n",
      "Nu = a*(Gr*Pr)**m\n",
      "h = k*Nu/L\n",
      "A = L*H\n",
      "Q = h*A*delT\n",
      "\n",
      "#Results\n",
      "print \"In English Units\"\n",
      "print \"The heat transfer cofficient is \",round(h,2),\"btu/h.ft2.F\"\n",
      "print \"The heat transfer rate across the wall is \",round(Q),\"btu/h\"\n",
      "\n",
      "    #SI Units\n",
      "H = 0.305                     #Height of the wall (m)\n",
      "Tw = 505.4                    #Temperature of the wall (K)\n",
      "Tb = 311.0                    #Temperature of the wall in contact (K)\n",
      "L = 0.305                     #Length of the wall (m)\n",
      "k = 0.0343                    #Thermal  conductivity of the wall (W/(m.K)\n",
      "rho = 0.867                   #Density of air (kg/m3)\n",
      "Pr = 0.69                     #Prandtl number\n",
      "mu = 2.32e-5                  #Viscosity of air (cp)\n",
      "g = 9.806                     #Graitational accleration (m/s2)\n",
      "\n",
      "#Calculations\n",
      "Tf = (Tw + Tb)/2\n",
      "beta = 1./Tf\n",
      "delT = Tw - Tb\n",
      "Gr = L**3*rho**2*g*beta*delT/(mu**2)\n",
      "a = 0.59\n",
      "m = 1./4.\n",
      "Nu = a*(Gr*Pr)**m\n",
      "h = k*Nu/L\n",
      "A = L*H\n",
      "Q = h*A*delT\n",
      "\n",
      "#Results\n",
      "print \"In SI Units\"\n",
      "print \"The heat transfer cofficient is \",round(h,2),\"W/(m2.K)\"\n",
      "print \"The heat transfer rate across the wall is \",round(Q,1),\"W\"\n",
      "\n",
      "print 'The answers are different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "In English Units\n",
        "The heat transfer cofficient is  1.24 btu/h.ft2.F\n",
        "The heat transfer rate across the wall is  434.0 btu/h\n",
        "In SI Units\n",
        "The heat transfer cofficient is  7.05 W/(m2.K)\n",
        "The heat transfer rate across the wall is  127.5 W\n",
        "The answers are different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 36
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7-2 Page Number 257"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Natural Convection and Simplified Equation\n",
      "\n",
      "#Variable Declaration\n",
      "#From previous Example 4.7-1 Page Number 254\n",
      "L = 0.305                 #Length of the wall (m)\n",
      "delT = 194.4              #Temperature diffrence (K)\n",
      "\n",
      "\n",
      "#Calculation\n",
      "A = 0.305*0.305           #Area of the wall (m2)\n",
      "h = 1.37*(delT/L)**.25\n",
      "Q = h*A*delT\n",
      "\n",
      "#Results\n",
      "print \"The heat transfer coefficient calculated is \",round(h,2),\"W/m2/K\"\n",
      "print \"The heat transfer rate across the wall is \",round(Q,2),\"W\"\n",
      "print 'The answers are different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The heat transfer coefficient calculated is  6.88 W/m2/K\n",
        "The heat transfer rate across the wall is  124.48 W\n",
        "The answers are different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.7-3 Page Number 258"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Natural Convection in Enclosed Vertical Space\n",
      "\n",
      "#Variable Declaration\n",
      "L = 0.6                 #Length of the plate (m) \n",
      "W = 0.4                 #Width of the plates (m)\n",
      "d = 0.03                #Distance between the plates (m)\n",
      "T1 = 394.3              #Temperature at one side of the plate (k)\n",
      "T2 = 366.5              #Temperature at the other side of the plate (k)\n",
      "rho = 0.9295            #Density of air (kg/m3)\n",
      "mu = 2.21e-5            #Viscosity of air (Pa.s)\n",
      "k = 0.03219             #Heat transfer coefficient of wall (W/m.K)\n",
      "Pr = 0.693              #Prandtl number\n",
      "g = 9.806               #Gravitational accleration (m/s)\n",
      "\n",
      "#Calculations\n",
      "Tf = (T1 + T2)/2.\n",
      "beta = 1/Tf\n",
      "Gr = d**3*rho**2*g*beta*(T1-T2)/(mu**2)\n",
      "h = k/d*0.2*(Gr*Pr)**(1./4.)/(L/d)**(1./9.)\n",
      "A = L*W\n",
      "Q = h*A*(T1-T2)\n",
      "\n",
      "#Results\n",
      "print \"Heat Transfer Coefficient\", round(h,3),\"W/m2.K\"\n",
      "print \"Heat Transfer Rate\", round(Q,2),\"W\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat Transfer Coefficient 1.909 W/m2.K\n",
        "Heat Transfer Rate 12.74 W\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8-1 Page Number 261"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Rate of Heat Transfer in a Jacketed Kettle \n",
      "\n",
      "#Variable Declaration\n",
      "Tjs = 115.6                #Temperature of steam being condensed (deg C)\n",
      "dki = 0.656                #Inside diameter of the kettle (m)\n",
      "hk = 0.984                 #Height of the kettle (m)\n",
      "tw = 0.0032                #Thickness of the wall of the jacket (m)\n",
      "k = 16.27                  #Heat transfer coefficient of the wall (W/m.K)\n",
      "hi = 10200.                #Condensing steam cofficient (W/m2.K)\n",
      "Tsat = 100.                #Saturation temperature (deg C)\n",
      "A = 1.0\n",
      "\n",
      "#Calculations\n",
      "Twa = 110.\n",
      "Ri = 1./(hi*A)\n",
      "Rw = tw/(k*A)\n",
      "Riw = Ri + Rw\n",
      "\n",
      "xx = 1.2\n",
      "while(xx > 0.1):\n",
      "    delT = Twa - Tsat \n",
      "    ho = 5.56*delT**3\n",
      "    q = ho*delT\n",
      "    Ro = 1./(ho*A)\n",
      "    Rs = Riw + Ro\n",
      "    delTc = Ro*(Tjs-Tsat)/Rs\n",
      "    Tw = Tsat + delTc\n",
      "    xx = abs(Tw-Twa)\n",
      "    Twa = (Tw + Twa)/2.\n",
      "#Results vary because more iterations are done\n",
      "#Result\n",
      "print \"Ri:%5.2e\" %Ri\n",
      "print \"Rw:%5.2e\" %Rw\n",
      "print \"Ro:%5.2e\" %Ro\n",
      "print 'Wall Temperature: %4.1f'%Tw\n",
      "print \"Boiling Heat Transfer Coefficient\", round(ho,1),\"W/(m2.K)\"\n",
      "print \"Results vary because more iterations are done\"\n",
      "print 'The answers are different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Ri:9.80e-05\n",
        "Rw:1.97e-04\n",
        "Ro:3.28e-04\n",
        "Wall Temperature: 108.2\n",
        "Boiling Heat Transfer Coefficient 3051.0 W/(m2.K)\n",
        "Results vary because more iterations are done\n",
        "The answers are different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.8-2 Page Number 265"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Condensation on Vertical Tubes\n",
      "from math import pi\n",
      "#Variable Declaration English Units\n",
      "Ps, Tsat = 10., 193        #Saturation Pressure ans temperature, psia and \u00b0F\n",
      "L , do = 1., 1./12         #Lenght and ouside diameter of the tube, m\n",
      "Tw = 187.                  #Wall temperature, \u00b0F\n",
      "hv, hl = 1143.3, 161.      #Latent heat of evaporation and enthalpy of liquid \n",
      "vl,vg = 0.01657, 40.95     #specific volume of liquid and vapor, ft3/lbm\n",
      "mul = 0.324                #Viscosity of liquid, lbm/(ft.hr)\n",
      "kl = 0.390                 #Thermal conductivity of liquid, Btu/(ft.hr.\u00b0F)\n",
      "g = 32.174                 #Gravitational acceleration, ft/s2\n",
      "\n",
      "#Calculation English Units\n",
      "g = g*3600**2\n",
      "mul = mul*2.4191\n",
      "rhol , rhov = 1./vl , 1./vg\n",
      "Tf = (Tw + Tsat)/2.\n",
      "hfg = hv-hl\n",
      "delT = Tsat - Tw\n",
      "Nu = 1.13*(rhol**2*g*hfg*L**3/(mul*kl*delT))**(1./4)\n",
      "h=Nu*kl/L\n",
      "A = pi*do*L\n",
      "Q = h*A*delT\n",
      "mdot = Q/hfg\n",
      "Re = 4*mdot/(pi*do*mul)\n",
      "print \"Average heat transfer coefficient\",round(h,2),\"Btu/(h.ft2.\u00b0F)\"\n",
      "print \"Reynolds number is,\", round(Re,1), \"hence flow is laminar\"\n",
      "\n",
      "#Variable Declaration SI Units\n",
      "Ps, Tsat = 68.9, 89.44\n",
      "L , do = 0.305, 0.0254\n",
      "Tw = 86.11\n",
      "hv, hl = 2657800, 374600\n",
      "vl,vg = 0.01657/16, 40.95/16\n",
      "mul = 3.24e-4\n",
      "kl = 0.675\n",
      "g = 9.806\n",
      "\n",
      "#Calculation SI Units\n",
      "\n",
      "rhol , rhov = 1./vl , 1./vg\n",
      "Tf = (Tw + Tsat)/2.\n",
      "hfg = hv-hl\n",
      "delT = Tsat - Tw\n",
      "Nu = 1.13*(rhol**2*g*hfg*L**3/(mul*kl*delT))**(1./4)\n",
      "h=Nu*kl/L\n",
      "A = pi*do*L\n",
      "Q = h*A*delT\n",
      "mdot = Q/hfg\n",
      "Re = 4*mdot/(pi*do*mul)\n",
      "\n",
      "#Results\n",
      "print \"Average heat transfer coefficient\",round(h,2),\"W/(m2.K)\"\n",
      "print \"Reynolds number is,\", round(Re,1), \"hence flow is laminar\"\n",
      "print 'The answers are different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Average heat transfer coefficient 2353.51 Btu/(h.ft2.\u00b0F)\n",
        "Reynolds number is, 73.4 hence flow is laminar\n",
        "Average heat transfer coefficient 13354.93 W/(m2.K)\n",
        "Reynolds number is, 73.3 hence flow is laminar\n",
        "The answers are different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9-1 Page Number 271"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Temperature Correction Factor for a Heat Exchanger\n",
      "\n",
      "#Variable Declration\n",
      "mdotc = 2.52              #Mass flow rate of water, kg/s \n",
      "Tci, Tco = 21.1, 54.4     #Inlet and outlet temperature of cold water, \u00b0C\n",
      "Thi, Tho = 115.6, 48.9    #Inlet and outlet temperature of hot water, \u00b0C\n",
      "Ao = 9.3                  #Outside surface area of exchanger, m2\n",
      "Cp = 4187.                #mean specific heat of water, J/(kg.K)\n",
      "\n",
      "#Calculations\n",
      "Qc= mdotc*Cp*(Tco-Tci)\n",
      "delT1 = Thi-Tco\n",
      "delT2 = Tho-Tci\n",
      "delTLM = (delT1-delT2)/log(delT1/delT2)\n",
      "Z = (Thi-Tho)/(Tco-Tci)\n",
      "Y = (Tco-Tci)/(Thi-Tci)\n",
      "                #PART \"A\" 1-2 pass \n",
      "Fta = 0.74          # correction factor for Z and Y values in part a from chart\n",
      "delTMa = Fta*delTLM\n",
      "Uoa = Qc/(Ao*delTMa)\n",
      "                #PArt \"B\" 2-4\n",
      "Ftb = 0.94         # correction factor for Z and Y values in part b from chart\n",
      "delTMb = Ftb*delTLM\n",
      "Uob = Qc/(Ao*delTMb)\n",
      "#Result\n",
      "print \"PART A\"\n",
      "print \"Mean Temperature Difference for 1-2 pass Heat Exchanger\", round(delTMa,1),\"\u00b0C or K\"\n",
      "print \"Required Overall outside Heat Transfer coefficient for 1-2 pass\", round(Uoa,1),\"W/(m.K)\"\n",
      "\n",
      "print \"PART B\"\n",
      "print \"Mean Temeperature Difference for 2-4 pass Heat Exchanger\", round(delTMb,1),\"\u00b0C or K\"\n",
      "print 'The answers are different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "PART A\n",
        "Mean Temperature Difference for 1-2 pass Heat Exchanger 31.3 \u00b0C or K\n",
        "Required Overall outside Heat Transfer coefficient for 1-2 pass 1206.2 W/(m.K)\n",
        "PART B\n",
        "Mean Temeperature Difference for 2-4 pass Heat Exchanger 39.8 \u00b0C or K\n",
        "The answers are different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.9-2 Page Number 275"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Effectiveness of Heat Exchanger\n",
      "from math import exp\n",
      "#Variable Declaration\n",
      "mc, mh  = 0.667, 2.85        #mass flow rate of cold water and hot oil,kg/s\n",
      "cpc, cph = 4192., 1890.      #Specific heat of cold water and hot oil,kJ/(kg.K)\n",
      "Tci,Thi = 308., 383.         #Inlet temperatures of cold water and hot oil, \u00b0C\n",
      "U,A = 300., 15.              #Overall heat transfer coefficient W/(m2.K) and Surface area, m2\n",
      "\n",
      "#Calcualtions\n",
      "Cc = mc*cpc       #(m*cp)C\n",
      "Ch = mh*cph       #(m*cp)H\n",
      "if Cc > Ch:\n",
      "    Cmin = Ch\n",
      "    Cmax = Cc\n",
      "else:\n",
      "    Cmin = Cc\n",
      "    Cmax = Ch\n",
      "\n",
      "NTU = U*A/Cmin\n",
      "Cminbymax = Cmin/Cmax\n",
      "\n",
      "#Using figure \"a\" on page 274\n",
      "Enum = 1. - exp(-NTU*(1-Cminbymax))\n",
      "Eden = 1. - Cminbymax*exp(-NTU*(1-Cminbymax))\n",
      "Tco= 350.\n",
      "epsilon = Enum/Eden\n",
      "\n",
      "Q = epsilon*Cmin*(Thi-Tci)\n",
      "Tco = Q/Cmin + Tci\n",
      "\n",
      "#Results     \n",
      "print \"Heat Tranfer Rate\", round(Q,2),\"W\" \n",
      "print \"Outlet Temperature of cold fluid\", round(Tco,1),\"K\"\n",
      "print 'The answers are different than book because book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "0.708413929951\n",
        "Heat Tranfer Rate 148557.8 W\n",
        "Outlet Temperature of cold fluid 361.1 K\n",
        "The answers are different than book because book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10-1 Page Number 279"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Radiation to Metal Tube\n",
      "import scipy.constants as sc\n",
      "from math import pi\n",
      "\n",
      "#Variable Declaration\n",
      "do, L = 0.0254, 0.61      #Outside diameter of tube, and length, m \n",
      "Ts = 588.                 #Surface temperature of the tube, K\n",
      "ep = 0.6                  #emmisivity of metal tube at 1088 K\n",
      "Te = 1088.                #Temperature of surrounding air, K\n",
      "\n",
      "#Calculations \n",
      "        #SI Units\n",
      "A = pi*do*L\n",
      "Q = ep*A*5.676e-8*(Ts**4-Te**4)\n",
      "\n",
      "print \"Heat Transferred to tube from the surrounding in SI units\", round(Q,1), \"W\"\n",
      "\n",
      "#Variable Declaration\n",
      "do, L = 1./12, 2.0       #Outside diameter of tube, and length, ft \n",
      "Ts = 600                 #Surface temperature of the tube, \u00b0F\n",
      "ep = 0.6                 #emmisivity of metal tube at 1500 \u00b0F\n",
      "Te = 1500.               #Temperature of surrounding air, \u00b0F\n",
      "\n",
      "#Calculations \n",
      "        #English Units\n",
      "A = pi*do*L\n",
      "Q = ep*A*0.1714e-8*((Ts+460)**4-(Te+460)**4)\n",
      "print \"Heat Transferred to tube from the surrounding in English units\", round(Q,1), \"Btu/hr\"\n",
      "print 'The answers are different than book, because of book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat Transferred to tube from the surrounding in SI units -2124.7 W\n",
        "Heat Transferred to tube from the surrounding in English units -7266.9 Btu/hr\n",
        "The answers are different than book, because of book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.10-2 Page Number 280"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Combined Covection Plus Radiation from a Tube\n",
      "import scipy.constants as sc\n",
      "from math import pi\n",
      "\n",
      "#Variable declaration\n",
      "do, L = 0.0254, 0.61     #Outside diameter of tube, and length, m \n",
      "Ts = 588.                #Surface temperature of the tube, K\n",
      "ep = 0.6                 #emmisivity of metal tube at 1088 K\n",
      "Te = 1088.               #Temperature of surrounding air, K\n",
      "\n",
      "#Calculations\n",
      "A = pi*do*L\n",
      "hc = 1.32*((Te-Ts)/do)**0.25\n",
      "hr = ep*5.676e-8*(Te**4-Ts**4)/(Te-Ts)\n",
      "Q = A*(hc + hr)*(Ts-Te)\n",
      "#Results\n",
      "print \"Convective Heat Transfer Coefficient\",round(hc,2)\n",
      "print \"Radiation Heat Transfer Coefficient\",round(hr,2)\n",
      "print \"Heat Transferred to the tube from the surrounding\", round(Q,2), \"W\"\n",
      "print 'The answers are different than book, because of book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Convective Heat Transfer Coefficient 15.64\n",
        "Radiation Heat Transfer Coefficient 87.3\n",
        "Heat Transferred to the tube from the surrounding -2505.23 W\n",
        "The answers are different than book, because of book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11-1 Page Number 285"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Radiation between Parallel Plated\n",
      "import scipy.constants as sc\n",
      "\n",
      "#Variable declaration \n",
      "ep1, ep2 = 0.8, 0.7       #emmissivities of plate 1 and 2\n",
      "T1, T2 = 866.5, 588.8     #Temperatures of surface 1 and 2, K\n",
      "\n",
      "#Calculations PART \"SI\"\n",
      "q12 = 5.676e-8*(T1**4-T2**4)/(1./ep1+1./ep2-1.)\n",
      "q12b = 5.676e-8*(T1**4-T2**4)\n",
      "#Results\n",
      "print \"SI Units\"\n",
      "print \"a)  Heat Flux from Plate 1 to Plate 2\", round(q12,2),\"W/m2\"\n",
      "print \"b)  Heat Flux from Plate 1 to Plate 2 when both surfaces are balck body\", round(q12b,2),\"W/m2\"\n",
      "#Variable declaration \n",
      "\n",
      "\n",
      "#Calculations PART \"British\"\n",
      "ep1, ep2 = 0.8, 0.7     #emmissivities of plate 1 and 2\n",
      "T1, T2 = 1100, 600      #Temperatures of surface 1 and 2, \u00b0F\n",
      "\n",
      "q12 = 0.1714e-8*((T1+460)**4-(T2+460)**4)/(1./ep1+1./ep2 -1.)\n",
      "q12b = 0.1714e-8*((T1+460)**4-(T2+460)**4)\n",
      "\n",
      "#Results\n",
      "print \"English Units\"\n",
      "print \"a)  Heat Flux from Plate 1 to Plate 2\", round(q12,2),\"Btu/ft2.h\"\n",
      "print \"b)  Heat Flux from Plate 1 to Plate 2 when both surfaces are balck body\", round(q12b,2),\"Btu/ft2.h\"\n",
      "print 'The answers are different than book, because of book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "SI Units\n",
        "a)  Heat Flux from Plate 1 to Plate 2 14998.18 W/m2\n",
        "b)  Heat Flux from Plate 1 to Plate 2 when both surfaces are balck body 25175.52 W/m2\n",
        "English Units\n",
        "a)  Heat Flux from Plate 1 to Plate 2 4758.29 Btu/ft2.h\n",
        "b)  Heat Flux from Plate 1 to Plate 2 when both surfaces are balck body 7987.12 Btu/ft2.h\n",
        "The answers are different than book, because of book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.11-7 Page Number 296"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Gas Radiation to a Furnace Enclosure\n",
      "import scipy.constants as sc\n",
      "\n",
      "#Variable Declaration\n",
      "L = 0.3             #Inside length of cubical furnace, m    \n",
      "P = 1.              #Pressure of gas inside furnace, atm\n",
      "Tg = 1100.          #Temperature of gas, K\n",
      "Tw = 600.           #Temperature of furnace wall, K \n",
      "xco2 = 0.1          #mole fraction of CO2  \n",
      "\n",
      "#Calculations\n",
      "Lbm = .60*L\n",
      "pco2 = P*xco2\n",
      "pgL = pco2*Lbm\n",
      "        #from figure 4.11-10\n",
      "epg = 0.064\n",
      "alphag600 = pgL*(Tw/Tg)\n",
      "alphaguc = 0.048\n",
      "alphagc = alphaguc*(Tg/Tw)**0.65\n",
      "q = sc.sigma*(epg*Tg**4-alphagc*Tw**4)\n",
      "A = L*L*6\n",
      "Q = q*A\n",
      "\n",
      "#Results\n",
      "print \"Heat Transfer rate in Gas radiation\", round(Q/1000,3), \"kW\"\n",
      "print 'The answer is different than book, because of book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Heat Transfer rate in Gas radiation 2.587 kW\n",
        "The answers are different than book, because of book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 2,
     "metadata": {},
     "source": [
      "Example 4.12-1 Page Number 298"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heating a Non-Newtonian Fluid in Laminar Flow\n",
      "from scipy.optimize import root\n",
      "\n",
      "#Variable Declaration\n",
      "mdot = 7.56e-2     #Mass flow rate of non-Newtonian fluid, kg/s\n",
      "di = 0.0254        #Inside Diameter of the tube, m\n",
      "L = 1.524          #Length of the tube, m\n",
      "Ti =  37.8         #Inlet temperature of the fluid, \u00b0C \n",
      "Tw = 93.3          #Inside wall temperature, \u00b0C\n",
      "rho = 1041.        #density of fluid, kg/m3\n",
      "cpm = 2.093e3      #specific heat of fluid, J/(kg.K)\n",
      "k =  1.212         #Thermal conductivity of fluid, W/(m.K)        \n",
      "n = 0.4            #Rheological constants for fluid\n",
      "K378 = 139.9       \n",
      "K933 = 62.5\n",
      "\n",
      "#Calculations\n",
      "Tbo = 54.4\n",
      "Tb = (Ti + Tbo)/2.0\n",
      "slope = (log(K378)-log(K933))/(Ti-Tw)\n",
      "c = log(139.9)-slope*Ti\n",
      "Kb = exp(slope*Tb+c)\n",
      "Kw = exp(slope*Tw+c)\n",
      "delta = (3.*n+1)/(4*n)\n",
      "NGz = mdot*cpm/(k*L)\n",
      "gamabw = Kb/Kw\n",
      "Nu = 1.75*delta**(1./3)*NGz**(1./3)*gamabw**0.14\n",
      "\n",
      "ha = k*Nu/di\n",
      "Tk = (2.*Tw-Ti)/2.\n",
      "mT = 1./2\n",
      "\n",
      "f = lambda T: mdot*cpm*(T-Ti)-ha*pi*di*L*(Tk-mT*T)\n",
      "sol = root(f,25)\n",
      "Tbo = sol.x[0]\n",
      "\n",
      "#Results\n",
      "print \"Gratez Number\", round(NGz,1)\n",
      "print \"Heat Transfer Coefficient\", round(ha,1),\"W/m2.K\"\n",
      "print \"Oultlet bulk temperature of the fluid\",round(Tbo,1),\"\u00b0C\"  \n",
      "print 'The answers are different than book, because of book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Gratez Number 85.7\n",
        "Heat Transfer Coefficient 450.5 W/m2.K\n",
        "Oultlet bulk temperature of the fluid 54.2 \u00b0C\n",
        "The answers are different than book, because of book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 22
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 4.13-1 Page Number 301"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Heat Transfer Coefficient in Agitated Vessel\n",
      "\n",
      "#Variable Declaration\n",
      "Dt = 1.83       #Diameter of agitated vessel,m\n",
      "Tl = 300.       #Temperature of liquid to be heated, K\n",
      "Da = 0.61       #Diameter of agitator vessel,m\n",
      "N = 100.        #RPM of agitator\n",
      "Tw = 355.4      #Wall temperature of Jaket, K\n",
      "rho = 961.      #Density of liquid, kg/m3\n",
      "cp = 2500.      #Density of liquid, K/(kg.K)\n",
      "k = 0.173       #Thermal conductivity of liquid, W/(m.K)\n",
      "mu = 1.0        #Viscosity of liquid at 300K, Pa.s\n",
      "muw = 0.084     #Viscosity of liquid at Wall temperature 355.5K, Pa.s\n",
      "\n",
      "#Calculations\n",
      "Nre = Da**2*(N/60)*rho/mu\n",
      "Npr = cp*mu/k\n",
      "#for equation 4.13-1 a = 0.74, b=2/3\n",
      "a = 0.74\n",
      "b = 2./3\n",
      "Nu = a*Nre**b*Npr**(1./3)*(mu/muw)**0.14\n",
      "h = Nu*k/Dt\n",
      "\n",
      "#Results\n",
      "print 'Reynolds number is %3.0f'%Nre\n",
      "print 'Prandtl number is %5.0f'%Npr\n",
      "print \"Heat transfer coefficient to the wall of jacket\",round(h,1),\"W/(m2.K)\"\n",
      "print 'The answers are different than book, because of book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Reynolds number is 596\n",
        "Prandtl number is 14451\n",
        "Heat transfer coefficient to the wall of jacket 170.7 W/(m2.K)\n",
        "The answers are different than book, because of book uses rounded numbers\n"
       ]
      }
     ],
     "prompt_number": 29
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 4.13-2 Page Number 306"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Fin efficiency and Heat Loss from Fin\n",
      "\n",
      "#Variable Declaration\n",
      "k = 222.        #W/(m.K)\n",
      "r1 = 0.04       #Outer radius of tube, m\n",
      "L = 0.04        #Fin length, m \n",
      "To = 523.2      #Fin base temperature, K\n",
      "Ta = 343.2      #Surrounding Temperature, K\n",
      "t = 2./1000     #Thickness of fin, m\n",
      "h = 30.         #Surrounding convective coefficient, W/(m2.K)\n",
      "\n",
      "#Calculation\n",
      "Lc = L + t/2\n",
      "asbc = Lc*(h/k*t)**0.5\n",
      "param = (Lc+r1)/r1\n",
      "#From fig4.13-5 b for parameter and abscisa value eff = 0.89\n",
      "eff = 0.89\n",
      "Afc = 2*pi*((Lc+r1)**2-r1**2)\n",
      "qf = eff*h*Afc*(To-Ta)\n",
      "\n",
      "#Result\n",
      "print \"Efficiency of the fin is\", round(eff,4)\n",
      "print \"Rate of Heat Loss\", round(qf,1),\"W\"\n",
      "print 'The answers are different than book, because of book uses rounded numbers'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Efficiency of the fin is 0.89\n",
        "Rate of Heat Loss 149.8 W\n"
       ]
      }
     ],
     "prompt_number": 30
    },
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Example 4.15-1 Page Number 313"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Steady State Heat Conduction in Two Directions\n",
      "import numpy as np\n",
      "\n",
      "#Variable Declaration\n",
      "D = 8.0            #Ouside dimention of square, m\n",
      "Hi = 4.0           #Inside Height of chamber, m\n",
      "Wi = 2.0           #Inside width of chamber, m\n",
      "Ti = 600.0         #Inside Temperature of chamber, K\n",
      "To = 300.0         #Outside Temperature of chamber, K\n",
      "k = 1.5            #Thermal conductivity of material, W/(m.K)\n",
      "Gl = Gw = 1.0      #Grid size in Height and width Directions, m\n",
      "L = 1.0            #Length of Chamber, m\n",
      "\n",
      "#Calculations\n",
      "np.set_printoptions(precision=1)\n",
      "#Column indices used are one less than used in book\n",
      "T0 = np.zeros(3)\n",
      "T1 = np.zeros(3)\n",
      "T2 = np.zeros(6)\n",
      "T3 = np.zeros(6)\n",
      "T4 = np.zeros(6)\n",
      "T5 = np.zeros(6)\n",
      "    \n",
      "def printT():\n",
      "    print 'Temperature at various nodes are as follows'\n",
      "    print 'T   2      3      4      5'\n",
      "    print 1,T1[1:2]\n",
      "    print 2,T2[1:2]\n",
      "    print 3,T3[1:5]\n",
      "    print 4,T4[1:5]\n",
      "\n",
      "\n",
      "#Initialize\n",
      "T0[2]=T1[2]=T2[2]=T2[3]=T2[4]=T2[5]=600.                                #INNER NODES \n",
      "T0[0]=T1[0]=T2[0]=T3[0]=T4[0]=T5[0]=T5[1]=T5[2]=T5[3]=T5[4]=T5[5]=300   #outer nodes\n",
      "T1[1]=T3[3]=450.\n",
      "T2[1]=T3[1]=T3[2]=T4[4]=400.\n",
      "T3[4]=500.\n",
      "T4[1]=325.\n",
      "T4[2]=350.\n",
      "T4[3]=375.\n",
      "T0[1]=T2[1]\n",
      "T3[5]=T3[3]\n",
      "T4[5]=T4[3]\n",
      "\n",
      "r = 1.2           #Initial value of residue\n",
      "\n",
      "#Calculations\n",
      "while abs(r)>0.001:\n",
      "    r11 = T1[0]+T1[2]+T0[1]+T2[1]-4*T1[1]\n",
      "    T1[1]=(T1[0]+T1[2]+T0[1]+T2[1])/4\n",
      "    r21 = (T2[0]+T2[2]+T1[1]+T3[1]-4*T2[1])\n",
      "    T2[1]=T0[1]=(T2[0]+T2[2]+T1[1]+T3[1])/4\n",
      "    r31=(T3[0]+T3[2]+T2[1]+T4[1]-4*T3[1])\n",
      "    T3[1]=(T3[0]+T3[2]+T2[1]+T4[1])/4\n",
      "    r32 = T2[2]+T4[2]+T3[1]+T3[3]-4*T3[2]\n",
      "    T3[2] =(T2[2]+T4[2]+T3[1]+T3[3])/4\n",
      "    r33 = T3[2]+T3[4]+T2[3]+T4[3]-4*T3[3]\n",
      "    T3[3]=T3[5]=(T3[2]+T3[4]+T2[3]+T4[3])/4\n",
      "    r34 = T3[3]+T3[5]+T2[4]+T4[4]-4*T3[4]\n",
      "    T3[4]=(T3[3]+T3[5]+T2[4]+T4[4])/4\n",
      "    r41 = T4[0]+T4[2]+T3[1]+T5[1]-4*T4[1]\n",
      "    T4[1]=(T4[0]+T4[2]+T3[1]+T5[1])/4\n",
      "    r42 = T4[1]+T4[3]+T3[2]+T5[2]-4*T4[2]\n",
      "    T4[2]=(T4[1]+T4[3]+T3[2]+T5[2])/4\n",
      "    r43 = T4[2]+T4[4]+T3[3]+T5[3]-4*T4[3]\n",
      "    T4[3]=T4[5]=(T4[2]+T4[4]+T3[3]+T5[3])/4\n",
      "    r44 = T4[3]+T4[5]+T3[4]+T5[4]-4*T4[4]\n",
      "    T4[4] = (T4[3]+T4[5]+T3[4]+T5[4])/4\n",
      "    r = r11+r21+r31+r32+r33+r34+r41+r42+r43+r44\n",
      "    \n",
      "#Results\n",
      "print 'Recidue at convergence %10.8f'%r\n",
      "printT()\n",
      "Q1 = 4*k*(0.5*(T1[2]-T1[1]) + (T2[2]-T2[1]) + (T2[2]-T3[2]) + (T2[3]-T3[3]) + 0.5*(T2[4]-T3[4]))\n",
      "Q2 = 4*k*(0.5*(T1[1]-T1[0]) + (T2[1]-T2[0]) + (T3[1]-T3[0]) + (T4[1]-T4[0]) + (T4[1]-T5[1])+(T4[2]-T5[2])+(T4[3]-T5[3])+0.5*(T4[4]-T5[4]))\n",
      "print 'Heat transfer from inner surface %5.1f into the solid'%Q1\n",
      "print 'Heat transfer from outer surface %5.1f out from solid'%Q2\n",
      "Qavg = (Q1+Q2)*0.5\n",
      "print \"Average Heat loss per unit chamber length\",round(Qavg,1),\"W/m\"\n",
      "print 'Book is using rounded values of temperature throughout the iterations hence answers are different'"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Recidue at convergence 0.00090090\n",
        "Temperature at various nodes are as follows\n",
        "T   2      3      4      5\n",
        "1 [ 440.3]\n",
        "2 [ 430.6]\n",
        "3 [ 382.   459.2  483.7  489.5]\n",
        "4 [ 338.2  370.9  386.3  390.5]\n",
        "Heat transfer from inner surface 3369.8 into the solid\n",
        "Heat transfer from outer surface 3369.8 out from solid\n",
        "Average Heat loss per unit chamber length 3369.8 W/m\n",
        "Book is using rounded values of temperature throughout the iterations hence answers are different\n"
       ]
      }
     ],
     "prompt_number": 19
    }
   ],
   "metadata": {}
  }
 ]
}