summaryrefslogtreecommitdiff
path: root/Principles_And_Modern_Applications_Of_Mass_Transfer_Operations/chapter1.ipynb
blob: 398a4b40cdd0de2b7a015dc403f1122a5a6061c5 (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
{
 "metadata": {
  "name": ""
 },
 "nbformat": 3,
 "nbformat_minor": 0,
 "worksheets": [
  {
   "cells": [
    {
     "cell_type": "heading",
     "level": 1,
     "metadata": {},
     "source": [
      "Chapter 1:. Fundamentals of Mass Transfer"
     ]
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.1 Page number:6"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "T = 300  # [K]\n",
      "P = 500  # [kPa]\n",
      "R = 8.314  # [J/mole.K]\n",
      "\n",
      "\n",
      "# Solution (a)\n",
      "# Using equation 1.7 \n",
      "C = P/(R*T)  # [Total molar concentration, kmole/cubic m]\n",
      "print\"Total molar concentration in the gas feed is\",round(C,1),\"kmole/cubic m\\n\\n\" \n",
      "\n",
      "#Illustration 1.1 (b)\n",
      "# Solution (b)\n",
      "\n",
      "# Mixture of gases \n",
      "# Components  a-CH4 , b-C2H6 , c-nC3H8 , d-nC4H10\n",
      "# Basis: 100 kmole of gas mixture\n",
      "n_a = 88  # [kmole]\n",
      "n_b = 4  # [kmole]\n",
      "n_c = 5  # [kmole]\n",
      "n_d = 3  # [kmole]\n",
      "M_a = 16.04  # [gram/mole]\n",
      "M_b = 30.07  # [gram/mole]\n",
      "M_c = 44.09  # [gram/mole]\n",
      "M_d = 58.12  # [gram/mole]\n",
      "m_a = n_a*M_a  # [kg]\n",
      "m_b = n_b*M_b  # [kg]\n",
      "m_c = n_c*M_c  # [kg]\n",
      "m_d = n_d*M_d  # [kg]\n",
      "n_total = n_a+n_b+n_c+n_d  # [kmole]\n",
      "m_total = m_a+m_b+m_c+m_d  # [kg]\n",
      "M_avg = m_total/n_total  # [kg/kmole]\n",
      "row = C*M_avg  # [mass density, kg/cubic m]\n",
      "print\"Average molecular weight of gas feed is \",round(M_avg,2),\"kg/kmole\\n\" \n",
      "print\"Density of gas feed is \",round(row,2),\"kg/cubic m\\n\\n\" \n",
      "\n",
      "#Illustration 1.1 (c)\n",
      "\n",
      "\n",
      "# Mass fraction of each component\n",
      "x_a = m_a/m_total \n",
      "x_b = m_b/m_total \n",
      "x_c = m_c/m_total \n",
      "x_d = m_d/m_total \n",
      "print\"Mass fraction of CH4, C2H6, nC3H8, nC4H10 are\",round(x_a,3),round(x_b,3),round(x_c,3),round(x_d,3),\"respectively\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total molar concentration in the gas feed is 0.2 kmole/cubic m\n",
        "\n",
        "\n",
        "Average molecular weight of gas feed is  19.27 kg/kmole\n",
        "\n",
        "Density of gas feed is  3.86 kg/cubic m\n",
        "\n",
        "\n",
        "Mass fraction of CH4, C2H6, nC3H8, nC4H10 are 0.733 0.062 0.114 0.091 respectively\n"
       ]
      }
     ],
     "prompt_number": 1
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.2 Page number:7"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "# Component  a-KNO3   b-H20\n",
      "T = 293.0  # [K]\n",
      "s_eqm = 24.0  # [percent by weight, %]\n",
      "row = 1162.0  # [density of saturated solution, kg/cubic m]\n",
      "\n",
      "\n",
      "#Illustration 1.2 (a) \n",
      "# Solution (a)\n",
      "\n",
      "# Basis: 100 kg of fresh wash solution\n",
      "m_a = (s_eqm/100)*100  # [kg]\n",
      "m_b = 100 - m_a  # [kg]\n",
      "M_a = 101.10  # [gram/mole]\n",
      "M_b = 18.02  # [gram.mole]\n",
      "\t# Therefore moles of component 'a' and 'b' are\n",
      "n_a = m_a/M_a  # [kmole]\n",
      "n_b = m_b/M_b  # [kmole]\n",
      "\n",
      "m_total = 100  # [basis, kg]\n",
      "n_total = n_a+n_b  # [kmole]\n",
      "\t# Average molecular weight\n",
      "M_avg = m_total/n_total  # [kg/kmole]\n",
      "\t# Total molar density of fresh solution\n",
      "C = row/M_avg  # [kmole/cubic m]\n",
      "print\"Total molar density of fresh solution is\",round(C,2),\"kmole/cubic m\\n\\n\" \n",
      "\n",
      "#Illustration 1.2 (b)\n",
      "# Solution (b)\n",
      "\n",
      "# mole fractions of components 'a' and 'b'\n",
      "x_a = n_a/n_total \n",
      "x_b = n_b/n_total \n",
      "print\"Mole fraction of KNO3 and H2O is\",round(x_a,3),round(x_b,3)  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Total molar density of fresh solution is 51.77 kmole/cubic m\n",
        "\n",
        "\n",
        "Mole fraction of KNO3 and H2O is 0.053 0.947\n"
       ]
      }
     ],
     "prompt_number": 2
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.3 Page number:9"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "f_a = 45.0  \t\t\t\t# [percent of blood cells by volume]\n",
      "f_b = 55.0  \t\t\t\t# [percent of plasma by volume]\n",
      "r = 1200.0  \t\t\t\t# [Rate of blood which is pumped through artificial \t\t\t\t\tkidney, mL/minute]\n",
      "m_urine = 1540.0  \t\t\t# [mass of urine collected, g]\n",
      "x_u = 1.3  \t\t\t\t# [urea concentration, percent by weight]\n",
      "        # Data for sample of blood plasma\n",
      "c_urea = 155.3  \t\t\t# [mg/dL]\n",
      "d = 1.0245  \t\t\t\t# [specfic gravity of plasma]\n",
      "\n",
      "#CALCULATION\n",
      "\t#Illustration 1.3 (a)\n",
      "\t# Solution (a)\n",
      "\n",
      "\t# Basis: 4 hours\n",
      "\t# Assuming that the rate of formation and decomposition of urea during the procedure is \t\tnegligible and that no urea is removed by the patient\u2019s kidneys\n",
      "\t# Therefore urea in \u201cclean\u201d blood = urea in \u201cdirty\u201d blood - urea in urine\n",
      "\n",
      "m_u = m_urine*(x_u/100)  \t\t# [mass of urea in urine, g]\n",
      "\t# total volume of plasma that flows through the artificial kidney in 4 hours\n",
      "V_b = r*60*(f_b/100)*(1.0/100.0)*4  \t# [dL]\n",
      "\t# urea in dirty blood from given plasma concentration\n",
      "m_ud = c_urea*(1.0/1000.0)*V_b  \t# [g]\n",
      "\t\t\t\t\t# urea removal efficiency\n",
      "n = (m_u/m_ud)*100 \n",
      "#RESULT\n",
      "print\"Urea removal efficiency is \",round(n,1),\"%\"\n",
      "  \n",
      "\t#Illustration 1.3 (b)\n",
      "\t# Solution (b)\n",
      "#CALCULATION\n",
      "m_uc = m_ud-m_u  \t\t\t# [mass of urea on clean blood, g]\n",
      "m_p = d*100*V_b  \t\t\t# [Mass of plasma entering, g]\n",
      "m_rem = m_p-m_urine  \t\t\t# [Mass of plasma remaining, g]\n",
      "V_brem = m_rem/(d*100)  \t\t# [Volume of plasma remaining, dL]\n",
      "#RESULT\n",
      "c_y = (m_uc*1000)/V_brem  \t\t# [urea concentration in remaining plasma, mg/dL]\n",
      "print\"urea concentration in the plasma of the cleansed blood is\",round(c_y),\"mg/dL\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Urea removal efficiency is  8.1 %\n",
        "urea concentration in the plasma of the cleansed blood is 144.0 mg/dL\n"
       ]
      }
     ],
     "prompt_number": 3
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.6 Page number:21"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#VARIABLE DECLARATION\n",
      "\n",
      "T = 273  \t\t\t\t# [K]\n",
      "P = 1 \t\t\t\t\t# [bar]\n",
      "\t# 1 bar = 10**5 Pa\n",
      "\t# Values of the Lennard-Jones parameters (sigma and E/K) are obtained from Appendix B:\n",
      "sigma_a = 4.483  \t\t\t# [1st Lennard-Jones parameter, Angstrom]\n",
      "sigma_b = 3.620  \t\t\t# [Angstrom]\n",
      "d_a = 467.0  \t\t\t\t# [d = E/K 2nd Lennard-Jones parameter, K]\n",
      "d_b = 97.0  \t\t\t\t# [K]\n",
      "M_a = 76.0  \t\t\t\t# [gram/mole]\n",
      "M_b = 29.0  \t\t\t\t# [gram/mole]\n",
      "\n",
      "\n",
      "#CALCULATION\n",
      "\n",
      "sigma_ab = (sigma_a+sigma_b)/2  \t\t# [Angstrom]\n",
      "d_ab =math.sqrt(d_a*d_b)  \t\t# [K]\n",
      "M_ab = 2/((1/M_a)+(1/M_b))  \t\t\t# [gram/mole]\n",
      "T_star = T/d_ab \n",
      "a = 1.06036 \n",
      "b = 0.15610  \n",
      "c = 0.19300  \n",
      "d = 0.47635  \n",
      "e = 1.03587  \n",
      "f = 1.52996  \n",
      "g = 1.76474  \n",
      "h =3.89411  \n",
      "ohm = ((a/T_star**b)+(c/math.exp(d*T_star))+(e/math.exp(f*T_star))+(g/math.exp(h*T_star))) \n",
      "\n",
      "\t# Substituting these values into the Wilke-Lee equation yields (equation 1.49)\n",
      "D_ab = ((10**-3*(3.03-(.98/math.sqrt(M_ab)))*T**1.5)/(P*(math.sqrt(M_ab))*(sigma_ab**2)*ohm))  \t\t\n",
      "#RESULT\n",
      "\t\t\t\t\t\t# [square cm/s]\n",
      "print\"The diffusivity of carbon disulfide vapor in air at 273 K and 1 bar is\",round(D_ab,4),\"square cm/s\\n\" \n",
      "\n",
      "\t# The math.experimental value of D_ab obtained from Appendix A:\n",
      "D_abexp = (.894/(P*10**5))*10**4  \t\t\t# [square cm/s]\n",
      "percent_error = ((D_ab-D_abexp)/D_abexp)*100  \t\t# [%]\n",
      "\n",
      "#RESULT\n",
      "\n",
      "print\"The percent error of the estimate, compared to the math.experimental value is\",round(percent_error,1),\"%\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusivity of carbon disulfide vapor in air at 273 K and 1 bar is 0.0952 square cm/s\n",
        "\n",
        "The percent error of the estimate, compared to the math.experimental value is 6.5 %\n"
       ]
      }
     ],
     "prompt_number": 4
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.7 Page number:22"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#VARIABLE DECLARATION\n",
      "\n",
      "\t#   A-C3H5Cl    B-air\n",
      "T = 298.0  \t\t\t\t\t# [K]\n",
      "P = 1.0  \t\t\t\t\t\t# [bar]\n",
      "\n",
      "\t# Values of the Lennard-Jones parameters for allyl chloride must be estimated from \t\tequations (1.46) and (1.47).\n",
      "\t\t# From Table 1.2\n",
      "V_bA = 3*14.8+5*3.7+24.6  \t\t\t# [cubic cm/mole]\n",
      "\t\t\t\t\t\t# From equation 1.46\n",
      "sigma_A = 1.18*(V_bA)**(1.0/3.0)  \t\t\t# [1st Lennard-Jones parameter, Angstrom]\n",
      "\t# Normal boiling-point temperature for allyl chloride is Tb = 318.3 K\n",
      "\t# From equation 1.47, E/K = 1.15*Tb\n",
      "T_b = 318.3 \t\t\t\t\t# [K]\n",
      "d_A = 1.15*T_b  \t\t\t\t# [2nd Lennard-Jones parameter for C3H5Cl  E/K, \t\t\t\t\t\t\tK]\n",
      "M_A = 76.5  \t\t\t\t\t# [gram/mole]\n",
      "\n",
      "\t# Lennard-Jones parameters for air\n",
      "sigma_B = 3.62  \t\t\t\t# [Angstrom]\n",
      "d_B = 97  \t\t\t\t\t# [2nd Lennard-Jones parameter for air E/K, K]\n",
      "\n",
      "M_B = 29.0  \t\t\t\t\t# [gram/mole]\n",
      "\n",
      "sigma_AB = (sigma_A+sigma_B)/2  \t\t# [Angstrom]\n",
      "d_AB = math.sqrt(d_A*d_B)  \t\t\t# [K]\n",
      "M_AB = 2/((1/M_A)+(1/M_B))  \t\t\t# [gram/mole]\n",
      "\n",
      "T_star = T/d_AB \n",
      "a = 1.06036  \n",
      "b = 0.15610  \n",
      "c = 0.19300  \n",
      "d = 0.47635 \n",
      "e = 1.03587  \n",
      "f = 1.52996  \n",
      "g = 1.76474  \n",
      "h =3.89411  \n",
      "ohm = ((a/T_star**b)+(c/math.exp(d*T_star))+(e/math.exp(f*T_star))+(g/math.exp(h*T_star))) \n",
      " \n",
      "\t# Substituting these values into the Wilke-Lee equation yields (equation 1.49)\n",
      "D_AB = ((10**-3*(3.03-(.98/math.sqrt(M_AB)))*T**1.5)/(P*(math.sqrt(M_AB))*(sigma_AB**2)*ohm))  # [square cm/s]\n",
      "print\"The diffusivity of allyl chloride in air at 298 K and 1 bar is\",round(D_AB,4),\"square cm/s\\n\"\n",
      "\n",
      "\t# The experimental value of D_AB reported by Lugg (1968) is 0.098 square cm/s\n",
      "D_ABexp = .098  \t\t\t\t\t# [square cm/s]\n",
      "percent_error = ((D_AB-D_ABexp)/D_ABexp)*100  \t\t# [%]\n",
      "print\"The percent error of the estimate, compared to the experimental value is\",round(percent_error,1),\"%\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusivity of allyl chloride in air at 298 K and 1 bar is 0.0992 square cm/s\n",
        "\n",
        "The percent error of the estimate, compared to the experimental value is 1.2 %\n"
       ]
      }
     ],
     "prompt_number": 5
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.8 Page number:26"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable declaration\n",
      "\n",
      "\t# solute A-C2H60   solvent B-water\n",
      "T = 288\t\t  \t\t\t\t# [K]\n",
      "\n",
      "\t# Critical volume of solute\n",
      "V_c = 167.1  \t\t\t\t\t# [cubic cm/mole]\n",
      "\t# Calculating molar volume using equation 1.48\n",
      "V_ba = 0.285*(V_c)**1.048  \t\t\t# [cubic cm/mole]\n",
      "u_b = 1.153  \t\t\t\t\t# [Viscosity of liquid water at 288 K, cP]\n",
      "M_solvent = 18  \t\t\t\t# [gram/mole]\n",
      "phi_b = 2.26  \t\t\t\t\t# [association factor of solvent B]\n",
      "\n",
      "#Illustration 1.8 (a) \n",
      "\t# Solution (a)\n",
      "\n",
      "\t# Using the Wilke-Chang correlation, equation 1.52\n",
      "D_abo1 = (7.4*10**-8)*(math.sqrt(phi_b*M_solvent))*T/(u_b*(V_ba)**.6)  # [diffusivity of solute A \tin very dilute solution in solvent B, square cm/s]\n",
      "\n",
      "#RESULT\n",
      "print\"Diffusivity of C2H60 in a dilute solution in water at 288 K is\",round(D_abo1,8),\"square cm/s\" \n",
      "\t# The experimental value of D_abo reported in Appendix A is 1.0 x 10**-5 square cm/s\n",
      "D_aboexp = 1*10**-5  \t\t\t\t\t# [square cm/s]\n",
      "percent_error1 = ((D_abo1-D_aboexp)/D_aboexp)*100  \t# [%]\n",
      "\n",
      "print\"The percent error of the estimate, compared to the experimental value is\",round(percent_error1,1),\"%\" \n",
      "\n",
      "\t#Illustration 1.8 (b) \n",
      "\t# Solution (b)\n",
      "#CALCULATION\n",
      "\t# Using the Hayduk and Minhas correlation for aqueous solutions equation 1.53\n",
      "E = (9.58/V_ba)-1.12 \n",
      "D_abo2 = (1.25*10**-8)*(((V_ba)**-.19)-0.292)*(T**1.52)*(u_b**E)  \t# [square cm/s]\n",
      "\n",
      "#RESULT\n",
      "print\"\\n\\nDiffusivity of C2H60 in a dilute solution in water at 288 K is\",round(D_abo2,8),\"square cm/s\\n\" \n",
      "percent_error2 = ((D_abo2-D_aboexp)/D_aboexp)*100  \t\t\t# [%]\n",
      "print\"The percent error of the estimate, compared to the experimental value is\",round(percent_error2,1),\"%\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diffusivity of C2H60 in a dilute solution in water at 288 K is 1.002e-05 square cm/s\n",
        "The percent error of the estimate, compared to the experimental value is 0.2 %\n",
        "\n",
        "\n",
        "Diffusivity of C2H60 in a dilute solution in water at 288 K is 9.91e-06 square cm/s\n",
        "\n",
        "The percent error of the estimate, compared to the experimental value is -0.9 %\n"
       ]
      }
     ],
     "prompt_number": 6
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.9 Page number:27"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable declaration\n",
      "\t#    A-acetic acid(solute)     B-acetone(solvent)\n",
      "T = 313 \t\t\t\t\t # [K]\n",
      "\t# The following data are available (Reid, et al., 1987):\n",
      "\n",
      "\t# Data for acetic acid\n",
      "T_bA = 390.4  \t\t\t\t\t# [K]\n",
      "T_cA = 594.8  \t\t\t\t\t# [K]\n",
      "P_cA = 57.9  \t\t\t\t\t# [bar]\n",
      "V_cA = 171  \t\t\t\t\t# [cubic cm/mole]\n",
      "M_A = 60  \t\t\t\t\t# [gram/mole]\n",
      "\n",
      "\t# Data for acetone\n",
      "T_bB = 329.2  \t\t\t\t\t# [K]\n",
      "T_cB = 508  \t\t\t\t\t# [K]\n",
      "P_cB = 47  \t\t\t\t\t# [bar]\n",
      "V_cB = 209  \t\t\t\t\t# [cubic cm/mole]\n",
      "u_bB = 0.264  \t\t\t\t\t# [cP]\n",
      "M_B = 58  \t\t\t\t\t# [gram/mole]\n",
      "phi = 1 \n",
      "\n",
      "#CALCULATION\n",
      "\n",
      "\t#Illustration 1.9 (a) -\n",
      "\t# Solution (a)\n",
      "\t# Using equation 1.48\n",
      "V_bA = 0.285*(V_cA)**1.048  \t\t\t# [cubic cm/mole]\n",
      "\n",
      "\t# Using the Wilke-Chang correlation , equation 1.52\n",
      "D_abo1 = (7.4*10**-8)*(math.sqrt(phi*M_B))*T/(u_bB*(V_bA)**.6) \n",
      "\n",
      "#RESULT\n",
      "print\"Diffusivity of acetic acid in a dilute solution in acetone  at 313 K using the Wilke-Chang correlation is\",round(D_abo1,8),\"square cm/s\\n\" \n",
      "\t# From Appendix A, the experimental value is 4.04*10**-5 square cm/s\n",
      "D_aboexp = 4.04*10**-5  \t\t\t\t\t# [square cm/s]\n",
      "percent_error1 = ((D_abo1-D_aboexp)/D_aboexp)*100  \t\t# [%]\n",
      "\n",
      "print\"The percent error of the estimate, compared to the experimental value is \",round(percent_error1,1),\"%\" \n",
      "\n",
      "#Illustration 1.9 (b)\n",
      "# Solution (b)\n",
      "\n",
      "#CALCULATION\n",
      "# Using the Hayduk and Minhas correlation for nonaqueous solutions\n",
      "\n",
      "V_bA = V_bA*2  \t\t\t\t\t\t\t# [cubic cm/mole]\n",
      "V_bB = 0.285*(V_cB)**1.048  \t\t\t\t\t# [cubic cm/mole]\n",
      "\n",
      "\t\t# For acetic acid (A)\n",
      "T_brA = T_bA/T_cA  \t\t\t\t\t\t# [K]\n",
      "\t\t# Using equation 1.55 \n",
      "alpha_cA =  0.9076*(1+((T_brA)*math.log(P_cA/1.013))/(1-T_brA)) \n",
      "sigma_cA = (P_cA**(2.0/3.0))*(T_cA**(1.0/3.0))*(0.132*alpha_cA-0.278)*(1-T_brA)**(11.0/9.0)  # [dyn/cm]\n",
      "\n",
      "# For acetone (B)\n",
      "T_brB = T_bB/T_cB  \t\t\t\t\t\t# [K]\n",
      "\t\t# Using equation 1.55 \n",
      "alpha_cB =  0.9076*(1+((T_brB*math.log(P_cB/1.013))/(1-T_brB))) \n",
      "sigma_cB = (P_cB**(2.0/3.0))*(T_cB**(1.0/3.0))*(0.132*alpha_cB-0.278)*(1-T_brB)**(11.0/9.)  # [dyn/cm]\n",
      "\n",
      "# Substituting in equation 1.54\n",
      "D_abo2 = (1.55*10**-8)*(V_bB**0.27)*(T**1.29)*(sigma_cB**0.125)/((V_bA**0.42)*(u_bB**0.92)*(sigma_cA**0.105)) \n",
      "\n",
      "#RESULT\n",
      "\n",
      "print\"Diffusivity of acetic acid in a dilute solution in acetone  at 313 K using the Hayduk and Minhas correlation is\",round(D_abo2,7),\"square cm/s\\n\" \n",
      "\n",
      "percent_error2 = ((D_abo2-D_aboexp)/D_aboexp)*100  # [%]\n",
      "print\"The percent error of the estimate, compared to the experimental value is\",round(percent_error2),\"%\"\n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "Diffusivity of acetic acid in a dilute solution in acetone  at 313 K using the Wilke-Chang correlation is 5.596e-05 square cm/s\n",
        "\n",
        "The percent error of the estimate, compared to the experimental value is  38.5 %\n",
        "Diffusivity of acetic acid in a dilute solution in acetone  at 313 K using the Hayduk and Minhas correlation is 3.84e-05 square cm/s\n",
        "\n",
        "The percent error of the estimate, compared to the experimental value is -5.0 %\n"
       ]
      }
     ],
     "prompt_number": 7
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.10 Page number:30"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t#  acetone-1   benzene-2\n",
      "T = 298  \t\t\t\t\t# [K]\n",
      "x_1 = 0.7808 \n",
      "x_2 = 1-x_1  \n",
      "\n",
      "#CALCULATIONS\n",
      "\t# The infinite dilution diffusivities are\n",
      "D_12o = 2.75*10**-9  \t\t\t\t# [square m/s]\n",
      "D_21o = 4.15*10**-9  \t\t\t\t# [square m/s]\n",
      "\t# From the NRTL equation, for this system at the given temperature and concentration the \tthermodynamic correction factor r = 0.871.\n",
      "r = 0.871 \n",
      "D_12exp = 3.35*10**-9  \t\t\t\t# [square m/s]\n",
      "\n",
      "\n",
      "\t# Using equation 1.56\n",
      "D_12 = (D_12o**x_2)*(D_21o**x_1) \n",
      "D_12 = D_12*r \n",
      "\n",
      "#RESULT\n",
      "print\"The theoritical value of Fick diffusivity is\",round(D_12,11),\"square m/s\" \n",
      "\t# The predicted value of the Fick diffusivity is in excellent agreement with the \texperimental result."
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The theoritical value of Fick diffusivity is 3.3e-09 square m/s\n"
       ]
      }
     ],
     "prompt_number": 8
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.11 Page number:32"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "#  ammonia-1  nitrogen-2   hydrogen-3\n",
      "T = 300  \t\t\t\t\t# [K]\n",
      "P = 1 \t\t\t\t\t\t# [bar]\n",
      "y_1 = .40 \n",
      "y_2 = .20 \n",
      "y_3 = .40 \n",
      "import math\n",
      "\n",
      "\t# Lennard-Jones parameter for ammonia\n",
      "sigma_1 = 2.9  \t\t\t\t\t# [Angstrom]\n",
      "d_1 = 558.3  \t\t\t\t\t# [E/K, K]\n",
      "M_1 = 17.0 \t\t\t\t\t# [gram/mole]\n",
      "\n",
      "\t# Lennard-Jones parameter for nitrogen\n",
      "sigma_2 = 3.798  \t\t\t\t# [Angstrom]\n",
      "d_2 = 71.4  \t\t\t\t\t# [E/K, K]\n",
      "M_2 = 28.0  \t\t\t\t\t# [gram/mole]\n",
      "\n",
      "\t# Lennard-Jones parameter for hydrogen \n",
      "sigma_3 = 2.827  \t\t\t\t# [Angstrom]\n",
      "d_3 = 59.7  \t\t\t\t\t# [E/K, K]\n",
      "M_3 = 2.0  \t\t\t\t\t# [gram/mole]\n",
      "\n",
      "\t# Binary diffusivitiy of ammonia in nitrogen (D_12)\n",
      "\n",
      "#CALCULATIONS\n",
      "\n",
      "\n",
      "sigma_12 = (sigma_1+sigma_2)/2  \t\t# [Angstrom]\n",
      "d_12 = math.sqrt(d_1*d_2)  \t\t\t# [K]\n",
      "M_12 = 2/((1/M_1)+(1/M_2))  \t\t\t# [gram/mole]\n",
      "\n",
      "T_star12 = T/d_12 \n",
      "a = 1.06036  \n",
      "b = 0.15610  \n",
      "c = 0.19300  \n",
      "d = 0.47635  \n",
      "e = 1.03587  \n",
      "f = 1.52996  \n",
      "g = 1.76474  \n",
      "h = 3.89411  \n",
      "ohm12 = ((a/T_star12**b)+(c/math.exp(d*T_star12))+(e/math.exp(f*T_star12))+(g/math.exp(h*T_star12))) \n",
      " \n",
      "\t# Substituting these values into the Wilke-Lee equation yields (equation 1.49)\n",
      "D_12 = ((10**-3*(3.03-(.98/math.sqrt(M_12)))*T**1.5)/(P*(math.sqrt(M_12))*(sigma_12**2)*ohm12))  # [square cm/s]\n",
      "print\"The diffusivitiy of ammonia in nitrogen\",round(D_12,3),\"square cm/s\"\n",
      "\n",
      "\t# Binary diffusivitiy of ammonia in hydrogen (D_13)\n",
      "\n",
      "sigma_13 = (sigma_1+sigma_3)/2  \t\t# [Angstrom]\n",
      "d_13 = math.sqrt(d_1*d_3)  \t\t\t# [K]\n",
      "M_13 = 2/((1/M_1)+(1/M_3))  \t\t\t# [gram/mole]\n",
      "\n",
      "T_star13 = T/d_13 \n",
      "a = 1.06036  \n",
      "b = 0.15610  \n",
      "c = 0.19300  \n",
      "d = 0.47635  \n",
      "e = 1.03587  \n",
      "f = 1.52996  \n",
      "g = 1.76474  \n",
      "h = 3.89411  \n",
      "ohm13 = ((a/T_star13**b)+(c/math.exp(d*T_star13))+(e/math.exp(f*T_star13))+(g/math.exp(h*T_star13))) \n",
      " \n",
      "\t# Substituting these values into the Wilke-Lee equation yields (equation 1.49)\n",
      "D_13 = ((10**-3*(3.03-(.98/math.sqrt(M_13)))*T**1.5)/(P*(math.sqrt(M_13))*(sigma_13**2)*ohm13))  \t\t\t\t\t# [square cm/s]\n",
      "\n",
      "#RESULT\n",
      "\n",
      "print\"The diffusivitiy of ammonia in hydrogen\",round(D_13,3),\"square cm/s\\n\" \n",
      "\n",
      "\t# Figure 1.5 shows the flux of ammonia (N_1) toward the catalyst surface, where \n",
      "\t# it is consumed by chemical reaction, and the fluxes of nitrogen (N_2) and hydrogen \t\t(N_3)\n",
      "\t# produced by the reaction migrating away from the same surface.\n",
      "\n",
      "\t# Therefore N_1 = N_2+N_3 \n",
      "\t# From equation 1.59\n",
      "\t# N_2 = -(0.5)*N_1    and    N_3 = -(1.5)*N_1\n",
      "\n",
      "\t# Substituting in equation (1.58) we obtain\n",
      "D_1eff = (1+y_1)/((y_2+0.5*y_1)/D_12 + (y_3+1.5*y_1)/D_13)  \t\t# [square cm/s]\n",
      "\n",
      "#RESULT\n",
      "\n",
      "print\"The effective diffusivity of ammonia in the gaseous mixture is\",round(D_1eff,3),\"square cm/s\"   "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusivitiy of ammonia in nitrogen 0.237 square cm/s\n",
        "The diffusivitiy of ammonia in hydrogen 0.728 square cm/s\n",
        "\n",
        "The effective diffusivity of ammonia in the gaseous mixture is 0.457 square cm/s\n"
       ]
      }
     ],
     "prompt_number": 9
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.12 Page number:34"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t#  ammonia-1  nitrogen-2   hydrogen-3\n",
      "T = 300  \t\t\t\t\t# [K]\n",
      "P = 1  \t\t\t\t\t\t# [bar]\n",
      "y_1 = 0.40 \n",
      "y_2 = 0.20 \n",
      "y_3 = 0.40 \n",
      "\n",
      "#CALCULATIONS\n",
      "\n",
      "\t# The binary diffusivities are the same as for Example 1.11.\n",
      "D_12 = 0.237  \t\t\t\t\t# [square cm/s]\n",
      "D_13 = 0.728  \t\t\t\t\t# [square cm/s]\n",
      "\n",
      "\t# mole fractions of nitrogen (2) and hydrogen (3) on an ammonia (1)-free base from \tequation (1.61)\n",
      "y_21 = y_2/(1-y_1) \n",
      "y_31 = y_3/(1-y_1) \n",
      "\t# Substituting in equation (1.60) gives us\n",
      "D_1eff = 1/((y_21/D_12)+(y_31/D_13)) \n",
      "print\"The effective diffusivity of ammonia in the gaseous mixture is\",round(D_1eff,3),\"square cm/s\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The effective diffusivity of ammonia in the gaseous mixture is 0.431 square cm/s\n"
       ]
      }
     ],
     "prompt_number": 10
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.13 Page number:36"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#VARIABLE DECLARATION\n",
      "\n",
      "\t# acetic acid-1   water-2   ethyl alcohol-3\n",
      "T = 298  \t\t\t\t\t# [K]\n",
      "\t# The data required data for water at 298 K\n",
      "u_2 = 0.894  \t\t\t\t\t# [cP]\n",
      "V_c1 = 171  \t\t\t\t\t# [cubic cm/mole]\n",
      "\t# From equation 1.48\n",
      "V_b1 = 62.4  \t\t\t\t\t# [cubic cm/mole]\n",
      "\t# Substituting in equation (1.53)\n",
      "\t# the infinite dilution diffusion coefficient of acetic acid in water at 298 K\n",
      "E = (9.58/V_b1)-1.12 \n",
      "D_abo12 = (1.25*10**-8)*(((V_b1)**-.19)-0.292)*(T**1.52)*(u_2**E)  # [square cm/s]\n",
      "\n",
      "import math\n",
      "\t# Data for acetic acid\n",
      "T_b1 = 390.4  \t\t\t\t\t# [K]\n",
      "T_c1 = 594.8  \t\t\t\t\t# [K]\n",
      "P_c1 = 57.9  \t\t\t\t\t# [bar]\n",
      "V_c1 = 171  \t\t\t\t\t# [cubic cm/mole]\n",
      "M_1 = 60.0  \t\t\t\t\t# [gram/mole]\n",
      "\n",
      "\t# Data for ethanol\n",
      "T_b3 = 351.4  \t\t\t\t\t# [K]\n",
      "T_c3 = 513.9  \t\t\t\t\t# [K]\n",
      "P_c3 = 61.4  \t\t\t\t\t# [bar]\n",
      "V_c3 = 167  \t\t\t\t\t# [cubic cm/mole]\n",
      "M_3 = 46.0  \t\t\t\t\t# [gram/mole]\n",
      "u_3 = 1.043  \t\t\t\t\t# [cP]\n",
      "\n",
      "\n",
      "#CALCULATION\n",
      "\n",
      "\t# Using the Hayduk and Minhas correlation for nonaqueous solutions\n",
      "\n",
      "\t# According to restriction 3 mentioned above, the molar volume of the acetic acid to be \tused in equation (1.54) should be\t\n",
      "V_b1 = V_b1*2  \t\t\t\t\t# [cubic cm/mole]\n",
      "\t# The molar volume of ethanol is calculated from equation (1.48)\n",
      "V_b3 = 60.9  \t\t\t\t\t# [cubic cm/mole]\n",
      "\n",
      "\n",
      "\t# For acetic acid (1)\n",
      "T_br1 = T_b1/T_c1  \t\t\t\t# [K]\n",
      "\t# Using equation 1.55 \n",
      "alpha_c1 =  0.9076*(1+((T_br1)*math.log(P_c1/1.013))/(1-T_br1)) \n",
      "sigma_c1 = (P_c1**(2.0/3.0))*(T_c1**(1.0/3.0))*(0.132*alpha_c1-0.278)*(1-T_br1)**(11.0/9.0)  # \t\t\t\t\t\t\t\t\t\t\t[dyn/cm]\n",
      "\n",
      "\t# For ethanol (3)\n",
      "T_br3 = T_b3/T_c3  \t\t\t\t# [K]\n",
      "\t# Using equation 1.55 \n",
      "alpha_c3 =  0.9076*(1+((T_br3*math.log(P_c3/1.013))/(1-T_br3))) \n",
      "sigma_c3 = (P_c3**(2.0/3.0))*(T_c3**(1.0/3.0))*(0.132*alpha_c3-0.278)*(1-T_br3)**(11.0/9.0)  # [dyn/cm]\n",
      "\n",
      "\t# Substituting in equation 1.54\n",
      "D_abo13 = (1.55*10**-8)*(V_b3**0.27)*(T**1.29)*(sigma_c3**0.125)/((V_b1**0.42)*(u_3**0.92)*(sigma_c1**0.105)) \n",
      "\n",
      "\t# The viscosity of a 40 wt% aqueous ethanol solution at 298 K is u_mix = 2.35 cP\n",
      "u_mix = 2.35  \t\t\t\t\t# [cP]\n",
      "\t# The solution composition must be changed from mass to molar fractions following a \t\t\tprocedure similar to that illustrated in Example 1.2\n",
      "\t# Accordingly, a 40 wt% aqueous ethanol solution converts to 20.7 mol%.\n",
      "\t# Therefore mole fraction of ethanol (x_3) and water (x_2) \n",
      "\n",
      "x_3 = 0.207 \n",
      "x_2 = 1-x_3 \n",
      "\t# Using equation 1.62\n",
      "D_1eff = ((x_2*D_abo12*(u_2**0.8))+(x_3*D_abo13*(u_3**0.8)))/(u_mix**0.8) \n",
      "\n",
      "#RESULT\n",
      "\n",
      "print\"The diffusion coefficient of acetic acid at very low concentrations diffusing into a mixed solvent containing 40.0 wt percent ethyl alcohol in water at a temperature of 298 K is\",round(D_1eff,7),\"cm^2/s\\n\\n\"  \n",
      "\n",
      "\t# The experimental value reported by Perkins and Geankoplis (1969) is \n",
      "D_1exp = 5.71*10**-6  # [square cm/s]\n",
      "percent_error = ((D_1eff-D_1exp)/D_1exp)*100  # [%]\n",
      "\n",
      "\n",
      "print\"The error of the estimate is \",round(percent_error,1),\"%\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The diffusion coefficient of acetic acid at very low concentrations diffusing into a mixed solvent containing 40.0 wt percent ethyl alcohol in water at a temperature of 298 K is 5.9e-06 cm^2/s\n",
        "\n",
        "\n",
        "The error of the estimate is  3.2 %\n"
       ]
      }
     ],
     "prompt_number": 11
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.14 Page number:39"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t#  Binary gaseous mixture of components A and B\n",
      "P = 1 \t\t\t\t\t\t # [bar]\n",
      "T = 300  \t\t\t                 # [K]\n",
      "R = 8.314  \t\t\t\t\t # [cubic m.Pa/mole.K]\n",
      "delta = 1  \t\t\t\t\t # [mm]\n",
      "y_A1 = 0.7 \n",
      "y_A2 = 0.2 \n",
      "D_AB = 0.1  \t\t\t\t\t # [square cm/s]\n",
      "\n",
      "\t# Using equation 1.72\n",
      "#CALCULATION\n",
      "\n",
      "N_A = (D_AB*10**-4)*(P*10**5)*(y_A1-y_A2)/(R*T*delta*10**-3) \n",
      "\n",
      "#RESULT\n",
      "\n",
      "print\"The molar flux of component A is\",round(N_A,1),\"mole/square m.s\"   "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The molar flux of component A is 0.2 mole/square m.s\n"
       ]
      }
     ],
     "prompt_number": 12
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.15 Page number:41"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t\t# Diffusion of A through stagnant B\n",
      "P_total = 1.0 \t\t\t\t\t\t# [bar]\n",
      "P_B1 = 0.8 \t\t\t\t\t\t# [bar]\n",
      "P_B2 = 0.3 \t\t\t\t\t\t# [bar]\n",
      "\n",
      "import math\n",
      "\n",
      "#Calculation\n",
      "\t# Using equation 1.83\n",
      "P_BM = (P_B2-P_B1)/(math.log(P_B2/P_B1)) \t\t# [bar]\n",
      "\t# using the result of Example 1.14, we have\n",
      "N_A = 0.2 \t\t\t\t\t\t# [mole/square m.s]\n",
      "N_A = N_A*P_total/P_BM \t\t\t\t\t# [moloe/square m.s]\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The molar flux of component A is\",round(N_A,2),\"mole/square m.s\""
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The molar flux of component A is 0.39 mole/square m.s\n"
       ]
      }
     ],
     "prompt_number": 13
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.16 Page number:44"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "#Variable declaration\n",
      "\t# Nickel Carbonyl-A    carbon monoxide-B\n",
      "T = 323  \t\t\t\t\t# [K]\n",
      "P = 1  \t\t\t\t\t\t# [atm]\n",
      "R = 8.314  \t\t\t\t\t# [cubic m.Pa/mole.K]\n",
      "y_A1 = 1.0 \n",
      "y_A2 = 0.5 \n",
      "delta = 0.625  \t\t\t\t\t# [mm]\n",
      "D_AB = 20  \t\t\t\t\t# [square mm/s]\n",
      "\n",
      "#Calculations\n",
      "\n",
      "\n",
      "\t# The stoichiometry of the reaction determines the relation between the fluxes: from \t\t\tequation (1-59), N_B = - 4N_A and N_A + N_B = -3NA\n",
      "\t# Molar flux fraction si_A = N_A/(N_A+N_B) = N_A/(-3*N_A) = -1/3\n",
      "si_A = -1.0/3.0 \n",
      "\t# Using equation 1.78\n",
      "N_A = si_A*(D_AB*10**-6*P*10**5*math.log((si_A-y_A2)/(si_A-y_A1))/(R*T*delta*10**-3)) \n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The molar flux of component A is\",round(N_A,3),\"mole/square m.s\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The molar flux of component A is 0.187 mole/square m.s\n"
       ]
      }
     ],
     "prompt_number": 14
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.19 Page number:54"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "import math\n",
      "\n",
      "#Variable declaration\n",
      "# a-CuS04    b-H2O\n",
      "T = 273  \t\t\t\t\t\t# [K]\n",
      "delta = 0.01  \t\t\t\t\t\t# [mm]\n",
      "sol_ab = 24.3 \t\t\t\t\t\t# [gram/100 gram water]\n",
      "den_ab = 1140  \t\t\t\t\t\t# [kg/cubic m]\n",
      "D_ab = 3.6*10**-10  \t\t\t\t\t# [square m/s]\n",
      "den_b = 999.8  \t\t\t\t\t\t# [kg/cubic m]\n",
      "\n",
      "\n",
      "#Calcualtions\n",
      "\n",
      "\t# both fluxes are in the same direction  therefore, they are both positive and relation \tis N_b = 5N_a (where N_b and N_a are molar fluxes of component 'a' and 'b') \n",
      "\t# From equation (1.76), si_a = 1/6 = 0.167\n",
      "si_a = 0.167 \n",
      "\t# Calculation of mole fraction of component 'a'\n",
      "\t# Basis: 100 gram H2O (b)\n",
      "M_a = 159.63  \t\t\t\t\t\t# [gram/mole]\n",
      "M_b = 18  \t\t\t\t\t\t# [gram/mole]\n",
      "M_c =249.71  \t\t\t\t\t\t# [here M_c is molecular mass of hydrated \t\t\t\t\t\t\t  CuSO4, gram/mole]\n",
      "m_a = 24.3  \t\t\t\t\t\t# [gram]\n",
      "m_c = m_a*(M_a/M_c)  \t\t\t\t\t# [here m_c is the mass of  CuSO4 in 24.3 \t\t\t\t\t\t\tgram of crystal, gram]\n",
      "m_d = m_a-m_c  \t\t\t\t\t\t# [here m_d is mass of hydration of water \t\t\t\t\t\t\tin the crystal, gram]\n",
      "m_b_total = 100+m_d  \t\t\t\t\t# [total mass of water, gram]\n",
      "\n",
      "x_a1 = (m_c/M_a)/((m_c/M_a)+(m_b_total/M_b)) \n",
      "x_a2 = 0 \n",
      "\n",
      "\t# At point 1, the average molecular weight is\n",
      "M_1 = x_a1*M_a+(1-x_a1)*M_b  \t\t\t\t# [gram/mole]\n",
      "\t# At point 2, the average molecular weight is\n",
      "M_2 = x_a2*M_a+(1-x_a2)*M_b\n",
      "\t# Molar density at point 1 and 2\n",
      "row_1 = den_ab/M_1  \t\t\t\t\t# [kmole/cubic m]\n",
      "row_2 = den_b/M_2\n",
      "row_avg = (row_1+row_2)/2  \t\t\t\t# [kmole/cubic m]\n",
      "\n",
      "\t# Using equation 1.96\n",
      "\n",
      "N_a = si_a*D_ab*row_avg*math.log((si_a-x_a2)/(si_a-x_a1))/(delta*10**-3)  \t# [kmole/square \t\t\t\t\t\t\t\t\t\tm.s]\n",
      "rate = N_a*M_c*3600  \t\t\t\t\t# [kg/square m of crystal surface area \t\t\t\t\t\t\tper hour]\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"the rate at which the crystal dissolves in solution is\",round(rate),\"kg/square m of crystal surface area per hour\" \n",
      "   \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "the rate at which the crystal dissolves in solution is 30.0 kg/square m of crystal surface area per hour\n"
       ]
      }
     ],
     "prompt_number": 15
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.20 Page number:58"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t# A-hydrogen   B-ethane\n",
      "T = 373  \t\t\t\t\t# [K]\n",
      "P = 10  \t\t\t\t\t# [atm]\n",
      "d = 4000  \t\t\t\t\t# [Angstrom]\n",
      "e = 0.4  \t\t\t\t\t# [porosity]\n",
      "t = 2.5  \t\t\t\t\t# [tortuosity]\n",
      "D_AB = 0.86/P  \t\t\t\t\t# [square cm/s]\n",
      "k = 1.3806*10**-23  \t\t\t\t# [J/K]\n",
      "import math\n",
      "\n",
      "#Calculation\n",
      "\n",
      "# Using data from Appendix B for hydrogen and ethane, and equation (1.45)\n",
      "sigma_A = 2.827  \t\t\t\t# [Angstrom]\n",
      "sigma_B = 4.443  \t\t\t\t# [Angstrom]\n",
      "sigma_AB = ((sigma_A+sigma_B)/2)*10**-10  \t# [m]\n",
      "\n",
      "lamda=k*T/(math.sqrt(2)*3.14*(sigma_AB**2)*P*1.01325*10**5)  # [m]\n",
      "lamda=lamda*10**10  # [Angstrom]\n",
      "\t\t# From equation 1.101\n",
      "K_n = lamda/d \n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The value of a dimensionless ratio, Knudsen number is \",round(K_n,3) \n",
      "\t# If K_n is less than 0.05 then diffusion inside the pores occurs only by ordinary \t\tmolecular diffusion and equation 1.100 can be used to calculate D_ABeff\n",
      "D_ABeff = D_AB*e/t \n",
      "print\"The effective diffusivity of hydrogen in ethane is\",round(D_ABeff,3),\"square cm /s\"   "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of a dimensionless ratio, Knudsen number is  0.022\n",
        "The effective diffusivity of hydrogen in ethane is 0.014 square cm /s\n"
       ]
      }
     ],
     "prompt_number": 16
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.21 Page number:60"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t#   a-oxygen   b-nitrogen\n",
      "T = 293  \t\t\t\t\t\t# [K]\n",
      "P = 0.1  \t\t\t\t\t\t# [atm]\n",
      "d = 0.1*10**-6  \t\t\t\t\t# [m]\n",
      "e = 0.305 \t\t\t\t\t \t# [porosity]\n",
      "t = 4.39  \t\t\t\t\t\t# [tortuosity]\n",
      "k = 1.3806*10**-23  \t\t\t\t\t# [J/K]\n",
      "l = 2*10**-3  \t\t\t\t\t\t# [m]\n",
      "R = 8.314  \t\t\t\t\t\t# [cubic m.Pa/mole.K]\n",
      "x_a1 = 0.8 \n",
      "x_a2 = 0.2 \n",
      "M_a = 32.0  \t\t\t\t\t\t# [gram/mole]\n",
      "M_b = 28.0  \t\t\t\t\t\t# [gram/mole]\n",
      "\n",
      "#Calculation\n",
      "\n",
      "import math\n",
      "\t# Using data from Appendix B for oxygen and nitrogen, and equation (1.45)\n",
      "sigma_a = 3.467  \t\t\t\t\t# [Angstrom]\n",
      "sigma_b = 3.798  \t\t\t\t\t# [Angstrom]\n",
      "sigma_AB = ((sigma_a+sigma_b)/2)*10**-10  \t\t# [m]\n",
      "\n",
      "lamda = k*T/(math.sqrt(2)*3.14*(sigma_AB**2)*P*1.01325*10**5)  # [m]\n",
      "\t# From equation 1.101\n",
      "K_n = lamda/d \n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The value of a dimensionless ratio, Knudsen number is \",round(K_n,3) \n",
      "\t# If K_n is greater than 0.05 then transport inside the pores is mainly by Knudsen \t\t\tdiffusion\n",
      "\t# Using equation 1.103\n",
      "\n",
      "\n",
      "#Calculation\n",
      "\n",
      "D_Ka = (d/3)*(math.sqrt(8*R*T)/math.sqrt(3.14*M_a*10**-3))  # [square m/s]\n",
      "\n",
      "\t# Using equation 1.107\n",
      "D_Kaeff = D_Ka*e/t  \t\t\t\t\t# [square m/s]\n",
      "\n",
      "p_a1 = (x_a1*P)*1.01325*10**5  \t\t\t\t# [Pa]\n",
      "p_a2 = (x_a2*P)*1.01325*10**5  \t\t\t\t# [Pa]\n",
      "\n",
      "\t# Using equation 1.108\n",
      "N_a = D_Kaeff*(p_a1-p_a2)/(R*T*l)  \t\t\t# [mole/square m.s]\n",
      "\t# Now using the Graham\u2019s law of effusion for Knudsen diffusion\n",
      "\t# N_b/N_a = -math.sqrt(M_a/M_b) ,therefore\n",
      "N_b = -N_a*math.sqrt(M_a/M_b)  \t\t\t\t# [mole/square m.s]\n",
      "\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The diffusion fluxes of both components oxygen and nitrogen are \",round(N_a,5),\"mole/square m.s and\",round(N_b,5),\"mole/square m.s respectively\\n\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of a dimensionless ratio, Knudsen number is  6.813\n",
        "The diffusion fluxes of both components oxygen and nitrogen are  0.00127 mole/square m.s and -0.00136 mole/square m.s respectively\n",
        "\n"
       ]
      }
     ],
     "prompt_number": 17
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.22 Page number:61"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t#   a-oxygen   b-nitrogen\n",
      "T = 293  \t\t\t\t\t\t# [K]\n",
      "P = 0.1  \t\t\t\t\t\t# [atm]\n",
      "d = 0.3*10**-6  \t\t\t\t\t# [m]\n",
      "e = 0.305  \t\t\t\t\t\t# [porosity]\n",
      "t = 4.39  \t\t\t\t\t\t# [tortuosity]\n",
      "k = 1.3806*10**-23  \t\t\t\t\t# [J/K]\n",
      "R = 8.314  \t\t\t\t\t\t# [cubic m.Pa/mole.K]\n",
      "l = 2*10**-3  \t\t\t\t\t\t# [m]\n",
      "D_ab = 2.01*10**-4  \t\t\t\t\t# [square m/s]\n",
      "y_a1 = 0.8 \n",
      "y_a2 = 0.2 \n",
      "\n",
      "\n",
      "#Calculations\n",
      "\n",
      "import math\n",
      "\t# Using data from Appendix B for oxygen and nitrogen, and equation (1.45)\n",
      "sigma_a = 3.467  \t\t\t\t\t# [Angstrom]\n",
      "sigma_b = 3.798  \t\t\t\t\t# [Angstrom]\n",
      "sigma_AB = ((sigma_a+sigma_b)/2)*10**-10  \t\t# [m]\n",
      "\n",
      "lamda = k*T/(math.sqrt(2)*3.14*(sigma_AB**2)*P*1.01325*10**5)  # [m]\n",
      "\t# From equation 1.101\n",
      "K_n = lamda/d \n",
      "print\"The value of a dimensionless ratio,Knudsen number is \",round(K_n,2) \n",
      "\n",
      "\t# It means that both molecular and Knudsen diffusion are important and equation (1.109) \t\tmust be used to calculate N_a\n",
      "\t# From example 1.21     N_b/N_a = -1.069\n",
      "\t# Therefore si_a = 1/(1+(N_b/N_a))\n",
      "si_a = 1/(1+(-1.069)) \n",
      "\n",
      "\t# From equation 1.100\n",
      "D_abeff = D_ab*e/t  \t\t\t\t\t\t# [square m/s]\n",
      "\n",
      "\t# From equation 1.103\n",
      "D_Ka =  0.440*10**-4\t\t\t\t\t\t# [square m/s]\n",
      "\n",
      "\t# Using equation 1.107\n",
      "D_Kaeff = D_Ka*e/t \t\t\t\t\t\t# [square m/s]\n",
      "\n",
      "Y_a = 1+(D_abeff/D_Kaeff)  \n",
      "\n",
      "\t# Using equation 1.109 to calculate N_a\n",
      "N_a = (si_a*P*1.01325*10**5*D_abeff*math.log((si_a*Y_a-y_a2)/(si_a*Y_a-y_a1)))/(R*T*l) \n",
      "N_b = -1.069*N_a \n",
      "\n",
      "\n",
      "#RESULTS\n",
      "print\"The diffusion fluxes of both components oxygen and nitrogen are\",round(N_a,5),\"mole/square m.s and\",round(N_b,5),\"mole/square m.s respectively\" "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of a dimensionless ratio,Knudsen number is  2.27\n",
        "The diffusion fluxes of both components oxygen and nitrogen are 0.00311 mole/square m.s and -0.00332 mole/square m.s respectively\n"
       ]
      }
     ],
     "prompt_number": 18
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.23 Page number:62"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\n",
      "\t# A-beta dextrin   B-water\n",
      "T = 293  \t\t\t\t\t\t# [K]\n",
      "d = 88.8 \t\t\t\t\t\t# [Average pore diameter, Angstrom]\n",
      "d_mol = 17.96  \t\t\t\t\t\t# [Molecular diameter, Angstrom]\n",
      "e = 0.0233  \t\t\t\t\t\t# [porosity]\n",
      "t = 1.1  \t\t\t\t\t\t# [tortuosity]\n",
      "D_AB = 3.22*10**-6  \t\t\t\t\t# [square cm/s]\n",
      "\n",
      "#Calculation\n",
      "\n",
      "\t# Using equation 1.111 to calculate restrictive factor\n",
      "K_r = (1-(d_mol/d))**4\n",
      "\n",
      "\t# Using equation 1.110 to calculate effective diffusivity\n",
      "D_ABeff = e*D_AB*K_r/t  \t\t\t\t# [square cm/s]\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The effective diffusivity of beta-dextrin at 298 K is\",round(D_ABeff,10),\"square cm/s\"  "
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The effective diffusivity of beta-dextrin at 298 K is 2.76e-08 square cm/s\n"
       ]
      }
     ],
     "prompt_number": 19
    },
    {
     "cell_type": "heading",
     "level": 3,
     "metadata": {},
     "source": [
      "Example 1.24 Page number:63"
     ]
    },
    {
     "cell_type": "code",
     "collapsed": false,
     "input": [
      "#Variable declaration\n",
      "\t#   a-nitrogen\n",
      "P_atm = 1.01325*10**5 \t\t\t\t\t # [Pa]\n",
      "T = 300  \t        \t\t\t\t # [K]\n",
      "P_2 = 10130  \t\t\t\t\t\t # [Pa]\n",
      "P_1 = 500+P_2  \t\t\t\t\t\t # [Pa]\n",
      "d = 0.01*10**-2  \t\t\t\t\t# [average pore diameter, m]\n",
      "u = 180  \t\t\t\t\t\t# [micro Poise]\n",
      "u = 180*10**-6*10**-1  \t\t\t\t\t# [Pa.s]  \n",
      "l = 25.4*10**-3  \t\t\t\t\t# [m]\n",
      "v = 0.05  \t\t\t\t\t\t# [volumetric flow rate,  cubic m/square \t\t\t\t\t\t\tm.s]\n",
      "R = 8.314  \t\t\t\t\t\t# [cubic m.Pa/mole.K]\n",
      "\n",
      "\n",
      "#Calculations\n",
      "\n",
      "\t# Solution (a)\n",
      "\n",
      "P_avg = (P_1+P_2)/2  \t\t\t\t\t# [Pa]\n",
      "\t# The mean free path for nitrogen is from equation (1.102)\n",
      "lamda = 0.622*10**-6  \t\t\t\t\t# [m]\n",
      "K_n = lamda/d \n",
      "\t# Therefore, Knudsen diffusion will not occur and all the flow observed is of a \thydrodynamic nature.\n",
      "\n",
      "\t# From the ideal gas law, the nitrogen flux corresponding to the volumetric flow rate of \t0.05 m3/m2-s at 300 K and 1 atm\n",
      " \n",
      "N_a = P_atm*v/(R*T)  \t\t\t\t\t# [mole/square m.s]\n",
      "\t# Using equation 1.113\n",
      "B_o = u*R*T*N_a*l/(P_avg*(P_1-P_2))  \t\t\t# [square m]\n",
      "\n",
      "#RESULT\n",
      "\n",
      "print\"The value of the viscous flow parameter is\",round(B_o,13),\"square m\\n\\n\" \n",
      "\n",
      "\t#Illustration 1.24 (b) - Page:64\n",
      "\t# Solution (b)\t\n",
      "\n",
      "#Calculation\n",
      "\n",
      "T1 = 393  \t\t\t\t\t\t# [K]\n",
      "u = 220  \t\t\t\t\t\t# [micro Poise]\n",
      "u = 220*10**-6*10**-1  \t\t\t\t\t# [Pa.s]\n",
      "\t# Substituting in equation (1.113) the new values of temperature and viscosity and the \tvalue of B_o, obtained in part (a) while maintaining the pressure conditi# ons unchanged, \twe get N_a\n",
      "N_a1 = B_o*P_avg*(P_1-P_2)/(l*T*u*R)  \t\t\t# [mole/square m.s]\n",
      "v1 = N_a1*R*T/P_atm  \t\t\t\t\t# [cubic m(measured at 300 K and 1 atm)/ \t\t\t\t\t\t\tsquare m.s]\t\n",
      "\n",
      "#Result\n",
      "\n",
      "print\"The nitrogen flow to be expected at 393 K with the same pressure difference is \",round(v1,3),\"cubic m/sqm.s (measured at 300 K and 1 atm)\" \n"
     ],
     "language": "python",
     "metadata": {},
     "outputs": [
      {
       "output_type": "stream",
       "stream": "stdout",
       "text": [
        "The value of the viscous flow parameter is 4.463e-10 square m\n",
        "\n",
        "\n",
        "The nitrogen flow to be expected at 393 K with the same pressure difference is  0.041 cubic m/sqm.s (measured at 300 K and 1 atm)\n"
       ]
      }
     ],
     "prompt_number": 20
    }
   ],
   "metadata": {}
  }
 ]
}