26
Numerical Methods for Partial Differential Equations CAAM 452 Spring 2005 Lecture 12 Instructor: Tim Warburton

Numerical Methods for Partial Differential Equations

  • Upload
    fagan

  • View
    49

  • Download
    5

Embed Size (px)

DESCRIPTION

Numerical Methods for Partial Differential Equations. CAAM 452 Spring 2005 Lecture 12 Instructor: Tim Warburton. Godunov Scheme Summary. To complete this scheme we now specify how to compute the slopes. Standard formulae:. With Limiting. - PowerPoint PPT Presentation

Citation preview

Page 1: Numerical Methods for Partial Differential Equations

Numerical Methods for Partial Differential Equations

CAAM 452

Spring 2005

Lecture 12

Instructor: Tim Warburton

Page 2: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

1 1

1

1

upwind: 0

Centered slope (Fromm): 2

Upwind slope (Beam-Warming):

Downwind slope (Lax-Wendroff):

ni

n nn i ii

n nn i ii

n nn i ii

q q

dx

q q

dx

q q

dx

Godunov Scheme Summary

• To complete this scheme we now specify how to compute the slopes.

• Standard formulae:

2 2

11 1

1

2 2n n n n n ni i i i i i

dx u dtq q udt q q u dt

dx

Page 3: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

With Limiting

1 1 1 1minmod ,minmod 2 ,22

n n n n n nn i i i i i ii

q q q q q q

dx dx dx

1 1min mod ,n n n n

n i i i ii

q q q q

dx dx

Minmod slope limiter:

Monotonized central-difference limiter (MC limiter)

Page 4: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Today

• More limiters

• Flux limiting function formulation.

• We will discuss Harten’s sufficient conditions for a numerical method (including limiter) to be TVD

• Sweby TVD diagrams for flux limiting functions.

• Extension to systems of linear PDE’s

• Extension to nonlinear PDE’s

Page 5: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Flux Formulation with Piecewise Linear Reconstruction

• Last time we showed how the ansatz of a piecewise linear reconstruction and Godunov’s method allowed us to compute the time averaged flux contribution at each end of the I’th cell

1

1/ 2 1/ 2

1,

2

n

n

tni i

t t

n ni i

F f q x t dtdt

uuq dx udt

1

1/ 2 1/ 2

1 1

1,

2

n

n

tni i

t t

n ni i

F f q x t dtdt

uuq dx udt

Notice: we can obtain the i-1/2 flux by setting i->i-1 in the i+1/2 flux formula(i.e. the flux formula is continuous at the cell boundary)

Page 6: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• Using this notation the scheme becomes:

• This is known as the flux formulation with piecewise reconstruction.

1

1 1 11/ 2 1/ 2

1/ 2 1/ 2

1 1

where:

1,

2

n

n

n n n ni i i i

tni i

t t

n ni i

dtq q F F

dx

F f q x t dtdt

uuq dx udt

Page 7: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• So far we have assumed u>0 but we can generalize this for u<0 using the same approach as before:

• To simplify this we write it as:

1 1

1/ 2

if 02

if 02

n ni i

ni

n ni i

uuq dx udt u

Fu

uq dx udt u

1/ 2 1 1/ 2

1/ 2 1

12

where:

, ,2 2

limited version of

n n n ni i i i

n n ni i i

u udtF u q u q

dx

u u u uu u

q q

Page 8: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• By writing the time interval averaged flux function in this way:

• We are philosophically moving away from a local cell reconstruction approach towards controlling the flux contribution from jumps in the averages between elements.

1/ 2 1 1/ 2

1/ 2 1

12

limited version of

n n n ni i i i

n n ni i i

u udtF u q u q

dx

q q

Page 9: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Flux Limiters

• The idea is: limit the flux of q between cells and you will subsequently limit spurious growth in the cell averages near discontinuities

• A general approach is to multiply the jump in cell averages by a limiting function:

1/ 2 1/ 2 1

11/ 2

1

where:

1 if 0

1 if 0

n n n ni i i i

n nn I Ii n n

i i

q q

q q

q q

i uI

i u

Page 10: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• The theta ratio can be thought of as a smoothness indicator near the cell interface at x_{i-1/2}.

• If the data is smooth we expect the ratio to be approximately 1 (except at extrema)

• Near a discontinuity we expect the ratio to be far away from 1.

• The flux limiting function, phi, will range between 0 and 2. The smaller it is, the more limiting is applied to a jump in cell averages. Above 1 it is being used to steepen the effective reconstruction.

11/ 2

1

1 if 0

1 if 0

n nn I Ii n n

i i

q q

q q

i uI

i u

Page 11: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont• Using this formulation we can recover the methods we have seen

before and some new limiters:

High-resolution lim

upwind: 0

Lax-Wendroff: 1

Beam-Warming:

1Fromm: 1

2

minmod: minmod 1,

superbee: max 0,min 1,2 ,m

Linear

in 2

it

methods

,

1+MC: max 0,min ,2,

e

:

s:

2

r

2

van Leer: 1

Page 12: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• Using this notation we can write down the scheme in terms of the flux limiter function ( ):

1/ 11 / 2 121

1

1

2n ni

n n ni i

n n ni i i

n ni i ii q qqq q qq q

Upwind schemeflux contibution

Limited downwindcell interface fluxcontribution

Limited upwind cell interfaceflux contribution

1/ 11 / 2 121

1

1

2n ni

n n ni

n n ni i i

ni i in

ii q q qqq q qq

u>0

u<0

udtdx

Page 13: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Harten’s Theorem

Theorem: Consider a general method of the form:

for one time step, where the coefficients C and D are arbitrary values (which in particular may depend on qbar in some way).

Then provided that the following conditions are satisfied:

11 1 1

n n n n n n n ni i i i i i i iq q C q q D q q

1n ni iTV q TV q

1 0

0

1

ni

ni

n ni i

C i

D i

C D i

Page 14: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Sweby Diagramshttp://locus.siam.org/fulltext/SINUM/volume-21/0721062.pdf

• We need to express the flux limited scheme:

• In the form:

• And then satisfying the Harten conditions will guarantee the method is TVD.

• An appropriate choice (which we can work with) is:

11 1 1

n n n n n n n ni i i i i i i iq q C q q D q q

1/ 11 / 2 121

1

1

2n ni

n n ni i

n n ni i i

n ni i ii q qqq q qq q

1/ 21 1/ 2

1/ 2

1

2

0

nin n

i ini

ni

C

D

Page 15: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• In this case since the D coefficients are zero and the Harten TVD conditions reduce to:

• This will hold if:• We can summarize this in terms of the minmod

function:• In addition we require:• See LeVeque p 116-118 for details

1

1/ 21/ 2 1/ 2

1/ 2

0 1

1i.e. 0 1

2

ni

ni n n

i ini

C

0 2 and 0 2 0

0 minmod 2,2 0

0 0

Page 16: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

i.e. any flux limiting function must satisfy:

to be TVD. Graphically, the shaded region is the TVD region:

Clearly non of these linear limiters generate a TVD scheme.

0 minmod 2,2 0

Lax-Wendroff

FrommBeam-Warming

1 2 3

1

2

upwind: 0

Lax-Wendroff: 1

Beam-Warming:

1Fromm: 1

2

Page 17: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

cont

• To guarantee second order accuracy and avoid excessive compression of solutions, Sweby suggested the following reduced portion of the TVD region as a suitable range for the flux limiting function:

1 2 3

1

2

http://locus.siam.org/fulltext/SINUM/volume-21/0721062.pdf

Page 18: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Minmod Flux Limiter on Sweby Diagram

1 2 3

1

2

minmod: minmod 1,

It is apparent that the minmod flux limiter applies the maximum possible limiting allowed within the second order TVD region.

(i.e. it will be rather dissipative and smear out discontinuities somewhat as seen on the right hand side figure).

Page 19: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Superbee Flux Limiter on Sweby Diagram

1 2 3

1

2

superbee: max 0,min 1,2 ,min 2,

The Superbee limiter applies the minimum limiting and maximum steepeningpossible to remain TVD. It is known to suffer from excessive sharpening ofslopes as a result. On the right we show what happens to a smooth sine wave after 20 periods.Notice the flattening of the peaks and the steepening of the slopes.

Page 20: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

MC Flux Limiter on Sweby Diagram

1 2 3

1

2

The MC limiter transitions from upwind (theta<0) to Fromm (at theta=1/3) then switches to a constant(at theta=3). This is a compromise between Superbee and minmod

1+MC: max 0,min ,2,2

2

Page 21: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

van Leer Flux Limiter

van Leer: 1

The van Leer limiter charts a careful compromise path throughthe Sweby TVD region.

Page 22: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Summary of Some Flux Limiting Functions

Nonlinear second orderTVD limiters

Linear non-TVD limiters

Page 23: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Implementation

• For u>0 the scheme looks like:

• We can easily achieve this in matlab:

1/ 11 / 2 121

1

1

2n ni

n n ni i

n n ni i i

n ni i ii q qqq q qq q

Page 24: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Matlab Version

This is a sample Matlab implementation of a piecewise linear reconstructed Godunov approach with a selection of flux limiters.

Available from the course home page:

http://www.caam.rice.edu/~caam452/CodeSnippets/fluxlimiter.m

With the initial condition supplied by:

http://www.caam.rice.edu/~caam452/CodeSnippets/fluxlimiterexact.m

Page 25: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Homework 4

Q1) Using N=80,160,320,640,1280 estimate the solution order of accuracy of theflux limited scheme:

with flux limiting functions: i. Fromm

ii. minmod iii. MCusing initial conditions: i. sin(pi*x) ii. sin(pi*x) + (abs(x-.5)<.25);on the periodic interval [-1,1).

Use the fluxlimiter.m Matlab code from the web page. You will also need to download fluxlimiterexact.m and minmod.m Measure error both using the maxmimum norm, l2 norm and finally themaximum norm with data points near the discontinuity excluded.Use error plots and tables with discussion to describe your results.

11 1/ 2 1 1/ 2 1

1

2n n n n n n n n n ni i i i i i i i i iq q q q q q q q

Page 26: Numerical Methods for Partial Differential Equations

CAAM 452 Spring 2005

Homework 4 cont

Q2a) Invent your own 2nd order TVD flux limiter function (i.e. a function with range contained in the Sweby TVD region)

Q2b) Modify sweby.m to plot your flux limiter function and compare with the limiter functions already used.

Q2c) Estimate order of accuracy for a smooth initial condition to the advection equation

Q2d) Estimate order of accuracy for a discontinuous initial condition to the advection equation

Q2e) Compare results (with diagrams,results and comments) and discuss how your limiter differs from the other limiters we have seen.