A four-stage index 2 Diagonally Implicit Runge–Kutta method

18
Applied Numerical Mathematics 40 (2002) 415–432 www.elsevier.com/locate/apnum A four-stage index 2 Diagonally Implicit Runge–Kutta method Russell Williams a,, Kevin Burrage b , Ian Cameron a , Minnie Kerr b a Computer Aided Process Engineering Centre, Department of Chemical Engineering, The University of Queensland, Brisbane, Queensland 4072, Australia b Department of Mathematics, The University of Queensland, Brisbane, Queensland 4072, Australia Abstract High index Differential Algebraic Equations (DAEs) force standard numerical methods to lower order. Implicit Runge–Kutta methods such as RADAU5 handle high index problems but their fully implicit structure creates significant overhead costs for large problems. Singly Diagonally Implicit Runge–Kutta (SDIRK) methods offer lower costs for integration. This paper derives a four-stage, index 2 Explicit Singly Diagonally Implicit Runge–Kutta (ESDIRK) method. By introducing an explicit first stage, the method achieves second order stage calculations. After deriving and solving appropriate order conditions, numerical examples are used to test the proposed method using fixed and variable step size implementations. 2001 IMACS. Published by Elsevier Science B.V. All rights reserved. 1. Introduction The numerical method described in this paper is concerned with solving the general problem y = f (y , z), y (x 0 ) = y 0 , (1a) 0 = g(y , z), z(x 0 ) = z 0 , (1b) for x ∈[x 0 ,x f ] where x f is arbitrary. Let us define g z as the matrix of partial derivatives ∂g i /∂z j . If g z is nonsingular the problem is said to be of differential index 1, but if it is singular the problem is considered to be of higher index. Such problems arise in mechanical and process engineering as well as many other fields [9]. If it is possible, through substitution of the components of g z , to reduce the problem to the form y = f (y , z) y (x 0 ) = y 0 , (2a) 0 = g(y ), z(x 0 ) = z 0 , (2b) * Corresponding author. 0168-9274/01/$22.00 2001 IMACS. Published by Elsevier Science B.V. All rights reserved. PII:S0168-9274(01)00090-3

Transcript of A four-stage index 2 Diagonally Implicit Runge–Kutta method

Page 1: A four-stage index 2 Diagonally Implicit Runge–Kutta method

Applied Numerical Mathematics 40 (2002) 415–432www.elsevier.com/locate/apnum

A four-stage index 2 Diagonally Implicit Runge–Kutta method

Russell Williamsa,∗, Kevin Burrageb, Ian Camerona, Minnie Kerrb

a Computer Aided Process Engineering Centre, Department of Chemical Engineering, The University of Queensland,Brisbane, Queensland 4072, Australia

b Department of Mathematics, The University of Queensland, Brisbane, Queensland 4072, Australia

Abstract

High index Differential Algebraic Equations (DAEs) force standard numerical methods to lower order.Implicit Runge–Kutta methods such asRADAU5 handle high index problems but their fully implicit structurecreates significant overhead costs for large problems. Singly Diagonally Implicit Runge–Kutta (SDIRK) methodsoffer lower costs for integration. This paper derives a four-stage, index 2 Explicit Singly Diagonally ImplicitRunge–Kutta (ESDIRK) method. By introducing an explicit first stage, the method achieves second order stagecalculations. After deriving and solving appropriate order conditions, numerical examples are used to test theproposed method using fixed and variable step size implementations. 2001 IMACS. Published by ElsevierScience B.V. All rights reserved.

1. Introduction

The numerical method described in this paper is concerned with solving the general problem

y ′ = f (y,z), y(x0)= y0, (1a)

0 = g(y,z), z(x0)= z0, (1b)

for x ∈ [x0, xf ] wherexf is arbitrary. Let us definegz as the matrix of partial derivatives∂gi/∂zj . If gz isnonsingular the problem is said to be of differential index 1, but if it is singular the problem is consideredto be of higher index. Such problems arise in mechanical and process engineering as well as many otherfields [9].

If it is possible, through substitution of the components ofgz, to reduce the problem to the form

y ′ = f (y,z) y(x0)= y0, (2a)

0 = g(y), z(x0)= z0, (2b)

* Corresponding author.

0168-9274/01/$22.00 2001 IMACS. Published by Elsevier Science B.V. All rights reserved.PII: S0168-9274(01)00090-3

Page 2: A four-stage index 2 Diagonally Implicit Runge–Kutta method

416 R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432

then the problem is said to be of index 2. Implicitly we find that any solution to this problem must alsosatisfy the constraint

0 = ∂g

∂y· f (y,z). (2c)

The numerical solution of such problems is by no means trivial. The application of traditional methodsdeveloped for ordinary differential equations (ODEs) cannot guarantee solution of these higher indexequation sets, as highlighted by Petzold in [15]. Initial conditions which satisfy (2b) should provide asolution through Eqs. (2a), (2c), which are of the index 1 form, but solutions found in this manner cancease to satisfy (2b) due to numerical creep. The dummy derivative method, developed by Mattssonet al. [13], generates an index 1 system which ensures these constraints are met. Such a method requiressymbolic manipulation of the equation set which can be costly if the equation set changes repeatedlyduring integration, such as for problems with a discontinuous right hand side (described in [6]).

Recent work by Hairer et al. [9] derives order conditions for Runge–Kutta methods capable of solvinghigh index DAEs. Methods such as the Radau IIA set were found to already satisfy these conditions dueto their high stage order, but being fully implicit their overhead costs can be high. In comparison, SinglyDiagonally Implicit Runge–Kutta methods (SDIRKs) incur lower computational costs since Newtoniterations for each stage can be solved separately. However, these methods do not have high orderperformance for problems of index> 1 since their stage order is only 1.

The method derived in this paper achieves a stage order of 2 while allowing separate stage iteration,similar to an SDIRK. The solution of the previous step is introduced as an ”explicit” first stage, requiringno additional function evaluations to achieve order 2 in the remaining stages. After developing theoryto allow the application of order conditions for index 1 and 2 methods to an explicit stage Runge–Kuttamethod in Section 2, Section 3 develops a four-stage ESDIRK method suitable for problems of index 1and 2. Section 4 then tests the proposed method using fixed step sizes to ensure that the desired ordersare being achieved. Before testing a variable step size integrator, Section 5 discusses differences betweenthe implementations tested. Finally, Sections 6 and 7 compare the performance of the new method toRADAU5 and discuss the results.

2. Order conditions for explicit stage methods

This section is included to show how general convergence results can be obtained for Runge–Kuttawith tableau

c A

b, (3)

whereA, b andc are of the form

A= 0 0

u A

, bT = [b0 b T ], c =

0

c

. (4)

Page 3: A four-stage index 2 Diagonally Implicit Runge–Kutta method

R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432 417

HereA is ans× s matrix (nonsingular) andb T, c andu are, respectively, 1× s, s× 1 ands × 1 vectors.For the following proof, let us also define the vectorse andes , of lengths, as follows:

e = (1, . . . ,1)T, es = (0, . . . ,0,1)T. (5)

The first point to note is that for methods of this form, the stability function is given by

R(z)= 1+ bTz(I − Az)−1

(1

e

), (6)

which can easily be written as

R(z)= 1+ z(b0 + b T(z−1I − A

)−1u)+ b T(z−1I − A

)−1e. (7)

Then if

b T = eTs A, b0 = us, (8)

andA has eigenvalues with positive real part, thenR(z) is bounded∀Re(z)� 0 and, furthermore

R(∞)= 1− eTs A

−1c = −eTs A

−1u. (9)

In order to treat the convergence properties of (4) we will write it in the form of a multivalue method(that is to say, a general linear method). Ans-stage,r-value multivalue method for solvingy is given by

Yi =r∑

j=1

a(1)ij y

(n)j + h

s∑j=1

b(1)ij f (Yj ), i = 1, . . . , s,

y(n+1)i =

r∑j=1

a(2)ij y

(n)j + h

s∑j=1

b(2)ij f (Yj), i = 1, . . . , r.

(10)

HereY = [Y T1 , . . . , Y

Ts ]T is the vector of internal stages, whiley(n) = [y(n)T1 , . . . , y(n)Tr ]T is the vector of

external stages which carries all the information from step to step. Runge–Kutta methods can be writtenin this form with r = 1 andA1 = e = [1, . . . ,1]T ∈ R

s , while k-step linear multistep methods haves = k+ 1, r = k and

Y = [yTn+1, . . . , y

Tn+k−1

]T, y(n) = [

yTn , . . . , y

Tn+k−1

]T.

The method given by (10) can be characterized by the tableau

A1 B1

A2 B2

(11)

and can also be written in tensor product form

Y = (A1 ⊗ I )y(n) + h(B1 ⊗ I )F (Y ),

y(n+1) = (A2 ⊗ I )y(n) + h(B2 ⊗ I )F (Y ),(12)

whereI is them×m identity matrix andF (Y )= [f (Y1)T, . . . , f (Ys)

T]T.

Page 4: A four-stage index 2 Diagonally Implicit Runge–Kutta method

418 R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432

Note that the(s+1)-stage method given by (4) and (10) can be written as ans-stage, 2-value Nordsieckmethod in which

A1 = [e u], B1 = A,

A2 = 1 us

0 0

, B2 = b T

eTs

, (13)

whereeTs A = b T. In this formulation the pieces of information,yn andhf (yn) are carried forward from

step to step. For methods of form (4) (such as the trapezoidal method) this is the more natural formulation.If (10) is applied to the linear test equation

y′ = qy, (14)

then

y(n+1) = (A2 + zB2(I − B1z)

−1A1)y(n).

The matrixM(z) = A2 + zB2(I − B1z)−1A1 will be called the stability matrix and the limit of this

matrix at infinity will play a crucial role in understanding the behaviour of (10) applied to a DAE. IfB1

is nonsingular this matrix is given by

M(∞)= A2 − B2B−11 A1. (15)

Thus a method is said to be A-stable ifM(z) is power bounded for all Re(z)� 0, L-stable if the methodis A-stable andσ (M(∞))= {0}, and zero-stable ifM(z) is power bounded forz= 0.

In the case of method (13) in Nordsieck formulation the stability matrix given by (15) takes the form

M(∞)= 1− b TA−1e us − b TA−1u

−eTs A

−1e −eTs A

−1u

, (16)

and if the method is stiffly accurate

M(∞)= 0 0

−esA−1e −eT

s A−1u

, (17)

so thatσ (M(∞))= {0,−eTs A

−1u} which is consistent with (9).Consider now the DAE of the form

y′ = f (y, z) ∈ Rm1, 0= g(y, z) ∈ R

m2, (18)

which has consistent initial values(g(y0, z0)= 0); then if ∂g/∂z is nonsingular and of bounded inversein the neighbourhood of the solution of (18), then (18) is said to be of index 1. Eq. (18) can be interpretedas the limit whenε → 0 of the ODEs

y′ = f (y, z), εz′ = g(y, z), (19)

Page 5: A four-stage index 2 Diagonally Implicit Runge–Kutta method

R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432 419

and if (12) is applied to (19) then

Y = (A1 ⊗ Im1)y(n) + h(B1 ⊗ Im1)F (Y ,Z),

εZ = ε(A1 ⊗ Im2)z(n) + h(B1 ⊗ Im2)G(Y ,Z),

y(n+1) = (A2 ⊗ Im1)y(n) + h(B2 ⊗ Im1)F (Y ,Z),

εz(n+1) = ε(A2 ⊗ Im2)z(n) + h(B2 ⊗ Im2)G(Y ,Z),

(20)

where

F (Y ,Z)= [f (Y1,Z1)

T, . . . , f (Ys,Zs)T]T,

G(Y ,Z)= [g(Y1,Z1)

T, . . . , g(Ys,Zs)T]T.

If B1 is nonsingular then the second equation in (20) can be solved forG(Y ,Z) and substituted into thefourth equation. Puttingε= 0 then gives

Y = (A1 ⊗ Im1)y(n) + h(B1 ⊗ Im1)F (Y ,Z),

0 = G(Y ,Z),

y(n+1) = (A2 ⊗ Im2)y(n) + h(B2 ⊗ Im2)F (Y ,Z),

z(n+1) = (M(∞)⊗ Im2

)z(n) + (B2B

−11 ⊗ Im2

)Z.

(21)

Now consider problems of the form

y′ = f (y, z) ∈ Rm1, 0= g(y) ∈ R

m2, (22)

with consistent initial values(g(y0) = 0, gy(y0)f (y0, z0) = 0) and gy(y)fz(y, z) nonsingular in aneighbourhood of the solution of (22). Under these conditions (22) is said to be of index 2. By a similarmechanism for index 1 problems and under the same assumption thatB1 is nonsingular it can be shownthat

Y = (A1 ⊗ Im1)y(n) + h(B1 ⊗ Im1)F (Y ,Z),

0 = G(Y ),

y(n+1) = (A2 ⊗ Im2)y(n) + h(B2 ⊗ Im2)F (Y ,Z),

z(n+1) = (M(∞)⊗ Im2

)z(n) + (B2B

−11 ⊗ Im2

)Z.

(23)

In the case of a stiffly accurate method and using (17) it is clear from (21) and (23) that

y(n+1)1 = Ys, (24)

z(n+1)1 = Zs, (25)

so thatg(y(n+1)1 , z

(n+1)1 )= 0 org(y(n+1)

1 )= 0, depending on the index formulation, and the update lies onthe manifold, as is required.

Using the formulation in (20) and (23) it is simple to extend the analysis of the order conditions ofRunge–Kutta methods as applied to index 1 or index 2 methods to multivalue methods (see [2,3]). Inparticular, this can be done for methods (13).

Page 6: A four-stage index 2 Diagonally Implicit Runge–Kutta method

420 R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432

In order to do this we must define the stage order vectors which take the form for a multivalue methodas

kp = cp − A1qp − pB1cp−1, (26)

c = A1q1 + B1e. (27)

Here theqp are vectors associated with the starting procedure for the bushy treeτp−1. In the case ofmethod (13)

q0 = (1,0)T, q1 = (0,1)T, (28)

qp = 0, p � 2, (29)

so that

c = Ae, (30)

kp = cp − pAcp−1, p � 1. (31)

Hence all the essential behaviour of (13) as applied to index 1 and 2 problems is dependent only onA

andb T. Thus to achieve order 2 behaviour for our explicit stage method, we neglect the first column,u,of our method and perform the appropriate analysis.

3. Method derivation

We seek a four stage method achieving order 3 in the differential variables and order 2 in the algebraicvariables for problems of index 1 and 2. The second and third stage will be of order(2,1). One ofthese stages can then be used to provide an approximation to the solution at the end of the step for errorprediction. Such high stage order is also desirable if the method is to be used for interpolation.

The proposed code is to be used to solve DAE problems so we prefer that it be stiffly accurate, achievedby making the final row of theA-matrix equal to the vector of weights.

Standard SDIRK methods cannot satisfy order conditions for index 2 problems, but we desire the lowcost of their solution. To increase the order of our first calculated stage, we shall use the solution fromthe previous step to provide additional information. We indicate this in our Butcher tableau by includingan explicit first stage withc1 = 0. A similar idea was used by Alexander [1]. Stage calculations will besolved by some form of the modified Newton–Raphson method so, to reduce computational work, wemake the remaining diagonals equal. We thus have a method with the Butcher tableau below.

0 0

c2 a21 γ

c3 a31 a32 γ

1 b1 b2 b3 γ

b1 b2 b3 γ

= c A

bT. (32)

Page 7: A four-stage index 2 Diagonally Implicit Runge–Kutta method

R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432 421

3.1. Order conditions

The order conditions required for a method of order 3 and stage order 2 are found using the simplifyingassumptions described by Hairer and Wanner [8]. These are

C(2): Ack−1 = ck

k, k = 1,2, (33)

B(3): bTck−1 = 1

k, k = 1,2,3. (34)

In order to achieve order 3 for index 2 problems, we must satisfy the order conditions derived by Haireret al. [9]. However, these conditions are given assuming theA-matrix for the method is non-singular.This is not the case for our method.

From the theory of Section 2, we define

A = (aij )s−1i,j=1 =

a22 0 . . . 0...

. . .. . . 0

as2 . . . . . . ass

, (35)

b T = (b2, . . . , bs), (36)

c = (c2, . . . , cs), (37)

and the additional order conditions we must apply for index 2 methods are then found according to [9].In [10] we find that these can be satisfied with the assumptions

A1(3): b TA−1c k = 1, k = 1,2,3, (38)

A2(3): b TA−2c k = k, k = 1,2,3, (39)

where e = [1,1,1]T, b = [b2, b3, γ ]T and c = [c2, c3,1]T. Assumption (38) ensures order 3 in thedifferentials while (39) provides order 2 in the algebraics.

3.2. Solution of order conditions

UsingC(2) we find the first two columns are specified as

ai1 = ci −i−1∑j=2

aij − γ, i = 2,3,4, (40)

ai2 = 1

c2

(1

2c2i −

i−1∑j=3

aij cj − γ ci

), i = 3,4, (41)

so that the Butcher tableau becomes

0 0

2γ γ γ

c3 c3 − a32 − γ a32 γ

1 b1 b2 b3 γ

(42)

Page 8: A four-stage index 2 Diagonally Implicit Runge–Kutta method

422 R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432

where

a32 = c23 − 2c3γ

4γ. (43)

The conditions satisfyingC(2) andB(3) for the fourth stage can be solved to give

b1 =16 + γ 2 − γ 2c3 + 3

2γ c3 − γ − 14c3

γ c3, (44)

b2 =13 − γ + 1

2c3 + γ c3

2γ (2γ − c3), (45)

b3 =13 − 2γ + 2γ 2

c3(c3 − 2γ ), (46)

assumingc3 �= 0, γ �= 0 andc3 �= 2γ .Now, to solve the index 2 conditions we note that for Eq. (38),

b TA−1c k = ck4 = 1, (47)

since the method is stiffly accurate and soA1(3) is already satisfied.Further, [10] shows that ifC(q) is true thenA1(q − 1) implies (and is implied by)A2(q). Given our

method satisfiesC(2), A2(2) is assured leaving only one equation which must be satisfied.Since the block for our method is singular and we have specified that the method be stiffly accurate,

we setk = 3 for Eq. (39), and find it to be equivalent to

eT3A

−1c3 = 3,

so that, following some analysis and assuming that (c3 �= 2γ ) we find

c3 = 2γ (γ − 14)(γ − 1)

(γ − 12)

2 − 112

. (48)

Thus, using Eqs. (40)–(48) we have a 4-stage method of order(3,2) for both index 1 and index 2problems.

3.3. Stability

The stiffness of differential algebraic systems leads us to require strong stability for our method. It isreasonable to expect it be at least A-stable, implying that the method should have no stability restrictionswhen solvingy′ = λy with Reλ < 0 andh > 0. This is achieved when the stability function,R(z), of aRunge–Kutta method satisfies∣∣R(iy)∣∣� 1, for all realy, (49)

and

R(z) is analytic for Rez < 0. (50)

For the above method, we find the stability function to be

R(z)= (−γ 3 + 3γ 2 − 32γ + 1

6)z3 + (3γ 2 − 3γ + 1

2)z2 + (−3γ + 1)z+ 1

(1− zγ )3. (51)

Page 9: A four-stage index 2 Diagonally Implicit Runge–Kutta method

R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432 423

Therefore to achieve A-stability we can selectγ from

γ ∈ [13, θ

], θ ≈ 1.06857902, (52)

whereθ is the largest zero of the Laguerre polynomial,124 − 1

2y + 32y

2 − y3. Thus if we choose the rootlying within the step length, so thatγ ≈ 0.43586652, then

limz→∞R(z)= 0, (53)

and the method is considered L-stable. This implies that for highly stiff problems the method is able torapidly damp oscillations arising due to computational errors.

3.4. Error prediction

Since the stages are of order 2 we can select either of the internal stages for our embedded method. Ifwe select the second stage we find the embedded method to be of the form

0 0

2γ γ γ

from which we are reminded of the trapezoidal rule. Since it is stiffly accurate and A-stable it will performwell as our low order estimate for the error predictor. So choosingγ = 1

2 we findc2 = 1 with a stabilityfunction of the form

R(z)= 1+ 12z

1− 12z. (54)

Note that we find that no L-stable stiffly accurate method can be formed which has an embedded errorestimator.

Thus all degrees of freedom are satisfied and we find our final Butcher tableau to be

0 0

1 12

12

32

58

38

12

1 718

13 −2

912

3.5. ESDIRK23a

It was noted above that a value ofγ can be chosen which causes the method to be L-stable.Kværnø [11] has developed, independently of this work, such a method although no consideration is given

Page 10: A four-stage index 2 Diagonally Implicit Runge–Kutta method

424 R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432

to the solution of index 2 problems. The third stage of this method provides error prediction capabilities.The Butcher tableau is as follows.

0 0

2γ γ γ

1 −−6γ+1+4γ 2

4γ −2γ−14γ γ

1 6γ−112γ − 1

(24γ−12)γ −6γ 2−6γ+16γ−3 γ

This method will be compared with the previously developed method for its stability properties and itsperformance on index 2 problems.

4. Method comparison at fixed step sizes

It is now useful to compare this newly proposed method with other established implicit methods.Specifically, we shall compare our new method, which we shall termDIRK2, with theRADAU5 methodwhich uses a fully implicit 3 stage Butcher block and the three stage methodDIRK32 described in [4].As a final comparison we include the methodESDIRK23a, as described above. WhileESDIRK23a is alsoa four stage method with explicit first stage and stage order 2, it has not been constructed for index 2solution and, unlike the proposed method, all stage solutions lie within the step length. The expectedorder for each method is given in Table 1.

Simulations were performed on a Hewlett Packard HP C160 UNIX workstation. Global error is quoted,calculated from the solution at the final point. An “exact” solution is calculated byRADAU5 at a relativeerror tolerance of 1× 10−15. The error quoted is then the average absolute error, calculated as

error = ∥∥ycalc(xf )− yexact(xf )∥∥

2, (55)

whereycalc(x) andyexact(x) are the the calculated and “exact” solution vectors, respectively.Four test problems were considered, the first two being ODE problems from the CWI test set for IVP

solvers [12]. The Chemical Akzo Nobel Problem describes a complex set of chemical reactions while thepollution problem considers a large number of potential pollutant products reacting in the atmosphere.

Table 1Expected orders for the solvers under comparison

Index 1 Index 2

y-component z-component y-component z-component

DIRK32 3 2 –* –*

DIRK2 3 2 3 2

ESDIRK23a 3 2 2† 1†

RADAU5 5 5 5 3* Method not designed for index 2 problems.† Order expected sinceB(3) andC(2), see [10].

Page 11: A four-stage index 2 Diagonally Implicit Runge–Kutta method

R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432 425

Fig. 1. Variation of error with step-length for ODEs.

Fig. 2. Variation of error with step-length for DAEs.

The results for these ODE problems can be seen in Fig. 1. We note that both problems gave thirdorder response for the three DIRK solvers whileRADAU5, being fifth order, gives a roughly fifth orderresponse. It was not possible to use larger step sizes without convergence failure becoming a problem intheRADAU5 method.

The two other problems tested were DAE systems — one being a typical index 1 chemical engineeringproblem of a storage tank where the vapor space undergoes adiabatic compression, the second an index 2problem describing the response of a perturbed pendulum (from [9]).

For these problems the solution errors vary with step size as shown in Fig. 2. Performance is compa-rable for the three DIRK methods on the index 1 problem butDIRK32 shows much poorer performance

Page 12: A four-stage index 2 Diagonally Implicit Runge–Kutta method

426 R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432

for index 2 problems, resorting to first order behaviour. On the index 2 problem our method is, asexpected, order 3 but we find the performance ofESDIRK23a unexpected as we predicted an order 2response. This is discussed in Section 7.

5. Implementation issues

Practical implementations allow the step size to vary, maintaining a given local error. To make a faircomparison of methods we must seek implementations which are equivalent.

DIRK32 is an existing implementation which uses simple heuristics to control step size and iterations.Despite its reliance on heuristics, this solver is generally very efficient for process simulation problems.In comparison,RADAU5 has been designed to be flexible under a range of different problems. This makescomparison between the two codes difficult. For this reason, and because theRADAU5 code appeared tobe more effective under certain circumstances, alterations were made to the Index 2 DIRK code. Theresulting solver has been designatedDIRK2 in the following discussions.

The following is different betweenRADAU5 and the DIRK implementations.• Jacobian update: TheRADAU5 implementation retains a copy of the Jacobian which is refactored

whenever a new step size is chosen. Jacobians are then recalculated only when convergence appearsto be poor. In contrast, the DIRK implementations recalculate the Jacobian whenever a new stepsize is chosen or when the convergence rate of the Newton iterations exceeds 0.04.

The following operating conditions were set withinRADAU5 so that its operation would be comparablewith the DIRK implementations.

• Dead zone: Both methods apply a dead zone, which is preferable to reduce the number of Jacobianrefactorizations. To make the two methods comparable their dead zones were set so that step sizewas changed if the step size reduction was greater than 5% or the step size increase greater than40%.

• Maximum and minimum step size change:RADAU5 usually has a maximum increase of 8 times theprevious step size while the DIRK solvers permit up to 10 times. ThusRADAU5’s maximum wasincreased to 10 times. Both codes will not allow the step to be less than 20% of the previous stepsize.

The following were altered inDIRK2 as their addition appeared to improve the code’s performance.• Control of iterations:RADAU5 contains methods for monitoring the convergence of Newton

iterations. Iterations are terminated if the solution begins to diverge or if it is predicted thatthe iterations will not converge.DIRK32 stopped only if the maximum number of iterations wasexceeded butDIRK2 was altered to imitateRADAU5’s behaviour.

• Step size control: Gustafsson’s Predictive controller [7] treats step size selection as a control problemand uses a control algorithm to determine step size. Though slightly more conservative for smallproblems than the traditional method of step size control, this method claims to generally producebetter results. Testing with theDIRK2 code suggested this was a more suitable method for index 2problems and was generally at least comparable.RADAU5 uses the minimum of this and the standardstep size prediction.

• Error estimation: As described in [9], the error prediction forRADAU5 does not naturally approachzero ash→ 0 for index 2 problems sinceσ = bTA−2e of the RADAU method is not equal to that of

Page 13: A four-stage index 2 Diagonally Implicit Runge–Kutta method

R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432 427

the error prediction. InDIRK2 this is also the case. To compensate, index 2 variables are multipliedby h so that the error estimate after each step becomes

err = ∥∥y − y∥∥+ ∥∥z1 − z1

∥∥+ h∥∥z2 − z2

∥∥,wherez1 are index 1 algebraic variables andz2 are the index 2 algebraic variables.

• Stage value estimates: The predictor previously used to start Newton iterations inDIRK32 was linear,based on the previous stage value. A higher order predictor significantly reduced the number ofiterations on each stage. The predictor used was derived by the method described in [14].

The final index 2 DIRK code also contains routines suitable for discrete event handling but this introduceslittle overhead in the problems studied.

6. Method comparison at variable step sizes

The four variable step solvers were compared using the previous test problems. The compressorproblem described in [9] was also considered. In each case the dependence of the number of functioncalls and the time of execution on the accuracy of the result is given.

Relative tolerances were specified as starting at 0.5 × 10−3 and halving after each simulation. Errorswere calculated as the minimum number of significant correct digits (scd) at the end of the integrationinterval, calculated as

scd := − log10

(∥∥∥∥ycalc− yexact

yexact

∥∥∥∥∞

). (56)

6.1. Chemical Akzo Nobel Problem

This problem involves a set of 6 ODEs. The problem is at times stiff and gives an example ofthe difficult reaction kinetics that could be expected in a typical process engineering problem. Therelationship between global error and computational solver work is plotted in Fig. 3.

Fig. 3. Plots of solver performance for the Chemical Akzo Nobel Problem.

Page 14: A four-stage index 2 Diagonally Implicit Runge–Kutta method

428 R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432

Fig. 4. Plots of solver performance for the Pollution Problem.

We observe that whileRADAU5 makes significantly less function calls, it has greater overhead costs sothat its performance is only marginally better than the DIRK methods. There is little difference betweenthe three DIRK methods.

6.2. Pollution Problem

The pollution problem has 20 ODEs with some concentrations at times approaching zero. The resultsare shown in Fig. 4. We find that, thoughRADAU5 requires fewer function evaluations, it seems to takemore computational time than the DIRK methods.

6.3. Adiabatic Tank Index 1 Problem

The Adiabatic Tank Problem is described in [5, pp. 90–92] and is typical of DAE problems encounteredin Chemical Engineering. The problem solves 10 equations — four differential and six algebraic. Theresults are shown in Fig. 5. We findRADAU5 requires significantly less effort at tight tolerances but atloose tolerances the DIRK methods are comparable. Typically tolerances of 10−3 or 10−4 are adequatefor process engineering problems.

6.4. Index 2 Pendulum Problem

The motion of a swinging pendulum is described in [9] in an index 2 formulation. It contains 5equations — four differential and one index 2 algebraic. This problem was tested on the solvers andthe results are shown in Fig. 6. TheDIRK2 solver is now comparable in solve time toRADAU5 even attight tolerances whileDIRK32’s performance was so poor that it could only solve at loose tolerances.

Page 15: A four-stage index 2 Diagonally Implicit Runge–Kutta method

R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432 429

Fig. 5. Plots of solver performance for the Adiabatic Tank Problem.

Fig. 6. Plots of solver performance for the Index 2 Pendulum Problem.

6.5. Index 2 Pump Problem

The Index 2 Pump Problem is also described in [9]. This problem has 8 equations, five algebraic ofwhich one is index 2. The results in Fig. 7 showDIRK2 again comparable toRADAU5 with fewer functionevaluations.

Page 16: A four-stage index 2 Diagonally Implicit Runge–Kutta method

430 R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432

Fig. 7. Plots of solver performance for the Index 2 Pump Problem.

7. Discussion of performance comparison

The above results indicate that performance ofDIRK2 on index 1 problems is comparable to the originalDIRK32 solver but a significant improvement for index 2 problems.

The performance by theESDIRK32a method is at least comparable to that ofDIRK2 in each case andoften seems slightly better than our method. We note that the value ofγ giving L-stability also minimizesthe error constant of theESDIRK32a method, so our observations are consistent.

That the two explicit stage DIRKs were comparable for index 2 problems is surprising. The simplifyingassumptions derived by Higueras [10] suggest that forB(3) andC(2) ESDIRK32a can expect order 2differential behaviour and order 1 algebraic for index 2 problems. What we find is performance equivalentto our newly derived method. To explain this, we examine the order conditions in [8] which would giveESDIRK32a order 3 performance for index 2 problems. We find all are satisfied except that

b TA−2c3 ≈ 2.8717 �= 3, (57)

b TA−2(Ac · c)≈ 1.4359 �= 32. (58)

Though not satisfying the exact values, these are very close implying that the error constant for thismethod would be very small. While not being truly order 3, it seemsESDIRK32a is capable of essentiallyorder 3 behaviour.

RADAU5 outperformsDIRK2 on most ODE and index 1 problems, as would be expected given its 5thorder behaviour. An exception is the pollution problem which is notably larger (66 equations) than theother problems considered. We find that, as problem size increases,RADAU5’s solve time approaches thatof the DIRK methods. Solving with loose tolerances we find the computational effort is often comparablefor the two methods.

Both these observations point to the lower computational overhead of the DIRK methods providingan advantage when compared to a fully implicit method. This is very apparent for the index 2 problems

Page 17: A four-stage index 2 Diagonally Implicit Runge–Kutta method

R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432 431

whereRADAU5 clearly requires fewer function calls and yet is roughly equivalent to the DIRK methodsin computational time.

8. Summary

This paper has developed a four-stage DIRK method capable of solving index 1 and index 2 DAEs toorder(3,2). This is done by introducing an explicit first stage so that remaining stages may be order 2 inthe differentials.

Numerical tests using fixed step sizes demonstrate the advantage of this new method on index 2problems and tests using variable step size implementations show that its performance is equal to thatof the existingDIRK solver. Further, performance is comparable toRADAU5 at low tolerances or largeproblems, indicating its suitability for the solution of a wide range of process engineering problems.

A significant issue with this method is determining starting values. At present initial values must satisfy(2b) and (2c) to at least the same order of accuracy as the required solution before integration will besuccessful.

The advantage of this new method compared to the traditional DIRK methods is its ability to solveindex 2 problems. The use of an explicit first stage prevents an increase in computational costs whencompared toDIRK32 but permits higher stage order.

References

[1] R. Alexander, Diagonally implicit Runge–Kutta methods for stiff o.d.e.’s, SIAM J. Numer. Anal. 14 (6) (1977)1006–1021.

[2] K. Burrage, R.P.K. Chan, On smoothing and order reduction effects for implicit Runge–Kutta formulae,J. Comput. Appl. Math. 45 (1993) 17–27.

[3] K. Burrage, Order properties of implicit multivalue methods for ordinary differential equations, IMAJ. Numer. Anal. 8 (1988) 43–69.

[4] I. Cameron, Solution of differential-algebraic systems using diagonally implicit Runge–Kutta methods, IMAJ. Numer. Anal. 3 (1983) 273–289.

[5] R.G.E. Franks, Modeling and Simulation in Chemical Engineering, Wiley-Interscience, Sydney, 1972.[6] C.W. Gear, O. Østerby, Solving ordinary differential equations and discontinuities, ACM Trans. Math.

Software 10 (1) (1984) 23–44.[7] K. Gustafsson, Control-theoretic techniques for stepsize selection in implicit Runge–Kutta methods, ACM

Trans. Math. Software 20 (4) (1994) 496–517.[8] E. Hairer, S.P. Nørsett, G. Wanner, Solving Ordinary Differential Equations, Vol. II, Springer, Berlin, 1991.[9] E. Hairer, Ch. Lubich, M. Roche, The Numerical Solution of Differential-Algebraic Systems by Runge–Kutta

Methods, Lecture Notes in Mathematics, Vol. 1409, Springer, Berlin, 1989.[10] I. Higueras, On simplifying assumptions of Runge–Kutta methods for index 2 differential algebraic problems,

Computing 54 (2) (1995) 185–190.[11] A. Kværnø, ESDIRK-methods, Technical Report, The Norwegian University of Science and Technology.[12] W.M. Lioen, J.J.B. de Swart, W.A. van der Veen, Test set for IVP solvers, Technical Report, CWI, Amsterdam,

23 December 1996.[13] S.E. Mattsson, G. Söderlind, Index reduction in differential-algebraic equations using dummy derivatives,

SIAM J. Sci. Comput. 14 (3) (1993) 677–692.

Page 18: A four-stage index 2 Diagonally Implicit Runge–Kutta method

432 R. Williams et al. / Applied Numerical Mathematics 40 (2002) 415–432

[14] H. Olsson, G. Söderlind, Stage value predictors and efficient Newton iterations in implicit Runge–Kuttamethods, Technical Report, Department of Computer Science, Lund University, 1998.

[15] L.R. Petzold, Differential algebraic equations are not ODE’s, SIAM J. Sci. Statist. Comput. 3 (1982) 367–384.