Unevenly Spaced Grid

Post on 28-Oct-2014

53 views 3 download

Tags:

Transcript of Unevenly Spaced Grid

Ae232a. © Tim Colonius 1

Finite difference schemes

•  Alternative to function approximations for (spatial) discretization of PDE

•  Collocation method is the limit of FD •  Related to Lagrange Poly

–  Similar to Lagrange Polynomial, but applied locally

•  Measure of errors – points per wavelength

Ae232a. © Tim Colonius 2

FD discretization of PDE Method of lines

•  Semi-discrete approach •  Approximate each term in the equation locally based on

function values at nearby points •  Not always unambiguous because continuous terms can

be written in different forms (e.g. apply chain rule), and discrete approximations do not necessarily obey these continuous identities

•  Different approximations usually needed for “interior” points than boundary or near-boundary points

•  Leads to a system of ODE

Ae232a. © Tim Colonius 3

Finite-difference Formulae:

•  Simplest to derive using Taylor-series expansion

Stencil Size: l+r+1

Ae232a. © Tim Colonius 4

Simply done in maple

Ae232a. © Tim Colonius 5

Classroom Note:Calculation of Weights in Finite Difference Formulas Bengt Fornberg, SIAM Rev. 40, 685 (1998)

Ae232a. © Tim Colonius 6

Notes

•  Higher order derivatives similar •  On evenly spaced grid, symmetry/antisymmetry for even/

odd derivatives automatically zeros the odd/even equations

•  “Biased” (no symmetry) schemes are useful for representing points near the ‘edge’ of a domain.

•  Construction of stencils larger than ~3 points need to be constructed with care due to instability.

•  Geometry handled by overset grids.

Ae232a. © Tim Colonius 7

Unevenly spaced grid

A better approach is to solve on a curvilinear grid

Geometry is handled by overset grids

Ae232a. © Tim Colonius 8

Ae232a. © Tim Colonius 9

Can we do better using same stencil?

•  Suppose we use derivatives at adjacent points in our formula

Ae232a. © Tim Colonius 10

Notes

•  Terminology: –  “Compact Finite Difference” –  “Padé Finite Difference” –  “Implicit Finite Difference”

•  Better accuracy and smaller stencil for same order •  Can play same games to derive forward/backward

biased schemes •  But….we have coupled terms on the LHS •  In matrix form:

Ae232a. © Tim Colonius 11

Solution

•  If we take at most L=R=1 tridiagonal matrix •  If we take at most L=R=2 penta-diagonal matrix

•  Still O(N) computations to compute the derivative •  More computations •  Bad for parallel computations •  Obvious question…is the better accuracy for, say, the 4th order

compact scheme (compared to explicit scheme) cost effective?

–  4 times smaller leading error –  E4 requires 3A + 2M per N –  C4 requires 3A + 3M per N

•  The answer is generally yes, but we will discuss more later

Ae232a. © Tim Colonius 12

Optimized Finite Difference Schemes

•  Note that we have used all of the coefficients to minimize the error in the limit of h 0.

•  Perhaps we should examine errors at finite h and see if we can choose (some or all of) the coefficients more wisely?

•  How do we examine error at finite h?

•  Need to pick a function (or class of functions)

•  How about cosine and sine?

Ae232a. © Tim Colonius 13

Fourier Analysis of Differencing Errors

•  Consider FD schemes applied to periodic problems •  Compare FD derivative to spectral derivative for each

wavenumber •  Later this analysis will be crucial in understanding the

stability of FD schemes

Ae232a. © Tim Colonius 14

Fourier analysis of differencing errors

•  For local approximations (Finite-difference) it is useful to compare results to Spectrally accurate method.

•  Analyze how accurate local differencing is for complex exponential at a given wavelength

•  Gives nonlocal information about error (i.e. information at all scales)

•  Rigorously restricted to periodic domains, but also useful as an approximate analysis for the interior of large domains

Ae232a. © Tim Colonius 15

The modified wavenumber

Ae232a. © Tim Colonius 16

Explicit formula for modified wavenumber

Ae232a. © Tim Colonius 17

Centered 1st Derivative Examples

3pt

5pt 7pt

Ae232a. © Tim Colonius 18

2 ppw

3pt

5pt

7pt

3 ppw 4 ppw 10 ppw

Points per wavelength

Ae232a. © Tim Colonius 19

Biased schemes

•  Have complex modified wavenumbers

Ae232a. © Tim Colonius 20

2nd Derivative Approximations (symmetric)

3 pt (2nd order)

5 pt (4th order)

7 pt (6th order)

Ae232a. © Tim Colonius 21

6th order compact (r=l=2, R=L=1),

6th order explicit (r=l=3,R=L=0)

4th order explicit (r=l=2,R=L=0)

4th order compact (r=l=1, R=L=1),

Compact schemes (1st deriv)

Ae232a. © Tim Colonius 22

The modified wavenumber (another derivation)

Ae232a. © Tim Colonius 23

The modified wavenumber

Ae232a. © Tim Colonius 24

Centered 1st Derivative Examples

3pt

5pt 7pt

6th order compact (r=l=2, R=L=1),

6th order explicit (r=l=3,R=L=0)

4th order explicit (r=l=2,R=L=0)

4th order compact (r=l=1, R=L=1),

Explicit schemes

Implicit (compact, Padé) schemes

Ae232a. © Tim Colonius 25

Optimized FD schemes

•  Choose some coefficients to give a certain order of accuracy

•  Choose some coefficients to give a good modified wavenumber relation:

–  e.g. Make k’=k at some particular points –  Minimize the error in k’-k

•  Choose some coefficients to give other desirable properties –  Efficiency? –  Low storage? –  Parallalizability? –  And so on

Ae232a. © Tim Colonius 26

Efficiency

•  Different schemes have different operation counts

•  Real cost is CPU time to compute a derivative, can be estimated with operation count

•  Weight PPW with operation count to get normalized cost –  Aside: scheme can also impact maximum stable time step for a

given PDE. The plot on the next page accounts for this for the model advection equation, ut + ux = 0

Ae232a. © Tim Colonius 27

Efficiency

Ref: Colonius & Lele, Prog. Aerosp. Science, 2005