• Keine Ergebnisse gefunden

Finite Difference Approximations

N/A
N/A
Protected

Academic year: 2021

Aktie "Finite Difference Approximations"

Copied!
27
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Finite Difference Approximations

 Simple geophysical partial differential equations

 Finite differences - definitions

 Finite-difference approximations to pde‘s

Exercises

Acoustic wave equation in 2D

Seismometer equations

Diffusion-reaction equation

 Finite differences and Taylor Expansion

 Stability -> The Courant Criterion

 Numerical dispersion

dx

x f dx

x f f

x

) ( )

(  

(2)

)

( 2 2 2

2 2

y z

x

tp c p s

 The acoustic

wave equation - seismology

- acoustics

- oceanography - meteorology

Diffusion, advection, Reaction

- geodynamics - oceanography - meteorology - geochemistry - sedimentology

- geophysical fluid dynamics

P pressure

c acoustic wave speed

s sources

P pressure

c acoustic wave speed

s sources

p RC

C C

k

tC    v   

C tracer concentration k diffusivity

v flow velocity R reactivity

p sources

C tracer concentration k diffusivity

v flow velocity R reactivity

p sources

Partial Differential Equations in Geophysics

(3)

Finite differences

Finite volumes

- time-dependent PDEs

- seismic wave propagation - geophysical fluid dynamics - Maxwell’s equations

- Ground penetrating radar

-> robust, simple concept, easy to

parallelize, regular grids, explicit method

Finite elements - static and time-dependent PDEs

- seismic wave propagation - geophysical fluid dynamics - all problems

-> implicit approach, matrix inversion, well founded, irregular grids, more complex algorithms, engineering problems

- time-dependent PDEs

- seismic wave propagation - mainly fluid dynamics

Numerical methods: properties

(4)

Particle-based methods

Pseudospectral methods

- lattice gas methods

- molecular dynamics - granular problems - fluid flow

- earthquake simulations

-> very heterogeneous problems, nonlinear problems

Boundary element methods

- problems with boundaries (rupture)

- based on analytical solutions - only discretization of planes

-> good for problems with special boundary conditions (rupture, cracks, etc)

- orthogonal basis functions, special case of FD

- spectral accuracy of space derivatives

- wave propagation, ground penetrating radar -> regular grids, explicit method, problems with

Other numerical methods

(5)

What is a finite difference?

Common definitions of the derivative of f(x):

dx

x f dx

x f f

x dx

) ( )

lim (

0

 

dx

dx x

f x

f f

x dx

) (

) lim (

0

 

dx

dx x

f dx

x f f

x dx

2

) (

) lim (

0

 

These are all correct definitions in the limit dx->0.

But we want dx to remain FINITE

(6)

What is a finite difference?

The equivalent approximations of the derivatives are:

dx

x f dx

x f f

x

) ( )

(  

dx

dx x

f x

f f

x

) (

)

(  

dx

dx x

f dx

x f f

x

2

) (

)

(   

forward difference

backward difference

centered difference

(7)

The

big

question:

How good are the FD approximations?



This leads us to Taylor series....

(8)

Taylor Series

Taylor series are expansions of a function f(x) for some finite distance dx to f(x+dx)

What happens, if we use this expression for

dx

x f dx

x f f

x

) ( )

(  

?

...

)

! ( ) 4

! ( ) 3

! ( ) 2

( dx )

( )

(

' '''

4 '''

3 ''

2

'

   

dx f x

x dx f

x dx f

x f x

f dx

x

f

(9)

Taylor Series

... that leads to :

The error of the first derivative using the forward formulation is of order dx.

Is this the case for other formulations of the derivative?

Let’s check!

) ( )

(

...

)

! ( ) 3

! ( ) 2

( 1 dx

) ( )

(

'

3 ''' 2 ''

'

dx O x

f

x dx f

x dx f

x dx f

dx

x f dx

x f



 

   

 

(10)

... with the centered formulation we get:

The error of the first derivative using the centered approximation is of order dx2.

This is an important results: it DOES matter which formulation we use. The centered scheme is more accurate!

Taylor Series

) (

) (

...

)

! ( ) 3

( 1 dx

) 2 / (

) 2 / (

2 '

''' 3

'

dx O

x f

x dx f

x dx f

dx

dx x

f dx

x f

 

 

  

 

(11)

x

j 1

x

j

x

j 1

x

j 2

x

j 3

f x ( )

j

dx h

desired x location

What is the (approximate) value of the function or its (first, second ..) derivative at the desired location ?

How can we calculate the weights for the neighboring points?

x f(x)

Alternative Derivation

(12)

Lets’ try Taylor’s Expansion

f x ( ) dx

x f(x)

dx x f x

f dx

x

f (  )  ( )  ' ( ) (1) (2)

we are looking for something like

f

( )i

( ) x   w f x

( )i

( )

Alternative Derivation

dx x f x

f dx

x

f (  )  ( )  ' ( )

(13)

deriving the second-order scheme …

af

afaf dx ' bf

bfbf dx '

af

bf

 ( ab f )  ( ab f dx ) '

the solution to this equation for a and b leads to a system of equations which can be cast in matrix form

dx b

a

b a

/ 1

0

 0

1

b a

b a

Interpolation Derivative

2nd order weights

(14)

Taylor Operators

... in matrix form ...

 

 

 

 

 

 

 

 0

1 1

1

1 1

b a

Interpolation Derivative

... so that the solution for the weights is ...

 

 

 

 

 

 

 

b dx

a

/ 1

0 1

1

1 1

 

 

 

 

 

 

 

0 1 1

1

1

1

1

b a

 

 

 

 

 

 

 

dx b

a

/ 1

0 1

1

1

1

1

(15)

... and the result ...

Interpolation Derivative

Can we generalise this idea to longer operators?

 

 

 

 

 

2 / 1

2 / 1 b

a 

 

 

 

 

1 1 2

1 b dx

a

Let us start by extending the Taylor expansion beyond f(x±dx):

Interpolation and difference weights

(16)

''

! ' 3

) 2 '' (

! 2

) 2 ' ( ) 2 ( )

2 (

3 2

dx f dx f

f dx f

dx x

f

*a |

*b |

*c |

*d |

... again we are looking for the coefficients a,b,c,d with which the function values at x±(2)dx have to be multiplied in order to obtain the interpolated value or the first (or second) derivative!

... Let us add up all these equations like in the previous case ...

''

! ' 3

) '' (

! 2

) ' (

) ( )

(

3 2

dx f dx f

f dx f

dx x

f

''

! ' 3

) '' (

! 2

) ' (

) ( )

(

3 2

dx f dx f

f dx f

dx x

f

''

! ' 3

) 2 '' (

! 2

) 2 ' ( ) 2 ( )

2 (

3 2

dx f dx f

f dx f

dx x

f

Higher order operators

(17)

bf cf df

af

 )

(a b c d f

2 2 )

(

' a b c d

dxf

 2 )

2 2 2

( '

2

' b c d

a f

dx

6 ) 8 6

1 6

1 6

( 8 ' '

3

f ' a b c d

dx    

... we can now ask for the coefficients a,b,c,d, so that the left-hand-side yields either f,f’,f’’,f’’’ ...

Higher order operators

(18)

 1

b c d a

0 2

2    

a b c d

0 2 2

2  b 2  cda

6 0 8 6

1 6

1 6

8    

a b c d

... if you want the interpolated value ...

... you need to solve the matrix system ...

Linear system

(19)

High-order interpolation



 



 



 



 



 



 

0 0 0 1

6 / 8 6 / 1 6 / 1 6

/ 8

2 2

/ 1 2

/ 1 2

2 1

1 2

1 1

1 1

d c b a

...

with the result after inverting the matrix on the lhs

...



 



 



 



 

6 / 1

3 / 2

3 / 2

6 / 1

d c b a

...

Interpolation

...

(20)



 



 



 



 



 



 

0 0 / 1

0

6 / 8 6 / 1 6 / 1 6

/ 8

2 2

/ 1 2

/ 1 2

2 1

1 2

1 1

1 1

dx d

c b a

...

with the result

...



 

 



 

 

 



 

 



 

 

3 / 4

3 / 4

6 / 1 2

1 c dx

b a

...

first derivative

...

First derivative

(21)

Our first FD algorithm (ac1d.m) !

)

( 2 2 2

2 2

y z

x

tp c p s

P pressure

c acoustic wave speed

s sources

P pressure

c acoustic wave speed

s sources

Problem: Solve the 1D acoustic wave equation using the finite Difference method.

Problem: Solve the 1D acoustic wave equation using the finite Difference method.

Solution:

Solution:

 

2 2

2 2

) (

) ( 2

) (

) ( 2 )

( )

(

sdt dt

t p t

p

dx x

p x

p dx

x dx p

dt dt c

t p

(22)

Problems: Stability

 

2 2

2 2

) (

) ( 2

) (

) ( 2 )

( )

(

sdt dt

t p t

p

dx x

p x

p dx

x dx p

dt dt c

t p

 1

  dx

c dt

Stability: Careful analysis using harmonic functions shows that a stable numerical calculation is subject to special conditions (conditional stability). This holds for many numerical problems.

(Derivation on the board).

Stability: Careful analysis using harmonic functions shows that a stable numerical calculation is subject to special conditions (conditional stability). This holds for many numerical problems.

(Derivation on the board).

(23)

Problems: Dispersion

 

2 2

2 2

) (

) ( 2

) (

) ( 2 )

( )

(

sdt dt

t p t

p

dx x

p x

p dx

x dx p

dt dt c

t p

Dispersion: The numerical approximation has

artificial dispersion,

in other words, the wave speed becomes frequency dependent (Derivation in the board).

You have to find a frequency bandwidth

where this effect is small.

The solution is to use a sufficient number of grid Dispersion: The numerical approximation has

artificial dispersion,

in other words, the wave speed becomes frequency dependent (Derivation in the board).

You have to find a frequency bandwidth

where this effect is small.

The solution is to use a sufficient number of grid True velocity

(24)

Our first FD code!

 

2 2

2 2

) (

) ( 2

) (

) ( 2 )

( )

(

sdt dt

t p t

p

dx x

p x

p dx

x dx p

dt dt c

t p

% Time stepping for i=1:nt, % FD

disp(sprintf(' Time step : %i',i));

for j=2:nx-1

d2p(j)=(p(j+1)-2*p(j)+p(j-1))/dx^2; % space derivative end

pnew=2*p-pold+d2p*dt^2; % time extrapolation pnew(nx/2)=pnew(nx/2)+src(i)*dt^2; % add source term

pold=p; % time levels

p=pnew;

p(1)=0; % set boundaries pressure free p(nx)=0;

% Display plot(x,p,'b-') title(' FD ')

(25)

Snapshot Example

0 1000 2000 3000 4000 5000 6000

0 500 1000 1500 2000 2500 3000

Distance (km)

Time (s)

Velocity 5 km/s

(26)

Seismogram Dispersion

(27)

Finite Differences - Summary

 Conceptually the most simple of the numerical methods and can be learned quite quickly

 Depending on the physical problem FD methods are conditionally stable (relation between time and space increment)

 FD methods have difficulties concerning the accurate

implementation of boundary conditions (e.g. free surfaces, absorbing boundaries)

 FD methods are usually explicit and therefore very easy to implement and efficient on parallel computers

 FD methods work best on regular, rectangular grids

Referenzen

ÄHNLICHE DOKUMENTE

The numerical solution obtained by using our finite difference scheme with the non-reflecting boundary condition for multiple scattering problems on the artificial spherical

incompressible Navier–Stokes equations, finite difference, WENO schemes, non- incremental projection methods, incremental projection methods, PSPG-type stabilization.. The research

A new three point highly accurate nite dierence method for solving linear second order dierential equations is proposed.. The coecients of the scheme are constructed via

The higher order results as a combination between the spatial and time discretization method and the weighting factors in the splitting

If the regional accumulation pattern has been stable for the last several thousand years during the Holocene, and ice flow has been comparable to today, advective effects along

Whereas GPR sounding of glacier thickness is routinely deployed at polar and alpine sites, continuous internal radar reflec- tor mapping has been accomplished so far mostly on polar

Similar trends can be observed in the GPR image (Fig. 12) after processing: the blue line represents the concrete surface, the green line indicates the concrete-air interface of

After general processes, such as compensation for declined amplitude and filter plus special processes including speed analysis, de-convolution and displacement, the data