• Nem Talált Eredményt

Implicit Runge–Kutta method

2.4 Runge–Kutta method

2.4.3 Implicit Runge–Kutta method

As we have seen, the explicit Runge–Kutta methods are defined by the special (strictly lower triangular) matrixB ∈Rm×m and the vectorσ ∈Rm. A further and quite natural generalization is obtained by neglecting the requirement for the matrix B. Namely, we introduce the following notion.

Definition 2.4.8. LetB∈Rm×m be an arbitrary matrix, σ ∈Rm some given vector, and a=Be. The numerical method defined by these parameters, i.e.,

the method

k1 =f(ti+a1h, yi+h[b11k1+b12k2+· · ·+b1mkm]), k2 =f(ti+a2h, yi+h[b21k1+b22k2+· · ·+b2mkm]), . . . . km =f(ti+amh, yi+h[bm1k1+bm2k2+· · ·+bmmkm]),

(2.142)

yi+1 =yi+h(σ1k12k2+. . .+σmkm), (2.143) is called Runge–Kutta method. When B is not strictly lower triangular, i.e., there exists an elementbij such thati≥j andbij 6= 0, then the method (2.142)-(2.143) is called implicit Runge–Kutta method. When Bis not a strictly lower triangular matrix, but it is lower triangular, i.e., bij = 0 for any i > j, then the method (2.142)- (2.143) is called diagonally implicit Runge–Kutta method.

Remark 2.4.7. For the diagonally implicit Runge–Kutta method the algo-rithm is the following:

k1 =f(ti+a1h, yi+hb11k1),

k2 =f(ti+a2h, yi+h[b21k1+b22k2]),

. . . . km =f(ti+amh, yi+h[bm1k1+bm2k2+· · ·+bmmkm]),

(2.144)

yi+1 =yi+h(σ1k12k2+. . .+σmkm), (2.145) Remark 2.4.8. The main difference between them is as follows. For the explicit Runge–Kutta method we can compute the intermediate values ki di-rectly, by substituting the previously defined values k1, k2, . . . , ki−1. For the diagonally implicit Runge–Kutta method we cannot compute ki directly, be-cause, according to (2.144), ki is present on the left side, too. Therefore, for its computation we have to solve an algebraic equation. Typically, for the implicit Runge–Kutta method the situation is the same, however, the computation of ki becomes more difficult, because it is contained not only in the formula for the definition of ki but also in all equations of (2.142). This means that for the definition of the values ki we have to solve a system of nonlinear algebraic equations formunknown values. Hence the implicit methods (DIRK and IRK) require much more computational work. However, these methods have good stability properties, which make them very beneficial for solving some spe-cial problems (like stiff ones). The other benefit of the implicit Runge–Kutta methods is that usually they are more accurate than the explicit ones.

Remark 2.4.9. The implicit Runge–Kutta method can be written as

For the diagonally implicit Runge–Kutta method the only difference is that the formula (2.146) is changed into the formula

kj =f(ti+ajh, yi+h

j

X

s=1

bjsks), j = 1,2, . . . m. (2.148) In the sequel we introduce some important implicit Runge–Kutta methods (including also the special case of diagonally implicit Runge–Kutta methods) by giving their Butcher tableau. We will see that to write these methods in the usual form of one-step methods (i.e., to give the function Φ) is more difficult than for the explicit methods.

• Let the Butcher tableau of a method be given by 1 1

1 (2.149)

This is a diagonally implicit Runge–Kutta method, which yields the fol-lowing algorithm:

k1 =f(ti+h, yi+hk1)

yi+1 =yi+hk1. (2.150)

The realization of this method means the following. In the first step we solve the equation for the unknown k116, then we substitute this value into the second formula. Let us find the function Φ for this method. From the second formula we havehk1 =yi+1−yi. Therefore, by its substitution into the first equation k1 = f(ti+h, yi + (yi+1 −yi)) = f(ti+h, yi+1).

From the second equation we have yi+1 =yi+hf(ti+h, yi+1), therefore, Φ(h, ti, yi, yi+1) =f(ti+h, yi+1). Hence, the method with (2.149) is the well-known implicit Euler method. As we already know, this is a first order method.

16For the solution usually we use some iterative method (as the Newton method).

• Let the numerical method be given by 0.5 0.5

1 (2.151)

This is also a diagonally implicit Runge–Kutta method, which results in the following computational algorithm:

k1 =f(ti+ 0.5h, yi+ 0.5hk1)

yi+1 =yi+hk1. (2.152)

Let us find the function Φ for this method, too. From the second equation we have hk1 = yi+1−yi. By its substitution into the first equation, we obtain k1 =f(ti+ 0.5h, yi+ 0.5(yi+1−yi)) =f(ti+ 0.5h,0.5(yi+yi+1)).

Hence Φ(h, ti, yi, yi+1) =f(ti+ 0.5h,0.5(yi+yi+1)) and the corresponding one-step method (in the usual compact form) is

yi+1 =yi+hf(ti+ 0.5h,0.5(yi+yi+1)). (2.153) The diagonally implicit Runge–Kutta method (2.153) is called implicit midpoint rule. The order of the method can be defined by analyzing the expression (local approximation error) of the form

gi =u(ti+1)−u(ti)−hf(ti + 0.5h,0.5(u(ti) +u(ti+1))).

Let us define the order in h of gi. By developing into Taylor series, we get

u(ti+1)−u(ti) =hu0(ti) + h2

2 u00(ti) +O(h3), and similarly

f(ti+ 0.5h,0.5(u(ti) +u(ti+1)))

=f(ti+ 0.5h, u(ti) + 0.5hu0(ti) +O(h2))

=f(ti, u(ti)) + 0.5h∂1f(ti, u(ti)) + 0.5hu0(ti)∂2f(ti, u(ti)) +O(h2)

=f(ti, u(ti)) + h

2[∂1f(ti, u(ti)) +f(ti, u(ti))∂2f(ti, u(ti))] +O(h2).

When we substitute these value into the formula for gi, then taking into account the second relation in (2.4) we get gi =O(h3). This means that the implicit midpoint rule is a second order method.

• We consider the method with the Butcher tableau

0 0 0

1 0.5 0.5 0.5 0.5

(2.154)

This is a two-stage implicit Runge–Kutta method with the following this expression and the first relation into the second formula, we get k2 =f(ti+h, yi+ (yi+1−yi)) = f(ti+h, yi+1). Now, putting this value of k2, and k1 from the first equation into the third equation, we obtain Φ(h, ti, yi, yi+1) = 0.5[f(ti, yi) +f(ti +h, yi+1)]. Hence, the numerical method with the Butcher tableau (2.154) is the well-known second order trapezoidal method.

For the following two-stage methods we give only their Butcher tableau.

• We define the method, when in the numerical integration we choose the Gaussian basic points. This implies the following method:

1

The method (2.156) is a two-stage, fourth order implicit Runge–Kutta method.

• We define another two-stage implicit Runge–Kutta method as follows

1

The method (2.157) is called two-stage Radau method. We can show that the order of accuracy of this implicit Runge–Kutta method is 3.

During the consideration of the accuracy of the above implicit Runge–Kutta methods we have seen that the accuracy of the methods (p) can be greater then the number of the stages (m). For instance, the accuracy of the one-stage trapezoidal method has second order accuracy, the two-one-stage (2.156) method with Gaussian basic points has fourth order, etc. This means that the case p > m is also possible for the implicit methods. (The reason is that

the implicit Runge–Kutta methods have more free parameters.) We can show that the upper bound for the accuracy of some m-stage implicit Runge–Kutta method is p≤2m.

The methods with p = 2m, are called implicit Runge–Kutta method with maximum accuracy. Hence, the implicit Euler method, the implicit midpoint rule, and the method (2.156) with Gaussian points are all methods of maximum accuracy.

We enclose an interactive animation, called onestep imp.exe. The program can be downloaded from

http://www.cs.elte.hu/~faragois/nummod_jegyzet_prog/.

The image of this program on the screen can be seen in Figure 2.2.

Figure 2.2: The image on the screen of the interactive program for several implicit one-step methods

Alternatively, this program suggests three initial-value problems as test problems. The chosen numerical methods can be the theta-method, where the value of theta can be chosen, the 3rd order Runge–Kutta method and the 4th order Runge–Kutta method. We can select the discretization step size by giving the parameter n, which is the number of the partitions of the interval.

Pushing ”Calculate” we get the result. The result is given graphically, and the error (in maximum norm) is also indicated. By increasing n the order of the convergence is also shown.