Beruflich Dokumente
Kultur Dokumente
1 Funded
Book Description
Title: A Textbook Of Chemical Engineering Thermodynamics
Author: K. V. Narayanan
Publisher: Prentice Hall Of India, New Delhi
Edition: 15
Year: 2011
ISBN: 978-81-203-1732-1
Scilab numbering policy used in this document and the relation to the
above book.
Exa Example (Solved example)
Eqn Equation (Particular equation of the above book)
AP Appendix to Example(Scilab Code that is an Appednix to a particular
Example of the above book)
For example, Exa 3.51 means solved example 3.51 of this book. Sec 2.3 means
a scilab code whose theory is explained in Section 2.3 of the book.
Contents
List of Scilab Codes
11
18
34
51
72
105
7 Properties of Solutions
130
8 Phase equilibria
155
194
1.1
1.2
1.3
1.4
1.5
1.6
1.7
2.1
2.2
Exa 2.3
Exa 2.4
Exa 2.5
Exa 2.6
Exa 2.7
Exa 2.8
Exa 2.9
Exa 2.10
Exa 2.11
Exa 2.12
Exa 2.13
11
12
13
13
14
15
16
18
19
20
20
22
23
24
25
26
27
28
29
31
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
3.1
3.2
3.3
3.4
3.5
3.6
3.7
3.8
3.9
3.10
3.11
3.12
3.13
3.14
4.1
4.2
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
4.3
4.4
4.5
4.6
4.7
4.8
4.9
4.10
4.11
4.12
4.13
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
4.14
4.15
4.16
4.17
4.18
4.19
4.20
5.1
34
35
35
37
39
40
41
43
43
46
47
47
48
49
51
52
53
54
54
55
56
57
58
59
59
61
61
62
64
66
67
68
69
70
72
Exa 5.2
Exa 5.3
Exa 5.4
Exa 5.5
Exa 5.6
Exa 5.7
Exa
Exa
Exa
Exa
Exa
5.8
5.9
5.10
5.11
5.12
Exa 5.13
Exa 5.14
Exa 5.15
Exa 5.16
Exa 5.17
Exa 5.18
Exa 5.19
Exa 5.20
Exa 5.21
Exa 5.22
Exa 5.23
Exa 5.24
Exa
Exa
Exa
Exa
6.1
6.2
6.3
6.4
73
74
75
77
77
78
79
80
81
82
83
84
86
87
88
89
90
92
94
96
98
100
102
105
106
107
108
Exa 6.5
Exa 6.6
Exa 6.7
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
6.8
6.9
6.10
6.11
6.12
6.13
6.14
6.15
6.16
6.17
6.18
6.19
6.20
6.21
6.22
6.23
6.24
6.25
6.26
6.27
6.28
6.29
Exa
Exa
Exa
Exa
Exa
6.30
7.1
7.2
7.3
7.4
Exa 7.5
Exa 7.6
Exa 7.7
Exa 7.8
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
To calculate internal energy enthalpy entropy and fre
energy for 1 mole of nitrogen . . . . . . . . . . . . . .
To calculate entropy change and mean heat capacity .
Theoretical problem . . . . . . . . . . . . . . . . . . .
To calculate Cv for mercury . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
To estimate the fugacity of ammonia . . . . . . . . . .
To determine the fugacity of gas . . . . . . . . . . . .
To determine the fugacity coeffeceint at given pressure
Theoretical problem . . . . . . . . . . . . . . . . . . .
To determine the fugacity of pure ethylene . . . . . . .
To determine fugacity and fugacity coeffecient of steam
To estimate fugacity of ammonia . . . . . . . . . . . .
To calculate the fugacity of liquid water . . . . . . . .
To determine the fugacity of n butane in liquid state at
given conditions . . . . . . . . . . . . . . . . . . . . .
To determine the activity of solid magnesium . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
To find the volume of mixture . . . . . . . . . . . . . .
To find the required volume of methanol and water . .
To calculate the volume of water to be added and volume of dilute alcohol solution . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
To determine enthalpies of pure components and at infinite dilution . . . . . . . . . . . . . . . . . . . . . . .
To calculate the partial molar volume of the components
Theoretical problem . . . . . . . . . . . . . . . . . . .
7
109
109
110
111
113
114
115
115
116
117
117
118
118
119
119
120
121
121
122
123
124
124
125
126
127
128
130
130
132
133
134
135
136
137
Exa 7.9
Exa 7.10
Exa 7.11
Exa 7.12
Exa 7.13
Exa
Exa
Exa
Exa
Exa
Exa
7.14
7.15
7.16
7.17
7.18
7.19
Exa 7.20
Exa 7.21
Exa 7.22
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
7.23
7.24
8.1
8.2
8.3
8.4
8.5
8.6
Exa 8.7
Exa
Exa
Exa
Exa
Exa
8.8
8.9
8.10
8.11
8.12
Theoretical problem . . . . . . . . . . . . . . . . . . .
To estimate the solubility of oxygen in water at 298 K
To confirm that mixture conforms to Raoults Law and
to determine Henrys Law constant . . . . . . . . . . .
To calculate activity and activity coeffecient of chloroform . . . . . . . . . . . . . . . . . . . . . . . . . . . .
To determine fugacity fugacity coeffecient Henrys Law
constant and activity coeffecient . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
To determine enthalpies at infinite dilution . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
To determine change in entropy for the contents of the
vessel . . . . . . . . . . . . . . . . . . . . . . . . . . .
To determine heat of formation of LiCl in 12 moles of
water . . . . . . . . . . . . . . . . . . . . . . . . . . .
To calculate the free energy of mixing . . . . . . . . .
To calculate the mean heat capacity of 20 mol percent
solution . . . . . . . . . . . . . . . . . . . . . . . . . .
To find the final temperature attained . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
Theoretical problem . . . . . . . . . . . . . . . . . . .
To determine composition of vapour and liquid in equilibrium . . . . . . . . . . . . . . . . . . . . . . . . . .
To determine pressure at the beginning and at the end
of the process . . . . . . . . . . . . . . . . . . . . . . .
To determine temperature pressure and compositions .
To construct boiling point and equilibrium point diagram
Theoretical problem . . . . . . . . . . . . . . . . . . .
To calculate van Laar constants . . . . . . . . . . . . .
To calculate activity coeffecients in a solution containing
10 percent alcohol . . . . . . . . . . . . . . . . . . . .
138
139
140
141
143
144
145
146
146
147
148
149
150
151
153
153
155
155
156
157
157
158
159
160
163
165
165
166
Exa 8.13
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
8.14
8.15
8.16
8.17
8.18
8.19
8.20
8.21
8.22
8.23
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
8.24
8.25
8.26
8.27
8.28
9.1
9.2
9.3
9.4
9.5
9.6
9.7
9.8
Exa 9.9
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
Exa
9.10
9.11
9.12
9.13
9.14
9.15
9.16
9.17
9.18
To calculate equilibrium vapour composition for solution containing 20 mole percent hydrazine . . . . . . . 167
Theoretical problem . . . . . . . . . . . . . . . . . . . 169
To determine the total pressure . . . . . . . . . . . . . 170
To construct the Pxy diagram . . . . . . . . . . . . . 171
To determine the composition and total pressure of azeotrope 172
Theoretical problem . . . . . . . . . . . . . . . . . . . 174
To calculate equilibrium pressure and composition . . 174
To determine parameters in Wilsons equation . . . . . 177
To alculate bubble and dew point and the composition 179
To calculate bubble and dew point temperatures . . . 182
To test whetherthe given data are thermodynamically
consistent or not . . . . . . . . . . . . . . . . . . . . . 185
Theoretical problem . . . . . . . . . . . . . . . . . . . 186
To estimate the constants in Margules equation . . . . 187
To calculate the partial pressure of water in vapour phase 188
to calculate under three phase equilibrium . . . . . . . 189
To prepare temperature composition diagram . . . . . 191
Theoretical problem . . . . . . . . . . . . . . . . . . . 194
Theoretical problem . . . . . . . . . . . . . . . . . . . 194
Theoretical problem . . . . . . . . . . . . . . . . . . . 195
Theoretical problem . . . . . . . . . . . . . . . . . . . 196
Theoretical problem . . . . . . . . . . . . . . . . . . . 196
To calculate equilibrium constant . . . . . . . . . . . . 197
To calculate equilibrium constant at 500 K . . . . . . 198
To alculate standard free energy change and heat of formation . . . . . . . . . . . . . . . . . . . . . . . . . . 199
To estimate free energy change and equilibrium constant
at 700 K . . . . . . . . . . . . . . . . . . . . . . . . . 200
to calculate equilibrium constant at 600 K . . . . . . . 201
To calculate equilibrium constant at 500K . . . . . . . 202
To find the value of n . . . . . . . . . . . . . . . . . . 203
To determine the percent conversion . . . . . . . . . . 205
To calculate fractional dissociation of steam . . . . . . 206
To determine conversion of nitrogen affected by argon
207
To calculate the fractional dissociation of steam . . . . 208
To calculate the fractional distillation of steam . . . . 210
To evaluate the percent conversion of CO . . . . . . . 211
9
Exa 9.19
Exa 9.20
Exa 9.21
Exa 9.22
Exa 9.23
Exa 9.24
10
212
214
215
216
218
220
Chapter 1
Introduction and Basic
Concepts
Scilab code Exa 1.1 To find mans mass and weight on earth
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 1
3 // I n t r o d u c t i o n and B a s i c C o n c e p t s
4 // Example 1
5
6 clear all ;
7 clc ;
8
9
10 // Given :
11 F = 300; // [ N ]
12 g_local = 4.5; // l o c a l g r a v i t a t i o n a l a c c e l e r a t i o n [m/
s 2]
13 g_earth = 9.81; // e a r t h s g r a v i t a t i o n a l a c c e l e r a t i o n
[m/ s 2 ]
14
15
16 //To f i n d man s mass and w e i g h t on e a r t h
17 m = F / g_local ; // mass o f man [ kg ]
11
18 w = m * g_earth ; // w e i g h t o f man on e a r t h [ N ]
19 mprintf ( Mass o f man i s %f kg ,m ) ;
20 mprintf ( \ nWeight o f man on e a r t h i s %f N ,w ) ;
21
22
23 // end
// Given :
p1 = 1.15*10^5; // m e a s u r e d p r e s s u r e [ N/m 2 ]
p2 = 1.01325*10^5; // a t m o s p h e r i c p r e s s u r e [ N/m 2 ]
sg = 2.95; // s p e c i f i c g r a v i t y o f f l u i d
//To f i n d h e i g h t o f manometer f l u i d
p = p1 - p2 ; // d i f f e r e n c e i n p r e s s u r e
// U s i n g e q u a t i o n 1 . 2 ( Page no . 6 )
h = p /( sg *(10^3) *9.8067) ; // h e i g h t o f manometer
f l u i d [m]
19 mprintf ( H e i g h t o f manometer f l u i d i s %f m ,h ) ;
20
21
22
// end
12
Scilab code Exa 1.3 To find height from ground and Kinetic Energy
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
// Given
PE = 1.5*10^3; // p o t e n t i a l e n e r g y [ J ]
m = 10; // mass i n kg
u = 50; // v e l o c i t y i n m/ s
//To f i n d h e i g h t from g r o u n d and k i n e t i c e n e r g y
// U s i n g e q u a t i o n 1 . 8 ( Page no . 8 )
h = PE /( m *9.8067) ; // h e i g h t from g r o u n d i n m
// U s i n g e q u a t i o n 1 . 9 ( Page no . 8 )
KE = 0.5* m *( u ^2) ; // K i n e t i c e n e r g y i n J
mprintf ( H e i g h t from g r o u n d i s %f m ,h ) ;
mprintf ( \ n K i n e t i c Energy o f body i s %3 . 2 e J , KE ) ;
// end
13
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
clear all ;
clc ;
// Given
F = 600; // w e i g h t i n N
t = 120; // t i m e i n s e c
h = 0.18; // h e i g h t o f s t a i r s i n m
//To d e t e r m i n e t h e power d e v e l o p e d i n man
S = 20* h ; // t o t a l v e r t i c a l d i s p l a c e m e n t i n m
W = F * S ; // work done i n J
P = W / t ; // power d e v e l o p e d
mprintf ( Power d e v e l o p e d i s %i W ,P ) ;
// end
Scilab code Exa 1.5 To determine the force exerted pressure work done
and change in potential energy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// Given :
A = ( %pi /4) *(0.1^2) ; // a r e a i n m2
P = 1.01325*10^5; // p r e s s u r e i n N/m2
m = 50; // mass o f p i s t o n and w e i g h t i n kg
g = 9.81; // a c c e l e r a t i o n due t o g r a v i t y (N/m 2 )
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
clear all ;
15
8 clc ;
9
10
11 // Given :
12 //P/D = c o n s t a n t , where P i s
p r e s s u r e and D i s
diameter
13 //P = ( 2 1 0 5 ) D
14 Df = 2.5; // f i n a l d i a m e t e r (m)
15 Di = 0.5; // i n i t i a l d i a m e t e r (m)
16
17 //To d e t e r m i n e work done by g a s
18 // Work done = i n t e g r a l (PdV)
19 //W = i n t g ( ( 2 1 0 5 D) d ( p i / 6 ) (D 3 ) ) . . . . t h a t
20 W = ( %pi /4) *10^5*(( Df ^4) - Di ^4) ;
21 mprintf ( Work done by g a s i s %6 . 4 e J ,W ) ;
22
23 // end
is
clear all ;
clc ;
// Given :
T = 300; // t e m p e r a t u r e i n K
P = 6.5*10^5; // p r e s s u r e i n N/m2
Pa = 1.01325*10^5; // a t m o s p h e r i c p r e s s u r e i n N/m2
R = 8.314; // i d e a l g a s c o n s t a n t
16
16
17
18
19
20
21
22
23
24
25
26
27
28
29
m = 2; // mass o f g a s ( kg )
M = 44; // m o l e c u l a r w e i h g t o f g a s
//To f i n d t h e work done on s u r r o u n d i n g
n = m / M ; // n i s number o f k m o l e s
Vi = ( n * R *10^3* T ) / P ; // i n i t i a l volume i n m3
Vf = 2* Vi ; // f i n a l volume i n m3
V = Vf - Vi ; // c h a n g e i n volume
Ps = Pa +(5000*9.8067) ; // p r e s s u r e on s u r r o u n d i n g s
W = Ps * V ; // work done on t h e s u r r o u n d i n g s
mprintf ( Work done on s u r r o u n d i n g s i s %5 . 2 e J ,W ) ;
// end
17
Chapter 2
First Law of Thermodynamics
surrounding in J/ s
14
15 //To f i n d t h e c h a n g e i n i n t e r n a l e n e r g y
16 // U s i n g e q u a t i o n 2 . 4 ( Page no . 2 6 )
17 U = Q - W ; // c h a n g e i n i n t e r n a l e n e r g y i n J / s
18 mprintf ( I n t e r n a l e n e r g y o f s y s t e m i n c r e a s e s by %f J
/ s ,U ) ;
19
18
20
// end
Scilab code Exa 2.2 To find heat liberated work done and change in internal energy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
clear all ;
clc ;
// Given
T = 298; // t e m p e r a t u r e i n K
P = 101; // p r e s s u r e i n kPa
n_iron = 2; // m o l e s o f i r o n r e a c t e d
Q = -831.08; // h e a t l i b e r a t e d i n kJ
R = 8.314; // i d e a l g a s c o n s t a n t
19
28
29
30
mprintf ( \ nChange i n i n t e r n a l e n e r g y i s %6 . 3 e J ,U ) ;
// end
Scilab code Exa 2.3 To find the heat energy dissipated by brakes
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 2
3 // F i r s t Law o f Thermodynamics
4 // Example 3
5
6
7 clear all ;
8 clc ;
9
10
11 // Given
12 u = 20; // s p e e d o f c a r i n m/ s
13 z = 30; // h e i g h t v e r t i c a l l y a b o v e t h e bottom o f h i l l
14
15
16
17
18
19
20
21
22
23
in m
m = 1400; // mass o f c a r i n kg
//To f i n d t h e h e a t e n e r g y d i s s i p a t e d by b r a k e s
// U s i n g e q u a t i o n 2 . 3 ( Page no . 2 6 )
KE = -0.5* m *( u ^2) ; // c h a n g e i n k i n e t i c e n e r g y i n J
PE = -m *9.81* z ; // c h a n g e i n p o t e n t i a l e n e r g y i n J
Q = -( KE + PE ) ; // h e a t d i s s i p a t e d by b r a k e s i n J
mprintf ( Heat d i s s i p a t e d by b r a k e s i s %3 . 2 e J ,Q ) ;
// end
Scilab code Exa 2.4 To find internal energy change during each step and
work done during adiabatic process
20
p r e s s u r e p r o c e s s i s %i J , U1 ) ;
23
24 // For s t e p 2
25 W2 = 0; // work done f o r
c o n s t a n t volume p r o c e s s i s
zero
26 Q2 = 75; // h e a t r e c e i v e d i n J
27 U2 = Q2 ; // i n t e r n a l e n e r g y c h a n g e i n J
28 mprintf ( \ nChange i n i n t e r n a l e n e r g y f o r c o n s t a n t
volume p r o c e s s i s %i J , U2 ) ;
29
30 // For s t e p 3
31 Q3 = 0; // no h e a t e x c h a n g e i n
32 // S i n c e t h e p r o c e s s i s c y c l i c
33 //U3+U2+U1 = 0 ;
34 U3 = -( U1 + U2 ) ;
21
adiabatic process
35 W3 = - U3 ; // work done i n J
36 mprintf ( \nWork done d u r i n g
a d i a b a t i c p r o c e s s i s %i
J , W3 ) ;
37
38
// end
Scilab code Exa 2.5 To find change in internal energy and enthalpy
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 2
3 // F i r s t Law o f Thermodynamics
4 // Example 5
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 n_water = 10^3; // m o l e s o f w a t e r
13 T = 373; // t e m p e a r t u r e (K)
14 P = 101.3; // p r e s s u r e ( kPa )
15 sv_liquid = 0.00104; // s p e c i f i c volume o f l i q u i d (m
3/ kmol )
sv_vapour = 1.675; // s p e c i f i c volume o f v a p o u r (m3/
kmol )
17 Q = 1.03*10^3; // h e a t added i n kJ
16
18
19 //To f i n d c h a n g e i n i n t e r n a l e n e r g y and e n t h a l p y
20 W = P * n_water *( sv_vapour - sv_liquid ) *10^ -3; //
e x p a n s i o n work done i n kJ
21 U = Q - W ; // c h a n g e i n i n t e r n a l e n e r g y i n kJ
22
23 // For c o n s t a n t p r e s s u r e p r o c e s s
24 H = Q ; // e n t h a l p y c h a n g e i n kJ
22
25
26
27
28
mprintf ( Change i n i n t e r n a l e n e r g y i s %f kJ ,U ) ;
mprintf ( \ nChange i n e n t h a l p y i s %3 . 2 e kJ ,H ) ;
// end
Scilab code Exa 2.6 To find internal energy of saturated liquid and internal energy and enthalpy of saturated vapour
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 2
3 // F i r s t Law o f Thermodynamics
4 // Example 6
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 T = 233; // t e m p e r a t u r e i n K
13 VP = 1.005*10^3; // v a p o u r p r e s s u r e o f CO2 i n kPa
14 sv_liquid = 0.9*10^ -3; // s p e c i f i c volume o f l i q u i d
15
16
17
18
19
20
CO2 i n m3/ kg
sv_vapour = 38.2*10^ -3; // s p e c i c i f i c volume o f CO2
v a p o u r i n m3/ kg
L = 320.5; // l a t e n t h e a t o f v a p o r i s a t i o n o f CO2 i n
kJ / kg
// Assuming a t t h e s e c o n d i t i o n s CO2 i s s a t u r a t e d
l i q u i d so
H1 = 0; // e n t h a l p y i n l i q u i d s t a t e
//To f i n d i n t e r n a l e n e r g y o f s a t u r a t e d l i q u i d and
i n t e r n a l e n e r g y and e n t h a l p y o f s a t u r a t e d v a p o u r
21 // For s a t u r a t e d l i q u i d
22 U1 = H1 -( VP * sv_liquid ) ; // i n t e r n a l e n e r g y i n l i q u i d
23
23
24
25
26
27
28
29
30
s t a t e i n kJ / kg
// For s a t u r a t e d v a p o u r
Hv = H1 + L ; // e n t h a l p y o f s a t u r a t e d v a p o u r i n kJ / kg
Uv = Hv -( VP * sv_vapour ) ; // i n t e r n a l e n e r g y i n v a p o u r
s t a t e i n kJ / kg
mprintf ( I n t e r n a l Energy o f s a t u r a t e d l i q u i d i s %f
kJ / kg , U1 ) ;
mprintf ( \ n E n t h a l p y o f v a p o u r s t a t e i s %f kJ / kg , Hv )
;
mprintf ( \ n I n t e r n a l Energy o f v a p o u r s t a t e i s %f kJ /
kg , Uv ) ;
// end
Scilab code Exa 2.7 To calculate molar internal energy change and molar
enthalpy change
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
clear all ;
clc ;
// Given :
I = 0.5; // c u r r e n t i n Amperes
V = 12; // v o l t a g e i n v o l t s
t = 5*60; // t i m e i n s e c
m = 0.798; // mass o f w a t e r v a p o r i s e d i n g
M = 18; // m o l e c u l a r mass o f w a t e r i n g
//To c a l c u l a t e m o l a r i n t e r n a l e n e r g y c h a n g e and
24
//BY i d e a l g a s e q u a t i o n PV=RT
// R e f e r r i n g e q u a t i o n 2 . 9 f o r c o n s t a n t p r e s s u r e
p r o c e s s ( Page no . 2 9 )
25 U = H -(8.314*10^ -3*373) ; // m o l a r i n t e r n a l e n e r g y
c h a n g e i n kJ / mole
26 mprintf ( Molar E n t h a l p y c h a n g e d u r i n g t h e p r o c e s s i s
%i kJ / mole ,H ) ;
27 mprintf ( \ nMolar I n t e r a n l Energy c h a n g e d u r i n g t h e
p r o c e s s i s %f kJ / mole ,U ) ;
28
29
// end
clear all ;
clc ;
// Given :
m = 1650; // mass o f steam u s e d i n kg / h r
H1 = 3200; // e n t h a l p y a t 1 3 6 8 kPa and 645 K i n kJ / kg
H2 = 2690; // e n t h a l p y a t 137 kPa and 645 K i n kJ / kg
//To d e t e r m i n e t h e t h e o r e t i c a l h o r s e p o w e r d e v e l o p e d
25
17 // U s i n g e q u a t i o n 2 . 1 3 ( Page no . 3 2 )
18 Q = 0; // s i n c e t h e p r o c e s s i s a d i a b a t i c
19 z = 0; // a s s u m i n g t h a t i n l e t and d i s c h a r g e
20
21
22
23
24
25
26
of
t u r b i n e a r e a t same l e v e l
u = 0; // f e e d and d i s c h a r g e v e l o c i t i e s b e i n g e q u a l
Ws = -( H2 - H1 ) ;
Wj = Ws *10^3* m /3600; // work done by t u r b i n e i n J
W = Wj /745.7; // work done by t u r b i n e i n hp
mprintf ( Work done by t u r b i n e i s %f hp ,W ) ;
// end
Scilab code Exa 2.9 To find temperature of water delivered to second storage tank
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Given :
m = 25*10^3; // mass f l o w r a t e o f w a t e r i n kg / h
P = 2; // power s u p p l i e d by motor i n hp
q = 42000; // h e a t g i v e n i n kJ / min
z = 20; // e l e v a t i o n i n m
T = 368; // t e m p e r a t u r e i n K
To = 273; // s t a n d a r d t e m p e r a t u r e i n K
Cp = 4.2; // s p e c i f i c h e a t o f w a t e r i n kJ / kg K
//To f i n d t e m p e r a t u r e o f w a t e r d e l i v e r e d t o s e c o n d
s t o r a g e tank
26
w a t e r pumped i n kJ / kg
21 Q = q *60/ m ; // h e a t g i v e n o u t p e r kg o f f l u i d
22 PE = 09.81* z *10^ -3; // c h a n g e i n p o t e n t i a l e n e r g y i n
kJ / kg
23
24
25
26
27
28
29
30
31
32
33
// U s i n g e q u a t i o n 2 . 1 3 ( Page no . 3 2 )
H = -Q +W - PE ;
//H = H2H1
H1 = Cp *( T - To ) ;
H2 = H1 + H ;
// L e t T1 be t h e t e m p e r a t u r e a t s e c o n d s t o r a g e t a n k
T1 = To +( H2 / Cp ) ;
mprintf ( T e m p e r a t u r e o f w a t e r a t s e c o n d s t o r a g e t a n k
i s %i K , T1 ) ;
// end
Scilab code Exa 2.10 To find change in enthalpy and maximum enthalpy
change
1
2
3
4
5
6
7
8
9
10
11
12
13
14
clear all ;
clc ;
// Given :
D1 = 25; // i n t e r n a l d i a m e t e r o f p i p e i n mm
u1 = 10; // u p s t r e a m v e l o c i t y i n m/ s
D2 = 50; // downstream d i a m e t e r o f p i p e i n mm
27
// S i n c e t h e r e i s no e x t e r n a l d e v i c e f o r a d d i n g o r
r e m o v i n g e n e r g y a s work
16 //Q = 0 , Ws = 0
15
17
18
19
20
21
// ( a )
// L e t A1 nad A2 be u p s t r e a m and downstream
c r o s s s e c t i o n a l areas of pipe
22 u2 = (( D1 / D2 ) ^2) * u1 ; // downstream v e l o c i t y i n m/ s
23 H = 0.5*( u1 ^2 - u2 ^2) ; // c h a n g e i n e n t h a l p y i n J / kg
24 mprintf ( Change i n e n t h a l p y i s %f J / kg ,H ) ;
25
26 // ( b )
27 // For maximum e n t h a l p y c h a n g e
28 u2 = 0;
29 Hmax = 0.5* u1 ^2; // ( J / kg )
30 mprintf ( \nMaximum e n t h a l p y c h n a g e f o r a s u d d e n
e n l a r g e m e n t i n p i p e i s %f J / kg , Hmax ) ;
31
32
// end
28
11
12
13
14
15
16
17
18
19
// Given :
// At i n l e t :
T1 = 293; // T e m p e r a t u r e (K)
P1 = 300+136.8; // P r e s s u r e ( kPa )
// At e x i t :
T2 = 453; // T e m p e r a t u r e (K)
P2 = 136.8; // P r e s s u r e ( kPa )
Cp = 29.4; // s p e c i f i c h e a t c a p a c i t y a t c o n s t a n t
p r e s s u r e i n kJ / kmol
20 m = 1000; // mass o f h y d r o g e n i n kg
21 M = 2.02; // m o l e c u l a r mass o f h y d r o g e n
22
23
24
25
//To d e t e r m i n e h e a t t r a n s f e r r a t e s
// N e g l e c t i n g t h e k i n e t i c nd p o t e n t i a l e n e r g y c h a n g e s
// Assuming t h e p r o c e s s t o be o c c u r i n g t h r o u g h a
number o f s t e p s
26
27 // S t e p 1 be i s o t h e r m a l and s t e p 2 be i s o b a r i c
28 H1 = 0; // c h a n g e i n e n t h a l p y f o r s t e p 1
29 H2 = ( m / M ) * Cp *( T2 - T1 ) /1000; // c h a n g e i n e n t h a l p y
for
s t e p 2 i n kJ
30 H = H2 + H1 ;
31 Q = H ; // h e a t t r a n s f e r r e d
32 mprintf ( Heat t r a n s f e r r e d
33
34 // end
i n c o i l s i n kJ
i n c o i l s i s %f kJ , Q ) ;
Scilab code Exa 2.12 To find change in internal energy enthalpy heat supplied and work done
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
clear all ;
clc ;
// Given :
m = 10; // mass o f a i r i n kg
P1 = 100; // i n i t i a l p r e s s u r e ( kPa )
T1 = 300; // i n i t i a l t e m p e r a t u r e (K)
T2 = 600; // f i n a l t e m p e r a t u r e (K)
R = 8.314; // i d e a l g a s c o n s t a n t ( kJ / kmol K)
Cp = 29.099; // s p e c i f i c h e a t c a p a c i t y a t c o n s t a n t
p r e s s u r e ( kJ / kmol K)
18 Cv = 20.785; // s p e c i f i c h e a t c a p a c i t y a t c o n s t s a n t
volume ( kJ / kmol K)
19 M = 29; // m o l e c u l a r w e i g h t o f a i r
20
21
//To d e t e r m i n e c h a n g e i n i n t e r n a l e n e r g y e n t h a l p y
h e a t s u p p l i e d and work done
22 n = m / M ; // number o f m o l e s o f g a s ( kmol )
23 V1 = ( n * R * T1 ) / P1 ; // i n i t i a l volume o f a i r (m 3 )
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// ( a )
// C o n s t a n t volume p r o c e s s
V2 = V1 ; // f i n a l volume
// Change i n i n t e r n a l e n e r g y U = n i n t g ( CvdT ) . . . s o
U = n * Cv *( T2 - T1 ) ; // c h a n g e i n i n t e r n a l e n e r g y ( kJ )
Q = U ; // h e a t s u p p l i e d ( kJ )
W = 0; // work done
H = U +( n * R *( T2 - T1 ) ) ; // c h a n g e i n e n t h a l p y ( kJ )
disp ( For c o n s t a n t volume p r o c e s s ) ;
mprintf ( \ nChange i n i n t e r n a l e n e r g y i s %i kJ ,U ) ;
mprintf ( \ nHeat s u p p l i e d i s %i kJ ,Q ) ;
mprintf ( \nWork done i s %i kJ ,W ) ;
mprintf ( \ nChange i n e n t h a l p y i s %i kJ ,H ) ;
// ( b )
30
40
41
42
43
44
45
46
47
48
49
50
51
52
// C o n s t a n t p r e s s u r e p r o c e s s
// Change i n e n t h a l p y H = n i n t g ( CpdT ) . . . s o
H = n * Cp *( T2 - T1 ) ; // c h a n g e i n e n t h a l p y ( kJ )
Q = H ; // h e a t s u p p l i e d ( kJ )
U = H -( n * R *( T2 - T1 ) ) ; // c h a n g e i n i n t e r n a l e n e r g y ( kJ )
W = Q - U ; // work done ( kJ )
mprintf ( \n\ nFor c o n s t a n t p r e s s u r e p r o c e s s ) ;
mprintf ( \n\ nChange i n i n t e r n a l e n e r g y i s %i kJ ,U ) ;
mprintf ( \ nHeat s u p p l i e d i s %i kJ ,Q ) ;
mprintf ( \nWork done i s %i kJ ,W ) ;
mprintf ( \ nChange i n e n t h a l p y i s %i kJ ,H ) ;
// end
Scilab code Exa 2.13 To determine change in internal energy and change
in enthalpy
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 2
3 // F i r s t Law o f Thermodynamics
4 // Example 13
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 R = 8.314; // i d e a l g a s c o n s t a n t ( kJ / kmol K)
13 Cv = 20.8; // s p e c i f i c h e a t c a p a c i t y a t c o n s t a n t
volume ( kJ / kmol K)
14 Cp = 29.1; // s p e c i f i c
p r e s s u r e ( kJ / kmol K)
15 P1 = 10; // i n i t i a l p r e s s u r e ( b a r )
16 T1 = 280; // i n i t i a l t e m p e r a t u r e i n K
31
17 P2 = 1; // f i n a l p r e s s u r e ( b a r )
18 T2 = 340; // f i n a l t e m p e r a t u r e (K)
19
20 //To d e t e r m i n e t h e c h a n g e i n i n t e r n a l
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
e n e r g y and
change in enthalpy
// S o l u t i o n
n = 1; // b a s i s : 1 kmol o f i d e a l g a s
V1 = ( n * R * T1 ) /( P1 *100) ; // i n i t i a l volume i n m3
V2 = ( n * R * T2 ) /( P2 *100) ; // f i n a l volume i n m3
// Assuming t h e c h a n g e i n s t a t e i s o c c u r i n g a l o n g t h e
f o l l o w i n g two s t e p p r o c e s s
// 1 . A c o n s t a n t volume p r o c e s s i n which t h e p r e s s u r e
i s r e d u c e d t o t h e f i n a l v a l u e P2 and t h e
t e m p e r a t u r e g e t s r e d u c e d t o T2
// L e t Po and Vodenote t h e p r e s s u r e and volume o f
system a f t e r t h i s step
Po = P2 ;
Vo = V1 ;
To = ( Po *100* Vo ) /( n * R ) ;
U1 = Cv *( To - T1 ) ;
H1 = U1 +( V1 *100*( P2 - P1 ) ) ;
W1 = 0;
Q1 = U1 ;
// 2 . A c o n s t a n t p r e s s u r e p r o c e s s i n which t h e g a s i s
h e a t e d t o t h e f i n a l t e m p e r a t u r e T2 and t h e f i n a l
volume V2
H2 = Cp *( T2 - To ) ;
U2 = H2 -100*( V2 - V1 ) ;
Q2 = H2 ;
W2 = Q2 - U2 ;
38
39
40
41
42
43 // For a c t u a l p r o c e s s
44 U = U1 + U2 ; // c h a n g e i n i n t e r n a l e n e r g y ( kJ )
45 H = H1 + H2 ; // c h a n g e i n e n t h a l p y ( kJ )
46 mprintf ( Change i n i n t e r n a l e n e r g y i s %f kJ ,U ) ;
47 mprintf ( \ nChange i n e n t h a l p y i s %f kJ ,H ) ;
32
48
49
// end
33
Chapter 3
PVT Behaviour And Heat
Effects
clear all ;
clc ;
// Given :
T = 350; // t e m p e r a t u r e i n K
P = 10^5; // p r e s s u r e i n N/m2
R = 8.314; // i d e a l g a s c o n s t a n t
//To f i n d t h e m o l a r volume o f a i r
V = ( R * T ) / P ; // m o l a r volume i n m3
mprintf ( Molar volume o f a i r i s %3 . 2 e c u b i c m/ mol ,V
34
);
20
21
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
15
16
// end
Scilab code Exa 3.3 To determine heat and work effects for each step
1
2
3
4
5
6
7
clear all ;
35
8 clc ;
9
10
11 // Given :
12 Cp = 29.3; // s p e c i f i c
h e a t a t c o n s t a n t p r e s s u r e ( kJ /
kmol K)
13 R = 8.314; // i d e a l g a s c o n s t a n t
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 // S t e p 2 : The p r o c e s s i s a d i a b a t i c
30 Q2 = 0; // t h e p r o c e s s i s a d i a b a t i c
31 P3 = 1; // p r e s s u r e a f t e r s t e p 2 i n b a r
32 gama = ( Cp / Cv ) ;
33 T3 = (( P3 / P2 ) ^(( gama -1) / gama ) ) * T2 ; // t e m p e r a t u r e
after step 2
34 W2 = ( Cv *( T2 - T3 ) ) ; // work done by s y s t e m
35 mprintf ( \n\ nFor s t e p 2 ) ;
36 mprintf ( \ nHeat s u p p l i e d i n s t e p 2 i s %i , Q2 ) ;
37 mprintf ( \nWork done by s y s t e m i n s t e p 2 i s %f kJ /
kmol , W2 ) ;
38
39 // S t e p 3 : The p r o c e s s i s i s o b a r i c
40 T4 = 300; // t e m p e r a t u r e a f t e r s t e p 3 (K)
36
41 Q3 = Cp *( T4 - T3 ) ; // h e a t s u p p l i e d d u r i n g s t e p 3 ( kJ /
kmol )
42 U = ( Cv *( T4 - T3 ) ) ; // c h a n g e i n
i n t e r n a l energy during
s t e p 3 ( kJ / kmol )
43 W3 = Q3 - U ; // U s i n g f i r s t law o f t h e r m o d y n a m i c s
44 mprintf ( \n\ nFor s t e p 3 ) ;
45 mprintf ( \ nHeat g i v e n o u t by t h e s y s t e m i n s t e p 3 i s
%f kJ / kmol , Q3 ) ;
46 mprintf ( \nWork done on t h e s y s t e m i n s t e p 3 i s %f
kJ / kmol , W3 ) ;
47
48
// end
Scilab code Exa 3.4 To calculate change in internal energy change in enthalpy work done and heat supplied
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 3
3 //PVT B e h a v i o u r and Heat E f f e c t s
4 // Example 4
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 R = 8.314; // i d e a l g a s c o n s t a n t
13 Cp = 30; // s p e c i f i c h e a t a t c o n s t a n t p r e s s u r e ( J / mol
K)
14
15
//To c a l c u l a t e c h a n g e i n i n t e r n a l e n e r g y c h a n g e i n
e n t h a l p y work done and h e a t s u p p l i e d
37
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
// ( a ) : Gas i s expanded i s o t h e r m a l l y
T = 600; // t e m p e r a t u r e i n K
P1 = 5; // i n i t i a l p r e s s u r e i n b a r
P2 = 4; // f i n a l p r e s s u r e i n b a r
U1 = 0; // s i n c e t h e p r o c e s s i s i s o t h e r m a l
H1 = 0; // s i n c e t h e p r o c e s s i s i s o t h e r m a l
W1 = ( R * T * log ( P1 / P2 ) ) ; // work done d u r i n g t h e
process
Q1 = W1 ; // h e a t s u p p l i e d d u r i n g t h e p r o c e s s
mprintf ( When g a s i s expanded i s o t h e r m a l l y ) ;
mprintf ( \ nChange i n i n t e r n a l e n e r g y i n i s o t h e r m a l
p r o c e s s i s %i , U1 ) ;
mprintf ( \ nChange i n e n t h a l p y i n i s o t h e r m a l p r o c e s s
i s %i , H1 ) ;
mprintf ( \nWork done d u r i n g t h e p r o c e s s i s %f kJ /
kmol , W1 ) ;
mprintf ( \ nHeat s u p p l i e d d u r i n g t h e p r o c e s s i s %f kJ
/ kmol , Q1 ) ;
// ( b ) : Gas i s h e a t e d a t c o n s t a n t volume
V = 0.1; // volume (m 3 )
P1 = 1; // i n i t i a l p r e s s u r e ( b a r )
T1 = 298; // i n i t i a l t e m p e r a t u r e (K)
T2 = 400; // f i n a l t e m p e r a t u r e (K)
n = (( P1 * V *10^5) /( R * T1 ) ) ; // number o f m o l e s o f g a s
Cv = Cp - R ; // s p e c i f i c h e a t a t c o n s t a n t volume ( J / mol
K)
U2 = n * Cv *( T2 - T1 ) ; // c h a n g e i n i n t e r n a l e n e r g y ( J )
H2 = n * Cp *( T2 - T1 ) ; // c h a n g e i n e n t h a l p y ( J )
W2 = 0; // i s o c h o r i c p r o c e s s
Q2 = U2 + W2 ; // h e a t s u p p l i e d ( J )
mprintf ( \n\nWhen g a s i s h e a t e d a t c o n s t a n t volume )
;
mprintf ( \ nChange i n i n t e r n a l e n e r g y i s %f J , U2 ) ;
mprintf ( \ nChange i n e n t h a l p y i s %f J , H2 ) ;
mprintf ( \nWork done d u r i n g t h e p r o c e s s i s %i , W2 )
;
38
46
47
48
mprintf ( \ nHeat s u p p l i e d d u r i n g t h e p r o c e s s i s %f J
, Q2 ) ;
// end
Scilab code Exa 3.5 To determine work done and amount of heat transferred
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 3
3 //PVT B e h a v i o u r and Heat E f f e c t s
4 // Example 5
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 function [ y ] = Cv ( T ) ;
13
y = 27.4528+(6.1839*(10^ -3) * T ) -(8.9932*(10^ -7) *(
T ^2) ) -R ;
14 endfunction
15
16
17
18
19
20
21
22
23
24
m = 20; // mass o f a i r ( kg )
n = 1.25; // p o l y t r o p i c c o n s t a n t
P1 = 1; // i n i t i a l p r e s s u r e ( b a r )
P2 = 5; // f i n a l p r e s s u r e ( b a r )
T1 = 300; // t e m p e r a t u r e (K)
R = 8.314; // i d e a l g a s c o n s t a n t
M = 29; // m o l e c u l a r wt o f a i r
//To d e t e r m i n e work done and amount o f h e a t
39
transferred
25
26 // ( a ) : Work done by t h e c o m p r e s s o r p e r c y c l e
27 n_mole = m / M ; // m o l e s o f a i r ( kmol )
28 V1 = (( n_mole *10^3* R * T1 ) /( P1 *10^5) ) ; // i n i t i a l
volume (m 3 )
29 V2 = ( V1 *(( P1 / P2 ) ^(1/ n ) ) ) ; // f i n a l volume (m 3 )
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// S i n c e t h e p r o c e s s i s p o l y t r o p i c P(Vn )=c ( s a y
constant )
c = P1 *10^5*( V1 ^ n ) ;
// f u n c t i o n [ z ] = f (V) ;
//
z = c / (V 1 . 2 5 ) ;
// e n d f u n c t i o n
//W1 = i n t g ( V1 , V2 , f ) ; s o
W = ( c /(1 - n ) ) *(( V2 ^( - n +1) ) -( V1 ^( - n +1) ) ) /1000;
mprintf ( Work done by c o m p r e s s o r i s %4 . 3 e J ,W *1000)
;
// ( b ) : Amount o f h e a t t r a n s f e r r e d t o s u r r o u n d i n g
T2 = (( T1 * V2 * P2 ) /( V1 * P1 ) ) ; // f i n a l temp i n K
U1 = intg ( T1 , T2 , Cv ) ;
U = U1 * n_mole ; // c h a n g e i n i n t e r n a l e n e r g y ( kJ )
Q = U + W ; // h e a t s u p p l i e d
mprintf ( \ nChnage i n i n t e r n a l e n e r g y i s %f kJ ,U ) ;
mprintf ( \ nHeat s u p p l i e d i s %f kJ ,Q ) ;
// end
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
clear all ;
clc ;
// Given :
V = 0.3821*10^ -3 // m o l a r volume (m3/ mol )
T = 313; // t e m p e r a t u r e (K)
R = 8.314; // i d e a l g a s c o n s t a n t
a = 0.365; b = 4.28*10^ -5; // Vander Waals c o n s t a n t
//To compare t h e p r e s s u r e s
// ( a ) : I d e a l g a s e q u a t i o n
P = (( R * T ) /( V *10^5) ) ; // p r e s s u r e i n b a r
mprintf ( P r e s s u r e o b t a i n e d by i d e a l g a s e q u a t i o n i s
%f b a r ,P ) ;
22
23 // ( b ) : Van d e r Waals e q u a t i o n
24 P = (((( R * T ) /( V - b ) ) -( a /( V ^2) ) ) /(10^5) ) ;
25 mprintf ( \ n P r e s s u r e o b t a i n e d by Van d e r Waals
e q u a t i o n i s %f b a r ,P ) ;
26
27
// end
clear all ;
41
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
clc ;
//To f i n d Approx V a l u e
function [ A ]= approx (V , n )
A = round ( V *10^ n ) /10^ n ; //VV a l u e
funcprot (0)
endfunction
nTo what p l a c e
// Given :
T = 300; // t e m p e r a t u r e (K)
P = 100; // p r e s s u r e ( b a r )
R = 8.314; // i d e a l g a s c o n s t a n t
a = 0.1378; b = 3.18*10^ -5; // Van d e r w a a l s c o n s t a n t
//To c a l c u l a t e t h e volume
// ( a ) : I d e a l g a s e q u a t i o n
V_ideal = approx ((( R * T ) /( P *10^5) ) ,6) ;
mprintf ( Volume c a l c u l a t e d by i d e a l g a s e q u a t i o n i s
%4 . 2 e c u b i c m , V_ideal ) ;
28
29
30
31
// ( b ) : Van d e r Waals e q u a t i o n
function [ y ]= f ( V ) ;
y =(( P *10^5) +( a /( V ^2) ) ) *( V - b ) -( R * T ) ; // f u n c t i o n
to c a l c u l a t e d i f f e r e n c e between c a l c u l a t e d
and assumed volume
32 endfunction
33
34 V_real = 0;
35 for i = 0.20:0.01:0.30 // Van d e r w a a l s volume s h o u l d
36
37
38
39
40
be n e a r l y e q u a l t o I d e a l g a s valoume
res = approx ( f ( i *10^ -3) ,0) ;
for j = -5:5
if ( j == res ) // f o r v e r y s m a l l d i f f e r e n c e i may
be t a k e n a s e x a c t volume
V_real = i *10^ -3;
end
42
41 end
42 end
43 mprintf ( \ nVolume c a l c u l a t e d by Van d e r Waals
e q u a t i o n i s %3 . 2 e c u b i c m , V_real ) ;
44
45
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
13
14
// end
Scilab code Exa 3.9 To calculate compressibility factor and molar volume
1
2
3
4
5
6
43
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
clear all ;
clc ;
//To f i n d Approx V a l u e
function [ A ]= approx (V , n )
A = round ( V *10^ n ) /10^ n ; //VV a l u e
funcprot (0)
endfunction
nTo what p l a c e
// Given :
T = 500; // t e m p e r a t u r e (K)
P = 10; // p r e s s u r e ( b a r )
R = 8.314; // i d e a l g a s c o n s t a n t
B = -2.19*10^ -4; C = -1.73*10^ -8; // V i r i a l
coeffecients
22 Tc = 512.6; // c r i t i c a l t e m p e r a t u r e
23 Pc = 81; // c r i t i c a l p r e s s u r e
24
25
//To c a l c u l a t e c o m p r e s s i b i l i t y f a c t o r and m o l a r
volume
26
27
28
// ( a ) : T r u n c a t e d form o f v i r i a l e q u a t i o n
V_ideal = approx ((( R * T ) /( P *10^5) ) ,7) ; // i d e a l g a s
volume
29 function [ z ] = f1 ( V )
30
z = ((( R * T ) /( P *10^5) ) *(1+( B / V ) +( C /( V ^2) ) ) ) ; //
f u n c t i o n f o r o b t a i n i n g volume by v i r i a l
equation
31 endfunction
32
33
34
35
36
37
38
39
// l o o p f o r h i t and t r i a l method
flag = 1;
while ( flag ==1)
V_virial = approx ( f1 ( V_ideal ) ,7) ;
if ( approx ( V_ideal ,5) == approx ( V_virial ,5) )
flag = 0;
break ;
44
40
else
41
V_ideal = V_virial ;
42 end
43 end
44 mprintf ( Volume o b t a i n e d vy v i r i a l
e q u a t i o n i s %4 . 3 e
c u b i c m , V_virial ) ;
45 Z = approx ((( P *10^5* V_virial ) /( T * R ) ) ,3) ; //
compressibility factor
46 mprintf ( \ n C o m p r e s s i b i l t y f a c t o r f o r v i r i a l e q u a t i o n
i s %f ,Z ) ;
47
48 // ( b ) : R e d l i c h Kwong E q u a t i o n
49 // C o n s t a n t s i n R e d l i c h Kwong e q u a t i o n
50 a = approx (((0.4278*( R ^2) *( Tc ^2.5) ) /( Pc *10^5) ) ,4) ;
51 b = approx (((0.0867* R * Tc ) /( Pc *10^5) ) ,9) ;
52
53 V_ideal = approx ((( R * T ) /( P *10^5) ) ,7) ; // i d e a l g a s
volume
54
55
56
57
// F u n c t i o n t o f i n d volume by R e d l i c h Kwong e q u a t i o n
function [ x ] = f2 ( V )
x = (( R * T ) /( P *10^5) ) +b -(( a *( V - b ) ) /(( T ^0.5) *( P
*10^5) * V *( V + b ) ) ) ;
58 endfunction
59
60 // l o o p f o r h i t and t r i a l method
61 flag = 1;
62 while ( flag ==1)
63
V_redlich = approx ( f2 ( V_ideal ) ,7) ;
64
if ( approx ( V_ideal ,5) == approx ( V_redlich ,5) )
65
flag = 0;
66
break ;
67
else
68
V_ideal = V_redlich ;
69 end
70 end
71 mprintf ( \n\ nVolume o b t a i n e d by R e d l i c h Kwong
E q u a t i o n i s %4 . 3 e c u b i c m/ mol , V_redlich ) ;
45
compressibility factor
mprintf ( \ n C o m p r e s s b i l i t y f a c t o r by R e d l i c h Kwong
e q u a t i o n i s %f ,Z ) ;
// end
clear all ;
clc ;
// Given :
Ha = -890.94; // s t a n d a r d h e a t f o r r e a c t i o n a ( kJ )
Hb = -393.78; // s t a n d a r d h e a t f o r r e a c t i o n b ( kJ )
Hc = -286.03; // s t a n d a r d h e a t f o r r e a c t i o n c ( kJ )
//To c a l c u l a t e h e a t o f f o r m a t i o n o f methane g a s
// c 2 + b a g i v e s t h e f o r m a t i o n o f methane from
elements
18 Hf = (2* Hc ) + Hb - Ha ;
19 mprintf ( Heat o f f o r m a t i o n o f methane i s %f kJ / mol ,
Hf ) ;
20
21
// end
46
)
13 Hb = -296.03; // h e a t o f c o m b u s t i o n o f r e a c t i o n b ( kJ
)
14 Hc = -393.78; // h e a t o f c o m b u s t i o n o f r e a c t i o n c ( kJ
)
15 Hd = -167.57; // h e a t o f c o m b u s t i o n o f r e a c t i o n d ( kJ
)
16
17 //To c a l c u l a t e h e a t o f f o r m a t i o n o f c h l o r o f o r m
18 // c + ( 3 d ) a b g i v e s c h l o r o f o r m from i t s e l e m e n t s
19 Hf = Hc +(3* Hd ) -Ha - Hb ;
20 mprintf ( Heat o f f o r m a t i o n o f c h l o r o f o r m i s %f kJ /
mol , Hf ) ;
21
22
// end
4 // Example 12
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 Ho = -164987; // s t a n d a r d h e a t o f
r e a c t i o n a t 298 K
in J
13 T1 = 298;
14 T2 = 773; // t e m p e r a t u r e (K)
15
16 //To c a l c u l a t e s t a n d a r d h e a t o f r e a c t i o n a t 773 K
17 alpha = (2*29.16) +13.41 -26.75 -(4*26.88) ;
18 betta = ((2*14.49) +77.03 -42.26 -(4*4.35) ) *10^ -3;
19 gama = ((2* -2.02) -18.74+14.25+(4*0.33) ) *10^ -6;
20
21 // U s i n g e q u a t i o n 3 . 5 4 ( Page no . 6 7 )
22 H1 = Ho -( alpha * T1 ) -( betta *( T1 ^2) /2) -( gama *( T1 ^3) /3) ;
23
24 // At 773 K
25 Hr = H1 +( alpha * T2 ) +( betta *( T2 ^2) /2) +( gama *( T2 ^3) /3) ;
26 mprintf ( Heat o f r e a c t i o n a t 773 K i s %f kJ , Hr
/1000) ;
27
28
// end
48
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
clear all ;
clc ;
// Given :
To = 298; // s t a n d a r d t e m p e r a t u r e (K)
T1 = 400; // t e m p e r a t u r e o f r e a c t a n t s (K)
T2 = 600; // t e m p e r a t u r e o f p r o d u c t s (K)
Ho = -283.028; // s t a n d a r d h e a t o f r e a c t i o n ( kJ / mol )
//To d e t e r m i n e h e a t added o r removed
// B a s i s :
n_CO = 1; // m o l e s o f CO r e a c t e d
n_O2 = 1; // m o l e s o f o x y g e n s u p p l i e d
n_N2 = 1*79/21; // m o l e s o f n i t r o g e n
n1_O2 = 0.5; // m o l e s o f o x y g e n r e q u i r e d
n_CO2 = 1; // m o l e s o f c a r b o n d i o x i d e f o r m e d
// end
49
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
clear all ;
clc ;
// Given :
To = 298; // s t a n d a r d t e m p e r a t u r e (K)
T1 = 373; // t e m p e r a t u r e o f r e a c t a n t s (K)
Ho = 283178; // s t a n d a r d h e a t o f c o m b u s t i o n ( J / mol )
//To c a l c u l a t e t h e o r e t i c a l f l a m e t e m p e r a t u r e
// B a s i s :
n_CO = 1; // m o l e s o f CO
n_O2 = 1; // m o l e s o f o x y g e n s u p p l i e d
n1_O2 = 0.5; // m o l e s o f o x y g e n r e a c t e d
n_CO2 = 1; // m o l e s o f c a r b o n d i o x i d e f o r m e d
n_N2 = 79/21; // m o l e s o f n i t r o g e n
H1 = (( n_O2 *34.83) +( n_N2 *33.03) +( n_CO *29.23) ) *( To - T1
) ; // e n t h a l p y o f c o o l i n g o f r e a c t a n t s
// U s i n g e q u a t i o n 3 . 5 5 ( Page no . 6 9 )
H2 = Ho - H1 ;
Tf = H2 /(( n1_O2 *34.83) +( n_N2 *33.03) +( n_CO2 *53.59) )
+298; // f l a m e t e m p e r a t u r e
mprintf ( T h e o r e t i c a l f l a m e t e m p e r a t u r e i s %f K , Tf ) ;
// end
50
Chapter 4
Second Law of
Thermodynamics
clear all ;
clc ;
// Given :
T1 = 700; // t e m p e r a t u r e o f h e a t s o u r c e (K)
T2 = 300; // t e m p e r a t u r e o f h e a t s i n k (K)
//To c a l c u l a t e t h e maximum e f f i c i e n c y
eff =(( T1 - T2 ) / T1 ) ; // e f f i c i e n c y o f a h e a t e n g i n e
mprintf ( Maximum e f f i c i e n c y o f h e a t e n g i n e i s %f ,
eff ) ;
18
51
19
20
// end
Scilab code Exa 4.2 To determine minimum amount of work done and
heat given to surrounding
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
clear all ;
clc ;
// Given :
m = 1; // mass o f w a t e r ( kg )
T1 = 300; // t e m p e r a t u r e o f s u r r o u n d i n g (K)
T2 = 273; // t e m p e r a t u r e o f w a t e r (K)
Hf = 334.11; // l a t e n t h e a t o f f u s i o n o f i c e ( kJ / kg )
18
19 // ( a )
20 Q2 = m * Hf ; // h e a t a b s o b e d a t t e m p e r a t u r e T2
21 W = (( Q2 *( T1 - T2 ) ) / T2 ) ; //minimumm amount o f work
22
required
mprintf ( Minimum amount o f work r e q u i r e d i s %f kJ ,W
);
23
24 // ( b )
25 //Q1 i s t h e h e a t g i v e n up t h e s u r r o u n d i n g
26 Q1 = W + Q2 ;
52
27
28
29
30
mprintf ( \ nHeat g i v e n u p t o s u r r o u n d i n g i s %f kJ , Q1 )
;
// end
clear all ;
clc ;
// Given :
P_out = 4.5; // o u t p u t power ( hp )
P_in = 6.25; // i n p u t power (kW)
T1 = 1000; // s o u r c e t e m p e r a t u r e (K)
T2 = 500; // s i n k t e m p e r a t u r e (K)
//To d e t e r m i n e e f f i c i e n c y o f p r o p o s e d e n g i n e
ep = (( P_out *745.7) /( P_in *1000) ) ; // p r o p o s e d
efficiency
19 mprintf ( E f f i c i e n c y o f p r o p o s e d e n g i n e i s %f , ep ) ;
20
21 em = (( T1 - T2 ) / T1 ) ; //maximum e f f i c i e n c y
22 mprintf ( \ nThe maximum e f f i c i e n y i s %f , em ) ;
23 mprintf ( \ nHence t h e c l a i m o f t h e p r o p o s e d e n g i n e
i m p o s s i b l e );
24
25
53
is
26
// end
clear all ;
clc ;
// Given :
P = 500; // p r e s s u r e o f d r y s a t u r a t e d steam ( kPa )
// From steam t a b l e s
Hv = 2106; // l a t e n t h e a t o f v a p o r i s a t i o n ( kJ / kg )
T = 425; // s a t u r a t i o n t e m p e r a t u r e (K)
//To c a l c u l a t e t h e e n t r o p y o f e v a p o r a t i o n
//By e q u a t i o n 4 . 2 5 ( Page no . 9 3 )
Sv = ( Hv / T ) ; // e n t r o p y c h a n g e a c c o m p a n y i n g
vaporisation
21 mprintf ( Entropy o f e v a p o r a t i o n i s %f kJ / kg K , Sv ) ;
22
23
// end
3
4
5
6
7
8
9
10
11
12
13
14
15
// S e c o n d Law o f Thermodynamics
// Example 5
clear all ;
clc ;
// Given :
m = 2; // mass o f g a s ( kg )
T1 = 277; // i n i t i a l t e m p e r a t u r e (K)
T2 = 368; // f i n a l t e m p e r a t u r e (K)
Cv = 1.42; // s p e c i f i c g e a t a t c o n s t a n t volume ( kJ / kg
K)
16
17 //To d e t e r m i n e c h a n g e i n e n t r o p y
18 // U s i n g e q u a t i o n 4 . 3 1 ( Page no . 9 4 )
19 S = ( m * Cv * log ( T2 / T1 ) ) ; // c h a n g e i n e n t r o p y ( kJ /K)
20 mprintf ( Change i n e n t r o p y i s %f kJ /K ,S ) ;
21
22
23 // end
55
11
12
13
14
15
16
17
18
19
20
21
22
23
// Given :
T = 300; // t e m p e r a t u r e i n K
P1 = 10; // i n i t i a l p r e s s u r e ( b a r )
P2 = 1; // f i n a l p r e s s u r e ( b a r )
R = 8.314; // i e a l g a s c o n s t a n t
//To c a l c u l a t e t h e e n t r o p y c h a n g e
// U s i n g e q u a t i o n 4 . 3 3 ( Page no . 9 4 )
S = ( R * log ( P1 / P2 ) ) ; // ( kJ / kmol K)
mprintf ( Entopy c h a n g e i s %f kJ / kmol K ,S ) ;
// end
clear all ;
clc ;
// Given :
T1 = 335; // i n i t i a l t e m p e r a t u r e i n K
T2 = 300; // f i n a l t e m p e r a t u r e i n K
P1 = 10; // i n i t i a l p r e s s u r e ( b a r )
P2 = 1; // f i n a l p r e s s u r e ( b a r )
Cp = 29.3; // s p e c i f i c h e a t c o n s t a n t a t c o n s t a n t
p r e s s u r e ( kJ / kmol K)
17 R = 8.314; // i d e a l g a s c o n s t a n t
18
56
19 //To d e t e r m i n e c h a n g e i n e n t r o p y
20 // U s i n g e q u a t i o n 4 . 3 0 ( Page no . 9 4 )
21 S = (( Cp * log ( T2 / T1 ) ) -( R * log ( P2 / P1 ) ) ) ; // e n t r o p y
22
23
24
25
c h a n g e ( kJ / kmol K)
mprintf ( Entropy c h a n g e i n t h e p r o c e s s i s %f kJ / kmol
K ,S ) ;
// end
clear all ;
clc ;
// Given :
m1 = 10; // mass o f w a t e r a t 375 K ( kg )
m2 = 30; // mass o f w a t e r a t 275 K ( kg )
c = 4.2; // s p e c i f i c h e a t o f w a t e r ( kJ . kg K)
//To d e t e r m i n e t h e c h a n g e i n e n t r o p y
// L e t T be t h e f i n a l t e m p e r a t u r e (K)
T = (( m1 *375) +( m2 *275) ) /( m1 + m2 ) ;
// S1 be c h a n g e i n e n t r o p y f o r h o t w a t e r
S1 = ( m1 * c * log ( T /375) ) ; // [ kJ /K ]
// S2 be t h e c h a n g e i n e n t r o p y f o r c o l d w a t e r
57
24 S2 = ( m2 * c * log ( T /275) ) ; // [ kJ /K ]
25 // S be t h e t o t a l e n t r o p y c h a n g e
26 S = S1 + S2 ;
27 mprintf ( The t o t a l e n t r o p y c h a n g e
28 // end
i s %f kJ /K ,S ) ;
clear all ;
clc ;
// Given :
m1 = 35; // mass o f s t e e l i n kg
m2 = 150; // mass o f o i l i n kg
T1 = 725; // t e m p e r a t u r e o f s t e e l (K)
T2 = 275; // t e m p e r a t u r e o f o i l (K)
c1 = 0.88; // s p e c i f i c h e a t o f s t e e l ( kJ / kg K)
c2 = 2.5; // s p e c i f i c h e a t o f o i l ( kJ / kg K)
//To c a l c u l a t e t h e t o t a l e n t r o p y c h a n g e
// L e t T be t h e f i n a l t e m p e r a t u r e
T = ((( m1 * c1 * T1 ) +( m2 * c2 * T2 ) ) /(( m1 * c1 ) +( m2 * c2 ) ) ) ;
// S1 be t h e i n e n t r o p y f o r s t e e l
S1 = ( m1 * c1 * log ( T / T1 ) ) ; // [ kJ /K ]
// S2 be t h e c h a n g e i n e n t r o p y f o r o i l
S2 = ( m2 * c2 * log ( T / T2 ) ) ; // [ kJ /K ]
// S be t h e t o t a l e n t r o p y c h a n g e
58
28 S = S1 + S2 ;
29 mprintf ( The t o t a l
30
31 // end
e n t r o p y c h a n g e i s %f kJ /K ,S ) ;
clear all ;
clc ;
// Given :
n1 = 0.21; // volume % o f o x y g e n i n a i r
n2 = 0.79; // volume % o f n i t r o g e n i n a i r
R = 8.314; // i d e a l g a s c o n s t a n t
//To c a l c u l a t e e n t r o p y o f 1 kmol o f a i r
// U s i n g e q u a t i o n 4 . 3 5 ( Page no . 9 6 )
S = ( - R *( n1 * log ( n1 ) + n2 * log ( n2 ) ) ) ; // [ kJ / kmol K ]
mprintf ( The t o t a l e n t r o p y c h a n g e i s %f kJ / kmol K ,S
);
20 // end
Scilab code Exa 4.11 To determine change in entropy for the reaction
1
2
3 // S e c o n d Law o f Thermodynamics
4 // Example 11
5
6
7 clear all ;
8 clc ;
9
10 // Given :
11 // For t h e r e a c t i o n
12 //CO + 1/2O2 > CO2
13 H = -2.8318*10^5; // h e a t o f r e a c t i o n ( J / mol )
14 T = 298; // t e m p e r a t u r e o f r e a c t i o n i n K
15 // A b s o l u t e e n t r o p i e s f o r CO, O2 , CO2 a r e ( i n J / mol K
16
17
18
19
20
21
22
23
24
25
26
)
S_CO = 198;
S_O2 = 205.2;
S_CO2 = 213.8;
//To d e t e r m i n e t h e c h a n g e i n e n t r o p y f o r t h e
reaction
// R e f e r r i n g e q u a t i o n 4 . 3 6 ( Page no . 9 6 )
S_reactant = S_CO + 0.5* S_O2 ; // e n t r o p y c h a n g e f o r
reactants
S_product = S_CO2 ; // e n t r o p y c h a n g e f o r p r o d u c t s
S = S_product - S_reactant ; // t o t a l e n t r o p y c h a n g e
mprintf ( The t o t a l e n t r o p y c h a n g e f o r t h e r e a c t i o n
i s %f J / mol ,S ) ;
mprintf ( \ n S i n c e t h e r e a c t i o n i s h i g h l y i r r e v e r s i b l e
, e n t r o p y c h a n g e c a n n o t be c a l c u l a t e d a s t h e
r a t i o o f heat o f r e a c t i o n to the temperature );
27
28
// The e n e r g y a v a i l a b l e f o r u s e f u l work i s t h e
d i f f e r e n c e b e t w e e n h e a t o f r e a c t i o n and e n t r o p y
e n e r g y due t o i r e v e r s i b l e n a t u r e o f t h e p r o c e s s
29 W_useful = -H +( T * S ) ; // e n e r g y a v a i l a b l e f o r u s e f u l
work ( J )
30 mprintf ( \ nEnergy a v a i l a b l e f o r u s e f u l work i s %3 . 2 e
J , W_useful ) ;
60
31
32
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
13
14
// end
Scilab code Exa 4.13 To calculate change in entropy and check whether
the process is reversible
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 4
3 // S e c o n d Law o f Thermodynamics
4 // Example 13
5
6
7 clear all ;
8 clc ;
9
61
10
11
12
13
14
15
16
17
18
19
// Given :
H_steam = 2923.5; // e n t h a l p y o f s u p e r h e a t e d steam (
kJ / kg )
S_steam = 6.71; // e n t r o p y o f s u p e r h e a t e d steam ( kJ /
kg K)
H_liquid = 845; // e n t h a l p y o f s a t u r a t e d l i q u i d ( kJ /
kg )
S_liquid = 2.32; // e n t r o p y o f s a t u r a t e d l i q u i d ( kJ /
kg K)
T = 300; // t e m p e r a t u r e o f s y s t e m (K)
//To c a l c u l a t e c h a n g e i n e n t r o p y and c h e c k w h e t h e r
the process i s r e v e r s i b l e
S_system = S_liquid - S_steam ; // c h a n g e i n e n t r o p y o f
steam
20
21 // L e t Q be t h e h e a t g i v e n o u t d u r i n g c o n d e n s a t i o n
22 Q = -( H_liquid - H_steam ) ;
23 S_surrounding = Q / T ; // c h a n g e i n e n t r o p y o f t h e
surrounding
24 S_total = S_system + S_surrounding ; // t o t a l e n t r o p y
change
25 mprintf ( The t o t a l e n t r o p y c h a n g e i s %f kJ / kg ,
S_total ) ;
26 mprintf ( \ n S i n c e t o t a l e n t r o p y c h a n g e i s p o s i t i v e ,
the p r o c e s s i s i r r e v e r s i b l e );
27
28
// end
4 // Example 14
5
6
7 clear all ;
8 clc ;
9
10 // Given :
11 V = 1; // volume o f e a c h compartment i n c u b i c m e t e r s
12 P_sat = 683.6; // p r e s s u r e o f s a t u r a t e d steam ( kPa )
13 P_steam = 101.3; // p r e s s u r e o f s u p e r e a t e d steam ( kPa
)
14 T_sat = 437.2; // t e m p e r a t u r e o f s y s t e m (K)
15
16
17
18
19
20
21
// R e f e r r i n g steam t a b l e s
// For s a t u r a t e d steam a t p r e s s u r e 6 8 3 . 6 kPa and temp
437.2 K
H_sat = 2761; // e n t h a l p y o f s a t u r a t e d steam ( kJ / kg )
S_sat = 6.7133; // e n t r o p y o f s a t u r a t e d steam ( kJ / kg
K)
spvol_sat = 278.9*10^ -3; // s p e c i f i c volume o f
s a t u r a t e d steam ( c u b i c m/ kg )
U_sat = 2570.4; // s p e c i f i c i n t e r n a l e n e r g y o f
s a t u r a t e d steam ( kJ / kg )
22
23
24
//To d e t e r m i n e t h e c h a n g e i n e n t r o p y o f s y s t e m
m_sat = V / spvol_sat ; // mass o f s a t u r e a t e d steam ( kg )
63
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
5
6
7 clear all ;
8 clc ;
9
10 // Given :
11 V = 1; // volume o f e a c h compartment i n c u b i c m
12 T = 300; // t e m p e r a t u r e o f i d e a l g a s i n 1 s t
compartment (K)
13 P = 200; // p r e s s u r e
o f i d e a l g a s i n 1 s t compartment
( kPa )
14 R = 8.314; // i d e a l g a s c o n s t a n t
15
16 //To c a l c u l a t e e n t r o p y c h a n g e
17 // L e t n be t h e number o f m o l e s o f g a s
18 n = (( P * V ) /( R * T ) ) ;
19 // S i n c e g a s i n v e s s e l e x c h a n g e s no h e a t and work
w i t h s u r r o u n d i n g s o i n t e r n a l e n e r g y r e m a i n s same
20 // T h i s i m p l i e s t e m p e r a t u r e a f t e r m i x i n g i s same a s
that b e f o r e mixing
21
22
23
24
25
26
27
28
29
30
31
32
33
// F i n a l c o n d i t i o n s :
Tf = 300; // f i n a l t e m p e r a t u r e (K)
Vf = 2; // f i n a l volume ( c u b i c m)
Pf = 100; // f i n a l p r e s s u r e ( kPa )
// I n i t i a l c o n d i t i o n s :
Ti = 300; // i n i t i a l t e m p e r a t u r e (K)
Vi = 1; // i n i t i a l volume ( c u b i c m)
Pi = 200; // i n i t i a l p r e s s u r e ( kPa )
// U s i n g e q u a t i o n 4 . 3 3 ( Page num 9 4 )
S = n * R * log ( Vf / Vi ) ; // e n t r o p y c h a n g e o f s y s t e m ( kJ /K
)
34 // S i n c e e n t r o p y o f s u r r o u n d i n g d o e s n o t c h a n g e
35 S_total = S ; // t o t a l e n t r o p y c h a n g e
36 mprintf ( The c h a n g e i n t o t a l e n t r o p y i s %f kJ /K ,
S_total ) ;
65
37
38
// end
temperature
20 Tout_oil = 305; // e x i t t e m p e r a t u r e o f o i l (K)
21 Tout_water = 490; // e x i t t e m p e r a t u r e o f w a t e r (K)
22
23
24
25
// L e t m water be t h e mass f l o w r a t e o f w a t e r
//By e n t h a l p y b a l a n c e
m_water = (( m_oil * c_oil *( Tin_oil - Tout_oil ) ) /( c_water
*( Tout_water - Tin_water ) ) ) ; // ( kg /h )
26 S_oil = m_oil * c_oil * log ( Tout_oil / Tin_oil ) ; // e n t r o p y
c h a n g e o f o i l ( kJ /K)
27 S_water = m_water * c_water * log ( Tout_water / Tin_water ) ;
66
// e n t r o p y c h a n g e o f w a t e r ( kJ /K)
28 S_tot = S_oil + S_water ; // t o t a l e n t r o p y c h a n g e
29 mprintf ( The t o t a l e n t r o p y c h a n g e i n t h e p r o c e s s i s
%f kJ /K , S_tot ) ;
30
31
// end
/K)
17 S_oil = 43.90; // c h a n g e i n e n t r o p y o f o i l ( kJ /K)
18
19 S_tot = S_steel + S_oil ; // t o t a l e n t r o p y c h a n g e
20 // L e t W be l o s s i n c a p a c i t y f o r d o i n g work
21 W = To * S_tot ; // ( kJ )
22 mprintf ( The l o s s i n c a p a c i t y f o r d o i n g work i s %f
kJ ,W ) ;
23
24
// end
67
Scilab code Exa 4.18 To calculate total change in entropy and available
work
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 4
3 // S e c o n d Law o f Thermodynamics
4 // Example 18
5
6
7 clear all ;
8 clc ;
9
10 // Given :
11 m_oil = 5000; // mass f l o w r a t e o f h y d r o c a r b o n o i l (
12
13
14
15
16
17
18
19
kg / h )
Tin_oil = 425; // i n l e t t e m p e r a t u r e o f o i l (K)
Tout_oil = 340; // e x i t t e m p e r a t u r e o f o i l (K)
m_water = 10000; // mass f l o w r a t e o f w a t e r ( kg / h )
Tin_water = 295; // i n l e t t e m p e r a t u r e o f w a t e r (K)
c_oil = 2.5; // mean s p e c i f i c h e a t o f o i l ( kJ / kg K)
c_water = 4.2; // mean s p e c i f i c h e a t o f w a t e r ( kJ / kg
K)
//To d e t e r m i n e t o t a l c h a n g e i n e n t r o p y and a v a i l a b l e
work
20
21
22
23
// ( a )
//By e n e r g y b a l a n c e
Tout_water = (( m_oil * c_oil *( Tin_oil - Tout_oil ) ) /(
m_water * c_water ) ) +295; // e x i t t e m p e r a t u r e o f
w a t e r (K)
24 S_oil = m_oil * c_oil * log ( Tout_oil / Tin_oil ) ; // c h a n g e
i n e n t r o p y o f o i l ( kJ /K)
25 S_water = m_water * c_water * log ( Tout_water / Tin_water ) ;
68
// c h a n g e i n e n t r o p y o f w a t e r ( kJ /K)
26 S_tot = S_oil + S_water ; // t o t a l e n t r o p y c h a n g e
27 mprintf ( The t o t a l e n t r o p y c h a n g e i s %f kJ /K , S_tot )
;
28
29
30 // ( b )
31 To = 295; // t e m p e r a t u r e a t which h e a t
i s r e j e c t e d to
s u r r o u n d i n g (K)
32 // L e t Q be h e a t g i v e n o u t by t h e o i l on c o o l i n g
33 Q = m_oil * c_oil *( Tin_oil - Tout_oil ) ;
34 // Heat r e j e c t e d t o t h e s u r r o u n d i n g a t To by t h e
35
36
37
38
39
40
41
C a r n o t E n g i n e i s g i v e n by
//Q2 = To (Q/T) = To S o i l
Q2 = - To * S_oil ; // ( kJ )
// L e t W be t h e work o u t p u t o f e n g i n e
W = Q - Q2 ;
mprintf ( \ nThe work o u t p u t o f t h e e n g i n e would be %4
. 3 e kJ , W ) ;
// end
69
12 Cp = 0.45; // m o l a r h e a t c a p a c i t y a t 10 K ( J / mol K)
13 // Molar h e a t c a p a c i t y o f a s u b s t a n c e a t low
t e m p e r a t u r e s can be a p p r o x i m a t e d by t h e r e l a t i o n
14 //Cp = a (T 3 ) where a i s c o n s t a n t
15
16
17
18
//To d e t e r m i n e t h e m o l a r e n t r o p y o f m e t a l
// Entropy o f s o l i d a t 10 K i s c a l c u l a t e d u s i n g f i r s t
i n t e g r a l i n e q u a t i o n 4 . 5 5 ( Page no . 1 0 8 )
19 S = Cp /3;
20 mprintf ( Molar e n t r o p y o f m e a t l a t 10 K i s %f J / mol
K ,S ) ;
21
22
// end
Scilab code Exa 4.20 To calculate the absolute entropy of water vapour
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 4
3 // S e c o n d Law o f Thermodynamics
4 // Example 20
5
6
7 clear all ;
8 clc ;
9
10 // Given :
11 T = 473; // t e m p e r a t u r e a t e n t r o p y i s t o be
d e t e r m i n e d (K)
12 Tf = 273; // b a s e t e m p e r a t u r e (K)
13 Tb = 373; // b o i l i n g t e m p e r a t u r e (K)
14 Cpl = 4.2; // a v e a r g e h e a t c a p a c i t y o f w a t e r ( kJ / kg K
)
15 Cpg = 1.9; // a v e a r g e h e a t c a p a c i t y
o f water vapour
16 Hv = 2257; // l a t e n t
h e a t o f v a p o r i s a t i o n a t 373 K (
kJ / kg )
17
18
19
//To d e t e r m i n e t h e a b s o l u t e e n t r o p y o f w a t e r v a p o u r
// Entropy o f w a t e r v a p o u r i s c a l c u l a t e d u s i n g l a s t
t h r e e t e r m s o f e q u a t i o n o f 4 . 5 5 ( Page no . 1 0 8 )
20 S = ( Cpl * log ( Tb / Tf ) ) +( Hv / Tb ) +( Cpg * log ( T / Tb ) ) ;
21 mprintf ( A b s o l u t e e n t r o p y o f w a t e r v a p o u r a t 473 K
and 1 0 1 . 3 kPa i s %f kJ / kg K ,S ) ;
22 mprintf ( \ n I t c o m p a r e s f a v o u r a b l y w i t h t h e v a l u e
r e p o r t e d i n steam t a b l e s ) ;
23
24
// end
71
Chapter 5
Some Applications of the Laws
of Thermodynamics
clear all ;
clc ;
// Given :
u1 = 1; // e n t e r i n g v e l o c i t y o f w a t e r (m/ s )
d_ent = 0.2; // e n t r a n c e d i a m e t e r o f r e d u c e r (m)
d_exit = 0.1; // e x i t d i a m e t e r o f r e d u c e r (m)
P_ent = 105; // p r e s s u r e a t e n t r a n c e ( kPa )
z = 5; // d i s t a n c e b e t w e e n e n t r a n c e and e x i t (m)
g = 9.81; // a c c e l e r a t i o n due t o g r a v i t y
den = 1000; // d e n s i t y o f w a t e r ( kg /m 3 )
72
20 //To c a l c u l a t e t h e p r e s s u r e a t e x i t
21 A1 = ( %pi /4) * d_ent ^2; // c r o s s s e c t i o n
area of
e n t r a n c e (m 2 )
22 A2 = ( %pi /4) * d_exit ^2; // c r o s s s e c t i o n a r e a o f e x i t
(m 2 )
23
24
//By t h e e q u a t i o n o f c o n t i n u i t y and s i n c e d e n s i t y o f
water remains constant
25 u2 = ( A1 * u1 ) / A2 ;
26
27
//By B e r n o u l l i s e q u a t i o n b e t w e e n s e c t i o n 1 and 2 (
Eq 5 . 2 0 Page no . 1 1 8 )
28 P_exit = ( -(( u2 ^2 - u1 ^2) /2) -( g * z ) +( P_ent *10^3/ den ) ) *(
den /10^3) ;
29 mprintf ( The p r e s s u r e a t e x i t i s %f kPa , P_exit ) ;
30
31
// end
Scilab code Exa 5.2 To determine quality of steam flowing through the
pipe
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 5
3 // Some A p p l i c a t i o n s o f t h e Laws o f Thermodynamics
4 // Example 2
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 P = 1000; // p r e s s u r e o f s a t u r a t e d steam ( kPa )
13 T = 398; // t e m p e r a t u r e o f e s c a p i n g steam (K)
14
73
// R e f e r r i n g steam t a b l e s
H_vap = 2778; // e n t h a l p y o f s a t u r a t e d v a p o u r a t 1 0 0 0
kPa ( kJ / kg )
17 H_liq = 763; // e n t h a l p y o f s a t u r a t e d l i q u i d a t 1 0 0 0
kPa ( kJ / kg )
18 H_steam = 2726; // e n t h a l p y o f s u p e r h e a t e d steam a t
398 K ( kJ / kg )
15
16
19
20
//To d e t e r m i n e q u a l i t y o f steam f l o w i n g t h r o u g h t h e
pipe
21 // Assuming p o t e n t i a l and k i n e t i c e n e r g y c h a n g e s a r e
neglegible
22 // U s i n g e q u a t i o n 5 . 1 0 ( Page no . 1 1 7 )
23 //H = QWs
24
25
// L e t s e c t i o n 1 be a p o i n t i n p i p e and x be t h e
f r a c t i o n o f steam t h a t i s l i q u i d
26 // Then H1 = x H l i q + (1x ) H vap
27
28
// L e t s e c t i o n 2 be t h e p o i n t i n steam i s s u i n g from
the leak in valve
29 H2 = 2726; // [ kJ / kg ]
30
31
// end
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// C h a p t e r 5
// Some A p p l i c a t i o n s o f t h e Laws o f Thermodynamics
// Example 3
clear all ;
clc ;
// Given :
m = 10; // mass f l o w r a t e o f steam ( kg / s )
H1 = 3062; // e n t h a l p y o f e n t e r i n g steam ( kJ / kg )
H2 = 2875; // e n t h a l p y o f d i s c h a r g e d steam ( kJ / kg )
Q = -100/ m ; // h e a t l o s s t o t h e s u r r o u n d i n g ( kJ / kg )
u1 = 0; // e n t e r i n g v e l o c i t y o f steam
//To d e t e r m i n e t h e d i s c h a r g e v e l o c i t y
// U s i n g t o t a l e n e r g y b a l a n c e ( Eq . 5 . 9 , Page no . 1 1 7 )
// N e g l e c t i n g c h a n g e i n p o t e n t i a l e n e r g y and p u t t i n g
Ws = 0
21
22 H = H2 - H1 ;
23 u2 = sqrt (( Q - H ) *1000*2) ;
24 mprintf ( The d i s c h a r g e v e l o c i t y
25
26 // end
i s %i m/ s , u2 ) ;
75
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
clear all ;
clc ;
// Given :
To = 600; // t e m p e r a t u r e o f a i r (K)
Po = 2000; // p r e s s u r e o f a i r ( kPa )
gama = 1.4;
M = 0.8; // Mach number a t t h r o a t
m = 29; // m o l e c u l a r mass o f a i r
R = 8.314; // i d e a l g a s c o n s t a n t
//To d e t e r m i n e t h e r m o d y n a m i c a l p r o p e r t i e s a t t h r o a t
and c r i t i c a l p r e s s u r e
// ( a )
// U s i n g e q u a t i o n 5 . 4 0 ( Page no 1 2 3 ) . . u 2 = (M 2 )
gamaPV
// S u b s t i t u t i n g t h i s i n eq . 5 . 3 9 ( Page no . 1 2 3 ) and
on r e a r r a n g i n g we g e t
P = Po /((1+((( gama -1) /2) * M ^2) ) ^( gama /( gama -1) ) ) ;
// U s i n g eq . 5 . 3 9 and t h e r e l a t i o n PoVo = RTo/m
u = sqrt ((2* gama * R * To *1000) /( m *( gama -1) ) *(1 -( P / Po )
^(( gama -1) / gama ) ) ) ;
// U s i n g eq . 3 . 2 3 ( Page no . 4 9 )
T = To *( P / Po ) ^(( gama -1) / gama ) ;
// L e t d be t h e d e n s i t y
d_o = ( Po * m ) /( R * To ) ;
// S i n c e P (V gama ) = P/ ( den gama ) = c o n s t a n t . . . s o
d = d_o *(( P / Po ) ^(1/ gama ) ) ;
mprintf ( ( a ) . At t h r o a t ) ;
mprintf ( \ n P r e s s u r e = %i kPa ,P ) ;
mprintf ( \ n T e m p e r a t u r e = %i K ,T ) ;
mprintf ( \ n V e l o c i t y = %f m/ s ,u ) ;
mprintf ( \ n D e n s i t y = %f kg / c u b i c m ,d ) ;
// ( b )
76
40 // U s i n g eq . 5 . 4 2 ( Page no . 1 2 4 )
41 Pc = Po *((2/( gama +1) ) ^( gama /( gama -1) ) ) ; // c r i t i c a l
pressure
42 mprintf ( \n\n ( b ) . ) ;
43 mprintf ( \ nThe c r i t i c a l
44
45
p r e s s u r e i s %f kPa , Pc ) ;
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
13
14
// end
77
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 // The g i v e n n u m e r i c a l
i s t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
13
14
// end
Scilab code Exa 5.7 To calculate work required and temperature after
compression
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
clear all ;
clc ;
// Given :
P1 = 1; // i n i t i a l p r e s s u r e ( b a r )
T1 = 300; // i n i t i a l t e m p e r a t u r e (K)
P2 = 10; // f i n a l p r e s s u r e ( b a r )
gama = 1.3; // gama f o r CO2
V_rate = 100; // v o l u m e t r i c f l o w r a t e (m3/ h )
%f K , T2 ) ;
25
26
// end
)
P2 = 500; // f i n a l p r e s s u r e ( kPa )
eff = 0.8; // c o m p r e s s i o n e f f i c i e n c y
// R e f e r r i n g steam t a b l e s
// P r o p e r t i e s o f steam e n t e r i n g t h e c o m p r e s s o r
H1 = 2675.5; // e n t h a l p y ( kJ / kg )
S1 = 7.3594; // e n t r o p y ( kJ / kg K)
// P r o p e r t i e s o f c o m p r e s s e d steam
H2 = 3008; // e n t h a l p y ( kJ / kg )
S2 = S1 ; // i s e n t r o p i c c o m p r e s s i o n
79
24
25 //To c a l c u l a t e work r e q u i r e d and t e m p e r a t u r e
26
27 Hs = H2 - H1 ;
28 // U s i n g eq . 5 . 4 4 ( Page no . 1 2 8 )
29 W_isentropic = - Hs ;
30 W_act = W_isentropic / eff ;
31 mprintf ( The work r e q u i r e d f o r c o m p r e s s i o n i s %f kJ /
kg ,- W_act ) ;
32
33 H = Hs / eff ; // a c t u a l c h a n g e i n e n t h a l p y
34 H_act = H1 + H ; // a c t u a l e n t h a l p y o f steam l e a v i n g t h e
compressor
35 // From steam t a b l e s f o r s u p e r h e a t e d steam a t 500 kPa
and e n t h a l p y o f H a c t
36 T = 586; // t e m p e r a t u r e (K)
37 mprintf ( \ n T e m p e r a t u r e o f e x h a u s t steam i s %i K ,T ) ;
38
39
// end
80
);
21
22
// end
Scilab code Exa 5.10 To determine COP heat rejected and lowest temperature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
clear all ;
clc ;
// Given :
T = 290; // o p e r a t i n g t e m p e r a t u r e (K)
W = 1000; // work ( J )
tof = 3516.67; // t o n o f r e f r i g e r a t i o n (W)
//To d e t e r m i n e COP, h e a t r e j e c t e d and l o w e s t
temperature
17
18 // ( a )
19 Q2 = tof ;
20 COP = Q2 / W ; // c o e f f e c i e n t
of performance
81
refrigerator
31
32
i s %f K , T2 ) ;
// end
c o m p r e s s i o n r e f r i g e r a t i o n c y c l e (K)
14
15 //To d e t e r m i n e COP a t g i v e n
16 // ( a )
17 Ha = 656; // ( kJ / kg )
18 Hb = 724; // ( kJ / kg )
82
conditions
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Hd = 144; // ( kJ / kg )
Hc = Hd ;
// U s i n g eq . 5 . 6 1 ( Page no . 1 3 9 )
COP = ( Ha - Hd ) /( Hb - Ha ) ;
mprintf ( ( a ) . COP = %f , COP ) ;
// ( b )
Ha = 652; // ( kJ / kg )
Hb = 758; // ( kJ / kg )
Hd = 159; // ( kJ / kg )
Hc = Hd ;
eff = 0.75; // e f f i c i e n c y o f c o m p r e s s o r
COP = ( Ha - Hd ) /(( Hb - Ha ) *(1/ eff ) ) ;
mprintf ( \n\n ( b ) . COP = %f , COP ) ;
// ( c ) . I d e a l C a r n o t r e f r i g e r a t o r
COP = T2 /( T1 - T2 ) ;
mprintf ( \n\n ( c ) . COP = %f , COP ) ;
// end
83
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Tin_cool = 288; // e n t e r i n g t e m p e r a t u r e o f c o o l i n g
w a t e r (K)
Tout_cool = 300; // d i s c h a r g e t e m p e r a t u r e o f c o o l i n g
w a t e r (K)
m_c = 0.25; // mass f l o w r a t e o f c o l i n g w a t e r ( kg / s )
m = 0.5; // mass f l o w r a t e o f ammonia ( kg / min )
Ha = 1426; // e n t h a l p y o f s a t u r a t e d ammonia v a p o u r a t
258 K ( kJ / kg )
Hd = 281.5; // e n t h a l p y o f l i q u i d ammonia a t 294 K (
kJ / kg )
eff = 0.9; // c o m p r e s s o r e f f i c i e n c y
Cp = 4.2; // s p e c i f i c h e a t o f w a t e r ( kJ / kg K)
tof = 12660; // t o n o f r e f r i g e r a t i o n ( kJ / h )
//To d e t e r m i n e t h e power r e q u i r e m e n t and
r e f r i g e r a t i o n capacity in tons
Q1 = m_c * Cp *( Tout_cool - Tin_cool ) ; // h e a t r e j e c t e d by
c o m p r e s s o r a t c o n s t a n t p r e s s u r e ( kJ / s )
Q2 = ( m /60) *( Ha - Hd ) ; // h e a t a b s o r b e d ( kJ / s )
W = Q1 - Q2 ; // work r e q u i r e d ( kJ / s )
P = ( W *1000) /( eff *746) ; // power r e q u i r e m e n t o f
c o m p r e s s o r ( hp )
mprintf ( Power r e q u i r e m e n t o f t h e c o m p r e s s o r i s %f
hp ,P ) ;
28
29 rc = Q2 *3600/ tof ; // r e f r i g e r a t i o n c a p a c i t y ( t o n )
30 mprintf ( \n R e f r i g e r a t i o n c a p a c i t y i s %f t o n , rc ) ;
31
32 // end
Scilab code Exa 5.13 To calculate the COP and refrigeration circulation
rate
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
clear all ;
clc ;
// Given :
m1 = 10; // machine r a t i n g ( t o n )
// S i n c e 5 K a p p r o a c h i s n e c e s s a r y
T1 = 293+5; // t e m p e r a t u r e o f c o o l i n g w a t e r (K)
T2 = 261 -5; // t e m p e r a t u r e o f c o l d s t o r a g e (K)
Ha = 181; // e n t h a l p y o f s a t u r a t e d v a p o u r a t 256 K (
kJ / kg )
Sa = 0.714; // e n t r o p y o f s a t u r a t e d v a p o u r a t 256K (
kJ / kg K)
Hc = 62; // e n t h a l p y o f s a t u r a t e d l i q u i d a t 298 K ( kJ
/ kg )
Sc = 0.231; // e n t r o p y o f s a t u r a t e d l i q u i d a t 298 K (
kJ / kg K)
Hb = 206; // e n t h a l p y o f s u p e r h e a t e d v a p o u r ( kJ / kg )
Sb = 0.714; // e n t r o p y o f s u p e r h e a t e d v a p o u r ( kJ / kg )
//To c a l c u l a t e t h e COP and r e f r i g e r a n t c i r c u l a t i o n
rate
// R e f e r r i n g f i g 5 . 1 1 ( Page no . 1 4 3 )
// (DA/FA) = ( HaHd ) /Hv
// (DA/FA) = ( SaSd ) / Sv
//Hv/ Sv = T2
24
25
26
27
28
29 // Combining t h e t h r e e r e l a t i o n s , we g e t
30 Sd = Sc ; // i s e n t r o p i c p r o c e s s
31 Hd = Ha -( T2 *( Sa - Sd ) ) ;
32 // U s i n g eq . 5 . 6 4 ( Page no . 1 4 1 )
33 COP = ( Ha - Hd ) /(( Hb - Hc ) -( Ha - Hd ) ) ;
34 mprintf ( COP = %f , COP ) ;
35
85
36 // U s i n g e q u a t i o n 5 . 6 3 ( Page no . 1 4 0 )
37 m = (12660* m1 ) /( Ha - Hd ) ; // r e f r i g e r a n t
circulation
r a t e ( kg /h )
38 mprintf ( \n R e f r i g e r a n t c i r c u l a t i o n r a t e i s %f kg /h
,m ) ;
39
40
// end
Scilab code Exa 5.14 To determine the COP and air circulation rate
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 5
3 // Some A p p l i c a t i o n s o f t h e Laws o f Thermodynamics
4 // Example 14
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 m1 = 10; // machine r a t i n g ( t o n )
13 // Assuming 5 K a p p r o a c h i n r e f r i g e r a t o r and c o o l e r
14 Ta = 261 -5; // t e m p e r a t u r e o f a i r l e a v i n g t h e
15
r e f r i g e r a t o r (K)
Tc = 293+5; // t e m p e r a t u r e o f a i r l e a v i n g t h e c o o l e r
(K)
gama = 1.4;
Cp = 1.008; // s p . h e a t o f a i r ( kJ / kg K)
P1 = 4.052;
P2 = 1.013; // o p e r a t i n g p r e s s u r e s i n b a r
16
17
18
19
20
21 //To d e t e r m i n e t h e COP and a i r c i r c u l a t i o n
22 // U s i n g eq . 5 . 6 6 ( Page no . 1 4 5 )
23 Tb = Ta *( P1 / P2 ) ^(( gama -1) / gama ) ;
86
rate
24 Td = ( Tc * Ta ) / Tb ;
25
26 // U s i n g e q u a t i o n 5 . 6 8 ( PAge no . 1 4 6 )
27 COP = Ta /( Tb - Ta ) ;
28 mprintf ( COP = %f , COP ) ;
29
30 // C o n s i d e r i n g e n e r g y b a l a n c e i n r e f r i g e r a t o r
[mCp (
TaTd ) = m1 1 2 6 6 0 ]
31 m = ( m1 *12660) /( Cp *( Ta - Td ) ) ; // a i r c i r c u l a t i o n r a t e
( kg / h )
32 mprintf ( \n A i r c i r c u l a t i o n r a t e i s %i kg /h ,m ) ;
33
34
// end
Scilab code Exa 5.15 To verify that given heat pump is equivalent to 30
kW pump
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 5
3 // Some A p p l i c a t i o n s o f t h e Laws o f Thermodynamics
4 // Example 15
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 T1 = 300; // i n d o o r t e m p e r a t u r (K)
13 T2 = 290; // o u t s i d e t e m p e r a t u r e (K)
14 W_input = 1; // 1 kW h e a t pump
15 W_output = 30; // g i v e n o u t p u t (kW)
16
17 //To v e r i f y t h a t g i v e n h e a t pump i s e q u i v a l e n t t o 30
kW h e a t e r
87
18 Q2 = ( T2 /( T1 - T2 ) ) * W_input ; // h e a t a b s o r b e d
19 Q1 = Q2 + W_input ; // h e a t r e j e c t e d
20
21 if ( Q1 == W_output )
22
mprintf ( 1 kW pump i f o p e r a t e d r e v e r s i b l y ,
is
e q u i v a l e n t t o a 30 kW h e a t e r ) ;
23
24
else
mprintf ( The g i v e n h e a t pump i s n o t e q u i v a l e n t
t o a 30 kW h e a t e r ) ;
25 end
26
27 // end
clear all ;
clc ;
// Given :
T1 = 295; // t e m p e r a t u r e i n s i d e b u i l d i n g (K)
T2 = 275; // t e m p e r a t u r e o f o u t s i d e a i r (K)
eff = 0.25; // o v e r a l l e f f i c i e n c y o f u n i t
Hc = 890.9; // h e a t o f c o m b u s t i o n o f f u e l ( kJ / mol )
conv = 0.33; // e f f i c i e n c y o f c o n v e r s i o n o f h e a t o f
combustion to e l e c t r i c i t y
17 Q1 = 10^6; // amount o f h e a t t o be d e l i v e r e d
18
19
//To d e t e r m i n e t h e amount o f f u e l b u r n e d
88
20 COP = T1 /( T1 - T2 ) ;
21 W = Q1 / COP ; // work r e q u i r e d t o d e l i v e r Q1 kJ o f h e a t
22 W_act = W / eff ; // a c t u a l amount o f e l e c t r i c a l e n e r g y
t o be s u p p l i e d
W_heat = W_act / conv ; // h e a t e n e r g y r e q u i r e d a s h e a t
of combustion
24 n = W_heat / Hc ; // number o f m o l e s o f f u e l b u r n e d
25 mprintf ( The amount o f f u e l b u r n e d i s %f kmol ,n
/1000) ;
23
26
27
// end
Scilab code Exa 5.17 To calculate fraction of liquid in inlet stream and
temperature
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
clear all ;
clc ;
// Given :
// R e f e r r i n g steam t a b l e s
H1 = 2717; // e n t h a l p y o f
H2 = 538; // e n t h a l p y o f
S1 = 7.05; // e n t r o p y o f
S2 = 1.61; // e n t r o p y o f
at 2 . 5 4 bar
s a t u r a t e d v a p o u r ( kJ / kg )
s a t u r a t e d l i q u i d ( kJ / kg )
s a t u r a t e d v a p o u r ( kJ / kg K)
s a t u r a t e d l i q u i d ( kJ / kg K)
H = 2700; // e n t h a l p y o f s u p e r h e a t e d steam a t 1 b a r
and 385 K ( kJ / kg )
19 S = 7.42; // e n t r o p y o f s u p e r h e a t e d steam a t 1 b a r
89
and 385 K ( kJ / kg K)
20
21
//To d e t e r m i n e f r a c t i o n o f l i q u i d i n i n l e t s t r e a m
and t h e t e m p e r a t u r e
22 // L e t t h e f r a c t i o n o f l i q u i d i n i n l e t s t r e a m be x
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// ( a ) . . The e x p a n s i o n i s i s e n t h a l p i c
// A p p l y i n g e n t h a l p y b a l a n c e a r o u n d t h e t h r o t t l e
valve
// ( x H2 ) +(1x ) H1 = H
x = (H - H1 ) /( H2 - H1 ) ;
// From steam t a b l e s
T = 401; // t e m p e r a t u r e o f steam (K)
mprintf ( ( a ) . For i s e n t h a l p i c e x p a n s i o n ) ;
mprintf ( \n The f r a c t i o n o f l i q u i d i n i n l e t s t r e a m
i s %f ,x ) ;
mprintf ( \n The t e m p e r a t u r e o f s t r e a m i s %i K ,T ) ;
// ( b ) . . The e x p a n s i o n i s i s e n t r o p i c
// S i n c e e n t r o p y o f s a t u r a t e d v a p o u r a t i n l e t
p r e s s u r e ( S1 ) i s l e s s t h a n e n t r o p y o f steam
l e a v i n g the turbine (S)
// So , t h e i n l e t s t r e a m i s s u p e r h e a t e d , t h e r e f o r e
x = 0;
// From steam t a l e s
T = 478; // t e m p e r a t u r e o f s u p e r h e a t e d steam h a v i n g
e n t r o p y o f 7 . 4 2 kJ / kg K
mprintf ( \n\n ( b ) . For i s e n t r o p i c e x p a n s i o n ) ;
mprintf ( \n The f r a c t i o n o f l i q u i d i n i n l e t s t r e a m
i s %i ,x ) ;
mprintf ( \n The t e m p e r a t u r e o f s t r e a m i s %i K ,T ) ;
// end
90
Scilab code Exa 5.18 To determine fraction of air liquified and temperature of air
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 5
3 // Some A p p l i c a t i o n s o f t h e Laws o f Thermodynamics
4 // Example 18
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 // R e f e r r i n g F i g . 5 . 1 5 ( Page no . 1 5 1 )
13 Hc = 516; // e n t h a l p y o f h i g h p r e s s u r e g a s a t 120 b a r
and 306 K ( kJ / kg )
14 Ha = 526; // e n t h a l p y o f low p r e s s u r e g a s a t 2 b a r
and 292 K ( kJ / kg )
15 Hf = 121; // e n t a l p y o f s a t u r a t e d l i q u i d a t 2 b a r ( kJ
/ kg )
16 Hg = 314; // e n t h a l p y o f s a t u r a t e d v a p o u r a t 2 b a r (
kJ / kg )
17
18
//To d e t e r m i n e t h e f r a c t i o n o f a i r
temperature of a i r
l i q u i f i e d and
19
20 // ( a ) . .
21 // U s i n g e q u a t i o n 5 . 7 3 ( Page no . 1 5 2 )
22 x = ( Hc - Ha ) /( Hf - Ha ) ; // f r a c t i o n o f a i r l i q u i f i e d
23 mprintf ( ( a ) . The f r a c t i o n o f l i q u i f i e d a i r i s %f ,x
);
24
25 // ( b ) . .
26 // Taking e n t h a l p y b a l a n c e a r o u n d h e a t e x c h a n g e r
27 Hd = Hc - (1 - x ) *( Ha - Hg ) ;
28 // At e n t h a l p y o f Hd kJ / kg , from TS d i a g r a m f o r
29 T = 167; // t e m p e r a t u r e i n K
91
air
30
31
32
mprintf ( \n ( b ) . T e m p e r a t u r e o f a i r on h i g h p r e s s u r e
s i d e o f t h r o t t l e v a l v e i s %i K ,T ) ;
// end
Scilab code Exa 5.19 To determine ideal Rankine cycle efficiency thermal
efficiency and rate of steam production
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
clear all ;
clc ;
// Given :
P2 = 2800; // p r e s s u r e o f s u p e r h e a t e d steam ( kPa )
P1 = 5; // p r e s s u r e a f t e r e x p a n s i o n ( kPa )
e_turbine = 0.85; // i s e n t r o p i c t u r b i n e e f f i c i e n c y
e_pump = 0.8; // i s e n t r o p i c pump e f f i c i e n c y
V = 1.005*10^ -3; // s p e c i f i c volume o f s a t u r a t e d
l i q u i d a t 5 kPaHl =
17
18 // From steam t a b l e s :
19 Hl = 138; // e n t h a l p y o f
s a t u r a t e d l i q u i d a t 5 kPa (
kJ / kg )
20 Hv = 2562; // e n t h a l p y o f
s a t u r a t e d v a p o u r a t 5 kPa (
kJ / kg )
21 H3 = 3063; // e n t h a l p y o f s u p e r h e a t e d steam a t 2 8 0 0
23 Sv = 8.3951; // e n t r o p y o f
s a t u r a t e d v a p o u r a t 5 kPa
( kJ / kg K)
24 S3 = 6.6875; // e n t r o p y o f s u p e r h e a t e d steam a t 2 8 0 0
40
41 // ( b ) . . The t h e r m a l e f f i c i e n c y o f p l a n t
42 W_act = Ws / e_pump ; // a c t u a l work r e q u i r e m e n t i n pump
43 H_2 = Hl + W_act ; // e n t h a l p y o f w a t e r l e a v i n g t h e
44
45
46
47
48
49
50
f e e d w a t e r pump
W_out = e_turbine *( H3 - H4 ) ; // a c t u a l work o u t p u t
H_4 = H3 - W_out ; // a c t u a l e n t h a l p y o f steam l e a v i n g
the turbine
e_act = (( H3 - H_2 ) -( H_4 - Hl ) ) /( H3 - H_2 ) ;
mprintf ( \n ( b ) . The a c t u a l e f f i c i e n c y i s %f p e r c e n t
, e_act *100) ;
// ( c ) . . The r a t e o f steam p r o d u c t i o n
W_net = e_act *( H3 - H_2 ) ; // n e t work o u t p u t ( kJ / kg )
93
53
54
// end
Scilab code Exa 5.20 To determine the work output thermal efficiency
and rate of steam circulation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
clear all ;
clc ;
// Given :
P2 = 7600; // p r e s s u r e o f s u p e r h e a t e d steam ( kPa )
P1 = 5; // p r e s s u r e a f t e r e x p a n s i o n ( kPa )
V = 1.005*10^ -3; // s p e c i f i c volume o f s a t u r a t e d
l i q u i d (m3/ kg )
15
16
17
// From steam t a b l e s :
H_l1 = 138; // e n t h a l p y o f s a t u r a t e d l i q u i d a t 5 kPa
( kJ / kg )
18 S_l1 = 0.4764; // e n t r o p y o f s a t u r a t e d l i q u i d a t 5
kPa ( kJ / kg K)
19 H_v1 = 2562; // e n t h a l p y o f s a t u r a t e d v a p o u r a t 5 kPa
( kJ / kg )
94
20
21
22
23
24
25
26
27
28
29
30
S_v1 = 8.3951; // e n t r o p y o f s a t u r a t e d v a p o u r a t 5
kPa ( kJ / kg K)
H_l2 = 830; // e n t h a l p y o f s a t u r a t e d l i q u i d a t 1 4 0 0
kPa ( kJ / kg )
S_l2 = 2.2842; // e n t r o p y o f s a t u r a t e d l i q u i d a t 1 4 0 0
kPa ( kJ / kg K)
H_v2 = 2790; // e n t h a l p y o f s a t u r a t e d v a p o u r a t 1 4 0 0
kPa ( kJ / kg )
S_v2 = 6.4693; // e n t r o p y o f s a t u r a t e d v a p o u r a t 1 4 0 0
kPa ( kJ / kg K)
H5 = 3226; // e n t h a l p y o f s u p e r h e a t e d steam a t 1 4 0 0
kPa and 658 K
S5 = 7.2558; // e n t r o p y o f s u p e r h e a t e d steam a t 1 4 0 0
kPa and 658 K
H3 = 3150; // e n t h a l p y o f s u p e r h e a t e d steam a t 7 6 0 0
kPa and 673 K
S3 = 6.4022; // e n t r o p y o f s u p e r h e a t e d steam a t 1 4 0 0
kPa and 673 K
//To d e t e r m i n e t h e work o u t p u t , t h e r m a l e f f i c i e n c y
and r a t e o f steam c i r c u l a t i o n
// ( a )
// For h i g h p r e s s u r e t u r b i n e
// L e t t h e f r a c t i o n o f steam i n v a p o u r s t a t e be x
S4 = S3 ; // a s t h e e x p a n s i o n p r o c e s s i s i s e n t r o p i c
x = ( S4 - S_l2 ) /( S_v2 - S_l2 ) ;
H4 = H_l2 + x *( H_v2 - H_l2 ) ;
W_high = H3 - H4 ;
31
32
33
34
35
36
37
38
39 // For low p r e s s u r e t u r b i n e
40 S6 = S5 ; // i s e n t r o p i c e x p a n s i o n
41 x = ( S6 - S_l1 ) /( S_v1 - S_l1 ) ;
42 H6 = H_l1 + x *( H_v1 - H_l1 ) ;
43 W_low = H5 - H6 ;
44
45 mprintf ( ( a ) ) ;
46 mprintf ( \n The work o u t p u t o f h i g h p r e s s u r e
i s %i kJ / kg , W_high ) ;
95
turbine
47
48
49 // ( b )
50 // Work o u t p u t o f f e e d pump i s [Ws = i n t g (VdP) ]
51 Ws = V *( P2 - P1 ) ;
52 H2 = H_l1 + Ws ;
53 // U s i n g eq . 5 . 8 2 ( Page no . 1 5 9 )
54 eff = (( H3 - H2 ) +( H5 - H4 ) -( H6 - H_l1 ) ) /(( H3 - H2 ) +( H5 - H4 ) ) ;
55 mprintf ( \n\n ( b ) ) ;
56 mprintf ( \n Thermal e f f i c i e n c y i s %f p e r c e n t , eff
*100) ;
57
58
59
60
61
62
63
64
65
66
// ( c )
// The n u m e r a t o r o f eq . 5 . 8 2 g i v e s n e t work o u t p u t
W_net = ( H3 - H2 ) +( H5 - H4 ) -( H6 - H_l1 ) ;
// For 1 0 0 0 kW o f n e t work o u t p u t
rate = 3.6*10^6/ W_net ;
mprintf ( \n\n ( c ) ) ;
mprintf ( \n The r a t e o f steam c i r c u l a t i o n i s %f kg / h
, rate ) ;
// end
Scilab code Exa 5.21 To determine fraction of steam withdrawn and thermal efficiency of cycle
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 5
3 // Some A p p l i c a t i o n s o f t h e Laws o f Thermodynamics
4 // Example 21
5
6
7 clear all ;
8 clc ;
96
9
10
11 // Given :
12 P2 = 2800; // p r e s s u r e o f s u p e r h e a t e d steam ( kPa )
13 P1 = 275; // p r e s s u r e o f withdrawn steam ( kPa )
14 V = 1.070*10^ -3; // s p e c i f i c volume o f s a t u r a t e d
l i q u i d a t 275 kPa
15
16 // From steam t a b l e s :
17 H6 = 138; // e n t h a l p y o f s a t u r a t e d l i q u i d a t 5 kPa
18 S6 = 0.4764; // e n t r o p y o f s a t u r a t e d l i q u i d a t 5 kPa
19 H_v1 = 2562; // e n t h a l p y o f s a t u r a t e d v a p o u r a t 5 kPa
20 S_v1 = 8.3951; // e n t r o p y o f s a t u r a t e d v a p o u r a t 5
kPa
21 H1 = 549; // e n t h a l p y o f s a t u r a t e d l i q u i d a t 275 kPa
22 S1 = 1.6408; // e n t r o p y o f s a t u r a t e d l i q u i d a t 275
kPa
H_v2 = 2721; // e n t h a l p y o f s a t u r a t e d v a p o u r a t 275
kPa
24 S_v2 = 7.0209; // e n t r o p y o f s a t u r a t e d v a p o u r a t 275
kPa
25 H3 = 3063; // e n t h a l p y o f s u p e r h e a t e d steam a t 2 8 0 0
kPa and 598 K
26 S3 = 6.6875; // e n t r o p y o f s u p e r h e a t e d steam a t 2 8 0 0
kPa and 598 K
23
27
28
29
30
31
32
33
34
35 // A p p l y i n g e n e r g y b a l a n c e a r o u n d f e e d w a t e r h e a t e r
36 m = ( H1 - H7 ) /( H4 - H7 ) ; // f r a c t i o n o f steam e x t r a c t e d
37 mprintf ( F r a c t i o n o f steam withdrawn i s %f ,m ) ;
97
38
39
40
41
42
43
44
45
46
47
48
49
W_in = V *( P2 - P1 ) ; // work i n p u t t o t h e f e e d w a t e r
pump
H2 = H1 + W_in ;
// C o n s i d e r i n g i s e n t r o p i c e x p a n s i o n i n t u r b i n e
S5 = S3 ;
x = ( S5 - S6 ) /( S_v1 - S6 ) ;
H5 = H6 + x *( H_v1 - H6 ) ;
// U s i n g eq . 5 . 8 5 ( Page no . 1 6 2 )
eff = (( H3 - H2 ) -(1 - m ) *( H5 - H6 ) ) /( H3 - H2 ) ;
mprintf ( \n Thermal e f f i c i e n c y i s %f p e r c e n t , eff
*100) ;
// end
clear all ;
clc ;
// Given :
r = 8; // c o m p r e s s i o n r a t i o
T1 = 290; // t e m p e r a t u r e a t b e g i n n i n g (K)
P1 = 100; // p r e s s u r e a t t h e b e g i n n i n g ( kPa )
Q1 = 450; // h e a t t r a n s f e r r e d p e r c y c l e ( kJ / kg K)
Cp = 1.005; // s p e c i f i c h e a t o f a i r ( kJ / kg K)
Cv = 0.718; // s p e c i f i c h e a t o f a i r ( kJ / kg K)
R = 8.314; // i d e a l g a s c o n s t a n t
98
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
M = 29; // m o l e c u l a r wt o f a i r
//To d e t e r m i n e mean e f f e c t i v e p r e s s u r e
// B a s i s :
m = 1; // mass o f a i r ( kg )
// ( a )
// R e f e r r i n g f i g . 5 . 2 4 ( Page no . 1 6 4 )
V1 = ( m * R *1000* T1 ) /( M * P1 *10^3) ;
// C o n d i t i o n s a t s t a t e 2
V2 = V1 / r ;
gama = Cp / Cv ;
T2 = T1 *( r ^( gama -1) ) ;
P2 = P1 *( r ^ gama ) ;
mprintf ( ( a ) ) ;
mprintf ( \n At t h e end o f f i r s t p r o c e s s ) ;
mprintf ( \n T e m p e r a t u r e = %f K , T2 ) ;
mprintf ( \n P r e s s u r e = %f kPa , P2 ) ;
// C o n d i t i o n s a t s t a t e 3
// C o n s t a n t volume p r o c e s s
V3 = V2 ;
T3 = Q1 / Cv + T2 ;
P3 = ( T3 / T2 ) * P2 ;
mprintf ( \n\n At t h e end o f s e c o n d p r o c e s s ) ;
mprintf ( \n T e m p e r a t u r e = %f K , T3 ) ;
mprintf ( \n P r e s s u r e = %f kPa , P3 ) ;
// C o n d i t i o n s a t s t a t e 4
T4 = T3 /( r ^( gama -1) ) ;
P4 = P3 /( r ^ gama ) ;
mprintf ( \n\n At t h e end o f t h i r d p r o c e s s ) ;
mprintf ( \n T e m p e r a t u r e = %f K , T4 ) ;
mprintf ( \n P r e s s u r e = %f kPa , P4 ) ;
Q2 = Cv *( T4 - T1 ) ; // h e a t r e j e c t e d d u r i n g t h e c o n s t a n t
volume p r o c e s s
55
99
56 // ( b )
57 // U s i n g eq . 5 . 8 8 ( Page no . 1 6 5 )
58 eff = 1 - ((1/ r ) ^( gama -1) ) ;
59 mprintf ( \n\n\n ( b ) ) ;
60 mprintf ( \n Thermal e f f i c i e n c y i s %f , eff ) ;
61
62 // ( c )
63 W = Q1 - Q2 ; // work done
64 mprintf ( \n\n\n ( c ) ) ;
65 mprintf ( \n Work done i s %f kJ / kg ,W ) ;
66
67 // ( d )
68 Pm = W /( V1 - V2 ) ;
69 mprintf ( \n\n\n ( d ) ) ;
70 mprintf ( \n Mean e f f e c t i v e p r e s s u r e i s %f kPa , Pm ) ;
71
72 // end
Scilab code Exa 5.23 To determine work done thermal effeciency and mean
effective pressure
1
2
3
4
5
6
7
8
9
10
11
12
13
14
clear all ;
clc ;
// Given :
r = 15; // c o m p r e s s i o n r a t i o
P1 = 100; // p r e s s u r e i n t h e b e g i n n i n g ( kPa )
T1 = 300; // t e m p e r a t u r e i n t h e b e g i n n i n g (K)
100
15
16
17
18
19
20
21
22
23
Q1 = 500; // h e a t t r a n s f e r r a t e ( kJ / kg )
M = 29; // m o l e c u l a r wt o f a i r
R = 8.314; // i d e a l g a s c o n s t a n t
// S p e c i f i c h e a t s o f a i r ( kJ / kg K)
Cp = 1.005;
Cv = 0.718;
// ( a )
// I s e n t r o p i c c o m p r e s s i o n 12
V1 = ( R *1000* T1 ) /( M * P1 *10^3) ;
T2 = T1 * r ^( gama -1) ;
P2 = P1 * r ^ gama ;
V2 = V1 / r ;
mprintf ( ( a ) ) ;
mprintf ( \n At t h e end o f f i r s t p r o c e s s ) ;
mprintf ( \n T e m p e r a t u r e = %f K , T2 ) ;
mprintf ( \n P r e s s u r e = %f kPa , P2 ) ;
// C o n s a t n t p r e s s u r e h e a t a d d i t i o n 23
T3 = Q1 / Cp + T2 ;
V3 = ( T3 / T2 ) * V2 ;
P3 = P2 ;
mprintf ( \n\n At t h e end o f s e c o n d p r o c e s s ) ;
mprintf ( \n T e m p e r a t u r e = %f k , T3 ) ;
mprintf ( \n P r e s s u r e = %f kPa , P3 ) ;
// I s e n t r o p i c e x p a n s i o n 34
V4 = V1 ;
T4 = T3 /(( V4 / V3 ) ^( gama -1) ) ;
P4 = P3 *(( V3 / V4 ) ^ gama ) ;
mprintf ( \n\n At t h e end o f t h i r d p r o c e s s ) ;
mprintf ( \n T e m p e r a t u r e = %f K , T4 ) ;
mprintf ( \n P r e s s u r e = %f kPa , P4 ) ;
101
52 Q2 = Cv *( T4 - T1 ) ; // h e a t r e j e c t e d 41
53
54 // ( b )
55 Wnet = Q1 - Q2 ;
56 mprintf ( \n\n ( b ) ) ;
57 mprintf ( \n Net work done p e r c y c l e p e r kg a i r
i s %f
kJ / kg , Wnet ) ;
58
59 // ( c )
60 eff = Wnet / Q1 ; // t h e r m a l e f f i c i e n c y
61 mprintf ( \n\n ( c ) ) ;
62 mprintf ( \n Thermal e f f i c i e n c y i s %f , eff ) ;
63
64 // ( d )
65 Pm = Wnet /( V1 - V2 ) ; // mean e f f e c t i v e p r e s s u r e
66 mprintf ( \n\n ( d ) ) ;
67 mprintf ( \n Mean e f f e c t i v e p r e s s u r e i s %f kPa , Pm ) ;
68
69 // end
Scilab code Exa 5.24 To determine temperature pressure work and thermal effeciency
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 5
3 // Some A p p l i c a t i o n s o f t h e Laws o f Thermodynamics
4 // Example 24
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 T1 = 300; // i n i t i a l t e m p e r a t u r e (K)
102
13
14
15
16
17
18
19
P1
T3
P3
Cp
Cv
=
=
=
=
=
100; // i n i t i a l p r e s s u r e ( kPa )
1200; //max t e m p e r a t u r e (K)
500; //max p r e s s u r e ( kPa )
1.005; // ( kJ / kg K)
0.718; // ( kJ / kg K)
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
// ( a )
P4 = P1 ;
P2 = P3 ;
// I s e n t r o p i c c o m p r e s s i o n 12
T2 = T1 *(( P2 / P1 ) ^(( gama -1) / gama ) ) ;
mprintf ( ( a ) ) ;
mprintf ( \n At t h e end o f f i r s t p r o c e s s ) ;
mprintf ( \n T e m p e r a t u r e = %f K , T2 ) ;
mprintf ( \n P r e s s u r e = %f kPa , P2 ) ;
// P r o c e s s 23
mprintf ( \n\n At t h e end o f s e c o n d p r o c e s s ) ;
mprintf ( \n T e m p e r a t u r e = %f K , T3 ) ;
mprintf ( \n P r e s s u r e = %f kPa , P3 ) ;
// I s e n t r o p i c e x p a n s i o n 34
T4 = T3 /(( P3 / P4 ) ^(( gama -1) / gama ) ) ;
mprintf ( \n\n At t h e end o f t h i r d p r o c e s s ) ;
mprintf ( \n T e m p e r a t u r e = %f K , T4 ) ;
mprintf ( \n P r e s s u r e = %f kPa , P4 ) ;
// ( b )
W_comp = Cp *( T2 - T1 ) ; // work r e q u i r e d by c o m p r e s s o r
mprintf ( \n\n ( b ) ) ;
mprintf ( \n Work r e q u i r e d by c o m p r e s s o r i s %f kJ / kg
, W_comp ) ;
// ( c )
103
49
50
51
52
53 // ( d )
54 eff = 1 -( P1 / P2 ) ^(( gama -1) / gama ) ;
55 mprintf ( \n\n ( d ) ) ;
56 mprintf ( \n Thermal e f f i c i e n c y i s %f , eff ) ;
57
58 // end
104
Chapter 6
Thermodynamic Properties of
Pure Fluids
1)
13 V = 0.1; // m o l a r volume o f o r g a n i c l i q u i d (m3/ kmol )
14 P2 = 20; // f i n a l p r e s s u r e ( b a r )
15 P1 = 1; // i n i t i a l p r e s s u r e ( b a r )
16
17
18
//To d e t e r m i n e t h e c h a n g e i n e n t r o p y o f s y s t e m
// b e t t a = ( 1 /V) ( d e l V/ d e l T) p
105
19 // L e t k = ( d e l V/ d e l T) p
20 k = betta * V ;
21
22 // C o n s i d e r i n g Maxwell s r e l a t i o n Eq .
23
24
25
26
27
28
6 . 2 4 ( Page no .
193)
// dS = k ( dP )
S = -k *( P2 - P1 ) *10^5; // e n t r o p y c h a n g e ( J / kmol K)
mprintf ( Change i n e n t r o p y i s %f J / kmol K ,S ) ;
mprintf ( \n I t i s assumed t h a t ( d e l V/ d e l T) p i s
c o n s t a n t i n t h e p r e s s u r e r a n g e 1 t o 20 b a r ) ;
// end
clear all ;
clc ;
// Given :
T1 = 363; // t e m p e r a t u r e (K)
T2 = 373; // t e m p e r a t u r e (K)
P2 = 101.3; // v a p o u r p r e s s u r e a t 373 K ( kPa )
H = 2275*18; // mean h e a t o f v a p o r i s a t i o n ( kJ / kmol )
R =8.314; // i d e a l g a s c o n s t a n t ( kJ / kmol K)
//To c a l c u l a t e v a p o u r p r e s s u r e o f w a t e r a t 363 K
// U s i n g eq . 6 . 2 8 ( Page no . 1 9 6 )
P1 = P2 /( %e ^(( H / R ) *((1/ T1 ) -(1/ T2 ) ) ) ) ;
106
21
22
23
Scilab code Exa 6.3 To determine the melting point of mercury at 10 bar
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 6
3 // Thermodynamic P r o p e r t i e s o f Pure F l u i d s
4 // Example 3
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 d_l = 13.69*10^3; // d e n s i t y o f m e r c u r y i n l i q u i d
13
14
15
16
17
18
19
s t a t e ( kg /m 3 )
d_s = 14.193*10^3; // d e n s i t y o f m e r c u r y i n s o l i d
s t a t e ( kg /m 3 )
T1 = 234.33; // t e m p e r a t u r e i n K
P1 = 1; // i n i t i a l p r e s s u r e i n b a r
P2 = 10; // f i n a l p r e s s u r e i n b a r
Hf = 9.7876; // h e a t o f f u s i o n o f m e r c u r y ( kJ / kg )
//To d e t e r m i n e t h e m e l t i n g p o i n t o f m e r c u r y a t 10
bar
20 // U s i n g C l a p e y r o n e q u a t i o n [ Eq . 6 . 2 5 Page no . 1 9 5 ]
21 // Assuming d e l V / d e l H r e m a i n s c o n s t a n t , l o g ( T2/T1 )
= ( d e l V / d e l H ) ( P2P1 )
22
23 del_V = (1/ d_l ) -(1/ d_s ) ;
24 T2 = T1 *( %e ^(( del_V / Hf ) *( P2 - P1 ) ) ) ;
107
25
26
27
mprintf ( The m e l t i n g p o i n t o f m e r c u r y a t 10 b a r i s
%f K , T2 ) ;
// end
magnesium
19 // I n t e g r a t i n g Eq 6 . 3 1 ( Page no . 1 9 8 ) , we g e t
20 // S = i n t g ( Cp ( dT/T) )
21 S = 26.04* log ( T2 / T1 ) +5.586*10^ -3*( T2 - T1 )
// end
108
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
109
12
13
14
15
// The g i v e n e x a m p l e i s t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
// end
Scilab code Exa 6.7 To calculate internal energy enthalpy entropy and fre
energy for 1 mole of nitrogen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
clear all ;
clc ;
// Given :
T = 773; // t e m p e r a t u r e (K)
P = 100; // p r e s s u r e ( b a r )
Ho = 0; // e n t h a l p y o f n i t r o g e n a t 273 K and 1 b a r
So = 192.4; // e n t r o p y o f n i t r o g e n a t 298 K and 1 b a r
To = 273; // (K)
Po = 1; // ( b a r )
R = 8.314; // i d e a l g a s c o n s t a n t ( kJ / kmol K)
//Cp = 2 7 . 3 + ( 4 . 2 1 0 3 T) m o l a l h e a t c a p a c i t y a t 1
bar
20
21
//To c a l c u l a t e i n t e r n a l e n e r g y e n t h a l p y e n t r o p y and
f r e e e n e r g y f o r one mole o f n i t r o g e n
22 // S t e p 1 :
23 // Assuming t h a t n i t r o g e n i s i n i t i a l l y a t 273 K and 1
bar
110
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
// d e l H 1 = i n t g ( CpdT )
del_H1 = 27.3*( T - To ) +4.2*10^ -3*( T ^2 - To ^2) /2;
// Assuming t h a t n i t r o g e n i s i n i t i a l l y a t 298 K and 1
bar
// d e l S 1 = i n t g ( Cp ( dT/T) )
del_S1 = 27.3* log ( T / To ) +4.2*10^ -3*( T - To ) ;
H1 = Ho + del_H1 ;
S1 = So + del_S1 ;
// S t e p 2 :
// d e l H 2 = [ V T ( d e l V / d e l T ) p ] dP
// S i n c e n i t r o g e n b e h a v e s a s i d e a l g a s
// ( d e l V / d e l T ) p = R/P , V(RT) /P = 0
del_H2 = 0;
del_S2 = -R * log ( P / Po ) ;
H = H1 + del_H2 ;
S = S1 + del_S2 ;
// I n t e r n a l e n e r g y : U = HPV = HRT ( J / mol )
U = H - (R*T);
// Gibbs f r e e e n e r g y ( J / mol )
G = H -( T * S ) ;
mprintf ( E n t h a l p y i s %5 . 3 e J / mol ,H ) ;
mprintf ( \n Entrop y i s %f J / mol K ,S ) ;
mprintf ( \n I n t e r n a l e n e r g y i s %4 . 3 e J / mol ,U ) ;
mprintf ( \n Gibbs f r e e e n e r g y i s %4 . 3 e J / mol ,G ) ;
// end
Scilab code Exa 6.8 To calculate entropy change and mean heat capacity
1
2 // C h a p t e r 6
3 // Thermodynamic P r o p e r t i e s o f Pure F l u i d s
4 // Example 8
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 // E q u a t i o n o f s t a t e : P(VB) = RT + (AP 2 ) /T
13 Cp = 33.6; // mean s p e c i f i c h e a t a t a t m o s h e r i c
p r e s s u r e ( J / mol K)
14 A = 1*10^ -3; //m3 K/ ( b a r ) mol
15 B = 8.0*10^ -5; //m3/ mol
16 R = 8.314*10^ -5; // i d e a l g a s c o n s t a n t (m3 ( b a r ) / mol
K)
17
18
19
20
21
22
23
24
25
26
27 // For s t e p 1 :
28 Po = 4; // p r e s s u r e a t A ( b a r )
29 P1 = 1; // p r e s s u r e a t C ( b a r )
30 T = 300; // t e m p e r a t u r e (K)
31 // d e l S 1 = i n t g [ ( d e l V / d e l T ) pdP ]
32 del_S1 = ( R * log ( Po / P1 ) - ( A / T ^2) *( Po ^2 - P1 ^2) /2)
*10^5; // ( J / mol K)
112
33
34
35
36
37
38
39
40
41
42
43
// For s t e p 2 :
T1 = 300; // t e m p e r a t u r e a t C (K)
T2 = 400; // t e m p e r a t u r e a t D (K)
del_S2 = Cp * log ( T2 / T1 ) ; // ( J / mol K)
// For s t e p 3 :
P2 = 1; // p r e s s u r e a t D ( b a r )
P3 = 12; // p r e s s u r e a t B ( b a r )
T = 400; // t e m p e r a t u r e (K)
del_S3 = ( R * log ( P2 / P3 ) - ( A / T ^2) *( P2 ^2 - P3 ^2) /2)
*10^5; // ( J / mol K)
44 S = del_S1 + del_S2 + del_S3 ; // t o t a l e n t r o p y c h a n g e
45 mprintf ( ( a ) . T o t a l e n t r o p y c h a n g e i s %f J / mol K ,S )
;
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// ( b ) . The mean h e a t c a p a c i t y a t 12 b a r
// I f t h e c h a n g e i s b r o u h g t a l o n g ACo and CoB
// For ACo
P1 = 4; // p r e s s u r e a t A ( b a r )
P2 = 12; // p r e s s u r e a t Co ( b a r )
T = 300; // t e m p e r a t u r e (K)
del_S1 = R * log ( P1 / P2 ) - ( A / T ^2) *( P1 ^2 - P2 ^2) /2;
// For CoB
T2 = 400; // t e m p e r a t u r e a t B (K)
T1 = 300; // t e m p e r a t u r e a t Co (K)
del_S2 = S - del_S1 ;
Cpm = del_S2 /( log ( T2 / T1 ) ) ;
mprintf ( \n ( b ) . The mean h e a t c a p a c i t y a t 12 b a r i s
%f J / mol K , Cpm ) ;
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
(K 1)
13 k = 3.9*10^ -6; // c o e f f e c i e n t o f c o m p r e s s i b i l i t y ( b a r
1)
14 T = 273; // t e m p e r a t u r e i n K
114
15 d = 13.596*10^3; // d e n s i t y ( kg /m 3 )
16 Cp = 0.14*10^3; // ( J / kg K)
17
18 //To c a l c u l a t e Cv f o r m e r c u r y
19 // U s i n g e q u a t i o n 6 . 5 5 ( Page no . 2 0 8 )
20 Cv = Cp - ( betta ^2* T *10^5) /( k * d ) ;
21
22 mprintf ( Cv f o r m e r c u r y i s %f J / kg K , Cv ) ;
23
24 // end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
2 // C h a p t e r 6
3 // Thermodynamic P r o p e r t i e s o f Pure F l u i d s
4 // Example 12
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12
13 // The g i v e n e x a m p l e i s t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
116
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
117
12
13
14
15
// The g i v e n e x a m p l e i s t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
118
7 clear all ;
8 clc ;
9
10
11 // Given :
12
13 // The g i v e e x a m p l e i s
t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
i n v o l v e any n u m e r i a c l c o m p u t a t i o n
14
15
// end
2 // C h a p t e r 6
3 // Thermodynamic P r o p e r t i e s o f Pure F l u i d s
4 // Example 19
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12
13 // The g i v e n e x a m p l e i s t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
i n v o v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
120
clear all ;
clc ;
// Given :
// E q u t i o n o f s t a t e : P(Vb ) = RT
P = 10; // p r e s s u r e ( b a r )
T = 298; // t e m p e r a t u r e (K)
b = 3.707*10^ -5; // Vander Waal s c o n s t a n t (m3/ mol )
R = 8.314; // i d e a l g a s c o n s t a n t
//To e s t i m a t e t h e f u g a c i t y o f ammonia
// S i n c e PV = RT + Pb , Z = 1 + ( Pb/RT)
// U s i n g e q u a t i o n 6 . 1 2 7 ( Page no . 2 2 8 )
f = P *( %e ^(( b * P *10^5) /( R * T ) ) ) ;
mprintf ( F u g a c i t y f = %f b a r ,f ) ;
// end
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Example 22
clear all ;
clc ;
// Given :
// i n t g ( alphadP ) = 556.61 J / mol
P = 50; // p r e s s u r e i n b a r
T = 300; // t e m p e r a t u r e i n K
R = 8.314; // i d e a l g a s c o n s t a n t
//To d e t e r m i n e t h e f u g a c i t y o f g a s
// U s i n g e q u a t i o n 6 . 1 3 0 ( Page no . 2 3 0 )
f = P * %e ^( -556.61/( R * T ) ) ;
mprintf ( F u g a c i t y o f g a s a t 50 b a r and 300 K i s %i
b a r ,f ) ;
// end
Scilab code Exa 6.23 To determine the fugacity coeffeceint at given pressure
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 6
3 // Thermodynamic P r o p e r t i e s o f Pure F l u i d s
4 // Example 23
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
122
12 // E q u a t i o n o f s t a t e : PV = RT( 1 0 . 0 0 5 1 3P)
13 P = [1 5 10]; // p r e s s u r e s i n b a r
14
15 //To d e t e r m i n e f u g a c i t y c o e f f i c i e n t a t g i v e n
pressures
16 // A c c o r d i n g t o Eq . 6 . 1 1 8 ( Page no . 2 2 8 )
17 //RTd( l n f ) = VdP = RT( d l n P 0 . 0 0 5 1 3 dP )
18 // p h i = %e ( 0 . 0 0 5 1 3 P)
19
20 for i = 1:3
21
phi ( i ) = %e ^( -0.00513* P ( i ) ) ;
22
mprintf ( \n F u g a c i t y c o e f f e c i e n t
a t %i b a r i s %f
,P ( i ) , phi ( i ) ) ;
23 end
24
25 // end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
123
clear all ;
clc ;
// Given :
P = 100; // p r e s s u r e i n b a r
T = 373; // t e m p e r a t u r e i n K
a = 0.453; // Vander Waal s c o n s t a n t ( J m3/ mol 2 )
b = 0.571*10^ -4; // Vander Waal s c o n s t a n t (m3/ mol )
V = 2.072*10^ -4; // m o l a r volume (m3/ mol )
R = 8.314; // i d e a l g a s c o n s t a n t
//To d e t e r m i n e t h e f u g a c i t y o f p u r e e t h y l e n e
// U s i n g eq . 6 . 1 3 9 ( Page no . 2 3 3 )
ln_f = ( b /( V - b ) ) - ((2* a ) /( R * T * V ) ) + log (( R * T *10^ -5)
/( V - b ) ) ;
22 f = %e ^ ln_f ;
23 mprintf ( F u g a c i t y i s %f b a r ,f ) ;
24
25
// end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
clear all ;
clc ;
// Given :
T = 623; // t e m p e r a t u r e i n K
//To d e t e r m i n e f u g a c i t y and f u g a c i t y c o e f f e c i e n t o f
steam
ln_phi = (1/( R * T ) ) *(( H - Ho ) -T *( S - So ) ) ;
f = fo * %e ^ ln_phi ;
phi = f / fo ;
mprintf ( F u g a c i t y o f steam i s %f b a r ,f /100) ;
mprintf ( \n F u g a c i t y c o e f f e c i e n t i s %f , phi ) ;
// end
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// C h a p t e r 6
// Thermodynamic P r o p e r t i e s o f Pure F l u i d s
// Example 27
clear all ;
clc ;
// Given :
T = 473; // t e m p e r a t u r e i n K
P = 50*10^5; // p r e s s u r e i n Pa
d = 24.3; // d e n s i t y o f ammonia ( kg /m 3 )
m = 17; // m o l e c u l a r wt o f ammonia
R = 8.314; // i d e a l g a s c o n s t a n t
//To e s t i m a t e t h e f u g a c i t y o f ammonia
V = m /( d *1000) ; // m o l a r volume o f ammonia (m3/ kmol )
// U s i n g eq . 6 . 1 4 2 ( Page no . 2 3 4 )
f = ( V *( P ^2) ) /( R * T ) ;
mprintf ( The f u g a c i t y o f ammonia i s %f b a r ,f /10^5) ;
// end
126
10
11 // Given :
12 T = 303; // t e m p e r a t u r e i n K
13 P = 10; // p r e s s u r e i n b a r
14 Ps = 4.241/100; // s a t u r a t i o n p r e s s u r e ( b a r )
15 sp_vol = 1.004 *10^ -3; // s p e c i f i c volume a t 303 K (m
3/ kg )
16 R = 8.314; // i d e a l g a s c o n s t a n t
17
18 //To c a l c u l a t e t h e f u g a c i t y o f l i q u i d w a t e r
19 V = sp_vol *10^ -3*18; // m o l a r volume (m3/ mol )
20
21 // Assuming v a p o u r b e h a v e s a s an i d e a l g a s
22 f_sat = Ps ;
23 // U s i n g Eq . 6 . 1 4 4 ( Page no . 2 3 5 )
24 ln_phi = ( V /( R * T ) ) *( P - Ps ) *10^5;
25 f = f_sat * %e ^ ln_phi ;
26 mprintf ( F u g a c i t y o f l i q u i d w a t e r a t g i v e n
c o n d i t i o n s i s %f b a r ,f ) ;
27
28
// end
Scilab code Exa 6.29 To determine the fugacity of n butane in liquid state
at given conditions
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 6
3 // Thermodynamic P r o p e r t i e s o f Pure F l u i d s
4 // Example 29
5
6
7 clear all ;
8 clc ;
9
10
127
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Given :
T = 350; // t e m p e r a t u r e i n K
P = 60; // p r e s s u r e i n b a r
Ps = 9.35; // v a p o u r p r e s s u r e a t 350 K ( b a r )
V = 0.1072*10^ -3; // m o l a r volume (m3/ mol
phi = 0.834; // f u g a c i t y c o e f f e c i e n t
R = 8.314; // i d e a l g a s c o n s t a n t
//To d e t e r m i n e f u g a i t y o f n b u t a n e i n l i q u i d s t a t e
at given c o n d i t i o n s
f_sat = phi * Ps ;
// U s i n g eq . 6 . 1 4 4 ( Page no . 2 3 5 )
ln_phi = ( V /( R * T ) ) *( P - Ps ) *10^5;
f = f_sat * %e ^ ln_phi ;
mprintf ( F u g a c i t y o f nb u t a n e i n l i q u i d s t a t e a t
g i v e n c o n d i t i o n s i s %f b a r ,f ) ;
// end
clear all ;
clc ;
// Given :
M = 24.32; // m o l e c u l a r wt o f s o l i d magnesium
T = 300; // t e m p e r a t u r e i n K
P = 10; // p r e s s u r e i n b a r
128
15 Po = 1; // r e f e r e n c e s t a t e p r e s s u r e ( b a r )
16 d = 1.745*10^3; // d e n s i t y o f Mg a t 300 K i n kg /m3
17
18 //To d e t e r m i n e t h e a t i v i t y o f s o l i d m a g n e s i u n
19 // U s i n g eq . 6 . 1 4 9 ( Page no . 2 3 7 )
20 ln_a = ( M /( d *10^3* R * T ) ) *( P - Po ) *10^5;
21 a = %e ^ ln_a ;
22 mprintf ( A c i v i t y o f s o l i d magnesium a t 300 K and 10
b a r i s %f ,a ) ;
23
24
// end
129
Chapter 7
Properties of Solutions
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
clear all ;
clc ;
// Given :
V = 0.1; // volume o f m i x t u r e r e q u i r e d (m 3 )
Ve = 0.03; // volume o f a l c o h o l
Vw = 0.07; // volume o f w a t e r
de = 789; // d e n s i t y o f e t h a n o l ( kg /m 3 )
dw = 997; // d e n s i t y o f w a t e r ( kg /m 3 )
pe = 53.6*10^ -6; // p a r t i a l m o l a r volume o f e t h a n o l (
m3/ mol )
18 pw = 18*10^ -6; // p a r t i a l m o l a r volume o f w a t e r (m3/
mol )
19 Me = 46; // m o l e c u l a r wt o f e t h a n o l
20 Mw = 18; // m o l e c u l a r wt o f w a t e r
21
22
23
24
25
26
27
28
29
30
31
32
33
//To f i n d t h e volume o f m i x t u r e
ne = ( Ve * de *10^3) / Me ; // number o f m o l e s o f e t h a n o l
nw = ( Vw * dw *10^3) / Mw ; // number o f m o l e s o f w a t e r
xe = ne /( ne + nw ) ; // mole f r a c t i o n o f e t h a n o l
xw = 1 - ne ; // mole f r a c t i o n o f w a t e r
act_V = ( ne * pe ) +( nw * pw ) ;
if ( V == act_V )
then mprintf ( I t i s p o s s i b l e t o p r e p a r e t h e
r e q u i r e d s o l u t i o n );
else
Ve_act = ( Ve / act_V ) * V ;
Vw_act = ( Vw / act_V ) * V ;
mprintf ( \n For t h e g i v e n v o l u m e s o f e t h a n o l and
water , i t i s n o t p o s s i b l e t o p r e p a r e 0 . 1
c u b i c m o f mixture );
131
34
35
mprintf ( \n R e q u i r e d volume o f e t h a n o l i s %f
c u b i c m , Ve_act ) ;
mprintf ( \n R e q u i r e d volume o f w a t e r i s %f c u b i c
m , Vw_act ) ;
36 end
37
38 // end
Scilab code Exa 7.3 To find the required volume of methanol and water
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
clear all ;
clc ;
// Given :
V = 2; // volume o f d e s i r e d s o l u t i o n (m 3 )
x1 = 0.3; // m o l e s f r a c t i o n o f m e t h a n o l
x2 = 0.7; // m o l e s f r a c t i o n o f w a t e r
V1 = 38.632*10^ -6; // p a r t i a l m o l a r volume o f
m e t h a n o l (m3/ mol )
16 V2 = 17.765*10^ -6; // p a r t i a l m o l a r volume o f w a t e r (
m3/ mol )
17 mol_V1 = 40.727*10^ -6; // m o l a r volume o f e t h a n o l (m
3/ mol )
18 mol_V2 = 18.068*10^ -6; // m o l a r volume o f w a t e r (m3/
mol )
19
20
21
22
23
24
25
26
27
28
29
30
solution
n = V / V_mol ; // no .
n1 = x1 * n ; // m o l e s
n2 = x2 * n ; // m o l e s
V_m = n1 * mol_V1 ;
V_w = n2 * mol_V2 ;
mprintf ( Volume o f
m , V_m ) ;
mprintf ( \n Volume
m , V_w ) ;
of moles in the d e s i r e d s o l u t i o n
o f methanol
of water
m e t h a n o l t o be t a k e n i s %f c u b i c
o f w a t e r t o be t a k e n i s %f c u b i c
// end
Scilab code Exa 7.4 To calculate the volume of water to be added and
volume of dilute alcohol solution
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 7
3 // P r o p e r t i e s o f S o l u t i o n s
4 // Example 4
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 V1_w = 0.816*10^ -3; // p a r t i a l m o l a r volume o f w a t e r
i n 96% a l c o h o l s o l u t i o n
V1_e = 1.273*10^ -3; // p a r t i a l m o l a r volume o f
e t h a n o l i n 96% a l c o h o l s o l u t i o n
14 V2_w = 0.953*10^ -3; // p a r t i a l m o l a r volume o f w a t e r
i n 56% a l c o h o l s o l u t i o n
15 V2_e = 1.243*10^ -3; // p a r t i a l m o l a r volume o f
e t h a n o l i n 56% a l c o h o l s o l u t i o n
13
133
16 d = 0.997*10^3; // d e n s i t y o f w a t e r ( kg /m 3 )
17
18 //To c a l c u l a t e t h e volume o f w a t e r t o be added and
volume o f d i l u t e a l c o h o l s o l u t i o n
19 // B a s i s :
20 V = 2*10^ -3; // volume o f a l c o h o l s o l u t i o n (m 3 )
21 V_sp = (0.96* V1_e ) +(0.04* V1_w ) ; // volume o f 1 kg o f
laboratory alcohol
22 m_e = V / V_sp ; // mass o f 210 3 m3 a l c o h o l
23
24 // ( a ) .
25 // L e t mass o f w a t e r added be m kg
26 // Taking an a l c o h o l b a l a n c e
27 m = ( m_e *0.96) /0.56 - m_e ;
28 v = m / d ;
29 mprintf ( \n ( a ) . ) ;
30 mprintf ( \n Mass o f w a t e r added i s %f kg ,m ) ;
31 mprintf ( \n Volume o f w a t e r added i s %4 . 3 e c u b i c m ,
v);
32
33
34
35
// ( b )
m_sol = m_e + m ; // mass o f a l c o h o l s o l u t i o n o b t a i n e d
sp_vol = (0.56* V2_e ) +(0.44* V2_w ) ; // s p e c i f i c volume
o f 56% a l c o h o l
36 V_dil = sp_vol * m_sol ; // volume o f d i l u t e a l c o h o l
solution
37 mprintf ( \n\n ( b ) ) ;
38 mprintf ( \n Volume o f d i l u t e a l c o h o l s o l u t i o n i s %5
. 4 e c u b i c m , V_dil ) ;
39
40
// end
2 // C h a p t e r 7
3 // P r o p e r t i e s o f S o l u t i o n s
4 // Example 5
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12
13 // The g i v e n e x a m p l e i s t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
i n f i n i t e dlution
135
16
17
18
// ( a ) .
// The g i v e n s u b p a r t i s t h e o r e t i c a l and d o e s n o t
i n v o l v e numerical computation
19
20 // ( b ) .
21 // U s i n g eq . 7 . 2 7 ( Page no . 2 6 4 )
22 //H = H 1 b a r a s x1 = 1
23 H1 = 420 -60+40;
24 // U s i n g eq . 7 . 2 8 ( Page no . 2 6 4 )
25 //H = H 2 b a r a s x2 = 1
26 H2 = 600;
27 mprintf ( \n ( b ) . ) ;
28 mprintf ( \n Pure s t a t e e n t h a l p i e s a r e : ) ;
29 mprintf ( \n H1 = %i J / mol , H1 ) ;
30 mprintf ( \n H2 = %i J / mol , H2 ) ;
31
32 // ( c ) .
33 // H 1 i n f = H 1 b a r a s x1 = 0 , s o from eq . 7 . 2 7
34 H1_inf = 420;
35 // H 2 i n f = H 2 b a r a s x2 = 0 . s o from eq 7 . 2 8
36 H2_inf = 640;
37 mprintf ( \n\n ( c ) . ) ;
38 mprintf ( \n At i n f i n i t e d i l u t i o n : ) ;
39 mprintf ( \n H1 = %i J / mol , H1_inf ) ;
40 mprintf ( \n H2 = %i J / mol , H2_inf ) ;
41
42 // end
Scilab code Exa 7.7 To calculate the partial molar volume of the components
1
2
3
4 // Example 7
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 // Volume a s a f u n c t i o n o f m o l a l i t y :
13 function [ y ] = V ( m )
14
y = 1.003*10^ -3 + 0.1662*10^ -4* m + 0.177*10^ -5* m
c o m p o n e n ts
20 // D i f f e r e n t i a t i n g Eq . 7 . 2 9 w i t h r e f e r e n c e t o m, we
get
21 V1_bar = 0.1662*10^ -4 + 0.177*1.5*10^ -5* m ^0.5 +
0.12*2*10^ -6* m ;
22
23 V_sol = V ( m ) ; // volume o f a q u e o u s s o l u t t i o n
24 n1 = m ;
25 n2 = 1000/18;
26 V2_bar = ( V_sol - n1 * V1_bar ) / n2 ;
27 mprintf ( P a r t i a l m o l a r volume o f w a t e r = %4 . 3 e c u b i c
m/ mol , V2_bar ) ;
28 mprintf ( \n P a r t i a l m o l a r volume o f NaCl = %4 . 3 e
c u b i c m/ mol , V1_bar ) ;
29
30
// end
numerical computation
14
15
// end
numerical computation
14
15
// end
138
Scilab code Exa 7.10 To estimate the solubility of oxygen in water at 298
K
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 7
3 // P r o p e r t i e s o f S o l u t i o n s
4 // Example 10
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 K = 4.4*10^4; // Henry s law c o n s t a n t ( b a r )
13 pp = 0.25; // p a r t i a l p r e s s u r e o f o x y g e n i n b a r
14 M_O2 = 32; // m o l e c u l a r wt o f o x y g e n
15 M_water = 18; // m o l e c u l a r wt o f w a t e r
16
17 //To e s t i m a t e t h e s o l u b i l i t y o f o x y g e n i n w a t e r a t
298 K
18 // U s i n g eq . 7 . 7 2 ( Page no . 2 7 5 )
19 x_O2 = pp / K ; // mole f r a c t i o n o f O2
20 mprintf ( S o l u b i l i t y o f o x y g e n i s %5 . 4 e m o l e s p e r
mole o f w a t e r , x_O2 ) ;
21
22
23
24
25
26
// I n mass u n i t s
sol_O2 = ( x_O2 * M_O2 ) / M_water ;
mprintf ( \n S o l u b i l i t y o f o x y g e n i n mass u n i t s i s %4
. 3 e kg o x y g e n p e r kg w a t e r , sol_O2 ) ;
// end
139
Scilab code Exa 7.11 To confirm that mixture conforms to Raoults Law
and to determine Henrys Law constant
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 7
3 // P r o p e r t i e s o f S o l u t i o n s
4 // Example 11
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 xb = [0 0.2 0.4 0.6 0.8 1.0];
13 pa_bar = [0.457 0.355 0.243 0.134 0.049 0];
14 pb_bar = [0 0.046 0.108 0.187 0.288 0.386];
15
16 //To c o n f i r m m i x t u r e c o n f o r m s t o R a o u l t s Law and t o
17
18
19
20
21
22
23
24
25
26
27
28
29
30
d e t e r m i n e Henry s law c o n s t a n t
clf
xa = 1 - xb ;
plot ( xa , pa_bar ) ;
plot ( xa , pb_bar ) ;
xtitle ( , Mole f r a c t i o n o f A , P a r t i a l P r e s s u r e ) ;
// For R a o u l t s Law p l o t t i n g
x = linspace (0 ,1 ,6) ;
y1 = linspace (0 ,0.457 ,6) ;
y2 = linspace (0.386 ,0 ,6) ;
plot2d (x , y1 , style =3) ;
plot2d (x , y2 , style =3) ;
// For Henry s law p l o t t i n g
140
o f component A and
B
yh1 (1) = 0; yh1 (2) = 0.049; // For component A
for i = 3:6
yh1 ( i ) = yh1 (i -1) +( x ( i ) -x (i -1) ) *(( yh1 (2) - yh1 (1) )
/( x (2) -x (1) ) ) ;
end
36
37
38 yh_2 (6) = 0; yh_2 (5) = 0.046; // For component B
39 i = 4;
40 while ( i ~=0)
41
yh_2 ( i ) = yh_2 ( i +1) + ( x ( i ) -x ( i +1) ) *(( yh_2 (6) -
H e n r y s Law ) ;
47
48
49
50
51
52
53
54
55
56
// ( a )
mprintf ( From t h e g r a p h i t can be i n f e r r e d t h a t , i n
t h e r e g i o n where R a o u l t s law i s o b e y e d by A, t h e
H e n r y s law i s o b e y e d by B , and v i c e v e r s a ) ;
// ( b )
// S l o p e o f Henry s law
mprintf ( \n For component A, Ka = %f b a r , yh1 (6) ) ;
mprintf ( \n For component B , Kb = %f b a r , yh_2 (1) ) ;
// end
141
Scilab code Exa 7.12 To calculate activity and activity coeffecient of chloroform
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 7
3 // P r o p e r t i e s o f S o l u t i o n s
4 // Example 12
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 xa = [0 0.2 0.4 0.6 0.8 1.0];
13 Pa_bar = [0 0.049 0.134 0.243 0.355 0.457];
14 Pb_bar = [0.386 0.288 0.187 0.108 0.046 0];
15
16 //To c a l c u l a t e a c t i v i t y and a c t i v i t y c o e f f e c i e n t o f
chloroform
17 xb = 1 - xa ;
18 Pbo = 0.386; // v a p o u r p r e s s u r e o f p u r e c h l o r o f o r m
19 // ( a ) . Based on s t a n d a r d s t a t e a s p e r Lewis R a n d a l l
rule
20
21
22
23
24
25
26
27
28
29
30
31
32
142
);
for i = 1:6
a ( i ) = Pb_bar ( i ) / Kb ;
mprintf ( \n
%f ,a ( i ) ) ;
if ( xb ( i ) ==0)
mprintf (
Not d e f i n e d ) ;
else
ac ( i ) = a ( i ) / xb ( i ) ;
mprintf (
%f , ac ( i ) ) ;
end
end
// end
143
14
15
16
17
18
function [ y ] = f1 ( x1 ) ;
y = (50* x1 ) -(80* x1 ^2) +(40* x1 ^3)
endfunction
//To d e t e r m i n e f u g a c i t y f u g a c i t y c o e f f e c i e n t Henry s
Law c o n s t a n t and a c t i v i t y c o e f f e c i e n t
19
20
21
// ( a )
// F u g a c i t y o f component i n s o l u t i o n becomes f u g a c i t y
o f p u r e component when mole f r a c t i o n a p p r o a c h e s
1 i .e.
22 x1 = 1;
23 f1_pure = f1 ( x1 ) ;
24 mprintf ( ( a ) . F u g a c i t y f 1 o f p u r e component 1 i s %i
b a r , f1_pure ) ;
25
26 // ( b )
27 phi = f1_pure / P ;
28 mprintf ( \n ( b ) . F u g a c i t y c o e f f e c i e n t i s %f , phi ) ;
29
30 // ( c )
31 // Henry s Law c o n s t a n t i s l i m ( f 1 / x1 ) and x1 t e n d s t o
0
32 x1 = 0;
33 K1 = 50 - (80* x1 ) + (40* x1 ^2) ;
34 mprintf ( \n ( c ) . H e n r y s Law c o n s t a n t i s %i b a r , K1 ) ;
35
36
37
38
39
// ( d )
mprintf ( \n ( d ) . T h i s s u b p a r t i s t h e o r e t i c a l and
d o e s n o t i n v o l v e any n u m e r i c a l c o m p u t a t i o n ) ;
// end
144
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
145
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
146
// Given :
// F u n c t i o n f o r e n t h a l p y c h a n g e o f m i x t u r e
//H = x1 x2 ( 4 0 x1 + 20 x2 )
H1_pure = 400; // e n t h a l p y o f p u r e l i q u i d 1 a t 298 K
and 1 b a r ( J / mol )
15 H2_pure = 600; // e n t h a l p y o f p u r e l i q u i d 2 ( J / mol )
11
12
13
14
16
17 //To d e t e r m i n e e n t h a l p i e s a t i n f i n i t e d i l u t i o n
18 // U s i n g eq . 7 . 1 2 6 and 7 . 1 2 8 ( Page no . 2 9 4 )
19 // H 1 b a r = 20(1 x1 ) 2 ( 2 x1 +1)
20 // U s i n g eq . 7 . 1 2 7 and 7 . 1 2 8 ( Page no . 2 9 4 )
21 // H 2 b a r = 40 x1 3
22
23 // For i n f i n i t e d i l u t i o n x1 = 0 , d e l H 1 i n f = H 1 b a r
24 x1 = 0;
25 delH1_inf = 20*((1 - x1 ) ^2) *(2* x1 +1) ;
26 H1_inf = H1_pure + delH1_inf ; // ( J / mol )
27
28 // For i n f i n i t e d i l u t i o n o f 2 , x1 = 1 and d e l H 2 i n f =
H2 bar
29 x1 = 1;
30 delH2_inf = 40* x1 ^3;
31 H2_inf = delH2_inf + H2_pure ; // ( J / mol )
32
33 mprintf ( E n t h a l p y a t i n f i n i t e d i l u t i o n f o r component
1 i s %i J / mol , H1_inf ) ;
34 mprintf ( \n E n t h a l p y a t i n f i n i t e d i l u t i o n f o r
component 2 i s %i J / mol , H2_inf ) ;
35
36
// end
3 // P r o p e r t i e s o f S o l u t i o n s
4 // Example 18
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12
13 // The g i v e n e x a m p l e i s t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
Scilab code Exa 7.19 To determine change in entropy for the contents of
the vessel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
clear all ;
clc ;
// Given :
R = 8.314; // i d e a l g a s c o n s t a n t
n1 = 100; // m o l e s o f n i t r o g e n
n2 = 100; // m o l e s o f o x y g e n
//To d e t e r m i n e t h e c h a n g e i n e n t r o p y o f t h e c o n t e n t s
of the v e s s e l
148
17 x1 = n1 /( n1 + n2 ) ;
18 x2 = n2 /( n1 + n2 ) ;
19
20 // U s i n g eq . 7 . 1 2 2 ( Page no . 2 9 2 )
21 S = -R *( x1 * log ( x1 ) + x2 * log ( x2 ) ) ;
22 S_tot = S *( n1 + n2 ) ;
23 mprintf ( Change i n e n t r o p y o f c o m p o n e n t s a r e %f J /K
, S_tot ) ;
24
25
// end
of water
149
21
22
23
24
25
26
27
// Adding r e a c t i o n 1 and 2 , we g e t
// L i + 1/2 Cl2 + 12H2O > L i C l ( 1 2H2O)
H_form = Hf + H_sol ;
mprintf ( Heat o f f o r m a t i o n o f L i C l i n 12 m o l e s o f
w a t e r i s %f kJ , H_form ) ;
// end
clear all ;
clc ;
// Given :
R = 8.314; // i d e a l g a s c o n s t a n t
n1 = 3; // m o l e s o f h y d r o g e n
n2 = 1; // m o l e s o f n i t r o g e n
T = 298; // t e m p e r a t u r e i n K
P1 = 1; // p r e s s u r e o f h y d r o g e n i n b a r
P2 = 3; // p r e s s u r e o f n i t r o g e n i n b a r
//To c a l c u l a t e t h e f r e e e n e r g y o f m i x i n g
V1 = ( n1 * R * T ) /( P1 *10^5) ; // volume o c c u p i e d by
hydrogen
21 V2 = ( n2 * R * T ) /( P2 *10^5) ; // volume o c c u p i e d by
nitrogen
22 V = V1 + V2 ; // t o t a l volume o c c u p i e d
150
23 P = (( n1 + n2 ) * R * T ) /( V *10^5) ; // f i n a l
pressure
a t t a i n e d by m i x t u r e ( b a r )
24
25
26
// I t i s assumed t h a t p r o c e s s i s t a k i n g i n two s t e p s
// S t e p 1 : I n d i v i d u a l g a s e s a r e s e p a r a t e l y b r o u g h t t o
f i n a l p r e s s u r e at constant temperature
27 // S t e p 2 : The g a s e s a r e mixed a t c o n s t a n t
t e m p e r a t u r e and p r e s s u r e
28
29
30
31
32
33
34
35
36
37
38
39
40
// For s t e p 1
G1 = R * T *( n1 * log ( P / P1 ) + n2 * log ( P / P2 ) ) ;
// For s t e p 2 , u s i n g eq . 7 . 1 2 1 ( Page no . 2 9 2 )
x1 = n1 /( n1 + n2 ) ;
x2 = n2 /( n1 + n2 ) ;
G2 = ( n1 + n2 ) * R * T *( x1 * log ( x1 ) + x2 * log ( x2 ) ) ;
G = G1 + G2 ; // f r e e e n e r g y i n J
mprintf ( The f r e e e n e r g y o f m i x i n g when p a r t i t i o n i s
removed i s %f kJ ,G /1000) ;
// end
Scilab code Exa 7.22 To calculate the mean heat capacity of 20 mol percent solution
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 7
3 // P r o p e r t i e s o f S o l u t i o n s
4 // Example 22
5
6
7 clear all ;
8 clc ;
9
151
10
11
12
13
14
15
16
17
18
19
20
21
// Given :
C_water = 4.18*10^3; // h e a t c a p a c i t y o f w a t e r ( J / kg
K)
C_ethanol = 2.58*10^3; // h e a t c a p a c i t y o f e t h a n o l ( J
/ kg K)
G1 = -758; // h e a t o f m i x i n g 20 mol p e r c e n t e t h a n o l
w a t e r a t 298 K( J / mol )
G2 = -415; // h e a t o f m i x i n g 20 mol p e r c e n t e t h a n o l
w a t e r a t 323 K ( J / mol )
n_wat = 0.8; // m o l e s o f w a t e r
n_eth = 0.2; // m o l e s o f e t h a n o l
T1 = 323; // i n i t i a l t e m p e r a t u r e i n K
T2 = 298; // f i n a l t e m p e r a t u r e i n K
mixed a t 298 K
31 H3 = G1 ; // ( J )
32
33 // S t e p 4 :
34 // M i x t u r e i s h e a t e d t o 323 K
35 //H = Cpm ( T1T2 )
36 H = G2 ;
37 Cpm = (H - H1 - H2 - H3 ) /( T1 - T2 ) ;
38
39 mprintf ( Mean h e a t c a p a c i t y o f
K , Cpm ) ;
40
152
s o l u t i o n i s %f J / mol
41
// end
o f C h e m i c a l E n g i n e e r i n g Thermodynamics
of Solutions
i n i t i a l t e m p e r a t u r e (K)
// Mean h e a t c a p a c i t y o f s o l u t i o n ( J / mol
K)
14 Hs = -758; // h e a t o f m i x i n g ( J / mol )
15
16 //To f i n d t h e f i n a l t e m p e r a t u r e a t t a i n e d
17 // S i n c e t h e p r o c e s s i s a d i a b a t i c
18 H = 0;
19 T = (H - Hs ) / Cpm + To ;
20 mprintf ( The f i n a l t e m p e r a t u r e a t t a i n e d by t h e
m i x i n g i s %f K ,T ) ;
21
22
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
154
Chapter 8
Phase equilibria
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
156
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
157
11
12
13
14
15
// Given :
// The g i v e n e x a m p l e i s t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
// end
clear all ;
clc ;
// Given :
P1 = 106; // v a p o u r p r e s s u r e o f nh e p t a n e ( kPa )
P2 = 74; // v a p o u r p r e s s u r e o f t o l u e n e ( kPa )
P = 101.3; // t o t a l p r e s s u r e ( kPa )
//To d e t e r m i n e t h e c o m p o s i t i o n o f t h e l i q u i d and
vapour i n e q u i l i b r i u m
17 // R e f e r r i n g eq . 8 . 5 1 ( Page no . 3 3 2 )
18
19 // L e t x be mol f r a c t i o n o f h e p t a n e i n l i q u i d
20 x = (P - P2 ) /( P1 - P2 ) ;
21 // U s i n g eq . 8 . 5 4 ( Page no . 3 3 3 )
22 y = x *( P1 / P ) ;
23
24 mprintf ( C o m p o s i t i o n o f l i q u i d h e p t a n e i s %f mol
158
p e r c e n t ,x *100) ;
25 mprintf ( \n C o m p o s i t i o n o f h e p t a n e i n v a p o u r form i s
%f mol p e r c e n t ,y *100) ;
26
27
// end
Scilab code Exa 8.7 To determine pressure at the beginning and at the
end of the process
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 8
3 // Phase E q u i l i b r i a
4 // Example 7
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 P1 = 135.4; // v a p o u r p r e s s u r e o f b e n z e n e ( kPa )
13 P2 = 54; // v a p o u r p r e s s u r e o f t o l u e n e ( kPa )
14
15 //To d e t e r m i n e t h e p r e s s u r e a t t h e b e g i n n i n g and a t
t h e end o f p r o c e s s
16
17 // At b e g i n n i n g
18 x =
0.5; // l i q u i d p h a s e c o m p o s i t i o n
19 // U s i n g eq . 8 . 5 1 ( Page no . 3 3 2 )
20 P_beg = P2 + ( P1 - P2 ) * x ;
21
22 // At t h e end
23 y = 0.5; // v a p o u r p h a s e c o m p o s i t i o n
24 // U s i n g eq . 8 . 5 4 ( Page no . 3 3 3 ) and r e a r r a n g i n g
25 P_end = ( P1 * P2 ) /( P1 - y *( P1 - P2 ) ) ;
159
26
27
mprintf ( P r e s s u r e a t t h e b e g i n n i n g o f t h e p r o c e s s i s
%f kPa , P_beg ) ;
28 mprintf ( \n P r e s s u r e a t t h e end o f t h e p r o c e s s i s %f
kPa , P_end ) ;
29
30
// end
pressure of acetone
endfunction
function [ y2 ] = P2 ( T )
y2 = %e ^(14.2724 - 2945.47/( T -49.15) )
pressure of a c e t o n i t r i l e
20 endfunction
21
22
23
// v a p o u r
//To d e t e r m i n e t e m p e r a t u r e p r e s s u r e and c o m p o s i t i o n s
// ( a ) . To c a l c u l a t e x1 and y1
160
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
T = 327; // t e m p e r a t u r e i n K
P = 65; // p r e s s u r e i n kPa
P1_s = P1 ( T ) ;
P2_s = P2 ( T ) ;
// U s i n g eq . 8 . 5 1 ( Page no . 3 3 2 )
x1 = (P - P2_s ) /( P1_s - P2_s ) ;
// U s i n g eq . 8 . 5 4 ( Page no . 3 3 3 )
y1 = x1 *( P1_s / P ) ;
mprintf ( ( a ) ) ;
mprintf ( \n x1 = %f , x1 ) ;
mprintf ( \n y1 = %f , y1 ) ;
// ( b ) . To c a l c u l a t e T and y1
P = 65; // p r e s s u r e i n kPa
x1 = 0.4;
flag = 1;
T2 = 340; // t e m p e r a t u e ( assumed )
while ( flag ==1)
P1_s = P1 ( T2 ) ;
P2_s = P2 ( T2 ) ;
P_calc = P2_s + x1 *( P1_s - P2_s )
if (( P_calc - P ) <=1)
flag = 0;
else
T2 = T2 -0.8;
end
end
y1 = x1 *( P1_s / P ) ;
mprintf ( \n\n ( b ) ) ;
mprintf ( \n T e m p e r a t u r e i s %f K , T2 ) ;
mprintf ( \n y1 = %f , y1 ) ;
// ( c ) . To c a l c u l a t e P and y1
T3 = 327; // t e m p e r a t u r e i n K
x1 = 0.4;
161
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
P1_s = P1 ( T3 ) ;
P2_s = P2 ( T3 ) ;
P = P2_s + x1 *( P1_s - P2_s ) ;
y1 = x1 *( P1_s / P ) ;
mprintf ( \n\n ( c ) ) ;
mprintf ( \n P r e s s u r e i s %f kPa ,P ) ;
mprintf ( \n y1 = %f , y1 ) ;
// ( d ) . To c a l c u l a t e T and x1
P = 65; // p r e s s u r e i n kPa
y1 = 0.4;
flag = 1;
T = 340; // assumed t e m p e r a t u r e (K)
while ( flag ==1)
P1_s = P1 ( T ) ;
P2_s = P2 ( T ) ;
y1_calc = ( P1_s *( P - P2_s ) ) /( P *( P1_s - P2_s ) ) ;
if (( y1_calc - y1 ) >=0.001)
flag = 0;
else
T = T -2;
end
end
x1 = y1 *( P / P1_s ) ;
mprintf ( \n\n ( d ) ) ;
mprintf ( \n T e m p e r a t u r e = %f K ,T ) ;
mprintf ( \n x1 = %f , x1 ) ;
// ( e ) . To c a l c u l a t e P and x1
T = 327; // t e m p e r a t u r e (K)
y1 = 0.4;
P1_s = P1 ( T ) ;
P2_s = P2 ( T ) ;
// U s i n g eq . 8 . 5 4 and 8 . 5 1
x1 = ( y1 * P2_s ) /( P1_s - y1 *( P1_s - P2_s ) ) ;
P = x1 *( P1_s / y1 ) ;
162
100
101
102
103
104
mprintf ( \n\n ( e ) ) ;
mprintf ( \n P r e s s u r e = %f kPa ,P ) ;
mprintf ( \n x1 = %f , x1 ) ;
// ( f ) . To c a l c u l a t e f r a c t i o n o f t h e s y s t e m i s l i q u i d
and v a p o u r i n e q u i l i b r i u m
105 T = 327; // t e m p e r a t u r e (K)
106 P = 65; // p r e s s u r e ( kPa )
107 y1 = 0.7344;
108
109 P1_s = P1 ( T ) ;
110 P2_s = P2 ( T ) ;
111 x1 = (P - P2_s ) /( P1_s - P2_s ) ;
112 // L e t f be t h e f r a c t i o n o f t h e m i x t u r e t h a t
113
114
115
116
117
118
is
liquid
// A p p l y i n g a c e t o n e b a l a n c e
f = (0.7 - y1 ) /( x1 - y1 ) ;
mprintf ( \n\n ( f ) ) ;
mprintf ( \n F r a c t i o n o f m i x t u r e t h a t i s l i q u i d i s %f
p e r c e n t ,f *100) ;
// end
Scilab code Exa 8.9 To construct boiling point and equilibrium point diagram
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 8
3 // Phase E q u i l i b r i a
4 // Example 9
5
6
7 clear all ;
8 clc ;
9
163
10
11
12
13
14
15
16
17
18
19
// Given :
P = 101.3; // t o t a l p r e s s u r e o v e r t h e s y s t e m ( kPa )
T = [371.4 378 383 388 393 398.6];
Pa = [101.3 125.3 140.0 160.0 179.9 205.3];
Pb = [44.4 55.6 64.5 74.8 86.6 101.3];
//To c o n s t r u c t b o i l i n g p o i n t and e q u i l i b r i u m p o i n t
diagram
for i = 1:6
xa ( i ) = (P - Pb ( i ) ) /( Pa ( i ) - Pb ( i ) ) ; // U s i n g eq .
8.51
ya ( i ) = xa ( i ) *( Pa ( i ) / P ) ; // U s i n g eq . 8 . 5 4
end
20
21
22
23 // ( a ) .
24 //To c o n s t r u c t b o i l i n g p o i n t d i a g r a m
25 clf
26 plot ( xa , T ) ;
27 plot ( ya , T ) ;
28 xtitle ( B o i l i n g P o i n t d i a g r a m , xa and ya ,
Temperature );
29
30
31
32
33
34
35
36
37
38
39
40
// ( b ) .
//To c o n s t r u c t t h e e q u i l i b r i u m d i a g r a m
xset ( window , 1 ) ;
clf
p l o t ( ya , xa ) ;
x t i t l e ( Equilibrium Diagram , xa , ya ) ;
//( c ) .
m p r i n t f ( ( c ) . The g i v e n s u b p a r t i s t h e o r e t i c a l and
d o e s n o t i n v o l v e any n u m e r i c a l c o m p u t a t i o n ) ;
// end
164
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
165
12
13
14
15
16
17
18
19
20
21
22
23
24
x1 = 46.1/100; // mole p e r c e n t o f A
P = 101.3; // t o t a l p r e s s u r e o f s y s t e m ( kPa )
P1_s = 84.8; // v a p o u r p r e s s u r e o f component A ( kPa )
P2_s = 78.2; // v a p o u r p r e s s u r e o f component B ( kPa )
//To c a l c u l a t e van Laar c o n s t a n t s
gama1 = P / P1_s ;
gama2 = P / P2_s ;
x2 = 1 - x1 ;
// van Laar c o n s t a n t s :
// U s i n g eq . 8 . 6 9 ( Page no . 3 4 8 )
A = log ( gama1 ) *(1 + ( x2 * log ( gama2 ) ) /( x1 * log ( gama1 ) )
) ^2;
25 B = log ( gama2 ) *(1 + ( x1 * log ( gama1 ) ) /( x2 * log ( gama2 ) )
) ^2;
26
27
28
29
30
31
Scilab code Exa 8.12 To calculate activity coeffecients in a solution containing 10 percent alcohol
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 8
3 // Phase E q u i l i b r i a
4 // Example 12
5
6
7 clear all ;
8 clc ;
9
166
10
11 // Given :
12 x2 = 0.448; // mole f r a c t i o n o f e t h a n o l
13 P = 101.3; // t o t a l p r e s s u r e ( kPa )
14 P1_s = 68.9; // Vapour p r e s s u r e o f b e n z e n e ( kPa )
15 P2_s = 67.4; // v a p o u r p r e s s u r e o f e t h a n o l ( kPa )
16
17 //To c a l c u l a t e a c t i v i t y c o e f f e c i e n t s i n a s o l u t i o n
c o n t a i n i n g 10% a l c o h o l
18 x1 = 1 - x2 ;
19 gama1 = P / P1_s ;
20 gama2 = P / P2_s ;
21
22 // U s i n g eq . 8 . 6 9 ( Page no . 3 4 8 )
23 // van Laar c o n s t a n t s :
24 A = log ( gama1 ) *(1 + ( x2 * log ( gama2 ) ) /( x1 * log ( gama1 ) )
) ^2;
25 B = log ( gama2 ) *(1 + ( x1 * log ( gama1 ) ) /( x2 * log ( gama2 ) )
) ^2;
26
27 // For s o l u t i o n c o n t a i n i n g 10% a l c o h o l
28 x2 = 0.1;
29 x1 = 1 - x2 ;
30 ln_g1 = ( A * x2 ^2) /((( A / B ) * x1 + x2 ) ^2) ;
31 ln_g2 = ( B * x1 ^2) /(( x1 +( B / A ) * x2 ) ^2) ;
32 gama1 = %e ^ ln_g1 ;
33 gama2 = %e ^ ln_g2 ;
34
35 mprintf ( A c t i v i t y c o e f f e c i e n t s : ) ;
36 mprintf ( \n For component 1 : %f , gama1 ) ;
37 mprintf ( \n For component 2 : %f , gama2 ) ;
38
39 // end
167
Scilab code Exa 8.13 To calculate equilibrium vapour composition for solution containing 20 mole percent hydrazine
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 8
3 // Phase E q u i l i b r i a
4 // Example 13
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 x2 = 0.585; // mol f r a c t i o n o f h y d r a z i n e
13 P = 101.3; // t o t a l p r e s s u r e o f s y s t e m ( kPa )
14 P2_s = 124.76; // v a p o u r p r e s s u r e o f h y d r a z i n e ( kPa )
15
16 //To c a l c u l a t e e q u i l i b r i u m v a p o u r c o m p o s i t i o n f o r
s o l u t i o n c o n t a i n i n g 20% ( mol ) h y d r a z i n e
17 x1 = 1 - x2 ;
18 P1_s = 1.6* P2_s ; // v a p o u r p r e s s u r e o f w a t e r ( kPa )
19 gama1 = P / P1_s ;
20 gama2 = P / P2_s ;
21
22 // U s i n g eq . 8 . 6 9 ( Page no . 3 4 8 )
23 // van Laar c o n s t a n t s :
24 A = log ( gama1 ) *(1 + ( x2 * log ( gama2 ) ) /( x1 * log ( gama1 ) )
) ^2;
25 B = log ( gama2 ) *(1 + ( x1 * log ( gama1 ) ) /( x2 * log ( gama2 ) )
) ^2;
26
27 // For s o l u t i o n c o n t a i n i n g 20% h y d r a z i n e
28 x2 = 0.2;
29 x1 = 1 - x2 ;
30 ln_g1 = ( A * x2 ^2) /((( A / B ) * x1 + x2 ) ^2) ;
31 ln_g2 = ( B * x1 ^2) /(( x1 +( B / A ) * x2 ) ^2) ;
32 gama1 = %e ^ ln_g1 ;
168
33
34
35
gama2 = %e ^ ln_g2 ;
// U s i n g eq . 8 . 4 7 ( Page no . 3 2 5 ) f o r c o m p o ne n t s 1 and
2 and r e a r r a n g i n g
36 alpha = 1.6; // a l p h a = P 1 s / P 2 s
37 y1 = 1/(1 + ( gama2 * x2 ) /( gama1 * x1 * alpha ) ) ;
38 y2 = 1 - y1 ;
39
40
mprintf ( E q u i l i b r i u m v a p o u r c o m p o s i t i o n f o r s o l u t i o n
c o n t a i n i n g 20 mol p e r c e n t h y d r a z i n e ) ;
41 mprintf ( \n H y d r a z i n e i s %f p e r c e n t , y2 *100) ;
42 mprintf ( \n Water i s %f p e r c e n t , y1 *100) ;
43
44
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
169
clear all ;
clc ;
// Given :
x1 = 0.047; // mol f r a c t i o n o f i s o p r o p a n o l
P1 = 91.11; // v a p o u r p e s s u r e o f p u r e p r o p a n o l ( kPa )
P = 91.2; // t o a t l p r e s s u r e o f s y s t e m ( kPa )
P2 = 47.36; // v a p o u r p r e s s u r e o f w a t e r ( kPa )
// van Laar c o n s a t n t s :
A = 2.470;
B = 1.094;
//To d e t e r m i n e t h e t o t a l p r e s s u r e :
x2 = 1 - x1 ;
// U s i n g eq . 8 . 6 8 ( Page no . 3 4 8 )
ln_g1 = ( A * x2 ^2) /((( A / B ) * x1 + x2 ) ^2) ;
ln_g2 = ( B * x1 ^2) /(( x1 + ( B / A ) * x2 ) ^2) ;
gama1 = %e ^ ln_g1 ;
gama2 = %e ^ ln_g2 ;
// T o t a l p r e s s u r e :
P_tot = ( gama1 * x1 * P1 ) + ( gama2 * x2 * P2 ) ;
if ( P == P_tot )
mprintf ( T h i s i s e q u a l t o t o t a l p r e s s u r e ) ;
170
33
34
else
mprintf ( T h i s i s l e s s t h a n t h e t o t a l p r e s s u r e .
T h i s e r r o r must have b e e n c a u s e d by a i r l e a k
);
35 end
36
37
38 // end
clear all ;
clc ;
// Given :
P1 = 24.62; // v a p o u r p r e s s u r e o f c y c l o h e x a n e ( kPa )
P2 = 24.41; // v a p o u r p r e s s u r e o f b e n z e n e ( kPa )
// A c t i v i t y c o e f f e c i e n t s a r e g i v e n by :
// l n g 1 = 0 . 4 5 8 x2 2 ;
// l n g 2 = 0 . 4 5 8 x1 2 ;
//To c o n s t r u c t t h e Pxy d i a g r a m
x1 = [0 0.2 0.4 0.6 0.8 1.0]
x2 = 1 - x1 ;
for i = 1:6
g1 ( i ) = %e ^(0.458* x2 ( i ) ^2) ; // a c t i v i t y
171
25
26
c o e f f e c i e n t f o r component 1
g2 ( i ) = %e ^(0.458* x1 ( i ) ^2) ; // a c t i v i t y
c o e f f e c i e n t f o r component 2
P ( i ) = ( g1 ( i ) * x1 ( i ) * P1 ) + ( g2 ( i ) * x2 ( i ) * P2 ) ; //
t o t a l p r e s s u r e ( kPa )
y1 ( i ) = ( g1 ( i ) * x1 ( i ) * P1 ) / P ( i ) ;
27
28 end
29 disp ( P ) ;
30 disp ( y1 ) ;
31
32 //To c o n s t r u c t Pxy d i a g r a m
33 clf
34 plot ( x1 , P ) ;
35 plot ( y1 , P ) ;
36 xtitle ( Pxy Diagram , x1 and y1 , P r e s s u r e ) ;
37
38 // end
Scilab code Exa 8.17 To determine the composition and total pressure of
azeotrope
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 8
3 // Phase E q u i l i b r i a
4 // Example 17
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 P = 40.25; // t o t a l p r e s s u r e ( kPa )
13 y1 = 0.566; // mol f r a c t i o n o f b e n z e n e i n v a p o u r
phase
172
14 x1 = 0.384; // mol f r a c t i o n
of benzene in l i q u i d
state
15 P1 = 29.6; // v a p o u r p r e s s u r e o f b e n z e n e ( kPa )
16 P2 = 22.9; // v a p o u r p r e s s u r e o f e t h a n o l ( kPa )
17
18 //To d e t e r m i n e t h e c o m p o s i t i o n and t o t a l p r e s s u r e
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
azeotrope
x2 = 1 - x1 ;
y2 = 1 - y1 ;
// U s i n g eq . 8 . 4 7 ( Page no . 3 2 5 )
// A c t i v i t y c o e f f e c i e n t s :
g1 = ( y1 * P ) /( x1 * P1 ) ;
g2 = ( y2 * P ) /( x2 * P2 ) ;
// U s i n g eq . 8 . 6 9 ( Page no . 3 4 8 )
// van Laar c o n s t a n t s :
A = log ( g1 ) *((1 + ( x2 * log ( g2 ) ) /( x1 * log ( g1 ) ) ) ^2) ;
B = log ( g2 ) *((1 + ( x1 * log ( g1 ) ) /( x2 * log ( g2 ) ) ) ^2) ;
// Assuming a z e o t r o p i c comp . ( f o r h i t and t r i a l
method )
x1 = 0.4;
flag = 1;
while ( flag ==1)
x2 =1 - x1 ;
ln_g1 = ( A * x2 ^2) /((( A / B ) * x1 + x2 ) ^2) ;
ln_g2 = ( B * x1 ^2) /(( x1 + ( B / A ) * x2 ) ^2) ;
g1 = %e ^ ln_g1 ;
g2 = %e ^ ln_g2 ;
P_1 = g1 * P1 ;
P_2 = g2 * P2 ;
if (( P_1 - P_2 ) <=1) and (( P_1 - P_2 ) >= -1)
flag = 0;
else
x1 = x1 +0.1;
end
end
173
of
49
50
mprintf ( A z e o t r o p i c c o m p o s i t o n o f b e n z e n e i s %i
p e r c e n t , x1 *100) ;
51 mprintf ( \n T o t a l p r e s s u r e o f a z e o t r o p e i s %f kPa ,(
P_1 + P_2 ) /2) ;
52
53
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
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
clear all ;
clc ;
// Given :
// W i l s o n c o n s t a n t s :
a12 = 1225.31; // ( J / mol )
a21 = 6051.01; // ( J / mol )
V1 = 74.05*10^ -6; // (m3/ mol )
V2 = 18.07*10^ -6; // (m3/ mol )
R = 8.314; // i d e a l g a s c o n s t a n t
T = 349; // t e m p e r a t u r e i n K
// A n t o i n e E q u a t i o n :
// Vapour p r e s s u r e o f 1 s t e l e m e n t
function [ y1 ] = P1 ( T )
y1 = %e ^(14.39155 -(2795.817/( T -43.198) ) )
endfunction
// Vapour p r e s s u r e o f 2 nd e l e m e n t
function [ y2 ] = P2 ( T )
y2 = %e ^(16.26205 -(3799.887/( T -46.854) ) )
endfunction
//To c a l c u l a t e e q u i l i b r i u m p r e s s u r e and c o m p o s i t i o n
// U s i n g eq . 8 . 7 3 ( Page no . 3 5 0 )
// W i l s o n P a r a m e t e r s :
W12 = ( V2 / V1 ) * %e ^( - a12 /( R * T ) ) ;
W21 = ( V1 / V2 ) * %e ^( - a21 /( R * T ) ) ;
// U s i n g A n t o i n e e q u a t i o n
P1_s = P1 ( T ) ;
P2_s = P2 ( T ) ;
// ( a ) . C o m p o s i t i o n o f v a p o u r i n e q u i l i b r i u m
175
43 x1 = 0.43;
44 x2 = 1 - x1 ;
45
46 // U s i n g eq . 8 . 7 2 ( Page no . 3 5 0 )
47 // W i l s o n e q u a t i o n s :
48 // A c t i v i t y c o e f f e c i e n t o f 1 s t component
49 function [ y3 ] = g_1 ( n1 , n2 ) // n1 i s mol f r a c t i o n
of 1
and n2 i s f o r 2
50
y3 = %e ^( - log ( n1 + W12 * n2 ) + n2 *(( W12 /( n1 + W12 * n2
) ) -( W21 /( W21 * n1 + n2 ) ) ) ) ;
51 endfunction
52
53
54
55
// A c t i v i t y c o e f f e c i n t o f 2 nd component
function [ y4 ] = g_2 ( n1 , n2 )
y4 = %e ^( - log ( n2 + W21 * n1 ) - n1 *(( W12 /( n1 + W12 * n2
) ) -( W21 /( W21 * n1 + n2 ) ) ) ) ;
56 endfunction
57
58
59
60
61
62
63
64
65
66
67
// A c t i v i t y c o e f f e c i e n t s :
g1 = g_1 ( x1 , x2 ) ;
g2 = g_2 ( x1 , x2 ) ;
P = ( g1 * x1 * P1_s ) + ( g2 * x2 * P2_s ) ;
y1 = ( g1 * x1 * P1_s ) / P ;
mprintf ( ( a ) . ) ;
mprintf ( \n E q u i l i b r i u m p r e s s u r e i s %f kPa ,P ) ;
mprintf ( \n C o m p o s i t i o n o f a c e t o n e v a p o u r i n
e q u i l i b r i u m i s %f , y1 ) ;
68
69
70 // ( b ) . C o m p o s i t i o n o f l i q u i d i n e q u i l i b r i u m
71 y1 = 0.8;
72 y2 = 1 - y1 ;
73 g1 = 1; g2 = 1; // assumed a c t i v i t y c o e f f e c i e n t s
74 P_as = 1/(( y1 /( g1 * P1_s ) ) + ( y2 /( g2 * P2_s ) ) ) ;
75
76 // H i t and t r i a l method :
176
77 flag = 1;
78 while ( flag ==1)
79
x1 = ( y1 * P_as ) /( g1 * P1_s ) ;
80
x2 = 1 - x1 ;
81
g1 = g_1 ( x1 , x2 ) ;
82
g2 = g_2 ( x1 , x2 ) ;
83
P_calc = 1/(( y1 /( g1 * P1_s ) ) + ( y2 /( g2 * P2_s ) ) ) ;
84
if (( P_calc - P_as ) <=1) and (( P_calc - P_as ) >= -1)
85
flag = 0;
86
else
87
P_as = P_calc ;
88
end
89 end
90
91 mprintf ( \n\n ( b ) . ) ;
92 mprintf ( \n E q u i l i b r i u m P r e s s u r e i s %f kPa , P_calc ) ;
93 mprintf ( \n C o m p o s i t i o n o f a c e t o n e i n l i q u i d i n
e q u i l i b r i u m i s %f , x1 ) ;
94
95
// end
177
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
T = 337.5; // t e m p e r a t u r e i n K
x1 = 0.842;
// A n t o i n e c o n s t a n t s
// For m e t h a n o l ( 1 )
A1 = 16.12609;
B1 = 3394.286;
C1 = 43.2;
// For m e t h y l e t h y l k e t o n e ( 2 )
A2 = 14.04357;
B2 = 2785.225;
C2 = 57.2;
//To
P1_s
P2_s
x2 =
g1 =
g2 =
d e t e r m i n e p a r a m e t e r s i n Wilson s e q u a t i o n
= %e ^( A1 -( B1 /( T - C1 ) ) ) ;
= %e ^( A2 -( B2 /( T - C2 ) ) ) ;
1 - x1 ;
P / P1_s ;
P / P2_s ;
// U s i n g eq . 8 . 7 2 and r e a r r a n g i n g :
function [ y1 ] = Wils ( n ) // n i s t h e Wilson s
p a r a m e t e r W12
36
y1 = ((( g1 * x2 ) /(1 -( n * x1 /( x1 + n * x2 ) ) +( x1 / x2 ) * log (
g1 *( x1 + n * x2 ) ) ) ) ^( x2 / x1 ) ) *( g1 *( x1 + n * x2 ) ) ;
37 endfunction
38
39 flag = 1;
40 W12 = 0.5; // assumed v a l u e
41 while ( flag ==1)
42
res = Wils ( W12 ) ;
43
if (( res -1) >= -0.09)
44
flag = 0;
45
else
46
W12 = W12 +0.087;
47
end
48
178
49 end
50
51 // For 2 nd W i l s o n p a r a m e t e r :
52 // U s i n g eq . 8 . 7 2 and r e a r r a n g i n g :
53 k = log ( g1 *( x1 + W12 * x2 ) ) / x2 - ( W12 /( x1 + W12 * x2 ) ) ;
54 W21 = ( - k * x2 ) /(1+ k * x1 ) ;
55
56 mprintf ( w i l s o n p a r a m e t e r s a r e : %f , %f , W12 , W21) ;
57
58 // end
Scilab code Exa 8.21 To alculate bubble and dew point and the composition
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
clear all ;
clc ;
// Given :
P = 101.3; // t o t a l p r e s s u r e i n kPa
T = [333 343 353 363]; // t e m p e r a t u r e s (K)
Pa = [81.97 133.29 186.61 266.58]; // P a r t i a l
p r e s s u r e o f component A ( kPa )
Pb = [49.32 73.31 106.63 166.61]; // P a r t i a l p r e s s u r e
o f component B ( kPa )
Pc = [39.32 62.65 93.30 133.29]; // P a r t i a l p r e s s u r e
o f component C ( kPa )
xa = 0.45; // mole f r a c t i o n o f m e t h a n o l
xb = 0.3; // mole f r a c t i o n o f e t h a n o l
179
19 xc = 1 - xa - xb ; // mole f r a c t i o n o f p r o p a n o l
20
21 //To c a l c u l a t e b u b b l e and dew p o i n t and t h e
composition
22
23
24
25
26
27
28
29
30
31
32
// ( a ) . To c a l c u l a t e b u b b l e p o i n t and v a p o u r
composition
clf
plot2d (T , Pa ) ;
plot2d (T , Pb , style =3) ;
plot2d (T , Pc , style =6) ;
xtitle ( , T e m p e r a t u r e , Vapour p r e s s u r e s ) ;
legend ( Pa ,Pb , Pc ) ;
// U s i n g eq . 8 . 8 4 ( Page no . 3 6 2 )
// At b u b b l e t e m p e r a t u r e , sum ( y i ) = sum ( ( x i Pi ) /P) =
1
33 for i = 1:4
34
sum_y ( i ) = ( xa * Pa ( i ) ) / P + ( xb * Pb ( i ) ) / P + ( xc * Pc (
i))/P;
35 end
36
37 Tb = interpln ([ sum_y ; T ] ,1) ; // o b t a i n i n g t e m p e r a t u r e
a t which sum ( y i ) = 1
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// O b t a i n i n g v a p o u r p r e s s u r e s a t b u b b l e t e m p e r a t u r e
Pb1 = interpln ([ T ; Pa ] , Tb ) ;
Pb2 = interpln ([ T ; Pb ] , Tb ) ;
Pb3 = interpln ([ T ; Pc ] , Tb ) ;
// C a l c u l a t i n g e q u i l i b r i u m v a p o u r c o m p o s i t i o n
ya = ( xa * Pb1 *100) / P ;
yb = ( xb * Pb2 *100) / P ;
yc = ( xc * Pb3 *100) / P ;
mprintf ( ( a ) . ) ;
mprintf ( \n The b u b b l e t e m p e r a t u r e i s %f K , Tb ) ;
mprintf ( \n The e q u i l i b r i u m v a p o u r c o n t a i n s %f
180
a t which sum ( x i ) = 1
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// O b t a i n i n g v a p o u r p r e s s u r e s a t dew t e m p e r a t u r e
Pd1 = interpln ([ T ; Pa ] , Td ) ;
Pd2 = interpln ([ T ; Pb ] , Td ) ;
Pd3 = interpln ([ T ; Pc ] , Td ) ;
// C a l c u l a t i n g l i q u i d c o m p o s i t i o n
xa = ( ya * P *100) / Pd1 ;
xb = ( yb * P *100) / Pd2 ;
xc = ( yc * P *100) / Pd3 ;
mprintf ( \n\n ( c ) . ) ;
mprintf ( \n The dew p o i n t i s %f K , Td ) ;
mprintf ( \n At dew p o i n t l i q u i d c o n t a i n s %f methanol
, %f e t h a n o l and %f p r o p a n o l ,xa , xb , xc ) ;
// end
181
Scilab code Exa 8.22 To calculate bubble and dew point temperatures
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 8
3 // Phase E q u i l i b r i a
4 // Example 22
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 // A l l Ki v a l u e s a r e o b t a i n e d from F i g . 1 3 . 6 0 f
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
C h e m i c a l E n g i n e e r s Handbook , 5 t h ed .
P = 1447.14; // p r e s s u r e o f t h e s y s t e m ( kPa )
x = [0.25 0.4 0.35]; // c o m p o s i t i o n o f t h e c o m p o n e n t s
T = [355.4 366.5]; // assumed t e m p e r a t u r e s (K)
K1 = [2.00 0.78 0.33]; // v a l u e o f Ki a t 3 5 5 . 4 K
K2 = [2.30 0.90 0.40]; // v a l u e o f Ki a t 3 6 6 . 5 K
//To c a l c u l a t e b u b b l e and dew p o i n t t e m p e r a t u r e s
// ( a ) . The b u b b l e p o i n t t e m p e r a t u r e and c o m p o s i t i o n
o f the vapour
// At b u b b l e p o i n t t e m p e r a t u r e , sum (K x ) = 1
Kx = [0 0];
for i =1:3
Kx (1) = Kx (1) + K1 ( i ) * x ( i ) ;
Kx (2) = Kx (2) + K2 ( i ) * x ( i ) ;
end
Tb = interpln ([ Kx ; T ] ,1) ;
// At Tb K, from F i g . 1 3 . 6 o f C h e m i c a l E n g i n e e r s
Handbook
31 Kb = [2.12 0.85 0.37]
32
33
// C a l c u l a t i o n o f v a p o u r c o m p o s i t i o n
182
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
i s %f K , Tb
);
mprintf ( \n At b u b b l e p o i n t v a p o u r c o n t a i n s %f
p e r c e n t propane , %f p e r c e n t b u t a n e and %f p e r c e n t
p e n t a n e ,y1 , y2 , y3 ) ;
// ( b ) . The dew p o i n t t e m p e r a t u r e and c o m p o s i t i o n o f
the l i q u i d
T = [377.6 388.8]; // assumed t e m p e r a t u r e s (K)
y = [0.25 0.40 0.35]; // v a p o u r c o m p o s i t i o n a t dew
point
K1 = [2.6 1.1 0.5]; // a t 3 7 7 . 6 K
K2 = [2.9 1.3 0.61]; // a t 3 8 8 . 8 K
// At dew p o i n t , sum ( y i / Ki ) = 1
Ky = [0 0];
for i = 1:3
Ky (1) = Ky (1) + y ( i ) / K1 ( i ) ;
Ky (2) = Ky (2) + y ( i ) / K2 ( i ) ;
end
Td = interpln ([ Ky ; T ] ,1) ;
// At Td K,
Kd = [2.85 1.25 0.59];
// C a l c u l a t i o n o f l i q u i d c o m p o s i t i o n
x1 = y (1) *100/ Kd (1) ;
x2 = y (2) *100/ Kd (2) ;
x3 = y (3) *100/ Kd (3) ;
mprintf ( \n\n ( b ) . ) ;
mprintf ( \n The dew p o i n t t e m p e r a t u r e i s %f K , Td ) ;
mprintf ( \n L i q u i d a t dew p o i n t c o n t a i n s %f p e r c e n t
183
propane , %f p e r c e n t b u t a n e and %f p e r c e n t p e n t a n e
,x1 , x2 , x3 ) ;
67
68
// For t h e g i v e n c o n d i t i o n eq . 8 . 9 1 ( Page no . 3 6 4 ) i s
t o be s a t i s f i e d
73 // sum ( z i /(1+ L / ( VKi ) ) ) = 0 . 4 5
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 mprintf ( \n L i q u i d c o m p o s i t i o n i n e q u i l i b r i u m i s %f
p e r c e n t propane , %f p e r c e n t b u t a n e and %f p e r c e n t
p e n t a n e ,x (1) *100 , x (2) *100 , x (3) *100) ;
102 mprintf ( \n Vapour c o m p o s i t i o n i n e q u i l i b r i u m i s %f
p e r c e n t propane , %f p e r c e n t b u t a n e and %f p e r c e n t
p e n t a n e ,y (1) *100 , y (2) *100 , y (3) *100) ;
103
104
// end
Scilab code Exa 8.23 To test whetherthe given data are thermodynamically consistent or not
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
clear all ;
clc ;
// Given :
P = 101.3; // t o t a l p r e s s u r e ( kPa )
x1 = [0.003 0.449 0.700 0.900];
y1 = [0.432 0.449 0.520 0.719];
P1 = [65.31 63.98 66.64 81.31]; // ( kPa )
P2 = [68.64 68.64 69.31 72.24]; // ( kPa )
//To t e s t w h e t h e r t h e g i v e n d a t a a r e
thermodynamically c o n s i s t e n t or not
19 x2 = 1 - x1 ;
20 y2 = 1 - y1 ;
21 for i = 1:4
185
22
23
24
25
26
27
28
29
30
31
32
33
34
35
g1 ( i ) = ( y1 ( i ) * P ) /( x1 ( i ) * P1 ( i ) ) ;
g2 ( i ) = ( y2 ( i ) * P ) /( x2 ( i ) * P2 ( i ) ) ;
c ( i ) = log ( g1 ( i ) / g2 ( i ) ) ; // k = l n ( g1 / g2 )
end
clf
plot ( x1 , c )
a = get ( c u r r e n t a x e s ) ;
set (a , x l o c a t i o n , o r i g i n ) ;
// As s e e n from t h e g r a p h n e t a r e a i s n o t z e r o
mprintf ( The g i v e n e x p e r i m e n t a l d a t a do n o t s a t i s f y
t h e R e d l i c h K i s t e r n c r i t e r i o n ) ;
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
186
clear all ;
clc ;
// Given :
x1 = [0.0331 0.9652]; // c o m p o s i t i o n o f c h l o r o f o r m
P = [40.84 84.88]; // t o t a l p r e s s u r e f o r s y s t e m ( kPa )
P1 = 82.35; // v a p o u r p r e s s u r e o f c h l o r o f o r m a t 328 K
( kPa )
15 P2 = 37.30; // v a p o u r p r e s s u r e o f a c e t o n e a t 328 K (
kPa )
16
17 //To e s t i m a t e t h e c o n s t a n t s i n M a r g u l e s e q u a t i o n
18 // U s i n g eq . 8 . 1 0 3 and 8 . 1 0 4 ( Page no . 3 7 5 )
19 g1_inf = ( P (1) -(1 - x1 (1) ) * P2 ) /( x1 (1) * P1 ) ;
20 g2_inf = ( P (2) -( x1 (2) * P1 ) ) /((1 - x1 (2) ) * P2 ) ;
21
22 // M a r g u l e s e q u a t i o n :
23 // l n g 1 = x2 2 [A + 2 (BA) x1 ]
24 // l n g 2 = x1 2 [ B + 2 (AB) x2 ]
25 //A = l n g 1 i n f when x1 t e n d s t o 0 , same f o r B
26
27 A = log ( g1_inf ) ;
28 B = log ( g2_inf ) ;
29
30 mprintf ( M a r g u l e s c o n s t a n t s a r e : ) ;
187
31
32
33
34
mprintf ( \n A = %f ,A ) ;
mprintf ( \n B = %f ,B ) ;
// end
Scilab code Exa 8.26 To calculate the partial pressure of water in vapour
phase
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 8
3 // Phase E q u i l i b r i a
4 // Example 26
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 // At 333 K
13 x1 = [0 0.033 0.117 0.318 0.554 0.736 1.000]; //
l i q u i d composition of acetone
14 pp1 = [0 25.33 59.05 78.37 89.58 94.77 114.63]; //
p a r t i a l p r e s s u r e o f a c e t o n e ( kPa )
15 Pw = 19.91; // v a p o u r p r e s s u r e o f w a t e r a t 333 K ( kPa
)
16
17
18
19
20
21
22
//To c a l c u l a t e t h e p a r t i a l p r e s s u r e o f w a t e r i n
vapour phase
// U s i n g eq . 8 . 1 0 0 ( Page no . 3 7 2 ) [ GibbsDuhem
E q u a t i o n ] and r e a r r a n g i n g
// dp2 / p2 = x1 /(1 x1 ) i n t g ( dp1 / p1 )
188
23
24
25
26
27
28
29
30
31
32
33
mprintf ( The r e s u l t s a r e : ) ;
mprintf ( \n A c e t o n e c o m p o s i t i o n
p r e s s u r e o f water );
38 for i = 1:7
39
mprintf ( \n
%f
x1 ( i ) , pp2 ( i ) ) ;
40 end
41
42
Partial
%f ,
// end
189
10
11
12
13
14
15
// Given :
P = 93.30; // t o t a l p r e s s u r e i n kPa
T1 = 353; // (K)
T2 = 373; // (K)
Pa1 = 47.98; // Vapour p r e s s u r e o f w a t e r
kPa )
16 Pb1 = 2.67; // Vapour p r e s s u r e o f l i q u i d
kPa )
17 Pa2 = 101.3; // Vapour p r e s s u r e o f w a t e r
kPa )
18 Pb2 = 5.33; // Vapour p r e s s u r e o f l i q u i d
kPa )
a t 353 K (
a t 353 K (
a t 373 K (
a t 373 K (
19
20 //To c a l c u l a t e u n d e r t h r e e p h a s e e q u i l i b r i u m :
21 // ( a ) . The e q u i l i b r i u m t e m p e r a t u r e
22 P1 = Pa1 + Pb1 ; // sum o f v a p o u r p r e s s u r e s a t 353 K
23 P2 = Pa2 + Pb2 ; // a t 373 K
24
25 // S i n c e v a p o u r p r e s s u r e v a r y l i n e a r l y w i t h
t e m p e r a t u r e , s o T a t which P = 9 3 . 3 0 kPa
26 T = T1 + (( T2 - T1 ) /( P2 - P1 ) ) *( P - P1 ) ;
27 mprintf ( ( a ) . The e q u i l i b r i u m t e m p e r a t u r e i s %f K ,T
);
28
29 // ( b ) . The c o m p o s i t i o n o f r e s u l t i n g v a p o u r
30 // At e q u i l i b r i u m temp :
31 Pa = 88.5; // v a p o u r p r e s s u r e o f w a t e r ( kPa )
32 Pb = 4.80; // v a p o u r p r e s s u r e o f l i q u i d ( kPa )
33
34 // At 3 p h a s e e q u i l i b r i u m , r a t i o o f mol f r a c t i o n s
of
c o m p o n e n ts i s same a s t h e r a t i o o f v a p o u r
pressures
35 P = Pa + Pb ; // sum o f v a p o u r p r e s s u r e s
36 y = Pa / P ; // mole f r a c t i o n o f w a t e r
37 mprintf ( \n The v a p o u r c o n t a i n s %f mol p e r c e n t w a t e r
v a p o u r ,y *100) ;
38
190
39
// end
Tb
Pb
)
= [12.40 19.86 31.06 37.99 47.32 70.11 101.3]; //
v a p o u r p r e s s u r e f o r b e n z e n e ( kPa )
= [35.85 51.85 72.91 85.31 100.50 135.42 179.14];
// v a p o u r p r e s s u r e f o r w a t e r ( kPa )
= 353.1; // b o i l i n g t e m p e r a t u r e (K)
= 101.3; // b o i l i n g p r e s s u r e ( kPa )
//To p r e p a r e t e m p e r a t u r e c o m p o s i t i o n d i a g r a m
//To f i n d t h r e e p h a s e t e m p e r a t u r e
clf
for i =1:7
P ( i ) = P1 ( i ) + P2 ( i ) ;
end
plot (P , T ) ;
// From graph , a t P = 1 0 1 . 3 kPa . .
T_ = 340; // t h r e e p h a s e t e m p e r a t u r e
191
29 // At t h r e e p h a s e t e m p e r a t u r e
30 P1_ = 71.18; // ( kPa )
31 P2_ = 30.12; // ( kPa )
32 xb_ = P1_ / Pb ; // mol f r a c t i o n o f b e n z e n e a t
triple
point
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// For t h e dew p o i n t c u r v e
// For c u r v e BE i n temp r a n g e from 342 t o 373 K
for i = 3:7
y1 ( i ) = 1 -( P2 ( i ) / Pb ) ;
end
clf
xset ( window ,1) ;
T1 (1) = 342; y1_ (1) = 0.7;
for i = 2:6
T1 ( i ) = T ( i +1) ;
y1_ ( i ) = y1 ( i +1) ;
end
plot ( y1_ , T1 ) ;
Temperature );
62
63
// end
192
193
Chapter 9
Chemical Reaction Equilibria
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
195
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
14
15
// end
196
11
12
13
14
15
// Given :
// The g i v e n e x a m p l e i s t h e o r e t i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
// end
o f r e a c t a n t ( J / mol )
Go_pdt = 51310; // s t a n d a r d f r e e e n e r g y o f f o r m a t i o n
o f p r o d u c t ( J / mol )
R = 8.314; // i d e a l g a s c o n s t a n t
T = 298; // t e m p e r a t u r e (K)
// R e a c t i o n : N2O4 ( g ) > 2NO2( g )
14
15
16
17
18 //To c a l c u l a t e e q u i l i b r i u m c o n s t a n t
19 // U s i n g eq . 9 . 5 0 ( Page no . 4 1 3 )
20 Go = 2* Go_pdt - Go_reac ;
21
22 // U s i n g eq . 9 . 3 1 ( Page no . 4 0 6 )
23 K = %e ^( - Go /( R * T ) ) ;
24 mprintf ( The e q u i l b r i u m c o n s t a n t %f ,K ) ;
197
25
26
// end
clear all ;
clc ;
// Given :
T1 = 298; // t e m p e r a t u r e i n K
Hf = -46100; // s t a n d a r d h e a t o f f o r m a t i o n ( J / mol )
Go = -16500; // s t a n d a r d f r e e e n e r g y c h a n g e ( J / mol )
R = 8.314; // i d e a l g a s c o n s t a n t
T = 500;
// R e a c t i o n : N2 ( g ) + 3H2 ( g ) > 2NH3( g )
//To c a l c u l a t e t h e e q u i l i b r i u m c o n s t a n t a t 500 K
// U s i n g eq . 9 . 5 0 ( Page no . 4 1 3 )
del_Go = 2* Go ;
// U s i n g eq . 9 . 3 1 ( Page no . 4 0 6 )
K1 = %e ^( - del_Go /( R * T1 ) ) ; // e q u i l i b r i u m c o n s t a t 298
K
25 Ho = 2* Hf ; // s t a n d a r d h e a t o f r e a c t i o n
26
27 // U s i n g eq . 9 . 3 7 ( Page no . 4 1 1 )
28 K = K1 *( %e ^(( - Ho / R ) *(1/ T - 1/ T1 ) ) ) ;
29 mprintf ( The e q u i l i b r i u m c o n s t a n t a t 500 K i s %f ,K )
198
;
30
31
// end
Scilab code Exa 9.8 To alculate standard free energy change and heat of
formation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
clear all ;
clc ;
// Given :
R = 8.314; // i d e a l g a s c o n s t a n t
T2 = 317; // t e m p e r a t u r e i n K
T1 = 391; // (K)
x2 = 0.31; // mol f r a c t i o n o f nb u t a n e a t 317 K
x1 = 0.43; // mol f r a c t i o n o f i s o b u t a n e a t 391 K
//To
of
19 // At
20 K2 =
21 K1 =
c a l c u l a t e s t a n d a r d f r e e e n e r g y c h a n g e and h e a t
reaction
317 K
(1 - x2 ) / x2 ; // e q u i l i b r i u m c o n s t a n t a t 317 K
(1 - x1 ) / x1 ; // e q u i l i b r i u m c o n s t a n t a t 391 K
22
23 // U s i n g eq . 9 . 3 1 ( Page no . 4 0 6 )
24 // S t a n d a r d f r e e e n e r g y c h a n g e
25 G2 = -R * T2 * log ( K2 ) ; // a t 317 K ( J / mol )
26 G1 = -R * T1 * log ( K1 ) ; // a t 391 K ( J / mol )
27
199
28 // U s i n g eq . 9 . 3 7 ( Page no . 4 1 1 )
29 Ho = - log ( K2 / K1 ) * R /(1/ T2 - 1/ T1 ) ;
30
31 mprintf ( S t a n d a r d f r e e e n e r g y c h a n g e o f t h e r e a c t i o n
);
32 mprintf ( \n At 317 K i s %f J / mol , G2 ) ;
33 mprintf ( \n At 391 K i s %f J / mol , G1 ) ;
34 mprintf ( \n A v e r a g e v a l u e o f h e a t o f r e a c t i o n i s %f
J / mol , Ho ) ;
35
36
// end
Scilab code Exa 9.9 To estimate free energy change and equilibrium constant at 700 K
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
clear all ;
clc ;
// Given :
// R e a c t i o n : N2 ( g ) + 3H2 ( g ) > 2NH3( g )
To = 298; // t e m p e r a t u r e i n K
T = 700; // (K)
R = 8.314; // i d e a l g a s c o n s t a n t
Hf = -46100; // s t a n d a r d h e a t o f f o r m a t i o n ( J / mol )
Gf = -16500; // s t a n d a r d f r e e e n e r g y o f f o r m t i o n o f
ammonia ( J / mol )
// S p e c i f i c h e a t d a t a
200
20
21
22
23
24
//Cp = 2 7 . 2 7 + 4.9310 3T ( f o r N2 )
//Cp = 2 7 . 0 1 + 3.5110 3T ( f o r H2 )
//Cp = 2 9 . 7 5 + 2 5 . 1 1 1 0 3T ( f o r NH3)
//To e s t i m a t e f r e e e n e r g y c h a n g e and e q u i l i r i u m
c o n s t a n t a t 700 K
Ho = 2* Hf ;
Go = 2* Gf ;
alpha = 2*29.75 - 27.27 - 3*27.01;
betta = (2*25.11 - 4.93 - 3*3.51) *10^ -3;
25
26
27
28
29
30 // U s i n g eq . 9 . 4 6 ( Page no . 4 1 2 )
31 del_H = Ho - alpha * To - ( betta /2) * To ^2;
32 // U s i n g eq . 9 . 4 8 ( Page no . 4 1 3 )
33 A = -( Go - del_H + alpha * To * log ( To ) + ( betta /2) * To
^2) /( R * To ) ;
34
35 // U s i n g eq . 9 . 4 7 and 9 . 4 8 ( Page no . 4 1 2 )
36 K = %e ^(( - del_H /( R * T ) ) + ( alpha / R ) * log ( T ) + ( betta
/(2* R ) ) * T + A ) ;
alpha * T * log ( T ) -( betta /2) * T ^2 - A * R * T ;
37 G = del_H 38
39 mprintf ( At
40 mprintf ( \n
41 mprintf ( \n
700 K ) ;
E q u i l i b r i u m c o n s t a n t i s %3 . 2 e ,K ) ;
S t a n d a r d f r e e e n e r g y c h a n g e i s %f J / mol
,G ) ;
42
43
// end
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
clear all ;
clc ;
// Given :
// R e a c t i o n : CO( g ) + 2H2 ( g ) > CH3OH( g )
T = 600; // t e m p e r a t u r e i n K
R = 8.314; // i d e a l g a s c o n s t a n t
// Gibbs f r e e e n e r g y
Gc = -203.81; // f o r
Gh = -136.39; // f o r
Gm = -249.83; // f o r
a t 600 K ( J / mol K)
CO
hydrogen
methanol
// H e a t s o f f o r m a t i o n a t 298 K ( J / mol )
Hc = -110500; // f o r CO
Hm = -200700; // f o r m e t h a n o l
//To c a l c u l a t e e q u i l i b r i u m c o n s t a n t a t 600 K
Go = T *(( Gm - Gc -(2* Gh ) ) + (1/ T ) *( Hm - Hc ) ) ;
// U s i n g eq . 9 . 3 1 ( Page no . 4 0 6 )
K = %e ^( - Go /( R * T ) ) ;
mprintf ( E q u i l i b r i u m c o n s t a n t i s %4 . 3 e ,K ) ;
// end
202
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
clear all ;
clc ;
// Given :
// R e a c t i o n : N2 ( g ) + 3H2 ( g ) > 2NH3( g )
T = 500; // t e m p e r a t u r e i n K
R = 8.314; // i d e a l g a s c o n s t a n t
// F r e e e n e r g y a t 500 K ( J / mol K)
Fn = -177.5; // f o r n i t r o g e n
Fh = -116.9; // f o r h y d r o g e n
Fa = -176.9; // f o r ammonia
// The f u n c t i o n ( Ho a t 298 K Ho a t 0 K) [ J / mol ]
Hn = 8669; // f o r n i t r o g e n
Hh = 8468; // f o r h y d r o g e n
Ha = 9920; // f o r m e t h a n o l
// F r e e e n e r g y o f f o r m a t i o n a t 298 K ( J / mol )
Hf = -46100;
//To c a l c u l a t e e q u i l i b r i u m c o n s t a n t a t 500 K
// U s i n g eq . 9 . 5 3 ( Page no . 4 1 4 )
sum_F = (2* Fa - Fn - 3* Fh ) - (2* Ha - Hn - 3* Hh ) / T ;
// ( J / mol K)
32 // U s i n g eq . 9 . 5 7 ( Page no . 4 1 5 )
33 Go = T *( sum_F + 2* Hf / T ) ;
34 K = %e ^( - Go /( R * T ) ) ;
35
36
37
38
mprintf ( E q u i l i b r i u m c o n s t a n t i s %f ,K ) ;
// end
203
clear all ;
clc ;
// Given :
//M p o l y m e r i s e s t o Mn, n>1
P1 = 1; // p r e s s u r e ( b a r )
P2 = 2; // ( b a r )
x1 = 0.15; // mol f r a c t i o n o f p o l y m e r a t 1 b a r
x2 = 0.367; // mol f r a c t i o n o f p o l y m e r a t 2 b a r
//To f i n d t h e v a l u e o f n
// ( a )
// The g i v e n s u b p a r t i s t h e o r e i c a l and d o e s n o t
i n v o l v e any n u m e r i c a l c o m p u t a t i o n
22
23
24
25
26
// ( b )
//K1 = x1 /(1 x1 ) n = KP1n1
//K2 = x2 /(1 x2 ) n = KP2n1
// D i v i d i n g t h e a b o v e e q u a t i o n s and t a k i n g l o g on
both s i d e s
27 // ( n1) l o g 2 = l o g ( x2 / x1 )+n l o g (1 x1/1x2 )
28
29 n = round (( log ( x2 / x1 ) + log (2) ) /( log (2) - log ((1 - x1 ) /(1 -
x2 ) ) ) ) ;
30 mprintf ( The v a l u e o f n i s %i ,n ) ;
31
32
// end
204
reactant mixture
// L e t e be t h e e x t e n t o f r e a c t i o n
// U s i n g eq . 9 . 3 ( Page no . 4 0 0 )
// mol f r a c t i o n o f n i t r o g e n i s (1 e ) /(4 2 e )
// mol f r a c t i o n o f h y d r o g e n i s (3 3 e ) /(4 2 e )
// mol f r a c t i o n o f ammonia i s 2 e /(4 2 e )
// so , ( [ 2 e /(4 2 e ) ] 2 ) /[(1 e ) /(4 2 e ) ] [ 3 ( 1 e ) /(4 2 e )
] 3 = KP2
25
26 // ( a )
27 P = 20; // ( b a r )
28 // e (4 2 e ) /(1 e ) 2 = 0 . 7 3 4 8 5
29 e = poly (0 , e ) ;
30 f = 2.73845* e ^2 - 5.4697* e + 0.73485;
205
31 x = roots ( f ) ;
32 mprintf ( ( a ) P e r c e n t a g e c o n v e r s i o n
i s %f p e r c e n t ,x
(2) *100) ;
33
34
35
36
37
38
39
40
41
42
43
// ( b )
P = 200; // ( b a r )
// e (4 2 e ) /(1 e ) 2 = 7 . 3 4 8 5
e = poly (0 , e ) ;
f = 9.3485* e ^2 - 18.697* e + 7.3485;
x = roots ( f ) ;
mprintf ( \n\n ( b ) P e r c e n t a g e c o n v e r s i o n i s %f
p e r c e n t ,x (2) *100) ;
// end
206
18 //CO2 : e /2
19 //H2 : e /2
20
21 //To c a l c u l a t e f r a c t i o n a l d i s s o c i a t i o n o f steam
22
23 // ( a ) .
24 // ( e / 2 ) ( e / 2 ) /[(1 e ) / 2 ] [ ( 1 e ) / 2 ] = K
25 // S o l v i n g we g e t :
26 e = 1/2;
27 mprintf ( ( a ) F r a c t i o n a l d i s s o c i a t i o n o f steam i s %i
p e r c e n t ,e *100) ;
28
29
// ( b ) . I f r e a c t a n t s t r e a m i s d i l u t e d w i t h 2 mol
nitrogen
// Mole f r a c t i o n o f c o m p o n e n t s
//CO: (1 e ) /4
// H20 : (1 e ) /4
//CO2 : e /4
//H2 : e /4
30
31
32
33
34
35
36 // so , K = ( e / 4 ) ( e / 4 ) /[(1 e ) / 4 ] [ ( 1 e ) / 4 ]
37 //On s o l v i n g we g e t
38 e = 1/2;
39 mprintf ( \n\n ( b ) A f t e r d i l u t i o n f r a c t i o n a l
d i s t i l l a t i o n o f steam i s %i p e r c e n t ,e *100) ;
40
41
// end
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 // R e a c t i o n : N2 + 3H2 > 2NH3
13 K = 2*10^ -4; // e q u i l i b r i u m c o n s t a n t o f r e a c t i o n
14 P = 20; // p r e s s u r e i n b a r
15
16 //To d e t e r m i n e c o n v e r s i o n o f n i t r o g e n a f f e c t e d by
argon
17
18
19
20
21
22
23
// Mole f r a c t i o n o f c o m p o n e n t s
// N i t r o g e n : (1 e ) /(6 2 e )
// Hydrogen : 3(1 e ) /(6 2 e )
// Ammonia : 2 e /(6 2 e )
of argon
i s %f p e r c e n t ,x (2) *100) ;
30 mprintf ( \n w h i l e i n a b s e n c e o f a r g o n i s 1 4 . 4 8
p e r c e n t ) ; // From e x a m p l e 9 . 1 3
31
32
// end
208
stream
18 // L e t e be t h e e x t e n t o f r e a c t i o n
19
20
// ( a ) . CO s u p p l i e d i s 100% i n e x c e s s o f t h e
stoichiometric requirement
// Mole f r a c t i o n o f c o m p o n e n t s :
//CO: (2 e ) /3
// H20 : (1 e ) /3
//CO2 : e /3
//H2 : e /3
21
22
23
24
25
26
27 // e 2/{(1 e ) (2 e ) ] = K = 1 , s o
28 // 3 e 2 = 0 ;
29 e = 2/3;
30 mprintf ( ( a ) . The c o n v e r s i o n o f steam i s %f p e r c e n t
,e *100) ;
31
32
// ( b ) . CO s u p p l i e d i s o n l y 50% o f t h e t h e o r e t i c a l
requirement
33 // Mole f r a c t i o n o f c o m p o n e n t s
34 //CO: (0.5 e ) / 1 . 5
209
35 // H20 : (1 e ) / 1 . 5
36 //CO2 : e / 1 . 5
37 //H2 : e / 1 . 5
38
39 // e 2 / [ ( 0 . 5 e ) (1 e ) ] = K = 1
40 // 1 . 5 e 0.5 = 1
41 e = 0.5/1.5;
42 mprintf ( \n\n ( b ) . P e r c e n t a g e c o n v e r s i o n
o f steam i s
%f p e r c e n t ,e *100) ;
43
44
// end
initially
14 K = 1; // e q u i l i b r i u m c o n s t a n t o f r e a c t i o n
15
16
17
18
19
20
//To c a l c u l a t e t h e f r a c t i o n a l
d i s t i l l a t i o n o f steam
// Mole f r a c t i o n o f c o m p o n e n t s a t e q u i l i b r i u m
//CO: (1 e ) /3
//H2O : (1 e ) /3
210
21 //CO2 : (1+ e ) /3
22 //H2 : e /3
23
24 // [ e (1+ e ) ] / [ ( 1 e ) 2 ] = K = 1
25 // 3 e 1 = 0
26 e = 1/3;
27 mprintf ( P e r c e n t a g e c o n v e r s i o n
o f steam i s %f
p e r c e n t ,e *100) ;
28
29
// end
clear all ;
clc ;
// Given :
// R e a c t i o n : CO( g ) + 2H2 ( g ) > CH3OH( g )
Kf = 4.9*10^ -5;
Kfi = 0.35;
P = 300; // p r e s s u r e i n b a r
//To e v a l u a t e t h e p e r c e n t c o n v e r s i o n o f CO
// B a s i s : 100 m o l e s o f i n i t i a l g a s m i x t u r e
n_CO = 25;
n_H2 = 55;
n_inert = 20;
v = -1 -2+1; // c h a n g e i n number o f m o l e s i n r e a c t i o n
211
23
24 // Mole f r a c t i o n s i n t h e e q u i l i b r i u m m i x t u r e
25 //CO = (25 e ) /(100 2 e )
26 //H2 = (55 2 e ) /(100 2 e )
27 //CH3OH = e /(100 2 e )
28
29 Ky = ( Kf / Kfi ) * P ^( - v ) ;
30 // [ e /(100 2 e ) ] / [ ( 2 5 e ) /(100 2 e ) ] [ ( 5 5 2 e ) /(100 2 e ) ] 2
= Ky , s o
31
32 e = poly (0 , e ) ;
33 f = (4+4* Ky ) * e ^3 - (400+320* Ky ) * e ^2 + (10000+8525* Ky
) * e - 75625* Ky
34 x = roots ( f ) ;
35
36
37
38
39
Scilab code Exa 9.19 To determine the composition of gases leaving the
reactor
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 9
3 // C h e m i c a l R e a c t i o n E q u i l i b r i a
4 // Example 19
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
212
reaction
16
17 // I n i t i a l c o m p o s i t i o n o f g a s m i x t u r e
18 n_h = 60;
19 n_n = 20;
20 n_inert = 100 - n_h - n_n ;
21
22 //To d e t e r m i n e t h e c o m p o s i t i o n o f g a s e s
l e a v i n g the
reactor
// Mole f r a c t i o n s i n t h e e q u i l i b r i u m m i x t u r e
//N2 : [20 ( e / 2 ) ] / ( 1 0 0 e )
//H2 : [6 0 ( 3 e / 2 ) ] / ( 1 0 0 e )
//NH3 : e /(100 e )
23
24
25
26
27
28 Ky = Kp *( P ^ - v ) ;
29 // e /(100 e ) / [ ( 2 0 ( e / 2 ) ] 1 / 2 [ { 6 0 ( 3 e / 2 ) }/(100 e ) ] 3 / 2
= Ky
30
31 e = poly (0 , e ) ;
32 f = (1.6875* Ky ^2 -1) * e ^4 - (270* Ky ^2+200) * e ^3 +
// x ( 4 ) b e i n g t h e o n l y p o s i t i v e r o o t i s t h e
percentage conversion
// Mole f r a c t i o n s i n e q u i l i b r i u m m i x t u r e
x_n = (20 -( e /2) ) /(100 - e ) ;
x_h = (60 -3*( e /2) ) /(100 - e ) ;
x_a = e /(100 - e ) ;
x_inert = 1 - x_n - x_h - x_a ;
mprintf ( C o m p o s i t i o n o f g a s l e a v i n g t h e r e a c t o r i s )
213
44
45
46
47
48
49
;
mprintf ( \n
mprintf ( \n
mprintf ( \n
mprintf ( \n
Nitrogen
Hydrogen
Ammonia
I n e r t gas
:
:
:
:
%f
%f
%f
%f
percent
percent
percent
percent
, x_n *100) ;
, x_h *100) ;
, x_a *100) ;
, x_inert *100) ;
// end
clear all ;
clc ;
// Given :
// R e a c t i o n : C2H4 ( g ) + H2O( l ) > C2H5OH( aq )
P = 85; // p r e s s u r e i n b a r
n_e = 0.015; // mol p e r c e n t o f e t h a n o l
n_w = 0.95; // mole p e r c e n t o f w a t e r
n_a = 0.48; // mol p e r c e n t o f e t h y l e n e i n v a p o u r
phase
17 M = 18; // m o l e c u l a r mass o f w a t e r
18 fc = 0.9; // f u g a c i t y c o e f f e c i e n t f o r e t h y l e n e
19
20 //To e v a l u a t e t h e e q u i l i b r i u m c o n s t a n t
21 //K = a c / ( a a a b )
22
23 m_e = n_e /( n_w * M *10^ -3) ; // mol / kg w a t e r
24 a_c = m_e ;
214
25 fa = fc * n_a * P ; // b a r
26 a_a = fa ;
27
28 // S i n c e mol f r a c t i o n o f w a t e r
i s c l o s e to unity , so
f u g a c i t y c o e f f e c i e n t o f w a t e r i s assumed t o be 1
29 a_b = n_w ;
30 K = a_c /( a_a * a_b ) ;
31 mprintf ( The e q u i l i b r i u m c o n s t a n t i s %5 . 4 e ( mol C2H4
) / ( kg w a t e r b a r ) ,K ) ;
32
33
// end
Scilab code Exa 9.21 To calculate the decomposition pressure and temperature at 1 bar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
clear all ;
clc ;
// Given :
// R e a c t i o n : CaCO3 ( s ) > CaO( s ) + CO2( g )
T = 1000; // t e m p e r a t u r e o f r e a c t i o n i n K
P = 1; // p r e s s u r e i n b a r
R = 8.314; // i d e a l g a s c o n s t a n t
// F u n c t i o n f o r s t a n d a r d f r e e e n e r g y o f t h e r e a c t i o n
function [ y ] = G ( T )
y = 1.8856*10^5 - 243.42* T + 11.8478* T * log ( T ) 3.1045*10^ -3* T ^2 + 1.7271*10^ -6* T ^3 215
(4.1784*10^5) / T
20 endfunction
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
//To c a l c u l a t e t h e d e c o m p o s i t i o n p r e s s u r e and
temperaure at 1 bar
Go = G ( T ) ;
K = %e ^( - Go /( R * T ) ) ;
// U s i n g eq . 9 . 7 5 ( Page no . 4 3 2 )
p_CO2 = K ; // d e c o m p o s i t i o n p r e s s u r e
mprintf ( D e c o m p o s i t i o n p r e s s u r e o f l i m e s t o n e a t 1 0 0 0
K s %f b a r , p_CO2 ) ;
// At p r e s s u r e = 1 b a r
K = 1;
Go = 0; // s i n c e K = 1
T = 1160; // assumed t e m p e r a t u r e (K)
flag = 1;
while ( flag ==1)
res = round ( G ( T ) ) ;
if ( res <=0)
flag = 0;
else
T = T +1;
end
end
mprintf ( \ n D e c o m p o s i t i o n t e m p e r a t u r e a t 1 b a r i s %i
K ,T ) ;
// end
Scilab code Exa 9.22 To evaluate wt of iron produced per 100 cubic m of
gas admitted
216
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
clear all ;
clc ;
// Given :
// R e a c t i o n : FeO ( s ) + CO( g ) > Fe ( s ) + CO2( g )
K = 0.403; // e q u i l i b r i u m c o n s t a n t o f r e a c t i o n
T = 1200; // t e m p e r a t u r e o f r e a c t i o n (K)
To = 273; // s t a n d a r d t e m p e r a t u r e (K)
Vo = 22.4*10^ -3; // m o l a r volume a t STP
M = 55.8; // m o l e c u l a r mass o f i r o n
//To c a l c u l a t e wt o f i r o n p r o d u c e d p e r 100 m3 o f
gas admitted
// B a s i s : 100 mol o f g a s e n t e r i n g
n = 100; // m o l e s o f g a s e n t e r i n g
n_C = 20; // m o l e s o f c a r b o n mono o x i d e
n_N = 80; // m o l e s o f n i t r o g e n
20
21
22
23
24
25 // L e t e be t h e e x t e n t o f r e a c t i o n
26 // Mole f r a c t i o n s i n e q u i l i b r i u m m i x t u r e
27 //CO = (20 e ) / 1 0 0
28 //CO2 = e / 1 0 0
29 // e /(20 e ) = K
30 e = (20* K ) /(1+ K ) ;
31 n_CO2 = e ; // m o l e s o f CO2 a t e q u i l i b r i u m
32 n_Fe = n_CO2 ; // by s t o i c h i o m e t r y
33 V = ( n * Vo * T ) / To ; // volume o f 100 mol o f g a s a t 1 2 0 0
K and 1 b a r
34
35 // L e t m be i r o n p r o d u c e d p e r 100 m3 g a s
36 m = ( n_Fe *100* M ) / V ;
217
37
38
39
mprintf ( I r o n p r o d u c e d p e r 100 c u b i c m o f g a s i s %f
kg ,m /1000) ;
// end
Scilab code Exa 9.23 To calculate the composition at equilibrium assuming ideal behaviour
1 //A Textbook o f C h e m i c a l E n g i n e e r i n g Thermodynamics
2 // C h a p t e r 9
3 // C h e m i c a l R e a c t i o n E q u i l i b r i a
4 // Example 23
5
6
7 clear all ;
8 clc ;
9
10
11 // Given :
12 P = 1; // p r e s s u r e i n b a r
13 K1 = 0.574; // e q u i l i b r i u m c o n s t a n t f o r eq . 9 . 8 8 (
Page no . 4 3 7 )
14 K2 = 2.21; // e q u i l i b r i u m c o n s t a n t f o r eq . 9 . 8 9 ( Page
no . 4 3 7 )
15
16
//To c a l c u l a t e t h e c o m p o s i t i o n a t e q u i l i b r i u m
assuming i d e a l behaviour
17 // L e t e 1 and e 2 be t h e e x t e n t o f f i r s t and s e c o n d
reactions
18
19
20
21
22
23
v1 = 1+3 -1 -1;
v2 = 1+1 -1 -1;
Ky1 = K1 * P ^ - v1 ;
Ky2 = K2 * P ^ - v2 ;
218
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
// mole f r a c t i o n s i n e q u i l i b r i u m m i x t u r e a r e :
//CH4 : (1 e 1 ) /(6+2 e 1 )
//H2O : (5 e1e 2 ) /(6+2 e 1 )
//CO: ( e1e 2 ) /(6+2 e 1 )
//H2 : ( 3 e 1+e 2 ) /(6+2 e 1 )
//CO2 : e 2 /(6+2 e 1 )
// For 1 s t r e a c t i o n :
// Ky1 = [ ( e1e 2 ) ( 3 e 1+e 2 ) 3 ] / [ ( 1 e 1 ) (5 e1e 2 ) (6+2 e 1 )
2]
// For 2 nd r e a c t i o n :
// Ky2 = [ e 2 ( 3 e 1+e 2 ) ] / [ ( e1e 2 ) (5 e1e 2 ) ]
// on s o l v i n g , we g e t :
deff ( [ y ] = f 2 ( e ) ,[ f 1 = [ ( e ( 1 )e ( 2 ) ) ( 3 e ( 1 )+e ( 2 )
) 3 ] / [ ( 1 e ( 1 ) ) (5 e ( 1 )e ( 2 ) ) (6+2 e ( 1 ) ) 2] Ky1 ,
f 2 = [ e ( 2 ) ( 3 e ( 1 )+e ( 2 ) ) ] / [ ( e ( 1 )e ( 2 ) ) (5 e ( 1 )e
( 2 ) ) ]Ky2 , y = [ f 1 ; f 2 ] ])
eo = [0.9 0.6]; // i n i t i a l g u e s s e s
[e , fes , m ] = fsolve ( eo , f2 ) ;
// Mole f r a c t i o n o f c o m p o n e n t s :
n_m = (1 - e (1) ) /(6+2* e (1) ) ;
n_w = (5 - e (1) -e (2) ) /(6+2* e (1) ) ;
n_CO = ( e (1) -e (2) ) /(6+2* e (1) ) ;
n_h = (3* e (1) + e (2) ) /(6+2* e (1) ) ;
n_c = e (2) /(6+2* e (1) ) ;
mprintf ( Mole f r a c t i o n o f t h e c o m po n e n t s a r e : ) ;
mprintf ( \n Methane = %f , n_m ) ;
mprintf ( \n Water = %f , n_w ) ;
mprintf ( \n Carbon monoxide = %f , n_CO ) ;
mprintf ( \n Hydrogen = %f , n_h ) ;
mprintf ( \n Carbon d i o x i d e = %f , n_c ) ;
// end
219
written
// a . C + 1/2O2 > CO
// b . C + O2 > CO2
// c . H2 + 1/2O2 > H2O
// d . C + 2H2 > CH4
// E l e m e n t s C and O2 a r e n o t p r e s e n t , s o t h e y a r e t o
be e l i m i n a t e d
23 // Combining a and b
24 // e . CO2 > CO + 1/2O2
25
26
27
28
29
30
// Combining a and d
// f . CH4 + 1/2O2 > CO + 2H2
// Combining c and e
// g . CO2 + H2 > CO + H2O
220
31
32
33
34
35
// Combining c and f
// h . 3H2 + CO > CH4 + H2O
// E q u a t i o n s g and h r e p r e s e n t i n d e p e n d e n t c h e m i c a l
r e a c t i o n s , so
36 r = 2;
37 C = 5; // no . o f c om p o n e n t s
38 pi = 1; // no . o f p h a s e s
39
40 // From eq . 9 . 9 0 ( Page no . 4 3 8 )
41 F = C - pi - r +2;
42 mprintf ( The number o f d e g r e e s o f f r e e d o m a r e %i ,F )
;
43
44
// end
221