Content uploaded by Jarek Rossignac

Author content

All content in this area was uploaded by Jarek Rossignac

Content may be subject to copyright.

An Unconditionally Stable

MacCormack Method∗

Andrew Selle†Ronald Fedkiw†ByungMoon Kim‡

Yingjie Liu§Jarek Rossignac‡

June 29, 2007

Abstract

The back and forth error compensation and correction (BFECC)

method advects the solution forward and then backward in time.

The result is compared to the original data to estimate the error.

Although inappropriate for parabolic and other non-reversible par-

tial diﬀerential equations, it is useful for often troublesome advec-

tion terms. The error estimate is used to correct the data before

advection raising the method to second order accuracy, even though

each individual step is only ﬁrst order accurate. In this paper, we

rewrite the MacCormack method to illustrate that it estimates the

error in the same exact fashion as BFECC. The diﬀerence is that the

MacCormack method uses this error estimate to correct the already

computed forward advected data. Thus, it does not require the third

advection step in BFECC reducing the cost of the method while still

obtaining second order accuracy in space and time. Recent work re-

placed each of the three BFECC advection steps with a simple ﬁrst

order accurate unconditionally stable semi-Lagrangian method yield-

ing a second order accurate unconditionally stable BFECC scheme.

We use a similar approach to create a second order accurate uncon-

ditionally stable MacCormack method.

∗Stanford University, 353 Serra Mall Room 206, Stanford, CA 94305,

Phone: 650-714-4426, Fax: 650-723-0033

†Compute Science Department, Stanford University, Stanford, CA,

email: aselle@cs.stanford.edu

‡College of Computing, Georgia Institute of Technology, Atlanta, GA

§School of Mathematics, Georgia Institute of Technology, Atlanta, GA

1

1 Introduction

Courant et al. [2] proposed a simple method of characteristics scheme for

discretizing advection equations. These semi-Lagrangian type schemes are

popular in many areas (for example in the atmospheric sciences commu-

nity [25]), because they can be made unconditionally stable. The simplest

semi-Lagrangian scheme traces back a straight line characteristic and uses

trilinear interpolation to estimate the data, and thus is ﬁrst order accu-

rate in space and time. The order of accuracy can be improved by tracing

back curved characteristics and using higher order interpolation (e.g. [19]).

However, this can signiﬁcantly increase the complexity and computational

cost of the method especially since high order polynomial interpolants re-

quire limiters to avoid oscillations, new extrema and possible instability.

See for example the appendix of [9] which illustrates the use of a non-

oscillatory cubic spline interpolant. Another way to improve the ﬁdelity

of semi-Lagrangian schemes is via auxiliary information. For example, af-

ter [24] popularized the semi-Lagrangian method in the ﬁeld of computer

graphics, [9] showed that vorticity conﬁnement [26] could be used to alle-

viate the high amount of dissipation allowing for visually intricate, albeit

non-physical ﬂows (see also [22] which used vortex particles). Similarly, [6]

showed that the simple ﬁrst order accurate semi-Lagrangian scheme can

be used to obtain very accurate level set tracking as long as particles are

tracked with higher order accuracy. The original particle level set method

[5] used ﬁfth order accurate Hamilton-Jacobi WENO [12] and third order

accurate TVD Runge-Kutta [23] making it diﬃcult to extend the method to

more complicated data structures. In contrast, the simple semi-Lagrangian

approach proposed in [6] allowed for straightforward extension to octree

[17, 16] (see also [27]) and run length encoded [11] data structures.

Back and forth error compensation and correction (BFECC) was ﬁrst

proposed in [3] with the aim of reducing mass loss in level set methods

(see [21, 20]). The key idea was to realize that a reversible diﬀerential

equation could be evolved forward and then backward in time to obtain

an error estimate. The diﬀerence between the ﬁnal result and the origi-

nal data is approximately twice the advection error. While inappropriate

for non-reversible diﬀerential equations such as the heat equation or level

set reinitialization [28], it is useful for problematic advection terms in hy-

perbolic diﬀerential equations. First, the forward advection operator Ais

applied to get ˆ

φn+1 =A(φn), and then the backward advection operator

ARis applied to get ˆ

φn=AR(ˆ

φn+1). The result is used to estimate the

error in an advection step as ˆ

φn−φn= 2eor e= ( ˆ

φn−φn)/2. Next,

this error estimate is used to adjust the initial condition of the ﬁnal ad-

vection via ¯

φn=φn−eand then φn+1 =A(¯

φn). If Awas linear, this

could be viewed as evolving both the equation and the error forward in

2

1

2

1

2

3

4

33

(b) Cheaper BFECC(a) Original BFECC

1

2

3

4

1

2

3

Figure 1: A conceptual diagram of the steps of the original BFECC method

and the cheaper modiﬁed BFECC method (which is actually a modiﬁed

MacCormack scheme).

time, i.e. φn+1 =A(φn−e) = A(φn)−A(e). Intuitively, this treats eas

if it were a time nquantity that needs to be advected forward in time to

time n+ 1. Since there is no strong evidence that eis a time nquantity,

one could just as well add it directly to the time n+ 1 state to obtain

φn+1 =A(φn)−e=ˆ

φn+1 −e. And since ˆ

φn+1 has already been computed

in the error estimation step, this strategy alleviates the need to carry out

a third advection step making the method signiﬁcantly cheaper. Figure 1

shows a conceptual diagram of these two methods applied.

Originally, [3] focused on the application of BFECC to the level set

equation φt+V· ∇φ= 0 using forward Euler time integration com-

bined with ﬁrst order accurate upwinding and downwinding for the for-

ward and backward time evolution, respectively. More recently, a series

of papers [13, 14, 4] showed that the forward and backward advection op-

erators could be replaced by a ﬁrst order accurate unconditionally stable

semi-Lagrangian scheme without changing the desirable properties of the

method. This produces an unconditionally stable, fully second order ac-

curate semi-Lagrangian method composed of simple ﬁrst order accurate

building blocks. This has the desirable simplicity of TVD Runge-Kutta

methods [23], and interestingly contains backward time evolution similar

to the higher order accurate TVD Runge-Kutta methods. Thus, the or-

der of accuracy of the simple semi-Lagrangian scheme can be raised from

one to two by increasing the amount of work by a factor of three, since

3

three semi-Lagrangian advections are required. Alternatively, as pointed

out above, the error estimate could be added directly to ˆ

φn+1 removing the

last advection step, thus requiring only twice the eﬀort of the ﬁrst order

accurate scheme.

The motivation for this cheaper version of the BFECC scheme came

from the MacCormack method [18], which uses a combination of upwind-

ing and downwinding to achieve second order accuracy in space and time.

Consider the cheaper version of the BFECC scheme applied to the one di-

mensional wave equation φt+φx= 0, with λ= ∆t/∆x,△−φ=φi−φi−1

and △+φ=φi+1 −φi. The forward advection step is ˆ

φn+1

i=φn

i−λ△−φn,

the backward advection step is ˆ

φn

i=ˆ

φn+1

i+λ△+ˆ

φn+1, and the error

estimate is ei= ( ˆ

φn

i−φn

i)/2 = ( ˆ

φn+1

i−φn

i+λ△+ˆ

φn+1)/2. Finally,

φn+1

i=ˆ

φn+1

i−e= (φn

i+ˆ

φn+1

i−λ△+ˆ

φn+1)/2. This is the same as

equation (2b) from the original [18] if one switches △−with △+through-

out. That is, [18] proposed unstable downwind diﬀerencing for the forward

step, and unstable upwind diﬀerencing for the backward step, whereas we

propose the stable versions for both steps. Note that this slight modiﬁ-

cation is also typically referred to as a MacCormack method or modiﬁed

MacCormack method, see e.g. [29] and [1]1. Thus while this particular

modiﬁcation of BFECC is not novel, it adds insight to the (modiﬁed) Mac-

Cormack method allowing us to extend it to be unconditionally stable via

simple semi-Lagrangian building blocks. Moreover, when viewed in this

fashion many other improvements can be made. For example, one can

automatically revert to the ﬁrst order accurate scheme when the upwind

and downwind building blocks pull data from non-commensurate regions

(e.g. if one gets information from the ﬂuid and the other from a solid wall

boundary). It also becomes straightforward to apply limiters to prevent

new extrema, which is important since the error correction step of both

BFECC and our newly proposed MacCormack scheme can produce new

extrema leading to instability.

2 Temporal Accuracy and Stability

Consider the model ordinary diﬀerential equation y′=λy and the Taylor

expansion yn+1 =yn+λ∆tyn+ ∆t2λ2yn/2 + ∆t3λ3yn/6 + O(∆t4). For-

ward Euler time integration is yn+1

fe = (1 + ∆tλ)ynwith a leading order

truncation error of ∆t2λ2yn/2. The subsequent step backwards in time

from yn+1

fe to ˆynis ˆyn= (1 −∆tλ)yn+1

fe = (1 −∆t2λ2)yn, so the error is

e= (ˆyn−yn)/2 = −∆t2λ2yn/2. BFECC computes a new initial value

1page 224

4

Forward Euler BFECC MacCormack (RK2)

∆tError Order Error Order Error Order

1.000 -6.61e-02 – -3.35e-02 – 1.73e-02 –

.500 -3.35e-02 1.0 -7.13e-03 2.2 3.40e-03 2.3

.250 -1.67e-02 1.0 -1.59e-03 2.2 7.66e-04 2.2

.125 -8.36e-03 1.0 -3.72e-04 2.1 1.82e-04 2.1

Table 1: y′=−y/2 with y0= 1.3. As predicted the error of the MacCor-

mack scheme is about half in magnitude and positive compared the to the

back and forth scheme.

¯yn=yn−ewhich is advanced forward in time via yn+1

fb = (1 + ∆tλ)¯yn, i.e.

yn+1

fb =1 + ∆tλ +1

2∆t2λ2+1

2∆t3λ3yn

with a leading order truncation error of −∆t3λ3yn/3. The version of the

MacCormack scheme we consider in this paper is

yn+1

m=yn+1

fe −e= (1 + ∆tλ +1

2∆t2λ2)yn

with a leading order truncation error of ∆t3λ3yn/6. That is, the MacCor-

mack method is identical to second order accurate Runge-Kutta for ordi-

nary diﬀerential equations. All this can be illustrated by solving y′=−y/2

with y0= 1.3 as shown in Table 1.

Next, we consider the regions of stability. As usual, forward Euler

requires |1 + ∆tλ| ≤ 1 so ∆tλ =x+yi must satisfy (x+ 1)2+y2≤1.

Similarly, BFECC requires (1 + x+1

2x2−1

2y2+1

2x3−3

2xy2)2+ (xy +

y+3

2x2y−1

2y3)2≤1. The graphs of the stability regions are shown in

Figure 2. Note that the BFECC method includes a signiﬁcant portion of

the imaginary axis similar to third order TVD Runge-Kutta.

5

-2 -1 012 3

-2

-1

0

1

2

RK3

BFECC

MacCormack RK2

Forward Euler

Figure 2: Stability regions for ordinary diﬀerential equations.

6

3 The Wave Equation

Consider the model problem ut+ux= 0 discretized with forward Euler in

time. First order accurate spatial upwinding is given by

un+1

i=un

i−∆t

∆x(un

i−un

i−1) = (1 −λ)un

i+λun

i−1

with λ= ∆t/∆x. BFECC can be written as a step forward in time

ˆun+1

i= (1 −λ)un

i+λun

i−1

followed by a step backward in time

ˆun

i= (1 −λ)ˆun+1

i+λˆun+1

i+1 = ((1 −λ)2+λ2)un

i+λ(1 −λ)(un

i−1+un

i+1)

followed by a correction of the original data using the estimated error

˜un

i=un

i−(ˆun

i−un

i)/2 = un

i−λ(1 −λ)(un

i+1 −2un

i+un

i−1)/2

followed by a step forward in time using this error corrected data

un+1

i= (1 −λ)˜un

i+λ˜un

i−1

=−1

2λ2+1

2λ3un

i−2+1

2λ+ 2λ2−3

2λ3un

i−1

+1−5

2λ2+3

2λ3un

i+−1

2λ+λ2−1

2λ3un

i+1.

Taylor expanding un

i−2,un

i−1and un

i+1, and using ut+ux= 0 leads to

un+1

i=un

i−∆x(un

i)xλ+∆x2

2(un

i)xxλ2−∆x3

6(un

i)xxx(−3λ2+λ+ 3λ3)

+

∞

X

i=4

ξbf(i, ∆x, ∆t)

=un

i+ ∆t(un

i)t+∆t2

2(un

i)tt +∆t3

6(un

i)ttt −3

λ+1

λ2+ 3

+

∞

X

i=4

ξbf(i, ∆x, ∆t)

where ξbf(i, ∆x, ∆t) = O(∆xi−2∆t2+ ∆xi−3∆t3+ (imod 2)∆xi−1∆t).

Thus, the ﬁnal terms can be simpliﬁed to P∞

i=4 ξbf(i, ∆x, ∆t) = O(∆x2∆t2+

∆x∆t3+ ∆x4∆t).

7

The MacCormack method instead uses the error estimate to correct the

already advected data resulting in

un+1

i= ˆun+1

i−(ˆun

i−un

i)/2

=1

2λ+1

2λ2un

i−1+ (1 −λ2)un

i+−1

2λ+1

2λ2un

i+1.

Taylor expansions and ut+ux= 0 can be used to rewrite this as

un+1

i=un

i−∆x(un

i)xλ+∆x2

2(un

i)xxλ2−∆x3

6(un

i)xxxλ+

∞

X

i=4

ξm(i, ∆x, ∆t)

=un

i+ ∆t(un

i)t+∆t2

2(un

i)tt +∆t3

6(un

i)ttt

1

λ2+O(∆x2∆t2+ ∆x4∆t)

since ξm(i, ∆x, ∆t) = O(∆xi−2∆t2) when ieven and ξm(i, ∆x, ∆t) =

O(∆xi−1∆t) when iis odd.

For a ﬁxed CFL number (i.e. ﬁxed λ) with ∆t=λ∆x, the ﬁnal sum-

mations in both methods become O(∆x4) or identically O(∆t4). Note

that the ﬁrst three terms of these expressions agree with the exact solu-

tion, so the fourth term in each expression is the leading local truncation

error. We write the truncation error as E(λ)∆t3uttt/6 + O(∆t4) where

Ebf (λ) = 1/λ2−3/λ + 2 for BFECC and Em(λ) = 1/λ2−1 for the

MacCormack method. Note that these results were derived for the wave

equation under the assumption that λ≤1. Since an unconditionally stable

approach allows for larger λ’s, a similar piecewise analysis can be carried

out for λ∈(1,2], λ∈(2,3], etc. to obtain

Ebf (λ) =

2 + 1

λ2−3

λλ≤1

2−6

λ3+13

λ2−9

λ1< λ ≤2

2−30

λ3+37

λ2−15

λ2< λ ≤3

(1)

and

Emac(λ) =

−1 + 1

λ2λ≤1

−1−6

λ3+7

λ21< λ ≤2

−1−30

λ3+19

λ22< λ ≤3

(2)

and so on. Using these expressions, we can compute the leading truncation

error at each grid point xias |∆t3uttt(xi, t)E(λ)/6|and the average error

over ngrid points as (1/n)Pn

i=1 |∆t3uttt(xi, t)E(λ)/6|. Computing this

for a single time step of ut+ux= 0 with u(0, x) = sin 4πx and n= 400

while varying the CFL number λproduces the graph depicted below.

8

Solving the same problem numerically for one time step and graphing the

computed average error magnitude similarly yields the following graph.

Next, consider solving the wave equation with u(0, x) = sin 4πx and

periodic boundary conditions to a ﬁnal time of t=.5 (one period). Table 2

compares the average errors obtained using ﬁrst order accurate upwinding,

9

Upwinding BFECC MacCormack

nError Order Error Order Error Order

101 6.0e-2 – 1.3e-3 – 4.7e-3 –

201 3.1e-2 1.02 3.3e-4 2.09 1.2e-3 1.96

401 1.6e-2 1.01 8.2e-5 1.97 2.9e-4 2.01

801 7.8e-3 1.00 2.1e-5 1.99 7.2e-5 2.00

Table 2: Wave equation solved with upwind building blocks and CFL=.75.

Semi-Lagrangian BFECC MacCormack

nError Order Error Order Error Order

101 2.6e-2 – 5.6e-4 – 5.3e-3 –

201 1.3e-2 .98 1.4e-4 2.09 1.3e-3 2.21

401 6.7e-3 1.02 3.5e-5 1.96 3.4e-4 2.05

801 3.3e-3 1.02 8.8e-6 1.99 8.4e-5 2.05

Table 3: Wave equation solved with semi-Lagrangian building blocks and

CFL=1.75.

BFECC and the MacCormack method with a CFL of .75. Since the CFL

is less than one, upwind building blocks are used for both BFECC and the

MacCormack method. Spatial reﬁnement shows the expected results for

all three methods. Table 3 shows similar results for a CFL of 1.75 where

semi-Lagrangian building blocks are used for BFECC and the MacCormack

method. Note that the the ﬁrst order accurate upwinding was replaced with

the ﬁrst order accurate semi-Lagrangian method as well.

10

4 New Extrema

Whether ﬁrst order accurate upwind building blocks (and a CFL less than

one) or simple semi-Lagrangian building blocks are used, the ﬁrst step for-

ward in time and the subsequent step backward in time produce monotone

data. That is, ˆunis bounded by ˆun+1 which is in turn bounded by un.

However, nothing special can be stated about the manner in which the er-

ror is computed, or the result obtained when the error estimate is applied

to either unin BFECC or ˆun+1 in the MacCormack scheme. In particular,

this error correction step can lead to new extrema and possible instabil-

ity. Figure 3 shows the oscillations obtained when using BFECC and the

MacCormack scheme to advect a square wave for one period. A simple

choice of limiter consists of limiting the ﬁnal solution at each grid point to

be bound by the values used in computing the ﬁrst advection step from un

to ˆun+1. For example, if the base of the semi-Lagrangian ray used in this

ﬁrst advection step interpolated data from the interval [xj, xj+1], then we

would postprocess the ﬁnal result (from either BFECC or MacCormack) to

be clamped between min(un

j, un

j+1) and max(un

j, un

j+1). This readily gen-

eralizes to multiple spatial dimensions, adaptive and non-Cartesian grids.

Another commonly used limiter reverts to a ﬁrst order accurate method

when the higher order accurate method would overshoot (see e.g. [10]). For

our method this requires no further computation as an out of bounds value

is simply replaced with the value from the ﬁrst semi-Lagrangian advection

step, that is, no error correction is used. Figure 3 shows the results ob-

tained by applying the clamping limiter to advection of the square wave

initial data, and though it is not depicted we also ran the example using

the reversion to ﬁrst order accurate approach which yielded nearly identi-

cal results to clamping. We also compared clamping to reversion using a

2D ﬂow example in Figure 9 in which we noticed no signiﬁcant diﬀerence

between the two methods. Despite this, we prefer the reversion approach

as it yields better results when the semi-Lagrangian MacCormack scheme

is applied to free surface ﬂows where the reversible PDE assumption of our

modiﬁed MacCormack scheme (and also BFECC) breaks down due to the

linear extrapolation of velocities to outside the ﬂuid region.

11

Figure 3: Both BFECC and the MacCormack method can create new

extrema, as shown here where a square wave is advected for one period. Of

course, these oscillations can be avoided with a simple limiting technique.

12

5 General Stability and Accuracy Results for

Linear Equations in Multi Dimensions

Consider the equation

ut+v· ∇u= 0,x∈[0,1]d,(3)

with periodic boundary conditions, where v∈Rdis a constant vector.

Assume a uniform partition of the domain so that xj= (j1, j2,···, jd)h,

jl∈ {0,1,···, J}, and h= 1/J is the mesh size. Let un

jbe a numerical

solution at (xj, tn). A linear scheme A(such as the ﬁrst order accurate

semi-Lagrangian scheme) is a linear operator ˆun+1 =A(un) such that

ˆun+1

j=X

i

αiun

j+i,

where {αi}are constants depending on ∆t/h, ∆t=tn+1 −tn. We can

obtain stability and accuracy results by applying similar arguments as in

[4]. Expanding un

jinto the ﬁnite Fourier series

un

j=X

k

cn

ke2πik·xj,

where k= (k1, k2,···, kd), kl∈ {0,±1,···,±(J−1)}, we obtain a relation

between two adjacent time steps cn+1

k=ρA(k)cn

k, where ρA(k) is called

the Fourier symbol of Aand maxk|ρA(k)|is called the ampliﬁcation factor

of A. Let AR: ˆun=AR(ˆun+1 ) be the corresponding linear scheme that

solves the time reversed equation of (3). Then the modiﬁed MacCormack

scheme acting on Ais

F:un+1 =F(un) = A+1

2(I−ARA)(un),

where Iis the identity operator. The Fourier symbol of Fis

ρF=ρA+1

2(1 −ρARρA).

We have the following theorem.

Theorem 1. Suppose ρAR=ρA, then |ρF| ≤ 1 if |ρA| ≤ 1.

Most conventional ﬁrst order accurate linear schemes satisfy the condi-

tion of Theorem 1, e.g., the upwind scheme, Lax-Friedrichs scheme and in

particular the Courant-Isaacson-Rees scheme (CIR or ﬁrst order accurate

semi-Lagrangian scheme).

13

A linear scheme Lis said to be accurate of order rif for any solution u

of (3) having continuous derivatives up to order r+ 1,

u(xj, tn+1)−L(u(·, tn))|xj=O(hr+1),

where ∆t/h is ﬁxed during the mesh reﬁnement. A convenient way to

check the accuracy of scheme Fis to compare the discrete Fourier symbol

ρFto the corresponding Fourier symbol for the exact solution uby using

the Lax’s theorem [15]. Expanding uinto the Fourier series

u(x, t) = X

k∈Zd

ck(t)e2πik·x

and substituting it into (3) to obtain dck(t)

dt =P(ik)ck(t), we obtain

ck(tn+ ∆t) = e∆tP (ik)ck(tn),

where Pis a homogeneous polynomial of degree one with real coeﬃcients

and e∆tP (ik)is the Fourier symbol for the exact solution u. Therefore for

an r-th order linear scheme A, following the Lax’s theorem

ρA(k) = e∆tP (ik)+Qr+1(ikh) + O(|kh|r+2),

where Qr+1 is a homogeneous polynomial of degree r+ 1 with real coeﬃ-

cients. If ris an odd positive integer, then Qr+1(ikh) is a real number. In

addition, if ρAR=ρA, then

ρF(k) = ρA(k) + 1

2[1 −ρAR(k)ρA(k)]

=ρA(k)−1

2[e−∆tP (ik)+e∆tP (ik)]Qr+1(ikh) + O(|kh|r+2)

=e∆tP (ik)+Qr+1(ikh)−1

2[e−∆tP (ik)+e∆tP (ik)]Qr+1(ikh) + O(|kh|r+2)]

=e∆tP (ik)+O(|kh|r+2).

We have the following theorem.

Theorem 2. Suppose ρAR=ρAand scheme Ais accurate of order rfor

equation (3), where ris an odd positive integer, then scheme Fis accurate

of order r+ 1.

14

6 Zalesask’s Disc

We use the the standard Zalesask’s Disc test to illustrate the behavior of

these methods for multidimensional advection. The initial data is a slotted

circle centered at (50,75) with radius 15 and a 5 by 25 size slot. We

show the results after advecting one rotation (to t= 628) in a rotational

velocity ﬁeld V=π

314 (50 −y, x −50). Although BFECC was originally

proposed for level set methods, this particular example is not meant to

test these methods ability to treat interfaces. Instead, we are focusing on

how these methods behave for multidimensional advection. Thus, we do

not consider reinitialization [28] or the addition of particles [5]. In fact,

[6] showed that the addition of accurately advected particles allows one

to reduce high order accurate level set advection to ﬁrst order accuracy

without adverse results. Still, accurate multidimensional advection is quite

useful for various other problems such as for incompressible ﬂows. In the

ﬁgures, we plot the zero isocontours for visualization purposes but stress

that the errors are computed across the entire domain (i.e. all isocontours).

In particular, we compute the order of accuracy by comparing the error eon

the coarse grid to the error e′on the ﬁne grid at coincident node locations

as log2

e(i,j)

e′(2i−1,2j−1) and average all of these values to obtain the values

shown in the tables below.

Figure 4 compares ﬁrst order accurate upwinding with the versions of

BFECC and the MacCormack scheme obtained using ﬁrst order accurate

upwind building blocks. Figure 5 compares the simple ﬁrst order accurate

semi-Lagrangian method with the versions of BFECC and the MacCormack

scheme obtained using simple ﬁrst order accurate semi-Lagrangian building

blocks. Note that the semi-Lagrangian method is fully multidimensional,

so even though the CFL is .75 in both Figure 4 and Figure 5 the resulting

numerical methods are all diﬀerent (in contrast to one spatial dimension

where semi-Lagrangian and upwind building blocks are identical for CFL’s

less than one). Finally, Figure 6 repeats the calculations from Figure 5

using a higher CFL of 1.75.

15

Upwinding BFECC MacCormack

Grid Size Error Order Error Order Error Order

10121.8 – 8.9e-2 – 1.6e-1 –

20129.6e-1 1.05 3.9e-2 1.79 6.3e-2 1.93

40125.2e-1 1.04 1.8e-2 1.77 3.2e-2 1.59

80122.8e-1 1.02 7.6e-3 1.98 1.3e-2 2.08

160121.5e-1 1.01 3.1e-3 2.04 5.5e-3 2.08

Figure 4: Zalesask’s disc rotation comparing simple upwinding with the

versions of BFECC and the MacCormack scheme obtained using ﬁrst order

accurate upwind building blocks (CFL=.75).

Semi-Lagrangian BFECC MacCormack

Grid Size Error Order Error Order Error Order

10121.8 – 9.9e-2 – 1.7e-1 –

20121.0 1.04 4.1e-2 1.73 6.7e-2 1.95

40125.4e-1 1.03 2.0e-2 1.67 3.3e-2 1.60

80122.9e-1 1.02 8.4e-3 1.93 1.4e-2 2.06

160121.5e-1 1.01 3.5e-3 2.00 5.9e-3 2.06

Figure 5: Zalesask’s disc rotation comparing the simple ﬁrst order accurate

semi-Lagrangian method with the versions of BFECC and the MacCormack

scheme obtained using simple ﬁrst order accurate semi-Lagrangian blocks

(CFL=.75).

16

Semi-Lagrangian BFECC MacCormack

Grid Size Error Order Error Order Error Order

10122.0 – 5.4e-2 – 1.5e-1 –

20121.1 1.02 2.4e-2 1.81 6.0e-2 1.82

40125.6e-1 1.02 1.0e-2 1.84 3.0e-2 1.62

80123.0e-1 1.01 4.0e-3 1.98 1.2e-2 1.99

160121.5e-1 1.02 1.5e-3 2.07 5.2e-3 2.01

Figure 6: Zalesask’s disc rotation comparing the simple ﬁrst order accurate

semi-Lagrangian method with the versions of BFECC and the MacCormack

scheme obtained using simple ﬁrst order accurate semi-Lagrangian blocks

(CFL=1.75).

17

7 Incompressible Flow

Consider inviscid incompressible ﬂow on a standard MAC grid. First the

advection terms are updated to obtain an intermediate velocity, and then

a Poisson equation is solved for the pressure which is subsequently used to

make the intermediate velocity divergence free.

Consider a [0,3] ×[0,1] domain divided into 300 ×100 MAC grid cells

with a radius .125 circle centered at (.5, .5). The horizontal velocity is set

to one at the left and right boundaries, and the vertical velocity is set to

zero at the top and bottom boundaries. Zero derivative Neumann bound-

ary conditions are used for the pressure on all four boundaries. Figure 7

compares the ﬁrst order accurate semi-Lagrangian method to BFECC and

the MacCormack method using ﬁrst order accurate semi-Lagrangian build-

ing blocks. The MacCormack method is shown both with and without the

extrema clamping procedure discussed earlier. Note that each component

of the velocity ﬁeld is separately advected and limited. Note that BFECC

and the MacCormack method both achieve similarly higher Reynolds num-

ber ﬂows than the ﬁrst order accurate semi-Lagrangian method. Whereas

Figure 7 was obtained with a CFL of .75, comparable results are shown in

Figure 8 with a higher CFL of 1.75. In Figure 9 we depict the results of

applying the extrema clamping strategies discussed in Section 4.

Both BFECC and the MacCormack method do not perform well when

information is mixed from disparate regions of the ﬂow. This happens

frequently near domain boundaries leading to poor error estimates in these

regions. Thus, for both BFECC and the MacCormack method, we revert

to the ﬁrst order accurate semi-Lagrangian scheme at any grid point whose

semi-Lagrangian characteristic could source from a solid wall or solid circle

boundary (i.e. CFL ×max(∆x, ∆y)).

Now consider free surface ﬂows which combine incompressible ﬂow with

level set advection for interface tracking. We use the basic free surface

model described in [7] with the improved second order accurate free sur-

face pressure boundary condition proposed in [8] and the improved fast

marching method from [16]. In addition, we use ﬁrst order accurate semi-

Lagrangian level set advection together with second order accurate Runge-

Kutta advection for the particles because [6] showed that the Particle Level

Set Method with a second order accurate particle advection scheme obvi-

ates the need for high order level set advection.

As [7] does, we extrapolate a divergence free velocity ﬁeld across the

interface for the level set and incompressible advection, resulting in lower

order values in those regions. The BFECC or semi-Lagrangian MacCor-

mack error computation then depends on these less accurate values which

creates new extrema which we could clamp. Unfortunately, clamping tends

to pollute the solution with the incorrect error correction, thus when new

18

Figure 7: Inviscid incompressible ﬂow comparing the ﬁrst order accurate

semi-Lagrangian method to BFECC and the MacCormack method using

ﬁrst order accurate semi-Lagrangian building blocks (CFL=.75).

19

Figure 8: Inviscid incompressible ﬂow comparing the ﬁrst order accurate

semi-Lagrangian method to BFECC and the MacCormack method using

ﬁrst order accurate semi-Lagrangian building blocks (CFL=1.75).

20

Figure 9: Inviscid incompressible ﬂow comparing the semi-Lagrangian

MacCormack method with clamping to the semi-Lagrangian MacCormack

method with reversion to ﬁrst order when new extrema are detected

(CFL=.75).

21

extrema are detected we advocate reverting to ﬁrst order accurate semi-

Lagrangian advection instead.

Consider a spherical radius .5 drop located at (.5, .75, .5) falling (with

gravity vector (0,−9.8,0)) into a pool at height .412134 contained in a

walled domain of [0,1] ×[0,1.5] ×[0,1] as shown in Figure 10, 11 and

12. As with the ﬂow past circle example, advection was reverted to the

ﬁrst order accurate semi-Lagrangian method in cells close to the domain

boundaries. Without any limiter the simulation becomes unstable so we

apply the following limiter variants: (1) clamping of new extrema, (2)

clamping of new extrema but always using the ﬁrst order accurate semi-

Lagrangian method near the interface and (3) reverting to the ﬁrst order

accurate semi-Lagrangian method at cells where new extrema are found.

(1) and (3) do well at producing higher Reynolds number ﬂows while (2)

mitigates most of the beneﬁt of the second order accurate approach.

Finally, consider a radius .2 solid ball splashing into a pool of water

in a [0,1.5] ×[0,1] ×[0,1] domain. The ball is kinematically moved from

(1.25, .55, .5) to (.8, .1, .5) between time 0 and .075 using linear interpola-

tion, and the ﬂuid has the gravity vector (0,−9.8,0). Figure 13, 14 and

15 show a comparison between the ﬁrst order accurate semi-Lagrangian

method and the three limiter strategies described above. Again we note

that without a limiter, the simulation is unstable. Also, as with the ﬂow

past circle example and the falling drop example, advection near the do-

main boundaries and the ob ject boundaries is reverted to the ﬁrst order

accurate semi-Lagrangian method.

22

Semi-Lagrangian MacCormack (Clamp Extrema)

MacCormack (Revert) MacCormack (Clamp Extrema)

ﬁrst order accurate near interface

Figure 10: Inviscid incompressible free surface ﬂow of a drop falling into

a pool. Notice how the MacCormack methods (top right, bottom left)

produce additional detail. Using the ﬁrst order accurate semi-Lagrangian

advection near the interface (bottom right) removes much of the advantage

of the second order accurate method (bottom r ight). (200 ×300 ×200 grid,

t= 6/24, CFL=1.75).

23

Semi-Lagrangian MacCormack (Clamp Extrema)

MacCormack (Revert) MacCormack (Clamp Extrema)

ﬁrst order accurate near interface

Figure 11: Inviscid incompressible free surface ﬂow of a drop falling into a

pool (200 ×300 ×200 grid, t= 10/24, CFL=1.75).

24

Semi-Lagrangian MacCormack (Clamp Extrema)

MacCormack (Revert) MacCormack (Clamp Extrema)

ﬁrst order accurate near interface

Figure 12: Inviscid incompressible free surface ﬂow of a drop falling into a

pool (200 ×300 ×200 grid, t= 18/24, CFL=1.75).

25

Semi-Lagrangian MacCormack (Clamp Extrema)

MacCormack (Revert) MacCormack (Clamp Extrema)

ﬁrst order accurate near interface

Figure 13: Inviscid incompressible free surface ﬂow of a solid ball thrown

into a pool. Note that the clamp and reversion MacCormack variants (up-

per right, lower left) capture the vortex sheeting due to the ball’s penetra-

tion that is missed when using the semi-Lagrangian method or the clamped

MacCormack method that uses the ﬁrst order accurate semi-Lagrangian

method near the interface (upper left, lower right). (450 ×300 ×300 grid,

CFL=1.75, t=4/24)

26

Semi-Lagrangian MacCormack (Clamp Extrema)

MacCormack (Revert) MacCormack (Clamp Extrema)

ﬁrst order accurate near interface

Figure 14: Inviscid incompressible free surface ﬂow of a solid ball thrown

into a pool. (450 ×300 ×300 grid, CFL=1.75, t=10/24)

27

Semi-Lagrangian MacCormack (Clamp Extrema)

MacCormack (Revert) MacCormack (Clamp Extrema)

ﬁrst order accurate near interface

Figure 15: Inviscid incompressible free surface ﬂow of a solid ball thrown

into a pool. (450 ×300 ×300 grid, CFL=1.75, t=40/24)

28

8 Conclusion

Motivated by the BFECC method, we rewrote a version of the MacCor-

mack method into a similar form facilitating its extension to unconditional

stability while still preserving second order accuracy in space in time. The

MacCormack method only requires two ﬁrst order accurate advection steps

whereas BFECC is 50% more expensive requiring three advection steps.

Although the semi-Lagrangian versions of BFECC and the MacCormack

scheme are not fully monotone, we proposed a simple limiter that preserves

monotonicity. We illustrated the expected behavior of the method on both

simple and more complex problems, noting that diﬃculties could arise if

the semi-Lagrangian rays mix information from disparate regions such as

from both solid wall boundaries and ﬂuid regions. In those instances, it is

simple to revert to the ﬁrst order accurate semi-Lagrangian method. We

also saw that using an increasing number of simple semi-Lagrangian rays

can improve accuracy. In particular one ray yields the ﬁrst order accurate

semi-Lagrangian method, two rays yield the second order accurate Mac-

Cormack method and three rays yield the second order accurate BFECC

method, which has a lower truncation error magnitude than the MacCor-

mack method in some problems. Thus an obvious question is whether

one can do better than the BFECC method with three rays, perhaps even

obtaining third order accuracy.

Acknowledgments

A. Selle and R. Fedkiw were supported in part by an ONR YIP award and

a PECASE award (ONR N00014-01-1-0620), a Packard Foundation Fellow-

ship, a Sloan Research Fellowship, ONR N0014-06-1-0393, ONR N00014-

03-1-0071, ONR N00014-02-1-0720, ONR N00014-05-1-0479 (for a SUN

computing cluster), ARO DAAD19-03-1-0331, NSF IIS-0326388, NSF ITR-

0205671, NSF ITR-0121288, NSF ACI-0323866 and NIH U54-GM072970.

Y. Liu was supported by NSF grant DMS-0511815.

References

[1] J.D. Anderson. Computational Fluid Dynamics: The Basics With

Applications. McGraw-Hill, 1995. New York, NY.

[2] R. Courant, E. Issacson, and M. Rees. On the solution of nonlinear

hyperbolic diﬀerential equations by ﬁnite diﬀerences. Comm. Pure and

Applied Math, 5:243–255, 1952.

29

[3] T. Dupont and Y. Liu. Back and forth error compensation and cor-

rection methods for removing errors induced by uneven gradients of

the level set function. J. Comput. Phys., 190/1:311–324, 2003.

[4] T. Dupont and Y. Liu. Back and forth error compensation and cor-

rection methods for semi-Lagrangian schemes with application to level

set interface computations. Math. Comp., In Press., 2006.

[5] D. Enright, R. Fedkiw, J. Ferziger, and I. Mitchell. A hybrid particle

level set method for improved interface capturing. J. Comput. Phys.,

183:83–116, 2002.

[6] D. Enright, F. Losasso, and R. Fedkiw. A fast and accurate semi-

Lagrangian particle level set method. Computers and Structures,

83:479–490, 2005.

[7] D. Enright, S. Marschner, and R. Fedkiw. Animation and rendering

of complex water surfaces. ACM Trans. Graph. (SIGGRAPH Proc.),

21(3):736–744, 2002.

[8] D. Enright, D. Nguyen, F. Gibou, and R. Fedkiw. Using the particle

level set method and a second order accurate pressure boundary con-

dition for free surface ﬂows. In Proc. 4th ASME-JSME Joint Fluids

Eng. Conf., number FEDSM2003–45144. ASME, 2003.

[9] R. Fedkiw, J. Stam, and H. Jensen. Visual simulation of smoke. In

Proc. of ACM SIGGRAPH 2001, pages 15–22, 2001.

[10] M. Herrmann and G. Blanquart. Flux corrected ﬁnite volume scheme

for preserving scalar boundedness in reacting large-eddy simulations.

AIAA J., 44(12):2879–2886, 2006.

[11] G. Irving, E. Guendelman, F. Losasso, and R. Fedkiw. Eﬃcient simu-

lation of large bodies of water by coupling two and three dimensional

techniques. ACM Trans. Graph. (SIGGRAPH Proc.), 25(3):805–811,

2006.

[12] G.-S. Jiang and D. Peng. Weighted ENO schemes for Hamilton-Jacobi

equations. SIAM J. Sci. Comput., 21:2126–2143, 2000.

[13] B.-M. Kim, Y. Liu, I. Llamas, and J. Rossignac. Using BFECC for

ﬂuid simulation. In Eurographics Workshop on Natural Phenomena

2005, 2005.

[14] B.-M. Kim, Y. Liu, I. Llamas, and J. Rossignac. Advections with

signiﬁcantly reduced dissipation and diﬀusion. IEEE Trans. on Vis.

and Comput. Graph., In Press., 2006.

30

[15] P.D. Lax. On the stability of diﬀerence approximations to solutions

of hyperbolic equations with variable coeﬃcients. Comm. Pure Appl.

Math., 14:497–520, 1961.

[16] F. Losasso, R. Fedkiw, and S. Osher. Spatially adaptive techniques

for level set methods and incompressible ﬂow. Computers and Fluids,

35:995–1010, 2006.

[17] F. Losasso, F. Gibou, and R. Fedkiw. Simulating water and smoke with

an octree data structure. ACM Trans. Graph. (SIGGRAPH Proc.),

23:457–462, 2004.

[18] R. MacCormack. The eﬀect of viscosity in hypervelocity impact cra-

tering. In AIAA Hypervelocity Impact Conference, 1969. AIAA paper

69-354.

[19] C. Min and F. Gibou. A second order accurate pro jection method

for the incompressible Navier-Stokes equation on non-graded adaptive

grids. J. Comput. Phys., 219:912–929, 2006.

[20] S. Osher and R. Fedkiw. Level Set Methods and Dynamic Implicit

Surfaces. Springer-Verlag, 2002. New York, NY.

[21] S. Osher and J. Sethian. Fronts propagating with curvature-dependent

speed: Algorithms based on Hamilton-Jacobi formulations. J. Com-

put. Phys., 79:12–49, 1988.

[22] A. Selle, N. Rasmussen, and R. Fedkiw. A vortex particle method

for smoke, water and explosions. ACM Trans. Graph. (SIGGRAPH

Proc.), 24(3):910–914, 2005.

[23] C.-W. Shu and S. Osher. Eﬃcient implementation of essentially non-

oscillatory shock capturing schemes. J. Comput. Phys., 77:439–471,

1988.

[24] J. Stam. Stable ﬂuids. In Proc. of SIGGRAPH 99, pages 121–128,

1999.

[25] A. Staniforth and J. Cote. Semi-Lagrangian integration schemes for

atmospheric models: A review. Monthly Weather Review, 119:2206–

2223, 1991.

[26] J. Steinhoﬀ and D. Underhill. Modiﬁcation of the Euler equations for

“vorticity conﬁnement”: Application to the computation of interacting

vortex rings. Phys. of Fluids, 6(8):2738–2744, 1994.

[27] J. Strain. Tree methods for moving interfaces. J. Comput. Phys.,

151:616–648, 1999.

31

[28] M. Sussman, P. Smereka, and S. Osher. A level set approach for

computing solutions to incompressible two-phase ﬂow. J. Comput.

Phys., 114:146–159, 1994.

[29] R.F. Warming and R.M. Beam. Upwind second-order diﬀerence

schemes and applications in aerodynamic ﬂows. AIAA J., 14(9):1241–

1249, 1976.

32