a fourth order multirate runge-kutta method with errorcontrol

24
Noname manuscript No. (will be inserted by the editor) A Fourth Order Multirate Runge-Kutta Method with Error Control Pak-Wing Fok Received: date / Accepted: date Abstract To integrate large systems of ordinary differential equations (ODEs) with disparate timescales, we present a multirate method with error control that is based on embedded, explicit Runge-Kutta (RK) formulas. The order of accuracy of such methods depends on interpolating certain solution compo- nents with a polynomial of sufficiently high degree. By analyzing the method applied to a simple test equation, we show that fourth order Cash-Karp Runge- Kutta coupled with a third order interpolant yields a method that is fourth order overall. We demonstrate our method on three simple test problems and confirm fourth order convergence numerically for each one. Keywords Multirate · Runge-Kutta · Interpolation 1 Introduction In this paper, we present a fourth order multirate method with error con- trol, that is suited for integrating large systems of ordinary differential equa- tions (ODEs) with different time scales. The method is based on a Cash-Karp Runge-Kutta formula [15] with “latent” and “active” components coupled to- gether through a third order interpolant. A multirate method is one that can take different step sizes for different components of the solution [8]. When might such a need for different time steps arise? One situation where multirate methods may be more efficient than single rate ones is when a few of the components contain time singularities or move on short time scales. In this case, explicit single rate methods may use a small global time step for all the components, whereas a multirate one could employ small time steps just for singular/fast ones, therefore improving the speed and efficiency of solution. P.-W. Fok 412 Ewing Hall, University of Delaware, Newark, DE 19716, USA E-mail: [email protected]

Upload: others

Post on 02-Jun-2022

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

Noname manuscript No.(will be inserted by the editor)

A Fourth Order Multirate Runge-Kutta Method

with Error Control

Pak-Wing Fok

Received: date / Accepted: date

Abstract To integrate large systems of ordinary differential equations (ODEs)with disparate timescales, we present a multirate method with error controlthat is based on embedded, explicit Runge-Kutta (RK) formulas. The orderof accuracy of such methods depends on interpolating certain solution compo-nents with a polynomial of sufficiently high degree. By analyzing the methodapplied to a simple test equation, we show that fourth order Cash-Karp Runge-Kutta coupled with a third order interpolant yields a method that is fourthorder overall. We demonstrate our method on three simple test problems andconfirm fourth order convergence numerically for each one.

Keywords Multirate · Runge-Kutta · Interpolation

1 Introduction

In this paper, we present a fourth order multirate method with error con-trol, that is suited for integrating large systems of ordinary differential equa-tions (ODEs) with different time scales. The method is based on a Cash-KarpRunge-Kutta formula [15] with “latent” and “active” components coupled to-gether through a third order interpolant.

A multirate method is one that can take different step sizes for differentcomponents of the solution [8]. When might such a need for different time stepsarise? One situation where multirate methods may be more efficient than singlerate ones is when a few of the components contain time singularities or moveon short time scales. In this case, explicit single rate methods may use a smallglobal time step for all the components, whereas a multirate one could employsmall time steps just for singular/fast ones, therefore improving the speed andefficiency of solution.

P.-W. Fok412 Ewing Hall, University of Delaware, Newark, DE 19716, USAE-mail: [email protected]

Page 2: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

2 Pak-Wing Fok

Multirate methods typically partition the solution into “active” and “la-tent” components. The active (latent) components are integrated using “mi-cro” (“macro”) steps and the integrators used for the micro and macro stepsdo not have to be the same; however they must be coupled together. How thiscoupling can be achieved without reducing the method order is the topic ofmost investigations.

Early multirate schemes were studied by Andrus [1], and Gear andWells [8].Kvaerno and other authors [9,3,5] advocate the use of Multirate PartitionedRunge-Kutta formulas (MPRK). The distinguishing feature of this class ofmethods is that macro and micro integrators are coupled through the inter-mediate stage function evaluations. In [11], a multirate θ-method is studied;different values of θ give rise to forward Euler, backward Euler and Trapezoidalintegrators and different orders of interpolation were tried. It was found thatpoorly chosen interpolants could give rise to order reduction or solution in-stability. Multirate methods are often based on existing integrators. MultirateRunge-Kutta has already been discussed above. However, equipped with suit-able interpolants, researchers have successfully implemented multirate versionsof Rosenbrock [17,16], Adams [6] and BDF [19] methods. Further treatmentscan be found in [2,12–14,20], and the references therein.

The overall order of a multirate method usually depends on the accuracyof interpolation. Multirate methods have generally been restricted to low or-der due to difficulties in constructing suitable interpolants. However, in [17], afourth order Rosenbrock method was developed and in [4], extrapolated mul-tirate methods were studied. The advantage of the methods in [4] is that theyare easily parallelized. While the base methods are low order (either explicitor implicit Euler along with zeroth order interpolation), they can be used tofind very accurate numerical solutions via Richardson extrapolation.

Our method shares some similarities with the MPRK methods [9,3] inthe sense that Runge-Kutta methods are the base schemes used to advancethe solution. However, our method is 4th order whereas the authors in [9,3] investigate 2nd and 3rd order (embedded) methods. Furthermore, we useinterpolation to couple the micro and macro integrators. Because we can gen-erate dense output for the latent components, we can implement error controland adaptive time stepping in the micro integrator; the number of microstepswithin a macrostep is free to vary between macrosteps. Because we use a“slowest first” strategy, adaptive time stepping in the macro integrator is in-dependent of the micro integrator and can be implemented without additionalcomplications. Our method also shares similarities with [17] in that activecomponents are detected by examining the error of each component. However,in our method, automatic step size selection is simple to implemnt and followsstandard protocols [15].

In section 2.1 we give the details of the numerical method. In section 3, weinvestigate the order and stability of our method. We discuss the importantissue of interpolation in section 4 and validate our code and present our resultsin section 5. Finally, we summarize our findings with a conclusion in section6.

Page 3: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 3

k1 k2

k3

k4 k6 k5

l1*

l2*

l3*

l4*

l6*

l5*

tn tn+1tn+1/4 tn+2/4 tn+3/4

latent

yn+2/4

xn+2/4^

active

Fig. 1 Intermediate stage function evaluations and timeslabs in a Cash-Karp Runge-Kuttamultirate scheme withm = 4 and tn+1−tn = h. kj and l∗j denote intermediate stage functionevaluations within a macrostep and microstep respectively. Symbols with hat accents arecalcuated through interpolation.

2 Algorithm

2.1 Description of method

The goal of our method is to efficiently solve a system of ODEs

du

dt= f(t,u), 0 ≤ t ≤ T, (1)

subject to the initial condition u(t = 0) = u0 where f : (R × RN ) 7→ R

N ,u0,u ∈ R

N , t, T ∈ R+ and a small fraction of the solution components have

fast time scales. These components may or may not be stiff. A standard explicitintegrator would take small time steps for all components of the solution. Incontrast, we would like our multirate method to take small steps for the activecomponents and large steps for the remaining ones.

Therefore following [9,3], we assume that the ODE system can be parti-tioned into “latent” and “active” components:

x = f1(t,x,y), (latent) (2)

y = f2(t,x,y), (active). (3)

This partioning will, in general, be time-dependent, i.e. the set of latent andactive components can change from macrostep to macrostep. Our algorithmadvances the latent component x using a single macrostep of size h. It advancesthe active component y using the same timestepper. However, the ensuing de-scription of the algorithm and analysis assumes a fixed micro step size h/m.Because both latent and active components are advanced using embeddedRunge-Kutta, the extension to implement error control and adaptive timestep-ping, based on estimation of the local truncation error, is straightforward [15].

Page 4: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

4 Pak-Wing Fok

Below, the coefficients ai, bij , cj and cj are the Cash-Karp Runge-Kutta co-efficients; see Table 1.

1. Compute intermediate stage function evaluations for latent and active com-ponents, over a macrostep of size h:

ki = hf1

tn + aih,xn +i−1∑

j=1

bijkj ,yn +i−1∑

j=1

bijlj

, (4)

li = hf2

tn + aih,xn +i−1∑

j=1

bijkj ,yn +i−1∑

j=1

bijlj

, (5)

for i = 1, . . . , 6.2. Advance latent components:

xn+1 = xn +

6∑

i=1

ciki (fourth order). (6)

xn+1 = xn +

6∑

i=1

ciki (fifth order). (7)

Our method does not use local extrapolation, so eq. (6) advances the so-lution while (7) is used to calculate the corresponding error.

3. Interpolate the latent components through

xn+ `m

= xn +`k1

m+

1

2

(

`

m

)2 (

−8k1

3+

25k4

6−

3k5

2

)

+1

6

(

`

m

)3 (10k1

3−

25k4

3+ 5k5

)

. (8)

We will derive (8) in section 4.4. For each ` ∈ {0, 1, . . . ,m − 1}, compute the intermediate stage function

evaluations within a microstep (see Fig. 1):

k∗

i =h

mf1

tn+ `m

+aih

m, xn+ `

m+

i−1∑

j=1

bijk∗

j , yn+ `m

+

i−1∑

j=1

bijl∗

j

, (9)

l∗i =h

mf2

tn+ `m

+aih

m, xn+ `

m+

i−1∑

j=1

bijk∗

j , yn+ `m

+

i−1∑

j=1

bijl∗

j

,(10)

for i = 1, . . . , 6. Note that both k∗

i and l∗i also depend on ` but we omitthe dependence for notational simplicity.

Page 5: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 5

5. Advance the active components through

yn+(`+1)/m = yn+`/m +

6∑

i=1

cil∗

i , (11)

yn+(`+1)/m = yn+`/m +

6∑

i=1

cil∗

i . (12)

i ai bij ci ci

1 0 282527648

37378

2 15

15

1857548384

0

3 310

340

940

0 250621

4 35

310

− 910

65

1352555296

125594

5 1 − 1154

52

− 7027

3527

27714336

0

6 78

163155296

175512

57513824

44275110592

2534096

14

5121771

j = 1 2 3 4 5 6

Table 1 Table of coefficients for Cash-Karp embedded Runge-Kutta formula. The coeffi-cients ci and ci are used for fourth and fifth order formula respectively. See [15] for details.

Interpolation is done once in (9) and (10) to compute xn+`/m; then thek∗

i and l∗i can all be computed. While xn+`/m only needs to be evaluated forintegers ` ∈ {0, 1, . . . ,m−1}, the interpolant (8) is third order accurate for all` ∈ [0,m]. Since Runge-Kutta is a one-step method, once we have computed(xn+`/m, yn+`/m), we may compute yn+(`+1)/m through (11) – see Figure 1.For a single rate scheme with no interpolation, the integrators (11) and (12)are fourth and fifth order respectively (note that we use a different notationfor the coefficients in (11) and (12) than in [15]). Because the multirate schemeinterpolates using (8), eq. (12) actually reduces to fourth order. However, wewill see that the error can still be estimated from |yn+(`+1)/m − yn+(`+1)/m|.When implementing our algorithm in practice we specialize to locally cou-pled systems ODE systems so that bookkeeping and selection of interpolatedcomponents is simplified.

We now discuss some technical details of our method.

Dynamic Partioning: The partitioning into latent and active compo-nents is done by estimating the local truncation error (LTE) for each compo-nent of the solution. Components whose errors are larger than δ×(maximum error)(where δ � 1) are flagged as active and are corrected through a second in-tegration using the micro integrator (see below). When δ = 1, there are no

Page 6: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

6 Pak-Wing Fok

active components and our method effectively reduces to a single-rate method.The remaining unflagged components are classified as latent. The ‘flag’ vector(consisting of ones (active) and zeros (latent)) is searched to find boundaryindices r and s. Starting from the first entry, a linear search is performed onthe flag vector until a 1 is first encountered; the corresponding index is la-belled r. Likewise, starting from the final entry, a linear search is performedin reverse until a 1 is first encountered; the corresponding index is labelled s.Components r to s constitute the “active region.” There may be some latentcomponents in an active region and these are still included in the micro inte-gration. Our code assumes the presence of a single active region but can beeasily modified to detect multiple zones of activity.

Macro time stepping: After taking a trial macrostep and flagging the ac-tive components, the algorithm checks if the unflagged errors are smaller thana preset tolerance. If they are, the trial step is successful and the macrostepsize is scaled up according to the largest unflagged error. If there are latentcomponents which have error larger than the preset tolerance, the trial stepis unsuccessful and has to be retaken. In this case the macrostep size is scaleddown according to the largest unflagged error.

Micro time stepping: Although the method is described above for mmicrosteps each of size h/m, in practice we implement (4)-(12) with errorcontrol/adaptive time-stepping. The number of microsteps in each macrostepcan vary from macrostep to macrostep and the microstep size can also varywithin a macrostep. The micro step size is chosen so that the accumulatederrors from the m microsteps is less than a preset tolerance and the errorresulting from taking one macrostep is also controlled to be less than thistolerance: whether a single macro step, or m microsteps are taken, the errorcommitted should be approximately the same.

A flowchart summary of our method is given in Figure 2.

3 Consistency and Order

3.1 Analysis of Single-Rate Method

We first analyze a single-rate method to introduce notation that will be usedto study the multirate method in later sections. Suppose we apply a singlerate Cash-Karp scheme to the pair of ODEs

u+Mu = 0, M =

(

m11 m12

m21 m22

)

, (13)

where u = (x(t), y(t))T . Let Kj = (kj , `j)T ∈ R

2 be the vector of intermediatestage function evaluations. Suppose we wish to advance from tn to tn+1. Then

Ki = −hM

un +

6∑

j=1

bijKj

,

Page 7: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 7

Take time step dt.

Find errors ei

Flag errors eis.t. ei > max(ei)*

�Find boundary indices

r and s

Let e* = max(unflagged errors)

Is |e*/TOL| < 1?

Perform micro-integration

on components yr,...,ys

dt = S*dt*max(5,|TOL/e*|1/5)

dt=S*dt*min(0.2,|TOL/e*|1/5)

No: failed step

Yes: successful step

from t to t+dt

Fig. 2 Flowchart description of adaptive-time stepping multirate method for the ODEsystem y = f(t, y). The time step tolerance is TOL and δ � 1 and 0 < S < 1 are requiredconstants. r and s define the boundary components of the active region.

where the coefficients bij are given by Table 1. The two components of thisequation are

kj = −hm11xn − hm11

6∑

j=1

bijkj − hm12yn − hm12

6∑

j=1

bij`j,

`j = −hm21xn − hm21

6∑

j=1

bijkj − hm22yn − hm22

6∑

j=1

bij`j.

Setting k = (k1, k2, . . . , k6)T , l = (`1, `2, . . . , `6)

T , 1 = (1, 1, 1, 1, 1, 1)T and[B]ij = bij , i, j = 1, . . . , 6, we have

(I +m11hB)k+m12hBl = −hm11xn1− hm12yn1,

m21hBk+ (I +m22hB)l = −hm21xn1− hm22yn1.

Page 8: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

8 Pak-Wing Fok

Solving for k and l, we have

k = N−11 (u1xn + u2yn), (14)

l = N−12 (v1xn + v2yn), (15)

where

N1(h) = I + hm11B − h2m12m21B(I +m22hB)−1B,

N2(h) = I + hm22B − h2m12m21B(I +m11hB)−1B,

u1(h) = (−hm11I + h2m12m21B(I +m22hB)−1)1,

u2(h) = (−hm12I + h2m12m22B(I +m22hB)−1)1,

v1(h) = (−hm21I + h2m21m11B(I +m11hB)−1)1,

v2(h) = (−hm22I + h2m21m12B(I +m11hB)−1)1,

are functions of the step size. In the following sections, we will use the microstep size h/m in the arguments of N2, v1 and v2.

3.2 Order Calculation

We now analyze the multirate scheme (4)-(12). The latent component x isadvanced via a macrostep:

xn+1 = xn + cTk(h), (fourth order)

= xn + cTN−11 (h)(xnu1(h) + ynu2(h)), (16)

xn+1 = xn + cTk(h), (fifth order)

= xn + cTN−11 (h)(xnu1(h) + ynu2(h)). (17)

Intermediate values are interpolated so that

xn+χ = xn + χk1 +χ2

2

(

−8

3k1 +

25

6k4 −

3

2k5

)

+χ3

6

(

10

3k1 −

25

3k4 + 5k5

)

,

= xn +

[

χqT1 +

χ2

2qT2 +

χ3

6qT3

]

k, (18)

(see eq. (8)), where

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

q2 = (−8/3, 0, 0, 25/6,−3/2, 0)T ,

q3 = (10/3, 0, 0,−25/3, 5, 0)T .

Now define

µ1 = cTN−12 (h/m)v1(h/m), µ1 = cTN−1

2 (h/m)v1(h/m),

µ2 = 1 + cTN−12 (h/m)v2(h/m), µ2 = 1 + cTN−1

2 (h/m)v2(h/m).

Page 9: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 9

If x(tn+i/m) was computed by timestepping, the active component y wouldadvance through the embedded formulas

yn+ i+1

m= yn+ i

m+ cT l(h/m) = µ2yn+ i

m+ µ1xn+ i

m, (19)

yn+ i+1

m= yn+ i

m+ cT l(h/m) = µ2yn+ i

m+ µ1xn+ i

m. (20)

However, in our scheme, xn+i/m is approximated through interpolation, so wehave instead

yn+ i+1

m= µ2yn+ i

m+ µ1xn+ i

m, (21)

yn+ i+1

m= µ2yn+ i

m+ µ1xn+ i

m. (22)

Using (18), the original ODEs (13) and Taylor series xn =∑

j=0 x(j)n+i/m

(

− ihm

)j,

yn =∑

j=0(−1)jy(j)n+i/m

(

− ihm

)j, we find that

yn+ i+1

m= eT2

[

I −hM

m+

1

2

(

hM

m

)2

−1

6

(

hM

m

)3

+1

24

(

hM

m

)4]

un+ im

+gTi un+ i

m

(

h

m

)5

+O(h/m)6,

= yn+ im− yn+ i

m

h

m+

yn+ im

2

(

h

m

)2

...yn+ i

m

6

(

h

m

)3

+y(4)

n+ im

24

(

h

m

)4

+gTi un+ i

m

(

h

m

)5

+O(h/m)6.

Similarly,

yn+ i+1

m= eT2

[

I −hM

m+

1

2

(

hM

m

)2

−1

6

(

hM

m

)3

+1

24

(

hM

m

)4]

un+ im

+gTi un+ i

m

(

h

m

)5

+O(h/m)6, (23)

= yn+ im− yn+ i

m

h

m+

yn+ im

2

(

h

m

)2

...yn+ i

m

6

(

h

m

)3

+y(4)

n+ im

24

(

h

m

)4

+gTi un+ i

m

(

h

m

)5

+O(h/m)6, (24)

for different vectors gi and gi and e2 = (0, 1)T . The expressions for gi and gi

are lengthy and are therefore omitted. However we show below that gi 6= gi

by considering the accumulated truncation error after m steps.We see that while eqs. (19) and (20) are normally fourth and fifth order

respectively in a single rate scheme, with the interpolation, (21) and (22) areboth fourth order. Nevertheless, the magnitude of the error at O(h/m)5 canstill be be estimated by |yn+(i+1)/m−yn+(i+1)/m| (recall that step doubling can

Page 10: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

10 Pak-Wing Fok

also be used to estimate the local truncation error and the numerical solutionafter two half-steps and the solution with a single whole-step have the sameorder of error).

We now study the truncation error after a compound step, consisting of mmicro steps in yn+i/m and a single macro step in xn. From (21), we have

yn+1 = µm2 yn + µ1

m∑

j=1

µj−12 xn+m−j

m,

=[

µm2 + µ1d

TN−11 (h)u2(h)

]

yn +

µ1

m∑

j=1

µj−12 + µ1d

TN−11 (h)u1(h)

xn,

upon using (18), where

d = q1

m−1∑

j=0

(

j

m

)

µm−j−12 +

q2

2

m−1∑

j=0

(

j

m

)2

µm−j−12 +

q3

6

m−1∑

j=0

(

j

m

)3

µm−j−12 .

Therefore un+1 and un are related through

un+1 = S(hM)un, (25)

where

S11 = 1 + cTN−11 (h)u1(h), (26)

S12 = cTN−11 (h)u2(h), (27)

S21 = µ1

(

1− µm2

1− µ2

)

+ µ1dTN−1

1 (h)u1(h), (28)

S22 = µm2 + µ1d

TN−11 (h)u2(h). (29)

Applying the same analysis to eq. (22), we have

un+1 = S(hM)un, (30)

where the entries of S are identical to (26)-(29) but with µ1 → µ1, µ2 → µ2

and c → c. By expanding Sij and Sij in Taylor series for small h, one canshow that

S(hM) = I − hM +(hM)2

2−

(hM)3

6+

(hM)4

24+ Eh5 +O(h6), (31)

S(hM) = I − hM +(hM)2

2−

(hM)3

6+

(hM)4

24+ Eh5 +O(h6), (32)

where the matrices E and E are functions of M and given in appendix A.1.Since E21 6= E21 and E22 6= E22, it is evident that gi 6= gi in (23) and (24).

Page 11: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 11

Finally, since (−M)ju = u(j)(t) for j ≥ 1, eqs. (25) and (30) along witheqs. (31) and (32) imply

u(tn + h) = u(tn) + hu′(tn) +h2u′′(tn)

2+

h3u′′′(tn)

6+

h4u(4)(tn)

24+ O(h5),

u(tn + h) = u(tn) + hu′(tn) +h2u′′(tn)

2+

h3u′′′(tn)

6+

h4u(4)(tn)

24+ O(h5).

We have shown that both embedded formulas for the micro-timestep integra-tion are fourth order, when applied to the simple test equation (13). Becauseof the cubic interpolant (18), the fifth order formula for the micro timestep-per reduces to fourth order. However, the entries E11 and E12 in (32) satisfy−eT1 M

5/5! = (E11, E12) where e1 = (1, 0)T so the macro timestepper in (17)is fifth order. We also see from (31) and (32) that the region of absolute stabil-ity for the compound step will be very similar to that corresponding to fourthorder single-rate Runge-Kutta.

3.3 Absolute Stability of Multirate Steps

Now consider the special case where M =

[

λ1 0λ1 − λ2 λ2

]

. The resulting so-

lutions for x(t) and y(t) are x(t) = c1 exp(−λ1t) and y(t) = c2 exp(−λ1t) +c3 exp(−λ2t). When λ1, λ2 > 0 and λ2 � λ1 = O(1), x(t) evolves on a O(1)timescale but y(t) contains a λ−1

2 (fast) timescale. If a single-rate explicitmethod is used, absolute stability and the resulting stiffness of y requires thatthe global time step be scaled according to the fast time scale. However, wewill show that with our multirate method, we may take large steps for x(t),small steps for y(t) and still satisfy absolute stability requirements. Consideradvancing xn with a single macrostep and yn with a single microstep. Then

xn+1 =(

1 + cTN−11 u1

)

xn + cTN−11 u2yn,

yn+1/m = µ1xn + µ2yn,

or(

xn+1

yn+1/m

)

= R

(

xn

yn

)

=

[

σ(hλ1) 0

σ1

(

hλ1

m , hλ2

m

)

σ(hλ2/m)

](

xn

yn

)

where

σ(z) = 1− zcT (I + zB)−11, (33)

σ1(z1, z2) = (z2 − z1) cT (I + z2B)−1(I − z1B(I + z1B)−1)1.

The eigenvalues of R are σ(hλ1) and σ(hλ2/m). Both eigenvalues must be< 1 for the integrator to be absolutely stable. Suppose we employ a singlerate method with m = 1. Then for absolute stability, we must choose h smallenough so that |σ(hλ2)| < 1: see Fig. 3. The fast time scale in y demands asmall global time step. However with the multirate scheme, we may choosem = O(λ2) so that a large step size h is used for x(t), a small step size h/mis used for y(t) and |σ(hλ2/m)| < 1 is still satisfied.

Page 12: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

12 Pak-Wing Fok

0 1 2 3 4 50

0.5

1

1.5

2

2.5

3

3.5

4

z

σ(z)

Fig. 3 Stability function σ(z) as given by (33); B and c are given in Table 2.1.

4 Interpolation

The key to making a multirate method high order lies in the ability to generatedense output from the latent components with high accuracy. One way to gen-erate dense output is to use interpolation.1 For some integrators it is obvioushow to derive an interpolant that is consistent with the underlying integrator.The Backward Differentiation Formulas (BDF), which use extrapolation fromprior time steps to advance the solution in time, are an example of this. Forother integrators, such as Runge-Kutta schemes, constructing the interpolantis less obvious and this is our focus here. Note that we need to generate in-terpolants during run time using only the function evaluations within eachtime step. The extra constraint of generating the interpolants during run timeadds a complication to the “traditional” problem of interpolating the solutionafter completing the integration [7,10]. Because we are constructing these in-terpolants during run time, we are at liberty to use the intermediate functionevalulations inherent in the application of Runge-Kutta: this information isnot usually available in the traditional interpolation problem.

We hypothesize that when the micro integrator is explicit, interpolating thelatent components using an (n− 1) order interpolant coupled to an integratorwhich is order n gives a multirate method that is order n overall. Certainly,we found that this is the case for the Cash-Karp method discussed in thispaper (n = 4). In appendix A.2, we also prove that Heun’s method (secondorder Runge Kutta) together with linear interpolation gives a second ordermultirate method.

1 We use the word “interpolation” to describe a method to construct a smooth approxima-tion to the numerical solution between two times tn and tn+1. However, the function that wederive does have to not pass through the numerical solution at tn+1. Hence strictly speak-ing, it is not an interpolant. Nevertheless, for convenience, we refer to these approximatingfunctions as “interpolants”.

Page 13: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 13

In [11], the authors found that using linear interpolation reduced the orderof a multirate (implicit) trapezoidal rule. However, the active components werefixed a priori, and so were the interpolated components. We think that thechoice of which components to interpolate is important. We advocate thatinterpolation should be done for solution components that are “sufficientlyslow,” though it is not clear how to quantify this statement at present. Whatis clear is that the interpolant (8) (or any high order interpolant) could stillgive large interpolation errors that would contaminate the accuracy of themicro integrator if x(t) had large derivatives.

4.1 Derivation of interpolants

We now illustrate how interpolants can be constructed during run-time forthe Cash-Karp Runge-Kutta formula [15]. Suppose we have the simple scalarODE y = f(t, y). Then to construct a third order interpolant, note that for0 ≤ χ ≤ 1,

y(tn + χh) = yn + χhy′n +(χh)2

2y′′n +

(χh)3

6y′′′n +O(h4). (34)

By repeatedly differentiating the ODE y′n = f(tn, yn), we have

y′n = G0

y′′n = G1

y′′′n = G2 +G3,(35)

where G0 = fn, G1 = fnf′

n + fn, G2 = f2nf

′′

n + 2fnf′

n + fn and G3 = fnf′

n2+

f2nf

′′

n + f ′

nfn. Our convention is to use a dash for a y-derivative and a dot for

a t-derivative: f ′

n = ∂f(tn,yn)∂y and fn = ∂f(tn,yn)

∂t . Therefore, (34) becomes

y(tn + χh) = yn + χhG0 +(χh)2

2G1 +

(χh)3

6(G2 +G3) +O(h4). (36)

Using definitions ki = hf(tn + aiki, yn +∑i−1

j=1 bijkj) and expanding in Taylorseries, we have

k1 = hG0,

k2 = hG0 +h2

5G1 +

h3

50G2 +O(h4),

k3 = hG0 +3h2

10G1 +

9h4

200(G2 +G3) +O(h4),

k4 = hG0 +3h2

5G1 +

9h3

50(G2 +G3) +O(h4),

k5 = hG0 + h2G1 +h3

2(G2 +G3) +O(h4),

k6 = hG0 +7h2

8G1 +

49h3

128(G2 +G3) +O(h4).

(37)

Page 14: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

14 Pak-Wing Fok

Taking only the equations for k1, k4 and k5, we form a linear system in termsof G0, G1 and G2 +G3:

h 0 0

h 3h2

59h3

50

h h2 h3

2

G0

G1

G2 +G3

=

k1k4k5

. (38)

Upon solving for G0, G1 and G2 +G3 and substituting into (36), we find

y(tn + χh) = yn + χk1 +χ2

2

(

−8

3k1 +

25

6k4 −

3

2k5

)

+χ3

6

(

10

3k1 −

25

3k4 + 5k5

)

+O(h4). (39)

A similar calculation can be performed for classical 4th order Runge-Kuttaformulas and other embedded formulas (e.g. Dormand-Prince) to generate cu-bic interpolants. This method fails when quartic (or higher order) interpolantsare required; for reasons unknown to us at the moment, the 4× 4 analogue to(38) is singular for all the RK formulas that we analyzed (Dormand-Prince,Cash-Karp, Fehlberg). However, quartic and higher order interpolants can beconstructed if one includes more intermediate stage function evaluations in theRunge-Kutta formula [18].

5 Validation and Results

We now test our method on some large ODE systems that arise from a method-of-lines discretization of some common physical PDEs. Our examples also fol-low the sample problems that were explored in [11,17]. We use these simpletest problems as a way to illustrate proof-of-principle and demonstrate 4thorder convergence of the method.

5.1 Example 1: Transport Equation

The problem considered is a method-of-lines discretization of

∂y

∂t+ U

∂y

∂x= 0, (40)

y(x, 0) = exp(−x2), (41)

on the infinite domain −∞ < x < ∞. For U > 0 we use an upwind discretiza-tion

y1(t) = 0, (42)

yi(t) = −U

∆x(yi − yi−1), i = 2, 3, . . . , N, (43)

yi(0) = exp(−x2i ), (44)

Page 15: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 15

where xi = −L + (i − 1)∆x, ∆x = 2L/(N − 1) and L � 1. The numericaldomain for eqs. (42)-(44) is [−L,L]. Equations (42) and (43) together with theinitial condition (44) constitute N locally coupled linear ordinary differentialequations.

Figure 4 shows the result of applying our multirate integration methodto (42)- (44). The method flags components of the solution that move on afast time scale, corresponding to regions in space which are perturbed by thetravelling wave. The upwind discretization has a truncation error that corre-sponds to a diffusion term which is responsible for the spreading of the initialcondition. This diffusion also ensures that the number of flagged componentsincreases as time progresses.

−20 −10 0 10 200

0.5

1t = 0.01, r = 145, s = 262, error = 2.8e−014, numsteps=1

0 100 200 300 400nz = 98

0 100 200 300 400nz = 157

−20 −10 0 10 200

0.5

1t = 6.00, r = 160, s = 348, error = 1.4e−006, numsteps=9

−20 −10 0 10 200

0.5

1t = 3.28, r = 159, s = 300, error = 1.0e−006, numsteps=6

0 100 200 300 400nz = 122

−20 −10 0 10 200

0.5

1t = 4.28, r = 147, s = 316, error = 1.1e−006, numsteps=7

0 100 200 300 400nz = 138

Fig. 4 Multirate integration of discretized transport equation (42)-(44). Indices of flaggedcomponents are indicated on a lattice below each profile. Range of microintegration incomponent space is given by indices r and s. numsteps is the number of macrosteps taken;nz is the number of flagged components. Parameters were L = 20, N = 401, ∆x = 0.1,

δ = 10−7, U = 1. Initial condition was a discretization of e−x2

.

5.2 Example 2: Reaction-Diffusion equation

We now consider a discretization of the reaction-diffusion system

∂y

∂t= ε

∂2y

∂x2+ γy2(1 − y), (45)

y(x, 0) = (1 + exp[λ(x− 1)])−1

, λ =1

2

2γ/ε, (46)

Page 16: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

16 Pak-Wing Fok

which admits a travelling wave solution. A centered-in-space discretizationgives

y1(t) = 0, (47)

yi(t) =ε

∆x2(yi+1 − 2yi + yi−1) + γy2i (1− yi), i = 2, 3, . . . , N − 1,(48)

yN (t) = 0, (49)

yi(0) = (1 + exp[λ(xi − 1)])−1

, (50)

with xi = (i − 1)∆x, ∆x = L/(N − 1) and L � 1. The numerical domain ofsolution is [0, L].

Figure 5 shows the results of applying our multirate integration methodto the nonlinear ODE system (47)-(50). As with example 1, because the dis-turbance is localized in space, our method successfully flags the components ithat have large yi while leaving the remaining components unflagged.

0 0.5 1 1.5 2 2.5 3 3.50

0.5

1

t = 0.06, r = 44, s = 182, error = 3.4e−009, numsteps=2

0 100 200 300 400nz = 107

0 0.5 1 1.5 2 2.5 3 3.50

0.5

1

t = 0.21, r = 43, s = 177, error = 4.4e−009, numsteps=6

0 100 200 300 400nz = 104

0 0.5 1 1.5 2 2.5 3 3.50

0.5

1

t = 0.39, r = 43, s = 211, error = 6.0e−009, numsteps=14

0 100 200 300 400nz = 119

0 0.5 1 1.5 2 2.5 3 3.50

0.5

1

t = 0.50, r = 45, s = 197, error = 6.6e−009, numsteps=17

0 100 200 300 400nz = 92

Fig. 5 Multirate integration of reaction-diffusion equation (47)-(49). Indices of flagged com-ponents are indicated on a lattice below each profile. Range of microintegration in componentspace is given by indices r and s. numsteps is the number of macrosteps taken; nz is thenumber of flagged components. Parameters were L = 3.5, N = 401, ∆x = 8.75 × 10−3,δ = 10−12, ε = 0.01, γ = 100. Initial condition was a discretization of (1 + eλ(x−1))−1 with

λ = 0.5√

2γ/ε.

Page 17: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 17

5.3 Example 3: Advection-Diffusion equation

As a third example, we consider a discretization of a forced advection-diffusionequation

∂y

∂t+ a

∂y

∂x= d

∂2y

∂x2− cy + g(x, t), (51)

g(x, t) = 1000 [cos(πx/2)]200

sin(πt), (52)

y(x, 0) = 0, (53)

on −1 ≤ x ≤ 1. We use a fourth order spatial discretization that results in abroader stencil and a pentadiagonal system of ODEs:

y1(t) = 0, (54)

y2(t) = 0, (55)

yi(t) = −a(−yi+2 + 8yi+1 − 8yi−1 + yi−2)

12∆x+

d(−yi+2 + 16yi+1 − 30yi + 16yi−1 − yi−2)

12∆x2− cyi + g(xi, t), (56)

i = 3, 4, . . . , N − 2.

yN−1(t) = 0, (57)

yN (t) = 0, (58)

yi(0) = 0, i = 1, 2, . . . , N, (59)

with xi = −1 + (i − 1)/∆x and ∆x = 2/(N − 1). Figure 6 shows the resultsof our method applied to the system (54)-(59). Because the original PDE thatproduced the discretization is diffusive, qualitatively, the solution does notremain localized in space and the number of flagged components increasesquickly in time.

Next, we performed a convergence study to demonstrate that cubic inter-polants coupling the macro and micro integrators together render our multi-rate method globally fourth order. Because our method is adaptive in time, wemonitor the average microstep size over the course of an integration and recordthe corresponding error at the final time. The “exact” solution is found an-alytically in the transport equation and is computed using MATLAB’s ODEsolvers, set to a suitably stringent tolerance, for the reaction-diffusion andadvection-diffusion equations. Figure 7 demonstrates that we do indeed achievefourth order convergence, in terms of the infinity norm of the error.

Finally, it is instructive to compare single rate and multirate methods.Ideally, for a given macrostep tolerance, we would like our multirate methodto take fewer macrosteps than a single rate method, but incur roughly thesame error at the end of the integration (in a single rate method, the normaltime step is considered the “macrostep” and there are no microsteps). Wecompare the number of steps taken and the errors incurred for all three testproblems in Table 2.

Page 18: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

18 Pak-Wing Fok

−1 −0.5 0 0.5 1

0

2

4

6t = 0.01, r = 120, s = 284, error = 3.5e−009, numsteps=1

0 100 200 300 400nz = 145

−1 −0.5 0 0.5 1

0

2

4

6t = 0.06, r = 127, s = 303, error = 1.6e−008, numsteps=2

0 100 200 300 400nz = 157

−1 −0.5 0 0.5 1

0

2

4

6t = 0.28, r = 106, s = 325, error = 9.3e−005, numsteps=3

0 100 200 300 400nz = 200

−1 −0.5 0 0.5 1

0

2

4

6t = 0.80, r = 130, s = 347, error = 1.9e−005, numsteps=4

0 100 200 300 400nz = 186

Fig. 6 Multirate integration of advection-diffusion equation (54)-(59). Indices of flaggedcomponents are indicated on a lattice below each profile. Range of microintegration incomponent space is given by indices r and s. numsteps is the number of macrosteps taken;nz is the number of flagged components. Parameters were L = 1, N = 401, ∆x = 5× 10−3,δ = 10−12, a = 5, d = 0.01, c = 100. Initial condition was yi(0) = 0 for 1 ≤ i ≤ N .

While our multirate method always takes fewer macrosteps than the singlerate method, the results are somewhat mixed for the error. For the transportequation, the errors in the single rate and multirate methods are comparableand at the same time, there is a large reduction in the number of macrostepstaken. For the reaction-diffusion equation, the error incurred by the multi-rate method is much smaller which implies that too many steps are taken bythe microintegrator (about 351/17 ≈ 20 microsteps per macrostep). In theadvection-diffusion problem, again the micro-integrator is taking many smallsteps (about 120 per macrostep) but this time the resulting error is larger thanthat of the single rate method. We think that these inaccuracies stem fromthe diffusive nature of eq. (51). Unlike examples 1 and 2, the latent solutioncomponents may have large time derivatives, rendering the interpolation in-accurate. Methods need to be developed in order to choose boundary indicesr and s (see Fig. 2) so that the interpolation error is suitably small. Furtherinvestigations will center on developing error estimation techniques for theinterpolants.

6 Conclusions

In this paper, we presented a fourth order multirate method. The method isbased on embedded Runge-Kutta formulas and is explicit in time. The mainstrength of the method is its high order; we showed in this paper that only third

Page 19: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 19

10−4

10−3

10−2

10−1

10−12

10−10

10−8

10−6

10−4

10−2

average ∆ tmicro

Infin

ity N

orm

Err

or

TransportReaction−DiffusionAdvection−Diffusion

Fig. 7 Convergence of adaptive time stepping multirate method, applied to equations (42)-(44), (47)-(50) and (54)-(59). Solid lines have slope 4.

Equation # macrosteps (error) # macrosteps/# microsteps (error)

Transport 32 (1.1× 10−5) 9/60 (1.4× 10−6)Reaction-Diffusion 95 (1.0× 10−6) 17/351 (6.6× 10−9)Advection-Diffusion 411 (1.3× 10−7) 4/480 (1.9 × 10−5)

Table 2 Comparison of single rate (second column) and multirate (third column) integra-tion methods in terms of number of steps taken and error incurred. Error was measuredusing the infinity norm.

order interpolants are needed for a fourth order solver. Our algorithm generatesthese interpolants by using the intermediate stage function evaluations of anembedded Runge-Kutta (RK) formula. We tested our method on three simpleproblems and performed a convergence study to show that the method isindeed fourth order.

We see two main extensions to this work. The first is to understand froma theoretical standpoint why our method is effective when the solutions arewave-like, but not so competitive when they are diffusive. From the PDE pointof view, disturbances in a diffusive equation tend to spread over time. There-fore the size of the active region r− s+1 quickly grows making the multiratemethod less and less efficient over time (in the extreme case when r = 1 ands = N , all components are being integrated twice). However, we do not solvethe PDE directly; rather we solve the ODEs resulting from its discretization.Therefore we need to better understand the behavior of solutions of the dis-cretized equations in index-space.

The second is to extend our paradigm to other Runge-Kutta formulas.How and whether suitable interpolants can be built remains a critical issue.For example, for a general nth order RK formula, we do not know if it is always

Page 20: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

20 Pak-Wing Fok

possible to construct interpolants that have order (n−1) during run time. Theinterpolant used in our method, eq. (8) and derived in section 4.1, does not usethe available data point (tn+1, yn+1). It is derived from a Taylor series at tnand its order stems from derivative information at tn which in turn comes fromintermediate stage function evaluations. Hermite interpolation would seem tobe a natural way to easily increase the order of eq. (39). The control of in-terpolation errors and how to to choose the interpolating components shouldremain active areas of research within the field of multirate integrators.

In summary, this work contributes to the currently growing body of re-search in multirate methods. We hope that the strategies presented in thispaper can be extended to the numerical solution of other physical problemsand be used to improve the efficiency and accuracy of other multirate algo-rithms.

Acknowledgements: The author would like to thank R. R. Rosales whostimulated the author’s interest in multirate methods and proposed the methodto derive the cubic interpolants.

Page 21: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 21

A Appendix

A.1 Error terms

Here we give the forms of the error terms in eqs. (31) and (32).

E11 = −10517

1228800(m5

11 + 4m311m12m21 + 3m11m

212m

221 + 3m2

11m12m21m22

+2m212m

221m22 + 2m11m12m21m

222 +m12m21m

222),

E12 = −10517

1228800(m4

11m12 + 3m211m

212m21 +m3

12m221 +m3

11m12m22 + 4m11m212m21m22

+m211m12m

222 + 3m2

12m21m222 +m11m12m

322 +m12m

422),

E21 =1

314572800(−4070677m4

11m21 − 12212031m211m12m

221 − 4070677m2

12m321

−2621717m311m21m22 − 13384788m11m12m

221m22 − 2621717m2

11m21m222

−9314111m12m221m

222 − 2621717m11m21m

322 − 2621717m21m

422,

E22 =1

314572800(−4070677m3

11m12m21 − 8141354m11m212m

221 − 6692394m2

11m12m21m22

−10763071m212m

221m22 − 9314111m11m12m21m

222 − 11935828m12m21m

322

−2621717m522),

E11 =1

120(−m5

11 − 4m311m12m21 − 3m11m

212m

221 − 3m2

11m12m21m22

−2m212m

221m22 − 2m11m12m21m

222 −m12m21m

322),

E12 =1

120(−m4

11m12 − 3m211m

212m21 −m3

12m221 −m3

11m12m22

−4m11m212m21m22 −m2

11m12m222 − 3m2

12m21m222

−m11m12m322 −m12m

422,

E21 =1

61440(−795m4

11m21 − 2385m211m12m

221 − 795m2

12m321

−512m311m21m22 − 2614m11m12m

221m22 − 512m2

11m21m222 −

1819m12m221m

222 − 512m11m21m

322 − 512m21m

422),

E22 =1

61440(−795m3

11m12m21 − 1590m11m212m

221 − 1307m2

11m12m21m22

−2102m212m

221m22 − 1819m11m12m21m

222 − 2331m12m21m

322 − 512m5

22).

A.2 Order calculation for Multirate RK2

Lemma 1 Suppose the RK2 multirate method is applied to the pair of autonomous ODEsx = f1(x, y), y = f2(x, y) (where x(t) is the latent component and y(t) is the active compo-nent) to advance from timestep tn to tn+1:

x∗

n+1 = xn + hf1(xn, yn),

y∗n+1 = yn + hf2(xn, yn),

xn+1 = xn +h

2

[

f1(xn, yn) + f1(x∗

n+1, y∗

n+1)]

.

xn+χ = (1 − χ)xn + χxn+1, 0 ≤ χ ≤ 1,

y∗n+ i+1

m

= yn+ im

+h

mf2(

xn+ im, yn+ i

m

)

,

yn+ i+1

m

= yn+ im

+h

2m

[

f2(

xn+ im, yn+ i

m

)

+ f2(

xn+(i+1)/m, y∗n+(i+1)/m

)]

,

Page 22: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

22 Pak-Wing Fok

and 0 ≤ i ≤ m−1. Assume that fj,∂fj∂x

,∂2fj∂x2 ,

∂fj∂y

,∂2fj∂y2 and

∂2fj∂x∂y

, j = 1, 2, are continuous

for all tn ≤ t ≤ tn+1. Then the local truncation in xn+1 after a single macrostep is O(h3)and the local truncation error in yn+1 after m microsteps of size h/m error is also O(h3).

Proof Since fj and its derivatives are continuous on [tn, tn+1], x(t), x(t), y(t) and y(t) areall continuous on the same interval. Let

C1 = maxt∈[tn,tn+1]

∂f2

∂xx

, (60)

C2 = max

(

maxt∈[tn,tn+1]

x2

4

∂2f2

∂x2

, maxt∈[tn,tn+1]

y2

4

∂2f2

∂y2

, maxt∈[tn,tn+1]

xy

2

∂2f2

∂x∂y

)

. (61)

Let us analyze the multirate method step by step.

1. Advance latent components first:

x∗

n+1 = xn + hf1(xn, yn),

y∗n+1 = yn + hf2(xn, yn),

xn+1 = xn +h

2

[

f1(xn, yn) + f1(x∗

n+1, y∗

n+1)]

.

= xn + hxn +h2xn

2+ O(h3).

Therefore the local truncation error in xn+1 is O(h3).

2. Perform linear interpolation:

xn+χ = (1 − χ)xn + χxn+1, 0 ≤ χ ≤ 1, (62)

⇒ xn+(i+1)/m =

(

1−i+ 1

m

)

xn +i+ 1

mxn+1, (63)

= xn + xn(i+ 1)h

m+ xn

(i + 1)h2

2m+O(h3). (64)

But

xn = x(n+ im

)− im

= xn+ im

− xn+ im

ih

m+

xn+ im

2

(

ih

m

)2

+ O

(

ih

m

)3

, (65)

xn = x(n+ im

)− im

= xn+ im

− xn+ im

ih

m+

...xn+ i

m

2

(

ih

m

)2

+O

(

ih

m

)3

, (66)

xn = x(n+ i

m)− i

m= x

n+ im

−...xn+ i

m

ih

m+

....x

n+ im

2

(

ih

m

)2

+ O

(

ih

m

)3

, (67)

so substituting (65), (66) and (67) into (64), we have

xn+ i+1

m

= xn+ im

+ xn+ im

(

h

m

)

+xn+ im

[

i2

2m2−

i(i+ 1)

m2+

i+ 1

2m

]

h2 +O(h3), (68)

and

xn+ im

= xn+ im

+ xn+i/m

[

i

2m−

i2

2m2

]

h2 +O(h3).

Page 23: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

A Fourth Order Multirate Runge-Kutta Method with Error Control 23

3. Advance active components. For i = 0, 1, . . . ,m− 1, let

y∗n+ i+1

m

= yn+ i

m+

h

mf2(

xn+ i

m, y

n+ im

)

,

= yn+ i

m+

(

h

m

)

yn+ i

m,

yn+ i+1

m

= yn+ im

+h

2m

[

f2(

xn+ im, yn+ i

m

)

+ f2(

xn+(i+1)/m, y∗n+(i+1)/m

)]

,

= yn+ i

m+

h

2m

[

f2(

xn+ i

m+ ξ′1, yn+ i

m

)

+ f2(

xn+ im

+ ξ2 + ξ′2, yn+ im

+ ξ3)]

, (69)

where

ξ2 =xn+ i

mh

m,

ξ3 =yn+ i

mh

m,

ξ′1 = xn+i/m

[

i

2m−

i2

2m2

]

h2 + O(h3),

ξ′2 = xn+ im

[

i2

2m2−

i(i+ 1)

m2+

i+ 1

2m

]

h2.

Note that ξ2,3 = O(h) but ξ′1,2 = O(h2). Expanding (69) in Taylor series, we find that

yn+(i+1)/m = yn+ im

+ yn+ im

(

h

m

)

+yn+ i

m

2

(

h

m

)2

+h

2m

[

(ξ′2 + ξ′1)∂f2

∂x

n+ im

+ξ222

∂2f2

∂x2

n+ im

+ξ232

∂2f2

∂y2

n+ im

+ ξ2ξ3∂2f2

∂x∂y

n+ im

]

+O(h4/m),

= yn+ im

+ yn+ im

(

h

m

)

+yn+ i

m

2

(

h

m

)2

+h3εi,m

m+ O(h4/m),

and we see that yn+(i+1)/m is second order accurate with respect to the microstep h/m and

the local truncation error is h3εi,m/m +O(h4/m) where

εi,m =

(

2i+ 1

4m−

i(i+ 1)

2m2

)

xn+ im

∂f2

∂x

n+ im

+

x2n+ i

m

4m2

∂2f2

∂x2

n+ im

(70)

+

y2n+ i

m

4m2

∂2f2

∂y2

n+ im

+xn+ i

myn+ i

m

2m2

∂2f2

∂x∂y

n+ im

. (71)

Then by (60) and (61), | εi,m| ≤ C1 + C2 for t ∈ [tn, tn+1] and the accumulatedtruncation error over m micro steps is

m−1∑

i=0

[

h3εi,m

m+O(h4/m)

]

≤h3

m

m−1∑

i=0

| εi,m|+O(h4),

≤ (C1 + C2)h3 + O(h4). (72)

Page 24: A Fourth Order Multirate Runge-Kutta Method with ErrorControl

24 Pak-Wing Fok

Linear interpolation can also be implemented using xn+χ = (1 − χ)xn + χx∗

n+1 instead of(62); this is closer in spirit to the cubic interpolant (18) which only uses intermediate stagefunction evaluations. The resulting error calculation is very similar to the above, but with

(64) replaced by the simpler expression xn + xn(i+1)h

mand the h2 term in (68) replaced by

xn+ im

[

i2

2m2 −i(i+1)

m2

]

h2. The associated accumulated truncation error after m microsteps

also satisfies eq. (72).

References

1. J. F. Andrus. Numerical solution of systems of ordinary differential equations separatedinto subsystems. SIAM J. Numer. Anal., 16: 605-611, 1979.

2. A. Bartel and M. Gunther. A multirate W-method for electrical networks in state-spaceformulation. J. Comp. Appl. Math., 147(2):411–425, 2002.

3. A. Bartel, M. Gunther and A. Kvaerno. Multirate methods in electrical circuit simula-tion. Progress in Industrial Mathematics at ECMI 2000, 258-265, 2000.

4. E. M. Constantinescu and Adrian Sandu. Extrapolated multirate methods for differen-tial equations with multiple time scales, Journal of Scientific Computing, 2012.

5. E. M. Constantinescu and Adrian Sandu. Multirate Timestepping Methods for Hyper-bolic Conservation Laws Journal of Scientific Computing, 33: 239–278, 2007.

6. E. M. Constantinescu and Adrian Sandu. Multirate Explicit Adams Methods for TimeIntegration Journal of Scientific Computing, 38: 229–249, 2009.

7. W. H. Enright, K. R. Jackson, S. P. Nørsett, and P. G. Thomsen. Interpolants forRunge-Kutta formulas. ACM Trans. Math. Softw., 12(3):193–218, 1986.

8. C. W. Gear and D. R. Wells. Multirate linear multistep methods. BIT, 24:484–502,1984.

9. M. Gunther, A. Kværnø, and P. Rentrop. Multirate partitioned Runge-Kutta methods.BIT, 41(3):504–514, 2001.

10. M. K. Horn. Fourth and fifth order, scaled Runge-Kutta algorithms for treating denseoutput. SIAM J. Numer. Anal., 20(3):558–568, 1983.

11. W. Hundsdorfer and V. Savcenco. Analysis of a multirate theta-method for stiff ODEs.Applied Numerical Mathematics, 59:693–706, 2009.

12. T. Kato and T. Kataoka. Circuit analysis by a new multirate method. Electr. Eng.Jpn., 126(4):1623–1628, 1999.

13. A. Logg. Multi-adaptive time integration. Appl. Numer. Math., 48:339–354, 2004.14. J. Makino and S. Aarseth. On a Hermite integrator with Ahmad-Cohen scheme for

gravitational many-body problems. Publ. Astron. Soc. Japan, 44:141–151, 1992.15. W. H. Press, S. A. Teukolsky, W. V. Vetterling, and B. P. Flannery. Numerical Recipes

in C: The Art of Scientific Computing. Cambridge University Press, second edition,1992.

16. V. Savcenco. Construction of a multirate RODAS method for stiff ODEs Journal Comp.Appl. Math., 225: 323-337, 2009.

17. V. Savcenco, W. Hundsdorfer, and J. G. Verwer. A multirate time stepping strategyfor stiff ordinary differential equations. BIT, 47:137–155, 2007.

18. L. F. Shampine. Some Practical Runge-Kutta Formulas Mathematics of Computation,173: 135-150, 1986.

19. S. Skelboe. Stability properties of backward differentiation multirate formulas. Appl.Numer. Math., 5: 151-160, 1989.

20. J. Waltz, G. L. Page, S. D. Milder, J. Wallin, and A. Antunes. A performance comparisonof tree data structures for N-body simulation. J. Comp. Phys., 178:1–14, 2002.