Sei sulla pagina 1di 7

Examples for Chemical Engineering

Thermodynamics II Using Matlab

Dr. Ali Khalaf Al-Matar


2006/2007

Chapter 1
Pure Component Properties Using EOS
1.1 Compressibility Factors Using PR-EOS
The gas cylinders distributed by Jordan Petroleum Re nery Company (JPRC) contain
a mixture of propane and n-butane. Assume they contain only n-butane. The volume
of the cylinder is about 30 liters and the net mass of its contents is 15 kg. In winter,
the temperature of the cylinder can be assumed to be 15 C, and the pressure inside the
cylinder is 12 bars.
1. Use the Peng-Robinson equation of state to determine what are the phase(s) inside the
cylinder.
2. Repeat the same calculations as in the rst part if the pressure is reduced to 7 bars.
What are the mass fraction of the liquid and that of the vapor?
The following general solution procedure for the use of EOS in compressibility
calculations is recommended to be followed:
1. Obtain the properties of the component of interest from any reference you deem
useful. I am using the properties package coming with Sandler's book.
Component M W (g/mol) Tc (K) Pc (MPa) ! (-)
.
n-butane
58.124
425.2
3.80 0.199
2. Determine the covolume (b) and energy (a) parameters from the proper EOS. This
time the PR-EOS is used,
RTC
b = 0:07780
;
(1)
PC
= 0:37464 + 1:5422! 0:26992! 2
(2)
(
"
#)2
1=2
T
(T ) =
1+
1
;
(3)
TC
a(T )

0:45724

R2 TC2
(T ):
PC

(4)

3. Determine the reduced covolume (B) and energy (A) parameters. Once the covolume
and the energy parameters are determined, we can make a better utilization of their
values by using their reduced equivalents i.e.,
bP
B =
;
(5)
RT
aP
A =
(6)
(RT )2

Section 1.1

Compressibility Factors Using PR-EOS

4. Find the coef cients in the compressibility cubic according to the proper EOS. For the
PR-EOS the coef cients of this cubic are given as
0 = Z 3 + a2 Z 2 + a1 Z + a0
(7)
a2 = B 1;
(8)
2
a1 = A 3B
2B;
(9)
2
3
a0 =
AB + B + B ;
(10)
5. Solve for the roots of the compressibility cubic. Two approaches exists: numerical
and analytical solutions. The solution for these conditions yields only one real root
Z =0.0472. This is equivalent to one single phase which is a subcooled liquid
phase since the total pressure is higher than the vapor pressure of n-butane at this
temperature.

1.1.1 Numerical Solution to Cubic Equations


Solve for the roots of the PR-EOS using Matlab's roots function. The roots function
is based on solving for the eigenvalues of the companion matrix. One can use the Matlab
built in fzero and solve twice near B and 1. If the two solutions converge to the same
root then a single phase exists, otherwise two phase coexist. In an exam setting one would
use an easy numerical method such as the Newton-Raphson method which is outlined
below.
The Newton-Raphson (NR) nds a re ned estimate of an initial guess to the root using
the simple formula
f (Zi )
Zi+1 = Zi
:
(11)
f 0 (Zi )
The compressibility cubic is easily differentiated to yield
Zi3 + a2 Zi2 + a1 Zi + a0
(12)
Zi+1 = Zi
3Zi2 + 2a2 Zi + a1
1.1.1.1

Numerical solution when one real root exists

The butane problem at 288.15 K and 12 bar is solved for the compressibility using the
following sequence of steps

Chapter 1

Pure Component Properties Using EOS

(8:314)(425:2)
= 7:2446 10 5 ;
3:80 106
= 0:37464 + 1:5422(0:199) 0:26992(0:199)2 = 0:6708;
(
"
#)2
1=2
288:15
(T ) =
1 + 0:6708 1
= 1:2513;
425:2
b

a(T )

A =
a2 =
a1 =
a0 =
0 =

0:07780

(8:314)2 (425:2)2
(1:2513) = 1:8837:
3:80 106
(7:2446 10 5 )(12 105 )
= 0:0363;
(8:314)(288:15)
(1:8837)(12 105 )
= 0:3938;
(8:314)2 (288:15)2
0:0363 1 = 0:9637;
0:3938 3(0:0363)2 2(0:0363) = 0:3173;
0:3938(0:0363) + (0:0363)2 + (0:0363)3 =
3
Z
0:9637Z 2 + 0:3173Z 0:0129:
0:45724

0:0129;

Solution with initial guess Z = B To determine the liquid like root, on starts with an
initial guess Z0 = B and carries out the iterations using NR method.
(0:0363)3 0:9637(0:0363)2 + 0:3173(0:0363) 0:0129
Z1 = 0:0363
= 0:04677
3(0:0363)2 + 2( 0:9637)(0:0363) + 0:3173
(0:04677)3 0:9637(0:04677)2 + 0:3173(0:04677) 0:0129
Z2 = 0:04677
= 0:04716
3(0:04677)2 + 2( 0:9637)(0:04677) + 0:3173
(0:04716)3 0:9637(0:04716)2 + 0:3173(0:04716) 0:0129
Z3 = 0:04716
= 0:04716
3(0:04716)2 + 2( 0:9637)(0:04716) + 0:3173
Iterations are repeated until a convergence criteria is reached. Convergence criteria
may be the absolute or relative tolerance in the compressibility and/or function value.
Solution with initial guess Z = 1 To determine the liquid like root, on starts with an
initial guess Z = B and carries out the iterations using NR method.
(1)3 0:9637(1)2 + 0:3173(1) 0:0129
= 0:7549
3(1)2 + 2( 0:9637)(1) + 0:3173
(0:7549)3 0:9637(0:7549)2 + 0:3173(0:7549) 0:0129
Z2 = 0:7549
= 0:5668
3(0:7549)2 + 2( 0:9637)(0:7549) + 0:3173
Iterations are carried out until the convergence criteria is met. This is achieved after 13
iterations as
(0:04716)3 0:9637(0:04716)2 + 0:3173(0:04716) 0:0129
Z13 = 0:04716
= 0:04716:
3(0:04716)2 + 2( 0:9637)(0:04716) + 0:3173
The same root is arrived at as that with the initial guess Z = B. Consequently, we
have only one phase which is a liquid phase.
Z1

Section 1.1
1.1.1.2

Compressibility Factors Using PR-EOS

Numerical solution when three real roots exist

The butane problem at 288.15 K and 7 bar is solved for the compressibility using the
following sequence of steps
(8:314)(425:2)
= 7:2446 10 5 ;
3:80 106
= 0:37464 + 1:5422(0:199) 0:26992(0:199)2 = 0:6708;
(
"
#)2
1=2
288:15
(T ) =
1 + 0:6708 1
= 1:2513;
425:2
b

a(T )

A =
a2 =
a1 =
a0 =
0 =

0:07780

(8:314)2 (425:2)2
(1:2513) = 1:8837:
3:80 106
(7:2446 10 5 )(7 105 )
= 0:02117;
(8:314)(288:15)
(1:8837)(7 105 )
= 0:22973;
(8:314)2 (288:15)2
0:02117 1 = 0:97883;
0:22973 3(0:02117)2 2(0:02117) = 0:18605;
0:22973(0:02117) + (0:02117)2 + (0:02117)3 =
Z 3 0:97883Z 2 + 0:18605Z 0:0044052:
0:45724

0:0044052;

Solution with initial guess Z = B To determine the liquid-like root, on starts with an
initial guess Z0 = B and carries out the iterations using NR method.
(0:02117)3 0:97883(0:02117)2 + 0:18605(0:02117) 0:0044052
Z1 = 0:02117
= 0:02731
3(0:02117)2 + 2( 0:97883)(0:02117) + 0:18605
(0:02731)3 0:97883(0:02731)2 + 0:18605(0:02731) 0:0044052
Z2 = 0:02731
= 0:02756
3(0:02731)2 + 2( 0:97883)(0:02731) + 0:18605
(0:02756)3 0:97883(0:02756)2 + 0:18605(0:02756) 0:0044052
Z3 = 0:02756
= 0:02756:
3(0:02756)2 + 2( 0:97883)(0:02756) + 0:18605
Solution with initial guess Z = 1 To determine the vapor-like root, on starts with an
initial guess Z = B and carries out the iterations using NR method.
0:97883(1)2 + 0:18605(1) 0:0044052
= 0:8349
3(1)2 + 2( 0:97883)(1) + 0:18605
(0:8349)3 0:97883(0:8349)2 + 0:18605(0:8349) 0:0044052
Z2 = 0:8349
= 0:7562
3(0:8349)2 + 2( 0:97883)(0:8349) + 0:18605
Iterations are carried out until the convergence criteria is met. This is achieved after 6
iterations as
(0:7333)3 0:97883(0:7333)2 + 0:18605(0:7333) 0:0044052
Z6 = 0:7333
= 0:7333:
3(0:7333)2 + 2( 0:97883)(0:7333) + 0:18605
This is a different root and the same as the root arrived at with the initial guess Z = B.
Z1

(1)3

Chapter 1

Pure Component Properties Using EOS

Consequently, we have two coexisting phases: vapor and liquid, .

1.1.2 Analytical Solution to Cubic Equations


Contrary to the numerical solution using Matlab's roots function, one can use analytical
solution to the cubic equation obtained.
1. Write your cubic in the form
Z 3 + bZ 2 + cZ + d = 0
(13)
2. Compute
p

2b3
b2

9bc + 27d
54
3c

(14)

q3

(16)

(15)

3. Calculate the discriminator1


p2
4. Two cases may arise
a. The cubic has only one real root if p2
following sequence of steps
p
r =
p2
Z1

p
jpj

b. The cubic has three real roots if p2


the following sequence of steps
=
Z1
Z2
Z3
1.1.2.1

=
=
=

arccos

q 3 > 0: The root is determined by the


q 3 + jpj

1=3

r +q
r

q3
p
p
q3

(17)

b
:
3

(18)

0: The three roots are determined using


!

p
2 q cos( =3) b=3
p
2 q cos[( + 2 )=3]
p
2 q cos[( + 4 )=3]

(19)

b=3
b=3:

(20)
(21)
(22)

Solution when one real root exists

Solving for the compressibility of butane in the cylinder problem requires the cubic
equation. The coef cients for 288.15 K and 12 bars are available from the PR-EOS as

Discriminator is used loosely since this is not the same as the discriminator for a quadratic equation.

Section 1.1

Compressibility Factors Using PR-EOS

= Z 3 0:9637Z 2 + 0:3173Z 0:0129


2( 0:9637)3 9( 0:9637)(0:3173) + 27( 0:0129)
p =
= 0:01135
54
( 0:9637)2 3(0:3173)
q =
= 0:002571
9
2
3
2
3
p
q = 0:01135
( 0:002571) = 1:289 10 4
The discriminator in this case is positive. Therefore, we have one phase equivalent to one
real root which can be calculated as:
p
p
1=3
1=3
r =
p2 q 3 + jpj
=
1:289 10 4 + j0:01135j
= 0:2832;
0

Z1

1.1.2.2

p
jpj

r2 + q
r

b
=
3

0:01135
j0:01135j

0:28322 + ( 0:002571)
0:2832

( 0:9637)
= 0:04716:
3

Solution when three real roots exist

The sequence of calculations are the same as the case with one single real root. However,
the discriminator is negative in this case which means we need to calculate the three roots
using equations 19-22. Solving for the compressibility of butane in the cylinder problem
requires the cubic equation. The coef cients for 288.15 K and 7 bars are available from
the PR-EOS as
= Z 3 0:97883Z 2 + 0:18605Z 0:0044052
2( 0:97883)3 9( 0:97883)(0:18605) + 27( 0:0044052)
p =
= 0:006585
54
( 0:97883)2 3(0:18605)
q =
= 0:04444
9
p2 q 3 = ( 0:006585)2 (0:04444)3 = 4: 440 3 10 5
The discriminator in this case is negative. Therefore, we have two phases equivalent to
three real roots which can
! be calculated as:
p
0:006585
= arccos p
= arccos p
= 2:3503
3
0:044443
q
p
0:97883
p
Z1 =
2 q cos( =3) b=3 = 2 0:04444 cos(2:3503=3)
= 0:027562
3
p
0:97883
p
Z2 =
2 q cos[( + 2 )=3] b=3 = 2 0:04444 cos((2:3503 + 2 )=3)
= 0:73331
3
p
0:97883
p
Z3 =
2 q cos[( + 4 )=3] b=3 = 2 0:04444 cos((2:3503 + 4 )=3)
= 0:217 95
3
The maximum root Z = 0:73331 is assigned as the vapor compressibility, while the
minimum root Z = 0:027562 is assigned as the liquid compressibility.
0

Potrebbero piacerti anche