E.
Dieterich FEDERAL REPUBLIC OF GERMANY
G. Sorescu
G. Eigenberger
Numerical methods for
the simulation of
chemical engineering
processes
Fundamental aspects and the current state of the art in simu-
lating the dynamic and steady-state behavior of chemical engi-
neering processes are discussed. The discretization of the spatial
derivatives in the equations of change leads to a system of differ-
ential algebraic equations (DAE), consisting ofordinary differen-
tial equations in the time domain, and algebraic equations. The
present paper discusses the necessary steps to solve the DAE, and
mentions proven standard software for these steps as well as for
the solution of the differential algebraic equations as a whole.
1. Introduction Whereas mathematical analysis of experiments
is distinguished by a long and proven tradition in
Chemical engineering research and development is chemical engineering, detailed mathematical model-
based on the analysis and on the purposeful utiliza- ing and numerical simulation are techniques within
tion ofthe relevant physical-chemical interactions. In the framework of chemical engineering training that
this context, mathematical modeIing of these inter- are covered with an intensity greatly varying from
actions and their numerical simulation keep gaining one place to another. In addition, CUITent develop-
an increasing importance; they enable to concentrate ment of methods and procedures used in computer
experimental investigations on well-defined aspects, simulation is so rapid that it increasingly becomes
to discover complex relationships through the inter- more difficult to follow its growth.
play between experiment and numerical simulation, In this paper, on the one hand, important fun-
and to commercially exploit these. damentals of numerical simulation are sketched,
standard methods are explained, and a few sources
that are suitable for their study in depth are men-
From Chemie-Ingenieur-Technik 64, No. 2, pp. 136-147 tioned. On the other hand, developments are dis-
(1992), with permission. Dipl.-Ing. Erwin Dieterich, Dr.- cussed which have an effect on the application of
log. Gheorge Sorescu, and Professor Dr.-log. Gerhart numerical simulation, and which may become sig-
Eigenberger are associated with the Institut ftir Chemische nificant for its future use. In contrast to the com-
Verfahrenstechnik, Universitat Stuttgart, BobIinger Str. puter scientist, or the (numerical) mathematician,
72, D70199 Stuttgart 1.
the engineer usually considers numerical simulation
0020.631813414-04551$5.00 0 1994, American Institute ofChemi- as a tool with whose details he wants to become
cal Engineers. acquainted only up to a point which is necessary
INTERNATIONAL CHEMICAL ENGINEERING Vol. 34, No. 4 October 1994 455
for its practical application. This paper is based on convenient to explicitly carry B in the subsequent
that premise. However, it is apparent that, with the manipulations.
help of standard numerical tools, only standard prob- Equation (1) is a nonlinear partial differential
lems of computer simulation may be solved, and that equation (PDE) of the convection-diffusion type,
each foray into new territory forces consideration of which is widely used for the description of chem-
the whole spectrum of numerical methods available. ical engineering equipment, characterized by one-
The present paper also contains comments on this dimensional flow.
problem. The customary technique used for its numerical so-
Physically meaningful mathematical models of lution is the method of lines. This technique is based
chemical engineering equipment and plants are on discretization of the spatial derivative
based on the equations for conservation of mass, mo-
mentum, and energy. For most applications, so far DlPc _v 8c (5)
they have been limited to the use of one or two 8z2 8z
spatial coordinates; often, only the steady state is
e.g., by a simple equidistant difference approximation
treated. The latter limitation, however, is removed in
at point I, using step size Az:
this treatment, partly because consideration of dy-
namics becomes increasingly important for the un-
derstanding of chemical engineering equipment and
8c
8z
I~
I
CHI - cl-I
2Az
(6)
processes, and, partly, because inclusion of dynam-
ics often requires only small extra effort as compared
with the calculation of the steady state, and some-
times it even assures a better convergence of the so-
lPcl 8 (~)
8z2 I 8z
lution than a purely steady-state calculation. Above
all, however, dynamic simulation may be carried out
by using a highly standardized scheme, the so-termed CHI - 2Cl + Cl-I
= (7)
method of lines. Az2
This way, within the solution interval, the PDE is
1.1. Introductory ezample transformed into a system of NZ ordinary differen-
As an introductory example, the model of an tial equations. The equation at the point oflineariza-
isothermal tubular reactor is considered that can be tion 1 becomes
characterized by the mass balance on the concentra-
tion C of a key component for a controlling reaction.
Using the spatially one-dimensional diffusion con-
vection equation, the mass balance is as follows: where
D v
8c lPc 8c
0= Az2 + 2Az (9)
B at = D 8z2 - v 8z + S(c, z, t) (1) -2D
{3=- (10)
Az2
with the initial condition
D v
'Y = AZ2 - 2Az (11)
c(t = O,z) = cO(z) (2)
In view of coupling between Cl, Cl-I, cl+I, the system
and the boundary conditions of equations must be solved simultaneously. Inspec-
tion of the solution plane t above z (cf. Figure 1) offers
D-
8Z
Bcl = v(c(t, z = 0) - c*) (3) an explanation for the term method of lines. After dis-
%=0 cretization with respect to spatial derivatives, each
of the ordinary differential equations (8) obtained is
Bcl _0 (4) solved along a z = constant line.
Bz %=L -
Equation (8), written in vectorial notation, is as
The source term S(c, z, t) describes the rate of re- follows:
action which depends on the concentration c usually dy
B dt =~, z, t) (12)
in a nonlinear fashion, and that may also explicitly
depend on position and time. The capacity factor B where B is the capacity matrix; y is the solution vec-
in Equation (1) is equal to unity. Nevertheless, it is tor; andfon the right-hand side is the function vector
456 October 1994 Vol. 34, No. 4 INTERNATIONAL CHEMICAL ENGINEERING
t Next, the nonlinear right-hand side fmust be lin-
c..1 C1 C1.1 earized. Thislinearization can be carried out, e.g., by
expanding f about the old solution yk. The relation-
ship is as follows:
tt+1 (15)
where &f/{)y is the matrix of partial derivatives of the
right-hand side I with respect to all solutions V, the
so-termed Jacobian matrix, at the known time k.
t= 0 The solution at the new time k + I, therefore, re-
quires solution of the linear system of equations
1-1 1+1 z
I 0 I 0 I 0 I Robmaktor (16)
Fig. 1. Spatial discretization and integration with respect to
time of Equation (1) by the method of lines. where both the matrix of coefficients A and the vector
b on the right-hand side can be determined with the
help of model constants and the solutions at the last
1 stepyk.
1 The amount of computation required for the so-
lution of the system of Equations (16) depends on
B= 1 the structure of the matrix A, i.e., on the number
of elements in A that are different from zero, and
on the pattern of the nonzero elements. With ease,
1 it can be shown that the pattern is usually deter-
1 mined by the structure of the Jacobian matrix &f/{)y.
Cl h In the introductory example used, the Jacobian ma-
trix is tridiagonal (cf. Figure 2a) because, according
C2 h
to Equation (8), at point oflinearization I, the concen-
trations Cl-I. Cz, and CHI appear in the mass balance.
y = C, ;f= 11 (13) If the model of the tubular reactor under considera-
tion not only consists of a PDE of one concentration
but if also, e.g., equations for other concentrations as
CNZ-I INZ-I
well as for temperature, pressure, and density are
CNZ INz
required, then, in the vector y [Equation (13)], a sub-
vector appears instead of Cl, consisting of the vari-
A solution of the system (12) of first-order, nonlinear ables at point I, mentioned above. The function 11 in
differential equations can be carried out by first dis- the function vector f is replaced by a subvector of
cretizing the time coordinate t, using the index k and the appropriate spatially discretized right-hand side
the time step Llt: at point 1. Then, 8fi/{)Y, is the Jacobian submatrix at
point oflinearization 1, and, therefore, &f/{)Y and also
A obtain a block tridiagonalstructure (ef. Figure 2b).
••
••• DD
•••
••• ODD Fig. 2. Customary structures of the Jacobian ma-
trix J = 8(/()y or the solution matrix A [Equation
•••
••• ODD (16)]. a) tridiagonal structure of the introductory
•••
•• DD example; b) block tridiagonal structure when con-
sidering several state variables; c) convection-
a) b) c) diffusion system with recycle.
INTERNATIONAL CHEMICAL ENGINEERING Vot. 34, No. 4 October 1994 457
If, instead of simple flow through a reactor, a tubu- ture as the one shown by Equation (16) results, and
lar reactor with recycle were considered, then, the that must be iteratively solved.
first element I = 1 (input) would be coupled with the In the following section, the individual steps:
last element I = NZ (output). In the pattern of the 1. discretization with respect to the space coordi-
Jacobian matrix and of the A matrix, the additional nate;
coupling block at position (1, NZ) is shown in Figure 2. discretization with respect to the time coordi-
2c. In this way, the peculiarities of spatial coupling nate;
are built into the matrix A of the linear system of 3. solution of the nonlinear system of equations;
Equation (16) for each piece of equipment and each and
process in an unambiguous way. 4. solution of the linear system of equations are
Also, the capacity matrix B introduced by Equa- discussed in greater detail and in the opposite order.
tions (1), (12), and (13) plays an important role for
an efficient and routine numerical treatment of the 2. Solution of linear systems of equations
model equations. In the introductory example, B cor-
responds to the unit matrix; often, B is a diagonal 2.1. Direct solution procedure
matrix. Situations exist, however, where time deriva- (LU decomposition)
tives of several state variables appear in the same
Formally, the solution of the linear system of equa-
balance equation, e.g., an enthalpy balance for com-
pressible fluids leads to a sum of the time derivatives tions
A3=b (17)
of temperature (aT/at) and total pressure (Op/at)
that can be considered in B without any additional is carried out by finding the inverses (A)-I:
transformation. From Equation (16), it is apparent
that the system of equations may also be solved if y=A-1b (18)
B is not regular, i.e., if the system contains rows
of zeros. An important example is the calculation This procedure, however, usually is not carried out
of th~ steady-state solution. Here, all time deriva- explicitly because of the large amount of calculations
tives disappear and B becomes the zero matrix. Un- involved. Rather, A is decomposed by suitable trans-
der these conditions, Equation (16) describes an iter- formation into the product of a lower triangular ma-
ative scheme for the steady-state solution yk by the trix L (er. Figure 3a) and an upper triangular matrix
Newton-Raphson method (see Section 3), where k de- U (er. Figure 3b) [1, 3-6]:
notes the iteration step. In any event, the solution of
the linear system of Equations (16) must be repeated A=LU (19)
until yk+l sufficiently well agrees with yk.
In addition, during the course of model formula- With the knowledge ofL and U, the solution ofEqua-
tion, often nonlinear coupling relationships appear tion (16) or, equivalently, of
between state variables that do not contail). time LUy=b (20)
derivatives. Typical examples are equations of state
or phase equilibrium relationships; quasisteady- can be reduced to two simple single steps: using the
state balance equations also belong here. This means
that Equation (12) often does not represent a system
of ordinary differential equations but it contains dif-
ferential equations and nonlinear equations which
are coupled with one another by f and, occasionally,
also by B. It has become customary to refer to thi8
situation as that of differential algebra equations
<DAE).
Quite in general, a physically based mathemati~
model of a chemical engineering process, after dis-
cretization of the, spatial derivatives, leads to a DAE
such as represented by Equation (12). DAE may be
solved with the help of so-termed DA solvers (er. Sec-
a) b)
tion 4). The introductory example shows a particu- Rg. 3. Decomposition of A according to Equation (19) into a)
larly simple procedure for this solution. In all situa- an upper triangular matrix U; and b) a lower triangular ma-
tions, a linear system of equations that has a struc- trix L.
458 October 1994 Vol. 34, No. 4 INTERNATIONAL CBEMICAL ENGINEERING
substitution Uy = x, first, the system of equations tinctly diagonally dominant matrices, even the solu-
tions of many more. Because the amount of calcula-
(21) tion increases faster than in direct proportion to the
number of equations N, an upper limit of N exists
is solved by forward substitution for the determina- beyond which a direct solution is not justified either
tion of x. If x is known, the solution vector y follows from the point of view of the amount of calculation
by substitution from to be carried out or from the point of view of the in-
Uy=X (22)
creasing extent of round-off errors. The upper limit
depends on the so-termed conditioning of the matrix
The decisive advantage of this procedure is that and on the computing accuracy available. This limit
the sohition' may be easily found for any right-hand may be easily reached and also exceeded, particularly
side b after carrying out the decomposition of A into in the simulation of model equations of two or three
LU. This advantage may be exploited in various situ- spatial dimensions.
ations in numerical simulation of chemical engineer- One way out of this difficulty is by using iterative
ing processes. solution techniques. However, whereas direct meth-
In the LU decomposition, attention must be paid to ods always lead to the solution, for a nonexcessive
pivoting. The pivoting is necessary in order to avoid number of equations N and a regular matrix A, con-
division by zero in the transformation ofA, or round- vergence with the classical iterative methods is only
ing off significant digits through small differences of assured for diagonally dominant systems. Modem
large numbers. Pivoting is frequently facilitated by iterative methods are capable of creating diagonal
appropriate scaling of the state variables y, e.g., on dominance by using suitable transformations [3, 6].
er.
the interval 1-1, 1]; [2,4,6]. According to the simplest version of an iterative
Numerous reliable standard routines are available solution technique, the so-termed Jacobian method,
for the purpose of LU decomposition ([Link] 2.3) the nth equation of the system of equations is solved
so that the process engineer only very seldom needs for the nth unknown in each iteration step, indepen-
to do any explicit programming. In general, it holds dently of the ~ther equations. Then, for Equation (17),
i)
valid that the structure ofA decisively influences the e.g.,
ease of solution of the linear system of equations.
Therefore, it is logical to group the model equations - - 1
Y nHl_ ( bn - ~~ an,k Yk (23)
k=l,k~n
in such a way that A possesses a standard domi- ann
nance. This standard dominance fucludes, in partic- where an,k are the elements ofA. Here, i is the itera-
ular, tridiagonal and block tridiagonal dominances, tion index. This indicates that ~ways the unknowns
both of which are shown in Figure 2. The tridiagonal from the previous iteration are substituted into the
and block tridiagonal patterns have the advantage right-hand side.
that they keep their structure in the process of LU Ifthe unknowns converge, iterative methods have
decomposition, if no pivoting is required. the advantage to be insensitive to rounding off errors,
Sometimes, it happens that model building does an4, for sparse matrices, iterations require only little
not lead to any of the standard patterns shown in storage capacity.
Figure 2, and, instead, the nonzero elements are very
irregularly distributed over the matrix. This distri- 2.8. S~/fware for the solution of linear systems
bution especially occurs for coupling of various pieces of equations
I
of equipment or processes, i.e., for plant simulation.
Here, A has only a few nonzero elements, and it is . For!a direct solution of systems of equations with
referred to as a sparse matrix. For such sparse ma- block tridiagonal or tridiagonal structure, the library
trices, special so-termed sparse solvers exist, which routines of LINPACK [18] or the IMSL library [19]
limit the storage place and the necessary calculations can be recommended. These routines are just as the
to the nonzero elements of the matrix. rest of the numerical software recommended here,
written in standard FORTRAN 77, and they are
2.2. Iterative solution techniques based on LU decomposition and partial pivoting.
For the direct solution of systems of sparse matri-
The solution techniques discussed up to this point ces, a generally accepted solution technique is not
are so-termed direct methods. For dense matrices, established. A very frequently used program is the
these techniques permit the solution of systems Harwell routine MA30, or its variant MA28 by Duff
consisting of a few thousand equations, and, for dis- and Reid [20, 21], which is easier to use and whose
INTERNATIONAL CHEMICAL ENGINEERING Vol. 34, No. 4 October 1994 459
strength lies in the application of information ob- Here, J~) is the Jacobian matrix that was already
tained in the first LU decomposition for subsequent introduced in connection with Equation (15)
solutions of problems with a similar pivotal struc- 8ft 8ft 8ft
ture. In recent years, various new algorithms have ayl 81J2 .. ' ayn
been published [22-24] that, however, mostly do not
reach the speed of MA 30 for repeated solutions of 8h 8h 8h
problems of identical structure such as in the simu- J~) = ayl 81/2 ... 8Yn (27)
lation of chemical engineering processes [25].
Iterative methods for the solution of linear systems
of equations do not yet reach the reliability provided 81n 81n 81n
by direct solution. In practice, tests must be carried 8YI 81/2 ... 8Yn
out in every individual situation whether or not a In practice, instead ofa matrix inversion, the linear
method converges for the particular problem at hand. system of equations
On the basis of the developments in recent years, e.g.,
[26], however, significant progress may be expected in (28)
the field using special strategies for improvement in
convergence and of combinations of direct and itera- equivalent to Equation (26), with
tive methods. yi+l = yi + l:lyi (29)
Basically, standard methods such as those de-
scribed in this section always result in a slower solu- is iteratively solved until the residual vector l:lyi be-
tion of a system of equations than an algorithm that comes less than a prescribed value [1, 3, 5]. In the in-
was optimized for a particular matrix structure; how- troductory example, only the first step in the N ewton-
ever, the amount of work required for such nonstan- Raphson iteration was used in Equations (15) and
dard methods is only warranted for very time-critical (16), where the initial value was the solution vector
applications. at the old time step tk.
Each numerical simulation is ultimately based on The reason for frequent use of either the direct or
repeated solutions of linear systems of equations. the modified Newton-Raphson method is its simple
From the users point of view, therefore, the develop- algorithm and its quadratic, i.e., faster than linear
ers of general solution packages for nonlinear equa- convergence. On the other hand, this convergence
tions or DA systems should uncouple their programs is only assured if sufficiently good initial values are
from the solution oflinear systems of equations, and used. Hence, the solution of large nonlinear systems
provide general interfaces. Only, then, the incorpora- of equations may run into great difficulties because if
tion of specific linear equation solvers will be possible several solutions exist the algorithm does not neces-
without unreasonable expense. sarily converge to the desired or to a physically mean-
ingful solution. In conjunction with the solution of a
DAE, these convergence problems, however, are less
severe because the previous time step provides a good
3. Solution of nonlinear systems starting value for the iteration, while the size of the
of equations change l:ly can be arbitrarily decreased by reduction
of the size of the time step.
The iterative solution of a nonlinear equation in Exceptions to this rule may be expected in two sit-
one unknown uations: at the start of the program if inconsistent
O=/(y) (24) starting values are used (ef. Section 4), or for func-
tions with a local or a global minimum in the vicinity
by Newton's method, using the iteration index i of the solution. This type of problem can be easily
HI _ i I(yi) understood for one unknown. The equation 0 = y2
Y - Y - I'(yi) (25) has a (double) zero at y = O. At the same time, the
global minimum of the function is at the same place.
is generally known. Generalization of this iteration Thus, I' (y = 0) = O. Here, the iteration procedure
procedure to systems of equations is the so-termed (25) leads to a division by zero.
Newton-Raphson method which can be formally writ- Additional difficulties may arise if the function
ten as a fixed-point iteration: f is not defined everywhere, because the Newton-
Raphson method does not always monotonously con-
verge but often oscillates about the solution. If the
460 October 1994 Vol. 34, No. 4 INTERNATIONAL CHEMICAL ENGINEERING
function is not defined in the vicinity of a zero, matrix consists of keeping the Jacobian matrix con-
then, an evaluation might be required in an unde- stant throughout several iteration steps, whereby the
fined region. AB a simple example, the reaction rate- order and the radius of convergence are diminished.
expression r = cO.5 may be used. A reasonable idea is On the other hand, the determination of the Jacobian
to assign the value of zero to the reaction rate for neg- matrix and the LU decomposition becomes unneces-
ative concentrations. However, this assignment may sary. To what extent this possibility can be exploited
prevent convergence of the Newton-Raphson proce- to advantage depends on the particular situation at
dure because here the derivative of the function f hand.
in the vicinity of the solution is no more continuous. Another possible way consists ofnot repeatedly cal-
A logical way out of this difficulty is to continue the culating the entire Jacobian matrix but to improve in
function without interruption into the undefined re- each iteration step the matrix determined at the out-
gion, e.g., by lettingr(c < 0) = -lclo.5 • set. Procedures along these lines are mostly based
In the process of determination of the Jacobian, on the method developed by Broyden [28]. These
the first question to answer is whether or not to use procedures have the disadvantage that they create
an analytical solution or an approximate numerical additional nonzero elements in the matrix. Several
calculation. AB a rule, an analytical evaluation of authors [29, 30] tackled the problem of Broyden up-
the derivatives leads to more accurate results, and dates while maintaining the matrix density almost
mostly also in a shorter time. However, analytical unchanged.
differentiation of complicated functions requires te- A convenient possibility for influencing the rate
dious work which may be subject to errors. Examples and the radius of convergence in the Newtonian pro-
for this are implicit relationships for the calculation cess is the relaxation expressed by
of multicomponent equilibria, and complicated reac-
tion rate-expressions. Therefore, in many library pro- (31)
grams, the option exists of numerically calculating
the Jacobian matrix: In this process, a step with w > 1 is referred to as
overrelaxation, whereas a step with w < 1 is termed
8fi ....... h(Yj + dYj) - fi(Yj)
(30)
underrelaxation. Overrelaxation is used to increase
8yj ....... dYj the convergence rate. Of practical significance is pri-
marily the underrelaxation whereby the convergence
In this process, care must be taken to avoid obliter- radius can be significantly increased [3, 14].
ation of significant digits by suitable scaling and by
choice of step size dYi' By taking advantage of that
the Jacobian matrix usually is sparse, the number of 8.1. Standard software for the solution of
function calls for the calculation off(y + l:!.y) can be nonlinear systems of equations
significantly reduced by altering before each function
call several components of f. Thus, in our introduc- Newtonian and quasi-Newtonian methods are
tory example for the complete calculation of the tridi- available for the calculation of zeros of nonlinear sys-
agonal Jacobian, four function evaluations are suffi- tems of equations in all the large standard mathe-
cient, independently of the number of discretization maticallibraries, e.g., such as IMSL or Harwell. The
points. program NLEQl ofDeufthard [31] was found by the
authors to be particularly useful in the solution of
Because, in the last few years, powerful programs
for symbolic calculations have become available, e.g., critical problems such as in the calculation of simul-
taneous chemical equilibria, and, also, in the process
MAPLE [35] or MACSYMA [36], today, analytical
ofinitia1ization ofDA systems; see Section 4.2. This
derivatives can be determined in a simple and ac-
program has a very effective control of the relaxation
curate manner. The result is available in FORTRAN
parameter w. Recent reviews of and comparison be-
code, and may directly be transferred to the equation
tween various solution methods ofnonlinear systems
solver.
ofequations from the point of view of the chemical en-
In the iteration according to Equation (26), primar-
gineer were presented by Sacham [32] and Sun [33].
ily, two cost factors appear:
(1) solution of the linear system of equations; and
(2) calculation of the Jacobian matrix J. 4. Integration of differential equations
Efficient procedures for the solution of linear sys-
tems of equations were discussed in the previous sec- During the course of model building, generally, sys-
tion. The simplest strategy for decreasing the amount tems of partial differential equations, ordinary differ-
of work required for the calculation of the Jacobian ential equations of first and higher order, and alga-
INTERNATIONAL CBEMICAL ENGINEERING Vot. 34, No. 4 October 1994 461
braic equations are generated. With the help of the Both of these methods reach a first-order accuracy.
method oflines, the partial differential equations can For a = 1/2, from Equation (34), the so-termed trape-
be reduced to a system of ordinary differential equa- zoidal rule follows, which is also implicit since fk+l
tions. Transformation of ordinary differential equa- is required, but this rule reaches a second-order ac-
tions of a higher order into a system of differential curacy.
equations of first order is carried out by simple sub- In this context, nth-order accuracy indicates that
stitution. the discretization error in the solution of the differ-
First, the integration of an ordinary differential ~ntial equation is proportional to ~tn. By using a
equation of first order with a nonlinear right-hand higher-order method, the discretization error can be
side f(y, t) is considered: reduced to a greater extent by decreasing ~t.
Using a central difference approximation of the
y' = dy = f(y, t) (32) time derivative, the following explicit procedure is
dt obtained, which is also of the order of two:
The simplest possibility consists of approximating
the differential quotient dy / dt by a difference quo-
tient, e.g.,
An analysis, however, shows that an unstable par-
dy yk+l _ y" asitic solution is brought in by the discretization pro-
dt = ~t = f(y, t) (33) cess. This analysis leads, independently of the choice
bf ~t, after several steps to oscillations of increasing
The next question is how to use a suitable ap- amplitude about the true solution so that, as a result,
proximation for the function f(y, t) in the interval Equation (37) turns out to be useless [7].
(t", t" + ~t). A flexible way of accomplishing this is A necessary condition for a solution algorithm is,
provided by the general Euler method (cf. Figure 4). therefore, first of all, a stable approximation of the
time derivative. This condition is satisfied for the gen-
"+1 "
Y ~; Y = (1-a)f(y", t")+af(yk+l, t"+~t) (34) eral Euler method. Nevertheless, even here undesir-
able oscillations may occur if a < 1, and the time step
Letting a = 0, i.e., f(y, t) :::::: f(y", t"), the so-termed is greater than a certain value. The undesirable os-
explicit Euler method is obtained, permitting solu- cillations are shown in Figure 5 on the example of the
tion for y"+l: stable linear differential equation .
dy
(35) T-=-y (38)
dt
In contrast to this method, the so-termed implicit Eu-
ler method with a = 1, i.e., f(yk+l, t" + ~t), in gen-
eral, results in a nonlinear relationship that must be 1.0 r-----.---,.--.--......- - . - - . - -.......- , - - - ,
solved by iterations, using the methods described in y
the previous section
Y
"+1
~~ Y
"
= f(yk+l, t" + ~t) (36) 0.5
Explicit Euler method a .. 0 y(t)
, .... .... -
Trapezoidal rule a .. 0.5 0.0
\
\ I
Implicit Euler method a .. 1 /0-0
\
/
\ /
\/
-0.5
0.0 2.0 4.0 8.0 8.0
,,+.
Fig. 5. Numerical solution of Equation (38) with ~t = 1.57
Fig. 4. Integration of Equation (32) using the general Euler using the implicit (a = 1) and the explicit (a = 0) Euler
method [Equation (34)]. method.
462 Octoller 199t VoL.a4, No. 4 INTERNATIONAL CHEMICAL ENGINEERING
with the solution nificant difficulties. These difficulties are illustrated
on a short example. The concentration evolution in
yet) = yO exp (-tiT) (39) an isothermal batch reactor of constant volume is to
With the help of Equations (35) and (36), the devel- be calculated for a simple situation of two reactions
in series:
opment of the numerical solution for large time steps
can be easily followed. For the explicit Euler method, (41)
the solution starts to oscillate in the example as soon The time dependence of concentration is described by
as f::l.t > T, and it exponentially increases as soon the following first-order differential equations:
as f::l.t > 2T. In contrast, the implicit Euler method
monotonously approaches the exact solution, even for dCA
d1 = -k1cA (42)
arbitrary large time steps f::l.t.
This result may be generalized in a remarkable dcB
way: all purely explicit integration methods for the d1 =k1cA -k2cB (43)
solution of stable differential equations become un-
stable above a limiting value of the time-step size dcc
d1 =k2cB (44)
~tcritJ where f::[Link] is of the order of magnitude of
the smallest time constant T or the smallest recipro- Analytical solution of this system is as follows:
cal eigenvalue of the linearized differential equation.
In contrast, implicit solution metho-ds permit time CA = CAO exp (-kIt) (45)
steps that are also significantly greater than T. This
result is of great importance for the solution of sys-
tems of differential equations (cf. Section 4.1). On the
other hand, no reason exists to prefer the implicit to CAO
the explicit method in the solution of individual dif- CC = k k (-k2 exp (-kIt) + kl exp (-k2t» + CAO
2 - I
ferential equations of first order, since, in order to (47)
obtain an accurate solution, the time step must be where CAO is the concentration of the eductA at time
chosen to be smaller than the value of the time con- t = o. Ifreaction (2) is much faster than reaction (1),
stant anyhow. The amount of calculations involved then, the term exp (-k2t) rapidly vanishes and the
in the explicit methods is, by the very nature, signifi- dynamic behavior of the system is only determined
cantly less compared to the implicit method. For this by exp (-kIt). Figure 6 shows the concentration evo-
reason, in the past, mainly explicit solution meth- lution for values of the rate constant kl = 1 and
ods were used for ordinary differential equations. The k2 = 106 • Note should be made that the solution is
[Link] popular examples are the classical fourth-order almost exclusively determined by the slow dynamics
Runge-Kutta method, the Adams-Moulton, and the with TI = 1/kl = 1 after a very short initial time pe-
Adams-Bashford methods [8]. riod. Nevertheless, when using the explicit method
For an efficient use of an integration method, of integration, for the reasons explained above, the
automatic time-step control must be used. Control time-step size of the order of magnitude of the least
assures, in addition to providing stability (in the time constant must be chosen, i.e., T2 = 1/k2 = 106
explicit method) and convergence (in the implicit (I), in order to keep the solution stable. Such a system
[Link]), also a control of the errors, and minimiza- is referred to as stiff. As a measure of stiffness, gen-
tion of the computing time required for the solution erally, the ratio of the least to the greatest real part
of a problem. In most situations, control of the time- of the eigenvalues of the system of differential equa-
step size is based on an error estimation, e.g., by a tions can be used [5]. Integration of a stiff system of
comparison of results obtained with different step the form of Equation (40) with an explicit method is
sizes f::l.t. not very effective: the number of the integration steps
which are only necessary for the sake of stability and
4.1. Integration of a system of ordinary not for the sake of accuracy becomes so great that the
differential equations integration can only be conveniently carried out with
implicit methods.
In the integration of a system of ordinary differen-
For nonlinear differential equations, the eigen-
tial equations,
values follow from the equations linearized about
(40)
the respective solution. Therefore, the stiffness can
with a regular matrix B, application of one of the strongly change during the course of the solution pro-
explicit methods described above may run into sig- cess. The least eigenvalue of a system of equations
INTERNATIONAL CHEMICAL ENGINEERING Vol. 34, No. 4 October 1994 463
c
c
0.5 5.0.-06
Fig. 6. a) Concentration versus time curves
0.0 L-.o--'"--'--'-...L..................;i::::.._ 0.0.+00 1IoG.I.......--'-...........L...........................-.I
0.0 2.5 5.0 0.0.+00 5.0.-06 1.0.-05 for a consecutive reaction [Equation (41)] for
kl = 1, k2= 106 ; b) short time dynamics of
a.) b) the consecutive reaction.
arising from spatial discretization of a PDE also de- form of Equation (40), where the matrixB is singular,
pends on the size chosen for the spatial step. For these i.e., it contains empty rows and/or columns. Typical
and the other reasons mentioned in Section 4.2, it is examples for linear and nonlinear coupling relation-
advisable not to use the explicit integration methods ships are represented by the boundary conditions of
in connection with the method of lines. PDEs, phase equilibria, equations of state, and PDEs
The semiimplicit Euler method [37] used in the in- assumed to be in quasi-steady state. The DAE may
troductory example be solved as a stiff system with the help of implicit
BYk+l -yk =~k)+ _fJ( I (yk+l_yk) (48)
integration methods [38], provided its index next
section) is less or equal to unity. Algebraic relation-
(er.
ll.t ay 7" ships can be visualized as differential equations with
an infinitely short oscillation time; DAEs are, there-
can be obtained from the implicit Euler method, fore, infinitely stiff systems of differential equations.
Equation (36), by linearizing the term f f+k about the For the numerical solution of a DAE, the initial
old time point tk, and leads to the formally explicit in- conditions must be specified. However, the number
(B-at :IJ
tegration procedure of the initial conditions that can be freely chosen, i.e.,
the degrees of freedom of the DAE may be less than
the number of variables whose time derivatives are
y'+1 contained in the system. This issue will be discussed
(B -at :1,.) ,. + Mlr)
in greater detail in the next section. In any event,
for the start of integration, the additional (not freely
= (49) selectable) variables must be determined in an ini-
tialization step in such a way that they satisfy the
without losing the stability properties of the implicit DAE at the initial point of time. For this purpose, a
Euler method [17]. Therefore, it is also suitable for transformation of the DAE which is described in the
stiff systems. This example forms the basis ofLIMEX next section should be used.
[47], an efficient standard procedure for the solution
4.3. Index problems
er.
of DAEs; Section 4.4.
In most situations, a DAE may be solved without
4.2. Integration of differentiol algebra systems any difficulty with the help of implicit or semiim-
plicit integration methods. In some situations, how-
In general, the model of chemical engineering ever, a particular structural property ofDAEs, the s~
equipment consists of differential equations that de- termed index, has a detrimental effect. Various ways
scribe its dynamic behavior, and of algebraic cou- exist of defining the index, among which the most
pling, DAE. The model may also be expressed in the widely used is to define a differential index [40, 41].
464 October 1994 Vol. 34, No. 4 INTERNATIONAL CHEMICAL ENGINEERING
---------------------------------j
According to its definition, the differential index kd equations, namely, Equations (50), (51), and (55), and
of a DAE is the number of derivatives necessary in the system has a differential index of kd = 1.
order to transform the DA system into a system of The example shows that, due to the structure of the
ordinary differential equations (ODE). A DAE with DAE, all three variables YI, Y2, and z play an equal
an index kd :5 1 may be integrated with the help of role, and that to which of these an initial condition
the above-described methods for stiff systems of dif- (degree of freedom) should be assigned is a matter of
ferential equations. The integration of systems with arbitrary choice. In practice, which of these variables
kd ~ 2, however, may lead to severe problems so that will be used as the initial condition depends on the
standard methods often do not work. nature of the physical problem.
For a demonstration of these deficiencies, the fol- Transformation of the original DAE by differentia-
lowing simple example is considered: tion and substitution may require a great deal of cal-
culations for complicated systems. Under such condi-
Y~=YI+2Y2+2z (50) tions, it is convenient to substitute a new (algebraic)
unknown for the derivative of one of the variables
Y~=YI-Y2-Z (51) to be eliminated, with the result that the derivatives
(52) of the algebraic coupling conditions supply the ad-
ditional equations necessary for the solution of the
The integration is characterized by the peculiar- problem. In the above-mentioned example, the sub-
ity that YI and Y2 are algebraically coupled through stitution of y~ = Z2 in Equation (53) results in the
Equation (52). Evidently, therefore, only one of these equivalent DAE with the index kd = 1:
equations can be freely specified as an initial condi-
tion, whereas the initial value ofthe other, along with y~ = YI + 2Y2 + 2z (56)
the variable z, must be determined in an initializa- 0=YI-Y2-Z- Z2 (57)
tion step. However, this initialization is not immedi-
ately possible because no explicit relationship exists 0= YI +Y2 (58)
for the calculation of z. For the determination of z, y~ = -Z2 (59)
Equation (52) can first be differentiated:
Although the system now has an additional new
(53) variable, the amount of work necessary for transfor-
mation was significantly reduced.
After substitution of(50) and (51) into (53), the fol- For dynamic models of chemical engineering pro-
lowing algebraic relationship which was hidden in cesses, index problems may always arise whenever
the original system is obtained: the state variables are coupled with one another by
equations of state, phase equilibrium relationships,
(54) or special transport expressions. In this connection, a
problem may arise already in the formulation of the
Now, z can be calculated. After differentiation of fundamental partial differential equations [42]. The
Equation (54) and substitution of Equations (50) and way to proceed here, i.e., before spatial discretization
(51), the following differential equation for z is ob- has taken place, is subject to ongoing research.
tained:
z' = -3(YI + Y2 +z) (55) 4.4. Standard software for DABs
Since two differentiations were necessary for the Using the integration routines contained in the
transformation of the original DAEs (50) to (52) into large program libraries of numerical mathematics,
the system of ordinary differential equations (50), e.g., IMSL, NAG, and Harwell, simple problems can
(51), and (55), the differential index of the original be solved without any difficulties and in a short time.
system is two. However, in general, to use programs in which more
For a general handling ofindex problems for kd ~ 2, recent results of mathematical research are imple-
Bachmann et al. [45,46] suggested developing the mented is more effective, since, particularly in the
hidden algebraic coupling from the original DAE by field of numerical integration of DAEs, significant
differentiation and substitution, and to solve the al- progress has been made in the eighties. The following
gebraic equations along with the required number of methods were found to be very effective:
differential equations. In the above-mentioned exam- (1) backward differential formula (BDF) methods;
ple, the substitute system consists of Equations (52) (2) extrapolation methods; and
and (54), in addition to one of the three differential (3) implicit Runge-Kutta methods.
INTERNATIONAL CHEMICAL ENGINEERING Vol. 34, No. 4 October 1994 465
The programs DASSL [43] and LSODElLSODI the one-dimensional situation, both yield either iden-
[44], based on the BDF method, found the most tical or: similar systems of equations. Due to its sim-
widespread use. The extrapolation codes developed plicity of handling, the difference method is preferred
by Deuflhard [3], e.g., EULSIM and LIMEX [47], were in the one-dimensional situation and sometimes also
found to be extremely effective in our applications, in the two-dimensional case. As an example, the dif-
and were found to be equally valuable compared to ference approximation carried out in Equations (5) to
DASSL in the solution of problems of practical rel- (7) of the introductory example may be mentioned.
evance. In recent years, a strong interest developed The problems arising in the discretization of spa-
in the implicit Runge-Kutta method [48-50]. The re- tial derivatives and their convenient handling will
spective codes, e.g., RADAU5 [50], did not yet reach not be discussed in this paper, but it will be presented
the level of the above-named programs, but, in the in a separate pUblication. At this point, only refer-
near future, further progress may be expected. ence is made to some introductory and comprehen-
All the above-mentioned programs contain auto- sive monographs [9, 10]. Introductory chapters deal-
matic error and step-size monitoring; in addition, ing with the treatment of PDEs may also be found
LIMEX is in a position to detect problems with an in some standard texts on numerical mathematics
index k d >2, and to automatically reject these. In [5, 6]. The methods used for the solution of chemical
general, these routines solve a problem in compa- engineering problems are discussed in [11, 12]. An
rable lengths of time, and, in each individual situ- introduction to the so-termed finite volume method
ation, it must be established which method is the may be found in [13] and to the finite element method
most suitable. If, in a system, a large number of in [14 to 16].
switching processes exist, which manifest themselves
in discontinuities of the right-hand side~, t) of the 6. Sources of information and codes
mathematical models, then, one-step methods such
as the extrapolation or the Runge-Kutta methods are This survey of numerical methods for the simula-
to be preferred because, with multistep methods such tion of dynamic and stationary behavior of chemical
as BDF, a restart must be performed with low order. engineering processes was meant to review the pro-
The simultaneous methods of dynamic plant simu- cedures that were· established and tested in recent
lation such as DIVA [51] or SPEEDUP [52] are based years. More detailed information may be found in the
on DAE solvers of high performance, where the mod- references indicated. It was pointed out that, for the
els of individual plant parts are discretized in space, solution of linear systems of equations, the solution
and combined to one single large DAE (40), which is ofnonlinear systems of equations, and the solution of
solved with the methods described above. DAEs, proven standard codes are available so that in-
dividual programming of these steps may be limited
5. Integration of partial to a few special situations.
differential equations The standard codes are usually contained as FOR-
TRAN 77 subprograms, on the one hand, in the large
As has been shown in the introductory example, commercially operated numerical libraries requiring
systems of PDEs can be transformed into a DAE licensing fees, such as IMSL, Harwell, or NAG. On
by discretization with respect to the position coor- the other hand, in recent years, a number of in-
dinates. Whereas, for the solution of a DAE, the teresting codes have become available without fees
above-described comprehensive and tested method of as public domain software, i.e., these subprograms
solution exists, permitting the solution with a pre- may be freely copied and used. An example of this
determined accuracy, the technique of spatial dis- is the LAPACK collection for the solution of linear
cretization is not equally well developed. In particu- systems of equations, along with the BLAS routines
lar, the chemical engineer himself must usually also simultaneously developed for the purpose of funda-
carry out spatial discretization when using commer- mental vector and matrix operations. (BLAS = Ba-
cial simulation software, unless he or she prefers pre- sic Linear Algebra Subroutines.) These routines are
manufactured process modules with a limited scope. available, and can be copied without charge at most
As a rule, in these modules, the errors arising from university computer centers throughout the world.
spatial discretization are not considered or limited. ,Additional general or specialized codes are centrally
A large number of methods is available for the dis- collected at various locations. The best known server
cretization of spatial derivatives. The best known for of programs of numerical math is NETLm. The
chemical engineering applications are the finite dif- largest similar collection in Germany is the eLib of
ference methods and the finite element methods. In the Konrad-Zuse-Zentrum in Berlin. In addition to a
466 October 1994 Vol. 34, No. 4 INTERNATIONAL CHEMICAL ENGINEERING
copy ofNETLm, also numerous recent developments Subscripts
may be found in eLib, such as the routines LIMEX
and NLEQl mentioned in the present paper. This i iteration index
collection of programs is easily obtained by way of k time index or summation index
INTERNET, and various mail protocols. Information I position index
on the best way to proceed may be obtained from • input
administrators of networks of scientific computer
centers.
Literature cited
Acknowledgments
1. Stoer, J., Numerische Mathematik (Numerical
The material presented in this paper partly origi-
Mathematics) 1, 5th Edition, Springer-Verlag,
nates from the joint project DNA of dynamic simu-
Berlin (1989).
lation of chemicitl engineering plants involving four
2. Stoer, J., Numerische Mathematik (Numeri-
laboratories of the Chemical Engineering Faculty of
cal Mathematics) 2, Third Edition, Springer-
the University of Stuttgart. Support of this work by
Verlag, Berlin (1990).
the VW Foundation and DFG is gratefully acknowl-
3. Deuflhard, P. and Hohmann, A., Numerische
edged.
Mathematik (Numerical Mathematics), W. de
Gruyter, Berlin (1991).
Nomenclature* 4. Engeln-Miillges, G., Numerische Mathematik
fUr Ingenieure (Numerical Mathematics for En-
A coefficient matrix gineers), 5th Edition, Bibliographisches Insti-
b vector of right-hand side tut (1987).
B,B capacity term 5. Schwarz, H. R., Numerische Mathematik (Nu-
c concentration merical Mathematics), Second Edition, B. G.
D diffusivity Teubner Verlag, Stuttgart (1988).
f,r function of the right-hand side 6. Press, W. H., et al., Numerical Recipes, Third
J Jacobian matrix Edition, Cambridge University Press, Cam-
kt, k2 rate constants bridge (1988).
L lower triangular matrix 7. Burden, L. B. and Faires, J. D., Numerical
L length of reactor Analysis, Third Edition, Prindle, Weber, and
N number of equations Schmidt, Boston (1989).
NZ number of mesh points in space 8. Gear, G. W., Numerical Initial Value Problems
p pressure in Ordinary Differential Equations, Prentice
S source function Hall, Englewood Cliffs (1971).
t time 9. Meis, T. and and Marcowitz, u., Numerische
T temperature Behandlung partieller Differentialgleichungen
U upper triangular matrix (Numerical Treatment of Partial Differential
v flow velocity Equations), Springer-Verlag, Berlin (1978).
y,y unknown 10. Ames, W. F., Numerical Methods for Partial Dif-
z position ferential Equations, Second Edition, Academic
z algebraic unknown (in Section 4.3) Press, New York (1977).
11. Davis, M. E., Numerical Methods and Model-
Greek letters ing for Chemical Engineers, John WHey & Sons,
New York (1964).
l:l.t time-step size 12. Finlayson, B. A., Nonlinear Analysis in Chem-
l:l.z spatial step size ical Engineering, McGraw-Hill, New York
T time constant (1980).
w relaxation factors 13. Patankar, S. v., Numerical Heat Transfer and
Fluid Flow, McGraw-Hill, New York (1980).
14. Richter, w., Numerische Losung partieller Dif-
ferential-gleichungen mit der Finite-Element-
Methode (Numerical Solution of Partial Dif-
·Vectors and matrices are in boldface.
INTERNATIONAL CHEMICAL ENGINEERING Vol. 34, No. 4 October 1994 467
ferentia1 Equations with the Finite Element 32. Shacham, M., Camp. Chem. Eng. 9, pp. 103--124
Method), F. Vieweg & Sohn, Braunschweig (1985).
(1986). 33. Sun, E. T. and Stadtherr, M. A., Comp. Chem.
15. Villadsen, J. V. and Michelsen, M. L., Solu- Eng. 12, pp. 1129--1145 (1988).
tion of Differential Equation Models by Polyno- 34. Stoer, J., in Computational Mathematical Pro-
mial Approximation, Prentice-Hall, Englewood gramming, Klaus Schittkowski, Ed., NATO ASI
Cliffs (1980). Series, Springer Verlag, Berlin (1985).
16. Schwarz, H. R., Methode der finiten Elemente 35. Char, B. W., et al., MAPLE Reference Manual,
(The Finite Elements Method), Second Edition, Watcom Publ., Ltd. (1988).
B. G. Teubner Verlag, Stuttgart (1984). 36. MACSYMA Reference Manual, Symbolics, Inc.
17. Deuflhard, P., Numerik von Anfangswertmeth- (1988).
oden fUr gewohnliche Differentialgleichungen 37. Deuflhard, P., SIAM Rev. 27, pp. 505--535
(Numerical Initial Value Methods for Ordinary (1988).
Differential Equations), FU Berlin, TR 89-2 38. Gear, C. W., IEEE Trans. Circuit Theory CT-IB,
(1989). pp. 89--95 (1971).
18. Dongarra, J. J., et al., UNPACK User's Guide, 39. Pantelides, C. C., SIAM J. Sci. Stat. Comput. 9,
SIAM, Philadelphia (1979). pp. 213--231 (1988).
19. IMSL, User's Manual, IMSL Mathematics Li- 40. Petzold, L. R., SIAM J. Sci. Stat. Comput. 3, pp.
brary, Houston (1989). 367--384 (1982).
20. Duff, I. S. and Reid, J. K, ACM 7Tans. Math. 41. Gear, C. W. and Petzold, L. R., SIAM J. Numer.
Software 5, pp. 18-35 (1979). Anal. 21, pp. 716-728 (1984).
21. Duff, I. S., Erisman, A. M., and Reid, J. K,Direct 42. Hindmarsh, A. C. and Johnson, S. H., Chem.
Methods for Sparse Matrices, Clarendon Press, Eng. Sci. 43, pp. 3235-3258 (1988).
Oxford (1987). 43. Brenan, K E., Campbell, S. L., and Pet-
22. Stadtherr, M. A. and Wood, E. S., Comput. zold, L. R., Numerical Solution of Initial-Value
Chem. Eng. 8, pp. 9-33 (1984). Problems in Differential-Algebraic Equations,
23. Gilbert, J. and Peierls, T., SIAM J. Sci. Stat. North-Holland Publ. Co., Amsterdam (1989).
Comp. 9, pp. 862-874 (1988). 44. Hindmarsh, A. C., ACM-Signum Newsletter 15,
24. Osterby, O. and Zlatev, Z., Direct Methods for pp. 10--27 (1980).
Sparse Matrices Daimi PB-123, Computer Sci- 45. Bachmann, R., Mrziglod, T., et al., in
ence Department, Aarhus University (1980). DECHEMA-Monogr. 116, VCh, Weinheim
25. Ng. E., A Comparison of Some Methods for Solv- (1989).
ing Sparse Nonsymmetric Linear Systems, Oak 46. Bachmann, R., MrzigIod, T., et al., Comp. Chem.
Ridge National Laboratory, unpublished draft Eng. 14, pp. 1271-1273 (1990).
(1991). 47. Deuflhard, P., Hairer, E., and Zugck, J., Numer.
26. Saadi, Y. and Schultz, M. H., SIAM J. Sci. Stat. Math. 51,51, pp. 501-516 (1987).
Comput. 7, pp. 856--870 (1986). 48. Brenan, K E. and Petzold, L. R., SIAM J. Nu-
27. Crowe, C. M. and Nishio, M., AIChE J. 21, pp. mer. Anal. 26, pp. 976-996 (1989).
3--12 (1975). 49. Ascher, U. M. and PetzoId, L. R., SIAM J. Numer.
28. Broyden, C. G., Math. Camp. 19, pp. 577--593 Anal. 28, pp. 1097-1120 (1991).
(1965). 50. Hairer, E., Lubich, C., and Roche, M., The Nu-
29. Schubert, L. K, Math. Comp. 25, pp. 27--39 merical Solution of Differential-Algebraic Sys-
(1970). tems by Runge-Kutta Methods, Springer Verlag,
30. BogIe, I. D. L. and Perkins, J. D., Camp. Chem. Berlin (1989).
Eng. 12, pp. 791--812 (1988). 51. Kroner, A., et al., Comp. Chem. Eng. 14, pp.
31. Deuflhard, P., Newton Techniques for Highly 1289--1295 (1990).
Nonlinear Problems-Theory, Algorithms, 52. Perkins, J. D. and Sargent, R. W. H., AIChE
Codes, Academic Press, New York (in print). Symp. Ser. 214, pp. 1-11 (1982).
468 October 1994 Vol. 34, No. 4 INTERNATIONAL CHEMICAL ENGINEERING