Professional Documents
Culture Documents
1
(c)Use Excel's "Solver" to solve the problem as a constrained minimization problem
without the use of Lagrange multipliers and without differentiation of the objective
functions. Compare the results with those obtained in (b).
4.5.5 Solution
G c G0 n
min ni i ln i (1)
ni RT i 1
RT ni
where ni is the number of moles of component i, c is the total number of
0
compounds, R is the gas constant and Gi is the Gibbs energy of pure component
i at temperature T. The minimization of Eq. 1 is carried out subject to atom
balance constrains:
c Gi0 ni 3
min F n ln j g j (5)
RT n i j 1
i
ni , j i 1
The condition for minimum of this function at a particular point is that all the
partial derivatives of F with respect to ni and λj vanish at this point. The partial
derivative of F with respect to n1, for example, is
F G10 n
ln 1 42 3 0 (6)
n1 RT ni
The other partial derivatives with respect to ni can be obtained similarly. If it is
expected that the amount of a particular compound at equilibrium is very close to
zero it is preferable to rewrite the equation in a form that does not require
calculation of the logarithm of a very small number. Rearranging Eq. (6), for
example, yields
G0
n1 n i exp 1 4 2 3 0 (6a)
RT
The partial derivatives of F with respect to λ1, λ2 and λ3 are g1,g2 and g3,
respectively.
2
(b) The complete set of nonlinear equations, as entered into the Polymath
nonlinear algebraic equation solver, is shown in Table 2. There are 12 implicit
equations associated with the 12 unknowns. In the Polymath input the amount
(moles) of a compound (ni) are represented by the formula of the compound, for
clarity. The equations associated with O2 and C2H2 are written in the form of Eq.
(6a) as preliminary tests have shown difficulty in convergence of the solution
algorithm when equation that contains logarithm of the amount of those
compounds was used.
The initial estimates suggested by Balzisher et al. (shown in Table 1) are entered
in lines 15 through 23 of the Polymath input. Only the "constrained" algorithm
converges to the solution from those initial estimates, while the other algorithms
stop with the error message that the calculation of the logarithm of a negative
number is attempted. The constrained algorithm allows definition of some or all of
the unknowns as "absolutely positive" variables, meaning that they are not
allowed to obtain negative values during the solution process.
3
process (lines 15, 17, 18 and 19) or they are allowed to have both negative and
positive values (lines 24, 25 and 26).
In Table 3 the Polymath solution for the equilibrium composition of the effluent
mixture are shown. It can be seen that the effluent contains significant amounts of H2
(5.345 moles per mole of C2H6 fed), H2O, CO, CO2 and CH4 and only trace amounts
of C2H6, C2H4, C2H2 and O2. All the function values are smaller by several orders of
magnitude than the respective variable values, indicating that the solution is correct
(the same values were obtained also by Balzisher et al., who used a dedicated
FORTRAN program to solve the same problem).
To find the value of the objective function at this point Eq. 1 should be added to the
Polymath input. The additional equations comprising Eq. (1) are shown in Table 4.
The objective function value at the solution is -104.34.
(c) In order to use the Excel "Solver" equations (1) through (4) entered into Polymath
and exported to Excel. The equation set is shown in Table 5. In lines 5, 6 and 7 the
atom balance constrains (equations 2, 3 and 4, respectively) are entered. The
4
equations in line 4 and lines 9 through 18 are components of the objective function
(Eq. 1). It should be noted that the Solver cannot find the minimum if Eq. 1 is entered
in its original form. It stops with error messages indicating that there is an attempt to
calculate logarithm of a negative number. In order to prevent calculation of logarithm
of a negative number or logarithm of zero the expression for calculating the partial
Gibbs energy of some of the compounds was changed to the following expression:
Gi G0 n
ni i ln abs i (7)
RT RT
n
i
where ε is a very small number (ε = 10-21 is used). This form of the equation is
used for the compounds which present only in trace amounts in the effluent: O2,
C2H2, C2H4 and C2H6.
A B C D E
5
In cells C19 through C27 the initial estimates for the nine variables are introduced.
The use of the Solver for this problem is explained with reference to figures 1 and 2.
The "target cell" to be minimized is cell C18 which contains the formula for the
objective function (see Table 5). The cells to be changed are the cells which contain
the numbers of moles of the various compounds. Three constrains (Equations (2), (3)
and (4)) should be explicitly entered, while the constrains regarding the positive
value of the compounds can be specified in the "Options" communication box.
6
Table 6. Effluent Composition and Minimum of Gibbs Energy by Various
Techniques
Solution
Initial Excel Balzisher
No. Component Estimate Polymath Solver et. al1
0.0014944
0.066456
1 CH4 0.001 0.066564 4
2 C2H4 0.001 9.54E-08 1.0112E-06 9.41E-8
3 C2H2 0.001 3.16E-10 2.9847E-07 3.15E-10
0.5344196
0.544917
4 CO2 0.993 0.544918 7
1.4639625
1.3886
5 CO 1 1.388517 9
6 O2 0.007 5.46E-21 0 3.704E-21
5.5296297
5.3455
7 H2 5.992 5.345225 7
1.4671980
1.5215
8 H2O 1 1.521646 4
9 C2H6 0.001 1.67E-07 6.0332E-05 1.572E-7
Gibbs Energy -103.61831 -104.34 -104.27612