summaryrefslogtreecommitdiff
path: root/Introduction_To_Chemical_Engineering_Thermodynamics_by_G_Halder/9-Solution_Thermodynamics_Properties.ipynb
blob: 56d886ab3d04ded07234babbb087584a81bee9fc (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
{
"cells": [
 {
		   "cell_type": "markdown",
	   "metadata": {},
	   "source": [
       "# Chapter 9: Solution Thermodynamics Properties"
	   ]
	},
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.10: Fugacity_of_Component_in_Mixture.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.10\n",
"// Page: 354\n",
"\n",
"printf('Example: 9.10 - Page: 354\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"x1 = 0.3;// [mole fraction of component 1 in the mixture]\n",
"x2 = 0.7;// [mole fraction of component 2 in the mixture]\n",
"phi1 = 0.7;// [fugacity coeffecient of component 1 in the mixture]\n",
"phi2 = 0.85;// [fugacity coeffecient of component 2 in the mixture]\n",
"P = 50;// [bar]\n",
"T = 273 + 100;// [K]\n",
"//*************//\n",
"\n",
"phi = exp(x1*log(phi1) + x2*log(phi2));// [fugacity coeffecient of the mixture]\n",
"f = phi*P;// [bar]\n",
"printf('Fugacity of the gaseous mixture is %.3f bar',f);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.11: Fugacity_of_Component_in_Mixture.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.11\n",
"// Page: 354\n",
"\n",
"printf('Example: 9.11 - Page: 354\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"x1 = 0.3;// [mole fraction of hydrogen in the mixture]\n",
"x2 = 0.25;// [mole fraction of nitrogen in the mixture]\n",
"x3 = 0.45;// [mole fraction of oxygen in the mixture]\n",
"phi1 = 0.7;// [fugacity coeffecient of oxygen in the mixture]\n",
"phi2 = 0.85;// [fugacity coeffecient of nitrogen in the mixture]\n",
"phi3 = 0.75;// [fugacity coeffecient of oxygen in the mixture]\n",
"P = 60;// [bar]\n",
"T = 273 + 150;// [K]\n",
"//***********//\n",
"\n",
"phi = exp(x1*log(phi1) + x2*log(phi2) + x3*log(phi3));// [fugacity coeffecient of the mixture]\n",
"f = phi*P;// [bar]\n",
"printf('Fugacity of the gaseous mixture is %.3f bar',f);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.12: Fugacity_of_Solids_and_Liquids.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.12\n",
"// Page: 356\n",
"\n",
"printf('Example: 9.12 - Page: 356\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"T = 372.12;// [K]\n",
"Psat = 100;// [kPa]\n",
"P = 300; //[kPa]\n",
"Vspecific = 1.043*10^(-3);//[cubic m/kg]\n",
"M = 18*10^(-3);// [molecular weight of water, kg/mol]\n",
"R = 8.314;// [J/mol K]\n",
"//***************//\n",
"\n",
"Psat = Psat/100;// [bar]\n",
"P = P/100;// [bar]\n",
"Vl = Vspecific*M;// [cubic m/mol]\n",
"// Vapour is assumed to be like an ideal gas.\n",
"phi = 1;\n",
"fsat = Psat*phi;// [bar]\n",
"fl = fsat*exp(Vl*(P - Psat)*10^5/(R*T));// [bar]\n",
"printf('Fugacity of liquid water is %.4f bar',fl);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.13: Fugacity_of_Solids_and_Liquids.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.13\n",
"// Page: 357\n",
"\n",
"printf('Example: 9.13 - Page: 357\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"Vl = 90.45*10^(-6);// [molar volume of liquid butadiene, cubic m/mol]\n",
"fsat = 4.12;// [bar]\n",
"P = 10;// [bar]\n",
"Psat = 4.12;// [bar]\n",
"T = 313;// [K]\n",
"R = 8.314;// [J/mol K]\n",
"//************//\n",
"\n",
"fl = fsat*exp(Vl*(P - Psat)*10^5/(R*T));// [bar]\n",
"printf('The fugacity of the liquid water is %.4f bar',fl);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.14: Fugacity_of_Solids_and_Liquids.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.14\n",
"// Page: 357\n",
"\n",
"printf('Example: 9.14 - Page: 357\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"b = 0.0391;// [cubic dm/mol]\n",
"P1 = 1000;// [atm]\n",
"T = 1000 + 273;// [K]\n",
"R = 0.0892;// [L bar/K mol]\n",
"deff('[Vreal] = f1(P)','Vreal = R*T/P + b');\n",
"deff('[Videal] = f2(P)','Videal = R*T/P');\n",
"//**************//\n",
"\n",
"// We know that:\n",
"// RTlog(f/P) = integral('Vreal - Videal',P,0,P)\n",
"f = P1*exp((1/(R*T))*integrate('f1(P) - f2(P)','P',0,P1));// [atm]\n",
"phi = f/P1;\n",
"printf('The fugacity of the gas is %d atm \n',f);\n",
"printf('The fugacity coeffecient of the gas is %.3f atm',phi);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.15: Fugacity_of_Solids_and_Liquids.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.15\n",
"// Page: 359\n",
"\n",
"printf('Example: 9.15 - Page: 359\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"Vl = 73*10^(-6);// [cubic m/mol]\n",
"P = 275;// [bar]\n",
"Psat = 4.360;// [bar]\n",
"T = 110 + 273;// [K]\n",
"R = 8.314;// [J/mol K]\n",
"//**************//\n",
"\n",
"// Acetone vapour is assumed to behave like ideal gas.\n",
"phi = 1;\n",
"fsat = Psat;// [bar]\n",
"fl = fsat*exp(Vl*(P - Psat)*10^5/(R*T));// [bar]\n",
"printf('Fugacity of liquid butadiene at 313 K & 10 bar is %.3f bar',fl); "
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.16: Gibbs_Theorem.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.16\n",
"// Page: 362\n",
"\n",
"printf('Example: 9.16 - Page: 362\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"V1 = 2.8;// [Volume of Oxygen, L]\n",
"V2 = 19.6;// [Volume of hydrogen, L]\n",
"R = 1.987;// [cal/K mol]\n",
"//**************//\n",
"\n",
"n1 = V1/22.4;// [moles of Oxygen]\n",
"n2 = V2/22.4;// [moles of Hydrogen]\n",
"n = n1 + n2;// [total number of moles]\n",
"x1 = n1/n;// [mole fraction of Oxygen]\n",
"x2 = n2/n;// [mole fraction of Hydrogen]\n",
"// From Eqn. 9.88:\n",
"deltaS_mix = - (R*(x1*log(x1) + x2*log(x2)));// [cal/K mol]\n",
"printf('The entropy change of mixiong is %.3f cal/K mol',deltaS_mix)"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.17: Gibbs_Theorem.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.17\n",
"// Page: 363\n",
"\n",
"printf('Example: 9.17 - Page: 363\n\n');\n",
"\n",
"// Mathematics is involved in proving but just that no numerical computations are involved.\n",
"// For prove refer to this example 9.17 on page number 363 of the book.\n",
"\n",
"printf(' Mathematics is involved in proving but just that no numerical computations are involved.\n\n');\n",
"printf(' For prove refer to this example 9.17 on page 363 of the book.');"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.18: Gibbs_Theorem.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.18\n",
"// Page: 364\n",
"\n",
"printf('Example: 9.18 - Page: 364\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"n1 = 0.7;// [moles of helium]\n",
"n2 = 0.3;// [moles of argon]\n",
"R = 8.314;// [J/mol K]\n",
"T = 273 + 25;// [K]\n",
"//******************//\n",
"\n",
"n = n1 + n2;// [total moles]\n",
"x1 = n1/n;// [mole fraction of helium]\n",
"x2 = n2/n;// [mole fraction of argon]\n",
"deltaG_mix = n*R*T*(x1*log(x1) + x2*log(x2));// [J]\n",
"printf('The free energy change of mixing is %.2f J\n',deltaG_mix);\n",
"\n",
"// Since the gases are ideal:\n",
"deltaH_mix = 0;// [J]\n",
"printf('The enthalpy change of mixing is %d J\n',deltaH_mix);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.19: Gibbs_Theorem.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.19\n",
"// Page: 364\n",
"\n",
"printf('Example: 9.19 - Page: 364\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"V = 20;// [Volume of vessel, L]\n",
"V1 = 12;// [Volume of Hydrogen, L]\n",
"V2 = 10;// [Volume of Nitrogen, L]\n",
"P = 1;// [atm]\n",
"T = 298;// [K]\n",
"P1 = 1;// [atm]\n",
"P2 = 1;// [atm]\n",
"R = 0.082;// [L atm/K mol]\n",
"//************//\n",
"\n",
"n1 = P1*V1/(R*T);// [number of moles of Hydrogen]\n",
"n2 = P2*V2/(R*T);// [number of moles of Nitrogen]\n",
"n = n1 + n2;// [total number of moles]\n",
"Pfinal = n*R*T/V;// [atm]\n",
"p1 = Pfinal*n1;// [partial pressure of Hydrogen, atm]\n",
"p2 = Pfinal*n2;// [partial pressure of Nitrogen, atm]\n",
"deltaG_mix = R*T*(n1*log(p1/P1) + n2*log(p2/P2));// [J]\n",
"printf('Free Energy change of mixing is %.2f J\n',deltaG_mix);\n",
"\n",
"// Since mixing is ideal:\n",
"deltaH_mix = 0;// [J]\n",
"printf('Enthalpy change in mixing is %.2f J\n',deltaH_mix);\n",
"\n",
"deltaS_mix = - (deltaG_mix/T);// [J/K]\n",
"printf('Entropy Change in mixing is %.3f J/K\n',deltaS_mix);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.1: Partial_Molar_Properties.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.1\n",
"// Page: 338\n",
"\n",
"printf('Example: 9.1 - Page: 338\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"V1_bar = 52.37*10^(-6);// [partial molar volume of ethanol, cubic m/mol]\n",
"y1 = 0.5;// [mole fraction of ethanol]\n",
"Density = 800.21;// [kg/cubic m]\n",
"M1 = 46*10^(-3);// //[Molecular wt. of ethanol,kg/mol]\n",
"M2 = 18*10^(-3);// [Molecular wt. of water,kg/cmol]\n",
"//*************//\n",
"\n",
"y2 = 1 - y1;// [mole fraction of water]\n",
"M = y1*M1 + y2*M2;// [Molecular wt. of mixture, kg/mol]\n",
"V = M/Density;// [Volume of mixture, cubic m/mol]\n",
"// From Eqn. 9.9:\n",
"V2_bar = (V - y1*V1_bar)/y2;// [partial molar volume of water, cubic m/mol]\n",
"printf('Partial molar volume of water is %.2e cubic m/mol\n',V2_bar);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.20: Excess_Property_Of_Mixture.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.20\n",
"// Page: 367\n",
"\n",
"printf('Example: 9.20 - Page: 367\n\n');\n",
"\n",
"// Mathematics is involved in proving but just that no numerical computations are involved.\n",
"// For prove refer to this example 9.20 on page number 367 of the book.\n",
"\n",
"printf(' Mathematics is involved in proving but just that no numerical computations are involved.\n\n');\n",
"printf(' For prove refer to this example 9.20 on page 367 of the book.');"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.21: Henry_Law.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.21\n",
"// Page: 373\n",
"\n",
"printf('Example: 9.21 - Page: 373\n\n');\n",
"\n",
"// Mathematics is involved in proving but just that no numerical computations are involved.\n",
"// For prove refer to this example 9.21 on page number 373 of the book.\n",
"\n",
"printf(' Mathematics is involved in proving but just that no numerical computations are involved.\n\n');\n",
"printf(' For prove refer to this example 9.21 on page 373 of the book.');"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.2: Partial_Molar_Properties.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.2\n",
"// Page: 338\n",
"\n",
"printf('Example: 9.2 - Page: 338\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"Vol = 2;// [Volume of the mixture, cubic m/mol]\n",
"y1 = 0.4;// [mole fraction of alcohol, cubic m/mol]\n",
"V1_bar = 38.3*10^(-6);// [partial molar volume of alcohol, cubic m/mol]\n",
"V2_bar = 17.2*10^(-6);// [partial molar volume of water, cubic m/mol]\n",
"V1 = 39.21*10^(-6);// [molar volume of alcohol, cubic m/mol]\n",
"V2 = 18*10^(-6);// [molar volume of water, cubic m/mol]\n",
"//*************//\n",
"\n",
"// From Eqn. 9.9:\n",
"V = y1*V1_bar + (1 - y1)*V2_bar;// [molar volume of the solution]\n",
"n = Vol/V;// [number of moles of solution]\n",
"n1 = y1*n;// [number of moles of alcohol required]\n",
"n2 = (1 - y1)*n;// [number of moles of water required]\n",
"V_alcohol = V1*n1;// [Volume of alcohol required, cubic m]\n",
"V_water = V2*n2;// [Volume of water required, cubic m]\n",
"printf('Volume of alcohol required is %.3f cubic m while volume of water required is %.3f cubic m\n',V_alcohol,V_water);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.3: Partial_Molar_Properties.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.3\n",
"// Page: 339\n",
"\n",
"printf('Example: 9.3 - Page: 339\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"Vol = 2000;// [cubic cm]\n",
"y1_1 = 0.96;// [mass fraction of ethanol in laboratory alcohol]\n",
"y2_1 = 0.04;// [mass fraction of water in laboratory alcohol]\n",
"y1_2 = 0.56;// [mass fracion of ethanol in vodka]\n",
"y2_2 = 0.44;// [mass fraction of water in vodka]\n",
"Vbar_water1 = 0.816;// [cubic cm/g]\n",
"Vbar_ethanol1 = 1.273;// [cubic cm/g]\n",
"Vbar_water2 = 0.953;// [cubic cm/g]\n",
"Vbar_ethanol2 = 1.243;// [cubic cm/g]\n",
"Density_water = 0.997;// [cubic cm/g]\n",
"//***************//\n",
"\n",
"// Solution (i)\n",
"// From Eqn 9.9\n",
"Va = y1_1*Vbar_ethanol1 + y2_1*Vbar_water1;// [Volume of laboratory alcohol, cubic cm/g]\n",
"mass = Vol/Va;// [g]\n",
"// Let Mw be the mass of water added in laboratory alcohol.\n",
"// Material balance on ethanol:\n",
"Mw = mass*y1_1/y1_2 - mass;// [g]\n",
"Vw = Mw/Density_water;// [Volume of water added, cubic cm]\n",
"printf('Mass of water added is %d g\n',Mw);\n",
"\n",
"// Solution (ii)\n",
"Mv = mass + Mw;// [Mass of vodka, g]\n",
"Vv = y1_2*Vbar_ethanol2 + y2_2*Vbar_water2;// [Volume of ethanol, cubic cm/g]\n",
"V_vodka = Vv*Mv;// [Volume of vodka obtained after conversion, cubic cm]\n",
"printf('The volume of vodka obtained after conversion is %.d cubic cm\n',V_vodka);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.4: Partial_Molar_Properties.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.4\n",
"// Page: 339\n",
"\n",
"printf('Example: 9.4 - Page: 339\n\n');\n",
"\n",
"// Mathematics is involved in proving but just that no numerical computations are involved.\n",
"// For prove refer to this example 9.4 on page number 339 of the book.\n",
"\n",
"printf(' Mathematics is involved in proving but just that no numerical computations are involved.\n\n');\n",
"printf(' For prove refer to this example 9.4 on page 339 of the book.');"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.5: Partial_Molar_Properties.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.5\n",
"// Page: 340\n",
"\n",
"printf('Example: 9.5 - Page: 340\n\n');\n",
"\n",
"// Mathematics is involved in proving but just that no numerical computations are involved.\n",
"// For prove refer to this example 9.5 on page number 340 of the book.\n",
"\n",
"printf(' Mathematics is involved in proving but just that no numerical computations are involved.\n\n');\n",
"printf(' For prove refer to this example 9.5 on page 340 of the book.');"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.6: Partial_Molar_Properties.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.6\n",
"// Page: 341\n",
"printf('Example - 9.6 and Page number - 341\n\n');\n",
"\n",
"//Given\n",
"T = 25+273.15;// [K]\n",
"P = 1;// [atm]\n",
"// Component 1 = water\n",
"// Component 2 = methanol\n",
"a = -3.2;// [cubic cm/mol]  A constant\n",
"V2 = 40.7;// [cubic cm/mol]  Molar volume of pure component 2 (methanol)\n",
"// V1_bar = 18.1 + a*x_2^(2)\n",
"\n",
"// From Gibbs-Duhem equation at constant temperature and pressure we have\n",
"// x_1*dV1_bar + x_2*dV2_bar = 0\n",
"// dV2_bar = -(x_1/x_2)*dV1_bar = -(x_1/x_2)*a*2*x_2*dx_2 = -2*a*x_1*dx_2 = 2*a*x_1*dx_1\n",
"\n",
"// At x_1 = 0: x_2 = 1 and thus V2_bar = V2\n",
"// Integrating the above equation from x_1 = 0 to x_1 in the RHS, and from V2_bar = V2 to V2 in the LHS, we get\n",
"// V2_bar = V2 + a*x_1^(2) -  Molar volume of component 2(methanol) in the mixture \n",
"\n",
"printf('The expression for the partial molar volume of methanol(2) is\nV2_bar = V2 + a*x_1^(2) [cubic cm/mol]\n\n');\n",
"\n",
"// At infinite dilution, x_2 approach 0 and thus x_1 approach 1, therefore\n",
"x_1 = 1;// Mole fraction of component 1(water) at infinite dilution\n",
"V2_bar_infinite = V2 + a*(x_1^(2));//[cubic cm/mol]\n",
"\n",
"printf('The partial molar volume of methanol at infinite dilution is %.1f cubic cm/mol',V2_bar_infinite);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.7: Partial_Molar_Properties.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.7\n",
"// Page: 342\n",
"\n",
"printf('Example: 9.7 - Page: 342\n\n');\n",
"\n",
"// Solution\n",
"\n",
"//*****Data******//\n",
"// Data = [X1 V*10^6(cubic m/mol)];\n",
"Data = [0 20;0.2 21.5;0.4 24.0;0.6 27.4;0.8 32.0;1 40];\n",
"//************//\n",
"\n",
"scf(1.1);\n",
"plot(Data(:,1),Data(:,2));\n",
"title('Example 9.7');\n",
"xlabel('Mole fraction');\n",
"ylabel('Molar Volume*10^(6)');\n",
"xgrid();\n",
"\n",
"// Solution (i)\n",
"printf('For X1 = 0.5\n');\n",
"// A tangent is drawn to the curve at X1 = 0.5.\n",
"// The intercept at X2 = 0 or X1 = 1, gives V1_bar.\n",
"V1_bar1 = 33.8*10^(-6);// [cubic m/mol]\n",
"// The intercept at X2 = 1 or X1 = 0, gives V2_bar.\n",
"V2_bar1 = 17*10^(-6);// [cubic m/mol]\n",
"printf('Partial molar volume of component 1 is %.2e cubic m/mol\n',V1_bar1);\n",
"printf('Partial molar volume of component 2 is %.2e cubic m/mol\n',V2_bar1);\n",
"printf('\n');\n",
"\n",
"// Solution (ii)\n",
"printf('For X2 = 0.75\n');\n",
"// A tangent is drawn to the curve at X1 = 0.75.\n",
"// The intercept at X2 = 0 or X1 = 1, gives V1_bar.\n",
"V1_bar2 = 36.6*10^(-6);// [cubic m/mol]\n",
"// The intercept at X2 = 1 or X1 = 0, gives V2_bar.\n",
"V2_bar2 = 12.4*10^(-6);// [cubic m/mol]\n",
"point1 = [0 V1_bar1; 1 V2_bar1];\n",
"point2 = [0 V1_bar2;1 V2_bar2];\n",
"scf(2);\n",
"plot(point1(:,1),point1(:,2),point2(:,1),point2(:,2));\n",
"legend('X1 = 0.5','X1 = 0.75');\n",
"xlabel('Mole fraction');\n",
"ylabel('Molar Volume');\n",
"printf('Partial molar volume of component 1 is %.2e cubic m/mol\n',V1_bar);\n",
"printf('Partial molar volume of component 2 is %.2e cubic m/mol\n',V2_bar);"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.8: Gibbs_Duhem_Equatio.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.8\n",
"// Page: 352\n",
"\n",
"printf('Example: 9.8 - Page: 352\n\n');\n",
"\n",
"// Mathematics is involved in proving but just that no numerical computations are involved.\n",
"// For prove refer to this example 9.8 on page number 352 of the book.\n",
"\n",
"printf(' Mathematics is involved in proving but just that no numerical computations are involved.\n\n');\n",
"printf(' For prove refer to this example 9.8 on page 352 of the book.');"
   ]
   }
,
{
		   "cell_type": "markdown",
		   "metadata": {},
		   "source": [
			"## Example 9.9: Gibbs_Duhem_Equatio.sce"
		   ]
		  },
  {
"cell_type": "code",
	   "execution_count": null,
	   "metadata": {
	    "collapsed": true
	   },
	   "outputs": [],
"source": [
"clear;\n",
"clc;\n",
"\n",
"// Example: 9.9\n",
"// Page: 352\n",
"\n",
"printf('Example: 9.9 - Page: 352\n\n');\n",
"\n",
"// Mathematics is involved in proving but just that no numerical computations are involved.\n",
"// For prove refer to this example 9.9 on page number 352 of the book.\n",
"\n",
"printf(' Mathematics is involved in proving but just that no numerical computations are involved.\n\n');\n",
"printf(' For prove refer to this example 9.9 on page 352 of the book.');"
   ]
   }
],
"metadata": {
		  "kernelspec": {
		   "display_name": "Scilab",
		   "language": "scilab",
		   "name": "scilab"
		  },
		  "language_info": {
		   "file_extension": ".sce",
		   "help_links": [
			{
			 "text": "MetaKernel Magics",
			 "url": "https://github.com/calysto/metakernel/blob/master/metakernel/magics/README.md"
			}
		   ],
		   "mimetype": "text/x-octave",
		   "name": "scilab",
		   "version": "0.7.1"
		  }
		 },
		 "nbformat": 4,
		 "nbformat_minor": 0
}