The C1osed-System COl'lstraint
2.2 2.2.1
CHAPTER TWO
_
The Closed-System Constraint and Chemical Stoichiometry He.re we deveIop the basis for the constraint on the computatíon of chemicaI equilibrium that is due to the requírement for conservation of elements in a closed system undergoing chemical change, a special form of the law of conservation of rnass. This constraint is intimately bound up with what is usually called chemical stoichiometry, * whether it is expressed directly in terms of conservation equations OI' indirectly in terms of chemical equations. The specific purpose of this chapter is to develop chemical stoichiometry for a dosed system in a form suitable for incorporation in an equilibrium-computa tion a1gorithm. Useful too15 for this are provided by linear algebra since the conservation equations are themselves linear algebraic equations, and in what follows we make use of vector-matrix notation. The end result is a stoichiornet. ric~coçfficieni al.gorithm, computer programs for which are contained in Ap p~~ndjx A.
2.1
15
THE CLOSED-SYSTEM CONSTRAINT The Element-Abundance Equations
A c10sed system has a fixed mass; that is, it does not exchange matter with its surroundings, although it may exchange energy. It may consist of one or more than ane phase and may undergo reaction and mass transfer internaHy. Its importance in equilibrium computations i5 that the equilibrium conditions of thermodynamics (Chapter 3) apply primarily to such a system. In the laboratory and in chemical processing, the concept of a closed system obviously applies to a batch system. Perhaps less obviously, it also applies to a fluid system undergoing "plug" flow in.which there is no mixing or dispersion in the direction of flow and in which ali clements of fluid have the same residence time in a particular vessel or conduit (Levenspiel, 1972, p. 97). In such a case each portion of fluid, 01' arbitrary size, acts as a batch system in moving through the vessel. This description i5 most suitably applied to a fluid flowing at a relatively high velocity in a conduit of uniform cross section. Operationally, any description of a closed system is al1 expression of the law of conservation of mass. A closed system can be defined by a set of element~ abundance equations expressing the conservation of the chemicai elements making up the species of the system. Thcre is one equation for each element, as follows: :Y
2:
Qkini
=
bk ;
k=1,2, ... ,J.f,
(2.2.-1)
i=l
where Qki is the subscript to the kth element in lhe molecular formula of species i; /1, is lhe number of moles of i (in some basis amount of system); hÁ is the fixed number oI' moles of the k th e.lement in the system; M is the number of elements;and N is lhe number of species. Alternatively, equations (2.2-1) may be written so as to express the change from one compositionaJ state to anolher: N'
THE APPROACH
2:
We first define a closed system and then develop a method (Smith and Missen, 1979) for treating chemical stoichiometry that involves generating, a priori, an appropriate set of chemical equations. Since another approach involves starting with a set of such equations, we discuss the implications of this and finally consider some special stoichiometric situations. In this sense the treatment is more general than, and goes beyond, the specific purpose indicated previously.
Qki ôn j
= O;
k= 1,2, ... ,.M,
i=l
(2.2-2)
where ôn i is the change in the number of moles of the i th species between two compositional states of the system. In vector-matrix form, the element-abundance equations 2.2-1 and 2.2-2 are, respectively, Ao
= b,
(2.2-3)
and "Thc won;! ":;toichiOP),'lrJ"
ar
Gr\.~ek
origino literaliv conccrm mCihurcmcnt (-mctry) dcmcnt.
ckm~nt {stoichion): in chemical stoichioffictrv lhe clcment is a chcmiçal
14
ar
an
Aôn
= O,
(2.2-4 )
'lhe Closed-System Constraint and Chemkal Stoichiometry
16
where, as described in more detail in the following paragraphs, A is the formula matrix, n is the species-abundance vector,* and b is the element-abun dance vector. Again, it is the fact that b is fixed that characterizes a closed system. Any one of equations 2.2-1 to 2.2-4 expresses the closed-system constraint. Example 2.1 Write equations 2.2-1 and 2.2-3 for a reaction involving the species NH , 02' NO, N02, and H 20. Assume that the initia1 state of the 3 system consists of NH 3 and 02 in the molar ratio 4: 7. Solution The NH 3 : O2 molar ratio establishes a basis amount of system such that b = 4, b H = 12, and bo = 14. The three element-abundance equa N tions 2.2-1 for the three elements in the arder nitrogen, hydrogen, and oxygen are then: lnNH
3
3n N H:<
+ On0 2 +
lnNo
+
In N 0 2
+ On H20 =
+ 0110 + 011 NO + OnNO z + 211H 2
OnNH, + 2n 02
20
+ ln~w + 211N0 2 + lnl:l 2 o
bN
= bH
= 4, =
12,
= bo = 14.
Equation 2.2-3 for this systcm is rl NH3 \
li
O
1
O
O
2
1
1 O 2
(1~)'
O) 2 \ no,
nNO
1
\ 14
n N02 \ n H2 0
!
where the matrix on the left is A, which is made up of the coefficients on the left in equations 2.2-1 and the two vectors are n and b, respectively. The maximum number of linearly independent element-abundance equa tions, which is the same as the maximum number of linearly independent rows (or columns) in the matrix A, is given by the rank of A (Noble, 1969, p. 128). 2.2.2
Some Terminology
To provide a concise summary of unambiguous- terminology, we define a number of terms in tbis section, mostly relating to a c10sed system, even ,. Ali vectors are column vectors. and superscript tran"posC of a vector.
r.
used in Secliol1 ~.2.2 al1d lalcr, denotes lhe
11
The C1osed-System Constraint
though some of them have already been introduced. These are as follows: chemical species: by
a chemical entity distinguishable frem other such entities
1 1ts molecular formula; ar, failing that, by 2 1ts molecular structure:(e.g., to distinguish isomeric forms with the same molecular formula); or failing that, by 3 The phase in which it occurs ie.g., H 20(e) is a species distinct fram H 20(g)}.
chemical substance: a chemical entity distinguishable by properties I or 2 (above), but not by 3; thus H 20(C) and H 20(g) are the same substance, water. chemical system: a collection of chemical species and elements denoted by an ordered set of specíes and an ordered set of the el{~mentscontained therein as fol!ows:
{(AI' A 2 ,···,A j , ••• ,A N ),
(E l , E2 ,···,Ek ,···,E/If)}'
where Ai is the molecular formula, togcther with structural and phase designa tions, if necessary, of species i and E" is element k; the order is immaterial but once decided, remains fixed. The list of e1ements includes (l) each isotope involved in isotopic exchange, (2) the protonic charge p, if ionic species are involved, and (3) a desígnation such as XI' X 2> ••• , for each inert substance in the species list, where an inert substance is one that i5 not invo1ved in the system in the sense of physicochemical change. formula vector (Brinkley, 1946) ai:
the vector of suhscripts (usually integers) to the elements in the molecular formula of a species~ for illstance, for C6 H 5 N02 , a = (6,5, t 2)T. formula matrix A: the iH X N matrix in which colunm i is aj; A:::-~ (a I' a 2 ,· .. , ai" .. , a N); A is the coefficient matrix in the dement-abundance equations 2.2-1. species-abundance vector n: the vector of nonnegatíve real numbers repre sentíng the numbers of moles of the species in a basis amount of the chemical system; n = (n 1, n 2 , •.. ,nj, ... ,n N )1'; n j ~ O; n also denotes the composition or compositional state of a system, element-abundance vector b: the vector of (usually nonnegative) real numbers representing the number of moles of elements in a basis amount of the chemical system: b = (b l , b2, ... ,-b k , ... ,bM)T; b is often specified by the relative amounts of reactants for the system. dosed chemical system: one for which all possible n satísfy the element-abun dance equations 2.2-3 for some givenb.
111e Closed-Sy«tem Constraint and Chemical Stoicbiometf!'
18
species-abundance-change vector, 8n = 0(2) - n(\): the changes in mole num bers between compositional states (1) and (2) of the closed chemical system; it must satisfy equation 2.2-4. feasibility or infeasibility (of a closed system): whether a given b is compati ble with the species list and the preceding definitions of A and n; for example, for the system {(NO:!, N 20 4 ), (N,O)}; b = (b N , bol, b = (l,2f is feasible, but b = (2,2{ is infeasible; a necessary condition for feasibility is lhat the rank of the augmented matrix (A, b), obtained from the system of linear equations An = b be equal to the rank of A; this is not a sufficient condition because the algebraic theorem on which it is based allows for the possibility of solutions involving negative values for some or all of the n i; a sufficient condition for infeasibility is that the ranks be unequal; we assume throughout that alI systems are feasible.
Chemical Stoichiometry
19
numericaUy equal because only equations 2.2-1 are involved as linear equations relating to {nJ. They are not equal in general, however, alld this is discussed in Section 2.4. Chemical stoichiometry enables us to determine the values of F;; and R for a given system (i.e., one for which A is known) and to write a permissible set of chemical equations. Before describing a method for doing this, however, we describe the genesis of chemical stoichiometry and chemical equations from lhe conservation equations. 2.3.2 General Treatment of Chemical Stoichiometry*
The general solution of equation 2.2-1 or 2.2-3, a set of M linear equations in N unknowns, is R
n = n° 2.3 2.3.1
+
In a c10sed chemical system we are interested in the various compositional states that can arise, subsequent to an initial state, as a result of chemical change within the system. The determination of any of these states is subject to the element-abundance equations. These algebraic equations may alternatively be cast in the form of chemical equations, which is what we usually think of when we speak about chenúcal stoichiometry. Whether the equations are algebraic or chemical, one of the purposes of chemical stoichiometry is to determine the appropriate number of them, that is, the maximum number that are Iinearly independent. This number.. is different for the two types of equation, as described subsequently. For the algebraic equations, it is usual1y M, but it may be less than this. The conservation equations usually do not, of course, provide alI the information required to determine lhe composition n. This is most easily seen in terms of equation 2.2-3. The difference between the number of variables N used to describe the composition and the maximum number of linearly independent equations relating {n j} is called the number of stoichiometric degrees of freedom F;;. This is then the number of additional relations among the variables required to determine any compositional state. If the 5tafe is an equilibrium state, the additional relations arise from thermodynamic condi tions, as described in Chapter 3; otherwise, they may arise from kinetic rate laws or from analytical determinations. Thus far the only linear equations relating {n i} that we have considered are the element-abundance equations 2.2-1. The difference between N and the maximum number of linearly independent element-abundance equations is in general denoted by the symbol R. Throughout this section ~ and R are
"i€j'
(2.3-1)
j=1
CHEMICAL STOICHIOMETRY
Introductory Concepts
2:
where n° is any particular solution (e.g., an initial composition), ("1' "2" .. '''R) is any set of R linearly independent solutions of the homogeneous equation corresponding to equation 2.2-3 (i.e. equation 2.2-4), and the quantities €j are a set of real parameters. Each "J is called a stoichiometric vector, defined in general as follows: stoichiometric vector v: any nonzero vector of N real numbers satisfying lhe equation A" == O. Hence A'j
= O;
(1]*0);
j= 1,2, ... ,R,
(2.3-2)
which may also be written as /11
2: QkJ'\' == O; 1:::1
k == L2,.... ,M; " j = 1,2, .... ,R,
(2.3~3)
and Vi} =t= O for at least one i for every j. The quantity R is the rnaximum number of linearly independent solutions of equations 2.3-2 and is given by R = N - C,
(2.3-4)
where
c Usually, but not always, C
=
rank (A).
(2.3-5 )
= M.
Ao alternative way of regarding the parameters {~j} and the quantities {Vi j} may be obtained from further examination of equation 2.3-1. which may be ·An eJementary trcatmen: has been descríbed by Smith and Missen (1979) and has been iilusuared for a simple system
-n,e Closed-System Con~traint and Chemical Stoichiometry
26
written as
= 1l~ + L
Pij~j;
i = 1,2 •... ,N.
(2.3-1a)
(2.3-6)
Example 2.2 Consider the system {(NH 3 , Oz, NO, NOz, Hl», (N,H, O)} in = Example 2.1, in which the formula matrix A is given. The vector (O, - 11 -1, 1, O{ is a stoichiometric vector since it satisfies Av = O; that is,
)=1
For fixed nO, we have
( dn i
)
.
a~j ~k;'J
= PiJ ;
i=I,2, ... ,N;
j=1,2, ... ,R,
21
Such equations are a chemical shorthand way of writing the vector equations 2.3-7 (or equation 2.3-2). To be able to use these concepts in actual situations, we must be able to determine the quantities R and a set of R linearly independent stoichiometric vectors,{v,l We discuss a systematic numerical determination of these quanti ties in lhe next section but first use an example to illustrate the definitions.
R
ni
Chemical Stoichiometry
where the notation ~h=j means alI ~'s other than the jth, and Pij is called the stoichiometric coellidem of the ith species in the j th stoichiometric vector. Thus Pij is the rate of change of the mole number of the ith species n i with respect to the reaction parameter ~J" Further significance of ~j is discussed in Section 2.3.5. Here we note that equation 2.3-1 may be regarded as essentially a linear transformation from the N independent variables fi to the R independent variables ~. The variables fi are constrained by the element-abundance equations 2.2-3, whereas the varia bles ~ are not so constrained. since for any {~J, premultiplication of equation 2.3-1 by A gives .
v,
0\
o
O O
O
O 2
2
1
2
1
1 O) 1
_1 2
-} I
(n ,O
I
Oi
Another stoichiometric vector for this system is Vz = (- i, - i, 3, O, 1) T. These two vectors are JinearJy independent because of the values of the last two entries of each vector. The rank of A is C = 3, and hence the maximum number of linearly independent vectors is R = 5 - 3 = 2.
R
An = AnO
+ L €jA"J.
Any composition of the system can be, written from equation 2.3-1 as
j= I
The first term on the right is b, and the second term vanishes because of the definition of the stoichiometric vectors (see equation 2.3-2). The chemical significance of equation 2.3-1 is that any compositional state of the system n can be written in terms of any particular state nO and a linear combination of a set ofR linearly independent vectors "J satisfying equation
n
= nO + (O, -~,
-I, 1,0)T~1
O(q -j(~) -1(~) + I(~) +O(~) ~ (~l, Oi_
N
L
aiP ij
= o;
j
= 1,2, ... ,R.
(2.3-7)
j,O, l)T~i'
Equations 2.3-7 for this system are
2.2A.
Equation i3-2 leads naturally to the concept of chemical equatiofls. What we call a "chemical equation" is simply a chemical shorthand way of writing equation 2.3-2 or 2.3-3, in which the columns of A are replaced by the corresponding molecular formulas of the species. Equations 2.3-3 may be written in terms of the columns of A as
+ (--1, -7"
\2
JI
1,
0,
and
-t
W-~ mt ( ~ ) +
+
o( ~) +
Im m =
Replacing the formula vectors by the names of the respective species A j and O by O. we have
i=l
A set of chemical equations results from equations 2.3-7 when we repIace the formula vectors ai by their species names Ai and the vector O by O: IV
L i=1
Aiv ij
= o;
j
=
1,2, . .. ,R.
(2.3-8)
ONH 3
-
-~NH3 -
lN02 + OHzO
= O,
i 0 2 + iNO + ONO z + lH 20
= O.
102 - lNO
+
Conventionally, species names with negative stoichiometric coefficients are
written on the left side of a chemical equation a..'1d those with positive
22
Thc C1osed-System Constraint and Chemkal Stoichiometry
coefficients on the right side, so that negative numbers do not appear. Thus clearing of fractions and zero quantities and rearranging in accordance with this convention, we have 2NO
+ O2 =
2N02
+ 502
= 4NO
+
23
those C 11 i values are linearly independent. This is equivalent to partitioning the species into two groups, components (numbering C) and noncomponents (numbering R). The components may be regarded as chemical "building blocks" for forming the noncomponents in chemical equations, one equation being required for each noncomponent. This leads to the following definition: component: one of a set of C species of the chemical system, whose set of formula vectors {3 I' a 2 ,· .. ,a c } satisfies rank (ai' 3 2 " .. ,a c ) = C [where C = rank (A)].
and 4NH 3
Chemical Stoichiometry
6H 20.
A linearly independent set of R stoichiometric vectors {v;} is called a complete set of stoichiometric vectors for the system with formula matrix A. This is an appropriate name since, from equations 2.3-1, we can determine any possible solution n of the e1ement-abundance equations by specifying, by some means other than chemical stoichiometry itself, an appropriate set of R ~j values (relative to a suitable nO), along with the matrix. A concise way of writing any set of stoichiometric vectors is by defining a matrix N whose columns are the vectors 'j-; that is,
Example 2.3 For the system described in Examples 2.1 and 2.2, a complete stoichiometric matrix is
o -j j
-
N=I_:
("1' "2""
1
Equation 2.3-10 becomes
O ( I
complete stoichiometric matrix N: an N X R matrix whose R columns are linearly independent stoichiometric vectors, with the additional specification that R = N .- rank (A) (equations 2.3-4 and -5); this condition impEes that rank (N) = R. This enables us to write equations 2.3-2 as the single matrix equation =-~
!
(2.3-9)
,vq ).
When q = R and allvj are linearly independent, N is "complete," and hence we define the fol1owing:
AN
I
~I
O N =
t
O.
(2.3-10)
Analogous to the idea of a complete set of stoichiometric vectors, we define the following: complete set of chemical equations: the set of equations 2.3-8, where the vij form a complete stoichiometric matrix N, as defined previously. We emphasize that such a set of equations is not unique since any one equation can be replaced by a linear combination of any of the equations. It is generated solely from the list of species presumed (or demonstrated) to be present, that is, from A, and neither requires nor implies any knowledge of reactions presumed to be taking place, or of reaction mechanisms. If we define
c = rank (A),
(2.3-5)
as previously, the significance of C is as follows: given R n values, we can solve equations 2.2-3 for C n i values, provided that lhe formula vectors of I
\~
O O 2
1 O I
1 O 2
~I .)
-1 -1 1 O
..
~
~
~
I- (0 -
,
I I '
O '. O
OI
~) .
This matrix equation is equivalent to the two vector equations in Example 2.2. Hence a complete set of chemical equations for this system is given by the t\\'O .... chemical equations written there. Since C = 3 for {his system, a set of components is given by {AI' A 2 , A 3}, where {a 1,a 2,a:d are línearly independent. The nine possible sets of components are {NH 3 , 02' NO}, {NH 3 , 2. N0 2}, {NH 3 . 02' H 2 0}, {NH 3 , NO, N0 2 }, {NH 3 , NO, H 20}, {NH 3 , N02, H 20}, {02' NO, H 20}, {02' N02 , H 20}, and {NO, N02, H 20}.
°
2.3.3
The Stoichiometric Procedure/Algoritbm
The procedure simultaneously determines rank (A) and a complete set af chemical equations. HP-41C, BASIC, and FORTRAN computer programs implementing it are given in Appendix A, and we describe lhe" hand calcula tion" procedure here. This procedure can also be used for balancing oxidation-reduction equations in inorganic and analytieal chemistry, as an alternative to other methods, sueh as the half-reaction method that uses oxidation numbers (Mahan, 1975. pp. 257-265), and ion-eIectron and
The C1osed-Svstem COfistraint and Chemical Stoichiometry
24
valence-electron methods (Engelder, 1942, pp. 122-127), which require addi tional concepts. The procedure is similar to that used in the solution of linear algebraic equations by Gauss-Jordan reduction (Noble, 1969, pp. 65-66). lt illvolves the reduction of the formula matrix A to uni! matrix form (Noble, 1969, pp. 131-132) by elementary row operations (Noble, 1969, p. 78). The unit matrix form is represented by A* =
(IO c O' Z)
Chemical Stoichiometry
2 Form a unit matrix as large as possible in the upper-Ieft portion of A by elementary row operations, and column interchange if necessary; if columns are interchanged, the designation of the species (above the column) must be interchanged also. The final result is a matrix A*, as in equation 2.3-11. 3 At the end of these steps, the folIowing are established: (a) The rank of the matrix A. which is C, the number of components, is the number of I's on the principal diagonal of A*; (b) A set of components is given by the C species indicated above the columns of the unit matrix;'
(2.3-11)
where I c is a (C X C) identity matrix and Z is a (C X R) matrix, at least one of whose elements is nonzero; C is the rank of A * as well as the rank of A. In many cases the O submatrices are absent. A complete stoichiometric rnatrix is formed from A * by appending the R X R identity matrix below - Z; thus
N -Z) IR ' = (
(2.3-13)
AcZ = AR'
where the columns of A c refer to a set of component species and the columns of A R refer to the remaining species. Thus we have Z
(c) The maximum number of linearly independent stoichiometric equa tions is given by R = N - C; and (d) A complete stoichiometric matrix N in canonical {ofm is obtained from the submatrix Z in equation 2.3-11, according to equation 2.3-12; each equatioIl in a permissible set of chemical equations is obtained Crom a column of N by first writing equation 2.3-8 and lhen rearranging, using the convention described in Example 2.2.
(2.3-12)
(Schneider and Reklaitis, 1975; Schubert and Hofmann, 1975,1976). A com plete stoichiometric rnatrix expressed in the form of equation 2.3-12, that is, one that contains the R X R identity matrix, is said to be in canonical formo Here N is a complete stoichiomctric matrix for A since our Gauss-Jordan procedure essentiaIly constructs the columns of Z in A* to satisfy
= ACIA R •
(2.3-14)
25
2.3.4 lIlustration of the Treatment and Procedure The procedure described in Section 2.3.3 can be used for a chemically reacting system that involves inert species, charged species, and mass transfer between phases. The first two of these havc been ilIustratcd previously (Smith and Missen, 1979), and we illustrate the third here. Example 2.4 Consider the esterification of ethyI alcohol (C 1 H ó O) wíth acetic acid (C2 H 4 ü 1 ) to form water and ethyl acetate (C4 H g0 1 ) in a liquid CC) vapor(g)contact, which allows for lhe presence of acetic acid dimer in the vapor phase (Sanderson and Chien, 1973). The system is represented by {(H 2 0(e), C 2 H 6 0(e), C 1 H 4 0 2 (e), C4 H 80 2 (e), H 20(g), C Z H 6 0(g),
and hence _ (
AN -
Ac ' A R
c
) ( - A IA R)
_
IR. - -AR
_ + A R-O.
C 1 H 40 2(g), C4H g0 2(g), (C1H 40 2)1(g»), (C, H, O)}.
(2.3-15)
In addition to row operations, column interchanges may be required to obtain the unit matrix form, depending on the way in which the species have been arbitrarily ordered at the outset as columns of A. The steps of the procedure are as follows (Smith and Missen, 1979): 1 Write the formula matrix A for the given system, with each column identified above it by the chemical species represented.
For this system, we use the procedure described in Section 2.3.3 to determine the number of components C, a set of components, the nurnber of chemical equations R(= F;,), and a perrnissible set of chemical equations. Following the steps outlined previously, we have, with N = 9 and M = 3,
(I) (2) (3) (4) (5) (6) (7) (8) (9)
1 A=
n
2 6
2
4
O
2
4
8
2
6
1
2
2
1
2 4 2
4 8 2
~)
The Closed-System ConstTaint and Chemical Stoichimuet"1)
26
Here the numbers at the tops of the columns correspol1d to the species in the order given, and the rows are in the order of the elements given. 2 The matrix A can be put in the fol1owing form by means of elementary row operations and column interchanges.
}
A* = ( O
O
O
}
O
(8) (9)
(4) (5) (6) (7)
(2) (1) (3)
1 -} I
O O }
O 1 O
1 O O O O 1
} O) O
-1
1
Rank (A) = C = 3;
(b) a set of components is {H 20(e)(l), C 2 H ó O(e)(2), C2 H 4 0 ir)O)}; (c) R = N - C = 9 - 3 = 6; (d) reordering the list of species according to the designations above A *, we have the following complete stoichiometric matrix: O
-1
1
-}
o
1
O
N=j
o
1
o o o o
·0
o
o o
-}
O O
o
o 1
o
o o
o o -}
o o o
-I 1 -1 O
01O -2
o
o o
O
O
o
1
o o
1
o
o o 1
This corresponds to the following set of six chemical equations:
C 2 H ó O(e) + C 2 H 4 0 2 (f) H 20(C)
= H 20(r.)
-+- C4H~02(fJ),
= H 20(g).
C 2 H ó O( fi) = C 1 H ó O(g),
C 1 H 4 0 2 ( e)
C 2 H ó O(r.)
27
10) to measure the "degree of advancement of a reaction:' The quantities ~j (i.e., for R chemical equations) were introduced previously as a set of rea·l parameters in establishing the concept of chemical equations from the element-abundance equations. If we accept the existence of chemical equations ab initio, then equations 2.3-1 and 2.3-:.6 define a set of quantities ~1' one such quantity for each chemical equation written. The extent of reaction is a useful variable for equilibrium computations. From equation 2.3~I. it is an extensive quantity.
2
3 (a)
r- I
Expressing Compositional RestTictions in Standard Form
= C 2 H 4 0 1 (g),
+ C 2 H 4 0 2 (e) = H 20(e) + C4 H x0 2 (g), 2C 2 H 4 0 2 (e) = (C 1 H 4 0 2 )ig)·
2.3.5 nle Extent of Reaction The quantity ~ introduced in equation 2.3-1 is the extent-of-reaction parameter original1y introduced by De Donder (1936, p. 2~ Prigogine and Defay, 1954. p.
2.4 EXPRESSING COMPOSITIONAL RESTRICTIONS IN STANDARD FORM 2.4.1
Introduction
We discussed in Section 2.3 how a complete stoichiometric matrix N and a corresponding complete set of chemical equations can be obtained when the formula matrix A of a system is given. These procedures are essentiaUy those used in the computer program VCS in Appendix D, which calculates equi librium compositions. Whenever A is given at the outset, we advocate the formation of an N matrix in this way. This guarantees that rank (N) = N - rank (A),
(2.4-1)
in which case we say that the compositional restnctlOns are expressed in standard formo However, if an N matrix i.s given at the outset, there is no guarantee that is the case. The purpose of this section is to show how the formula matrix A can bc modified (if necessary) so that equation 2.4~1 is satisfied. An important situation in which an N malrix is specified at the outset is in problems involving only mass transfer of substances betwcen phases. The key feature of a complete stoichiometric rnatrix.· corresponding to a given formula matrix A, is that its rank R is givcn by equation 2.3-4, where R is the proper number of stoichiometric equations needed to describe ail possible compositions of the system. Normally, we do not advocate forming an N matrix for a set of chemical equations written or suggested ab initio by some means because it is not necessari1y assured that such a matrix has the correct rank R. Typical situations giving rise to a stoichiometric matrix whose rank is incorrect are: (l) there may be too many equations in such a set, in the sense that they are not alllinearly independent; and (2) even if the equations written are linearly independent, they do not necessari1y represent the maximum possible number of linearly independent equations. Occasional1y, however, we may wish to consider a specific N matrix at the outset. For example, an N matrix may be suggested by a kinetic mechanism. Such a mechanism must be examined to ensure that rank (N) = R. Even if rank (N) iscorrect, kinetic schemes must pass other stoichiometric tests (Ridler
The Closed-System Consrraint and Chemical Stoichiometry
28
et a1., 1977; Üliver, 1980), whieh are related to the nonnegativity eonstraints on the mole numbers. Here we diseuss how sueh N matrices may be utilized. Indeed, some authors approach chemieal stoiehiometry in this way (e.g., Aris and Mah, 1963). We discuss such problems here partIy because it is worthwhile to view this approaeh in terms of the formulation in Sections 2.2 and 2.3 and partly beeause eertain types of N matrix have special properties, which are explored in Section 2.4.3. They also specify some speeial kinds of chemical equilibrium problem, which we treat in Chapter 9. 2.4.2
Reduction of a Given Stoichiometric Matrix to Standard Form
For the formation of hydrogen bromide from hydrogen and bromine, the relevant system in kinetic terms is {(Br z• H 2 , HBr, H, Br), (H, Brn. The accepted chain-reaetion mechanism (e.g., Moore, 1972, p. 398) is Br 2
---+
2Br
Br + H 2
--'>
HBr
+H
H + Br 2
......
HBr
+ Br
+ HBr
---+
H2
2Br
---+
Br2
H
N=I
~1
O
1
1 -1
-1
I
programs listed in Appendix A. We can thus use the rows of N as input to this programo Since the rnatrix in this case is small, we illustrate the procedure by hand. This results eventually in the matrix I
O
O
O
lo
I O
O O
O O
O 1 O
I
(N*{ =
-I O
O
O
-2 O -1 O O
The rank of {N*f is 3, and hence a complete stoichiometric matrix is given by the nonzero rows of (N*)T, 100
O O O -2
+ Br
I O O I -2 --I O-}
2H H
O I -1 -I 1
O -2
2Br = Br 2 ,
cients in the kinetic scheme, with each column corresponding to a given reaction, made up by the coefficients of the species in that reaction. With the equations and species ordered as indicated previously, a stoichiometric matrix is O -'I 1
2.9
A linearly independent set of chemical equations is hence given by
A stoiehiometric matrix N is constructed from the stoichiometric coeffi
-1 O O O 2
Expressing Compositional Restrictions in Standard Form
1 O O O
-2
Since we can establish from the formula rnatrix of the system, aceording to the method described in Section 2.3.3, that there are at most three linearIy independent chemicaI equations for this system, there must be two columns too many for N. We can determine a linearly independent set of chemical equations by performing e1ementary co1umn operations on N. This is equivalent to perform ing elementary row operations on NT in the same way as for A in the computer
=
+ Br =
H2, HBr.
Usually, but not always, the number of linearly independent chemical equations that results coincides with rank(N) = R.
(2.4-2)
Equation 2.4-2 essential1y means that the given N can be reduced to a complete stoichiometric matrix. The original N matrix is often in error in the sense that it has toa many columns (as in the preceding example). We see in what follows, however, that oecasionally fewer than the maximum number of chemical equations may occur. 2.4.3 .Stoichiometric Degrees of Freedom and Additional Stoichiometric Restrictions We have seen the way in which the specifieation of the formula matrix A for a chemical system consisting of N speeies restriets the allowable compositions fi to those satisfying the element-abundanee constraints ofequations 2.2-1 or 2.2-3. The number af linearly independent constraints posed by these restric tions is given by C = rank (A). Thus a total of (N - C) mole numbers of appropriate species of the composition vector must be specified for lhe
The Closed-System Constraint and Chemical Stoichiometry
30
remaining mole numbers to be determined. The number (N - C) is essentiaUy the number of degrees of freedomthat are imposed by the element-abundance constraints. We have denoted this number by R, which is then defined by R = N- C.
(2.3-4)
We a1so introduced in Section 2.3.1 the quantity ~ to denote the stoichio metric degrees of freedom. When we specify a priori a stoichiometric matrix N for a system, the number of stoichiometric degrees of freedom ~ is defined as ~
= rank (N).
(2.4-3)
When a formula matrix A is specified and the only compositional restrietions are the element-abundance constraints, we have seen that ~
= R = N - rank (A).
(2.4-4)
Expressing Compositional UestTidions in Standard fonn
form a modified matrix A', and modified element-abundallee veet()T b' FI'
~~R,
(2.4-5)
=N
- rank (A').
= O.
Additional Stoichiometric Restrictions that Arise Explicitly
Suppose lhat it is known experimentally that the amounts of two species p and q are always equal. This can be written as
~
(2.4-10)
In this {ase r = 1, and from equation 2.4-7, we obtain
we must have (Noble, 1969, p. 142) rank N
(2.4-9)
Thus the eompositional restrictions are expressed in standard form. We call a pair of matrices A' and N satisfying equation 2.4-9 "compatible" matriees. In the remaining parts of this section we show how to obtain compatible matriees for two types of problem in whieh we effectively have r> O. The two cases refer to situations in whieh the additionaI stoichiometric restrictions arise both explieitly and implicitly.
np-nq=O.
(2.3-10)
that
(2.4-8)
r = N - rank (A') - rank (N)
since for the matrix equation AN =0,
50
The impartance of this is that we can treat the combined set of constraints in the same manner as before by using the modified formula matrix A'. Since the right side of equation 2.4-8 is R for the modified system, we have r = O: that is.
2.4.4
In general,
31
~=R-I=N-C-l.
N -- rank (A),
(2.4-6 )
where N is the number of eolumns of A and the number of rows of N. For convenience, fol1owing equation 2.4-5, we define the quantity r as the dif ference between R and F: *:
We wish to be able to account for this restriction by means of a modified complete stoichiometric matrix N' that is compatible with a formula matrix A'. Example 2.5
Consider lhe system {(CóH s CH 3 , H 2 , CóH ó, CH 4 ), (C, H)}
r=R -
~
= N - rank (A) - rank (N),
(2.4-7)
and we call r the number of special stoiehiometric restrictions. The purpose af this section is to show how the r additional stoichiometric restrictions can be eombined with the usual element-abundanee constraints to *In the previous lreatment (Smilh and Missen. 1979) this distinction was nat drawn. and hem:e lhe treatment was restricted to cases in whieh r =: o. The distinction is neecssary in goin& beyond "pure" stoichiometry (r O). It has. in effcet. becn emphasized by Bjornbom (1975, 1977, 1981 ) frol}l another point of view.
'*
discussed by Bjbrnbom (1975) and by Sehneider and Reklaitis (1975). Suppose that it is known experimentalIy tha1 if the initial state is toluene, the resulting benzene and methane oceur in equimolar amounts. To see how this additional eonstraint is ineorporated, we first write the usual element-abundanee eonstraints and the compositional restrietion of equation 2.4-10. Thus we have
Ao =
(~
O 6 2
6
~ )(~ i)
= ( :: )
(2.4-11 )
The Closed-System Constraint and ChemicaJ Stoichiometry
32
Expressing Compositional Restrictions in StandardFonn
.13
V,/e do this by forming the modified formula matrix A' and elernent-abundance vector b' by means aí
and n, ) nz - O
O
(o
-1) ( ::
-
.
(2.4-12)
A'
= (~)
(2.4-l6a)
b'
= (:)
(2.4-16b)
and BeTe rank (A) = 2, N = 4, R = 2, r = 1, and ~ = 4 - 2 - 1 = 1. Let us now see how this example can be presented in standard formo Equations 2.4-11 and 2.4-12 are equivalent to the single set of equations (2.4-13)
Ato =b',
Ali the constraints are now expressed in the single equation
=
2
6 6
.I).
O
1
-1
o
, (7
A'
~
F.s
=
,
(
- rank (A') = rank (N').
(2.4-17)
I~
n = n°
Equation 2.4-13 nm\' incorporates all the compositional constraints on the systern. We treat A t as a modified system formula matrix and obtain a complete stoichiometric matrix for iL This yields
N'=
=N
It follows ihat every possible composition fi of the system is given by the general solution of equation 2.4-13, which is
(~: ). I
(2.4-13)
We form a complete stoichiometric matrix N' from A' in the usual way. Then the problem is formulated in standard form:
4. ,
and
b'
= b'.
A'o
where lhe matrix A' and the vector b' are
-1 1 .. 1
We have combined the element-abundance constraints and the additional stoichiometric restriction in equation 2.4-13 (cf. Ao = b). Frorn ihis. rank (Ar) = 3, and ~ = 4 - 3 = 1 = rank (N') = N - rank (A'). In general, we may incorporate any additional constraints that are of the
"j~j'
(2.4-J8)
j=l
2.4.5
--1 '
+ 2:
Additional Stoichiometric Restrictions that· Arise Implidtly
We consider here the general situationin which an N matrix is specified a priori as determining the allowable compositions a system may attain, starting fram some particular given composition nO. We assume that alI the columns of N are linearly independent. [f this is not the case, we use the methods described in Section 2.4.2 to achieve this. For a given stoichiometric matrix N, we show how a "fictitious" formula matrix A can be found, thus enabling us to treat the problem in standard formo That Às, we waut to have
form
Do =d,
(2.4-14)
where rank (H) = r.
(2.4-15)
F.s
= N - rank
(A) = rank (N).
(2.4-19)
The solution of the problem is relative1y straightforward, and we can perhaps appreciate this best by considering an example of an unrestricted stoichiometric system.
The Oosed-System Consrraint and Otemical Stoichiometry
34
Example 2.6 Consíder the system {(CH4,02.C02,H20,H2)' (C, H, O)}. A complete stoichiometric matrix is _I
NT=
-)
}
_1
(
I
1:
2
1
1
1
O
1" 1"
~ ).
A*
=
10
O
I
O
O
2
1:
I
O
I
?
_.1
-1
O
)
2
I
= 0,
NTAT = O.
•
(2.4-20)
c=
= 2 = rank (N).
Thus, for the matrix A*, N i5 a complete stoichiometric matrix. The 5ystem formula vectors are given by a*(CH 4 ) = (l,O,O)T
°
a *(
2)
IF, )
N= ( N,
a*(H 20) = (1,1,
-!f
N i
i== I
(2.4-24 )
'
A* = (-N1,IN-fJ,
The element-abundance equations corresponding to this formula matrix are
2: aj,!1 = L aj;nf = b/,
(2.4-23)
where IF is the identity matrix of order F, and N I is an (N - F,) X F:. matrix. An arbitrary matrix N can be put in this farOl by the method discussed in Section 2.4.2. Then a compatible matrix A* is given by
I _ 2"I)T a *(H 2 ) -- (I2,},
N
rank (A *) = N - rank (N).
The main point we wish to emphasize by means of the preceding example is that we can either start from a given formula matrix A and obtain a complete (but nonunique) stoichiometric matrix N or tum the situation around, starting from a given stoichiometric matrix N and obtain a (nonunique) compatible formula matrix A*. The actual recipe for construcIing A* when N i5 in a specific form is 5traightforward and can be performed by in5pection. The general prescription í5 as fo11oW5. We start with a matrix N in the form
= (O, 1, O) T
a*(C0 2 ) = (0,0, I)T
(2.4-22)
Now we consider the case when NT is given, and we want to determine a "complete" matrix A * that satisfies equation 2.4-22. Just as N in equation 2.3-10 is not unique, AT in equation 2.4-22 is also not unique, but is an N X C matrix (A *)T that satisfies
and N -- rank (A*)
(2.3-HJ)
We saw in the previous discussion of this problem thar lhe matrix N is not unique but is only subject to the requirement that it have N - rank (A) linearly independent columns. If we now consider the transpose of equation 2.3-10, we have
,1
h is readily verified that this A * is compatible with N given previously since A*N
The fact that we have produced a rather strange looking formula matrix in this example is not really very strange at all if we examine the situation more carefully.* Normally, we are given A and then determine a complete stoichio metric matrix N satisfying AN =0.
Now form the 3 X 5 matrix with the first three columns being the 3 X 3 identity matrix and the last two columns being the negative of the first three elements of the rows of N T . This yields the matrix 1
35
Expressing Compositional Restrictions in Standard Form
where A* i5 compatible with N since it has (]V - F,) linearly independeut columns and satisfies
(2.4-21 )
i= I
where n° is any allowable composition of the system (e.g., the initial composi tion).
(2.4-25 )
A'N = *cf. Bjórnbom (1981 l.
(-N"IN-d( ~ 1
-N1+N1=O.
The CIosed-SystemConstraint and ChemicaJ Stoichiometry
36
PROBLEMS
The element-abundance vector b*, corresponding to A* is given by A*n o = b*,
(2.4-26)
2.1
where n° is any allowable composition of the system, such as the starting composi tion_ Thus the element-abundance constraints are A*n
= b*.
2.2
(b) (c) (d)
Na 20 2 + CrCI 3 + NaOH =F Na 2Cr04 + NaCI + H 20 K 2Cr 20 7 + H 2 S04 + H 2 S03 =F CriS04h + H 20 + K 2S04 KCI0 3 + NaN02 =1= KCI + NaN0 3 KMn04 + H 20 + Na2Sn02 =1= MnOz + KOH + Na z Sn03
2.3 For each of the folJowing 5ystems, determine the number C and a permissible set of components and the maximum number R and a permissible set of independent chemicaI equations:
C 2 H 6 (g) = C 2 H 6 (r), (a)
C 3 H 6 (g)
Write equation 2.2-3 in full f-or the system {(H 3 P04 , H 2 PO;, HPOr-, pol- , H+ , OH- , H 20), (H, 0, P, p)}, if the system results from dissolving 2 moles of H 3 P04 in I mole of H 20. From the result in part a, write equations 2.2-} for the system, that is, by multiplying out equation 2.2-3.
Balance each of the following by Gauss-Jordan reduction, and in so doing show that only one chemical equation i5 required in each case: (a)
Example 2.7 Consider the system {(C2 H 6 (C), C 3 H 6 (e), C 3 H 8(e), C 2 H 6 (g), C 3 H 6 (g), C 3 H ll(g», (C, H)}, in which only mass transfer of the substances between the two phases is allowed. Find A* and b* 50 that the problem may be treated in standard formo
The N matrix is generated at the outset from the chemical
(a)
(b)
Smith (1976) has also treated Example 2.5 by this implicit approach.
Solution equations
37
Problems
= C3 H 6 (P),
(b) (c)
and
{(CO, CO2, H, H 2 , H 20, 0, 02' OH, N 2 , NO), (C, H, O. N)} {(CH 4 , C 2 H 2 , C 2 H 4, C 2 1l 6 , C6 H ó ' H 2 , H 20), (C, H, H 20)} {(CH 4 , CH 3 D, CH z D 2 , CHD3 • CD4 ), (C, H, O)} (Apse and Missen. 1967)
C 3 H g (g) = C 3 H 8(C),
(d) (e)
as
N=I
O O -}
O
~\I
O 1 O O
1
O
-]
(h)
This is in the same form as equation 2.4-24, with ~ matrix A*, from equation 2.4-25, is A*
1
=(O O
O O 1 O
(g)
O -}
O
O
(f)
1
= 3. A compatible formula
O O)
O O 1 100
O . 1
From equation 2.4-26,
, I
n~ + n~ )
b*
= A*n c = . n~ + n~ \ n~ + nâ
..
2.4
((C(gr), CO(g), CO2(g), Zn(g), Zn( e). ZnO(s», (C, O. Zn)} ((Fe(C 2 0 4)+ . Fe(C 20 4)2" .Fe(C204)~- .Fe 3 + ,SOJ- ,HS04- .H+, HC 2 0 4- , H 2C204' C 2 (C, Fe. H, 0, S, p)} (Swinnerton and Miller, 1959) {(H 20, H 20 2 • H+ , K + • Mn04- , Mn2+ , 02' SOr- ). (H, K, Mn, 0, S. p)} , {(C6 H 6 (f). C(,Hó(g), C 7 H!\(l'), C 7 H x(g), o-CgH1oU). o-CKHIO(g)· m-CxHIO(I'), m-CgHIO(g), p-Cl\HlOU). p-Cy,HIO(g». (C. H)} {(0Z
0,;- }.
Ethylene can be made by the dehydrogenation of ethane. Methane is a possible by-product. and it is undesirable for the system to approach equilihrium with respect to all these species at lhe outlet of the reactor. as the following figures show. For a feed that contains 0.4 mole of steam (inert) per mole of C 2 H ó ' and for an outlet temperature of 1100 K and pressure of }.6 atm, it can be calculated that if equilibrium obtained at the oudet, there wouid be 0.515 mole of ethylene per mole of ethane in lhe feed and 0.950 mole of methane. Calculate the mole fraction of each species in the oudet mixture 011 a steam-free basis.
Thern1Od~'namic
CHAPTER THREE
_
Chemical Thermodynamics and Equilibrium Conditions
Potential Functions anti Críteria for Equilibrium
41
in the function between two states of the system is independent of the "path" of the change. Among the most important potential functions are the entropy function, lhe Helrnholtz function, and the Gibbs function. For each such functiol1, there is a statement of the secol1d law of thermodynamics that includes both the criterion for a natural process to occur and for its ultimate equilibrium state; the statement must also incorporate any relevant constraints. Thus, for the entropy function S, the statement is
dSad
~
O,
(3.1-1)
where subscript ad refers to an adiabatic system; for the Helrnholtz function A, dAT,V':;;; O;
(3.1-2)
dG T , P ~ O.
(3.1-3)
and for the Gibbs function G, In Chapler 2 we dealt with lhe stoichiometric description of a chemical system that is valid regardless of whether the system is at equilibrium. Here we deal with lhe thermodynamic description of a chemical system and the conditions for equilibrium in a closed system provided by chemical thermodynamics. The treatment is necessarily synoptic. Full developments and accounts are given, for example, by Prigogine and Defay (1954), Lewis and Randall (1961), and Denbigh (1981). We first review conditions for equilibrium in terms of potential functions and the thermodynamic description of a chemical system, introducing the chernical potential. We then fonnulate the equilibrium conditions in terms of the chemical potential in two ways, corresponding to the two ways oi" incorporating the closed-system constraint discussed in Chapter 2. After showing ihe equivalence of these two formulations, we develop the expressions for the chemical potential that are necessary for their use. We conc1ude the ·chapter by commenting on the nonnegativity constraint and on the existence and uniqueness of solutions, introducing equilibrium constants, discussing reactions in electrochemical cells, and describing the ways by which the requisite information for the chernical potential is obtained.
3.1 THERMODYNAMIC POTENTIAL FUNCTIONS AND CRITERIA FOR EQUILIBRIUM The second law of thermodynamics provides severa1 potentia1 functions governing the direction of natural or spontaneous processes. The particular potential function appropriate to a given situation is governed by the choice of thermodynamic variables, which are regarded as independent variables. Specification of the values of these variables defines the state of the system. Thus these functions are referred to as state functions, which implies that any change 40
In each case the symbol d refers to an infinitesimal change, and the inequality refers to a spontaneous process and the equality to equilibrium; for relation 3.1-2, there is no work interaction of any kind between the system and its environment, and for re1ation 3.1·-3, there is no work involved other than that related to volume change (PV work). At equilibrium, depending on the appropriate constraint(s), cntropy is at a (local) maximum, the Helrnholtz function is at a minimum, and the Gibbs function is at a IlÚnimum. Of these three potentiál functions, the most important, because of the constraints, temperature and pressure, is the Gibbs function. The development in this book is based almost entirely on this function, but the results can be recast into equivalent forms when appropriate to a particular situatioil. The Helmholtz function and the Gibbs function are both sometimes referred to as free-energy functions_ The Helmholtz function is also sometimes referred to as the work function and the Gibbs function as the free-enthalpy function. We do not use these last terms, but because of common usage, we frequently refer to the Gibbs function as free energy. In fact, both A and G, as well as other potential functions, have interpretations as work quantities: dA T
,:;;;
-ôw,
dAT,v':;;; -ôw',
dG T , P':;;; -ôw',
(3.1-4)
where w is work of any kind, w' is work other than work of volume change, and th.e symbo! ô denotes a path-dependent quantity. In each case, the
Chemical Thermodynamics and Equilibrium Conditions
42
inequality refers to a thermodynamically irreversible change in state and the equality (the maximum work obtainable) refers to a reversible change. We have occasion to use relation 3.1-4 in the case of an electrochemical cell in Section
Thermodynamic Description of a Chemical System
where the chemical potential for the species i, J-L" is defined by any of J-Li
3.11.
au)' = (a;; i
u =U(S, V, n),
(3.2-1)
=H(S, P, n), A =A(T, V, n),
(3.2-2)
H
- an,
(3.2-3)
or
= G(T, P,n),
N
dU
= TdS -
PdV +
2: l1i dn"
(3.2-5)
i=J
+
VdP
+ 2:
l1,dn"
(3.2-6)
i=J N
dA
=-
S dT - P dV
+ 2:
aT
(3.2-7)
i=J
i
(3.2-9)
T. P.II}""i
-H T2
P,n
r a(fljT) 1 aT P.n
'
~,
T2
(3.2-10)
(3.2-11)
-h
l
'
(3.2-12)
and
( aapIL ,)
= Vi' T.n
(3.2-13)
where the subséript fi means tha1 alI mole numbers are constant and .h, and c, are the partiaI molar enthalpy and partia] molar volume, respectively. of species i in the system:
h, = ( I
11, dn i'
=(aG)'. an
O(G/Tl]
N
dH = TdS
S.P.Il;""
3G) = V', ( ap T,n
(3.2-4)
where U is internaI energy and H is enthalpy. Equation "3.2-4, for example, states that G is a (single-valued) function of T, P, and the (N) mole numbers n. Each oi these state functions is also homogeneous (in the mathematical sense; cf. physicochemical sense discussed previously) of degree 1 in each mole number n,. Each of these equations gives rise to a corresponding equation for lhe (complete) differential of the function involved:
T. V'''}''''i
I
Becauseof the homogeneity property of these functions, J-L, dependsonly on the intensive state of lhe system, such as defined by T, P, and composition. Since the most important of these fom functions is the Gibbs function G, we continue to use this function exclusively, wÍth the understanding that corresponding descriptions can be written in terms of U, H, or A as required. Frorn equation 3.2-8 and the definition of G, the temperature aod pressure derivatives for G and Mi' in their most useful forms, are as follows: [
G
aH) = (' a;;S,V."}",,
_(aA)
3.2 THERMODYNAMIC DESCRIPTION OF A CHEMICAL SYSTEM A homogeneous (single-phase) chemical system, open or closed, is defined thermodynamically by ooe of the following natural sets of state function and independent variables:
43
~:, ) r av)
v, = (ãn i
p ", • .'
T,P,")'",'
(3.2-14)
(3.2-15)
The additivity equation for the total Gibbs function of the system is obtained by integration of equation 3.2-8 at fixed T, P, and composition:
and N
dG = - S dT
+
V dP
+
2: 11, dn" i=J
.AI
(3.2-8)
G(T, P, n)
= 2: i·= I
n/[Li'
(3.2-16)
OIemical Tltennod}'namics and Equilibrium Conditiot"ls
44
Differentiation of this equation and comparison of the result with equation 3.2-8 leads to the Gibbs-Duhem equation for the (homogeneous) system:
The Stoichiometric Formulation
We describe two formulations of the minimization problem (cf. Smith, 1980a), referred to here as:
N
S dT - V dP
+ 2:
n i d p, i
= O.
(3.2-17)
i=1
This result can also be obtained by appLying Euler's theorem to the Gibbs function as a homogeneous function of degree 1 in the mole numbers. TlIe equations to this point may be applied to a homogeneous system or to each phase in a heterogeneous system. For a closed, heterogeneous (multiphase) system, we note that, as a consequence of the definition of a chemical spccies in Section 2.2.2, the chemical potential and partial molar quantities of a species in a given phase are determined by the variables that define the state of that phase only, and the implications for the equations in this section for G, J1.i' and so on are then as fo11ows: Equations 3.2-4,3.2-8,3.2-10,3.2-11, and 3.2-16 apply to the system as a whole or to each phase, provided that the extensive quantities G, H, S, and V relate to the whole system or to the phase under consideration. 2 Equations 3.2-9,3.2-12,3.2-13,3.2-14, and 3.2-15 apply to each species (and hence to a particular phase). 3 In particular.equation 3.2-17 applies to each phase; that is, there i5 a Gibbs-Duhem equation for each phase.
45
2
lhe stoichiometric formulation, in which the closed-system constraint i5 treated by means of stoichiometric equations so as to result in an essentially unconstrained minimization problem. and the nonstoichiometric formulation, in which stoichiometric equations are not used but, instead, the closed-system constraint is treated by means of Lagrange multipliers. These two formulations are described in turn in Sections 3.4 and 3.5, following which their equivalence is shown,
THE STOICHIOMETRIC FORMULATION
3.4
From Chapter 2 the mole numbers n are related to the extents of reaction the R stoichiometric equations, which are the independent variables, by
TWO FORl\1lJLATIONS OF THE EQUILIBRIUM CONDITIONS
For either a single-phase or multíphase system to be at equilibrium, G is at a (global) minimum subject to the closed-system constraint and the nonnegativity constraint at the given thermodynamic conditions (fixed T and P). This is essentially lhe statement of relation 3.1-3. Bere and in Sections 3.4 to 3.7 we assume that n j > O (mathematically this means that the nonnegativity constrainls are" non-binding"); that is, we ignore th~ possibility in the nonnegativüy constraint that n = O and return to the implications of this latter possibility in Section 3.8. At equilibrium. we thus deal with
(2.3-1)
j=1
Hence we may write (cf. equation 3.2-4)
(3.3-1 )
although 1his by itself is a necessary but not a sufficient condition. Our problem is essentially to express G as a function of the n i and to seek those vaiues of the n i that make G a minimum subject to the constraints. We assume that we are given values for the element-abundance vector b, temperatUfe T, pressure P, and the appropriatc "free-energy" data.
(3.4·1 )
and the problem is one of minimizing G, for fixed T and P, in terms oi the R Since these last are independent quantities. the first-oràer neccssary conditions for a minimum in G are ~/s.
(3G) \ ag
I
= O.
(3.4-2 )
T. P
or
I
dGT,p=O.
of
R
~.vt n -- n 0+ LJ j'i>j"
G =; G(T, P, ~), 3.3
~
( There are R
(;~ t.
=N
3G )
3~j T.P'~b.j
j
= 1. 2.... ,R.
(3.4-3)
- C equations in the set 3.4-3, Since
~ (' aG ')
P. ' ' ' '
= O;
;:-\
3n;
( on i ) T. P, nk""".
a~j ~,,~;
j = 1,2, ... . R.
(3.4-4 !
ChemicaJ Thermodynamics and Eqnilibrium Conditions
46
( 3G)
=
an i
T. P.
=
a~j
This is a simple forro of constrained optimization problem (\Valsh, 1975, p. 7). One approach is to use the method of Lagrange multipliers to remove the
P , ij
(2.3-6)
N
then, on combiningequations 3.4-3, 3.2-9, and 2.3-6, we have N
j
= 1,2, ... ,R.
(3.4-5)
Example 3.1 For the system described in Example 2.2, for which R equations 3.4-5 corresponding to the two stoichiometric equations -102-NO+N02=O
and
-iNH J
-
= 2,
the
i02 + iNO + H 20 = O
are -
~JLOl
-
~NO
+ /LN0 = O 1
-1f1.NH, - ~f1.02
and
+
jf1.NO
+ f1.H 1 0
=--=
O,
( ar) an
i
=
11.
M
L
J.ti -
ae ) ( oÀ k
n,
~
-
= O.
(n i > O)
3.5-3:
f1.N0 2
3À H
ÀN -
2
2À o = 0,
-
ÀN -
-
ÀN -
J.tH 2 0 -
2À H
= O,
-
Ào
= O,
2À o
= O,
Ào
= O,
The three equations 3.5-4 are
;=1
bN
subject to
=
1.2, ... ,1\1.
=
rank (A)
n NH3 -
(2.2-1)
n NO
3n NH3
-
-
n N01 = O,
-
2n H20 = O,
and
i=l
\Ve :issume, for convenience. that M
-
bH
li!
k
= C.
(3.5-4)
So[ution The system, as represented in Example 2.2, is {(NH 3 , 02' NO, NO:!, H 2 0), (N, H,O)}. Here N = 5 and M = 3. There are five equations
!'oi
bk ;
(3.5-3)
Example 3.2 Write the set of equations 3.5-3 and 3.5-4 for the system described in Example 2.2.
J.tNO -
2: Qkini =
(3.5-2)
As in the stoichiometric formulation, the solution of these equations involves the introduction of an appropriate expression for f1.i'
The problem is formulated as one of minimizing G. for fixed T and p. in terms of the N mole numbers, subject to the M element-abundance constraints. That is, frem equation 3.2-16. (3.5-1)
akin i
;= 1
f\i#~
J.t0
n,f1.j'
= o,
N
= bk
\
THE NONSTOICHIOMETRIC FORMULATION
= 2:
akiÀ k
k= 1
17'" À
J.tNH, -
min G(n)
,
and
respectively.
3.5
IN)
M
where À is a vector of M unknown Lagrange multipliers, À = (À I' À 2' ... ,À M ( . Then the necessary conditions provide the fol1owing set of (N + M) equations in the (N +M) unknowns (n I' n 2' ..• , n N' À I' À 2' ... ,À M ):
i=1
The quantity on the left side of this equation is denoted by D.Gj , and its negative has been called lhe affinity by De Donder (1936, Chapter 4). Equations 3.4-5 are R conditions for equilibrium in the system and are readily recognized as the "dassical" forms of the equilibrium conditions (Denbigh, 1981, p. 173). When appropriate expressions for the J.ti are introduced into the equations in terms of free-energy data and the mole nuínbers, the solution of these equations provides the composition of the system at equilibrium.
e:
= i~1 niJ.ti + k~1 À k \ bk -- i~l a ki J1 i
t(n, À)
f.k#i
L JJijJ.ti = o;
47
constraints. For this, we first write the Lagrangian
ani ) (
(3.2-9)
J.ti'
"k..-i
Tbe Nonstoichiometric Formulation
bo - 2n 02
-
n NO
-
2n NOz
--
n H20 = O.
Chemical Thermodynamics and EquilibriuUI Condítions
48
3.6 EQUIVALENCE OF THE TWO FORMULATIONS The equivalence of the stoichiometric and nonstoichiometric formulations can be shown as follows. FIOm equation 3.5-3, for the nonstoichiometric formulation, we bave M
P.i = ~
= 1,2, ... ,N.
j
QkiÀk;
(3.6-1)
The Chtmical Potential
49
We consider expressions for the chemical potentíal of a pUfe species first before turning attention to species in solution, in which latter case, composition must be taken into account in addition to T and P. 3.7.1.1 Pure Species
FIOm equation 3.2-13 written for apure species, we obtain
k==1
Hence, for the quantity on the left side of equation 3.4-5, the stoichiometric formulation, it follows that
N
.~
Pijf.Li
N
.2:
=
1=1
(M
2:
vi}
QkiÀk
p.(T, P) - p.(T, PC) =
2: 2: 114
~
k=1
(3.7-1)
I
P
po
v dP.
(3.7-2)
/11
We apply this to three particular cases: ideal gas; nonideal gas; and liquid or solid.
ÀkQkiPjj
i=1 k=1
=
v,
where v is molar volume. Integratiol1 of this at fixed T fram a reference pressure p o to P results in
k=l
1=1
N
)
aP.) T = ( <JP
N
Àk
3.7.1.1.1
~
QkiPi; i=1 .
Ideal Gas
Introduction into equation 3.7-2 of the equation of state
=0 (which is the stoichiometric formulation) since
and a reference or standard-state pressure (P O ) of unity results in
N
~ aki~'ij = O.
(3.7-3)
Pv= RT
p.(T, P) = p.°(T)
(2.3-3)
+ RTln P,
(3.7-4)
i'-=I
3.7 THE CHEMICAL POTENTIAL 3.7.1
Expressions for the Chemical Potential
The structure of chemical thermodynamics, as exemplified by the equations in this chapter to this point, is general and independent of the functional form of the chemical potential #li' Although the structure contains derivatives that show how tJ.i depends on temperature and pressure (equations 3.2-12 and 3.2-13), thermodynamics itself provides no comparable expressions for lhe dependence of #li on composition. We must then superimpose on the thermodynamic structure, particularly in equations 3.4-5 and 3.5-3, the equilibrium conditions, specific expressions for #l i to introduce composition explicitly into these equilibrium conditions. A guideline for this is that the expression for /Li must satisfy the Gibbs-Duhem equation (equation 3.2-17).
where P must be in the same unit of pressure as p o . Thus if p o is cnosen to be 1 atm, P must be expressed in atmospheres. We retain this choice in accordance with usual practíce, particularly in relation to free-energy data (Denbigh, 1981, p. xxi). In equation 3.7-4 p.°(T) is called the standard chemical potential that is a function of T onIy. 3.7.1.1.2
Nonideal Gas
Equation 3.7-2 may be written, on addition and subtraction of RTln( P/ PC), as p.(T, p)
= #l(T, Pc)
- RTln p o + RTln P
+
f;( v - R:) dP. (3.7-5)
On leuing p o
~
O and using equation 3.7-4, since in this limit fl(T, PC)
Chemical Thermodynamics and Equilibrium Conditions
50
J.7.1.2
approaches its ideal value, we have
+
JL(T, p) = p.°(T)
The Chemical Potential
RTln P+
~P( v -
3.7.1.2.1
RJ) dP.
(3.7-6)
For convenience, it is customary to use the last two terms on the right of equation 3.7-6 to define the fugacity f by means of
RTln f= RTln P
+ ~P( v - RJ)
SI
Species in Solution Ideal-Gas Solution
The form of equation 3.7-4 for the chemical potential of a pure, ideal gas suggests the form for a species in an ideal-gas solution (i.e., a solutionof ideal gases):
pAT, P,
Xi)
= f.!~(T)
+ RTln p;,
(3.7-12)
(3.7-7)
dP.
in which pressure P is replaced by the partial pressure Pi' where, by definition,
It fol1ows from this definition that · -f = I I1m P-O
Pi= (ni)p:=x.P n I
(3.7-8)
P
(3.7-13)
,
t
is the mole fraction of species i, and n t is the total number of moles in the solution. A justification for this form is that application of equation 3.2-13 to equation 3.7-12 leads to the equation of state for an ideal-gas soIution:
Xi
3.7.1.1.3
Liquid or Solid
For apure liquid or solid, it is convenient to take p o to be the vapor pressure p*, to take advantage of the equilibrium condition for liquid-vapor or solidvapor equilibrium-equation 3.4-5, in conjunction with equation 3.7-6. Thus from the latter, the chemical potential of the liquid ar solid at (T, p*), which is equal to that of the vapor at (T, p*), is f.!(T, p*) = p.°(T)
+ RTln p* + oP*( vg - pRT)
l
+ oP"'( vg
f
-
+ RTln p*.
lP*{ v -RT) - dP+ jP( v -RT) - dP. P * P p
~ni
RT
= n tp
(3.7-14b)
Jli(T, P, x,)
= /Lf(T) + RTln P + RTln Xi'
(3.7-12a)
3.7.1.2.2
Ideal So/uJion
Equation 3.7-12a may be used as the basis for a less restricted type of system -an ideal solution, which may be gaseous (but not necessarily an ideal-gas solution), liquid, or solid. This is accomplished in part by replacing the first two terms on the right by an arbitrary function of T, P, and a standard compositional state xi, f.L;(T, P, x1), so that
(3.7-lOa)
Analogous to equation 3.7-7 for the fugacity of a gas, the fugacity of a liquid OI solid is given by
g
RT
This can be most easily seen if equation 3.7-12 is written as
RT) dP+ fP p",vdP,
where v is the molar volume of the liquid or solid. The two integraIs on the right of equation 3.7-10 are usually relatively small in value, and hence, for a pure liquid or solid, we obtain
f RTln-= P o
_
v= 2,n i v i = p
P
(3.7-10)
p.(T, P) ~ f.L°(T)
(3.7-14a)
Hence
(3.7-9)
dP.
where vg is the molar volume of the vapor. On combining this \vith eCjuation 3.7-2, we have )1(T,P)=1J.°(T)+RTlnp*
(~~) r.n = RJ = Vi'
(3.7-11)
IJ.i(T, P,
xJ =
f.Li(T, P, xj)
+ RTln Xi'
(3.7-15)
The definition of an ideal solution in terms of f.L i is completed by specification With respect to of the standard state, which then serves to define /L/T, P, xi, there are two common choices or conventions,each convention leading to a
xn.
Cbemical Thermodynamics and Equilibrium Conditions
52
The Chemical Potential
and interpret JL~i (numerical1y different from 3.7-17:
particular type of ideality: 1 The Raoult Convention In this case xi -+ 1; that is, the standard state is pure species i at (T, P) of the system and in the same physieal state. Henee /Lj(T, P, xi) = lim (JLj - RTln xi-l
xJ,
and equation 3.7-15 is normally written without reference to
IJ.i(T, P, x,) = #L7(T, P)
+ RTlnx
j •
(3.7-16)
xi
/L~i
(3.7-15a)
lim (/Li - RTln X;).
(3.7-17)
Xi- Ü
Since 11-7 in equation 3.7-17 is different from 1J.i in equation 3.7-15a, we denote it henceforth by JL':t,. and write equation 3.7-15 as {Li(T, P;x i ) = fJ.'jfi(T, P) + RTlnx j •
(3.7-15b)
The Raoult convention is eommonly used for alI species in a solution in situations in which no distinction is made between solute(s) and solvent(s). When this distinction is appropriate, the Henry eonvention is commonly used for the saIute speeies and the Raoult convention for the solvent species. The composition variable used in equation 3.7-15 need not be the mole fraction. For the Henry convention applied to a solid solute speeies i dissolved in a liquid solvent, the molality m,. is commonly used, where fl i
m ·= 1000Mn ' I S S
(3.7-18)
by the analog ofequation
lim (/Li - RTln m j ) .
mi-O
JLftj = I-t~i
(3.7-20)
+ RTln m s '
(3.7-21)
where m s is the molality of the solvent, 1000/ Ms" Another composition variable that is sometimes used in connection with the Henry convention is the molarity Ci , defined by
nj Cj = V'
(3.7-22)
the number of moles of speeies i per unit volume (conventionally in liters) oi the system at (T, P). The disadvantage of this variable, in comparison with Xi and m i , is that it is inherently a funetion, albeit usually a weak function, of T and P. Equations 3.7-19 and 3.7-20 may be rewritten in terms of Cj , with l1-êr replaeing JL~i' and equation 3.7-21 becomes
2 The Henry Conventíon In {his case x7 -> O; that is, the standard state is lhe infinitely dilute solutioo of spccies i at (1', P) of the system. Hence
== fi; :::::
=
p../fJ
From equations 3.7-15b, 3.7-18, and 3.7-19, Ilfti and f.L:li are re1ated by
as
Ajustification for equation 3.7-15a as a model for a species in an ideal solution is that it can be used to derive the charaeteristics, including additivity of pure-species enthalpies and Raoult's law, Df this type of ideal solution. The quantity JLrcT, P) is the standard chemical potential of speeies i lhat is a function of bolh T and P. From equation 3.7-16, 117 is the ehemical potential of pure speeies i at (T, P) of lhe system in the same physical slate. We note that an ideal solution based on the Raoult convention is equivalent to the type of ideality to whieh the Lewis-Randall fugacity mIe applies (Prausnitz, 1969, pp.90-92).
1-Li(T, P, xi)
53
P,'jfi
= /Lê,. + RTln çç,
(3.7-23)
where Cs is the molarity of the solvent, n si V. \Vhen the solute is an electrolyte (e.g., a salt dissolved in water), equation 3.7-19 canoot be used for an individual ionie species since the limitiog process of equatioo 3.7-20 is not operationally possible, because it would violate electrieal-charge neutrality. The eation and anion of an eleetrolyte must be combined to represent the. electrolyte as. a whoie. For this purpose, the mean-ion molaJity of species i is defined 'by m~...,,.
= m:+m"--,
(3.7-24)
where v
= v+ +v
(3.7-25 )
Here v + and v _ are the subscripts to the cation and aníon, respective1y, in the molecular formula of theelectrolyte. Then equation 3.7-19 becomes poi(T, P,
mJ = fJ.~i + RTln m~i'
(3.7-26)
n i is the number of moles of solute i dissolved in n s moles of solvent, and Ms is the molecular weight of the solvent. In this ease we write equation 3.7-15b as f.L,.(T, P, m,.) = f.1.~,(T, P) + RTln m j
(3.7-19)
Example 3.3 Calculate the mean-ion molahty aí A1iS04)3 in a solution made up by dissolving 0.1 g mole of the salt in 200 g of water.
Chemical Thermodynamics and Equiübrium Conditions
54
and Xi may be re.placed by molality or molarity (with conse.quent changes for the numericai values of both ai and l'i)' In this case equations 3.7-27, 3.7-27a, and 3.7-27b become, respectively,
Solution
If we assume that AI 2(S04)3 is a "strong" electrolyte (i.e., completely ionized), then m+
= p+m = 1.0
and
m_
lim Yi = 1
(Raoult convention)
(3.7-29a)
lim ri = 1
(Henry convention).
(3.7-29b)
Xj-+ I
or
m~ = m~ m:
= (1.0)\1.5)3 = 3.37.
x;-+O
For an electrolyte species in a nonideal solution, the modification of the general forms, fol1owing equatioll 3.7-26 for an ideal solution, involves the introduction of the mean..;ion activity or mean-ion activity coefficient, each defined in a manner analogous to the mean-ion molality in equation 3.7-24. In terms of the mean-ion activity coefficient y:!: , equation 3.7-26 becomes
= 3.37 1/5 = 1.27'5.
Nonideal Solution
The most general form of expression required for the chemical potential is that for a species in a nonideal solution, whether gaseous, liquid, or solid. To remove the restriction of an ideal solution, we replace the composition variable in equation 3.7-15a by the activity ai of species i, and to complete the definition of activity, we specify the standard state. As for an ideal solution, there are two ·common ways of doing the latter; thus
JLzfT, P,x)
(3.7-29)
and
= p_m = 1.5,
and, from equation 3.7-24,
m:!:
+ RTln-·({(T, P,x)x j ,
IJ-j(T, p,x) = p.j(T, p)
1'=1'++1'_=2+3=5
3.7.1.2.3
S5
The Cbemical Potcntial
= IJ-7(T,
p)
+ RTlnai(T, P,x),
(3.7-27)
together with, for the Raoult convention, in terros of mole fractíon, tiro ai = 1: x i -+ I Xi
(3.7-27a)
IJ-i(T, P,m)
= J1.:ni(T,
p) + RTln(y:!:m~);',
(3 .7~30)
together with lim y . . -j = L
nl;-O
(3.7-30a)
-
As an altemative to the approach just described, for species in a nonideal solulion, the chemical potential maybe expressed in terms of the fugacity by using a relalion equivalent to equations 3.7-6 and 3.7-7 for apure species: p)T, P, x) = IJ-f(T)
+ RTln J;,
(3.7-31)
.
where the fugacity J; is defined by (Prausnitz, 1969, p. 30): and for the Henry convention,
lim ai = 1. x;-+Q X
(3.7-27b)
RTlnct>i = RTln
_:P = ~P( Vi - RJ) dP,
(3.7-32)
j
An alternative to the use of activity is the use of the activity coefficient Yi of species i, where a i = Yjx i ,
(3.7-28)
where
J; 9i= xip·
(3.7-33)
Chemical Thermodynamics and Equilibrium ConditIDns
56
3.7.2 Assigning Numerical Values to the Chemical Potential Expressions for the chemical potential, and in particular for the chemícal potential of a specíes in a nonideal solution, involve two types of quantity to which numerical values must be assigned: (1) the standard chemical potential (p.0 Of p.*) and (2) the composition and composition-related quantities, such as activity or activity coefficient and fugacíty or fugacity coefficient. For the first, we discuss ways in which numerical information is available in Section 3_12, in connection also with the standard free energy of reaction introduced in Section 3.10. For the second, there is a vast literature, and we only point out here some general features, inc1uding those re1ated to the temperature and pressure dependence of p.; given in equations 3.2-12 and 3.2-13, whích involve partial molar quantities. We discuss this in more detail in Chapter 7. The types of information required can be listed as follows: 1 Volumetric (PvTx) lnformation This inc1udes information contained in an equation of state, compressibility-factor charts, and tables of densities. This is needed for the determination of fugacity or fugacity coefficient, partial molar volume, and the pressure dependence of the chemical potential, activity coefficient, fugacity, and so on. The partial molar volume is involved in most of these determinations. If the molar volume v of a solution is known as a function of composítion at fixed (T, P), the partial molar volume of species i in lhe solution Vi can. be determined from v by the re1ation (cf. Smith and Van Ness, 1975, p. 604)
i).I
= v - joFl 2: X j (
;;j)
TP,x ••,
(3.7-34)
2 Enthalpy lnfonnatiQn This inc1udes data regarding heat capacltles, enthalpies of solution and rnixing, and enthalpies of formation. This is needed for deterrnination of the temperature dependence of the chemical potential, activity coefficient, and so on. The partial molar enthalpy of species i in a solution fi i can be determined from molar enthalpy by means of a relation analogous to equation 3.7-34.
3 A ctivity Coefficient Information This includes information given by correlations of experimental data obtained, such as fram phase equilibria for nonelectrolytes and from emf determinations for electrolytes. For the formeI' in particular, many empirical and serniempirical relations, such as the Margules, van Laar, and Wilson equations, have been proposed (Prausnitz, 1969, Chapter 6). 4 Excess Thermodynamic Function lnformation This inc1udes data concerning excess enthalpies and volumes (Missen, 1969). Much of lhe information required is given in terms of excess functions. An excess function is the difference between the function for a nonideai solution and the sarne function
57
Implications of the Nonnegativity ConstTaint
for an ideal solution based on a specified convention, whether the Raoult or the Henry convention. Thus the excess molar volume of a solution VE is defined by VE
=V -
(3.7-35)
Vid,
where Vid is the molar volume of an ideal solution at the same T, P, and x. Expressions involving excess thermodynamic functions are compkte1y analogous to lhose involving the corresponding thermodynarnic functions, except for a few cases of intensive quantities (Missen, 1969). For example, theexcess partial molar volume of species i in a solution may be related to VE by an equation analogous to equation 3.7-34:
v;
õE I
= VE - "x. -avE) ~ J ( ax j*i j
(3.7-36) T,P.Xk.,oj
Finally, we point out that, for numerical work, we frequently use the nondimensional form of the chernical potential IlJRT. The equations in Section 3.7.1 could alI be rewritten correspondingly in nondimensional formo
3.8
IMPLICATIONS OF THE NONNEGATIVI1Y CON8TRAINT
To this point we have assumed that the equilibrium conditions discussed in Sections 3.4 and 3.5 have a solution t.hat satisfies n; > O for aU species. This need not be the case, however, and in this section we show how the equilibrium conditions must be modified to account for the possibility of n i = O. We then show that tbis leads to the necessity to develop criteria to test for the presence OI' absence of an entire phase at equilibrium. Ir n i = O, either n( = O OI' n( O. In general, for a nonideal solution. fram equation 3.7-29, at fixed (T, P) we have
*
/Li =
n·
117 + RTln Yi(X) + RTln ---!.., n
(3.7-29)
1
and, from the definition of Ili'
âG ) = JLi' ( an T,P,nj'F'i
(3.2-9)
i
We assume that ri is finite for a11 possible mole fI'actions (for an ideal solution, this is true, since ri = I). Then, if n i = o and n l O, P.i ~ - 00. Froro equation 3.2-9, it follows that G may be lowered by adding an infinitesimal amount of species i, and hence at equílibrium the case n i = O and n ( =1= Ois not possibie. This, in tum, implies that the only possibility is n i = O and n( = O at equilibrium. In other words, n i is zero if, and only if, ali species in that phase aIso
*
Chemical Thennodynamics anel Equilibrium Conditions
58
have zero mole numbers (i.e., the entire phase is absent) (cf. Denbigh, 1981, pp. ltiO-161 ). We have thus shown that, to consider the possibility n i = O at equilibrium, we simply foeus on establishing whether n t = O. We examine the three possibilities for a phase: (I) single species; (2) ideal solution; and (3) nonideal solution. We then show how the equilibrium conditions, with equations 3.5-3 for the nonstoichiometric formulation and 3.4-5 for the stoichiometric formulation, must be modified. 3.8.1
Implications of the Nonnegativi~' Constraiut
59
3.8.2. Ideal Solution For a solution, we cannot proceed completely as for a single-species phase because ôG/an i is not strictly defined when n i = O. However, we again suppose that the (rest of the) system is at equilibrium and that the phase under 'Consideration is absent (n i = O for alI species in that phase) and consider whether a small amount of it could be formed. In the nonstoichiometric formulation for each species in a small arnount of the phase, from equation 3.6-1,
Single-Species Phase
M
For a single-species phase, it is relatively easy to modify lhe conditions since ]lj = jLi(T, P) and is independent of composition. The Kuhn-Tucker conditions are used (Walsh, 1975, pp. 35-39), which are analogous to the Lagrange multiplier conditions when inequality constraints are present. For the species in the single-species phase under consideration, equation 3.5-3 in the nonstoichiometrie formulation is replaced by the pair of conditions
(
ae ) ~ I
= #Li --
M
~
akiÃ- k
= O,
(n i > O)
(3.8-la)
0kiÃ- k
> 0,
(n j
= O).
(3.8-1b)
k= I
nJ'f""À
and
ae )
( an
i
= n, .. "À
M
#Li - 2: k= I
I
M
(.L7
+ 2:
vkjJJ.k =
O,
(n i > O)
(3.8-2a)
= O)
(3.8-2b)
k=1
and
aG
aG
i
)
M
an =ay = (.L7 + 2:
+ RTln Xi = 2:
akiÀ k ,
(3.6-1)
M )1 k~1 akiÃ- k · r
(3.8-3)
k==l
or, equivalently, Xi =
t
exp [ '1'( RT) -J1.7
+
If lxi < 1, the phase i5 absent; if (by coincidence) ~x; = I, the phase is at incipient formation; and if ~Xi> 1, the phase is present in finite amount, and the equilibrium calculation must allow for this. Thus the test or criterion for the phase to be absent at equilibrium is
~exp[{ ir) (-~: +
1
< I,
(3.8-4)
)] < 1
(3.8-5)
Qk'À k )]
or, in the stoichiometric formulation,
In the stoiehiometric formulation, instead of equation 3.4-5, we havc the pair of conditions, sternmíng from the stoichiometric matrix in canonieal form (Section 2.3.3) for the noncomponent species
aG aG a;- =v = s)
J1.i = J1.'f
lJ kj J1.k
> O,
(n i
~ exp[(RIr) (- ~: -
J '/~, I
v
where the summations are over all species in the phase. It is readily shown that relations 3.8-4 and 3.8-5 reduce to 3.8-lb and 3.8-2b, respectively, in the case of a single-species phase. Criteria 3.8-4 and 3.8-5 can be shown rigorously to be correct by considering the mathematical dual of the chemical equilibrium problem (Dembo, 1976). However, we have used an heuristic discussiol1 here. 3.8.3 Nonideal Solution
k= I
where i = j + M. Relations 3.8-1 b and 3.8-2b both essentially state lhat, if the free energy of the system were to be increased by the formation of species i, the formation would not take place.
Proceeding as for the ease of an ideal solution, we obtain the analog of equation 3.8-3: Yi(X)X i
= exp [( }T) (~Iuf + \
~ OkiÀk)]'
k=1
(3.8-6)
Otemical Thennodynamics and Equilibrium Conditions
60
Ir a solution x to these nonlinear equations satisfies ~ Xi < 1, the phase is absent; if it satisfies ~ Xi> 1, the phase is present and must be considered in the equilibrium calculation.
3.9
",.
~.
The conditions for the existence of a solution to a problem in chemical equi1ibrium have been reviewed by Smith (1980a). We assume that the nonnegativity and element-abundance constraints are satisfied by at Ieast one composition vector o and that a11 b k are finite and b k =1= O for at Ieast one element. It is a1so necessary that the function G be continuous in o. This is a potential problem only at n i = O; by ensuring that X; In [Yi(X)XJ = O for all i at Xi = 0, we ensure that G is continuous at X; = O. Then a soIution to the equilibrium problem exists. This follows froro a theorem in analysis known as lhe Weierstrass theorem (Hadley, 1964, p. 53). In addition to the existence of a solution, we are interested in the number of soIutions, that is, how many possible vectors o satisfy both the element-abundance constraints and the equilibrium conditions. This interest arises because nonuniqueness may occur in severa1 important situations. It is typically connected with incipient formation of a phase. A very simple illustration is provided by the system {(H 20(e), H 20(g»,(H, O)}, with b 1 = 2 and b2 = 1, at given T and P. There are three possibilities. At the given T, if P < p*, the unique solution is (n l , n 2 l = (O, Il; if P > p*~ the unique solution is (n 1, n 2 )T = (l.Ol; at P = p*, the solution is not unique, and any (n l , n 2 f satisfying n l + n 2 = 1 (n;;:';;:' O) is valido The same type of situation can occur in more complicated multiphase situations involving at Ieast one multispecies phase. The basic reason for the possibility of nonunique soIutions lies in the manner in which we have posed the equilibrium problem-in terros of (exten. sive) mole numbers, in addition to the two intensive parameters T and P. For the case of a system consisting of a single ideaI-solution phase, the chemical equilibrium problero has a unique solution, a proof of which statement follows. A sufficient condition for uniqueness is that G be a strictly convex function of o, subject to. the constraints. Then the Kuhn-Tucker conditions are sufficient as well as necessary. For a single phase, convexity thus depends on the quadratic form N
N
(
a2G
)
i~1 )~I anidn j ôniôn j ,
(3.9-1)
where a2 G /dn j dn j are the entries of a matrix called the Hessian matrix of G. Uniqueness is established if Q( 80) > for a11 allowable compositions o and nonvanishing variations 8n. From equation 3.7-15a, the entries of the Hessian
°
are given by 2
G
(
1)
a ôij - - , ---=RT onidn j ni n,
(3.9-2)
where Ôjj is the Kronecker delta function. Inserting equation 3.9-2 into 3.9-1, we have
EXISTENCE AND UNIQUENESS OF SOLUTIONS
Q(80) =
61
Existence and Uniqueness of Solutions
Q(ôo) RT
=~
ôn; _ n,
i=1
~ ( .~ ôn )2 ,
~ ni (ôn i
_
j
j=1
~j=l13nj)2
ni
1=1
n,
(3.9-3)
Since n i > O (which must be true, from our previous discussion), Q is positive unless the quantity in parentheses is zero for each i. In this latter case
'2.j=l ôn j
ôn i n;
(3.9-4)
nl
°
Since n; > O and on i =1= (for at least one i), the right side of equation 3.9-4 is nonzero. Multiplying equation 3.9-4 by akin i and summing over i, we have N
L ak;on; = ;=1
N
(
\ (
~ akin i } i=1
LN _ôn) J ; )=1
k = 1,2, ... ,C.
(3.9-5)
til
Since the lefl side of equation 3.9-5 is zero (from equation 2.2-2) and the second factor on the right side is nonzero, the first factor must be zero (for a11 k). However, this factor 1S b k (from equation 2.2-1) and cannot be zero for all k. As a result, Q can only be positive. For a single phase that is an ideal solution, the chemical equilibrium problem then has a unique solution (provided that existence is established). For a single phase that is a nonideal solution, we believe that the same result applies, but this has not yet been proved, as far as we are aware. For a multiphase ideal system, Hancock and Motzkin (1960) have found that uniqueness need not hold. This nonuniqueness is of a degenerate type since it is readily shown that G is convex for such a system. We call this nonuniqueness degenerate in the sense that on1y the reIative aroount of each phase is not unique, although the mole fractions of the species in each phase are unique (Shapiro and Shapley, 1965). When more than one phase is possible for a llonideal systero, it has been found that the Gibbs function may possess several local mínima; that is, G is not convex (Othmer, 1976; Ceram and Scriven, 1976; Heidemann, 1978; Gautam and Seider, 1979).
Chemical Thermodynamics and Equilibrium Conditions
74
(and the Henry convention), calculate (a) (b)
3.8
the standard chemical potential of the cadmium ion Cd2+ ; the standard chemical potential and the standard electrode potcntial on a molarity basis (the density of water is 0.9971 kg liter- I at 25°C).
Calculate the standard frce energy of formation of N 2 in water at 75°C, based on the Henry convention and the molality scale. Assume that the solubility of N 2 at a partial pressure of 1 atm corresponds to a mole fraction of 8.3 X 10- 6 (Prausnitz, 1969, p. 358).
3.9 The mean-ion activity coefficient y ± for H 2 S04 in water is 0.257 on the molality scale (Henry convention) at 25°C and m = 6.0 (Robinson and Stokes, 1965, p. 477). Calculate the value on (a) the molarity scale (Henry convention) and (b) the mole fraction scale (Henry convention). The density of the 6-m solution is 1.273 kg liter- I , and that of water is 0.9971 at 25°C. 3.10 Suppose that it is desired to work in terms of T and Vas independent variables, rather than in terms of T and P, as in most of Chapter 3. What are the equations corresponding to equations 3.2-10 to 3.2-17, 3.3-1,3.4-1 to 3.4-5,3.5-1 to 3.5-4,3.7-12, 3.7-15a, and 3.7-29? 3.11
Show that a2 G/a~2 is positive definite for a single ideal-solutíon phasc; that is, show that Q( ô~) corresponding to equatioil 3.9-1 is positive for all ô~ =1= O.
___
CHAP1~ER
FOUR
_
Computation of Chemical Equilibrium for Relatively
Simple Systems We are now in a position to consider actual examples of equilibrium analysis, having developed lhe equilibrium conditions in Chapter 3 in terms of two formulations, examined the nature of the constraints, and introduced expressions for the chemical potentia!. We develop algorithms for the two formulations for relatively simple systems prior to the development of general-purpose algorithms in later chapters. Initially we define a relatively simple sysicm and then comment on factors that affeet the choice of formulation to use. We subsequently develop first lhe stoichiornetric formulation and then the nonstoichiometric formulation, in special forms applicable to such systems. Each approach is iHustrated by examples. For these examples, T and Pare fixed, and we defer consideration of the effect of changes in T and/or P to Chapter 8.
4.1
RELATIVELY SIMPLE SYSTEMS AND THEIR TREATMENT
For the purpose of this chapter, a relatively simple system consists of a síngle phase that is an ideal solution of two or more species (including the case of an ideal-gas solution) and involves a relatively small number 1\1 of elements or a relatively small difference (N - M) between the number of species and the number of elements. [We continue to assume in this chapter, for convenience, that I\t! = rank (A) == c.] These restrictions are related to the means by which the calculations are actually performed-by "hand" (i.e., by means of a nonprogrammable caiculator or graphically), by means of a programmable calculator, or by means of a small computer. The devices used are then
75
76
Computation of Otemical Equilibrium for Relatively Simple Systems
characterized by having either no storage memory or a memory of a size of up to perhaps 64K bytes. Recent developments in both programmable calculators and in computers have meant that the difference between a calculator and a computer has narrowed, resulting in an almost continuous spectrum of capability, fram the smaUest programmable calculator to the largest mainframe computer. More precisely, in terms of M and .N, a relatively simple system is characterized by relatively small values of N M and M( N - M); the latter is a measure of the size of the matrix that must be manipulated in the stoichiometfic formulation (i.e., a measure of the size of the computer memory required), and the former is a similar measure for the nonstoichiometric formulation. Consideration of relatively complex systems involving nonideality, more than one phase, and relatively large values of NM or M(N - M) requires more storage than is available on many small machines, and we defer discussion of such systems to later chapters; which describe general-purpose algorithms for use with large computers. In the examples given in this chapter we illustrate three leveis of increasing problem complexity, along with corresponding leveIs of computational capability. The most prinútive of the latter, by hand, involves values of M or (N - M) of 1 or 2; that is, we consider systems for hand calculation to consist 01' two nonlinear equations at most, for the solution of which the NewtonRaphson or another procedure can be used (Ralston and Rabinowitz, 1978, Chapter 8). Recent development.s in programmable calculators alIow a significant increase in the size of system that can be considered relative to that for calclliation by hand. We use an HP-41C calculator for this purpose and in Appendix B presenl algorithms for both stoichiometric and nonstoicillometric formulations of lhe equilibrium problem. Finally, recent developments in small computers allow a further increase in the size of system that can be consídered simple. In Appendix B, we also present algorithms written in BASIC for each of the two problem formulations.
Stoichiometric Fonnulation for Relatively Simple Systems
4.3 STOICHIOMETRIC FORMULATION FOR RELATIVELY SIMPLE SYSTEMS 4.3.1
System Involving One Stoichiometric Equation (R
REMARKS ON CHOICE OF FORMULATION
The simplest case for the stoichiometric formulation is when there is only one stoichiometric equation (R = 1), which i5 the case when (N - M) = 1. The simplest case for the nonstoichiometric formulation is when there is only one elernent (M = 1). These simplest cases illustrate the determining characteristics for relatively smal! systems for the two formulations. Comparison of (N - M) with M is a useful guide as to which formulation to use for a reIatively simple system. For the stoichiometric case to be preferred, (N - M) is smaller, and for the nonstoichiometric case to be preferred, M is smaller. More precise1y, if (N - M) < M (N < 2M), the stoichiometric formulation is preferable; if (N - AI) > M (N > 2 M), lhe nonstoichiometric formulation i5 preferable.
= 1)
We consider first the simplest case of a system lhal can be represented by one stoichiometric equation to illustrate the stoichiometric approach, both numerically and graphically. The dissociation of hydrogen is used in the following paragraphs as an example of this situation. In general, for a system represented by the stoichiometric equation
~"iAi=O,
(2.3-8)
equation 2.3-1a relates n i to ~, the extent-of-reaction variable. Numerically, the solution is obtained froro equation 3.4-5, lhe equílibrium condition, and equation 2.3-1a, together with appropriate cherrucal potential expressions. The solution of equation 3.4-5 in terms of ~ provides the equilibrium value of ~, from which the composition can be calculated. Graphícally, the solution occurs at the minimum of the function G( ~), which is constructed from equations 3.4-1 and 2.3-1a, together with the chemical potential expressions. . Example 4.1 For the system {(H, H 2 ), (H)}, calculate the equilibrium composition at 4000 K and I atm (1) numericaHy, and (2) graphicaHy, if the system is composed initiaHy of an equimolar mixture of H and H 2 . At 4000 K, the standard free energy of formation of H is -15,480 J mole- 1 (Zwolinski et aI., 1974). So(ut;or;
Numerica/(v, the system may be represented by lhe stoichiometric
equation
H 2 = 2H 4.2
77
or
2H - H 2 = O.
Since H is species I and H 2 is species 2, v I criterion, from equation 3.4-5, is
(A)
= 2 and 112 = -- 1. The equilibrium
/l2 = 2~tl'
(B)
and equation 2.3-1 a applied to each species is nl=llf+2~,
n2 =
n~ -~_
(C) (D)
Ir we assume that the system is an ideai-gas soiution, so that the chemical
Computation of Chemical Equilibrium for Relatively Simple Systems
78
StoicbiometrícFormulatioll for Relatively Simple Systems
79
potential expression is given by equation 3.7-12a, then n
+ R T In -! + R T In P n
JL I = JL f
ok
(E)
I
t
and -20.000 o
J.L2 = JL2
I
T
R Tlnn2 n,
+ RTlnP.
(F) Q)
We also set nf = n~ = I. On substitution of equations C to F and the data (1L~ = -15,480; JL~ = O; R == 8.314; T = 4900 K; P = 1 atm) in equation B, we have the following equation for ~ at equilibrium: 2
(1 + 20 (1 - ~)(2 +~) = 2.537, fram which the relevant solution is ~ = 0.4345. This results in n I = 1.869 and n 2 = 0.565 moles; fram these, the composition, expressed in mole fractions, is XI = 0,768 and Xl = 0.232. Graph ically, the solution may be obtained by either minimizing G(~) or solving the nonlinear equation ÂGa) == LV;JL; == O. Here we illustrate the former, which is shown in Figure 4.1, a plot of Ga) against ~. Beginning with equation 3.2-16, G(~) is constructed as follows: G
= n l J1.J + n 2 JL2 = -15480 X
30960~
[(1- + 201n(1 +
+ 33257 2~)
+ (1
- ~)ln(1 -~) -(2 + ~)ln(2 + ~)].(H)
Figure 4.1 is a pIot of equation H and shows that G is a minimum at ~ = 0.434, which leads to essentially the same results as in the numerical solution (preceding paragraph). The minimum value of G is -72,800 J re1ative to the datum implied by the tJ.f values. 4.3.2
System Involving Two Stoichiometric Equations (R = 2)
We consider here only the graphical method of solution for a system represented by two stoichiometric equations. The numerical method should be implemented by the algorithm developed in the following section. As for R = I, we may consider either the minimization or the nonlinear equatíon point of view. For R = 2, the former involves finding the minimum point on a three-dimensional surface, and the latter involves finding the intersection of
:J
.2. -40,000
"'" (:;
-60,000
-72,800 --80,000
I
I
I -0.2
I
o
::c
11 0.2 0.4°.434 0.6
I 0.8
I 1.0
~
Figure 4.1 Graphical solution for Example 4.1 showing minimum in Ca) at equilibrium (point E).
two curves in the aI' ~2) plane. In Example 4.1 we used the minimization poim of view, and here we illustrate the use of the alternative. This graphical solution involves first establishing two nonlinear equations in ~ I and ~ l' the extents of reaction for the two stoichiometric equations, from the equilibrium criteria, the chemical potential expressions, and equation 2.3-la. We usethe system involving gaseous polymeric forms of carbon ai high temperature to illustraie the procedure. Example 4.2 For the system {(C j , C 2 , C 3 ), (C)}, calculate the equilibrium distribution of the three species at 4200 K and I atm, given that J.L0 / RT is 1.695 for C[ (species 1),1.119 for C 2 (species 2), and 0.171 for C 3 (species 3) (JANAF, 1971). Also assume that the system behaves as an ideal-gas solution. Solution The system may be represented by the following two stoicruometric equations with corresponding extent-of-reaction variables as indicated: 2C I = C 2 :
~l'
(A)
3C 1 = C 1 :
~2'
(B)
80
Computation oI Chemical Equílibrium for Relatively Simple Systems
Applyillg equation 2.3-1a and taking, for convenience, n~
= 3,
n~
81
Stoichiometric Formulation for Relatively Simple Systems
= n~ = O,
.
weh~e
n, = 3 -
2~1
- 3~2'
(C)
n 2 = ~1'
(D)
n 3 = ~2'
(E)
and
The equilibrium conditions, from equations A, B, and 3.4-5, are
~1
2JlI = J-Lz,
(F)
3JlI =J-L3·
(H)
Substituting chemical potential expressions for J-LI' J-Lz, and J-L3 from equation 3.7-12a into equations F and H, together with the use of equations C to E to eliminate n I' n2' n 3, and the use of the numerical data given and rearranging, we have (from equation F)
fIal;
~I(3 - ~I - 2~2) _ 9.689 (3 - 2~I - 3~2)2
~2) =
(J)
0.7
0.723
0.8
~2
=0,
Figure 4.2 Graphical solution for Example 4.2 showing equilibrium values of ~l and at point E.
~2
and from equation H
fi~l' ~2)
=
~2(J - ~l
-
2~2 )_~ _
(3 - 2~1 - 3~2)
136.18
(K)
4.3.3
= O. It is mathematically convenient to replace equation K by J/K (which is equivalent to replacing equation B by A - B or C 3 = C 1 + C 2 ). This results in
~1 (3 - 2~I - 3~2) _ 0.07115 - ~l - 2~2)
f{(~l' ~2) = ~2(3
ihe equilibrium mole fractions as a measure of the distribution are = 0.584." .
(L)
=0.
Values of ~l may be calculated from specified values of ~2 for each of equations J and L. Figure 4.2 is a pIot of the two sets of values of ~I against ~2' The solution lies at the intersection of the two curves, wh.ich then gives the equilibrium values of ~I and ~2' 0.315 and 0.723, respectively. From these,
XI
= 0.162,
x 2 = 0.254, and x 3
Stoichiometric Algorithm
To consider the general case of any number of stoíchiometric equations for relatively simple systems, we begin with the equilibrium conditions N
L
PiJJL/~) =
o;
j= 1,2, ... ,R:
(3.4-5)
;== I
From an estimate o(m) of the solution of equation 3.4-5, mole numbers at the next iteration are obtained by means of (see equation 2.3-1a) l1(m+1) i
= n(m J I
+ W(m)
R ""
~ j=1
v.. 8(:(m) IJ
~J
'
(4.3-1)
Computation of Chemical Equilibrium for RelativeJy Simple Systems
82
83
Stoicbiometric Formulation for Relatively Simple Systems
where d m ) is a positive step-size parameter, which is usually set to unity or less (see Section 5.4.1 for general discussion). Expanding equation 3.4-5 about n(m) in a Taylor series, neglecting the second- and higher-order terms, and setting the result to zero, we obtain the Newton-Raphson method (see Section 5.3.1 for general discussion). This gives R
N
N
(a
2: 2: 2: Vi) --.!2 1=lk=li=\ on k
)(m)( a )(m) ~ s~~m)
N
=
a~,
~ V.II(m l • LJ IJr, ,
i=1
j = 1,2, ... ,R,
(4.3-2)
where superscript (m) denotes evaluation at nem). For an ideal solution, we introduce the chemical potential expression from equation 3.7-15a, which is rewri t tco as IJ-.I = rI 11*
+ RT ln!!.i .
(4.3-3)
nr
From this. it follows that
1)
op.; (0ik -=RT -nr k i
on
n
(4.3-4)
'
where 8,,< is the Kronecker delta. Substituting equations 4.3-4 and 2.3-6 equation 4.3-2, we have
. ~ o~~ml( ,~-"
I
i.
: i= I
v/J"i! _ n~m)
iii, ) n(m)
r
N
(m)
VijJli
In
Suitabte
w lm l ?. . .
JÇ Yes
.
-2:~,
No
i:= I
j=1,2, ... ,R
~~
. 5 < 10-
B
N
= 2:
/
l:t.c.Gjl
);,:
(4.3-5)
where
~.
Make new estimate ofn \01
Vi)'
(4.3-6)
Figure 4.3
Flow chart for the stoichiometric algorithm for relatively simple solutions.
i=1
Equations 4.3-5 are solved for l)~(ml, and the resuli is used in equation 4.3-1 to determine o(m+ J). The procedure is repeated until convergence is attained. (This approach is essentially lhat suggested by Hutchison (1962), Stone (1966), and Bos and Meerschoek (1972).] A flow chart for this algorithm is given in Figure 4.3. Computer program listings for the HP-41C and in BASIC are provided in Appendix B.
Example 4.3 Calcula te the equilibrium mole numbers for the system {(C02 , N2 , H 2 0, CO, O 2 , NO, H]), (C H, O, N)} at 2200 K and 40 atm. resulting from the combustion of one mole of propane in air with the stoichiometric amount af oxygen (for complete combustion); assume that air consists of N 2 and 02 in a 4: 1 ratio. [This is· a simplified version of a problem originally considered by Damkohler and Edse (1943), in which the presence of the species H, O and OH is neglected here.]
Computation of Chemical Equilibrium for Relatively Simple Systems
84
Table 4.1
Summary of loput Data and Results for Example 4.3
Species
n{O)
O 2 O O O 2 2 1 O O I O O 2 O O O I I O 2 O O
-396.410 O -123.93 -302.65
2.0 19 1.5 \.0 0.75 2.0 2.5
1 O O I O
CO 2
N2
H 20
CO O2
NO H
Formula Vector
p,0, kJ mole-I
2
O 62.51 O
0(91
2.923 1.999 3.980 7.667 3.471 2.732 2.006
X 10 X X X X
1O~2
10-- 2 10- 2 10- 2
of the nonstoichiometric formulation in terms of the Lagrange multipliers, we use the case of N = 2. Then we consider a procedure for arbitrary N that can be generali2:ed to the numerical algorithm given in the following seetion. We note, however, that the computer programs of Appendix B.2 do not allow the case M = 1, although they could be suitably modified to do so. 4.4.1.1
Geometric lllustration for N
=2
Consider a system of species 1 and 2 involving one element. The problem is to minimize G(n l , n 2 ) = nlJLI
Solution The stoichiometric algorithm is appropriate in this case since N < 2M.. For illustration, we use the HP-41C program given in Appendix B. From the statement of the problem, b = (3,8, 1O,40f. We enter data and execute the program in accordance with the User's GuMe in Appendix B. A summary of the input data and the results is given in Table 4.1. We have ordered the species in column 1 in accordance with the note at the end of the User's Guide. The P.0 in column 3 is taken from JANAF (1971). The initial estimate 0(0) in column 4 has been arbitrarily set to satisfy b. The solution, obtained after nine iterations, is given in column 5. The dominant species are CO2 and H 20 as reaction products and N 2 as relatively inert. If the combuslion were indeed stoichiometrically complete, the amounts of these species wou]d be 3, 4, and 20, respectively.
Since N = 7 and rank (A) is 4, R= 3. The three chemical equations used by lhe algorithm are 2e02
2 3
COl + i N2 - co = NO, and -C02 + H 20 + CO = H 2 •
aGI RT for
-
2CO
these equations at n(9) is (-1.12 X
a1n l
(4.4-1)
(4.4-2)
b,
where b is the number of moles of the element in the (closed) system. The solution is obtained from equations 3.2-8 and 3.3-1, with dG
=
JL 1 dn
I
+ JL 2 dn 2 =
O,
(4.4-3)
from which dn 2 dn l
__
!!:.l fLz
(4.4-4 )
Since, fram equation 4.4-2, -~ a2
(4.4-5 )
it follows tha1, at equilibrium, 10- 7 , -
5.70 X
10- 8 ,
-1.20 X
fJ-l
= f.L2 (= À),
= 1)
We eonsider the simplest case of a system consisting of a single element to illustrate the minimization problem given in equation 3.5-1, subject to the constraints of equation 2.2-1. First, to provide geometric insight into lhe nature
(4.4-6)
a2
ai
4.4 NONSTOICHIOMETRIC FORMULATION FOR RELAT1VELY SIMPLE SYSTEMS System Consisting of ODe Element (M
+ a2n2 =
dn 2 dn]
IQ-8f.
4.4.1
+ n2JL2
at given T and P sueh that
= 02'
1
85
Nonstoichiometric FOrnlulation for Relatively Simple Systems
where the parameter li. has been introduced to represent the common fatio. These two equations can be rearranged as
= ajÀ,
(4.4-7)
JL2 = a 2/...,
(4.4-8)
JLI
which we reeognize as the equilibrium conditions of equation 3.5-3, with li. as the (single) Lagrange multiplier.
Computation of Otemical Equilibrium for Relatively Simple Systems
86
87
Nonstoichiometric Fonnulation for Relatively Simple Systems
The quantity dn 2 /d11 I in equation 4.4-4 is the slope of a tangent to the curve G = constant. Similarly, dn 2 /d11) in equation 4.4-5 is the slope of a tangent to the constraint (which is coincident with the constraint itself in this case). Equations 4.4-7 and 4.4-8 express the equality of these slopes. This condition, coupled with the requirement that the solution lie on the constraint, means that graphically the constraint itself must be tangent to a contour of constant G. For a linear constraint, the solution occurs graphically where the elementabundance constraint line (equation 4.4-2) is tangent to the G(n l , 112) surface (equation 4.4-1). This can be illustrated by constructing contours of fixed G values and showing tangency of one of the contours to the constraint line.
'3
2 1. 87 1
\
\
11 1
Example 4.4
Use the system described in Example 4.1 to illustrate the Lagrange multiplier method graphically. Solution
Equations 4.4-1 and 4.4-2 are, respectively,
G = 33257[11 l ln 11 1 + 11 2 1n 11 2 - 0.465511 1 - (/lI + /l2)ln(n,
+ 11 2 )], (A)
where G is in joules and 11 1 + 2/l 2 = 3,
(B)
based on a sy::;tem containing one mole of each species initially. The graphical construction is shown in Figure 4.4, wruch is a pIot of 11,(I1 H ) against nl11 H ,), showing the constraint line of equation B together with contours ofcónstant G calculated from equation A. Figure 4.4 shows the constraint line tangent to the coIÍtour G= -72,800 J at the equilibrium point E. The coordinates of this point are 11 1 = 1.87 and 11 2 = 0.56, in ~ssential agreement with the l'esult given in Example 4.1. The value of G at point E is consistent with lhe minimum value of G in Example 4.1.
o
0.56 112
Figure 4.4 Graphícal solution for Example 4.4; equilibrium is at poínt E,
Substituting equation 4.4-11 in equation 4.4-10 and summing equation 4.4-11. we have, respectively,
llt
iÀ - /17 ) = LN iexp ( -~
b
(4.4-·12)
i=1
4.4.1. 2
General C,!se (N
~
2)
and
Consider the general system for M= 1{(A j ,A 2 , .•• ,A N ), (A)}. The N+ 1 conditions at equilibrium fram equations 3.5-3 and 3.5-4 are j.tj
= iÀ;
i
= 1,2, ... ,N
(4.4-9) .
and N
~ i11 i
= b.
(4.4-10)
i=\
Using equation 3.7-15a for JLi in equation 4.4-9, we obtain
~
exp ( i A; : j ) = L
(4.4-13)
i=1
Equations 4.4-12 and 4.4-13 are two equations in the two unknowns A and 111" Since equation 4.4-13 contains only the unknown A, n r and the mole fractions of the species can be obtained by solving this equation and substituting the result in equations 4.4-12 and 4.4-11, respectively. The general prablem for M = 1 is thus equivalent to solving lhe single Nth-degree polynomial equation IV
nj
= n rexp (
p.1 ) . RT .,
iÀ -
i = 1,2, .. . ,N.
(4.4-11)
~ LJ
i=l
aiz -- 1-0 1 --- -., I
(4.4-14)
Computation of Chemical Equilibrium for Relatively Simple Systems
88
where
89
Nonstoichiometric Fonnulation ror Relative!y Simple Systems
iuto the first equilibrium condition M
-p-j ) = exp (, RT
ai
(4.4-15)
P-i -
~ a,j\k = 0;
i = 1,2, .. . ,N.
(3.5-3)
k=1
and
z = exp
(:r).
(4.4-16)
This results in M
n·I = n t o' i II lzu/,.'
From Descartes's mIe of signs (Wilf, 1962, p. 94), equations 4.4-14 has a
unique, positive, real root. Example 4.5 Repeat Example 4.2, using the nonstoiehiometric fOfffiulation and the Lagrange multiplier method.
(4.4-18)
where Zl
The solution involves the polynomial equation of degree 3 given by equation 4.4-14, whieh, on substitution of the data given in Example 4.2, becames
i = 1,2, ... ,N.
1=1
= exp (
:~ ),
(4.4-19)
Solut;on
0'.1836exp
(R~) + 0.3266[exp (:T)
r
+
0.8428[exp
(:r)
r-I
=
and we have replaced lhe dummy index k by I to avoid two dummy indices in the following equation being denoted by the same symbol. We substitute equation 4.4-18 into the second equilibrium condition, equation 3.5-4, to give
o. N'
This equatíon may be solved analytically or graphically. The result is XI RT = - 0.123. The mole fractions calculated from tlús result, with the use of equation 4.4-11, are XI = 0.162, x 2 = 0.255, and X 3 = 0.583, essentially the same as in Example 4.2.
M
n l ~ akioi 1=1
TI
Zflt = b k ;
k
= 1,2•... ,M,
(4.4-20)
I--:=.)
where lhe sum to N' exc1udes inert specíes.* The total number of moles is
In cases where not all speeies Ai are present in the system, equation 4.4-14 beeornes
N'
2:
n1 =
nj
+ n;;,
(4.4-21)
i= I
N
"~ a.za,; - 1 1
=O
,
(4.4-17)
i== I
where n;; is lhe total number of moles of inert species, Substituting equation 4.4-18 into equation 4.4-21, we obtain
where a li is the subscript to species Ai (i.e" its formula vector) and N is the number of species present. In equation 4.4-11, iÀ is replaced by aliÀ. 4.4.2
NODstoichiometric Algorithm
In this section we deseribe aD algorithm for the eomputation of equilibrium in a system consisting of a single phase that is an ideal solution, based on the minimizatíon problem stated in Section 3.5, for whieh the solution is given in general by equations 3.5-3 and 3.5-4. For an ideal solution, we introduce the appropriate chemical potential expression (equation 3.7-15a), wriUen as /Li
n· = JLi* + RT In ---.!., n(
N'
n( ( 1 -
(4.3-3)
FIOm equation 4.4-20, with k
=
1=1
i=l
)
z?
= nz-
(4.4-22)
1=1
1 and b 1 =t= O,
N'
2:
M
.2: Oi fi
M
al/JI
b
TI zft' = --;;1 1=1
(4.4-23 )
t
*Henceforth we frequently distinguish reacting species from inert species in order to reàuce the number ()f nonlinear equations that must be solved. The number of reacting species is r,'" (cf- i\', the totai number of species, induding inert species).
90
Computation of Oremical Equitibrium for Relatively Simple Systems
or
We combine equations 4.4··20 and 4.4-23 to eliminate n t : N'
M
N'
i
L f3
k
1=1
k = 2,3, ... ,M,
(4.4-24)
IlOt', =
ki o i
i= \
1=1
i=)
M
S'
M
L ak/J TI z,/i = r L aliai II z,li; i=1
(), =
'k
=
•
b":'
= 2,3, ... ,M.
k
1,2, ... ,M
(4.4-33 )
(4.4-34)
and (4.4-25)
,\,(
II "'/, ~rl
Zl
Similarly, equations 4.4-22 and 4.4-23 yield
(4.4-35)
1=2
where
M
L 0/(1 + r1a II zf/ li )
= 1,
(4.4-26)
(X"
f=J
i=\
=
1=2,3 .... ,M
Z"
O1--
N'
k
0kl'
1= I
where
where bk
91
NonsloichiometTic Formulalion for Relatively Simpte Sys1ems
1 = 2,3, ... ,M
= f31i ;
(4.4-36 )
and
where
nz
(Xli
=b;'
rI
(4.4-27)
Finally, equations 4.4-24 and 4.4-26 may be written as N'
L f3
TI z[', = 0k\;
k
= 1,2, ... ,M,
_
Il[ -
(4.4-28)
-~N'
h)
.. ' (4.4-_,8,
_
k.1=lalixi
f= I
i-= I
(4.4-37)
Henc~ we need store only the (3 matrix and the ali 's. lf desired, lhe total nllmber of molescan be determined from equation 4.4-23, which can be written, together with eqllation 4.4-18. as
M
ki oi
= ali'
The mole fractions are determined from the solution af equation 4.4-33 and
where
Ai
f3 li = 1 + rla li ,
(4.4-29)
XI
= ai Il zf/'
(4.4-39)
I=l
/3 ki = G ki
-
'kali;
k
= 2,3, ... ,M.
(4.4-30)
Equations (4.4-28) are M equations in the M unknown z's (or À's). These equations have been considered previously by Brinkley (1966), White (1967), and Vonka and Holub (1971), except that they did not incorporate inert species. Equations 4.4-28 require storage of both ali and f31i ar recalculation of one fram lhe other at each ileration. For better efficiency, we use only /3// by transforming ali into f3'i fIom equation 4.4-30: ali
= f31i + ',ali;
1= 2,3, ... ,M.
(4.4-31)
The Newton-Raphson method (see Section 5.3.1 for general discussion) for solving equations 4.4-33 for In O, (we use In 0I to ensure that fJ, remains positive) is given by
~. (~) aIn O, ,
1= I
In Bfm+ I)
o(lnO,)(ml
M
(
M
;~l f3 ki o; ,g2 zfu. ZI,g2 z?
)
= L 2, ... , M' ,
( 4 .4-40)
m=O,I,2 •....
(4.4-41)
k
where equation 4.4-33 has been written as f = O, and w is a step-size parameter. From equation 4.4-33, we obtain
ai:,
M
,'V'
';""1
,v'
-!k;
= In 0;111) + (,P,,) o(ln 81f"l;
aInO- = L
Substituting this result into equation 4.4-28 and rearranging, we have
=
6('''1
{3k,a/i(Jj
,Il 0/,"
,=\
X'
ali
= °"1'
(4.4-32)
l: /=-1
{3k,Ci.!t X i·
(4.4-42)
92
Computation of Chemical Equilibrium for Relatively Simple Systems
A flow chart for this algorithm is given in Figure 4.5. Computer program listings for the HP-41 C and in BASIC are provided in Appendix B. We illustrate tbis procedure first by a very simple system involving only two elements, to show explicitly the structure of equations 4.4-33. We then present a more complex example to illustrate the use of the BASIC computer program in Appendix B.
Example 4.6 Calculate the fraction of S02 converte
The system is represented by b
{(02,S02,S03)' (S,O)}; a l2
ali
A = ( a 2)
b2
b)
Choose M species with smallest p. and linearly independent ai
i
)=(o2
~)
1
2
= /3 12 = /3 13 = I /32 1 = a 21 - '2all = 2 -
/3)1
= a22 -
/322
/3 23 = a 23 (
Yes
a 13
a 23
a 22
= (1,4)T.
= 4
'2 = -
Xi> 100?
93
Nonstoichiometric Fonnulation for Relatively Simple Systems
Stop
4(1)
= -2
=2-
'2 a 13
= 3 - 4(1)
ai)
al2
an
(11
= exp (
(13
=2
r 2 a l2
a 21
(12
Make new estimate of M species
-
4(D)
a 13
a 23
(02
)
-J-t~ ) RT
=-
1
1
-
-2
~)
=1
)
= exp ( ~i = 1.5826 X
10
17
)
= exp ( ~1 = 1.0645 X 10 18
Equations 4.4-33 become, for k
= 1,
/3l1a/JfIIO{21
+
f3dJi1fI2(J{n
+ f3 13 (13(Jf 13fJ{23 = 1,
f32t o )fJ f IlO{21
+
f322(12fJfI2(J{22
+ f323(13(}'I13(Jf23 =
and for k = 2,
Inserting values in these two equations for
!I( 8), (J2)= Figure 4.5 systems.
f3ki' (1i'
(Ji + 1.5826 X 10 17fJ)O;2 +
Flow chart for the nonstoidúometric algoriLhm for relatively simple
= 0,
and
ali'
1.0645 X
O.
we have
10188)(J2-
1
-
1
(A)
94
Computation of Chemical Equilibrium for Relatively Simple Systems
and
h.«()\, (2 )
= 20!: - 2(1.5826 X 10 17 )0 102-
2 -
(B)
for k = I and k = 2, respectively. These two equations may be solved by means of one of the two nonstoichiometric computer programs in Appendix B, or graphical1y. For illustration, a graphical solution is shown in Figure 4.6, which is a pIot of 0I' calculated from each of equations A and B for assigned values of 2 , against 2 , The intersection provides the equilibrium values of 19 0l = 2.90 X 10- and 2 = 0.612. From these results and equation 4.4-39, the mole fractions are
°
°°
XI
=
Oi = 0.374,
X
=
(J201
X
2
3
2
°z -
-
°
(J3()1
95
From equation 4.4-38, n t = I j(x 2 + x 3 ) = 1.594. Thus the fraction of SOz converted at equilibrium is [l - 0.122(1.594)]/1 = 0.806.
1.0645 X 10 18 0 10;1
=0
Nonstoichiometric Formulation for Relativ·ely Simple Systems
Example 4.7 We reconsider the system described in Example 4.3, but now assume that N z is inert and that the species OH, H, and 0, previously neglected, are present. The first assumption means that the species NO is omitted. ENTER OEVICE NUMBER FOR PRINTING 61 ENTER NUMBER OF SPECIES ANO ELEMENTS: 8,3 TYPE OF CHEM. POTe :KJ, KCAL OR MU!RT ENTER 1, 2 OR 3 RESPECTIVELY 1
= O. 122 ,
HOW MANY SIGNIFICANT FIGURES? 8 ENTER SPECIES NAME
= 0.504.
C02
ENTER FORMULA VECTOR,CHEM POTENTIAL 4 NUMBERS 1,0,2,-396.41
2
ENTER SPECIES NAME CO ENTER FORMULA VECTOR,CHEM POTENTIAL 4 NUMBERS 1,0,1,-302.65 ENTER SPECIES NAME H20 ENTER FORMULA VECTOR,CHEM POTENTIAL 4 NUMBERS 0,2,1,-123.93 ENTER SPECIES NAME H2 ENTER FORMULA VECTOR,CHEM POTENTIAL 4 NUMBERS 0,2,0,0
~ Ol
Ó
ENTER SPECIES NAME 02 ENTER FORMULA VECTOR,CHEM POTENTIAL 4 NUMBERS 0,0,2,0 2
ENTER SPECIES NAME OH ENTER FORMULA VECTOR,CHEM POTENTIAL 4 NUMBERS 0,1,1,6.954 ENTER SPECIES NAME H
O' 0.3
!
1
11
- -
,
0.7
62
Figure 4.6
Graphical solution for Example 4.6.
I
ENTER FORMULA VECTOR,CHEM POTENTIAL 4 NUMBERS 0,1,0,94.81 Figur~ 4.7 Computer input display for Examp1e 4.7 with use of BASrC program in Appendix B.
L01
Two Oasses of Numerical Problem
5.1 TWO CLASSES OF NUMERICAL PROBLENI
CHAPTER FIVE
_
The approacnes we discuss for solving the chemical equilibrium problem involve consideration of two classesof numerical problem. These are (1) the minimization of a function f(x), perhaps subject to certainconstraints, and (2) the solution of a set of nonlinear algebraic or transcendental equations. Thus we wish to solve either
Survey of
Numerical Methods
minf(x),
(5.1-1)
= O,
(5.1-2)
xEO
or g(x)
I TI this chapter we provide some elementary background on numerical methods prior to considering the general-purpose algorithms discussed in Chapter 6. In Chapter 3 we provided an introduction to the two main approaches used throughout this book, the stoichiometric and the nonstoichiometric approaches, primarily from the thermodynamic point of view. In Chapter 4 we applied these to relative1y simple (ideal, single-phase) systems and for this purpose developed special-purpose algorithms to be used in conjunction with small computers. Numerous generaI-purpose algorithms have appeared in lhe literature relating te the solution of the chemical equilibrium problem, motivated by one of the two equivalent mathematical formulations described in Chapter 3 (cf. Smith, 1980a). Most of these algorithms can be classified as to whether they are methods for function minimization OI" for solving sets of nonlinear equations. In this chapter we outline some of the relations between these two types of method and some numerical ways of using them, as a prelude to detailed discussion of existing algorith.ms. We do not attempt to give an exhaustive discussion of such numerical methods. For example, we focus primarily 00 necessary conditions and consider only problems and approaches that are particularly appropriate to the formulations of the equilihrium problem discussed in Chapter 3. We also discuss only methods that use analytical expressions for first and second derivatives since these are usually readily available for chemical equilibrium problems. Recent treatments of general numerical aspects of optimization and nonlinear equations are given by, for example, Walsh (1975), Ralston and Rabinowitz (1978), Bazaraa and Shetty (1979), and Fletcher (1980). We believe that the general discussion given here is useful for two reasons: (1) it i5 important for an understanding of existing chemical equilibrium algorithms in terros of these general techniques; and (2) it should enable recognition of the basis of other equilibrium algorithms that may beencoun-
tered. 100
where ~ is a constraint set and g and x are N-vectors. In the following, we assume that f and g are twice continuously differentiable. Figure 5.1 shows the methods discussed in this chapter for solving these 1WO types Df problem. The numbers indicate the sections in which the various methods are treated, and the dashed lines indicate interrelationships or links, with precedence indicat.ed by arrows. There are five such links shown, indicated by the letters A, B, C, D, and E. Link A in Figure 5.1 reflects the fact that, when ~l = R N , the first-order necessary conditions for f(x) to take on a local minimum at x* are that x* satisfy the nonlinear equations df \I __--o ( _., dx J ~.... o
(5.1-3)*
Converse1y, if x* is a solution af equation 5.1-2, ít is also a solution af the minirnization problem N
2: g?(x*).
min
(s .1-4)
i=·' I
A sufficient condition for x* to be a local minimum of f is that eguation 5.1-3 holds and that the Hessian matrix (a 2//ax j dX i ) is positive definite at x*. At the outset we note that we cannot ül general solve such nonlinear problems in closed forro except in the simplest of special cases. However, the solution of sets of linear aigebraic equations on a digital computer is usuaHy a relatively straightforward task. Hence most numerical algorithms for solving nonlinear problems proceed by solving a sequence af problems whose degree of difficulty is no greater than that of solving sets of linear equations. Each step in this sequence is called an iteration. The sequence is usuaUy terminated *a/(lx is a colUllln vector with entoes a/ih,.
Minirnization Problems 0-0
....
.2·§ ~ @
~ ~:g~----.., I
ggc.
I I I I I
U::::l (V)
1lc .~ c
8 N
N LÓ
~ :õ
c
â;
c «)
L
.9--S ..... W
j~
·'E1
~
~ LÓ
I :
I
I
N
I
8
(.j
!ri
~
~ I II I I
t
"E
-------
00
t:o
.~
g
~
8 c
'o"
"O
LO
B
@
~ z
5.2
oS E
r/)
min j(x).
~
::s
(5.2-1 )
xER N
The constrained minimization problern that we consider is
Q>
I
min f(x),
I
I Ii I I
I
i!
(5.2-2)
xEQ
where the constraint set Q is defined by Q
j
102
(5.1-5)
MINIMIZATION PROBLEMS
! ri
"O
~
m =-0, 1,2, ... ,
We consider here the minimization of a functionj(x), where x E R N , perhaps subject to linear equality and nonnegativity constraints. In the absence of constraints, we have the unconstrained problem
Q)
a o
~
Li:
+ w(m) l)x(m);
Oi)
:::> LÓ
x(m)
'"" .8
z (§) ~
M Lei
c
<'oi
@
=
where m is an iteration indexo The scalar quantity w is calIed a step-size parameter, which determines the distance between successive iterations in the direction defined by l)x(m). Equation 5.1-5 is applied in general, and algorithms differ by the way in which l)x(m) is determined. We discuss ways of choosing w(m) [the so-calIed line-search algorithm (FIetcher, 1980, p. 17)] in Section 5.4. 1.
~ .;;: õcn
'"'" .~
L~g.\J olt i€'- ~5 -EE--------------- t .sE ~
o
o ~
@)
t. ~"O
~
r-- --------:-----
'tI
x(m+ I)
u
::::l
~~ I
~ @ I
Q)
E
::I ç;
'"
g
I
(.>
·C
~
.~
I I I
8o..
"@
:õ ~ a. c o
I
I r----~-----J
I
~E
~
ll :
E
f@
'c N
i
~.~"oo
e
'"
:;- -0 ....
*~ E~
l~ ~----, I o: E @ I I
(\/
~
:õ
~~
I
.g -g
L
a.
c o
.~
103
when the left and right sides of equation 5.1-2 agree to within some specified tolerance or the components of x change from iteration to iteration by less than some specífied srnall amount. The success of any such numerical algorithm depends on two main factors. The first is the complexity of each iteration (the amount ofcalculation that must be performed), and the second is the convergence properties of the algorithm (the number of iterations required). AIgorithms thus proceed from an initial estimate x(O) of a solution and calculate a sequence by means of
Q>
= {x :Ax = b,
XI
~
O} .
(5.2-3)
Here A is an M X N matrix and b ís an M-vector of real constants. In equation 5.1-5, ôx(m) is usualIy chosen at each iteration so that
df ( dw,m) )
w'.'~o i~'2:
N (
jf
aX i
)
ôx{m) ,'""
-,
(s .2-4)
unless (aj/ax;)x(mJ = O. An algorithm satisfying equation 5.2-4 is called a descent method. Different algorithms use different ways ofchoosing ôx(m), but alI have the commOil property that, once l)x(ml is chosen, the (positive)
104
Survey oI Numerical Methods
step-size parameter w(m) is chosen so thatf(x(m) + w(m) ôx(m») is smaller than f(x(m J). Equation 5.2-4 ensures that this is possible.
Minimization Problems
105
The necessary conditions that Q be a minimum with respect to x are
aQ = O;
5.2.1 5.2.1.1
An intuitively appealing choice of ôx(tn> is the vector along which f(x) decreases most rapidly at x(m). This is the gradient vector Vf, with entries af/'dx i • This choice of 8x(m) yields a first-order method usually called the gradient method (also referred to as the method of steepest descent or the first-variation method), which is defined by
The rate of change of f at 5.2-5 is
== 1,2, . .. ,N.
(5.2-8)
This yields
First-Order Method
ôx(m)
i
dX i
Unconstrained Minimization Methods
= - ( ax af ) x(m) == -
x(m)
(Vf)x(m l .
(5.2-5)
af ) ( -aX i
x(no)
N ( ali +.L - ) (xj j= I 3x a,x i
i
-
xjm l )
Equation 5.2-9 is a set of N linear equations in the N unknown elements af the vector ôx(m) == x - x(m). Thus the second-variation method i5 formally given by equation 5.1-5 with 8x(m)
== -
f2l )-1 .( ax 2
x(no} (
N
.L
i=1
(
af
)2
ÔX i x(m)'
(5.2-6)
This satisfies relation 5.2-4, unless we are at a value of x(m) that ma.kes the gradient vector vanish [in which case x(m) satisfies the first-order necessary conditions for a minimum]. Unfortunately, the gradient method can be quite slow to converge, especially near the minimum x*. The rcason for this is lhat the behavior of I near x* is determined largely by its second derivatives since the first derivatives become vanishingly small.
i=1,2, ... ,N.
(5.2-9)
in the direction defined by equations 5.1-5 and
( d:{m> ) w(m)=Q
== o;
x(no}
ai
(5.2-10)1<
OX ) x(no)'
where superscript ( - I) denotes a matrix inverse. The rate of change of f at x(m) in the direction defined by equations 5.1-5 and 5.2-10 is
(dJm) )w(m)~o
i~1 N
j;j ~a~il) (ai) (iJ~)~1 ,ax N
Id
f
dXj /
(5.2-11 )
ij
5.2.1.2 Second-Order Method \Ve may use information concerning second derivatives by approximating f near each x(m) by a quadratic function and then finding the minimurn of that approximation. This is sometimes called the second-variation method. The algorithm is based on minimizing the local quadratic approximation to f(x) at x(m), given by Q(x) =
j(x(~») + ~
;=1
(jL) aX i
x(m)
2
'-1 j.1 1-
ex; 'dxJ,
5.2.2 5.2.2.1
(Xi - xJm»
N ( +-1 2:N .L -'?Pj- )
where alI quantities OH lhe right side are evaluated at x(m). lf Lhe Hessían matrix is positive definite at x(m), the criterion of equation 5.2-4 is satisfied.
Constrained Minimization Methods Lagrange Multiplier Method
When the constraints on x are
(xi-x}m»)(xj-xjm»).
Ax=b
(5.2-7)
(I
X m
Here Q(x) is the quadratic function that agrees with the first two terros of the Taylor series expansion of f(x) about x(m).
(5.2-12)
(cf. equation 2.2-3), the classical method of Lagrange multipliers may be used (Walsh, 1975, p. 7), as was done in Chapter 3. (For simplicity, we assume tha! .0 2//0,,2 = (d/3x«(jf/oX)T)T
Survey of Numerical Methods
106
5.2.2.1.2
A is of fuH rank M.) We form the Lagrangian fUl1ction
t'.(x, A) = I(x)
+ k~1 À k M
(
bk
-
i~1 Akjx j N
Minimization Problems
)
(5.2-13)
107
Second-Order Method
A second-order method analogous to the second-variation method of equation 5.2-9 results when ôx(m) is determined from the (N + A1) linear equations
~
and then minimize e with respect to x, while ensuring that the constraints are satisfied. This results in the set of nonlinear equations
k= I
l\.(t)A ki
--
~ (~l àX aX
j= 1
j
j
oxjm)
=
x(nn
í~) àx; \
;i =
(5.2-19)
M
~ = ~- L aX
dX i
ae -
a,\
-
-
j
k=1
o;
=
AkjÀ k
i= 1,2,
,N )
(5.2-14)
N
b o
~ ~
A JOI x; = O;
j= 1,2,
,M.
N
~ A .ox(m)
~ j=1
Equations 5.2-14 correspond to link B in Figure 5.1. As in the case of unconstrained minirnization methods, there are first- and second-order implementations of the Lagrange multiplier method. 5.2.2.1.1
and
i=1
J
N
~ kJ
ar:: ) ( ax;
(!L) ax;
= -
5.2.2.2 x(m,.""",;
M
+ ~
N
À(;:') ~ AjiA kj =
k=l
i=1
k== I
l\i
~ Aji
(O
j=1
i
À(;I)A ki ;
= 1,2, ... ,N,
(5.2-15)
ai) ; a: Xl
==
b(m)
(I)
N A oA N A ~ À(m) ~ =~ ~ k ~ JI kl ~ JI ax o
00
=F b,
+ bo -
o
j=1
i=!
•
(5.2-20)
= b, -
bem). I'
1 = 1,2, ... ,M.
(5.2-21 )
Projection Methods
I
-'
(5.2-22)
where A is the matrix of the linear constraints of equation 5.2-12. For any vector y E R N , the direction defined by ôx(m)
= Pj!
(5.2-23)
satisfies
(5.2-17)
then equation 5.2-16 is modified to become M ~ k=l
A 1;.1 oox(m i
AP=O,
j= 1,2, ... ,M. (5.2-16)
x(m)
We have assumed here that x(m) satisfies the constraints of equation 5.2-12. Equations 5.2-16 ensure that x(m+I), as ultimately determined by equation 5.1-5, also satisfies these constraints. If the constraints are not satisfied at x(m), that is, if Ax(m)
o
1= 1,2, ... ,M
Projection methods (Walsh, 1975, pp. 146-148) are based on lhe use of an
where the Lagrange multipliers Nm) are determined by using equation 5.2-15 in conjunction with equation 5.2-12 to yield the set of M linear equations:
L
o·'
=
N X N matrix P, such that
M
xlm)
J
j=i
lf we use a fír~t-order method analogous to the gradient method employed in equation 5.2-5, we obtain
=
I;
Again, if equation 5.2-17 applies, equation 5.2-20 becomes
Hrst-Order Method
ox~mJ
1,2, ... ,N
x(-I)
b(m). J
'
j = 1,2, ... ,M.
Aox(m)
= O.
(5.2-24)
Thus, from equation 5.1-5, if x(m) satisfies the constraints, so also does x(m+l). The matrix P can be regarded as "projecting" the direction y onto the linear constraint set. Several choices are possible for y, including the right sides of equations 5.2-5 and 5.2-10. One way of obtaining the matrix P is by considering the first-order Lagrange multipiier method used in equations 5.2-15 and 5.2-16. These equations may be written in -vector-rnatrix fonu as
x(m}
(5.2-18)
ôx= -- V'f -+- AF >..
{5.2-25)
lOS
Survey of NumericaJ Methods
and
Nonlinear Equatioll Problems
that (AAT)À = A Vf,
Ih
=-
(1- AT(AAT)-IA)vf.
(5.2-27)
This way of determining l$x is a projection method since it satisfies equation 5.2-23, with
P = 1- AT(AAT)-I A
A~x
(5.2-26)
where, for ease of notation, we have dropped the iteration index m. Solving equation 5.2-26 for À and substituting the result in equation 5.2-25, we have
(5.2-28)
(m)
o~) Y = -Vf.
(a~)aI) _
= - i=l ~ 1Iij N
As in Chapter 2,
11;}
x("')
Constrained minimization problems may be converted to unconstrained problems in several ways (Walsh, 1975, Chapter 5), as indicated by link D in Figure 5.1. In the special case when the constraints are linear, as in equation 5.2-12, a linear transformation of variables may be used to obtain an uneonstrained problem. We have already explored the chemical implieations of such a transformation in Chapter 2 as it relates to chemieal stoichiometry and have deve10ped some prelimínary ideas for a "stoichiometric" algorithm in Chapter 3 and a special-purpose algorithm of this type in Chapter 4. Here we briefly review those results in relation to a general numerieal algorithm for minimizing a nonlinear function subject to á set of linear equality constraints, whieh we refer to as the method of stoichiometric elimination. The stoichiometric elimination technique focuses on a set of independent variables ~ related to x through the linear transformation
(aj
)
ÔX
.
j = 1,2, ... ,R.
x(ml'
j
(5.2-33)
denotes entry (i, j) of N. The seeond-order method sets
ô~(m)
Method of Conversion to Unconstrained Problem
N~~
(5.2-32)
(5.2-29)
The quantity P given by equation 5.2-28 may be used in conjunction with any direction y; with y given by ~uation 5.2-29, this method is called the gradient-projection method. Link C in Figure 5.1 reflects the way in which this projection method has been derived.
ôx =
= O.
Thus, from equation 5.1-5, if x(m) satisfies equation 5.2-12, so also does x(m+ I). The matrix N is arbitrary apart from equation 5.2-31 and may be redefined on each iteration, if required. However, a convenient way of forming N is first to choose a set of M linearly independent eolumns of A and then express the remaining R columns as a linear combination of these. Formation of this particular N matrix thus entails the solution of (N - M) sets of J1 linear algebraic equations. As before, we may employ either a first- or a second-order method for choosing the l$~ in equation 5.2-30. The first-order method sets
and
5.2.2.3
109
2 ) --I.
= _ 11 (
ae .
( af
Xl"') \
ao(;)
(5.2-34) x("'I'
The gradient veetor afj'à~ in equation 5.2-34 is expressed in terms of affax in equation 5.2-33. The Hessian matrix a2f/a~2 is related to a2fj'i3x 2 by
a2f
-- = • (:
d( d",}
N
~
"'-'
N
í.
a 21 )
)' (---_.k.J
k == 1 1=, J \
•
3x,:<1:\:/ !
11
1-' ki I)'
(5.2-35)
Equation 5.2-34 essentially entails the solution of a set of R = (N - M) linear equations on each iteration. This should be contrasted with the second-order Lagrange multiplier method described in Section 5.2.2, whieh requires the solution of a set of (N + M) linear equations in general.
(5.2-30)
5.3
NONLINEAR EQUATION PR,)BLEMS
and seeks to minimize f( Ü. The matrix N satisfies AN=O,
(5.2-31)
and has R = (N - M) linearly independent columns. Equation 5.2-31 ensures
As noted previously, the minimization problem is associated with the problem of solving sets of nonlinear equations. Here we first recapitulate various forms of these equations and then deseribe two methods for soIving sets of nonlinear equations.
no
Survey of Numerical Methods
The nonlinear equations associated with the unconstrained minimization of f(x) are
= o.
af àx
(5.3-1)
For the constrained minimization problem given by equations 5.2-2 and 5.2-12, if Lagrange multipliers are used to incorporate the constraints, we have the set of (N + M) nonlinear equations (cf. equation 5.2-14)
Equation 5.3-6 is identical to the second-variation method for minimizing f(x) when g(x) = Vf(x), as given by equation 5.2-9 (link E in Figure 5.1). The equivalence results frem the fact that the Hessian matrix of f appearing in equation 5.2-9 is identical to the lacobian matrix of g given by (ogT /3x),T appearing in equation 5.3-6. The Newton-Raphson method is a descent method for the objective funetion 1
N
~ g}(x).
="2
(5.3-7)
j=1
(5.3-2)
= b.
Ax
IH
S
= ox' aj }
ATÀ
Nonlinear Equation Problems
This is demonstrated by differentiation of equation 5.3-7 to yield
When the stoichiometric elimination technique is used to eliminate the constraints specified by equation 5.2-12, we have the set of nonlinear equations
aj = o.
~ ( d""m) ) .''''=0
~
1
UXJ
N
~
g}(x(I>I»)
~X(m) j
'\
,= I J= I
(5.3-3)
a~
(a)
N g (,,(1>1») ~ ~N ~ ~
=
J
~
.''''
o.
(5.3-8)
j:=:1
This may be written in. terms of the original x variables through lhe chain ruIe for differenüation to yield (cf. equation 5.2-33)
;~
NT
=
o.
(5.3-4)
Equation 5.3-8 allows us to choose the step-size parameter w(m) in equation 5.1-5 so as to minimize approximately S(x(m+ lI) at each iteration. We may aIso apply the Newton-Raphson method to the nonlinear equations 5.3-2. This yields (cf. equations 5.2-19 and 5.2-21)
As we have seen in Chapter 3, for chemicaI equilibrium problems, this yields the so-cailed classical forro of the chemical equilibrium conditions.
M N ~ A ~À(m) -~.
-'.J
1<=1
5.3.1
Newton-R~phson
I.
+ ~ .
j=
1
(agi) aX J
2: (aagi ) j=l \
Xj
úx)nJ) Xl""
(x. - x(ml); J
x(no
The resulling equations for ôx(m) lV
2
r
}-:=.:1
)
J
I
ôx(m)
J
x(no)
= ( : ; )x 1m ,
=
/11
~
-'.J j=l
-
Aôx(m l IJ
- J
"-
AA.(ml..
i = I,2,
,N
A
1= 1,2,
,,"1
k.r
k
'
(5.3-9) .
k=1
= b/ -
N ~
-'.J
I)
x(m l •
J
'
J=I
J
i
= 1,2, ... ,N.
which are used in conjunction with À(m+ Il
x(m)
x(m+
are
-gi(X
5.3.2 i = 1.2" .. ,N.
=
Nml
+ w(m) l)A.(m)
and
(5.3-5)
l
=X
~
(5.1-2)
The technique sets to zero the local linear approximation to g(x) at x( n1 l, I(ml(x), given by
•
a . _._1_. OX 3x
(
L.J
M
g(x) = O.
I
k
Method
The Newton-Raphson method (RaIston and Rabinowitz, 1978, p. 360) is one of the oldest and stíll most widely used numericaI techniques for solving the N nonlinear equations
1(n1l(x) = g.(x(n1l)
kJ
(5.3-6)
I)
= x(m)
+
w(m)
ôx(m).
Parameter-Variation l\1ethods
The general approach af parameter-variation methods has been or mterest recently in numerica! analysis (Raiston and Rabinowitz, 1978, p. 363). It
112
Suney of Numerkal Methods
attempts to solve a set of N nonlinear equations g(x) = O by introducing one or more auxiliary parameters a and then solvil1g the equations
h(x, a)
=O
(5.3-10)
at a sequence of values of a that approach zero. The parameters a must be incorporated in h in such a way that
h(x, O)
== g(x).
113
where J is the Jacobian matrix of g. Equation 5.3-18 is a matrix set of ordínary differentíalequations, which we can integrate from x( 0'(0») = x(O) to a = O along an appropriate path. This can be performed by using a computer algorithm for solving initial-value problems for ordinary differential equations. The value of x(O) is then the desired solution to g(x) = O. Another way of choosing h in equation 5.3-10 is to incorporate a single auxiliary parameter t and to write
(5.3-11 )
In the use of this method there are the two important questions of the choices of h and the sequence of a values. One possibility is to choose
h(x, a) = g(x) - a,
Step-Size Parameter and Convergence Criteria
g(x, t) = g(x) - tg(x(O»
(5.3.12)
agi dX J~}:N I ( axJ ( dt ) ~ tg,(x'O»); j
= g(x(O»,
(5.3-13)
h(x(O),
0'(0»
= O.
dx = Clt (5.3-14)
We then gradually change a to O through some sequence of values and at the same time solve the sequence of problems
h(x(m>,
a(m»
= O;
m = 1,2, ....
(5.3-15)
The plúlosophy of the method is that if O'(m+l) differs only slightly from O'(m\ the solutions x(m) and x(m+l) should also differ only slightly. Thus we might expect that x( nl l should be a good initial estimate of the solution of h(x(m+ ll • a(m+I)
= O.
(5.3-16)
One possibility for choosing the sequence {O'(nl)} is to regard equation 5.3-15 as defining x(a) and then to differentiate this equation to obtain the differential equation
N: } j= I
where
Ôik
(d g
_I
dXj
) ( - dX j dO'k
)
=ô.' ik'
i, k = 1.,2, ... •N,
(5.3-17)
T
aO'
= J-l(X),
(5.3-20)
tJ-lg(X(O».
(5.3-21)
We then integrate equation 5.3-21 [rom t = 1, where x(1) = x(ül, to t = O. The value of x(O) is 'lhe desired solution. In practice, these differential equation methods fail if the Jacobian matrix J(x) becomes singular at any stage of the integration. In that case, one must resort to additional techniques for computing a "path" of x values that terminates at the solution to the problem.
5.4 5.4.1
STEP-SIZE PARAMETER AND CONVERGENCE CRfTERIA Computation of the Step-Size Parameter
All the previous methods for minimization and for solving sets of nonlinear equations, except for the parameter-variation technique, involve computation of new values of x from current ones by means of x(m+
1)
=
x(m)
+ w(11I) ôx(ml,
(5.1-5)
where ôx(m) is deterrnined by the particular algorithm used and ",(111) is a positive step-size parameter. In this section we discuss the computation of ",(ml. If the problem can be posed in the form of a minimization problem for x of the forro
is the Kronecker delta. Equation 5.3-17 may be rewritten as
dX
i = 1,2•... ,N.
This may be rewritten as
= x(O) we have
where x(O) is arbitrarily chosen. At x
(5.3-19)
where x(O) is arbitrarily chosen. Differentiating equation 5.3-19 with respect to t, we have
and an initial value a(O)
= O,
(5.3-18)
minG(x),
(5.4-1)
Survey of Numericai Methods
114 m
a convenient way of choosing d ) is by finding the value of w that approximately minimizes G(x(m) + w ôx(nr» on each iteration. AlI minimization probIems are natural1y of the form of probIem 5.4-1, and we have seen that
Newton-Raphson method]. First, the value of
= 2:
gj2(X)
(5.4-2)
i=l
is a function whose minimum yields the solution of the nonlinear equations
g(x) = O.
dG) ( dw(m)
= ",(01)=0
~
-;=1
6x~m) < O,
( 3G )
3X i
x(m)
(5.4-4)
I
provided that 3GfaX =1= O. Equation 5.4-4 ensures that a positive value 01' w(m) in equation 5.1-5 can be found so that G(x em + 1)) < G(x(m»). Determination of the optimal step-size pararneter on each iteration is thus equivalent to the one··dimensional optimization problem minG(x(nl) ..,>0
+ w ÔX(I11».
(5.4-5)
In the solution of this problem, care must be taken that toa much computation time is not spent searching for the exact minimizing value of w. Usually it is preferable to determine this value onIy approximately and then proceed to the next iteration. Methods for solving this one-dimensional optimization problem are of two types. The first type brackets the minimum in smaller and smaller intervals. Techniques such as interval halving, golden-section search, and Fibonacci search may be used (Fletcher, 1980, pp. 25-29). These methods use values of G( ú») for comparison purposes only and do not use G( w) values explicitly. The second type fits G( ú») to a suitable low-order polynomial, whose minimum is then found analytically. For example, the paraboIa fitted to three values may be used. Davidon, as cited by Walsh (1975, pp. 97-101), fits a cubic polynomial to two points and the derivatives at these two points. We now discuss a very simple procedure, when w = 1 is known to provide an estimate of the optimum value [e.g., when ôx(m) is determined from the
i=1
aX i
ôxfnl)
(504-6)
",=1
is calculated. If this quantity is negative or zero, we assume lhat we have not passed the minimizing value of w, and we proceed to the next iteration, with w(m) = 1 in equation 5.1-5. If the quantity in equation 5.4-6 is positive, we set
(5.4-3)
Thus the determination of a step-size parameter is of general importance in the practical application of most of the numerical methods previously discussed. We have seen that the concept of a descent method is especially important since for such a method, G is a decreasing function of w(m) at x(m}; that is, the method yields ôx(m) satisfying
= ~ ( ?G )
( dG ) dw ",=1
N
G(x)
115
Step-Size ParaOleter and Conver.gence Criteria
w(m)
=
(dG/dwL=o . (dG/dwL=o -- (dG/dw)"'=l
(5.4-7)
Equatio115.4-7 ensures that O < w(m) < 1 since we assume that we have passed a minimum in G(w) at w = 1, and ôx(m) defines a descent method. This technique has been used with sóme success in a simple optimization algorithm (Smith and Missen, 1967) and is employed in the general-purpose computer programs given in Appendixes C and D. Final1y, if it is known that alI Xi of the solution of equation 5.4-1 are positive, we must a150 choose w to ensure that all Xi remain positive. A convenient way of doing this is to ensure that w satisfies ?)x(m)
w.ç max j,,;;,;.,;;;,N
{
1, - __ I -(I x~m)
-.+
(5.4·8)
where e is a small number (e.g., 0.01). 5.4.2
Convergence Criteria
The iterative procedure defined by equation 5.1-5 is ideally terminated when
I xjm)
- x:
l.ç e;
i = 1,2, ... ,N.
(5.4-9)
where x* is the solution and ê is some small positive number. Since x* is nol known, practical criteria are often chosen as one or more of the foilowing: max l";;;'i.,;;;,N
I ôximll.ç e,
(5.4-10)
IôxJm> \ .ç t:,
(5.4-11)
max 1 - - l<>;i";;;'N! x;m)
I
' a' , I \( ~ ~ J.çe l<>;I<>;N! dx,/x,""j max
(5.4-12 )
1I6
Survey of Numerical Metbods
and max l':;;'j':;;'N
I gj(x(m)) I~ e.
(5.4-13)
Criteria 5.4-10 and/or 5.4-11 may be used for both optimization and nonlinear equation problems. Criterion 5.4-11 is relevant only when it is known that x~m) =1= O. Criterion 5.4-12 is relevant to minimizing f(x) and criterion 5.4-13, to solving g(x) = O. In the programs presented in Appendixes B, C, and D, criteria 5.4-11 and 5.4-12 are used, with the former for non stoichiometríc algorithms and the latter for stoichíometric algoríthms.
CHAPTER SIX
_
Chemical Equilibrium Algorithms for Ideal Systems In Chapter 4 we developed special-pUfpose algorithrns for use on small computers to treat single-phase equílibrium problems for ideal systems with a relatively small number of specíes and eIements. For these problems. the chemical potential of each species is given by the ideal-solution form of equation 3.7-15a, which we rewFite as
_ J-ti*( T J-t, -• P)
+
/1 i RTln-.
(6.1-1)
/1{
In this chapter we díscuss general-purpose algorithms to treat problems wíth any number of phases, species. and elements. We continue to assume that equation 6.1-1 holds for each species. The quantity n I is the total number 01' moles in the phase in which species i i5 a constituent. Thus when a pbase contains only species t, the logarithmic term vanishes. Composition variables other than the mole fraction. whích is indicated in equation 6.1-1. can be used for an ideal solution. and we discuss this at the end of the chapter. ComputeI' programs for two sdected general-purpose algorithms developeà in this chapter are given in Appendixes C and O. In the literature sLlch algorithms have been applied primarily to equilibrium problems involving a single gas phase, with perhaps pUfe condensed phases also presenL Gas-phase reactors and metallurgical problems involving gases and condensed solids are examples of these situations. We derive alI the algorithms on the assumption that á solution to the equilibrium problem exists and is unique. We recall from Chapter 3 that. for ideal systems. this is guaranteed only in general in the case of problems consisting of one phase. Existence seldom presents practical difficulties. but the mathematical possibility of nonuniqueness can cause difficulties in the implementation of certain equilibríum algorithms, as can the nonnegativity constraints on the equilibrium mole numbers. In the ensuing discussion we occasionally refer lO these potential difficulties. but a complete discussion af them is postponed to Chaptcr 9. H7
118
Otemical Equilibrium Algoritbmsfor Ideal Systems
Reviews of equilibrium algorithms have been given by Zeleznik and Gordon (1968), Van Zeggeren and Storey (1970), Klein (1971), Holub and Vonka (1976), Seider et ai. (1980), and Smith (1980a, 1980b). We are concerned here primarily with a detailed criticaI analysis of the most important algorithms themselves and do not attempt an exhaustive review.
6.1
CLASSIFICATIONS OF ALGORIlBMS
Many algorithms for calculating chemical equilibrium have appeared in the literature. It is useful to classify them into groups with common characteristics to understand relations between them. Any such c1assification is, however, not unique, and in what follows we discuss algorithms in the context of four alternative classification schemes. 1 One broad way of c1assifying equilibrium algorithms fram a numerical
point of view is according to whether they are based on minimization methods or on methods for solving sets of nonlinear equations. This classification may sometimes be an artificial one, as we have seen in Chapter 5. 2 A second way of c1assifying algorithms is with respect to their incorpora tion of the element-abundance constraints and the equilibrium condi tions, as described in Chapters 2 and 3. Some algorithms satisfy the element-abundance constraínts at every iteration of the calculation and proceed to a solution of the equilibrium conditions. Conversely, some algorithms satisfy the equilibrium conditions at every iteration and proceed to a solution of the element-abundance constraints. Still other algorithms satisfy neither condition at each iteration and proceed to satisfy both simultaneously. This classification scheme has been sug gested by Johansen (1967). 3 A third classification scheme that has been used is equilibrium-constant methods versus free-energy-minimization methods. We believe that this classification is often misleading, and its use in the past has had the historical result of obscuring basic similarities between certain algo rithms. 4 Finally, as a fourth way, we may classify algorithms as to the particular way in which the element-abundance constraints are utilized in the calculations. As in Chapter 4, we refer to algorithms that elíminate these constraints by means of the technique discussed in Section 5.2.2.3 as stoichiometric algorithms. Such methods essentially treat the number of unknown independent variables as (N' - M). AIso, we refer to algo rithms that explicitiy utilize the element-abundance constraints in the forro of equation 2.2-3 as nonstoichiometric algorithms. For these algo rithms, the nurnber of variables is (N' + M), a1though for ideal systems,
119
Structul"e of Otaptcr
this number is usually effectively reduced to (lI! number of phases in the system.
+ 7T),
where rr is the
In summary, equilibrium algorithms can be examined from several points of view. This chapter is structured to focus on the fourth classification, but reference is also made to the others where appropriate. We have adopted the philosophy that, by taking various points of view into account and by studying the structures of some representative algorithms, we can better understal1d the basic features of any equilibrium algorithm.
6.2 STRUcrDRE OF CHAPTER The presentation in this chapter approximately parallels the disçussion of nurrierical methods in Chapter 5 and is outlined in Figure 6.1. We consider nonstoichiometric algorithms first (Section 6.3 as indicated) and then stoichio metric algorithms (Section 6.4). Within the former, and following the develop ment of Section 5.2.2 (on constrained minimization methods), we discuss first-order methods (Section .6.3.1) and then the Brinkley, NASA, and RAND algorithms, which are essentially variations of the same second-order method (Section 6.3.2); some other approaches are also mentioned (Section 6.3.3). Within the latter, and following lhe developrnent of Section 5.2.1 (on uncon
6.3 Nonstoichiometric algorithms
I
I I
6.3.1 First·order
I
1 Gradient --~ projection
I I
I
6.3.2 Second-order
I
2 Nonlinear gradient
projection
I
6.3.3 Other
l--~
1 RANO* -ooE- ~ 2 Brinkley--olE--::O- 3 NASA
6.4. Stoichiometric algorithms
I I
6.4.2 First-order
I
I
I
6.4.3 Second-order
I
6.4.4 Optimized stoichiometry
I
VCS' "Genera!-purpose a!gorithms for which computer programs are given in Appendices C and D.
Figure 6.1
Chem.icai equilihrium algoríthms.
no
Chemical Equilibrium Algoritluns for Ideal Systems
strained minimization methods), we also discuss first- and second-order meth ods (Sections 6.4.2 and 6.4.3); an important method reIated to the second-order method is developed separately using the concept of optimized stoichiometry (Section 6.4.4). We derive alI the algorithms primarily in the case of a single ideal-solution phase and indicate any extensions required to treat other types of problems.
1
121
Nonstoichiometric Algorithms
Since the constraint equations are now nonlinear, the gradient-projection method ís not strictly applicable. However., if we use the local linear Taylor series approximation to the constraints, we obtain, assumíng that y(m) salisfies equation 6.3-4, N
2: akin~m) ~y/m)
k = 1,2, ... ,M.
= O;
(6.3-5 )
i=l
6.3
NON8TOICHIOMETRIC ALGORITHMS
6.3.1
We can utilize the gradient-projection method for minimizing G( ôy) subject to the linear constraints of equation 6.3-5, which may be expressed in the form
First-Order Algorithms.
AD(m)ôy(m)
6.3.1.1
= 0,
(6.3-6)
Gradient Projection
The gradient-projection algorithm resulls from equation 5.2-23. Mole-number changes [rom a given estirnate n(m) are computed by means of 6n(m)
n(m+l)
= _P ( -aG)
an
=
n(m)
= _pp(rn\
(6.3-1)
(6.3-2)
The projection matrix P is given by
P = 1·- AT(AAT)-I A .
(5.2-28)
lt is assumed that n(m) satisfies lhe element-abundance constraints; equations 6.3-1 and 6.3-2 are used iteratively to minimize lhe Gibbs function of the system. This method has not appeared in the literature, allhough it has some useful computational features. For exampIe, onIy a single matrix inversion is required (in equation 5.2-28), which need be performed only once at the beginning of thealgorithm.
6.3.1. 2 Nonlinear Gradient Projection A related first-order algorithm has been proposed by Storey and Van Zeggeren (1964). The nonnegativity constraints on the mole numbers are incorporated by means of the logarithmic transformation
Yi = In n j •
(6.3-3)
This results in the transformed problem minG(Y),
such that N j=l
6y(m)
= _ p( aG ) \ ay
n(m)
+ w(m)6n(m).
~ akiexp(y;) = b k ;
where D(m) is the diagonal matrix with entries n~m). The resulting algorithm computes changes to y(m) by means of
k = 1,2, ... ,M.
(6.3-4)
= ._ PDp.(m),
(6.3-7)
y(m)
where we have omitted the superscript (m) on P and D for ease of notation. The projection matrix P, which must be recalculated on each iteration. results from replacing A in equation 5.2-28 by AD, thus yielding (
P = I - DTAT(ADDTAT)-lAD.
(6.3-8)
Storey and Van Zeggeren (1964) originally derived the preceding algorithm (equations 6.3-7 and 6.3-8) in a quite different manner. We can see lhe connection with their approach by considering the Lagrange multiplier formu lation of the gradient-projéction algorithm discussed in Section 5.2.2. V'h first define Lagrange multipliers i\ by means of the linear equations (cf. cquation 5.2-26) ADDTATÀ
= AD 2p.(m).
(6.3-9)
Then we set (cf. equation 5.2-25) õy(m)
= - Dp.(m) +
D 1A,T À.
(6.3-10)
Equations 6.3-9 and 6.3-10 are the working equations used by Storey and Van Zeggeren (1964). They are simply a minor rearrangement af equations 6.3-7 and 6.3-8. One practical difficulty with the preceding method is that the satisfaction ofl the element-abundance constraints oí equation 6.3-4 tends to deteriorate as th iterations proceed, uniess the step-size parameter w is very smal!. It is dear from lhe derivation that this is a consequence af lhe linear approximation t
l
122
Chemical Equilibrium Algoritluns for Ideal Systems
the nonlinear constraints. This "drifting" phenomenon may also occur to a minor extent in the use of the gradient-projection algorithm in equation 6.3-1. However, in that case the drifting oeeurs solely due to the accumulation of computer rounding errors. The drifting phenomenon may be alleviated by using the modification discussed in Section 5.2.2.1.1. Equation 6.3-7 then becomes
123
Nonstoichiometric Algorithms
The equilibrium conditions (equation 3.5-3), with the ideal-solution chemi cal potential incorporated, are
Itr + In n
RT
I
- In n. •
M
~ t:.J
.1.
'fI;
a k1.:::: O·'
i
= 1.2 .... ,N',
(6.3-14)
k=\
where ôy(m)
= - PDp.(m) + pem)DTAT(ADDTAT) -\ ôb,
(6.3-11)
'A k 1J;k:::: RT'
(6.3-15)
where ôb
=b -
Anem );
(6.3-12)
Equations 6.3-14 are linear in the logarithms of the mole numbers n j and the logarithm of the total number of moles n I ' where
f3 is an additional step-size parameter, which is usually set to unity. An approach equivalent to that of equation 6.3-11 was proposed by Storey and Van Zeggeren (1970). This modification may a1so be applied to equation 6.3-1 to minimize the effeets of eomputer rounding errors. Equation 6.3-1 then becomes
N'
n(= 2:n j
+ n ;;.
(4.4-21 )
i=1
In contrast to this, equation 4.4-21 and the element-abundance constraints N'
ôn(m)
= - Pp,(f>1) + f3(m)AT (AAT ) -\ ôb.
2:
(6.3-13)
We note tha! equations 6.3-] 1 and 6.3-13 in principie permit the use of initial-s01ution estimates n(O) that do not satisfy the element-abundance con straints. We remark in passing that these projection methods can also be viewed as types of stoichiometric techniques, which we discuss in detail in Section 6.4. This is due to the fact that the projection matrix used in each case can be viewed as a stoichiometric matrix. Thus, for P defined in equation 5.2-28, AP vanishes. We recall fram Chapter 2 that th.is means that the columns of Pare stoichiometric vectors. However, P is not a complete stoichiometric matrix since the number of columns N is larger than R = (N - M). We finally note that the two algorithms discussed in this section make no special assumptions as to the algebraic form of p.. Thus they can also be utilized for nonideal systems (Chapter 7).
akjn j -
b k = O;
k:=. 1,2, ... ,M.
(6.3-16)
i=\
are linear in n; and n I' The three variations (Brinkley, NASA, and RAND) of the basi.c algorithm discussed in this section differ essentially only in the way in which they numerically treat lhe mole-number variables. The RAND version uses n, as variables, and employs the Newton-Raphson method on equations 6.3-14. 4.4-21, and 6.3-16. which is equivalent to linearizing the logarithmic tcrms in equation 6.3-14. The Brinkley and NASA versions use In 11; as variab1es and employ the Newton-Raphson method on the same set of equations, which is equivalent to linearizíng the resulting exponential terms in equations 4.4-21 and 6.3-16 (cf. Section 6.3.1.2). We discuss the RAND variation first and then the Brinkley and NASA variations and show how all three algorithms are intimately related. We emphasize that in lhe fol1owing discussion we explicitly include the possibility of inert species through equation 4.4-21. This has not previously been considered in the literature, although Apse (1965) discussed their effect 00 the RAND variation of the algorithm.
6.3.2 Second-Order Algorithms-the BrinkIey-NASA-RAND (BNR) Algorithm
6.3.1.1
We consider here the nonstoichiometric formulation (discussed in Chapter 3) on which the Brinkley algorithm (Brinkley, 1947), the NASA algorithm (Huff ct aI., 1951), and the RAND algorithm (White et aL, 1958) are based. This views the problem as one of solving a set of nonlinear equations.
We consider problems consisting of a single multispecies phase first and theu generalize to multiphase problems. At the outset we allow the phase to be nonidear and then show the simpiifícations that ide;ility introduces. Lineariza tion of equation 3.5-3 about an arbitrary estimate of the solutiün (n(m), l/J(m))
The RA ND Varwtion
124
Chemical Equilibrium Algoritluns for Ideal
S~'stems
yidds, after rearrangement, ]
(d~ )
N'
RT.L
-_
;=!
j
M
(m)
dn.
+
on j
n(m)
M
L akiO\h(m)_~_ - RT 2: k=1 (m)
k=!
(m).
akil/J k
•
125
Nonstoicltiometric Algorithms
to be solved on each iteration of the procedure may be reduced f roro (N' + M) to (M + I) byeliminating the variables ~n(m) in equatiolls 6.3-17 and6.3-2ü. This can be done because of the special form of equatiol1 6.1-1. Thus equation 6.1-1 gives 1 (dJ.1.j)
an
RT i = 1,2, ... ,N',
Oj} _ . _
nj
j
(6.3-23)
n[
(6.3-17) where ôíj is the Kronecker delta. Substitution of equation 6.3-23 in 6.3-17 allows ôn(m) to be obtained explicitly in terms 01' tJ; in equation 6.3-18:
where
olj;i
m
)
l/Jk -lj;k m }
=
(6.3-18) on(m)
and
j
on(m) j
= n. j
n(m) j'
(6.3-19)
= n;m) (
M
+
~T
u -
;
j = 1,2, ... ,N', (6.3-24)
where the additional variable u is defined by LN~ on(.m} j-I
j
Orl(m) .- __ 1
u=-~=
n[
(6.3-25)
n(m) I
Substitution of equation 6.3-24 in 6.3-20 yields the M linear equations
N'
"
akj""k
k= I
As before, superscript (m) denotes evaluation at (n(m), lj;(m)). The quantities n and n(m) are related through the element-abundance constraints (equation 6.3-16) by
.:;,. j-=-l
ii(m) )
~
a kj.on(m) = bk j
b(m).
k = 1,2, ... ,M,
k,
(6.3-20)
"
M ( .:;,.
i=l
where
N' "a. a. nem) .:;,. Ik jk k
k=1
N'
k
= ..... )'
a
kj
n(m).
j
k
,
= I,2, ... ,M.
.I,.
'1',
+ ],(m)u V
j
.
(m)
" a n(m)~ ~ jk k RT
lV'
b(m)
1
+ bj - bem). ) ,
j:::: 1,2 .... ,M.
(6.3-26)
k=1
(6.3-21)
j=1
Equations 6.3-17 and 6.3-20 are a set of (N' + M) linear equations in the unknowns ôn(m) and ~I/;(m). These linear equations are solved, and new estimates of (u, tJ;) are obtained from lj;(m+ I)
=
'lj;(m)
+
w(m)~1f;(m}
A further equation is obtained by using equation 6.3-25 and summing equation 6.3-24 over i to give
LM i=-~
(6.3-22)
Ó~m)l/Ji
-
nzu
=
I
N' "
~
(m)
(m)!!:.L
nk
RT
(6.3-27)
k ""-o!
Each iteration of the RAND algorithm consists of soiving the set of + I) linear equations 6.3-26 and 6.3-27 and using equation 6.3-24 to determine 13o(m). The values of o used 011 the next iteration are obtained from
and
(M n(m+ I)
=
n(m)
+ w(m)~n(m).
(6.3-2) n(m+ I)
The process is then repeated, using these new solution estimates until conver gence is achieved. The usual working equations of the RAND algorithm in the literature are those for an ideal solution, although the preceding description applies to nonideal systems in general. For ideal systems, the number of linear equations
=
n(m)
+
w(m)~n(m),
(6.3-2)
where w is a step-size parameter. Several minor modificaüons of the RAND algorithm appear in the litera ture. Although we have derived it as a method for soIving nonlinearequations, it was originaHy formulated (White ei aI., 1958) as a second-variation method
126
Chemical Equilibrium Algorithms for Ideal Systems
for minimizing G subject to the element-abundance and nonnegativity con straints (Section 5.2.2.1). Thc original formulation requires that each nem} satisfy lhe element-abundance constraints. This removes thequantity (bj bJm» from the right side of equation 6.3-26. Another modification of the algorithm consists of the reduction of the number of working equations in the case of a single ideal-solution phase from (M + 1) to M. This modification has been presented several times in the literature (Brinkley, 1966; White,1967; Vonka and Holub, 1971) and is essentially the algorithm discussed in Section 4.4.2. Equations 6.3-26 and 6.3-27 are due to Ze1eznik and Gordon (1962) and Levine (1962), apart from our treatment of inerts. As Levine pointed out, even when nem) satisfies the element-abundance constraints, it is useful numerical1y to inc1ude the quantities (bj - bJm}) on the right side of equation 6.3-26 since this preven ts the accumulation of computer rounding errors. The RAND algorithm is easily extended to any number of single-species phases (Kubert and Stephanou, 1960; Oliver et aI., 1962; Core et al., 1963; Eriksson, 1971), and to more than one multispecies phase (Boynton, 1960; Raju and Krishnaswami, 1966; Eriksson and Rosen, 1973; Eriksson, 1975). In this general case, when there are 'lTm multispecies phases and 'l'{s single-species phases, equations 6.3-24, 6.3-26, and 6.3-27 become, respectively,
(M
r
on~m) = J n t ) i~l aijI/Ji + U a - ~T
/l(m) )
(for species in multispecies phases)
l
(for species in single-species phases)
uanyn}
(6.3-28) M
,IV'
~
N'
'IT
~
(m),
.t..I ~ aikajknk i=l k=1
ltIi
+ "~
b(m)
ja
ua
= ~ ~
a=\
(m)
(m)~
RT
ajkn k
+ bj
-
b(m).
j'
k=\
j=1,2, ... ,M,
(6.3-29)
and
Nonstoichiometric Algorithms
In spite of the straightforward way in which we have generalized to the multiphase situation, nontrivíal numerical problems may sometimes be en countered in lhe use of equations 6.3-29 and 6.3-30. These problems arise when the coefficient matrix of the linear equations becomes singular at some point in the calculations. It can be shown that in principIe this is not possible in problems consisting of only a single ideal phase but can occur whenever there is more than one phase. Such difficulties have been only briefly alluded to in the literature (Oliver et aI., 1962; Barnhard and Hawkins, 1963; Samue1s, 1971; Gordon and McBride, 1971, 1976; Madeley and Toguri, 1973a, 1973b; Eriksson, 1975). We discuss these in detail in Section 9.2. We observe from our discussion of classification schemes at the beginning of this chapter that the RAND algorithm, as originally formulated by White et aI. (1958), is a minimization method. At each iteration the element-abun dance constraints are satisfied, and the algorithm iteratively minimizes the Gibbs free energy. We have also shown that the sarne algorithm may be considered to be a method of solving the nonlinear equations 6.3-14 and 6.3-16. We have seen that the mole numbers and chemical potentials on each iteration need not necessari1y satisfy either equation 6.3-14 or 6.3-16, and the algorithm may iterate to satisfy both theseconditions simultaneously. It is usually called a jree-energy-minimization method. Finally, the RAND algorithm solves a numerical problem in which there are essential1y (M + 7T) variables that must be ultimately determined. These are the M Lagrange multipliers and the 7T values of the total number of moles in each phase. This is the case, however, only when a11 phases are ideal and is due to the fact that only then are we able to reduce the (N' + M) equations 6.3-17 and 6.3-20 to the (M + 1) equations 6.3-26 and 6.3-27. We have demonstrated the reduction for the case 7T = 1. In general, for nonideal systems (Chapter 7), we carmot reduce the number of equations in the set. In Figure 6.2 a flow chart is shown for the RAND algorithm as developed here. In view of the discussion in the foHowing two sections, we also refer to this as the BNR algorithm. In Appendix C we present a FORTRAN computer program that implements this algorithm. 6.3.2.2
M
2: j= \
N'
b{milJ;. -la
I
U
J1 za
cc
= 2:
p,(m)
n(m)~.
k= 1 ka
RT'
a
= 1,2, ...
,'l'{s
+ 'l'{m' (6.3-30)
where subscript a refers to a phase. We thus see that, in general, the RAND algorithm consists of iteratively solving the set of (M + '1T) linear equations 6.3-29 and 6.3-30, where 'l'{
=
'lTm
+ 7Ts '
Equations 6.3-26 and 6.3-27 are the special case
(6.3-31) 7T
=
7T
m
= I.
127
The Brinkley Variation
Although this variation was historically the earliest (Brinkley, 1947, 1951, 1956, 1960, 1966; Kandiner and Brinkley, 1950a, 1950b), it has been displaced by the RAND variation. This has been partly due to the use af the apparently appealing term "free-energy-minimization method" used to describe it, but also because Brinkley chose to discuss his algorithm by using notation that made it appear to be quite different fTom the RAND variation. In thissection we show that the Brinkley algorithm differs from the RAND algorithm in only a minor way. This observation was apparent1y first made by Zeleznik and Gordon (1960). We again start from equations 6.3-14 and 6.3-16, but we now use In n i as independent variables, rather than n j ' In the RAND variation nem) usuaHy
128
Chemical Equilibrium Algorithms for Ideal Systems
Nonstoichiometric Algorithms
129
Then for a single ideal phase equations 6.3-14 and 6.3-16 become, respectively; ll.{
exp(Yi)
;1- + ..
= 11; =: exp 2
Qkz"if'k -
(
k=1
)
ln n[ ;
i= 1.2, ... ,N'.
(6.3-32) S'
2: ajiexp( JJ = bj ;
j= 1,2, .....~.
(6.3-33)
;=1
Substitution of equation 6.3-32 into 63-33 yields N'
(
AI
i~1 ajiexp k~\ akitJ;k
-
p.* RT + In
1 n,.
= bj ;
= 1.2.... ,A1.
j
(6.3-34)
Finally, we also have, from equations 4.4-21 and 6.3-32.
~I exp k~ I a kI tJ; V'
Compute step-size parameter w lm )
I
J.L" )
(.\{
k -
R
T
11~ .
11 •
= 1 _.
(6.3-35)
Equations 6.3-34 and 6.3-35 are a set of (.\1 + 1) nonlinear equations in lhe + 1) unknowns .y and n(. );ote that lhe mole fractions obtained from equation 6.3-3i for an arbitra!)' set 01' Lagrange multipliers l/; define an equilibrium composition for some hypotheticaJ set of element abundances b*. Thus the Brinkley variation of lhe BNR algorithm iteratively modifies b* unlil it coincides with b specified by lhe right side of equation 6.3-33. Ir we choose estimates (tf;lm). m)) and determine n( m ) from equation 6.3-32. lhe Newton-Raphson iteration equations obtained from Enearizing equations 6.3-34 and 6.3-35 are (M
No
n;
'" l ~ M
~ i==1
Figure 6.2 algorithm.
= In n,.
".
~ 1<==1
)
a lI< a·JI.:'nlm) S '1r-'(( " l l k
-'--
b(rn)t:
}
lml .
= b} - bJ '
j
= 1. 2, .... A1 (6.3-36)
Flow chart for the RAND
and
satisfies the element-abundance constraints, and iterations proceed until the equilibrium conditions are satisfied. In contrast, in the Brinkley variation, n(m) satisfies the equilibrium conditions on each iteration, and iterations proceed until the element-abundance constraints are satisfied. Since In n i are the independent variables. it is convenient to set (cf. Section 6.3.1.2)
y,
I
(6.3-3)
M
2:
N'
b;'n) ôlJ!/m)
11=V
= t1~"" -
i=1
2.: Á=]
n~m!
-
n z•
(6.3-37)
where . n. c = in f1'.~';;'
(6.3-38)
ChemicalEquilibrium Algorithms for Ideal Systems
130
and ôl/; is defined by equation 6.3-18. On each iteration the linear equations 6.3-36 and 6.3-37 are solved for the (M + 1) unknowns 8..J;(m) and v. Then new values of If; and In n, are obtained from lf;(m+l)
=
n~m+
I)
= In
n~m)
N'
= 2:
+ w(m)v.
(6.3-39)
The resulting values of ..J;(m+ I) and In n~m+ I) are used in equations 6.3-32 to determine n{m+ Il, and the iteration is repeated. Note the similarity of the linear equations of the RAND variation (equa tions 6.3-26 and 6.3-27) to those of the Brinkley variation (equations 6.3-36 and 6.3-37). The coefficient matrices of the· two sets of linear equations are identical. Only the [ight sides differ slightly. This is because in Brinkley's variation nem) satisfies the equilibrium conditions, whereas in the RAND variation this is not the case. We cal! equations 6.3-32, 6.3-36, and 6.3-37 the Brinkley algorilhm here, although in Brinkley's earlier papers it appeared in a somewhat different, but completely equivalent, fonn. The main differences are twofold: (1) Brinkley chose to express the element-abundance constraints of equation 6.3-16 in terros of stoichiometric coefficients (this was primarily because he discussed two other methods for solving the resulting equations-intended for use in hand ca1culations and nol discussed here-for which this form of the constraints was essential); and (2) he chose to express the equilibrium conditions of equation 6.3-32 in terms of equilibrium constants. We now examine the progression from the form in equations 6.3-32, 6.3-36, and 6.3-37 to the form in Brinkley's papers. Wben the equilibrium conditions and the element-abundance constraints are expressed in stoichiometric forro, equations 6.3-32, 6.3-34, and 6.3-35 become, respe?tively,
j= 1,2, ... ,M.
P)ini;
(6.3-43)
i=; 1
(6.3-22)
and In
131
where
q)
+ w(m)ô\f1{m)
..J;(m)
Nonstoichiometric Algorithms
When i is greater than M, l'k/ are the negatives of the stoichiomclric coeffi cients in the stoichiometric equation in which one mole of species i is formed from a set of M component species. However, when i is less than or equal to M, we define, for the component species, P ki
= 8ki ;
i,k=I,2, ... ,M,
(6.3-44)
where li"i is the Kronecker delta. In equations 6.3-40 to 6.3-42, 10/; denotes the chemical potentials divided by RI' af the component species used in the stoichiometric equations. Note the formal similarity between the two sets of equations 6.3-32, 6.3-34, and 6.3-35 and 6.3-40 to 6.3-42. The Newton-Raphson iteration equations resulting from equations 6.3-41 and 6.3-42 are M
N'
'"
'"
~
"
n(m)~.1
P
~"ik jk
(m)
() 't'i
k
-+q(m)t') J
=:.
fi
"1)
_
q(m).
j
j'
=
1,2, . ...."'1. (6.3-45)
i=-o 1 k= 1
and ;v' 'V
M ) ' q(ml >::./,(m) _ .....
i
;=;
I
=v =
11 "
V 'rI
I
n(l7I) -
nem) -
~
t
k
0'0
k
11
='
(6.3-46 )
I
where V'
qJ<'/III = ". ,.;..
l' .n(nI).
Ii
I
,
j= 1.2, ... ,/'.1.
(6.3-47)
i=l
ni
M = exp ( 2:
Pkit/J k -
J.t7
RT
+ In n, ) ;
i
= 1,2, .. . ,N',
(6.3-40)
k=1
N'
2:
j=1
V)iexP
(
2:M
J.t*
Pkit/J k -
R~
)
+ In n, = q);
j
=
1,2, ... ,M, (6.3-41)
k=1
Equations 6.3-22 and 6.3-38 Lo 6.3-40 are then used to determine if;<'>J--II. In n~m+ 1), and d'" + 1). As in the case of the RAN O variation, the Brinkley variation is readily cxtended to consider more than one phase (see Prob1em 6.2). Brinkley's papers differ in some minor ways from this description. In his earlier papers he replaced v by u since
and
N'
2: i=1
exp
/li )
(M
2:
\ k=\
Pkit/J k -
RI'
,
= 1_
li t ( v=ln~-=Jn n~m) .
nz 11 t '
on I ) 1+--n~m)
ôn
:::::::;_.
(
n(-;;;)
= U,
(6.3-48 )
t
(6.3-42)
which resulted in a minor modification of eqwuion 6.3-39. :\iso, instead of
132
Otemical Equilibrium Algorithms for Ideal Systems
using equation 6.3-40 for the component species, Brinkley used the approximation n~m+ I)
n(m)
;m>exp(ôtP;(m») ~
n;m+l> = 1
f1(
(m)
n; )(1 + ôl/;(ftl» n m
(6.3-49)
I
t
and seI ôl/;i m > ~ ln( 1 + Ôafk m »).
(6.3-50)
The modifications of equations 6.3-45 to 6.3-50 are minor. Equations 6.3-32 and 6.3-34 to 6.3-37 are respectively equivalent to equations 6.3-40 to 6.3-42, 6.3-45, and 6.3-46. However, in his earlier papers Brinkley's equations appear very different from the latter set of equations. This is due only to his notation. Brinkley's notation also had the effeet of causing his algorithm to be regarded as an equilibrium-constant method when, in fact, it is essentially equivalent to the RAND algorithm. This notation, involving equilibrium constants, is the second main way in which his algorithm differs from equations 6.3-32 and 6.3-34 to 6.3-37. Brinkley expressed equation 6.3-40 in terms of equilibrium constants. Equations 6.3-45 and 6.3-46, the basic working equations of his algorithm, appear in the literature essentially as we have given them here (Brinkley, 1947). Since RT1fJ.: in equations 6.3-40 to 6.3-42 is the chemical potential of component species k, we have
. _ JLk
\fi" - R T
+ In n k
In n r;
-
k
= 1,2, . .. ,M.
(6.3-51)
For a mixture of ideal gases, equation 6.3-51 becomes
l/J" =
P
fLO,
R:'i + lo I1 k + ln-' I1 '
k = 1,2, . .. ,M.
(6.3-52)
t
Using equation 6.3-52, we may rewrite equation 6.3-40 for ali the species as P ) Vi
n· = K . ( I pl 11
TIM
k=1
1
I1 Vki ' k ,
i
= 1,2, ... ,N',
Nonstoichiometric Algorithms
133
(Note that, for the component species, equations 6.3-40 and6.3-53 gíve trivially 11; = 11;). In equati-on 6.3-54 K pi is the chemical equilibrium constant for the 'sloichiometríc equation forming one mole of species i from the component species. Equation 6.3-53 is completely equivalent to equation 6.3-40. Equation 6.3-53, when used in place of equation 6.3-40, would make equations 6.3-41 and 6.3-42 quite different in appearance from their present form, although they would remain mathematically identical. In terms of the classification schemes discussed at the beginning of lhe chapter, the Brinkley algorithm is essential1y a nonlinear equation method. The equilibrium conditions are satisfied at each iteration, and the algorithm iterates to satisfy lhe element-abundance constraints. It is either anequilibrium-constant method or not, depending on one's point of view (i.e., depending on whether equation 6.3-53 is used). As in the case of the RAND variation, there are in general (M + 11) unknown variables to be determined. These are the total number of moles in each phase and the chemical potentials of M component species. 6.3.2.3
The NASA Variation
In our discussion of lhe RAND variation we have seen that in the original formulation (White et a1., 1958) the mole numbers on each iteration satisfy the element-abundance constraints and that this restriction was relaxed in a later modification (Zelez.ník and Gordou, 1962; Levioe, 1962). In the Brinkley variation we have seen that the (Iogarithmic) mole-number variables on each iteration satisfy the equilibrium conditions. This restríction may also be re1axed, resulting in the NASA variation of the algorithm (Huff et aI., 1951; Gordon et aI., 1959). The NASA a\gorithm was oríginaUy formulated to consider equilibrium ca1culations at specified pressure P and enthalpy H. However, we consider its derivation here for the usual case of specified temperature T and pressure P. to facilitate comparíson with the RAND and Brínkley variations. Agaio consíderíng the case of an ideal solution and using \ogarithmic variables for the mole numbers (equation 6.3-32), we linearize equations 6.3-14 and 6.3-16 about estimates (n(m), l/;(ftl.» to yield, respective1y,
(6.3-53)
M
l:'(l fi n. k )(m)
u
where
_
t'(l o
U
n(
)(m)
= ".4..
a..,k,(.I.(m) '/'.1
+ (j.,,(m)) 'rJ
Im}
_
~. RT '
j=!
K . = exp ( pl
2:M
k=l
"k;
IL~
RT
_ fL? ) RT
k = L 2.... ,N'
(6.3-54)
(6.3-56)
and
and
N'
M Vi
= 2: k=l
"ki -
1.
(6.3-55)
2:
1,=01
a;knim'8(\n n k )(m) = bj
-
b:m)~
j = 1,2.... ~M.
(6.3-57)
Chemical Equilibrium Algorithms for Ideal Systems
134
The NASA variation always includes the atornic e1ements as species in the calculations. Numbering the species so that the first M are the elements, we have p,.)
(6.3-58)
j = 1,2, ... ,M.
'1')
= e5(ln n .)(m) ~ e5(ln n r
n~m»).
)(m)
(
N'
i~j 8(In ni)(m) n~m) + k=~+l aikn~m)
= n~m) - L k=1
When k does not denote an elernental species, equation 6.3-56 is written by using equation 6.3-59 as
M
. (m)
+ '~I a'k~(ln n,)(m)
p.(m)
;1'-;
-
k:
= M + 1, ... ,N'.
(6.3-60)
i=\
Substitution of equation 6.3-60 in 6.3-57 yields a set of M linear equations involving {e5(ln n)(m); j = 1,2, ... ,M}:
n;m)ô(ln nJ(m)
+
.,
M N' .~ ô(ln ni)(rn) ( ~~
1--1
aikajkn~m) )
k-M+!
N' L
+e5(ln n~m»)
ajkn~m) ( 1M a) ik
.2:
1=1
k=M+1 N'
L
_
M
em)
ajkn k
k=M+l
(
(m)
~
(m»)
~
i~l a ik RT + RT
j
+ bj
~
(m).
bj
,
= 1,2, ... ,M.
(6.3-61)
N'
i=\
= exp(1n nJ - n z
n~m)
-
nz -
N' ~
(Mp,(m) n~m} aik ~T
k=M+1
1=1
(6.3-62)
,L
+
;T .
p.{m) )
(6.3-63)
Equations 6.3-61 and 6.3-63 are a set of (M + 1) linear equations in the (M + 1) unknowns {e5(ln ni)(m); i = 1,2, ... ,M and o(ln n t )(fl1)}. The changes (o In n k )(m) in the remaining species mole numbers are given by equation 6.3-60. These equations essentially çomprise the NASA algorithm. The only minor difference betw,een this presentation and the algorithm as it appears in the literature arises from the fact that the pressure P is used as a variable instead of the total number of moles n t • We can see the similarity to the Brinkley variation by noting that if the initial (n(m), n~m») satisfied the equilibrium conditions, the first term on the right side of equation 6.3-61 would be absent. In additíon, we see fcom equation 6.3-60 that the new mole numbers would also satisfy the equilibrium conditions. The resulting algorithm in this case would hence be exactly equivalent to the Brinkley variation, except for the minor fact that changes in the chemical potentials of the elemental species (or component species in the Brinkiey variation) are given in tbe NASA algorithm by equation 6.3-59,' whereas in the Brinkley variation these are determined by exponentiating equations (i.3-59 and cornbining this with the linear approximation eX
A final equation is obtained by linearizing
L exp(1n n i )
1=1
j = 1,2, ... ,M. N'
JI a;,)
)
k=M+\
+ !!1-. RT '
(6.3-59)
+ ~ aik~T
This gives
(m)
J
8(ln n,)'m) = 8(ln n,)(m,( 1 -
135
+e5(lnnr)(m){-n~m) + ~ n~m)(1 - .~ a ik )}
Hence for the elemental species, from equation 6.3-56, we have
'1')
about (n(fl1),
M
.
l/;j= RT'
.,.~m) + e5.,.~m)
Nonstoichiometric Algoritbms
~
1
+x
(6.3-64)
to yield equation 6.3-49. We thus see that the only essential difference between the Brinkley and NASA variations is the fact that successive iterations satisfy lhe equilibrium conditions in the former, but not in the latter. The inclusion of the elements as species in the NASA variation is not an essential part of the rnethod. Thus the NASA variation complements the Brinkley variation similar to the way that the modification due to Zeleznik and Gordon (1962) and Levine (1962) complements the original RAND variation. The main difference between the three variations is between (1) the RAND variation and (2) the Brinkley and NASA variations.
136
Chemical Equilibrium Algorithms for Ideal Systems
This difference consists solely of lhe fact that the former variation uses lhe mole numbers n i as variables and the latter variations use In n i as variables. Computationally, one would expect little difference between the performance of the three variations, and this has been confirmed by Zeleznik and Gordon (1960). In terms of lhe classifications in Section 6.1, the NASA algorithm is a nonlinear-equation method. It satisfies neither the element-abundance nor the equilibrium conditions on each iteration. It can be, although it seldom is, formulated by using equilibrium conslants. There are in general (M + 'lT) variables to be determined, which are the chemical potentials of the elemental species and the total number of moles in each phase. 6.3.3
Other Nonstoichiometric Algorithms
In this section we briefly discuss some other chemical equilibrium algorithms that have appeared in the literature and that are based direct1y on equations 6.3-14 and 6.3-16. They are motivated from the numerical viewpoint of either minimization or nonlinear equations, but it seems that none of these has any particular advantage over the BNR algorithm. Several numerical schemes other than the BNR algorithm have been published for solving the set of nonlinear equations that result when the equilibrium conditions (equations 6.3-14) are substituted into the elementabundance constraints (equations 6.3-16). As we have seen, the Brinkley algorithm results from the application Df the Newton-Raphson method to these nonlinear equations. Other ways of solving these equations have been described by Scully (1962), Storey and Van Zeggeren (1967), and Stadtherr and Scriven (1974). Other methods based on minimization techniques have also been suggested in the literature. Madeley and Toguri (l973a) have developed an approach that uses the first-order algorithm due to Storey and Van Zeggeren (1964, 1970) in the initial stages and the RAND algorithm in the final stages. George et aI. (1976) use Powell's method of rninimization (Powell, 1970) on an unconstrained objective function that incorporates G and the element-abundance and nonnegativity constraints. Gautam and Seider (1979) have suggested a method based on the use of quadratic programming. Finally, Castillo and Grossman (1979) have used the variable-metric projection method due to Sargent and Murtagh (1973). A somewhat different approach uses an optimization technique called geometric prograrnrning (Duffin et aI., 1967). Minimization of any function is equivalent to maximization of the exponential of the negative of the function. Thus the chemical equilibrium problem may be formulated (for one phase) as
m:x (exp ( ;n] = n;' ig,[exp( -:; I RT)
r
I
NOllstoichiometric Algorithms
137
When the element-abundance constraints are formulated appropriately, these equations together with equation 6.3-65 form a problem in geometric programming. AIgorithms have been developed for solving such a problem, and these have been applied to the chemical equilibrium problem (Wilde and Beightler, 1967; Passey and Wilde, 1968; Dinkel and Lakshmanan, 1977). 6.3.4
Illustrative Example for the BNR Algorithm
Example 6.1 We illustrate the use of the RAND variation of the BNR algorithm by considering equilibrium in a system investigated by White et aI. (1958). This involves determination of the composition of the gas resulting from the combustion of hydrazine (N2 H 4 ) with oxygen in aI: I ratio at 3500 K and 51.0 atm. Using the species listed by White ct aI., we rcpresent the system by {(H 20, N 2 , H 2, OH, H, 02' NO, O, N, NH), (H, N, O)}. We use the free-energy data provided by them and one mole of initial reacting system. So/ut;on We first construct an input data file for the BNR computeI' program given in Appendix C, in accordance with the User's Guide (sec Figure 6.3). The first line indicates that there is one problem to be considered, and the second that there are 10 species and three components (in tbis case, equal to the number of elements). Each of the following 10 lines contains a species name, its formula vector, its phase designation (1 denotes a gaseous multispecies phase), and its standard chemical potential (p.°/RT in this case). The next two lines contain the initial equilibrium estimate (taken from the original paper), and these are followed by a line giving the element abundances. The final three lines show, respectively, the temperature and pressure, the names of the elements, and an arbitrary title. Using this input file, we obtain the output shown in Figure 6.4. Convergence is achieved after eight iterations, and the results are given both as equilibrium mole numbers and as mole fractions. They essentially agree with
001 010003 H
H2 H20 N
N2
NH NO
o 02 OH 0.1 0.1
2.0 3500.0
oo oo o1 o 1 o o2 o 1 1 o o1 1 oo 1 oo2 1 o 1 1 2
1-10.021 1-21.096 1-37.986 1-9.846 1-28.653 1-18.918 1-28.032 1-14.M 1-30.594
2
0.35 0.1 1.0 51.0
1-26.111
0.5
0.1
0.35
0.1
0.1
1.0
H NO
(6.3-65)
HYDRAZINE COMBUSTION
Figure 6.3
lnput data file for Examples 6.1 and 6.2.
0.1
Chemical Equilibrium Algorithms for Ideal Systems
138 RAND CALCULATION METHOD HYDRAZINE COMBUSTION
10 SPECIES 3 ELEMENTS 3 COMPONENTS 10 PHASE1 SPECIES O PHASE2 SPECIES O SINGLE SPECIES PHASES PRESSURE TEMPERATURE MOLES INERT GAS
51.000 ATM 3500.000 K 0.0 CORRECT
FROM ESTIMATE
2.000000000000D 00 1.000000000000D 00 1.0000000000000 00
1.9999998211860 00 9.9999982118610-01 9.999998211861Q-01
ELEMENTAL ABUNDANCES H N o STAN. CREM. POT. IS MU/RT SPECIES
STAN. CREM. PO"'.
FORMULA VEC'TOR H
H
H2 H20 N
N2 NR NO O 02 OH
1 2 2 O O
1 O O O 1
O SI lI} O 1 O 1 O 1 1 1 O 1 2 O 1 1 O 1 1 1 1 O 1 1 O 2 1 O 1 1
N O O
-1.00210 -2.10960 -3.7986D -9.84600 -2.8653D -1.8918D -2.8032D -1.46401) -3.0594D -2.6111D
01 01 01 00 01 01 01 01 01 01
F.QUILIERIUM EST. l.0000D-01 3.50000-01 5.0000D-01 1.00000-01 3.5000n-Ol 1.0000D-Ol 1.0000D-Ol 1.00000-01 l. OOOOD-Ol 1.0000D-Ol
139
Stoichiometric Algorithms
and that of N 2 would have been 0.5 moles (cf. 0.4852); n r would have been 1.5 moles (cf. 1.638). It has been assumed that N 2 H 4 is completely consumed (note that it has been excluded from the list of species). Finally, the amount of 02 remaining is 0.03732 mole, rather than zero.
6.4
STOICHIOMETRIC ALGORITHMS
6.4.1
Introduction
Stoichiometric algorithms eliminate the element-abundance constraints from the minimization problem, resulting in an unconstrained formulation. As discussed in Section 3.4, this is accomplished by transforming fram the N unknown mole numbers n, which are constrained by the M element-abundance equations, to a new set of "r.eaction-extent" variables ~, equal in number to R = (N' - M). Mole numbers on each iteration for these methods always satisfy the element-abundance constraints. The changes in the mole numbers ~n(m} from any estimate n(m) satisfying the element-abundance constraints are related to new ~ variables by R
8 ITERATIONS SPECIES
EQUILIBRIUM MOLES
MOLE FRACTION
l)n(m)
FINAl, DELTA
I
= "~
p .. l)d m ). I}
"'./
i = 1,2, ... ,N'.
'
(6.4-1)
)='1
4.0672821D-02 1.47'737190-01 7.8314179D-Ol 1.4143462D-03 4.8524621D-01 6.93189740-04 2.74000480-02 1.79494160-02 3.7316357D-02 9.6876036D-02
H H2 H20 N
N2 NR NO
o
02 OH
2.48240050-02 9.0169014D-02 4.77977990-01 8.6322341.D-04 2.96162210-0l 4.230777.00-04 1.6723178D-02 1.0Q55137D-02 2.2775433D-02 5.9126729D-02
2.8357D-11 2.83830-ll -6.25060-11 3.8327D-09 -:-1.89340-')9 -). 28"9D-]? -4.44930-:_1 1.6693[1< 1. 2 • 456 2D- " 1 4.11.86D-11
The matrix N has R = (N' - M) linearly independent colurnns and is related to the formula matrix A by N'
2: akivij =
k
O;
i=\
G/RT = -4.77613680 01 TOTAL PRASE1 MOLES 1.63840 00
= 1,2,
j= 1,2,
,M ,R
(6.4-2)
=
ELEMENTAL ABUNDANCES H N O FINAL LAGRANGE MULTIPLIERS
2.0000000000000 00 1.000000000000D 00 1.000000000000D 00 tLAMBDA/RT)
-9.785118420 00 -1. 29690111D 01
-1. 522212060 01
Viewing the Gibbs function G as a function of the reaction-extent variables we see that the chemical equilibrium problem is that of minimizing G(~). The necessary conditions for this are the nonlinear equations (cf. equation
~,
3.4-2)
aG =0. a~
(6.4-3)
Figure 6.4 Computer output for Example 6.1 from BNR algOlithm in Appendix C.
\Ve have seen in Chapter 3 that equation 6.4-3 is equivalent to the classical chemical formulation of the equilibrium conditions (cf. equation 3.4-5) those given by White et aI. (1958) to within four significant figures. The entries under "FINAL DELTA" give lhe final mole-number corrections at convergence. The dominant products of combustion are H 2 0 and N 2 , as expected. If we had assumed that the system behaved as a simple system (R = 1) with complete combustion, the amount of H 20 would have been 1 mole (cf. 0.7831).
âG :::= NTp.(~) = O.
(6.4-4)
Analogous to the discussion in Section 6.3, we rnay treat this formulation of the chemical equilibrium problem numerically from either the minimization ar the nonlinear equation point of ·view.
Chemical Equilibrium Algorithms for Ideal S)'stems
140
Qne of the main differences between stoichiometric and nonstoichiometric algorithms concerns the total number of independent variables that must essentially be determined. Using equations 6.3-14 and 6.3-16 direct1y, nonstoichiometric a1gorithms incorporate the e1ement-abundance constraints by the introduction of an additiona1 set of M variab1es (the Lagrange multipliers). We have seen that in several such algorithms a new variab1e is a1so introduced for each phase in the system. This results in a total of (N' + M + '1T) variables altogether. When the phases are ideal, this number is reduced to (M + '1T). In the stoichiometric algorithms the number of variables is always N' - lv!, regardless of whether the phases are ideal. Thus, for nonideal systems, the stoichiometric algorithms always have fewer variables. For ideal systems with a smal1 number of phases, the nonstoichiometric algorithms usually have fewer variables. For problems involving single-species phases, stoichiometric a1gorithms have certain numerical advantages over nonstoichiometric algorithms, and these are discussed in Chapter 9. We note that the mere appearance of stoichiometric coefficients in an algorithm does not justify classifying it as a stoichiometric algorithm in terms of the classification schemes presented in Section 6. L For example, the Brinkley algorithm uses stoichiometric coefficients, but it does so only in an incidental way, and hence we do not classify it as a stoichiometric algorithm. A number of general-purpose algoríthms have appeared in the líterature using the stoichiometric formulation. One of the first of these was that due to N aphtali (1959, 1960, 1961), who suggested using a first-order method to minimize G(~). At about the same time Villars (1959, 1960) devised an a1gorithm for solving the set of nonlínear equations 6.4-4. Cruise (1964) subsequently made severa1 improvements to this algorithm. Smith (1966) and Smith and Missen (1968) reformulated the Villars-Cruise algorithm as a minimization method, resulting in improved convergence properties. Hutchison (1962) suggested the use of the Newton-Raphson method in equations 6.4-4. This approach has also been suggested by Stone (1966) and by Bos and Meerschoek (1972). The coefficient matrix of the linear equations in the algorithm is usually so large, however, that the method is rather unwieldy and apparently has not been widely used. Finally, Meissner et aI. (1969) have discussed an approach that is very similar to the Villars algorithm. We consider each of these in turn in more'detail. Other stoichiometric methods, not discussed in detai1 here, have a150 appeared in the literaturc. For example, Sanderson and Chien (1973) have used Marquardt's a1gorithm (Marquardt, 1963) to solve equations 6.4-4.
141
Stoichiometric Algorithms
adjusted by amounts
ôf" where
Ô~)m) =
_ ( a~. 3G
)<m
/
1
= _!1G<m) J
.TV' ~ p .. II(m).
..i:J
IJr-"1
j= 1,2, ... ,R.
,
(6.4-5)
i=\
The mole numbers are adjusted by means of equation 6.4-1. This algorithm has been found to converge rather slowly, especially near the solution, as ís characteristic of first-order optimization methods in general. lt hence does not appear to be widely used. 6.4.3
Second-Order Algorithm
HutchisOIl (1962) and others (Stone, 1966; Bos and Meerschoek, 1972) have suggested applying the Newlon-Raphson method to cquations 6.4-4. This yields
ô~(m) =
_ (
2
a e )-) ( aG )
ae .
"(no]
(lf,
(6.4-6 ) n(no)'
This approach requires the solutíon of a set of R= (N' - M) linear equations on each iteration. Since lJ' is usually large compared with M, the numerical solution af these linear equations can be a very time-consuming scgment of the algorilhm. Thus this approach does not appear to have been widely used as a general-purpose method, but we have used it in Chapter 4 for relatively simple systems. Ma and Shipman (1972) have developed a method that uses the first-order algorithm in the il1itial stages and the second-order a1gorithm in the final stages. The next approach to be discussed is re1ated to equations 6.4-6 anà is essentially a way of reducing the labor involved in the solution af the linear equations. 6.4.4
Optimized Stoichiometry-The ViUars-Cruise-Smith (VCS) Algorithm
The Villars-Cruise-Smith (VCS) algorithm is intermediate between a first- and second-order method. The algorithm begins with equation 6.4-6. In the case of a single ideal phase, the Hessian matrix (a 2G /ae) is given by
a2e a (' N' ) a~í a~j = a~j . !c~i PkiJ.Lk I
6.4.2
First-Order Algorithm
Naphtaii (1959, 1960, 1961) suggested use of the first-order method, discussed in Section 5.2.1.1, for minimizing G( ~). The variables t at each iteration are
N'
N'
= RT 2:2:
ko:=\ I={
( 0kl vkivl.l \
~-;
1
I).
-;;
,
i, j = 1, 2, ... , R, (6.4-7)
O1emical Equilibrium Algorithms for Ideal Systems
142
Ir we choose the component species to be those with the largest mole numbers,
where 8kl is the Kronecker delta. We may rewrite equation 6.4-7 as _1_ ~ RT a~i a~j
=
N'
--
~
Pk;Jl kj _
nk
k=1
JliPj ;
i,j=I,2, ... ,R,
nl
(6.4-8)
where N'
Vi = ~
this tends to make the second term on the right side of equation 6.4-13 small and the first term large. The last term vanishes if either Vi or vj vanishes, and in any event it is often smallcompared with the first term because of the presence of n t in the denominator. If we form the N matrix in this way, we may make the reasonable approximation that the Hessian matrix may be considered to be diagonal, and we invert it directly to give
(6.4-9)
P ki •
k=1
2
We recall from Chapter 2 that we have considerable freedom in choosing the stoichiometric matrix N. If we can make use of this freedom to choose N so that the Hessian matrix in equation 6.4-7 is easily inverted, the useof equation 6.4-6 is very attractive. For example, if we can make the first terms in equation 6.4-8 vanish for i =F j, the Hessian is easily inverted in closed formo We can, in fact, choose N in this way by choosing {Vj} so that N'
j) .. '
JlkiJlkj _
~
---;;;:- -
RT~ (
j)t(m)
=_
JJkiJJ kj
-j)íj -+ nj + M
~
~ /(=1
k=l
nk
~
2) 1/2
k=l
JJ
ki
k=1
j)ij'
nr
(6.4-12)
,
'
(6.4-14)
nt
n/n)
--2
v· --.L
J -1
6.G(m) J
-
o
RT'
til
j
= 1,2, .. . ,R.
On each iteration the species mole numbers are exam.ined to ensure that the component species are those with the largest mole numbers. lf this is not the case, a new stoichiometric matrix is calculated. In the case of an ideal multiphase system, equation 6.4-15 becomes
nk
"kiJlkj - -viv -j •
nk
k~1 n k
(6.4-15)
respectively. Although it is possible in principIe to compute {v} in this way, it is probably not very useful since we would have to recalculate the N X R matrix N on each iteration, corresponding to each new composition n( m). The VCS algorithm essentíally makes a compromise between computing N in this way on each iteratíon and computing N onIy once at the beginning of the procedure. We note that if our stoichiometric matrix is in canonical form, the product JJkiJJ kj for i =F j is zero when k refers to a noncomponent species (k > M) since each noncomponent species has a nonzero stoichiometric coefficient only in one stoichiometric vector. When i = j, JJkiJJ kj = 1 for such k values. The entries of the Hessian matrix are thus, numbering the component species from 1 to M and the noncomponent species from (M + 1) to N', I a2 G RT ata~j
-2 ) - I
(6.4-11)
.-
N'
(
2
N'
~
~
_and
11",.11 =
ni+M
M2 + ~ Jlk] (
1 _(m) ._ ( n + M j
thal is. {Jj} is orthonormal with respect to the inner product and vector norms,
=
a~ia~j
M
(
~_I_+~"'ki_!!.i..-
{In the literature (Villars, 1959, 1960; Cruise, 1964; Smith, 1966; Smith and Missen, 1968), a further approximation is usually made by neglecting the term involving Vi'] The VCS algorithm for a single ideal phase thus consists of using equatiün 6.4-6 with 6.4-14 and iteratively adjusts each stoichiometric equation by an amount
ç]
)
) -·1
(6.4-10)
I) ,
k=t
Vi • ,,:
143
Stoiehiollletric Algorithms
i, j = 1, 2, ... , R .
( 6.4-13 )
[0*
0*
( M .,,2 J+M,a ~ k; Áa 1 ---+;-- l1ím)
j+M
TTm
,
~
o~(m)=
N'
~
~
a~lk=1
J
... k=l
(vo
n(m) Á
)21-
1
m
-kJ-ka-
ÂGí ) ) ---
tI'a
RT
(6.4-16)
(provided that at least one species for which J/
-
kj
=I:- O is in a multispecies phase)
6.G{m) ~T ( otherwise)
Here a:: denotes a phase. The value of oZa is ullity if species k is in any multispecies phase (X and is zero otherwise, and 0ka is unity if species k is in the
144
Chemical Equilibriurn AIgorithms for Ideal S)'stems
particular multispecies phase a and is zero otherwise. We remark that lhe VCS algorithm is well suited to handle multiphase problems, especialIy those involving single-species phases, such as arise in metallurgical applications. Tlús is due to the fact that the nonnegativity constraints on the species mole numbers are easily handled in this algorithm (as opposed, e.g., to the BNR algorithm discussed in Section 6.3). We discuss the treatment of the nonnegativity constraints in detail in Chapter 9. The foregoing description of the VCS algorithm is essentially that due to Smith (1966). However, historically this aIgorithm was not originally viewed as a free-energy-minimization method, but as a method for solving the nonlinear equations represented by the classical equilibrium conditions of equation 6.4-4. Villars (1959, 1960) originally proposed the use of equation 6.4-15 using an arbitrarily chosen N matrix. He also adjusted each individual stoichiometric equation in tum and recomputed the system composition before adjusting the next equation. He viewed this approach as a way of using the Newton-Raphson method on the equilibrium conditions, adjusting the stoichiometric equatíons one at a time. The analogous method for a single stoichiometric equation had been proposed by Deming (1930). In the approach due to Meissner et a!. (1969) each main iteration consists of bringing the reactions one at a time exactly, rather than approximately, to equilibrium. Cruise (1964) incorporated the optimized choice of N described previously, based on earlier work of Browne et alo (1960). Cruise also advocated the simultaneous adjustment of all stoichiometric equations by means of equation 6.4-15 on each iteration before recomputing the system composition. He found that these two modifications to Villars' method resulted in substantial improvements in computing speed and convergenee. Finally, Smith (1966) and Smith and Missen (1968) reformulated the method as a minimization algorithm and incorporated the step-size parameler <..l. This minimization point of view resulted in an algorithm that is both rapid and free of eonvergence problems. We remark in conclusion that the VCS algorithm is a descent method of minimization since, for a single ideal phase, 1
a2G
N'
2 -2 "kJ"J
N'
~ ---= ~ nk
-RT J
ae
k=l nk
nt
k=1
( " k j "-j ) 2 --nk nt
>0,
(6.4-17)
145
Stoichiometric Algorithrns
on each iteration. These equations ean have a singular or nearly singular eoefficient matrix for some problems, and this can cause practical dífficulties. The VCS algorithm avoids these. We discuss some examples of this type of difficulty in Chapter 9. In Figure 6.5 a flow ehart is displayed for the VCS algorithm, as developed here. A FORTRANcomputer program that implements this algorithm is given in Appendix D.
II I
Compute s~rametef'(,,)(m I
r ,
!
0(",+11_ 0 '",1 +(,,)("'1
~
N6~~
l
and equation 6.4-15 lhus yields on each iteration
(d~7m) )
w(m)=o
j~' ( a~j ) (a~J R
âG
2
,f.'
-1
a2 G )
R'.'
~ O.
(6.4-18)
Qne significant eomputational advahtage of lhis algorithm is the fact thar there are no linear equations to solve on each iteration. We recall that the BNR algorithm for an ideal system requires the solution of (M + 11') linear equations
figure 6.5 algorithm.
Flowchart for the VCS
146
6.4.5
Otemical Equilibrium Algorithms for Ideal Systems
lIIustrative Example for the VCS Algorithm
Example 6.2 We illustrate the use of the VCS algorithm by means of the system described in Example 6.1 (White et aI., 1958). The input data file is the same as for the BNR algorithm (Figure 6.3)-see User' s Guide in Appendix D. The output is shown in Figure 6.6. Convergence is achieved after 17 iterations, during wh:ich the stoichiometric matrix is calculated twice. Although the number of iterations (17) is greater than in Example 6.1 (8), the total
VCS CALCULATION METHOO HYORAZINE COMBUSTION 10 SPECIES 3 ELEMENTS 3 COMPONENTS 10 PHASE1 SPECIES O PHASE2 5PECIES O SINGLE SPECIES PHASES PRESSURE TEMPERATURE PHASE1 INERTS
51.000 ATM 3500.000 K 0.0
ELEMENTAL ABUNDANCES
CORRECT H N
o
FROM ESTIMATE
2.000000000000D 00 1.0000000000000 00 1.0000000000000 00
2.000000000000D 00 1.000000000000D 00 1.0000000000000 00
USER ESTlMATE OF EQUILIBRIUM STAN. CREM. POT. 15 MU/RT SPECIES H20 N2 82 N
H NH NO O 02 OH
FORMULA VECTOR H 2
N
o SI
2
o
o
2 O 1 1
o
o
1
1
O
1
1
1 1 1 1 1 1
1 o o o 1 o o 1 1 o o 1 O o 2 1
O
H20 H2 N2 OH H 02 NO
o
N
NH
EQU1LIBRIUM EST.
-3.798600 -2.865300 -2.109600 -9.846000 -1.002100 -1.89180D -2.803200 -1.464000 -3.05940D -2.611100
1 1
Dl 01 OI 00 01 01 Ol.
01 01 01
5.000000-01 3.500000-01 3.')0000C-01 1.000001::-01 1.000000-01 l.000000-01 1.000000-01 1.000000-01 1.00000D-Ol 1.000000-01
EQUILIBRIUM MOLES
MOLE FRACTION
DG/RT REAC'rION
7.83141530-01 1. 477 37 390-01 4.852-46220-01 9.6876244D-02 4.0672719D-02 3.7316404D-02 2.7400034D-02 1.79493820-02 1.4143465D-03 6.93187730-04
4.7797781D-01 9.0169136D-02 2.96162210-01 5.9126854D-02 2.48239390-02 2.2775466D-02 1.6723169D-02 l.Ü955116D-02 8.6322362D-04 4.2307596D-04
-3.32280-07 2.93160-08 -2.3448D-12 -4.47110-07 -2.09110-07 2.48210-08 -7.99930-07
H
N
o
Figure 6.6
computation time is about the same in both cases. The results calcu1ated in trus example agree with those in Example 6.1 to within five significant figures. Finally, each number below "DG/RT REACTION" gives !J.GjRT for the stoichiometric equation in which one mole of the indicated species is formed from the first three species (H 20, H 2 , and N 2 ) as components.
6.5
COMPOSITION VARIABLES OTHER THAN MOLE FRACTION
For the algorithms in Chapters 4 and 6, we have expressed the composition in terms of mole fractioll. The computer programs in the appendixes also use mole fraction as the composition variable. This is appropriate for gaseous systems and solutions of nonelectrolytes, but for solutions of electrolytes (e.g., aqueous solutiolls of acids, bases, and salts), the composition is usually expressed in molality or molarity, as described in Chapter 3. In this section we describe how the algorithms must be modified to consider problems involving such systems. For the RAND algorithm, the equations corresponding to equations 6.3-24 to 6.3-27 must be rederived. We leave this as an exercise in Problem 6.9. For the VCS algorithm, the only change that must be made in the computer program in Appendix D is to calculate the chemical potential in the appropriate way in the subroutine DFE. We illustrate how this is done by means of an example ffom Denbigh (1981, p. 328).
n,
(n,
Example 6.3 Consider the system {(CI 2(g), C1 2( H+ CI- (r). HCIOU). CIO-(r), H 20(P», (CI. H, O,p)} resulting from bubbling Clig) at a partial pressure of 0.5 atm through watcr at 25°C. Calculate the concentrations of the species in the liquid (aqueous) phase, if the solution is ideal, and the standard frec energics of formatioll, in kJ mole-I, are AGi = (O. 6.90, O, -131.25, -79.58, - 27.20, - 236.65)T.
=
G/RT = -4.7761377D 01 TOTAL PRASE 1 MOLES = 1.63840 00 ELEMENTAL ABUNOANCES
147
rI)
ITERATIONS = 17 EVALUATIONS OF STOICHIOMETRY SPECIES
STAN. CREM. PüT.
Compositíon Variables Other Than Mole Fraction
Solution The chemical potentíal of H 2 0 is given by /l[H 2 0(e)J = L\.G/[H 20(f)] + RTln X H20 and of each of the other species in the liquid phase by /li = t!.G~ + RTln m,.; for CI 2(g), /l[Clig)] = ~G/[Clig)] + RTln PC1 2' In subroutine DFE in Appendix D three FORTRAN statements are modified as follows. Statement number 11 is replaced by
11 FE(I) = FF(I)
+ ALOG(Z(I») - ALOG(Z(I)*O.018016DO)
IF(I.EQ.l )FE(I) 2.000000000 00 1. 000000000 00 1.00000000D 00
Computer output for Examp1e 6.2 from VCS algorithm in Appendix D.
= FF(I) + ALOG(Z(I»
- Y
Statement number 21 is replaced by 21 FE(L) = FF(L)
+ ALOG(Z(L) - ALOG(Z( I )*O.ü18016Dü)
148
Chemical Equilibrium Algoritluns for Ideal Systems
Statement number 31 is replaced by 31 FE(L)
149
Problems
PROBLEMS
= FF(L) + ALOG(Z(L»
- ALOG(Z(1)*0.018016DO)
The vector b is defined by nO[H 20(e)] = 1000/18.016 by choosing an arbitrarily large initial amount of CI 2(g) so that all of it does not dissolve {here we choose nO[CI 2(g)] = I} and, finally, by the electroneutrality requirement. Thus b = (2.0, 2000/18.016, 1000/18.016, O)T. The computer output from the VCS algorithm is shown in Figure 6.7. For the species in the liquid phase, the equilibrium mole numbers are virtually the molalities because of the choice of nO[H 2°(e)].
6.1
Derive equations 6.3-28 to 6.3-30, the RAND algorithm for a multiphase ideal system.
6.2 Show that, in the case of a multiphase ideal system, the working equations of the Brinkley algorithm, corresponding to equations 6.3-45 and 6.3-46, are M
~
~
N'
~".". n(m)~.I,~m)
~
ik Jk
k
'ri
+
;=1 k=1
VCS CALCULATION METHOO IT WILL THEREFORE BE TREATEO AS A SOLIO.
M
o P
FROM ES'rIMATE
2.0000000000000 00 1.1101243339250 02 5.5506216696270 01 0.0
2.0000000000000 00 1.1101200000000 02 5.5506000000000 01 1.387778780781a-17
USER ESTlMATE OF EQUILIBRIUM STAN. CHEM. POT. IN KJ./MOLE FORMULA VECTOR O
H 2
2
O
O
1
1 1 1
O
2
1
o o
O 1
H201L) CL2IG) H+ (L)
CL- IL) CL2IL) RCLO (L) CLO-IL)
STAN. CHEM. POT.
P SI (I) 2
O O O O 1 O -1 1 O 1 -1 O o
-2.366500 -l. 718250 0.0 -l. 312500 -7.958000 -2.720000 6.900000
O
2 2 2 2
2
ITERATIONS = 10 EVALUATIONS OF STOICHIOMETRY SPECIES
j=I,2, ... ,M
q(m). J'
02 00 02 01 01 00
C 4 (g): Cs(g): CH: CH 2 :
= MOLF: FRACTION
OG/R'I' REAC'I'ION
5.54815940 01 9.44479570-01 2.46228670-02 2.4622867D-02 3.08975660-02 2.46228660-02 6.65344810-10
9.98115250-01 1.00000000 00 4.42966000-04 4.42965980-04 5.55847980-04 4.42965970-04 1.19695700-11
-3.'1043D-06 8.04560-09 -4.70700-06
p
Cig):
5.520600 01 6.000000-01 5.000000-01 3.000000-01 l.000000-01 2.000000-01 1.00000D-Ol
EQUILIBRIUM MOLES
CL R O
(m) _
n((I.
~
(m) ~ nkc'
•
nz(l.'
-
a --
I , 2 , ... ,7T's
+ 7T'm'
k=l
2.000000000 00 1.110124330 02 5.550621670 01 7.18250180D-19
Figure 6.7 Computer output for Example 6.3 from VCS algorithm in Appendix D.
Determine the composition at equilibrium at 4000 K and 1.5 atm of the product stream resulting from the reaction of 1 mole of CH 4 and 1 mole of N 2 , based on the following standard free energies of fonnation at 4000 K (in kJ mole-' l ) (JANAF, 1971): C(gr): C(g): C 2(g):
EQUILI8RIUM EST.
G/RT = -5.29972110 03 TOTAL PHASE2 MOLES = 5.55860 o J. ELEMENTAL ABUNOANCES
= q.J _
N' -
nz(l.v(I. -
;=1
6.4
CORRECT CL H
CL
(I.
6.3 Prove equation 6.4-17.
0.500 ATM 298.150 K 0.0
ELEMENTAL ABUNOANCES
H201L) CL2IG) H+ (L) CL-IL) RCLOIL) CLO- (L) CL2 (L)
J(I.
a=1
~ (m)i:'./,(m) _ ~ qj U'rj
7 SPECIES 4 ELEMENTS 4 COMPONENTS o PHASEl SPECIES 6 PHASE2 SPECIES 1 SINGLE SPECIES PHASES
SPECIES
~
and
CHLORINE-SOLUTION PROBLEM THIS SPECIES:CL2IG) IS THE ONLY GAS.
PRESSURE TEMPERATURE PHASE2 INERTS
'1T
~ q(m)v
O 90.06 80.41 21.46 142.13 169.55 154.41 238.27
CH 3 : CH 4 : CHN: CN: C2 H 2 : C2 H 4 : C2 N2 : C4 N 2:
236.98 352.08 9.991 41.56 14.46 367.25 133.62 187.44
H: - H 2: HN: H 2N: H 3 N: N: N 2:
-15.32
°
258.66 331.16 411.06 210.77 O
6.5
Extend Problem 4.5 by considering equilibrium involving the additional species: C(gr), C(g), Cz{g), Cig), Cig), Cs(g), CH(g), CHz{g), CH 3(g), C2 H(g), C 2 Hz{g), C2Hig), O(g), H(g), OH(g), and HOz{g). Additional standard free energies of formation (JANAF, 1971), in the order cited, are (O, 479.87, 546.98, 497.52, 658.98, 653.79, 426.11, 325.68, 171.55, 282.87, 143.00, 160.10, 154.93, 136.61, 16.90, 92.03)T, in kJ mole-- 1•
6.6
Ethylene can be made in a tubular reactor by the dehydrogenation of ethane, with oudet conditions of about 1100 K and 2.0 atm. Suppose that the feed consists of steam (assume it to be inert) and ethane in the ratio 0.4 mole of steam per mole of ethane, and that the composition of the product stream on a steam-free basis is 36.0 mole % H 2, 11.7% CH 4 ,
.." .~
....
~
152
Chemical Equilibrium AlgQrithms for Ideal Systems
(d)
n,
Solubility of CaCO); system is {(CaC03(s, calcite), CaC0J< H 2C03 (e), HCO; (e), COf- (e), Ca2 + (e), CO2 (e), H 20(C), H+ (e), OH-(e», (Ca, C, H, O)}; I1.GI =(-1128.8, -1081.4, -623.2, - 586.8, - 527.9, -. 553.54, - 385.0, - 237.18, O, -157.29)T. Note: The standard free energies of formation are in kJ mole - " and for dissolved species indicated by (O, other than H 20(e), refer to the infinitely dilute standard state usually denoted by (aq). Data are from Wagman et aI. (1965-1973).
6.12 Consider the system described in Problem 4.10 with the additional species C 2 H 5 0H(g), CH 3COOH(g), CH 3COOC2 H s(g), and H 20(g). Calculate the equilibrium composition at 358 K and 0.9 atm with the assumption that both phases are ideal (vapor phase is an ideal-gas so]ution, and liquid phase is an ideal solution). (We note that the assumption is not a good one for the liquid phase, as indicated by the existence of a ternary azeotrope involving ethyl alcohol, ethyl acetate, and water.) At 358 K the vapor pressures of the four substances are 1.286, 0.327, 1.299, and 0.567 atm, respectively. 6.13 *Suppose that the product from a crude styrene unit consists of 2 mole % benzene (C6 H 6 ), 3% toluene (C 7 H g), 45% styrene (CgH g), and 50% ethyJbenzene (CgH IO ) and enters a vacuum distillation column for separation between toluene and ethylbenzene. If the stream is at 30°C and 0.0] 5 atm, what is the composition of each of the two phases (liquid and vapor) present? At 30°C the vapor pressures are 0.1570, 0.0482, 0.0166, and 0.0109 atm, respectively. Assume that the vapor phase is an ideal-gas solution, that the liquid phase is an ideal solution, and that only phase equilibrium is involved. (In solving this problem, consider the implications of the restriction to phase equilibrium with regard to free-energy data for the individual species imd an appropriate formula matiix for the system, as discussed in Section 2.4.5.)
CHAPTER SEVEN
Chemical Equilibrium AIgorithms for Nonideal Systems In Chapters 4 and 6 we presented algorithms for systems involving phases that are either pure species or ideal solutions, íncluding the special case for the latter of ideal-gas solutions. In this chapter we see how the general-purpose algorithms presented in. Chapter 6 may be adapted for use when the assump tion of ideal-solution behavior is not appropriate.We first discU5S in general terms the conditions and types of system for which nonideal behavior must be taken into account. We then prcsent further commcnts on lhe determination and representation of the chemical potential of a species in a nonideal solution, as a continuation of Section 3.7; finally, we consider the basic structure of appropriate algúrithms, presenting three approaches to the problem.
7. t
mE TRAN81TION FROM iDEALITY TO NONIDEALIIT
As has been emphasized in previous chapters, to solve the equations expressing the conditions for equilibrium, we must have an appropriate expression for the chemical potential of each species that relates it to composition, in addition to temperature and pressure. The chemical potential for a species in an ideal solution given, for example, by
1J.;(T, P,
'"Because of lhe assumptions made, this problem can be reduced to the solution of one nonlinear equation in one l.lnknown. Thus it does not require an elaborate algorithm for its solution. However, it iHustrates how such a problem can bc solved by a general proccdure, and if the phases were nonic.eal (see Chapter 7), the reduction could not be achieved.
xJ = p,7(T, P) + RTln X;,
(3.7-l5a)
depends only on (the measure of) its own composition (x; in equation 3.7-15a) and not on the composition of other species in the solution. This applies regardless of whether ideaiity is based on the Raoult convention or the Henry convention and regardless of the particular variable used toexpress composi tion. This makes possible the construction of algorithms for lhe calculation of equilibrium whose relatively simple forros are due to the fact that {;p,Jan; can be written as a simple analytical expression. ; 153
154
Chemical Equilibrium Algorithms for Nonideal Systems
The chemical potential for a species in a nonideal solution given, for example, by pAT, P,x) = p.f(T, P)
+ RTln Yj(T,
P, x)x j'
(3.7-29)
depends on composition in general, as reflected in the dependence of the activity coefficient Yi' This dependence may be complex and difficult to represent even when considerable experimental information is available [see Prausnitz (1969) for ao extensive discussion of the phenomenological behavior and treatment of activity coefficients]. In principie, the accurate prediction of lhe composilional dependence of the chemical potential of a species is a problem in statistical thermodynamics. It is only in relatively recent years that progress has been made in the statistical mechanics of fluids, for example, and such approaches are just beginning to be used in the treatment of real fluids (Rowlinson, 1969; Reed and Gubbins, 1973). Although we do not distinguish between phase equilibrium and reaction equilibrium, as lhe terros are commonly used, we note that much of the work devoted to the treatment of nonideal behavior has been done in the context of single phases and phase equilibrium, without the consequences of "chemical reaction" being taken ioto account. Relatively little attention has been paid to the general problem of determining chemical equilibrium (both intra- and interphase) in systems made up of nonideal solutions. In considering the breakdown of ideal behavior as an appropriate assump tion, we should distinguish between the transitions (l) from ideal-gas to non-ideal-gas behavior and (2) from ideal-solution to non-ideal-solution behav ior. The former occurs as the density of the gas increases from a relatively low value, as a result of either increasing pressure, decreasing temperature Of both. Even at relatively high density, however, a non-ideal-gas mixture may be essentially an ideal solution. It is in liquid and solid solutions that we must be mos! conscious of the likelihood of nonideal, rather than ideal, solution behavior. In qualitative terms, the key to this likelihood lies in the loosely defined term "chemicaJ similarity." For example, a solution of chemically similar pentane and hexane, which are adjacent members of an homologous series of hydrocarbons, may be considered to be virtually ideal, but if one of the two is replaced by the dissimilar species methyl alcohol, lhe resulting solution is very nonideal (Tenn and Missen, 1963). For nonideal solutions, since p. is often a very complex function of composi tion, this results, in tum, in complex expressions for 3p.j3n • This complexity J destroys the relatively simple forms of the algorithms obtained for ideal systems in Chapters 4 and 6. Before examining the structure of algorithms for nonideal systems, we consider further, following Section 3.7, the representation of the chemical potentiaI for nonideai systems.
155
Further Discussion of Chemical Potentials in Nonideal Systcms
7.2 FURTHER DISCUSSION OF CHEMICAL POTENTIALS IN NONIDEAL SYSTEMS In this section we amplify lhe very brief comments given in Section 3.7.2. The chemical potential of a species in a solution is determined ultimately by the nature of the intermolecular forces among the molecules. AlI thermodynamic properties may be calculated in principIe from these forces by the methods of statistical mechanics (Reed and Gubbins, 1973). The difficulties are formida ble, however, in the present state of knowledge. Not only is the precise nature of these forces usually unknown, but also, even given such knowledge, the exact numerical calculation of the properties is often impossible. Any reasona bly accurate solutions to this problem must involve approximations in terms of both these aspects. In face of these difficulties, most chemical potential information has been obtained from macroscopic experimental data, guided, in the sense of correla tion and prediction, where possible, by the more fundamental approach, which attempts to solve the statistical mechanical problem approximately for ap proximate intermolecular potential models. We outline three approaches: use of excess free-energy expressions, equations of state. and corresponding states theory. We then consider separately lhe case of electrolytes. 7.2.1
Us(~
of Excess Free-Energy Expressions
For liquid solutions of nonelectrolytes, chemical-potential information is com monly given in terms of the molar cxcess frce energy (gLo) of the solution or the activity coefficient of cach speci.es (see Section 3.7.2 for the definition of an excess function). The former provides a convenient summary for all species, and the interrelationships are as follows: J.I.;;
where
=:;
(7.2-1)
RTln Yi'
Ilr is the excess chemical potential of species i and N
gE =
L XJtr.
(7.2-2)
j=l
The activity coefficient may be calculated from gE by means of an equation analogous to equation 3.7-34: , RTln Y
=
E_
ILi - g
_
E
~
j~j
( agE)
X
_
J
dXJ
T. P.
(7.2-3) X","j
The compositional dependence of g E or YI is often given by means of an empirical Oi semiempirical correlation af experimental data. The temperature
156
Chemical Equilibrium Algorithms for Nonideal Systems
and pressure dependence and the Gibbs-Duhem relation are given by equa tions analogous to equations 3.2-10 to 3.2-17. We consider some of the commonly used correlations for gE for binary systems; the extension to multispecies systems may have to be done on an ad hoc basis. More elaborate methods, not described here, are used. by Prausnitz et alo (1980) in computing vapor-liquid and liquid-liquid equílibria; see also Skjold-Jl1Srgensen et aI. (1982). 7.1.1.1
Power-Series Expansion o{ gE /x.x 2
An example of the power-series expansion of gE /X 1X 2 is given by the equation of Redlich and Kister (1948): E
~- = X 1X 2
L
k
k~O
ak(T, p)(X 1 - X2) ,
(7.2-4)
where q is an effective volume parameter, x1ql ZI
Z2 =
7.2.1.4
X 2Q2 + x2q2 '
(7.2-8)
x1ql
~bk(T,P)(XI-X2)k,
+ A 12 x 2 )
12
V2 [ = -exp -
(7.2-5)
x 2 ln(x 2
(À 12 --
+ A 21 x 1),
l
À II )]
RT'
VI
" - -(À 12 A 21 = V ---!.exp
v2
k;;.O
-
(7.2-9)
where A
where the bk 's are parameters determined from experimental data. The first-order form of this leads to the van Laar equations for activity coefficients (van Laar, 1910) on application of equation 7.2-3. 7.2.1.3
(7.2-7)
'
The Wilson Equation
gE _
RT - -xlln(x l
The reciprocal of gE/X 1X2 may also be represented by a power-series expan sion (Vau Ness, 1959; Otterstedt and Missen, 1962):
.x t x 2
-1- x 2 Q2
and the a 's are interaction parameters, the subscripts to which indicate the nature and number of molecules involved in a particular interaction. Both the Margules and van Laar equations can be obtained as special cases of the WohI equation. The equation can also be extended to multispecies systems.
Power-Series Expansion o{ (gE/X.X 2 )-1
( L)-I
= x1ql
The equation given by Wilson (1964) is
where the Qk 's are parameters deterrnined from experimental data and x I and x 2 are the mole fractions of species I and 2, respective1y. Application of equation 7.2-3 to equation 7.2-4 results in the power-series expansions of In)'1 and In)'2 that are due to Margules (l895). 7.1.1.2
157
Further Discussion of Chemical Potentials in Nonideal Systems
-
À2
J]
RT'
(7.2-10)
(7.2-11 )
and V I and v 2 are the molar volumes of pure (liquid) species I and 2, respectively, and the À's are interaction energies. This equation can also be extended to multispecies systems. 7.2.1.5
lhe Regular-Solution Equation
The concept of a regular solution (Hildebrand et aI., 1970) provides the following expression for gE:
11te Wohl Expansion
The equation of Wohl (1946) is gE
gE x1ql
+ x 2Q2 \
= 2a
z 12 1'"2
+ 3a l12 z l2z 2 + 3a l22 z)zi
+4a II12 Z?Z2
=
V(Íl!
(7.2-12)
where
+ 4a l222 Z zi + 6al122z~zi + ... , j
(7.2-6)
v =
XIV)
+ X 2V 2 '
(7.2-13)
1>1 and 4>2 are volume fractions of species 1 and 2, respectively, with, for
158
in solution from volumetric data for the solution since
example. XlVI
>1
=
/li
(7.2-14)
-V
A 12
= (SI
=
/li
+
- S2)2.
(7.2-15)
ô is the solubility parameter and is formally defined as the square root of the cohesive-energy density of the species~ thus, for species 1, 01 =
(_~_,'
)'/2 ~
va
(_!1_H......:1_ :__-_R_T) 1/2,
(7.2-16)
where j,u is the cohesive energy. which is approximately equal to the energy of vaporization (ó'Hvap -- RT).
Use ofEquations of State
RTln
JP( - RT) dP. = o Vi - P
f
J; = oo[/ap) RTln-' 1xiP v \ an; T, v, li}""
I 1
The fugacity J; of a species in a solution, whether gas, liquid, or solid, can be determined, in principIe. from PvTx (volumetric) information by means of equation 3.7-32 (Prausnitz, 1969, p. 30),
= O,
(7.2-19)
the form of which must be obtained from experimental data or a theoretical . model. If
I
h xiP
(3.7-29)
RTln Y;x i •
This procedure is limited by the requirement that the volumetric data be available as a function of T, P, and x. This, in turn, requires either a very large amount of experimental data or an appropriate equation of state,
and
7.2.2.
159
Further Discussioll oI Chemical Potentials in Nonideal Systems
Cbemical Equilibrium Algorithms for Nonidea\ Systems
-RT] V
dV-RTlnz,
(7.2-20)
where z is the compressibility factor defined by PV z = n/RT'
I
(7.2-21)
I
In spite of the limitations notOO, we briefly outline three of the most widely used equations of state.
(3.7-32)
1 The activity coefficient Yi of the species is related to the fugacity by (Vall Ness, 1964,p.31)
J;
I
I
i
where /;*. lhe fugacity of species i in the standard state, is similarly determined, for example, from equation 3.7-7. It follows that Yi can be determined from volumetric data by, in the case of a gaseous system, 1
= exp [ RT ~
P
d
v
B
(7.2-18)
where ct is the molar volume of species i in the standard state [for the Raoult convention, it is the pure-cQmponent molar volume at (T. P), and for the Henry convention, it is the partial molar volume at infinite dilution at (T, P)]. Thus, in principIe, it is possible to determine the chemical potentia1 of a species
= 1 + 8(T, x) + C(T, x) + . "
'
(7.2-22)
where B, C, ... are caUed the second, third, ... viria1 coefficients. The composi tional dependence of the n th virial coefficient is ageneralized n th-degree linear form in the mole fractions (Mason and Spurling, 1969, p. 57). That is,
-
(Vi - V:) dPJ,
The Virial Equation
z = Pv RT
(7.2-17)
Yl = x1f;*'
Yi
7.2.2./
The pressure-explicit (Leiden) form of the virial equation is
= L: xixjBi )
(7.2-23)
i. )
and
I I
I
c = L: i.j.k
XiXjXkCi)k'
(7.2-24)
OtemicaJ Equilibrium Algorithms for Nonideal Systems
160
Although Bij , Cjjk ,. • • are detenninable in principIe from intermolecular potential functions, these are rarely known accurately except for the simplest of molecules. The virial coefficients for pure species can be obtained experi mental1y from volumetric data, but those for species in solutions are rarely available. It is thus usually necessary to postulate "mixing mIes" relating the virial coefficients of the solution to those of the pure species (Mason and Spurling, 1969, pp. 257-265). Equation 7.2-22 may be inverted to give the volume-explicit (Berlin) form of the virial equation (Putnam and Kilpatrick, 1953). The main disadvantage of the virial equation is its inapplicability to high densities (and hence to liquids). 7.2.2.2
The Redlich-Kwong Equation
The equation of Redlich and Kwong (1949) is a two-parameter, pressure-ex plicit form: Pv
Z
v
= RT = v -
a b - RT 3 /
2(
v
+ b) ,
(7.2-25)
species with spherically symmetrical molecular force fields, such as argon and krypton (Pitzer, 1939). For these, in its simplest (two-parameter) macroscopic form, the theory may be written as
z;(TR , PR } = zo(TR , PR ),
lhe Benedict-Webb-Rubin Equation
The equation of Benedict, Webb, and Rubin (1940, 1942) is also in pressure expliciL form and requires arbitrary mixing rules; it contains eight parameters: RT BoRT - Ao + Co/T 2 P=-+ v V2
bRT - a
+ -V3-
-"I)
+aa - + - -c2- -1-+ e"Ix p ( v6 T v 3 v2 V2'
(7.2-26)
This equation has been widely used for liquid-vapor equilibrium in líght hydrocarbon systems (Benedict et aI., 1951), and values of the parameters are available for a number of species (Holub and Vonka, 1976, Appendix li). 7.2.3
Use of Corresponding States Theory
The theory of corresponding states provides an alternative, gencrally less precise, approach to determining information about chemical potentials from volumetric data [for a review, see Mentrer et alo (1980)]. This approach is often useful when insufficient data are available to use the methods of the previous two sections. The theory has a rigorous statistical mechanical basis for simple
(7.2-27)
where Zi is the compressibility factor of any species i, and Zo is that of a reference species; T R and P R are respectively the reduced temperature and pressme defined by P
T TR = Te'
PR = Pc'
(7.2-27a)
where Te and Pc are the criticai temperature and pressure, respectively, of the species. Equation 7.2-27 expresses the idea that any two species behave the same volumetricaliy at the same reduced conditions of temperature and pressure. This is only approximate for most species, however, but it can be improved by the addition of a third parameter. Thus Pitzer (1955) and Pitzer et aI. (1955) have introduced the acentric factor w as a measure of the departure from spherical symmetry and defined empirically by
where a and b are the two parameters. There are no rigorous expressions relating these parameters to x corresponding to equations 7.2-23 and 7.2-24, and arbitrary mixing ruIes must be used (Redlich and Kwong, 1949). 7. 2. 2..i
161
Further Discussion of ChemicalPotentials in Nonideal Systems
w
= -lOgIO(
~* ) e
- 1.000.
(7.2-28)
T R -=O.7
Tables of values of w and derived thermodynamic quantities for pUfe species ("normal" fluids) are given by Lewis and Randall (1961, pp. 605-629). Normal fluids are essentially nonpolar, and for polar species, an additional parameter must be introduced. The theory of corresponding states may be extended to solutions in severa} ways. One way is to assume that the properties of the solution are those of a hypothetical fluid characterized by criticaI constants that depend in some way on ihe criticaI constants of the species in the solutiofi. This may be caUed a one-fluid model of the solution. Two- and three-fluid models rnay also be used in which the properties of the solution are determined from averages of the properties of two and three hypothetical species, respectively (Scott, 1956). The implementation of a one-fluid model, to which we confine attention, requires equations expressing the properties of the hypothetical fluid in terms of those of the (pure) species of the solution. The first and simplest of these was suggested by Kay (1936) for the criticai CORstants: . Te = LxjTCi
(7.2-29)
i
and Pc
= 2 X i PCi'
(7.2-30)
162
OIemical Equilibrium Algorithms for Nonideal Systems
to which may be added W
= 2:x i w
(7.2-31)
j •
Eqt:ations 7.2-29 and 7.2-30 are known as Kay's rule for pseudocritical con stants. It is not necessary that the equations be of this form, and other expressions have beeo postu1ated. For example, Leland et aI. (1962) have proposed, in terms of Te and vC ' the criticaI volume, rather than Tc and Pe, Tcvc
= 2: xixjTC;jvC;j
(7.2-32)
i. j
and ve
= 2: XiXjVC;j'
(7.2-33)
163
Further Oiscussion of Chemical Potentials in Nonideal Systems
it is not necessarily defined (Harned and Robinson, 1968, pp. 10, 33) in the same way as for solutions of nonelectrolytes (Section 3.7.2). These remarks notwithstanding, we attempt a brief description of methods for estimating activity coefficients for single electrolytes, but original sources should be consulted for greater detail and for rnixed electrolytes. As an empirical extension of the Debye-Hückellimiting law, the following equation has been provided by Davies (1962) for the mean-ion activity coefficient of a single electrolyte in dilute aqueous solution at 25°C: -loglo)'~
= 0.5I z + z _1 ( 1 +1°·5/0.5
)
-
(7.2-38)
0.30/ ,
where z+ and z_ are the cation and anion charges, respectively, and 1 is the ionic strength of the solution, defined by
;. j
1 = 0.52: m,z;2.
(7.2-39)
where
Tc ;;
= TCi ,
(7.2-34)
V Cii
= vc;,
(7.2-35)
1/3 __ I (
v Cij
1/3
-"2 VCií
+ V 1/ 3). ' LJj
(7.2-36)
and
Teíj
= ~iATCi;TCjJ 1/2( ( j ~ I).
(7.2-37)
Once lhe criticaI properties Df the hypothetical fluid are determined, the compressibility factor is deterrnined in the usual way from equation 7.2-27 or its equivalent, augmented by the acentric factoL The equations due to Leland et aI. (1962) are not completely arbitrary since they have some justification from statis tical mechanics (Leland et aI., 1968).
7.2.4
Equation 7.2-38 is intended to provide a mean-íon actlvny coefficienl tha! takes ion association into account. For uni-univalent electrolytes, equation 7.2-38 predicts a value of y"" = 0.785 at m = 0.1; experimental values for 50 electrolytes were shown to agree with a rnean deviation of less than 2%. For 40 uni-bivalent and bi-univalent electrolytes, the mean deviation from the calcu lated value of 0.545 was about 4%. For several bi-bivalent electrolytes, the agreement i5 less satisfactory, and the equation may be limited in its use for these to concentrations of less than about 0.05 m. The relation between rnean-ion activity coefficients that do and do nol take association into account is given by Davies (1962). Since the concentrations at which the equation is valid are relative1y 10\\". activity coefficients calcuJated fram equation 7.2-38 may be used either on a molality or on a molarity basis. For higher concentrations 01' a single electrolyte, Bromley (1973) has pre sented a correlation, which for 25°C becomes __ 0.511Iz+z_l1o.5 + (O.06+0.6B)lz+z __ 1 +Bl, log]()y",,-1+/°.5 (1+1.51/lz+z_lt7 1
Electrolyte Solutions (7.2-40)
The correlation and prediction of activity coefficients of electrolytes in solution is perhaps an even more difficult task than that for nonelectrolytes, to which the previous three sections have primarily been directed. Caution (cf. N ordstrom et aI., 1979) is required in selecting, interpreting, and applying appropriate equations for single ions and electrolytes, let alone rnixed electrolytes. The concept of excess free energy has been applied to solutions of electrolytes, but
where B is a parameter, values af which are given by Brornley for many electrolytes at 25°C. Representatian af actlvlty coefficients for mixed electrolytes has been considered, for example, by Meissner and Kusik (1972), Bromley (1973), and Pitzer and Kirn (1973): and has been rcviewed by Gautam and Seider (1979).
general by
7.3 ALGORITHMS FOR NONIDEAL SYSTEMS
/li(m)
We describe three classes of method for performing equilibrium calculations in nonideal systems. The first of these consists of "indirect" methods based on algorithms for ideal systems, which are well developed and hence serve as points of departure for algorithms for nonideal systems. The second class consists of "direcC' methods, which consider the nonideality explicitly from the outset and whose algorithms are derived in a manner similar to the one that has been used for ideal systems in Chapter 6. The third class is intermediate between the first two and consists of approaches that use the same work:ing equa tions of the ideal-system algorithms but use the appropriate nonideal values of the chemical potentials. We consider each of these three classes in turno 7.3.1
165
Algoritbms for Nonideal Systems
Chemical Equilibrium Algorithms for Nonideal S~stems
164
= p.i + RTln Yj(T, P, n(tn»;
m
=
1,2,3, ... ,
(7.3-3a)
until the composition on successive iterations remains constant to within some specified tolerance. The procedure is illustrated schematical1y in the flow chart shown in Figure 7.1. This procedure can be used in conjunction with any ideal-system calculation method, such as the BNR Of VCS algorithm in Chapter 6. Folkman and Shapiro (1968) have given a set of sufficient conditions on the Yi for such a scheme to produce a decreasing sequence of free-energy values that converges
Indirect Methods Based on Algorithms for Ideal Systems
An indirect method, first suggested by Brinkley (1947), has been used by Fickett (1963, 1976) and Cowperthwaite and Zwisler (1973) in calculating the detonation properties of explosives. Vonka and Holub (1975) have also used it in computing equilibrium compositions of real gaseous systems. The approach is based on the fact that equation 3.7-29 may be written as /Li
= P.f + RTln Yi(T,
P, n)
+ RTln Xi'
(7.3-1 )
The first two terms are combined, and the equation is formally rewritten as JLi = /lj[T, P,n*(T, P)]
+ RTlnx i ,
(7.3-2)
where lL7 is now a function of T and P through the (unknown) equílibrium solution n*. Equation 7.3-2 is written in the ideal-solution forro for the chemical potential (equation 3.7-15a). The calculation procedure is an iterative one, in which the first step is to compute the equilibrium composition assuming ideality ('ri = 1), yielding a first approximation to the system mole numbers n(I). Then the activity coefficients 'Y for the nonideal system are computed from a known chemicaI potentiaI expression at this composition n(l). In the next step the equilibrium composition in the "ideal" system is computed frem equation 7.3-2, with Mi replaced by ,...;(1)
=,...j + RTln'rj(T, P,rfI»).
Calculate ldeal-system equilibrium composition, using lIi = II;*(T, Pl + RT In Xi yielding the estimate n l11
I I
c:_==r=
I
Calcui ate real-systeml'lml from "Im)
I
I
~~"'I ~_=}J-j'(T.p)+RTlnljm!
I
Compute ideal-system equilíbrium composition, using flj
= Ilt 1m1 + RT In Xi yielding
No
Ali I n; Im + 1)
-
01m+1 i
n/ m II small enough?
(7.3-3)
That is, we assume that Yi remains fixed at y,<J). This yields a second approxi
mation n(1). The procedure i5 repeated, and equation 7.3-3 is replaced in
Figure 7.1 Flow chart for calculating equilibrium composition in nonideal system by using ideal-system algorithm in an iterative procedure.
Chemical Equilibrium Algorithms for Nonideal Slstems
166
on the unique solution to the problem (provided that this exists). The iteration procedure may become subject to convergence difficulties, however. if the deviations from ideality are large. A simple approach to alleviate convergence difficulties is the parameter variation technique discussed in Chapter 5. We write P,i = Jii
+ aRTln"'fi + RTln Xj,
(7.3-4)
in which we regard a as a parameter that is zero in the ideal system and unity in the nonideal system. The technique is to calculate equilibrium compositions by the method ilIustrated in Figure 7.1 for a sequence of values {a(m)} corresponding to a sequence of hypotheticaI nonideal systems with Jii ==
p.1 + a(m)RTln"'fi + RTln Xi'
(7.3-5 )
The value of a(m) is changed gradually from zero to unity. At each step the equilibrium composition for a = a(m) is used as the initial estimate of the solution for the calculation at ex = a(m+I). The important practical problem in the implementation of this approach is, of course, a wise choice of the sequence {a(m)}.
Example 7.1 Calculate the composition (mo]alities) at equi]ibrium at 25°C for the aqueous system {(H 3 P04 , H 2 P04- , HPol-, pol-, CaHP04 • CaH 2 P04+, CaPO;, Ca2+, CaOH+, H 20, H+, OH-), (H,P,O,Ca,p)} (cf. Feenstra, 1979). The value of b is based on 0.0009 mole of H 3 P04 and 0.0015 mole of CaHP04 dissolved in 1 kg of water. The standard free energies of formation 01' the species are AGI / RT = (-451.49, -439.12, - 439.40, -410.98, -662.70, -665.66, -649.16, -223.30, -289.80, -95.677, O, ~63.452)T. The data are fram Wagman et aI. (1965- ]973), with the exception of lhe values for CaH 2 PO: and CaP04- , which are calculated fram informa tion given by Feenstra. Solution In this system, as for many electrolyte systems, C =1= M. We discuss such problems in general in Section 9.3. and we note here that, in solving this problem, we may ignore any row of A, provided that C = rank (A, b).
The solution follows the flow chart in Figure 7.1. For the activity coeffi éients, it is assumed that lhe Davies equation (equation 7.2-38) is valid for the individual ionic species and that neutral species are ideal. The ideal-solution values and results for the first three iterations for the nonideal solution are shown in the fol1owing tabular list (lhe fourth iteration gives the same values as the third). The number of moles of H 20 and the ionic strength 1, ca1culated from equation 7.2-39, are given below lhe molalities. The charge balance (not shown in the list) is satisfied to within 10- 14 on a mola1ity basis.
167
Algorithms for Nonideal Systems
Molality
Species Ideal Solution H 3 P04 X 10 4
HzPO; X 10 HPol- X 10 3 X 10 12 CaHP04 X 10 6 CaH 2 P04+ X 10 8 CaPO; X 10 9 Ca2+ X 10 3 CaOH+ X 10 13 H+ X 10 3 OH- X 10 12
pol-
H 20, moles I X 10 3
3.044 1.300 2.093 1.372 1.519 3.473 2.010 1.498 2.239 1.190
1.564 2.014 0.881 3.0]4 5.996 3.825 1.497 3.082 1.035 9.771 55.5062
3.055 1.304 2.092 1.364 1.533 3.500 2.027 1.498 2.248 1.188 1.018 55.5062
3.045 1.301 2.093 1.372 1.519 3.474 2.010 1.498 2.239 1.190 1.019 55.5062
55.5062
7.5393
7.7746
7.7778
7.7778
3.817 6
Iteration 1 ltcration 2 Iteration 3
1.019
7.3.2 Direct Methods
We consider here the structure of algorithms that attack the problem taking into account nonideality from the outset. There are three types of approach: (1) first-order methods; (2) second-order methods; and (3) quasi-Newton or variable metric methods (Powell, 1980). As for ideal-system algorithms, basic differences also result fram whether they are constructed as nonstoichiometric a1gorithms or as stoichiometric algorithms. In the literature these have usually been developed in the context of a specific form of chemícal potentíal. For this reason, the general features of the algorithrns are somewhat obscured, and we elaborate each of these types in the fol1owing. 7.3.2.1
First-Order Methods
In these methods on1y f..ti itself is used. Any of the ideal-system algorithms discussed in Chapter 6 that do not use compositional derivatives of Ji i remain relative1y unchanged for nonideal systems. The only difference is that the appropriate nonideal model for f..t i is used instead of the ideal-solution formo The stoichiometric algorithm given by Naphtali (1959. 1960, and 1961), the nonstoichiometric algorithm due to Storey and van Zeggeren (1964), and the gradient-projection algorithm given .1n Section 6.3.1.1 are examples of this type. 7.3.2.2
Second-Order Methods
In methods of this type ap,jon i is usedexplicitly. We consider bOlh the nonideal versions of the second~order nonstoichiometric and stoichiometric algorithms presented in Chapter 6.
168
Chemical Equilibrium Algoritluns for Nonideal Systems
The nonideal versions of the nonstoichiometric Brinkley-NASA-RAND (BNR) algorithm result from direct consideration of theequilibrium conditions (equations 3.5-3 and 3.5-4) and follow the derivation of Chapter 6 up to the point where the ideal-solution model for the chemical potentials is invoked. The nonideal version of the RAND variation is obtained by employing the Newton-Raphson method in equations 3.5-3 and 3.5-4. This gives (cf. Boynton, 1963; Michels and Schneiderman, 1963; Zeleznik and Gordon, 1966; and Gautam and Seider, 1979) N' (a M -..!!i ) RT.~ an. Bn j + i:: a ki l)lfk J=I J ,,1'''1 k=1
- _1_
(m)
(m) ~
(m) _
RT
-
_
M
~ ak;lfk k=1
(m).
,
discussed in Chapter 6, where the ideal-solution form of equations 6.3-17 and 6.3-20 is preferabie for systems with relatively small numbers of elements and phases. A number of stoichiometric algorithms have been developed since about 1970 for computing equilibrium in aqueous systems. These have been reviewed by Nordstrom et aI. (1979), who compare a number of them and provide an extensive bibliography, mostly from the field of geochemistry. These algorithrns generally use the Newton-Raphson or a related method to solve the nonlinear equations 3.4-5. The computer programs are rather specialized for this particular application and usually have thermodynamic data files as internaI components. 7.3.2.3
i= 1,2, ... ,N'
(6.3-17)
and N'
~
Q
~
j=1
.81f~1II) = b - b(m).
kJ
k
J
k= 1,2, ... ,M,
k,
169
Problems
Quasi-Newton or Variable Metric Methods
Essentially, numerical information about J1.; is used on successive iterations to construct approximations to oIL;/ôn j in these methods. This type of approach has been used to solve chemical equilibrium problems by George et aI. (1976) and Castillo and Grossman (1979).
(6.3-20) 7.3.3 Intermediate Methods Based on Algorithms for Ideal Systems
where N'
b(m) k
-
-
~
~
a
n(m). ,
kj j
k
j=1
=
1,2, ... ,M.
(6.3-21)
The quantities n(m) and 1/;(m) are estimates of the solution at iteration m. Equations 6.3-17 and 6.3-20 are a set of (N' + M) linear algebraic equations in as many unknowns, which must be solved on each iteration of the method. For an ideal solution, this number may be reduced to M, as in Chapter 4, or to (M + I), as in Chapter 6, but tbis is not possible in general. The nonideal version of the stoichiometric afgorithm in Section 6.4.3 is based on consideration of equations 3.4-5. On each iteration, the linear equations resulting from the Newton-Raphson method, R
~
~
1=1
N'
l)l:(m) ""
N'
~ ~
~ ~
;==1 k=1
N'
( ap'; )
";j"k'
an
k
_ n(m)
~
(m).
~ "ijILI'
;=1
,
j = 1,2, ... ,R,
(7.3-6) (cf. equation 4.3-2) must be solved for the reaction-adjustment parameters 8€(m). Equation 7.3-6 consists of a total of R = (N' - M) equations, as opposed to (N' + M) in the case of equations 6.3-17 and 6.3-20. Thus
equation 7.3-6 is to be preferred. This should be contrasted with the situation
A third class of algorithm, intermediate between the first two, consists of using the working equations of an ideal-system algorithm, except that the chemical potential is replaced by its nonideal value in the calculation procedure (e.g., Eriksson and Rosen, 1973). This amounts to using the ideal-solution values for the compositional derivatives of p. and the nonideal values for p. itself.
7.3.4 Discussion Computational experience with the three classes of method described in this section is rather limited. Given this, we believe that the indirect and intermediate classes appear to be most useful since they can be employed in conjunction with any available ideal-system algorithm. Of the direct class of methods, the second-order stoichiometric algorithm is considerably simpler than the nonstoichiometric version. The quasi-Newton methods also appear prornising.
PROBLEMS 7.1 Continue Problem 6.8 by calculating theequilibrium mole numbers, using the third model studied by Vonka and Holub (1975)-a nonideal solution. Use the Redlich-Kwong equation of state to calculate fugacity coefficients (and hence activity coefficients). For a species in a nonideal