(245r) A Systematic Procedure for Analysis and Modification of Nonlinear Equation Sets to Enhance Convergence and Reduce Computational Effort
AIChE Annual Meeting
2016
2016 AIChE Annual Meeting
Computing and Systems Technology Division
Interactive Session: Applied Mathematics and Numerical Analysis
Monday, November 14, 2016  3:45pm to 5:45pm
Many practical problems in chemical
engineering give rise to the need to solve systems of nonlinear 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

x_{0}

x*

f(x*)

1

R = 40 

2

f1 = x1+x43 = 0

x1

2

2.9976

3.55E05

3

f2 = 2*x1+x2+x4+x7+x8+x9+2*x10R = 0

x2

5

3.9664

3.37E04

4

f3 = 2*x2+2*x5+x6+x78 = 0

x3

40

80

5.34E05

5

f4 = 2*x3+x54*R = 0

x4

1

0.0023645

6.04E04

6

f5 = x1*x50.193*x2*x4 = 0

x5

0

6.04E04

1.99E08

7

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

0

0.0013659

1.00E07

8

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

0

0.064573

2.57E08

9

f8 = x8*x41.799e5*x2*xs = 0 
x8

0

3.5308

3.59E08

10

f9 = x9*x40.0002155*x1*sqrt(x3*xs) = 0 
x9

0

26.432

1.45E06

11

f10 = x10*x4^23.846e5*xs*x4^2 = 0 
x10

5

0.0044998

1.56E13

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 (x_{i}, i=1…10),
requiring 10 initial guesses. The x_{i}'s represent the number
of moles of the various components, thus
all x_{i} must be ≥0. Four variables are constrained to
nonnegative values (x_{1}, x_{2}, x_{3},
x_{4} and x_{s}). 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. 198199 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

x_{0}

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.04E04



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.15E10

11

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



0.0044998

3.02E16

12

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

100

116.9995

5.409E11

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 (x_{2}
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),
915 (1999)
2.
POLYMATH is a product of Polymath
Software (http://www.polymathsoftware.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, 14491457 (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)