Finite difference methods An introduction - [Web site of · PDF file ·...

38
Finite difference methods An introduction Jean Virieux Professeur UJF 2012-2013 with the help of Virginie Durand

Transcript of Finite difference methods An introduction - [Web site of · PDF file ·...

Page 1: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Finite difference methods

An introduction

Jean Virieux

Professeur UJF

2012-2013

with the help of Virginie Durand

Page 2: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

A global vision Differential Calculus (Newton, 1687 & Leibniz 1684)

Find solutions of a differential equation (DE) of a dynamic system.

Chaos Systems (Poincaré, 1881) Find properties of solutions of the DE of a dynamic

system. Chaos & Stability (Smale, 1960)

Find properties of solutions of a physical system without knowing its DE

After the presentation of Etienne Ghys, 13 october 2009

This course is about the differential calculus using the finite difference approach familiar to Newton & Leibniz

Page 3: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Bibliography on Finite Difference Methods :A. Taflove and S. C. Hagness: Computational Electrodynamics: The Finite-

Difference Time-Domain Method, Third Edition, Artech House Publishers, 2005

O.C. Zienkiewicz and K. Morgan: Finite elements and approximmation, Wiley, New York, 1982

W.H. Press et al, Numerical recipes in FORTRAN/C …Cambridge University Press, USA, 20XX …

http://en.wikipedia.org/wiki/Finite-difference_time-domain_method

http://en.wikipedia.org/wiki/Upwind_scheme

http://en.wikipedia.org/wiki/Lax-Wendroff_method

Spice group in Europe : http://www.spice-rtn.org

FDTD introduction :

ftp://ftp.seismology.sk/pub/papers/FDM-Intro-SPICE.pdf

By P. Moczo, J. Kristek and L. Halada

Page 4: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

What is the main idea?• Coverage of the computational domain by a space-time grid

• Approximate derivatives and initial values at all grid points• Define boundary conditions at end points• Construct the linear algebraic system to be solved by the

computer

Page 5: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

The heat equation2

2

( , ) ( , ) ( , )u x t u x tk x tt x

k3,3 10-72 10-7

1,15 10-61,44 10-77,3 10-76,7 10-71,1 10-6k en m2/s

Sol humide (8%)Sol secGlaceEau

CalcaireBasalteGranite

k is the thermal diffusion coefficient

Replace partial derivatives by finite difference approximations leading to an algebraic system

u(x,t) ~ Uin where the index

i is for the discrete spatial position and n for the discrete time level

Page 6: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Other PDE in physics

2

2

( , ) ( , )( )u x t u x txt x

2 22

2 2

( , ) ( , )( )u x t u x tc xt x

2

2

( )( ) u xf xx

The scalar wave equation is a partial differential equation which belongs to second-order hyperbolic system.

2

2

( , )0 u x tx

2 22

2 2

( , ) ( , )( )u x t u x txt x

2

2

( , ) ( , )( )u x t u x txt x

Wave Equation

Fluid Equation

Diffusion Equation

Laplace Equation

Fractional derivative Equation

Time is involved in all physical processes except for the Laplace equation related to Newton law and mass distribution.

Poisson equation could be considered as well when mass is distributed inside the investigated volume

Poisson Equation

( , ) ( , )( ),u x t u x ta xt

tx

Advection Equation

Page 7: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Finite Difference Stencil

i-1 i i+1

(Leveque 1992)

centeredhUUUD

backwardhUUUD

forwardh

UUUD

iii

iii

iii

211

0

1

1

Truncations errors : 0h

Second derivative

iii UDUDDUDD 200

)2(1112

2iiii UUU

hUD

Higher-order terms : same procedure but you need more and more points

h

Page 8: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Finite difference approximation1

1

1 1

21 ( )2

i i

i i

i io

o

U UDh

U UDh

U UDh

D D D

forward

backward

centeredForward/backward first-order approximation

Centered second-order approximation

Higher-order approximations could be considered as well : more values !!!

Page 9: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Second-order accurate central-difference approximation

Leapfrog second-order accurate central-difference approximation

Leapfrog 4th-order accurate central-difference approximation

Stencil length

Duality between a function and its derivative

Page 10: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

xux

xux

xux

xuxuuxxu

nininininini 4

44

,3

33

,2

22

,,,1 2462

)(

xux

xux

xux

xuxuuxxu

nininininini 4

44

,3

33

,2

22

,,,1 2462

)(

xux

xuxuuu

nininini 4

44

,2

22

,,1,1 122

Discretisation and Taylor expansion

)(2 2

2,,1,1

,2

2

xx

uuuxu ninini

ni

Assuming an uniform discretisation x,t on the domain, we consider interpolation upto power 4

by summing, we cancel out odd terms

neglecting power 4 terms of the discretisation steps. We are left with quadratic interpolations, although cubic terms cancel out for precision.

Page 11: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Second derivatives2 1 1

2

2 1 1

2

1

i i i

i i i i

U U UDh

U U U UD D D D Dh h h

Various methods for evaluation of second derivatives

Taylor interpolation formulation related to Lagrande polynomials and, therefore, values are not restricted to nodes of a grid … we assume a smooth contribution of the numerical solution.

The solution of the heat equation has a numerical approximate solution

1 1

1 12

1 11 12

1 2

2

n nn n ni ii i i

n

n n n n ni i i i i

U U U U Ut x

tU U U U Ux

Page 12: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code
Page 13: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Stability: Errors are bounded during the computation of the solution.

Consistence: Truncation errors go to zero when discretisation gets smaller.

Is the numerical solution correct ?S

olution Accuracy Convergence: Numerical solutions go to the exact

solution as discretisation gets smaller.

Page 14: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Heterogeneous mediaWhen considering numerical methods, we often address the problem of complex media for which there is no analytical solution

Spatial derivatives of medium properties should be estimated

Decreasing the order of derivatives by adding auxiliairy variables which have often physical meanings ….

, ,,

, ,

,

Page 15: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Parsimonious approach1

1

1 1

11

2

2

n ni i

n ni

n nni i

i i i

ni

ii

U UR C FV Vt

UV

xUx

K

1 11 2 1 2

1 1 1 1

12

2

1

2

( )4

2 22

n n n n nni i i i i i i i i

i i

n n n ni i i i

i

n n i ini i

i i i

U

K KU UR C

U K U K U U K KR C F

U U U Ux x

xF

t

t x

Standard grid

Not exactly waht we want because of indices i+2 and i-2: we need to move to a mixed grid approach (duality between a function and its derivative)

Page 16: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Parsimonious approach1

1/ 2 1/ 21

1/ 2 1/ 21

n nn nni i

i i i

ni

i i

n ni

ii

U UR C Ft

V

V Vx

U Ux

K

1 11/ 2 1 1/ 2 1 1/ 2 1

1 1 1/ 2 1

/ 22

/1

21

( )

n n

n n i ini i

n n n n nni i i i

n

i i i

ni i i

i i i i ii i i

i

U

U U U Ux x

x

K KU U

U K U K U U K KR C

F

Ft x

R Ct

Staggered grid

or mixed grid approach

Same indices than the homogeneous case: arithmetic average coming from the physics behind …

Identify how to define jumps at an interface

Page 17: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Time marching procedure

1 11 12 2n n n n n n

i i i i i itU U U U U

x

i-1 i i+1

n-1

n

n+1

A very simple construction: estimation of a future value from present values and one past value.

Initial values:

Boundary values:

1 0iU

1 0 & 0n nLU U Dirichlet conditions

IS THAT ALL ?

Explicit centered scheme

Page 18: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Frequency approach

Finite Difference formulation leads to a linear system

1/ 2 1 1/ 2 1 1/ 2 1/ 22

( )i i i i i i ii i i i

K U K U K K Ui R CU Fx

WRITE ON THE BLACKBOARD THE LINEAR SYSTEM

Page 19: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

FIND A SOLUTION ?

In Time : marching approach

In Frequency : linear algebra

Page 20: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

ODE versus PDE formulations

GOAL : find ways to transform differential operators into algebraic operators in order to use linear algebra at the end

( ) ( ( , ), , )

( ) ( , ) ( , )

d y t A y x t x tdtd y t A x t y x tdt

( , ) ( ( , ), , )

( , ) ( , ) ( , )

y x t D y x t x tt

y x t D x t y x tt

O.D.E

Ordinary differential Equations

P.D.E

Partial Differential Equations

Linear

Non-linear

Symmetry between space and time ?

« simple » solution « complex » solution

Page 21: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

EXISTENCE & UNIQUENESS

The numerical problem is well posed usingHadamard criteria if the solution exists, isunique and depends continuously to initial/boundary conditions, to boundaries and coefficients of the differential equations

Von Neumann stability analysis for FD methods: numerical integration cannot go beyond physicaldistances of interaction.

For example, Courant-Friedrichs-Lewy CFL condition for wave propagation

Page 22: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

First-order hyperbolic equationuEx

uvt

xv

t

xc

tv

2

xuE

xtu

2

2

Let us define other variables for reducing the derivative order in both time and space

The 2nd order PDE became a 1st order PDE

This is true for any order differential equations: by introducing additionnal variables, one can reduce the level of differentiation. Among these different systems, one has a physical meaning

which becomes

xvE

t

xtv

1

Ec 2

with

stress

velocity

Other choices are possible as displacement-stress instead of velocity-stress.

Page 23: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code
Page 24: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Initial and boundary conditions

Boundary conditions u(0,t)

Initial conditions u(x,0)

Boundary conditions u(L,t)

1D string medium

Difficult to see how to discretize the velocity c(x) !

f(x,t)=s(t)r(x) Excitation condition

Dirichlet conditions on u

Neumann conditions on

, ,

Much better for handling heterogeneities, ,

, ,

Page 25: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code
Page 26: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code
Page 27: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code
Page 28: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

v=0

Page 29: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Source excitationImpulsive source: Ricker wavelet for example

1 2

Oscillatory source: Sinus wavelet for example

sin 22

Page 30: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Source radiation Directional source (hammer) Explosive source (dynamite)

Meaning for the string?

Application of of opposite sign forces on two nodes or a fictiousforce between two nodes

Page 31: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code
Page 32: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code
Page 33: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code
Page 34: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code
Page 35: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Simulation in a two-layer medium

c1=2000 m/s c2=4000 m/s - S=1 in the high-velocity layer

Radiation boundary condition

Code df1d.3.f

Page 36: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

Seismic propagation in the Angel Bay nearby Nice (France)

Earthquake of magnitude 4.9 at a depth of 8 km

Page 37: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

CONCLUSION Efficient numerical methods for

propagating seismic waves Time integration versus frequency

integration Competition between FE & FV for

modelling FD an efficient tool for imaging

Page 38: Finite difference methods An introduction - [Web site of · PDF file · 2012-10-24Finite difference methods An introduction Jean Virieux Professeur UJF ... n where the index ... Code

THANKS YOU !