(245r) A Systematic Procedure for Analysis and Modification of Nonlinear Equation Sets to Enhance Convergence and Reduce Computational Effort | AIChE

(245r) A Systematic Procedure for Analysis and Modification of Nonlinear Equation Sets to Enhance Convergence and Reduce Computational Effort

Authors 

Shacham, M. - Presenter, Ben Gurion University of the Negev
Brauner, N., Tel-Aviv University

      Many practical problems in chemical
engineering give rise to the need to solve systems of non-linear algebraic
equations (NLE). Typical examples include phase equilibrium and chemical
equilibrium computations, steady state process simulation, flow distribution in
pipeline networks etc. Nowadays powerful mathematical software packages are
available for solving systems of NLEs. Shacham and Cutlip[1]  evaluated and compared six state of the art
software packages. In this work only the POLYMATH[2] and MATLAB[3]
packages are employed. Based on our experience, these packages can serve as
good representative of the additional ones. 

      Some of the library functions for solving
NLEs employ "globally convergent" methods (see, for example p. 176 in
Press et al[4]), but even such methods are often unable to find the
solution from certain sets of initial estimates. In such cases some trial and
error with regard to the initial estimates may be required in order to enable
the algorithm to converge to the correct solution. A common cause of such
difficulties is the presence of discontinuities and/or regions where some of
the functions are undefined (Shacham and Brauner[5]). The impact of
such discontinuities becomes most severe if they lie in the vicinity of the
solution. Consider, for example the "Combustion of Propane in Air"
test problem of Hiebert[6] shown in Table
1.

Table
1. Hiebert’s[6]  "Combustion of Propane in Air" NLE
Solver Test Problem

No.

Equations

Variable

x0

x*

f(x*)

1

R = 40  

2

f1 = x1+x4-3 = 0

x1

2

2.9976

-3.55E-05

3

f2 = 2*x1+x2+x4+x7+x8+x9+2*x10-R = 0

x2

5

3.9664

3.37E-04

4

f3 = 2*x2+2*x5+x6+x7-8 = 0

x3

40

80

-5.34E-05

5

f4 = 2*x3+x5-4*R = 0

x4

1

0.0023645

6.04E-04

6

f5 = x1*x5-0.193*x2*x4 = 0

x5

0

6.04E-04

-1.99E-08

7

f6 = x6*sqrt(x2)-0.002597*sqrt(x2*x4*xs) = 0

x6

0

0.0013659

-1.00E-07

8

f7 = x7*sqrt(x4)-0.003448*sqrt(x1*x4*xs) = 0

x7

0

0.064573

2.57E-08

9

f8 = x8*x4-1.799e-5*x2*xs = 0

x8

0

3.5308

-3.59E-08

10

f9 = x9*x4-0.0002155*x1*sqrt(x3*xs) = 0

x9

0

26.432

1.45E-06

11

f10 = x10*x4^2-3.846e-5*xs*x4^2 = 0

x10

5

0.0044998

-1.56E-13

12

xs = x1+x2+x3+x4+x5+x6+x7+x8+x9+x10

117.00021

      This example comprises of 10 implicit
algebraic equations with 10 unknowns (xi, i=1…10),
requiring 10 initial guesses. The xi's represent the number
of moles of the various components,  thus
all xi must be ≥0. Four variables are constrained to
non-negative values (x1, x2, x3,
x4 and xs). Using
a constrained NLE solver several solutions to this problem can be obtained, some
of them are physically infeasible. The solution shown in Table 1 (x*)
was obtained by CONLES, the constrained NLE solver algorithm of Shacham[7] , which is
available in POLYMATH and also for MATLAB (see pp. 198-199 in [8]). 

      To alleviate the solution of NLE systems
which contain discontinuities the following systematic procedure is proposed.

1.   Identify expressions with discontinuities
(like logarithm, square root, division by unknowns, etc.). Modify such
expressions as to eliminate the discontinuities (replacing log by exp., for
example), if possible.

2.   Select a unique "output" variable
from each of the equations, where an output variable only appears on the left
hand side (l.h.s) of one (and only one) of the
equations. Leave the equations from which no output variable can be selected in
an implicit form.

3.   Mark the unknowns that could not be selected
as output variables as of "known" (value) and arrange the explicit
equations in a sequence so that only "known"  variables appear in the r.h.s.
of the equations and the "output" variable on the l.h.s.
Explicit equations that cannot be arranged in this form should be rewritten as
implicit equations.

4.   Solve the revised system of equations with an
NLE solver program.

5.
Substitute the solution obtained into the original NLE system to verify that
the reformulated and rearranged system is identical (in terms of the solution
obtained) to the original system.

      Applying the proposed procedure to the
example problem yields the results of Table 1.

Table
1. Revised Formulation of the Example Problem

No.

Equations

Variable

x0

x*

f(x*)

1

R = 40  

2

x1 = 3 - x4

x1

-

2.9976

-

3

x5 = 4 * R - (2 * x3)

x2

-

3.966427

-

4

x2 = x1 * x5 / (.193 * x4)

x3

40

79.9997

-

5

x6 = .002597 * sqrt(x4 * xs)

x4

1

0.0023645

-

6

x7 = .003448 * sqrt(x1 * xs)

x5

-

6.04E-04

-

7

x8 = .00001799 * x2 * xs / x4

x6

-

0.0013659

-

8

x9 = .0002155 * x1 * sqrt(x3 * xs) / x4

x7

-

0.0645727

-

9

x10 = 0 - ((2 * x1 + x2 + x4 + x7 + x8 + x9 - R) / 2)

x8

-

3.530816

-

10

f1 = 2 * x2 + 2 * x5 + x6 + x7 – 8 = 0

x9

-

26.43155

1.15E-10

11

f2 = x10 * x4 ^ 2 - (.00003846 * x4 ^ 2 * xs) = 0

x10

-

0.0044998

-3.02E-16

12

f3= xs - (x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8 + x9 + x10) = 0

xs

100

116.9995

-5.409E-11

      Observe that the use of the proposed
procedure alleviated the problem solution by reducing the dimension of the
problem (3 implicit equations, instead of 10), reduction of the number of
initial estimates that need to be provided (3 instead of 10) that enables
providing good initial estimates based on physical considerations, and reducing
the number of variables that are associated with discontinuity (x2
is removed from the list).

      In the presentation the proposed procedure
for analysis and modification of NLE systems will be described in more detail
and several examples where the use of this procedure alleviates considerably
the solution of NLE systems that contain regions where some of the functions
are undefined, will be presented.

 

References

1.    
Shacham, M. and M.B. Cutlip, “A
Comparison of Six Numerical Software Packages for Educational Use in the
Chemical Engineering Curriculum”, Computers in Education Journal, IX(3),
9-15 (1999)

2.    
POLYMATH is a product of Polymath
Software (http://www.polymath-software.com).

3.    
MATLAB is a trademark of The Math
Works, Inc. (http://www.mathworks.com).

4.    
Press, W.H., P.B. Flannery, S.A. Teukolsky and W.T. Vetterling, Numerical
Recipes
, 2nd Ed., Cambridge University Press, Cambridge (1992)

5.    
Shacham, M. and  N. 
Brauner, ”Numerical Solution of Nonlinear Algebraic Equations with
Discontinuities”, Comp. & Chem. Eng., 26, 1449-1457 (2002)

6.    
Hiebert, K. L. "An
evaluation of mathematical software that solves systems of nonlinear equations".
ACM Transactions on Mathematical Software, 8, 5–20 (1983).

7.    
Shacham, M. Numerical solution of
constrained nonlinear equations. International Journal of Numerical Methods
in Engineering
, 23, 1455–1481 (1986)..

8.    
Cutlip, M. B., and M. Shacham, Problem
solving in chemical and biochemical engineering with POLYMATH, Excel and
MATLAB. 2nd Ed., Prentice Hall, Upper Saddle River, N. J.  (2008)