numerical methods for partial differential equations

41
Numerical Methods for Partial Differential Equations CAAM 452 Spring 2005 Lecture 6 Various Finite Difference Discretizations for the Advection Equations – Phase and Dissipation Error Instructor: Tim Warburton

Upload: candra

Post on 20-Mar-2016

43 views

Category:

Documents


1 download

DESCRIPTION

Numerical Methods for Partial Differential Equations. CAAM 452 Spring 2005 Lecture 6 Various Finite Difference Discretizations for the Advection Equations – Phase and Dissipation Error Instructor: Tim Warburton. Note on AB3 Stability. Review: After Time Stepping… Back to PDE’s. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Numerical Methods for Partial Differential Equations

Numerical Methods for Partial Differential Equations

CAAM 452Spring 2005

Lecture 6Various Finite Difference Discretizations for the

Advection Equations – Phase and Dissipation ErrorInstructor: Tim Warburton

Page 2: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Note on AB3 Stability

3 2

2:(23 -16 5) /12

z zz z

iz re

Page 3: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Review: After Time Stepping… Back to PDE’s

• We have now proposed two quite distinct but reliable ways to advance an ODE approximately in time.

• But our original goal was to solve a PDE

• And not just for one mode.

u uct x

Page 4: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Review: Sample Points in Time Space

nt

u uct x

• We chose to sample the ODE at discrete points on the time axis.

• We can also make the same choice for the spatial representationat each discrete time level.

• We follow this choice with the dilemma of how to reconstruct anapproximation to the derivative of discretely sampled data.

•Assume c is positive

mx 1mx 1mx 2mx 2mx x

3mx 3mx

Page 5: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Review: Choice of Stencil

ntmx 1mx 1mx 2mx 2mx

x3mx 3mx

ntmx 1mx 1mx 2mx 2mx

x3mx 3mx

ntmx 1mx 1mx 2mx 2mx

x3mx 3mx

ntmx 1mx 1mx 2mx 2mx

x3mx 3mx

ntmx 1mx 1mx 2mx 2mx

x3mx 3mx

And many more combinations

Page 6: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Today: Delta Operators

We will consider the use of each of these difference formula(and more sophisticated versions) as approximations for the spatial derivatives.

We consider stability… by which we mean we will examine the eigenspectrum of the difference operator treated as a matrix.

We will use Gershgorin’s theorem frequently: http://mathworld.wolfram.com/GershgorinCircleTheorem.html

1

1

1 10 2

m mm

m mm

m mm

u uudx

u uudx

u uudx

Page 7: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Right Difference Matrix

• Consider a case with 10 points on a periodic interval:• The semi-discrete scheme for the advection equations is:

mm

du c udt

0 0

1 1

2 2

9 9

1 11 1

1 11 1

1 11 1

1 11 1

1 11 1

u uu uu u

d cdx dx

u u

Note: I used indexing from zero to match with classical definitions coming up.

Page 8: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Discrete Operator Matrix

• By Gerschgorin’s theorem we conclude that the matrix has all eigenvalues contained in the circle centered at -c/dx with radius c/dx

• Thus the eigenvalues are all in the left half plane, with the possible exception of one or more on the origin good candidate for time-stepping.

0 0

1 1

2 2

9 9

1 11 1

1 11 1

1 11 1

1 11 1

1 11 1

u uu uu u

d cdx dx

u u

Page 9: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• We can be more precise about the location of the eigenvalues of

• We first introduce the Fourier transform for the data vector:

• This is simply a linear, map applied to the vector of values with inverse given by:

21

nM imM

n mm

u u e

21

0

mM inM

m nn

u u eM

Page 10: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Fourier Transform in Matrix Notation

• Introducing the following notation for the Fourier transform matrix and a shift operator:

• We consider the following eigenvalue problem:

21

0

1

1

where :ˆ

if 1 if 1

nm M imM

n nm m nmm

nnm m

u u e

u n Mu

u n M

F F

R

1

k M

n nk nk k nk

cc u u udx

R I or c u udx

R I

Page 11: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Right Shift Matrix

• We write down explicitly what the right shift matrix is:

• Where the box around the addition operator indicates that this is addition modulo M

• This time the delta indicates the Kronecker Delta:• http://mathworld.wolfram.com/KroneckerDelta.html

1,nm n m

R

Page 12: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• We perform a similarity transform using the Fourier matrix:

• Becomes:

• We now consider the first term:

• First note (basic properties of the Fourier transform):

c u udx

R I

1c v vdx

F R I F

1FRF

2 2

1 1 and n nim imM M

nm nme e

M

F F

Page 13: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

1

2 21 1

1,0 0

2 121

0

22 21

0

2

1

1

nm

i nj i mkM MM M

j kj k

i m ji njMM M

j

i mi nj i mjMMM M

j

i mM

nm

e eM

e eM

e e eM

e

FRF

What we discover after some algebra(with slight liberties taken with the notation) is that the Fourier transform matrix diagonalizes the right shift matrix.

Page 14: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• Finally we return to the and can now find its eigenspectrum:

• Using

• We find that the matrix is diagonalized by the Fourier matrix and that

2

1i mM

nmnme

FRF

1c v vdx

F R I F

2

1 for 0,..., 1i mMc e m M

dx

Page 15: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Important Result: Fourier Transform of Right Shift Matrix

2

1i mM

nmnme

FRF

i.e. the Fourier (similarity) transform of the right shift matrix is a diagonal matrix

Page 16: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Left Difference Matrix

• Consider a case with 10 points on a periodic interval:• The semi-discrete scheme for the advection equations is:

mm

du c udt

0 0

1 1

2 2

9 9

1 11 1

1 11 1

1 11 1

1 11 1

1 11 1

u uu uu u

d cdx dx

u u

Page 17: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• Applying Gerschgorin this time we find that the eigenvalues are all in a disk centered at +c/dx with radius c/dx.

• This is bad news !.

• All the eigenvalues are in the right half plane, apart from the possiblity of a subset which are at the origin.

• i.e. any non zero mode will be unstable for time stepping operator (and clearly not physical)

Page 18: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Detailed Study of the Left Difference Operator Spectrum

• This time we introduce the left shift operator:

• This time the eigenvalue problem to consider is:

• Through a similar analysis (since the Fourier transform also diagonalizes the left shift matrix) we find:

• This confirms the Gerschgorin estimate.

, 1nm n m

L

cc u u udx

I L

2

1 for 0,..., 1i mMc e m M

dx

Page 19: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Important Result: Fourier Transform of Left Shift Matrix

2

1i mM

nmnme

FLF

i.e. the Fourier (similarity) transform of the left shift matrix is a diagonal matrix

Page 20: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Polynomials of Shift Matrices• We can express most finite difference operators as

polynomials of shift operators:

• We can apply the Fourier similarity transform to diagonalize this:

• Where is the vector of Fourier coefficents for u.• Hence each Fourier coefficient satisfies:

0 0

prj k

jkj k

du a udt

R L

1 1 1

0 0

pr j k

jkj k

dv a vdt

F FRF FLF F

1v uF

1 1 1

0 0

22 2

0 0 0 0

pr j k

jkj k

i m j ki mj i mkp pr rm M M M

jk m jk mj k j k

dv a vdt

dv a e e v a e vdt

F FRF FLF F

Page 21: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Centered Differencing

• We recall the centered difference operator can be expressed in terms of the left and right difference operators:

0

0

1

2 2

12

2

22sin 0,.., 1

2

im imM M

dxcc u u udx

c v vdx

c ic me e m Mdx dx M

R L

F R L F

0m

mdu c udt

Page 22: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• So the operator has purely imaginary eigenvalues

• As before we must resort to a time-stepping method which will in this case accommodate a portion of the imaginary axis.

2sin 0,.., 1ic m m Mdx M

0

Page 23: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

The 4th Order Central Difference Formula

• Recall the fourth order central difference formula:

• As for the central differencing formula all the eigenvalues are imaginary.

• We have used the diagonalizing property of the Fourier transform on polynomials of the shift matrices

2 1 1 2

2 2

2 2

8 812

8 812

ˆ 2ˆ8 8 where 12

ˆsin 2 8sin6

m m m m

mm m m m

i i i imm m

m m m

du c u u u udt dxdu c udt dxdu c me e e e udt dx M

ic udx

R R L L

0

22

4 0: 13!

mm m

du dxu udx

Page 24: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Summary of Mode Evolution

• Using:

• We write down the ODE satisfied by each discrete Fourier mode of the transformed data:

0

22

0

ˆ 1 ˆ

ˆ 1 ˆ

ˆ sin ˆ

ˆ1 8sin sin 2 ˆ6 6

m

m

imm

imm

mm m

mm m

dudu cc u e udt dt dx

dudu cc u e udt dt dx

dudu icc u udt dt dx

dudu dx icc udt dt dx

mu

2m

mM

Page 25: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Interpreting the ODEs

• We can assert an interpretation of multipliers in the ODE for each discrete Fourier mode.

• We know that the m’th mode has physical shapewhere L is the periodic length (L=M*dx)

• So (reverting back to our approach for turning a PDE into an ODE analytically) we would ideally be solving:

• Thus we can perform a small theta analysis of the multipliers in each of the cases we just derived.

2 mxiLe

2ˆ ˆmm

du mci udt L

Page 26: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

(1) Right Difference

2 3 44

2 3 44

2 3 44

ˆ 1 ˆ

12! 3! 4!

22! 3! 4!

22! 3! 4!

m

m

imm

i m m mm m

m m mm

m m mm

du c e udt dx

c ce i i Odx dx

c i m c i Odx M dx

ic m c i OL dx

2 31 222 1

0ˆ ˆmm ct m Oi ct dx ML

m mdx Mu u e e

The small theta analysis (low wave number) implies the solution will decay

Page 27: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

(2) Left Difference

2 3 44

2 3 44

2 3 44

ˆ 1 ˆ

12! 3! 4!

22! 3! 4!

22! 3! 4!

m

m

imm

i m m mm m

m m mm

m m mm

du c e udt dx

c ce i i Odx dx

c i m c i Odx M dx

ic m c i OL dx

3

21 2 122!0ˆ ˆ

mm ct Oi ctm

dx dxMLm mu u e e

The small theta analysis shows that the solution propagates and grows exponentially fast

Page 28: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

(3) Center Difference

35

35

35

ˆ sin ˆ

sin3!

23!

23!

mm m

mm m m

mm

mm

du ic udt dx

ic ic Odx dx

c i m ic Odx M dx

ic m ic OL dx

53

!2

30ˆ ˆm m

itm c Oi ci tdt d

m mx xLu u e e

The small theta analysis shows that the solution propagates and does not grow

Page 29: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

(4) 4th Order Center Difference

3 5 7

3 5 7

5 7

ˆ 8sin sin 2 ˆ6

1 188sin 3! 5!6 6 1 32sin 2 2 8

3! 5!2 24

6 5!

mm m m

m m m mm

mm m m m

m m

du ic udt dx

Oic icdx dx

O

ic m ic OL dx

5 74

!2

50ˆ ˆm m

itm c Oi cti tdx dxL

m mu u e e

Page 30: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Summary of Small Theta Analysis

• The dominant remainder term in this analysis relates to a commonly used, physically motivated description of the shortfall of the method:

33

3

3

2

5

2

5

12

2

2

2

0

1

425

4

3!

!

!

0ˆ ˆ

0ˆ ˆ

0ˆ ˆ

0ˆ ˆ

m

m

m

m

m

m

mtd

tm Oi ct dxLm m

tm c Oi ct dxLm m

itm c Oi ct dxLm m

i im c ti c

i t

t dx

tdx

m

x

x

L

d

m

du c u u u e edtdu c u u u e edtdu c u u u e edtdu c u u u e edt

7m

t Odx

Dissipative

Unstable

Dispersive

Dispersive

Page 31: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Terms

• The dominant error is dispersive if it causes different modes to travel at different speeds as with

• To leading order accuracy ctilde is the actual numerical wavespeed, compared with the physical advection speed

• The dominant error is dissipative if it reduces the wave amplitude over time as with

2 31 12

0ˆ ˆm m

m ct Oi ct dxLm m

dxu u e e

3 532 1 3

3!

2 13!0 1ˆ ˆ 2

m mm i mi ct ct OL dx dx m

m m

mL dxu u e e c c c Om mdx

L

0

Page 32: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Comparison of Multipliers

6

Page 33: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

The Imaginary Part

• We now see that for each of the methods has a dispersive nature (wave speed changes with wave number).

• Also, the imaginary part of the multiplier is not monotone and linear over [0, pi] or [pi,2*pi]

• Clearly there will be spurious modes (eigenvalues) which show up in the discrete spectrum as we saw last time.

Spurious modes

Page 34: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Recap Via a New Example

• There is a 6th order central difference scheme:

• We Fourier transform this:

2 42 2

6 0 16 30dx dx

1

2 41 2 2 1

6 0

2 41

0

2 41 1 1

0

1 1 1 1 1

1 1 1 1

16 30

16 30

16 30

sin 1 11 1 e 1 e 16 30

m mi imnm

dx dx

dx dx

dx dx

idx

F F F F F F F F F F F F

F F F F F F

F F F F

F F

F F F FF FF F

2 2e 1 em mi i

Page 35: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• We simplify this to:

• Compare with GKO p83.• The eigenvalues are all imaginary• Tedious Taylor expansion computations will reveal

an error O(theta^7)• Next we plot this dispersion relationship against the

other examples:

2 216

2 4

sin 1 11 1 e 1 e 1 e 1 e6 30

sin 2 81 sin sin3 2 15 2

m m m mi i i imnm

m m mnm

idx

idx

F F

Page 36: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Phase Error Plot

• It should be clear that the 6th order central difference operator is more accurate over a wider range of theta – but still prone to spurious eigenvalues.

Should be(1/6)*dx^2

Page 37: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Summary So Far

• We have established that for the advection equation it is not appropriate to use for the spatial derivative term (non-negative real part for multiplier).

• The other difference formulae are stable in this context:

• In this context is referred to as an upwind derivative – it uses a dissipative mechanism to remain stable.

• The given central difference operators are carefully designed so that their eigenvalues sit on the imaginary axis.

u uct x

0 4 6, , ,

Page 38: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• We have established that in each of the schemes we have replaced the exact ODE multiplier

• with an approximation, in this lecture denoted by:

• We found that this approximation is not uniform in wave number – i.e. there is a non monotonic dependence in m (embedded in the error terms).

• This explains our observation of the spurious eigenvalues in the computer evaluations of the spectrum of the discrete operator.

2i mcL

error termsmicdx

Page 39: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Recall Those Spurious Eigenvalues• What should the eigenvalues of the 4th order derivative operator

ideally tend to in the limiting of decreasing dx?• Example (10, 20, 80 points with the periodic length 2*pi):>> [dxDeigs, dxD] = test4th(10);>> dx = 2*pi/10; >> sort(dxDeigs/dx)

ans =

0.0000 - 0.0000i 0.0000 + 0.0000i 0.0000 - 0.9950i 0.0000 + 0.9950i 0 - 1.4996i 0 + 1.4996i 0 - 1.8623i 0 + 1.8623i -0.0000 - 2.1741i -0.0000 + 2.1741i

>> [dxDeigs, dxD] = test4th(20);>> dx = 2*pi/20;>> >> e = sort(dxDeigs/dx);>> e(1:10)

ans =

-0.0000 -0.0000 -0.0000 - 0.9997i -0.0000 + 0.9997i 0.0000 - 1.6233i 0.0000 + 1.6233i -0.0000 - 1.9901i -0.0000 + 1.9901i 0.0000 - 2.9290i 0.0000 + 2.9290i

>> [dxDeigs, dxD] = test4th(80);>> dx = 2*pi/80;>> e = sort(dxDeigs/dx);>> >> e(1:10)

ans =

0.0000 - 0.0000i 0.0000 + 0.0000i -0.0000 - 1.0000i -0.0000 + 1.0000i -0.0000 - 1.6639i -0.0000 + 1.6639i -0.0000 - 2.0000i -0.0000 + 2.0000i 0.0000 - 2.9997i 0.0000 + 2.9997i

Page 40: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Upwinding

• Recall: we referred to the differencing operator as the “upwind derivative”.

• This is due to the physical placement of the sampled data relative to the advection direction:

• i.e. the differencing only uses data from the upstream (upwind) direction.

• More on this next time.

mx 1mx 1mx 2mx 2mx x

3mx 3mx

Advection direction

Page 41: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Next Lecture

• Introduction of some standard finite-difference methods.

• Define (for finite difference schemes):1) Consistency2) Stability3) Accuracy4) Courant-Friedrichs-Lewy condition for stability

• We will examine convergence:1) Continuous time+discrete space (as seen today)2) Discrete time and discrete space3) Lax-Richtmyer equivalence theory (consistency+stability

convergence)