Simple Predictor Corrector Method

To illustrate the method we will modify the simple Euler method, equation 10-6, as follows. The predictor equation is yn+i = jvi + 2hF(x„,y„) (10-28)

which requires values at x„_i and x„ to calculate _y„+i- Once we have an approximate value for y„+i, we use the corrector equation

to get an improved value of y„+i. The corrector equation is used iteratively: the value of y„+i is used to obtain an improved value of y„+i and the process is continued until a specified level of convergence is obtained. Two starting values are required, and generally only a single value at xq is provided as part of the statement of the problem; the fourth-order Runge-Kutta method can be used to obtain the other starting value.

The worksheet shown in Figure 10-13 illustrates the application of this simple predictor-corrector formula. Again we use as an example the simulation of the first-order kinetic process A B with initial concentration Co = 0.2000 mol/L and rate constant k = 5 x 103 s~\ Again, we use a time increment of 20 seconds.

A

B

C

D

E

F

1

Simulating First-Order Reaction Using Two-point Predictor-Corrector Method

2

(Values in bold are initial values)

3

t Pred Corrl Corr2 Corr3 Corr4

4

0

0.2000

Difference

between successive values (row 11)

5

20

0.1810

-3E-05

2 £-06

-3E-08

4E-09

6

40

0.16381

0.16373

0,16373

0 16373

0,16373 i

7

50

0.14821

0,14821

0.14321

0.14821

0.14821 I

8

B0

0.13417

0,13409 0,13409

0.13409

0.13409

9

100

0.12137

0.12139 0.12139

0.12139

0.12139

10

120

0.10989

0.10981

0.10981

0.10981

0.10981

11

140

0.09940

0.09943

0.09942

0.09942

0.09942

12

160

0 09001

0.08992

0.08993 0,08993

0.08993 I

13

180

0.08139

0.08144

0,08144

0,08144

0.08144

14

200

0.07373

0,07364

0.07364

0,07364 ; 0.07364

Figure 10-13. Decreasing error in the Euler method by a simple predictor-corrector method, (folder 'Chapter 10 Examples', workbook 'ODE Examples', worksheet 'Predictor-Corrector Method')

Figure 10-13. Decreasing error in the Euler method by a simple predictor-corrector method, (folder 'Chapter 10 Examples', workbook 'ODE Examples', worksheet 'Predictor-Corrector Method')

The predictor formula was entered in column B. The first two values, shown in bold, are the starting values; the predictor formula, in cell B6, corresponds exactly to equation 10-28 and is

The corrector formula, in cell C6, corresponds exactly to equation 10-29 and =$B5+DX*(-k*$B5-k*B6)/2

The preceding formula is used iteratively. The formula (note the use of relative and mixed references) was Filled Right to perform the iterations. The formulas in row 5 were added to display the difference between a corrected value and the preceding one (for example, the formula in cell C5 is

=B11-C11

and shows how the corrector formula converges).

+1 0

Post a comment