Professional Documents
Culture Documents
Deiters-2002 Calculation of Densities Cubic Equations of State
Deiters-2002 Calculation of Densities Cubic Equations of State
State
Ulrich K. Deiters
¨ Germany
Institute of Physical Chemistry, University at Cologne, D-50939 Koln,
Some cubic equations of state can e®entually ha®e unphysical solutions for the molar
®olume. The conditions for this phenomenon are discussed. The computational accu-
racy and computing time requirements of the analytical root finding method (Cardano’s
formula) are in®estigated. A new, faster iterati®e root finder for cubic polynomials is
proposed.
Introduction
In spite of their theoretical shortcomings, cubic equations Cardano’s Formula and Cubic Equations of State
of state are still frequently used in many chemical and engi- Typical cubic equations of state are of the form
neering applications. This is partly due to the fact that these
equations can be transformed into cubic polynomials with re-
spect to the molar volume.
This reducibility to a cubic polynomial is by no means re- ps p rep q p att Ž1.
quired by physical insight, but by mathematical convenience:
the calculation of the density or the molar volume from the
given pressure and temperature, which is one of the most where the repulsion term p rep and the attraction term p att
frequently performed operations in phase equilibrium calcu- are simple rational functions of the molar volume; for the
lations, can be done for these equations by Cardano’s for- former usually Žbut not necessarily . the van der Waals term is
mula. Its application does not require iteration or predeter- used
mined initial values, and if more than one solution is possi-
ble, it yields all of them. It is easy to program, fail-safe, and
fast. RT
Usually the solution with the highest density Žif there is p rep s Ž2.
Vm y b
more than one. is associated with the liquid phase, the one
with the lowest density with the vapor phase, and thus the
road to the calculation of phase equilibria seems clear. It will
be shown, however, that there are pitfalls along this road, It should be noted that modern statistical thermodynamics
and that some cubic equations of state can generate unphysi- does not support this repulsion term. There is, however, a
cal solutions. cubic equation of state for an attractive-hard-sphere fluid,
The admittedly fast execution of the density calculation is which does not use the van der Waals term ŽYelash et al.,
evidently an advantage over noncubic equations, which re- 1999., but it is not considered here.
quire higher-order or iterative root solvers. These require By multiplying a cubic equation of state by the denomina-
typically 2]4 times as much CPU time as Cardano’s formula, tor polynomials, it is turned into a cubic polynomial equation
and it has been argued that this would slow down complex
design programs in chemical engineering to a rather unac-
ceptable degree. 3
One might ask how these design programs could perform Ý siVmi s 0 Ž3.
satisfactorily a few years ago, when the computers were sig- is 0
a3 x 3 q a2 x 2 q a1 x q a0 s 0 with a3 / 0
ai
x 3 q b 2 x 2 q b1 x q b 0 s 0 with bi s
a3
b 22
y 3 s px q qs 0 with ps b1 y
3
b1 b 2 2 b 23
qs b 0 y q
3 27
p 3 q 2
Figure 1. 400 K isotherm of nitrogen, including physi-
ds ž / ž /
3
q
2 cally unreasonable branches, calculated with
the Redlich–Kwong equation of state.
4. If d) 0, there is only one real root
3
q 3
q b2 dano’s formula with a Newton iteration
(
x 0 s y q'd q y y'd y
2 2 3 (
3
q 27
with f sarccos y
ž ( /2
y
p3
Here Vm denotes the ‘‘raw’’ result from Cardano’s formula.
Usually a single iteration step is sufficient.
a Vm y b
Ž .
h Ž Vm . s p Ž Vm y b . s RT y 2 Ž 12.
Vm q c1Vm q c 0
physical validity of the solutions if there is more than one.. is characterized by c 0 s 0 and c1 s b. It has three poles, and
Figures 1 and 2 also show the reason for the appearance of the minimum in domain III is at Vm,e s bŽ1y'2 ., which is a
undesirable roots: cubic equations of state have up to three negative number. The pressure at this minimum is given by
real poles, which divide the range of molar volumes into four
domains Žlabeled I]IV in the diagrams.. The highest pole is RT a
of first order and lies at Vm s b. The ‘‘real’’ domain I is at ps y Ž 15.
Vm ) b. As shown in the diagram, the equation of state can y'2 b Ž 4y3'2 . b 2
have a branch with positive pressure values in domain III,
and this can give rise to undesirable solutions. The contribution of the repulsive part of the equation of state
The generalized cubic equation of state can be written as is negative, and that of the attractive part positive. Since the
repulsive part has a stronger temperature dependence Ž AT .
than the attractive one Ž aA1r'T in the original version.,
RT a increasing the temperature will generally lower the pressure
ps y Ž 11. above which physically unreasonable densities can be gener-
Vm y b Vm2 q c1Vm q c 0 ated. In Figure 1 this pressure is extremely high. One should
Algorithm 2: New algorithms for sol©ing cubic equations 6. Find the roots Žif any. of the quadratic polynomial hŽ x .
analytically.
Given is a polynomial equation with real coefficients a i :
Test runs on a workstation wHewlett-Packard Series
9000rB1000 Žprocessor HP-PA-RISC 8500, 300 MHz.x
showed that Algorithm 2 is indeed faster than Cardano’s for-
a3 x 3 q a2 x 2 q a1 x q a0 s 0 with a3 / 0
mula, as shown by Table 1. Being mostly iterative, the new
algorithm does not suffer from loss of accuracy as does Car-
dano’s. ŽAlgorithm 2 is a general solver for cubic polynomials;
1. Divide by a3 to obtain the normalized form
it does not exclude unphysical solutions. When it is applied
to equations of state, it is necessary to check whether the
ai solutions are physically meaningful..
x 3 q b 2 x 2 q b1 x q b 0 s 0 with bi s
a3
Conclusion
With many cubic equations, the calculation of molar vol-
2. Determine an interval containing all real roots: umes for fixed pressure and temperature can produce physi-
cally unreasonable values, with Vm - b. Generally, one has to
be on guard against such unwanted solutions when working
y r F x k Fq r with r s1qmax Ž < bi < . with light gases Žsuch as helium, hydrogen, nitrogen, methane.
at high reduced temperatures. The tendency to develop such
solutions is greater if the two lower poles of the equations of
3. Select an initial value from the interval boundaries: state are farther apart.
The existence of physically unreasonable solutions is not
an argument against classic cubic equations; it is necessary,
yr if g Ž x infl . ) 0
x Ž0. s
½ qr if g Ž x infl . F 0
however, to make sure that such solutions are discarded
within computer programs. The common programming prac-
tice to use the lowest root of a cubic equation as liquid vol-
ume can lead to erroneous results or premature program ter-
where x infl s y1r3 b 2 is the location of the in- minations.
flection point. This choice ensures that no extremum lies Root calculation by Cardano’s formula should always be
between the initial value and the nearest root. followed with a Newton iteration step.