Chapter 8 Diffusion Equation - University of Alaska...

17
Chapter 8 Diffusion Equation This chapter describes different methods to discretize the diffusion equation f t - α 2 f x 2 + 2 f y 2 + 2 f z 2 = 0 which represents a combined boundary and initial value problem, i.e., requires to prescribe bound- ary f boundary (t ) and initial conditions f (x, y , z, t = 0). 8.1 Explicit methods 8.1.1 Forward time centered space scheme In one dimension and using finite difference the FTCS scheme is f n+1 j = f n j + sΔx 2 L xx f n j s = α Δt /Δx 2 The truncation error is given by E n j = α Δx 2 2 s - 1 6 4 f x 4 n j + O ( Δx 4 ) The amplification factor is g = 1 - 4s sin 2 kΔx 2 which yields s < 1/2 for stability. 145

Transcript of Chapter 8 Diffusion Equation - University of Alaska...

Page 1: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

Chapter 8

Diffusion Equation

This chapter describes different methods to discretize the diffusion equation

∂ f∂ t−α

(∂ 2 f∂x2 +

∂ 2 f∂y2 +

∂ 2 f∂ z2

)= 0

which represents a combined boundary and initial value problem, i.e., requires to prescribe bound-ary fboundary(t) and initial conditions f (x,y,z, t = 0).

8.1 Explicit methods

8.1.1 Forward time centered space scheme

In one dimension and using finite difference the FTCS scheme is

f n+1j = f n

j + s∆x2Lxx f nj

s = α∆t/∆x2

The truncation error is given by

Enj = α

∆x2

2

(s− 1

6

)∂ 4 f∂x4

∣∣∣∣nj+O

(∆x4)

The amplification factor is

g = 1−4ssin2(

k∆x2

)which yields s < 1/2 for stability.

145

Page 2: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 146t xi-1 i i+1nn+1n-1 i+2i-2 Schematic: FTCSFigure 8.1: Representation of the FTCS scheme.

In two dimensions the same approach can be used to yield

f n+1jk = f n

jk + sx∆x2Lxx f njk + sy∆y2Lyy f n

jk

with sx = αx∆t/∆x2, sy = αy∆t/∆y2

Stability requires sx + sy ≤ 1/2. An improved nine point scheme can be found if αx = αy = αand∆x = ∆y which for

∆ f n+1jk

∆t= αLxx f n

jk +αLyy f njk +α

2∆t2LxxLyy f n

jk

yields stability for s≤ 1/2. This scheme can efficiently be implemented with

f ∗jk = (1+α∆tLyy) f njk

f n+1jk = (1+α∆tLxx) f ∗jk

8.1.2 Richardson and DuFort-Frankel schemes

One could have the idea that is is more accurate to employ a centered difference for the temporalderivative which give the Richardson scheme

f n+1j − f n−1

j

2∆t= αLxx f n

j =α

∆x2

(f n

j−1−2 f nj + f n

j+1)

and is second order accurate for the time derivative. However the stability analysis shows that thisscheme is unconditionally unstable. A small modification of this scheme where the term 2 f n

j is

Page 3: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 147

split into two time levels according to 2 f nj = f n−1

j + f n+1j leads to the so-called Dufort-Frankel

scheme:

f n+1j − f n−1

j

2∆t= αLxx f n

j =α

∆x2

(f n

j−1− f n−1j − f n+1

j + f nj+1

)Although it appears as if this were implicit it is straightfor-ward to re-arrange terms to yield

f n+1j =

2s1+2s

(f n

j−1 + f nj+1)+

1−2s1+2s

f n−1j

This scheme is actually unconditionally stable. However,carrying out the consistency test, i.e., expanding terms inthe corresponding Taylor series yields

[∂ f∂ t−α

∂ 2 f∂x2 +α

(∆t∆x

)2∂ 2 f∂ t2

]n

j

+O(∆t2,∆x2)= 0

Symbolic representation of theDuFort-Frankel scheme.

Thus it is not sufficient to conduct the limit of ∆t,∆x→ 0 to achieve consistency as long as ∆t/∆xremains finite. Using the relation

α

(∆t∆x

)2

= s∆t

demonstrates that consistency can be achieved if s is kept constant and ∆t → 0 because ∆t ∼ ∆x2

for constant s.

The amplification factor for the DuFort-Frankel scheme is

g =2scosk∆

1+2s± 1

1+2s

√1−4s2 +4s2 cosk∆

8.1.3 Three-level scheme

The general method suggest an approach such as

a f n+1j +b f n

j + c f n−1j −

(dLxx f n

j + eLxx f n−1j

)= 0

Page 4: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 148

Using this method and applying consistency yields theequation

1∆t

(1+ γ)(

f n+1j − f n

j

)− 1

∆tγ

(f n

j − f n−1j

)= α

[(1−β )Lxx f n

j +βLxx f n−1j

]The error resulting from this scheme is

Enj = αs∆x2

(12

+ γ +β − 112s

)∂ 4 f∂x4

∣∣∣∣nj+O

(∆x4) Symbolic representation of the

the-level scheme.

such that this scheme becomes 4th order accurate for β =−0.5− γ +1/12s. The equation for theamplification factor is

(1+ γ)g2− [1+2γ +2s(1−β )(cosk∆−1)]+ [γ−2β s(cosk∆−1)] = 0

The discussion of the parameter space is somewhat complicated but the general result is that thereis a stability limit with values of s increasing from about 0.35 to 5 if γis raised from 0 to about 6.

γ

s

0.5

0.4

0.3

2.0 4.0 6.0

stable

unstable

Figure 8.2: Illustration of the stability space for the three level scheme.

The truncation error for the previous methods for different grid resolution is shown in the followingtable. It illustrates that for specific values of s the simple FTCS and DuFort-Frankel methods canachieve 4th order accuracy.

8.1.4 Hopscotch method

This is a fairly original method which uses a two stage FTCS algorithm. Here we describe thetwo-dimensional variant.

In the first stage which is carried out for j + k +n = even the usual FTCS scheme is applied

Page 5: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 149

Table 8.1: RMS errors for different explicit schemes and varying parameters as a function of gridresolution.

Case s γ RMS RMS RMS approx.∆x = 0.2 ∆x = 0.1 ∆x = 0.05 conv. rate

FTCS 1/6 0.007266 0.00049 0.000033 3.9FTCS 0.3 0.6437 0.1634 0.0413 2.9FTCS 0.41 1.2440 0.3023 0.0755 2.0DuF-F 0.289 0.0498 0.00233 0.00012 4.3DuF-F 0.3 0.0244 0.0136 0.00395 1.8DuF-F 0.41 0.8481 0.2085 0.0525 2.03L-4th 0.3 0.0 0.0711 0.00416 0.00022 4.23L-4th 0.3 0.5 0.1372 0.00665 0.00029 4.53L-4th 0.3 1.0 0.2332 0.00916 0.00054 4.13L-4th 0.41 1.0 0.7347 0.0229 0.00140 4.0

∆ f n+1jk

∆t= αLxx f n

jk +αLyy f njk j + k +n = even

In the second stage the same scheme is applied but (a)now on all grid points with j+k+n = odd and (b) thesecond order derivative is using the newly computedtime level n + 1. This is possible now in an explicitmethod because all grid points adjacent to the one tobe updated have been updated in the first stage.

∆ f n+1jk

∆t= αLxx f n+1

jk +αLyy f n+1jk , j + k +n = odd

1. Stage schematic:

2. stage schematic:

The Figure above shows a schematic of the time update. The grid topology is shown in the follow-ing figure. Here the first stage updates for instance all grid points indicated in blue. The 2nd stagethen uses the spatial derivative from those grid points to update the orange points. The resultingpattern looks like a chess board.

Note that this method is not only very efficient and simple but also unconditionally stable (in 2dimensions?). The error associated with the scheme is O

(∆t,∆x2,∆y2).

8.2 Implicit methods

8.2.1 Fully implicit scheme

This method is equivalent to the FCTS method, however, with the 2nd derivative operator evaluatedat the new time level.

Page 6: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 150xyFigure 8.3: Representation of the grid topology used for the Hopscotch method.

∆ f n+1j

∆t= αLxx f n+1

j

Consistency yields

Enj =−∆t

2

(1+

16s

)∂ 4 f∂x4

∣∣∣∣nj+O

(∆x4)

and the amplification factor is

g =(

1+4ssin2(

k∆x2

))−1 Schematic of the fully implicitscheme.

which demonstrates that the scheme is unconditionally stable. The solution to this method can befound by solving

1+2s −s 0 0 0−s 1+2s −s 0 00 −s 1+2s −s 00 0 −s 1+2s −s0 0 0 −s 1+2s

f n+11

f n+12

f n+13

f n+14

f n+15

=

d1d2d3d4d5

of rank N corresponding to the number of grid points. The tridiagonal system is easily solved usingthe Thomas algorithm.

8.2.2 Crank-Nicholson scheme

This method uses a mixture of spatial derivative using time levels n and n+1.

Page 7: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 151

∆ f n+1j

∆t=

α

2Lxx

(f n

j + f n+1j

)which generates an error of order En

j = O(∆t2,∆x2). Note

that the scaling of ∆t2 in the error is caused by the centeredtime derivative. The equation for the amplification factor is

g−1+2sgsin2 k∆

2+2ssin2 k∆

2= 0 Schematic of the finite differ-

ence Crank-Nicholson schemeor

g =1−2ssin2 k∆

2

1+2ssin2 k∆

2

which implies unconditional stability.

Finite element Crank-Nicholson

Note that this is easily expanded to the finite elementCrank-Nicholson scheme by applying the correspondingmass operators to the time derivative term

1∆t

Mx∆ f n+1j = α

(12

Lxx f nj +

12

Lxx f n+1j

)Schematic of the finite elementCrank-Nicholson scheme

The Crank-Nicholson scheme can also be generalized in substituting the factors of 1/2 by a vari-able parameter in the following manner

∆ f n+1j

∆t= α

[(1−β )Lxx f n

j +βLxx f n+1j

]In this case the method is unconditionally stable for

0≤ β ≤ 12

and has the restriction

s≤ 12(1−2β )

if β > 0.5.

Page 8: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 152

8.2.3 Generalized three level schemes

Another generalization is to consider a weighted time differencing over three time levels:

(1+ γ)∆ f n+1j

∆t−

γ∆ f nj

∆t= α

[(1−β )Lxx f n

j +βLxx f n+1j

]where the particular choice

γ =12

β = 1

yields an error E = O(∆t2,∆x2) with unconditional stability.

Finally we can apply a generalized mass operator Mx = (δ ,1−2δ ,δ ) which yields

(1+ γ)Mx∆ f n+1

j

∆t− γMx

∆ f nj

∆t= α

[(1−β )Lxx f n

j +βLxx f n+1j

]Note that the Crank-Nicholson schemes are recovered us-ing γ = 0, β = 1/2. The FEM Crank-Nicholson scheme isrecovered in this case with δ = 1/6.The error for this scheme is

Enj = αs∆x2

(12

+ γ−β +δ −1/12

s

)∂ 4 f∂x4

∣∣∣∣nj+O

(∆x4)

Schematic of the general threelevel schemes

such that the scheme becomes fourth order accurate for

β =12

+ γ +δ −1/12

sThe algebraic equations for this scheme are

a j f n+1j−1 +b j f n+1

j + c j f n+1j+1 = (1+2γ)Mx f n

j − γMx f n−1j +(1−β )sL̂xx f n

j

ai = ci = (1+ γ)δ − sβ

b j = (1+ γ)(1−2δ )+2sβ

L̂xx f nj = f n

j−1−2 f nj + f n

j+1

The specific choice of δ = 1/12 yields fourth order accuracy for β = 12 + γ .

A summary on the methods implemented in the program Diffim.f of implicit schemes is given inthe next table.

The following table is a summary of the RMS error obtained for implicit methods with the programDiffim.f. All results use s = 1.0

Page 9: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 153

Method - me Mx β

1 - FDM-2nd order (0,1,0) 0.5+ γ

2 - FEM-2nd order (1/6,2/3,1/6) 0.5+ γ

3 - FDM-4th order (0,1,0) 0.5+ γ− 112s

4 - FEM-4th order (1/6,2/3,1/6) 0.5+ γ + 112s

5 - Composite (1/12,5/6,1/12) 0.5+ γ

Table 8.2: Overview of implicit methods implemented for the one-dimensional diffusion equation.

Method γ RMS RMS RMS approx.∆x = 0.2 ∆x = 0.1 ∆x = 0.05 conv. rate

1 0.0 0.3895 0.1466 0.03993 1.92 0.0 0.8938 0.1787 0.04185 2.13 0.0 0.2393 0.01526 0.00105 3.94 0.0 0.2393 0.01522 0.00090 4.15 0.0 0.2393 0.01525 0.00103 3.91 1.0 2.090 0.03003 0.03245 3.02 1.0 1.760 0.2475 0.04668 2.43 1.0 2.367 0.1246 0.00813 3.94 1.0 1.395 0.0927 0.00591 4.05 1.0 1.867 0.1087 0.00710 3.9

Table 8.3: RMS errors for different explicit schemes and varying parameters as a function of gridresolution.

8.2.4 Boundary conditions

Thus far we have mostly implied Dirichlet boundary conditions which are straightforward to im-plement. Von Neumann conditions provide more of a challenge. The most straightforward imple-mentation is a one sided difference (here for the boundary at xmin)

f n+12 − f n+1

1∆x

= cn+1

which yields an equation for the boundary value f n+11 . However, this gives only first order accuracy

while the overall methods usually give at least 2nd order accuracy.

Better approach: Introduce artificial (mathematical) boundary with j = 0 and

f n+12 − f n+1

0∆x

= cn+1

where cn+1 is the gradient of f at the boundary for time tn+1. For the FTCS scheme this gives

Page 10: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 154

f n+11 = (1−2s) f n

1 + s( f n2 + f n

0 )

= (1−2s) f n1 +2s

(f n2 − cn+1

∆x)

Similar for the fully implicit method this yields

(1+2s) f n+11 − s

(f n+12 + f n+1

0)

= f n1

or(1+2s) f n+1

1 −2s f n+12 = f n

1 −2scn+1∆x

Page 11: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 155

8.2.5 Summary on methods for the one-dimensional diffusion equation

Sche

me

Alg

ebra

iceq

uatio

nTr

unca

tion

erro

rA

mpl

.fac

torg

Stab

ility

FTC

S∆

fn+1

j ∆t

L xx

fn jE

n j=

α∆

x2 2

( s−1 6

) ∂4f

∂x4

∣ ∣ ∣n j1−

4ssi

n2( Θ 2

)s≤

1/2

DuF

ort-

Fran

kel

fn+1

j=

2s1+

2s

( fn j−1+

fn j+1) +

1−2s

1+2s

fn−1

jE

n j=

α∆

x2( s2−

1 12

) ∂4f

∂x4

∣ ∣ ∣n j

2sco

sΘ+(1−

4ssi

n2Θ)1/

2

1+2s

none

Cra

nk-N

icho

lson

∆fn+

1j ∆t

=α 2

L xx

( fn j+

fn+1

j

)E

n j=−

α∆

x2

12∂

4f

∂x4

∣ ∣ ∣n j

1−2s

sin2 (

Θ/2

)1+

2ssi

n2 (Θ

/2)

none

3lev

elim

plic

it3 2

∆fn+

1j ∆t−

1 2∆

fn j∆

t=

αL x

xfn+

1j

En j=−

α∆

x2

12∂

4f

∂x4

∣ ∣ ∣n j

1±4 3

i [3 16

+s(

1−co

sΘ) ]1/

2

2 [1+

4 3s(

1−co

sΘ) ]

none

FEM

Cra

nk-N

icho

lson

Mx

∆fn+

1j ∆t

=α 2

L xx

( fn j+

fn+1

j

)E

n j=

α∆

x2

12∂

4f

∂x4

∣ ∣ ∣n j

(2−

3s)+

(1+

3s)c

osΘ

(2+

3s)+

(1−

3s)c

osΘ

none

Rem

arks

s=

α∆

t∆

x2L x

x=

1∆

x2(1

,−2,

1)∆

fn+1

j=

fn+1

j−

fn j

Mx=

(1/

6,2/

3,1/

6)∆

fn j=

fn j−

fn−1

j

Page 12: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 156

8.3 Splitting schemes

8.3.1 ADI method

In two-dimensions implicit methods are usually computationally very expensive. Consider thetwo-dimensional version of the fully implicit method.

(1+2sx +2sy) f n+1jk − sx

(f n+1

j−1,k + f n+1j+1,k

)− sy

(f n+1

j,k−1 + f n+1j,k+1

)= f n

jk

The problem with this equation is the inversion of the matrix defined by the rhs of the equation.In the one-dimensional case the resulting matrix was a tridiagonal banded matrix. In the two-dimensional case the matrix is not anymore banded but has elements that are far offset off thediagonal even though the matrix is sparse. While there are some techniques to deal with sparesmatrices Gauss elimination is still rather and often prohibitively expensive.

The alternative to a fully implicit solution is the ADI method which is illustrated using the follow-ing basic equations.

f ∗jk− f njk

∆t/2−αxLxx f ∗jk−αyLyy f n

jk = 0

f n+1jk − f ∗jk

∆t/2−αxLxx f ∗jk−αyLyy f n+!

jk = 0

Here the ∗ in the first equation is interpreted as an auxiliary intermediate time level n + 1/2. Thecorresponding algebraic equations are cast in the form

−12

sx f ∗j−1,k +(1+ sx) f ∗jk−12

sx f ∗j+1,k =12

sy f nj,k−1 +(1− sy) f n

jk +12

sy f nj,k+1

−12

sy f n+1j,k−1 +(1+ sy) f n+1

jk −12

sy f n+1j,k+1 =

12

sx f ∗j−1,k +(1− sx) f ∗jk +12

sx f ∗j+1,k

Note that these equations are almost identical to the ones used for the corresponding elliptic equa-tion solver using the ADI scheme ((7.4) and (7.5)). These equations are used in two stages toevolve the system from time level n to time level n + 1. Note that - as in the prior introduction ofthe ADI scheme - each step requires only the solution of an implicit equation in one dimension.In the first step (equation) the system is solved for k considered fixed. Since the solution is soughtonly for the x grid, i.e., one-dimensional, the resulting matrices are banded tridiagonal and easy tosolve with the Thomas algorithm.

Similarly the second step is conducted only for the y grid (with x or j fixed) such that the secondstep also involves only one-dimension and thus the solution of a banded tridiagonal matrix.

The von Neumann stability analysis is used to determine an amplification factor for each half step.The product of the resulting amplification factors yields

Page 13: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 157k-1 k k+1j-1 j j+1 j-1 j j+1Figure 8.4: Schematic of the two stages of the simple finite difference ADI method.

g = g′g′′ =

[1−2sy sin2 (k∆y/2)1+2sx sin2 (k∆x/2)

][1−2sx sin2 (k∆x/2)1+2sy sin2 (k∆y/2)

]

which implies |g| ≤ 1 and therefore unconditional stability. The scheme has an error of O(∆t2,∆x2,∆y2).

Note that boundary conditions need to to be considered carefully to insure that the global errorindeed remains second order. Using Dirichlet conditions the evaluation of the boundary at xmax = 1for the intermediate step using

f ∗nx,k = bn+1/2k

yields an error of O(∆t). The correct approach for this boundary should be

f ∗nx,k =12(bn

k +bn+1k

)− 1

4∆tLyy

(bn

k +bn+1k

)8.3.2 Generalized two level scheme

As in the case of the one-dimensional schemes splitting schemes can easily be generalized byintroducing weights for the spatial and temporal derivatives at different time levels. For two timelevels this generalization is

∆ f n+1jk

∆t= (1−β ) [αxLxx +αyLyy] f n

jk +β [αxLxx +αyLyy] f n+1jk (8.1)

again with ∆ f n+1jk = f n+1

jk − f njk. One can rewrite this as an equation for ∆ f n+1

jk by moving the β

terms to the left side in the following manner

[1−β∆t (αxLxx +αyLyy)]∆ f n+1jk = ∆t (αxLxx +αyLyy) f n

jk

Page 14: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 158

Up to O(∆t2) this can be rewritten as

(1−β∆tαxLxx)(1−β∆tαyLyy)∆ f n+1jk = ∆t (αxLxx +αyLyy) f n

jk

where we have added a term β 2∆t2αxαyLxxLyy∆ f n+1jk which however is O

(∆t2). With the definition

∆ f ∗jk = (1−β∆tαyLyy)∆ f n+1jk one obtains the following two stage scheme:

(1) (1−β∆tαxLxx)∆ f ∗jk = ∆t (αxLxx +αyLyy) f njk

(2) (1−β∆tαyLyy)∆ f n+1jk = ∆ f ∗jk

Each of these steps only involves the inversion of a tridiagonally banded matrix.

Similar to the one-dimensional equivalent the resulting scheme is unconditionally stable for β ≥0.5 (also in 3D) and the resulting error is of the order O

(∆t2,∆x2,∆y2) for β = 0.5.

Note that an extension to three time levels is straightforward as in prior examples of one-dimensionalschemes

(1+ γ)∆ f n+1

jk

∆t− γ

∆ f njk

∆t= (1−β )

[αxLxx f n

jk +αyLyy f njk

]+β

[αxLxx f n+1

jk +αyLyy f n+1jk

]yields with some minor algebra

(1)(

1− β∆t1+ γ

αxLxx

)∆ f ∗jk =

∆t1+ γ

(αxLxx +αyLyy) f njk +

γ

1+ γ∆ f n

jk

(2)(

1− β∆t1+ γ

αyLyy

)∆ f n+1

jk = ∆ f ∗jk

Again this scheme requires only a one-dimensional implicit solution at each stage.

8.3.3 Finite element methods

Similar to one-dimensional implicit schemes it is straightforward to extend two or three-dimensionalimplicit schemes to finite elements. In general the inclusion of finite elements can be done using amass operator such that the diffusion equation in operator form becomes

Mx⊗My∂ f∂ t

∣∣∣∣jk

= αxMy⊗Lxx f jk +αyMx⊗Lyy f jk

Page 15: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 159k-1 k k+1j-1 j j+1 j-1 j j+1Figure 8.5: Schematic of the two stages of the two level finite difference ADI method.

where this operator for linear finite elements is given by Mx = (1/6,2/3,1/6) and as usual thesecond derivative operator is Lxx = 1

∆x2 (1,−2,1). Another way to express the operation is

Mx f jk =j+1

∑i= j−1

m ji fik , My f jk =k+1

∑m=k−1

f jmmmk

Applying the mass operator in combinations with the second derivative operator yields for instance

My⊗Lxx f jk =16

Lxx f j,k−1 +23

Lxx f j,k +16

Lxx f j,k+1

Note that one can further generalize the approach by using instead of the fem mass operator anoperator defined as Mx = (δ ,1−2δ ,δ ).

Using the mass operator for the two level scheme (8.1) yields

Mx⊗My∆ f n+1

jk

∆t= (αxMy⊗Lxx +αyMx⊗Lyy)

[(1−β ) f n

jk +β f n+1jk

]Similar to the finite difference two level scheme one can re-arrange terms (and add a term of orderO(∆t2)) to yield

(Mx−β∆tαxLxx) ⊗ (My−β∆tαyLyy) f n+1jk

= (Mx +(1−β )∆tαxLxx)⊗ (My +(1−β )∆tαyLyy) f njk (8.2)

Note that the terms proportional to ∆t2 have been added compared to the original equation whichlimits the accuracy to O

(∆t2) which, however was anyhow the accuracy of the original equation.

Similar to the finite difference approach one can now solve this equation in two stages

Page 16: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 160

(1) (Mx−β∆tαxLxx) f ∗jk = (My +(1−β )∆tαyLyy) f njk (8.3)

(2) (My−β∆tαyLyy) f n+1jk = (Mx +(1−β )∆tαxLxx) f ∗jk (8.4)

Here one can easily that this set of equations is identical to (8.2) by multiplying the second stageequation with (Mx−β∆tαxLxx) and insert f ∗jk from the first stage.

Note that the choice of β = 0.5 yields the ADI finite element method. The two level finite elementscheme with Mx = (δ ,1−2δ ,δ ) is unconditionally stable for

β ≥ 0.5+δ −0.25

s

for ∆x = ∆y and αx = αy.

Finally note that the finite element method can also easily be applied to a linear version computing∆ f n+1

jk instead of the equations (8.3) and (8.4). Equation (8.2) is easily re-written as

(Mx−β∆tαxLxx) ⊗ (My−β∆tαyLyy)∆ f n+1jk

= ∆t (αxMy⊗Lxx +αyMx⊗Lyy) f njk ≡ Rn

jk

which with the definition of ∆ f ∗jk = (My−β∆tαyLyy)∆ f n+1jk lends itself to the following two stage

splitting scheme

(1) (Mx−β∆tαxLxx)∆ f ∗jk = Rnjk

(2) (My−β∆tαyLyy)∆ f n+1jk = ∆ f ∗jkk-1 k k+1j-1 j j+1 j-1 j j+1

Figure 8.6: Schematic of the two stages of the two level finite element ADI method.

The scheme is basically identical with the nonlinear formulation. The advantage of the linearformulation is usually a better accuracy. The following figure shows a schematic of the finite

Page 17: Chapter 8 Diffusion Equation - University of Alaska systemhow.gi.alaska.edu/ao/sim/chapters/chap8.pdf · CHAPTER 8. DIFFUSION EQUATION 147 split into two time levels according to

CHAPTER 8. DIFFUSION EQUATION 161

element scheme. Different from the finite difference method the first stage involves all nodes inthe vicinity of j,k. The overall numerical effort of the various splitting schemes in two dimensionsis very comparable. Although the finite element method involve some more nodes for the 1st stagestep the difference with finite difference methods is not significant. Thus the eventual choice ismore determined by properties of thee resulting schemes.

Finally it is worth pointing out that one area of increased complexity is that of boundary conditions.These need to be formulated in agreement with the discretization and the solution method. Thuschoice of particular boundary conditions alters the algebraic equations at the boundaries and mustbe taken into account in the solution of the tridiagonal matrices for splitting schemes.