You are on page 1of 61

Numerical methods

Specific methods:
• Finite differences
• Pseudospectral methods
• Finite volumes
Specific methods:
• Finite differences
• Pseudospectral methods
• Finite volumes
… applied to the acoustic wave equation …

Example: seismic wave propagation
Why numerical methods
Generally heterogeneous
medium
Seismometers
explosion
… we need numerical
solutions! … we need grids! …
And big computers …
Partial Differential Equations in Geophysics
) (
2 2 2
2 2
z
y x
t
s p c p
∂ + ∂ + ∂ · ∆
+ ∆ · ∂ 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 C
t
+ − ∇ • − ∆ · 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
Numerical methods: properties
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
-> robust, simple concept, irregular grids, explicit
method
Other Numerical methods:
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, GPR
-> regular grids, explicit method, problems with
strongly heterogeneous media
What is a finite difference?
Common definitions of the derivative of f(x):
dx
x f dx x f
f
dx
x
) ( ) (
lim
0
− +
· ∂

dx
dx x f x f
f
dx
x
) ( ) (
lim
0
− −
· ∂

dx
dx x f dx x f
f
dx
x
2
) ( ) (
lim
0
− − +
· ∂

These are all correct definitions in the limit dx->0.
But we want dx to remain FINITE
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
The big question:
How good are the FD approximations?
≈ ≠ ·
This leads us to Taylor series....
Our first FD algorithm (ac1d.m) !
) (
2 2 2
2 2
z
y x
t
s p c p
∂ + ∂ + ∂ · ∆
+ ∆ · ∂
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 p
dx
dt c
dt t p
+ − − +
− + − + · +
Problems: Stability
[ ]
2
2
2 2
) ( ) ( 2
) ( ) ( 2 ) ( ) (
sdt dt t p t p
dx x p x p dx x p
dx
dt c
dt t p
+ − − +
− + − + · +
1 ≈ ≤ε
dx
dt
c
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.
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.
Problems: Dispersion
[ ]
2
2
2 2
) ( ) ( 2
) ( ) ( 2 ) ( ) (
sdt dt t p t p
dx x p x p dx x p
dx
dt c
dt t p
+ − − +
− + − + · +
Dispersion: The numerical
approximation has
artificial dispersion,
in other words, the wave
speed becomes frequency
dependent.
You have to find a
frequency bandwidth
where this effect is small.
The solution is to use a
sufficient number of grid
points per wavelength.
Dispersion: The numerical
approximation has
artificial dispersion,
in other words, the wave
speed becomes frequency
dependent.
You have to find a
frequency bandwidth
where this effect is small.
The solution is to use a
sufficient number of grid
points per wavelength.
True velocity
Our first FD code!
[ ]
2
2
2 2
) ( ) ( 2
) ( ) ( 2 ) ( ) (
sdt dt t p t p
dx x p x p dx x p
dx
dt c
dt 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 ')
drawnow
end
Snapshot Example
0 1000 2000 3000 4000 5000 6000
0
500
1000
1500
2000
2500
3000
Distance(km)

T
i
m
e

(
s
)

Velocity5km/s
Seismogram Dispersion
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
• 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
Numerical Methods in Geophysics The Fourier Method
The Fourier Method
- What is a pseudo-spectral Method?
- Fourier Derivatives
- The Fast Fourier Transform (FFT)
- The Acoustic Wave Equation with the Fourier Method
- Comparison with the Finite-Difference Method
- Dispersion and Stability of Fourier Solutions
Numerical Methods in Geophysics The Fourier Method
What is a pseudo-spectral Method?
Spectral solutions to time-dependent PDEs are formulated
in the frequency-wavenumber domain and solutions are
obtained in terms of spectra (e.g. seismograms). This
technique is particularly interesting for geometries where
partial solutions in the ω -k domain can be obtained
analytically (e.g. for layered models).
In the pseudo-spectral approach - in a finite-difference like
manner - the PDEs are solved pointwise in physical space
(x-t). However, the space derivatives are calculated using
orthogonal functions (e.g. Fourier Integrals, Chebyshev
polynomials). They are either evaluated using matrix-
matrix multiplications or the fast Fourier transform (FFT).

Numerical Methods in Geophysics The Fourier Method
Fourier Derivatives



∞ −


∞ −

− ·

,
`

.
|
∂ · ∂
dk e k ikF
dk e k F x f
ikx
ikx
x x
) (
) ( ) (
.. let us recall the definition of the derivative using Fourier integrals ...
... we could either ...
1) perform this calculation in the space domain by convolution
2) actually transform the function f(x) in the k-domain and back
Numerical Methods in Geophysics The Fourier Method
The Fast Fourier Transform
... the latter approach became interesting with the introduction of the
Fast Fourier Transform (FFT). What’s so fast about it ?
The FFT originates from a paper by Cooley and Tukey (1965, Math.
Comp. vol 19 297-301) which revolutionised all fields where Fourier
transforms where essential to progress.
The discrete Fourier Transform can be written as
1 ,..., 1 , 0 , ˆ
1 ,..., 1 , 0 ,
1
ˆ
/ 2
1
0
/ 2
1
0
− · ·
− · ·



·


·
N k e u u
N k e u
N
u
N ikj
N
j
j k
N ikj
N
j
j k
π
π
Numerical Methods in Geophysics The Fourier Method
The Fast Fourier Transform
... this can be written as matrix-vector products ...
for example the inverse transform yields ...
]
]
]
]
]
]
]
]
]
]

·
]
]
]
]
]
]
]
]
]
]

]
]
]
]
]
]
]
]
]
]

− −
− −


1
2
1
0
1
2
1
0
) 1 ( 1
2 2 6 4 2
1 3 2
ˆ
ˆ
ˆ
ˆ
1
1
1
1 1 1 1 1
2
N N
N N
N
N
u
u
u
u
u
u
u
u




  
  
  



ω ω
ω ω ω ω
ω ω ω ω
.. where ...
N i
e
/ 2π
ω ·
Numerical Methods in Geophysics The Fourier Method
The Fast Fourier Transform
... the FAST bit is recognising that the full matrix - vector multiplication
can be written as a few sparse matrix - vector multiplications
(for details see for example Bracewell, the Fourier Transform and its
applications, MacGraw-Hill) with the effect that:
Number of multiplications Number of multiplications
full matrix FFT
N
2
2Nlog
2
N

this has enormous implications for large scale problems.
Note: the factorisation becomes particularly simple and effective
when N is a highly composite number (power of 2).
Numerical Methods in Geophysics The Fourier Method
The Fast Fourier Transform
.. the right column can be regarded as the speedup of an algorithm
when the FFT is used instead of the full system.
Number of multiplications Number of multiplications
Problem full matrix FFT Ratio full/FFT
1D (nx=512) 2.6x10
5
9.2x10
3
28.4
1D (nx=2096) 94.98
1D (nx=8384) 312.6
Numerical Methods in Geophysics The Fourier Method
Acoustic Wave Equation - Fourier Method
let us take the acoustic wave equation with variable density

,
`

.
|
∂ ∂ · ∂ p p
c
x x t
ρ ρ
1 1
2
2
the left hand side will be expressed with our
standard centered finite-difference approach
[ ]

,
`

.
|
∂ ∂ · − + − + p dt t p t p dt t p
dt c
x x
ρ ρ
1
) ( ) ( 2 ) (
1
2 2
... leading to the extrapolation scheme ...
Numerical Methods in Geophysics The Fourier Method
Acoustic Wave Equation - Fourier Method
where the space derivatives will be calculated using the Fourier Method.
The highlighted term will be calculated as follows:
) ( ) ( 2
1
) (
2 2
dt t p t p p dt c dt t p
x x
− − +

,
`

.
|
∂ ∂ · +
ρ
ρ
n
j x
n n n
j
P P ik P P ∂ → → → → →
−1
FFT
ˆ ˆ
FFT
υ υ υ
multiply by 1/ρ

,
`

.
|
∂ ∂ → →

,
`

.
|
∂ →

,
`

.
|
∂ → → ∂
− n
j x x
n
x
n
x
n
j x
P P ik P P
ρ ρ ρ ρ
υ
υ
υ
1
FFT
ˆ
1
ˆ
1
FFT
1
1
... then extrapolate ...
Numerical Methods in Geophysics The Fourier Method
Acoustic Wave Equation - 3D
) ( ) ( 2
1 1 1
) (
2 2
dt t p t p
p p p dt c
dt t p
z z y y x x
− − +

,
`

.
|

,
`

.
|
∂ ∂ +

,
`

.
|
∂ ∂ +

,
`

.
|
∂ ∂
· +
ρ ρ ρ
ρ
n
j x
n n n
j
P P ik P P ∂ → → → → →
−1
FFT
ˆ ˆ
FFT
υ υ υ

,
`

.
|
∂ ∂ → →

,
`

.
|
∂ →

,
`

.
|
∂ → → ∂
− n
j x x
n
x
n
x
n
j x
P P ik P P
ρ ρ ρ ρ
υ
υ
υ
1
FFT
ˆ
1
ˆ
1
FFT
1
1
.. where the following algorithm applies to each space dimension ...
Numerical Methods in Geophysics The Fourier Method
Comparison with finite differences - Algorithm
let us compare the core of the algorithm - the calculation of the
derivative
(Matlab code)
f u n c t i o n d f = f d e r 1 d ( f , d x , n o p )
% f D E R 1 D ( f , d x , n o p ) f i n i t e d i f f e r e n c e
% s e c o n d d e r i v a t i v e
n x = m a x ( s i z e ( f ) ) ;
n 2 = ( n o p - 1 ) / 2 ;
i f n o p = = 3 ; d = [ 1 - 2 1 ] / d x ^ 2 ; e n d
i f n o p = = 5 ; d = [ - 1 / 1 2 4 / 3 - 5 / 2 4 / 3 - 1 / 1 2 ] / d x ^ 2 ; e n d
d f = [ 1 : n x ] * 0 ;
f o r i = 1 : n o p ;
d f = d f + d ( i ) . * c s h i f t 1 d ( f , - n 2 + ( i - 1 ) ) ;
e n d
Numerical Methods in Geophysics The Fourier Method
Comparison with finite differences - Algorithm
... and the first derivative using FFTs ...
f u n c t i o n d f = s d e r 1 d ( f , d x )
% S D E R 1 D ( f , d x ) s p e c t r a l d e r i v a t i v e o f v e c t o r
n x = m a x ( s i z e ( f ) ) ;
% i n i t i a l i z e k
k m a x = p i / d x ;
d k = k m a x / ( n x / 2 ) ;
f o r i = 1 : n x / 2 , k ( i ) = ( i ) * d k ; k ( n x / 2 + i ) = - k m a x + ( i ) * d k ; e n d
k = s q r t ( - 1 ) * k ;
% F F T a n d I F F T
f f = f f t ( f ) ; f f = k . * f f ; d f = r e a l ( i f f t ( f f ) ) ;
.. simple and elegant ...
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Dispersion and Stability
... with the usual Ansatz
) ( dt n kjdx i n
j
e p
ω −
·
we obtain
) ( 2 2 ndt kjdx i n
j x
e k p
ω −
− · ∂
) ( 2
2
2
2
sin
4
ndt kjdx i n
j t
e
dt
dt
p
ω
ω

− · ∂
... leading to
2
sin
2 dt
cdt
k
ω
·
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Dispersion and Stability
What are the consequences?
a) when dt << 1, sin
-1
(kcdt/2) ≈ kcdt/2 and w/k=c
-> practically no dispersion
b) the argument of asin must be smaller than one.

2
sin
2 dt
cdt
k
ω
· )
2
( sin
2
1
kcdt
dt

· ω
636 . 0 / 2 /
1
2
max
≈ ≤

π dx cdt
cdt k
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 10Hz
Example of acoustic 1D wave simulation.
FD 3 -point operator
red-analytic; blue-numerical; green-difference

0 200 400 600
-0.5
0
0.5
1
Sourcetimefunction
0 10 20 30
0
0.5
1
Gaussinspace
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
-0.5
0
0.5
1
Time(sec)
3point - 2order; T=6.6s, Error =50.8352%
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 10Hz
Example of acoustic 1D wave simulation.
FD 5 -point operator
red-analytic; blue-numerical; green-difference

0 200 400 600
-0.5
0
0.5
1
Source time function
0 10 20 30
0
0.5
1
Gauss inspace
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
-0.5
0
0.5
1
Time (sec)
5 point - 2 order; T=7.8 s, Error =3.9286%
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 10Hz
Example of acoustic 1D wave simulation.
Fourier operator
red-analytic; blue-numerical; green-difference

0 200 400 600
-0.5
0
0.5
1
Sourcetimefunction
0 10 20 30
0
0.5
1
Gauss inspace
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
-1
-0.5
0
0.5
1
Time(sec)
Fourier - 2order; T=35s, Error =2.72504%
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 20Hz
Example of acoustic 1D wave simulation.
FD 3 -point operator
red-analytic; blue-numerical; green-difference

0 200 400 600
-0.5
0
0.5
1
Sourcetimefunction
0 10 20 30
0
0.5
1
Gaussinspace
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
-1
-0.5
0
0.5
1
Time(sec)
3point - 2order; T=7.8s, Error =156.038%
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 20Hz
Example of acoustic 1D wave simulation.
FD 5 -point operator
red-analytic; blue-numerical; green-difference

0 200 400 600
-0.5
0
0.5
1
Sourcetimefunction
0 10 20 30
0
0.5
1
Gaussinspace
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
-0.5
0
0.5
1
Time(sec)
5point - 2order; T=7.8s, Error =45.2487%
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - 20Hz
Example of acoustic 1D wave simulation.
Fourier operator
red-analytic; blue-numerical; green-difference

0 200 400 600
-0.5
0
0.5
1
Sourcetimefunction
0 10 20 30
0
0.5
1
Gaussinspace
0.8 0.9 1 1.1 1.2 1.3 1.4 1.5
-1
-0.5
0
0.5
1
Time(sec)
Fourier - 2order; T=34s, Error =18.0134%
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Comparison with FD - Table
0
20
40
60
80
100
120
140
160
5 Hz 10 Hz 20 Hz
3 point
5 point
Fourier
Difference (%) between numerical and analytical solution
as a function of propagating frequency
Simulation time
5.4s
7.8s
33.0s
Numerical Methods in Geophysics The Fourier Method
Numerical solutions and Green’s Functions
The concept of Green’s Functions (impulse responses) plays an
important role in the solution of partial differential equations. It is also
useful for numerical solutions. Let us recall the acoustic wave equation
p c p
t
∆ · ∂
2 2
with ∆ being the Laplace operator. We now introduce a delta source in
space and time
p c t x p
t
∆ + · ∂
2 2
) ( ) ( δ δ
the formal solution to this equation is
x
c x t
c
t x p
) / (
4
1
) , (
2

·
δ
π
(Full proof given in Aki and Richards, Quantitative Seismology, Freeman+Co, 1981, p. 65)
Numerical Methods in Geophysics The Fourier Method
Numerical solutions and Green’s Functions
In words this means (in 1D and 3D but not in 2D, why?) , that in
homogeneous media the same source time function which is input at the
source location will be recorded at a distance r, but with amplitude
proportional to 1/r.
An arbitrary source can evidently be constructed by summing up different
delta - solutions. Can we use this property in our numerical simulations?
What happens if we solve our numerical system with delta functions as
sources?
x
c x t
c
t x p
) / (
4
1
) , (
2

·
δ
π
Numerical Methods in Geophysics The Fourier Method
Numerical solutions and Green’s Functions
0 200 400 600 800 1000
0
0.2
0.4
0.6
0.8
1
0 200 400 600 800 1000
0
0.2
0.4
0.6
0.8
1
0 200 400 600 800 1000
0
0.2
0.4
0.6
0.8
1
3 point operator
5 point operator
Fourier Method
Time steps
Impulse response (analytical)
Impulse response (numerical
Source is a Delta
function in space and
time
500 1000 1500
0
1
2
3
4
5
6
7
8
9
10
500 1000 1500
0
1
2
3
4
5
6
7
8
9
10
500 1000 1500
0
1
2
3
4
5
6
7
8
9
10
Numerical Methods in Geophysics The Fourier Method
Numerical solutions and Green’s Functions
3 point operator 5 point operator Fourier Method
F
r
e
q
u
e
n
c
y

i
n
c
r
e
a
s
e
s
I
m
p
u
l
s
e

r
e
s
p
o
n
s
e

(
a
n
a
l
y
t
i
c
a
l
)

c
o
n
c
o
l
v
e
d

w
i
t
h

s
o
u
r
c
e
I
m
p
u
l
s
e

r
e
s
p
o
n
s
e

(
n
u
m
e
r
i
c
a
l

c
o
n
v
o
l
v
e
d

w
i
t
h

s
o
u
r
c
e
Numerical Methods in Geophysics The Fourier Method
Fourier Method - Summary
The Fourier Method can be considered as the limit of the finite-difference
method as the length of the operator tends to the number of points along
a particular dimension.
The space derivatives are calculated in the wavenumber domain by
multiplication of the spectrum with ik. The inverse Fourier transform
results in an exact space derivative up to the Nyquist frequency.
The use of Fourier transform imposes some constraints on the
smoothness of the functions to be differentiated. Discontinuities lead to
Gibb’s phenomenon.
As the Fourier transform requires periodicity this technique is particular
useful where the physical problems are periodical (e.g. angular
derivatives in cylindrical problems).

Finite Elements – the concept
How to proceed in FEM analysis:
• Divide structure into pieces (like LEGO)
• Describe behaviour of the physical quantities
in each element
• Connect (assemble) the elements at the nodes
to form an approximate system of equations
for the whole structure
• Solve the system of equations involving unknown
quantities at the nodes (e.g. displacements)
• Calculate desired quantities (e.g. strains and
stresses) at selected elements
Finite Elements – Why?
FEM allows discretization of bodies with arbitrary shape.
Originally designed for problems in static elasticity.
FEM is the most widely applied computer simulation method in
engineering.
Today spectral elements is an attractive new method with
applications in seismology and geophysical fluid dynamics
The required grid generation techniques are interfaced with
graphical techniques (CAD).
Today a large number of commercial FEM software is available
(e.g. ANSYS, SMART, MATLAB, ABACUS, etc.)
Finite Elements – Examples
Discretization – finite elements
As we are aiming to find a numerical solution to our problem it
is clear we have to discretize the problem somehow. In FE
problems – similar to FD – the functional values are known at a
discrete set of points.
... regular grid ...
... irregular grid ...
Domain D
The key idea in FE analysis is to approximate all
functions in terms of basis functions ϕ , so that
i
N
i
i
c u u ϕ

·
· ≈
1
~
Finite elements – basic formulation
Let us start with a simple linear system of equations
| * y
and observe that we can generally multiply both sides of
this equation with y without changing its solution. Note
that x,y and b are vectors and A is a matrix.
b Ax ·
n
y yb yAx ℜ ∈ · →
We first look at Poisson’s equation (e.g., wave equation
without time dependence)
) ( ) ( x f x u · ∆ −
where u is a scalar field, f is a source term and in 1-D
2
2
2
x ∂

· ∇ · ∆
Formulation – Poisson’s equation
fv uv · ∆ −
We now multiply this equation with an arbitrary function
v(x), (dropping the explicit space dependence)
... and integrate this equation over the whole domain. For
reasons of simplicity we define our physical domain D in
the interval [0, 1].
∫ ∫
· ∆ −
D D
fv uv
dx fv dx uv
∫ ∫
· ∆ −
1
0
1
0
... why are we doing this? ... be patient ...
Partial Integration
... partially integrate the left-hand-side of our equation ...
dx fv dx uv
∫ ∫
· ∆ −
1
0
1
0
[ ] dx u v uv dx uv
∫ ∫
∇ ∇ + ∇ · ∆ −
1
0
1
0
1
0
we assume for now that the derivatives of u at the boundaries vanish
so that for our particular problem
dx u v dx uv
∫ ∫
∇ ∇ · ∆ −
1
0
1
0

... so that we arrive at ...
... with u being the unknown function. This is also true for our
approximate numerical system
dx fv dx v u
∫ ∫
· ∇ ∇
1
0
1
0
... where ...
i
N
i
i
c u ϕ

·
·
1
~
was our choice of approximating u using basis functions.
dx fv dx v u
∫ ∫
· ∇ ∇
1
0
1
0
~
The basis functions
... otherwise we are
free to choose any
function ...
The simplest choice
are of course linear
functions:
+ grid nodes
blue lines – basis
functions ϕ
i
1
2
3
4
5
6
7
8
9
1 0
we are looking for functions ϕ
i
with the following property
¹
'
¹
≠ ·
·
·
i j x x for
x x for
x
j
i
i
, 0
1
) ( ϕ
The discrete system
The ingredients:
k
v ϕ ·
i
N
i
i
c u ϕ

·
·
1
~
dx fv dx v u
∫ ∫
· ∇ ∇
1
0
1
0
~
dx f dx c
k k
n
i
i i
ϕ ϕ ϕ
∫ ∫

· ∇
,
`

.
|

·
1
0
1
0
1
... leading to ...
The discrete system
dx f dx c
k k i
n
i
i
ϕ ϕ ϕ
∫ ∫

· ∇ ∇
·
1
0
1
0
1
... the coefficients c
k
are constants so that for one
particular function ϕ
k
this system looks like ...
k ik i
g A b ·
... probably not to your surprise this can be written in matrix form
k i
T
ik
g b A ·
The solution
... with the even less surprising solution
( )
k
T
ik i
g A b
1 −
·
remember that while the b
i
’s are really the coefficients of the
basis functions these are the actual function values at node points
i as well because of our particular choice of basis functions.
Basis functions and element
Linear
Quadratic
T
r
a
n
g
l
e
s
Q
u
a
d
r
a
n
g
l
e
s
The Acoustic Wave Equation 1-D
How do we solve a time-dependent problem such
as the acoustic wave equation?
where v is the wave speed.
using the same ideas as before we multiply this equation with
an arbitrary function and integrate over the whole domain, e.g. [0,1], and
after partial integration
f u v u
t
· ∆ − ∂
2 2
dx f dx u v dx u
j j j t
∫ ∫ ∫
· ∇ ∇ − ∂
1
0
1
0
2
1
0
2
ϕ ϕ ϕ
.. we now introduce an approximation for u using our previous
basis functions...
The Acoustic Wave Equation 1-D
) ( ) (
~
1
x t c u u
i
N
i
i
ϕ

·
· ≈
together we obtain
) ( ) (
~
1
2 2 2
x t c u u
i
N
i
i t t t
ϕ

·
∂ · ∂ ≈ ∂
note that now our coefficients are time-dependent!
... and ...





·
]
]
]

∇ ∇ +
]
]
]


1
0
1
0
2
1
0
2
j j
i
i i j
i
i i t
f dx c v dx c ϕ ϕ ϕ ϕ ϕ
which we can write as ...
Time extrapolation





·
]
]
]

∇ ∇ +
]
]
]


1
0
1
0
2
1
0
2
j j
i
i i j
i
i i t
f dx c v dx c ϕ ϕ ϕ ϕ ϕ
... in Matrix form ...
g c A v c M
T T
· +
2
 
M
A b
... remember the coefficients c correspond to the
actual values of u at the grid points for the right choice
of basis functions ...
How can we solve this time-dependent problem?
stiffness matrix
mass matrix
FD extrapolation
... let us use a finite-difference approximation for
the time derivative ...
g c A v c M
T T
· +
2
 
... leading to the solution at time t
k+1
:
g c A v
dt
c c c
M
k
T
k k
T
· +

,
`

.
|
+ −
− +
2
2
1 1
2
[ ]
1
2 2 1
1
2 ) ( ) (


+
− + − ·
k k k
T T
k
c c dt c A v g M c
we already know how to calculate the matrix A but
how can we calculate matrix M?
Matrix assembly
% assemble matrix Mij
M=zeros(nx);
for i=2:nx-1,
for j=2:nx-1,
if i==j,
M(i,j)=h(i-1)/3+h(i)/3;
elseif j==i+1
M(i,j)=h(i)/6;
elseif j==i-1
M(i,j)=h(i)/6;
else
M(i,j)=0;
end
end
end
% assemble matrix Aij
A=zeros(nx);
for i=2:nx-1,
for j=2:nx-1,
if i==j,
A(i,j)=1/h(i-1)+1/h(i);
elseif i==j+1
A(i,j)=-1/h(i-1);
elseif i+1==j
A(i,j)=-1/h(i);
else
A(i,j)=0;
end
end
end
M
ij
A
ij
Numerical example – regular grid
This is a movie obtained with the sample Matlab program: femfd.m
Finite Elements - Summary

FE solutions are based on the “weak form” of the partial
differential equations
• FE methods lead in general to a linear system of equations
that has to be solved using matrix inversion techniques
(sometimes these matrices can be diagonalized)
• FE methods allow rectangular (hexahedral), or triangular
(tetrahedral) elements and are thus more flexible in terms of
grid geometry

The FE method is mathematically and algorithmically more
complex than FD

The FE method is well suited for elasto-static and elasto-
dynamic problems (e.g. crustal deformation)

Why numerical methods
Example: seismic wave propagation

Seismometers

Generally heterogeneous medium

explosion

… we need numerical solutions! … we need grids! … And big computers …

Partial Differential Equations in Geophysics

∂2p = c 2 ∆ + s p t ∆ = (∂2 +∂2 +∂2 ) z x y
PP cc ss pressure pressure acoustic wave speed acoustic wave speed sources sources

The acoustic wave equation - seismology
- acoustics - oceanography - meteorology

∂ t C = k∆C − v • ∇C − RC + p
C C k k vv R R p p tracer concentration tracer concentration diffusivity diffusivity flow velocity flow velocity reactivity reactivity sources sources

Diffusion, advection, Reaction - geodynamics
- oceanography - meteorology - geochemistry - sedimentology - geophysical fluid dynamics

irregular grids. explicit method Finite elements .mainly fluid dynamics -> robust.all problems -> implicit approach.geophysical fluid dynamics .Numerical methods: properties Finite differences . matrix inversion. simple concept.time-dependent PDEs .static and time-dependent PDEs .time-dependent PDEs . easy to parallelize.geophysical fluid dynamics . irregular grids.seismic wave propagation . well founded. more complex algorithms.seismic wave propagation . regular grids. simple concept. explicit method . engineering problems Finite volumes .Maxwell’s equations .seismic wave propagation .Ground penetrating radar -> robust.

cracks.based on analytical solutions .wave propagation.only discretization of planes --> good for problems with special boundary conditions (rupture. explicit method. special case of FD .problems with boundaries (rupture) .orthogonal basis functions.lattice gas methods .Other Numerical methods: Particle-based methods . problems with strongly heterogeneous media .granular problems .molecular dynamics .spectral accuracy of space derivatives . GPR -> regular grids. nonlinear problems Boundary element methods . etc) Pseudospectral methods .fluid flow .earthquake simulations -> very heterogeneous problems.

But we want dx to remain FINITE .What is a finite difference? Common definitions of the derivative of f(x): f ( x + dx) − f ( x) ∂ x f = lim dx →0 dx f ( x) − f ( x − dx) ∂ x f = lim dx →0 dx f ( x + dx ) − f ( x − dx) ∂ x f = lim dx →0 2dx These are all correct definitions in the limit dx->0.

What is a finite difference? The equivalent approximations of the derivatives are: f ( x + dx) − f ( x) ∂x f ≈ dx + forward difference f ( x) − f ( x − dx) ∂x f ≈ dx − backward difference f ( x + dx) − f ( x − dx) ∂x f ≈ 2dx centered difference .

The big question: How good are the FD approximations? ≈≠= This leads us to Taylor series. ....

Our first FD algorithm (ac1d. Solution: Solution: c 2 dt 2 [ p ( x +dx ) −2 p ( x) + p ( x −dx )] p (t +dt ) = 2 dx +2 p (t ) − p (t −dt ) + sdt 2 .m) ! ∂2p = c 2 ∆ + s p t ∆ = (∂2 +∂2 +∂2 ) z x y PP cc ss pressure pressure acoustic wave speed acoustic wave speed sources sources Problem: Solve the 1D acoustic wave equation using the finite Problem: Solve the 1D acoustic wave equation using the finite Difference method. Difference method.

dt c ≤ ε ≈1 dx .Problems: Stability c 2 dt 2 [ p( x +dx ) −2 p( x) + p ( x −dx )] p (t +dt ) = 2 dx +2 p (t ) − p (t −dt ) + sdt 2 Stability: Careful analysis using harmonic functions shows that Stability: Careful analysis using harmonic functions shows that aastable numerical calculation is subject to special conditions stable numerical calculation is subject to special conditions (conditional stability). This holds for many numerical problems. (conditional stability). This holds for many numerical problems.

dependent. in other words. artificial dispersion. You have to find aa You have to find frequency bandwidth frequency bandwidth where this effect is small. where this effect is small. the wave in other words. The solution is to use aa The solution is to use sufficient number of grid sufficient number of grid points per wavelength. True velocity . points per wavelength. the wave speed becomes frequency speed becomes frequency dependent.Problems: Dispersion c 2 dt 2 [ p( x +dx ) −2 p( x) + p ( x −dx )] p (t +dt ) = 2 dx +2 p (t ) − p (t −dt ) + sdt 2 Dispersion: The numerical Dispersion: The numerical approximation has approximation has artificial dispersion.

Our first FD code! c 2 dt 2 [ p( x +dx ) −2 p( x) + p ( x −dx )] p (t +dt ) = 2 dx +2 p (t ) − p (t −dt ) + sdt 2 % Time stepping for i=1:nt. % FD disp(sprintf(' Time step : %i'. % time extrapolation pnew(nx/2)=pnew(nx/2)+src(i)*dt^2. p(1)=0. % set boundaries pressure free p(nx)=0. % time levels p=pnew. % space derivative end pnew=2*p-pold+d2p*dt^2. % Display plot(x.'b-') title(' FD ') drawnow end .i)).p. for j=2:nx-1 d2p(j)=(p(j+1)-2*p(j)+p(j-1))/dx^2. % add source term pold=p.

Snapshot Example V lo ity5k /s ec m 30 00 20 50 20 00 T e (s) im 10 50 10 00 50 0 0 0 10 00 20 00 30 00 D ta c ( m is ne k ) 40 00 50 00 60 00 .

Seismogram Dispersion .

Summary •• •• •• •• •• Conceptually the most simple of the numerical methods and Conceptually the most simple of the numerical methods and can be learned quite quickly can be learned quite quickly Depending on the physical problem FD methods are Depending on the physical problem FD methods are conditionally stable (relation between time and space conditionally stable (relation between time and space increment) increment) FD methods have difficulties concerning the accurate FD methods have difficulties concerning the accurate implementation of boundary conditions (e. free surfaces.g.Finite Differences . implementation of boundary conditions (e. free surfaces. rectangular grids FD methods work best on regular.g. rectangular grids . absorbing boundaries) absorbing boundaries) FD methods are usually explicit and therefore very easy to FD methods are usually explicit and therefore very easy to implement and efficient on parallel computers implement and efficient on parallel computers FD methods work best on regular.

Dispersion and Stability of Fourier Solutions Numerical Methods in Geophysics The Fourier Method .What is a pseudo-spectral Method? .The Fourier Method .The Fast Fourier Transform (FFT) .Fourier Derivatives .Comparison with the Finite-Difference Method .The Acoustic Wave Equation with the Fourier Method .

Numerical Methods in Geophysics The Fourier Method . In the pseudo-spectral approach . the space derivatives are calculated using orthogonal functions (e.What is a pseudo-spectral Method? Spectral solutions to time-dependent PDEs are formulated in the frequency-wavenumber domain and solutions are obtained in terms of spectra (e.g.the PDEs are solved pointwise in physical space (x-t). Chebyshev polynomials). seismograms). They are either evaluated using matrixmatrix multiplications or the fast Fourier transform (FFT).in a finite-difference like manner . for layered models).g. Fourier Integrals. This technique is particularly interesting for geometries where partial solutions in the ω -k domain can be obtained analytically (e.g. However.

we could either ..... ∞  − ikx ∂ x f ( x) = ∂ x  ∫ F (k )e dk     −∞  = − ∫ ikF (k )e −ikx dk −∞ ∞ ..Fourier Derivatives . let us recall the definition of the derivative using Fourier integrals . 1) perform this calculation in the space domain by convolution 2) actually transform the function f(x) in the k-domain and back Numerical Methods in Geophysics The Fourier Method ...

... N −1 Numerical Methods in Geophysics The Fourier Method . The discrete Fourier Transform can be written as 1 ˆ uk = N N −1 j =0 u j e −2πikj / N . Math.. N −1 ∑ j =0 N −1 ˆ u k = ∑u j e 2πikj / N . k = 0. the latter approach became interesting with the introduction of the Fast Fourier Transform (FFT)...The Fast Fourier Transform .. vol 19 297-301) which revolutionised all fields where Fourier transforms where essential to progress. Comp. k = 0..1.. What’s so fast about it ? The FFT originates from a paper by Cooley and Tukey (1965.1..

.. where . ω = e 2πi / N Numerical Methods in Geophysics The Fourier Method . 1 1 1 ω  1 ω 2       N −1 1 ω  1 1 ω2 ω4 ω3 ω6   ˆ   u0   u0  ˆ  ω N −1   u1   u1      2 N −2 ˆ  u2   u2   ω =                    ( N −1) 2    ω  u N −1  u N −1   ˆ     1 . for example the inverse transform yields .The Fast Fourier Transform ........ this can be written as matrix-vector products .

MacGraw-Hill) with the effect that: Number of multiplications full matrix N2 FFT 2Nlog2N this has enormous implications for large scale problems. Numerical Methods in Geophysics The Fourier Method . the Fourier Transform and its applications.. the FAST bit is recognising that the full matrix .The Fast Fourier Transform . Note: the factorisation becomes particularly simple and effective when N is a highly composite number (power of 2).vector multiplication can be written as a few sparse matrix ..vector multiplications (for details see for example Bracewell.

6x105 FFT 9.98 312..2x103 Ratio full/FFT 28.The Fast Fourier Transform Number of multiplications Problem 1D (nx=512) 1D (nx=2096) 1D (nx=8384) full matrix 2.4 94. Numerical Methods in Geophysics The Fourier Method . the right column can be regarded as the speedup of an algorithm when the FFT is used instead of the full system.6 .

.Acoustic Wave Equation .. leading to the extrapolation scheme .. Numerical Methods in Geophysics The Fourier Method ..Fourier Method let us take the acoustic wave equation with variable density 1  1 2  ∂x p  ∂t p = ∂x  2  ρ c ρ  the left hand side will be expressed with our standard centered finite-difference approach 1 ρ 2 dt c   [ p(t +dt ) −2 p(t ) + p (t −dt )] = ∂x  1 ∂x p  2   ρ  .

Fourier Method 1   ∂x p  +2 p (t ) − p (t −dt ) p (t +dt ) = ρ dt ∂x  c  ρ  2 2 where the space derivatives will be calculated using the Fourier Method..Acoustic Wave Equation ... then extrapolate . Numerical Methods in Geophysics The Fourier Method . The highlighted term will be calculated as follows: ˆ Pjn →FFT →P n → υP n →FFT ik ˆυ υ multiply by 1/ρ n n − 1 →∂x Pjn  1 ˆ  1 ˆ 1 1 n −1 n ∂ x Pj → FFT →  ∂ x P  → ikυ  ∂ x P  → FFT → ∂ x  ∂ x Pj  ρ  ρ  ρ  ρ  υ  υ   ..

3D p (t + dt ) =  1  1  1   ∂x  ∂x p  + ∂ y  ∂ y p  + ∂z  ∂z p  ρc dt    ρ  ρ  ρ        + 2 p (t ) − p (t − dt ) 2 2 . where the following algorithm applies to each space dimension . ˆ Pjn →FFT →P n → υP n →FFT ik ˆυ υ n n − 1 →∂x Pjn  1 ˆ  1 ˆ 1 1 n −1 n ∂ x Pj → FFT →  ∂ x P  → ikυ  ∂ x P  → FFT → ∂ x  ∂ x Pj  ρ  ρ  ρ  ρ  υ  υ   Numerical Methods in Geophysics The Fourier Method ..Acoustic Wave Equation ...

Algorithm let us compare the core of the algorithm . n2=(nop-1)/2. end if nop==5.dx.*cshift1d(f. end Numerical Methods in Geophysics The Fourier Method . if nop==3. end df=[1:nx]*0.the calculation of the derivative (Matlab code) function df=fder1d(f. d=[-1/12 4/3 -5/2 4/3 -1/12]/dx^2. for i=1:nop. df=df+d(i).nop) finite difference % second derivative nx=max(size(f)).nop) % fDER1D(f.dx.-n2+(i-1)). d=[1 -2 1]/dx^2.Comparison with finite differences .

simple and elegant . for i=1:nx/2. k(i)=(i)*dk.dx) % SDER1D(f. df=real(ifft(ff))... Numerical Methods in Geophysics The Fourier Method .. % initialize k kmax=pi/dx. % FFT and IFFT ff=fft(f).Comparison with finite differences . end k=sqrt(-1)*k..*ff. and the first derivative using FFTs .Algorithm .. .dx) spectral derivative of vector nx=max(size(f)). k(nx/2+i)=-kmax+(i)*dk.. function df=sder1d(f. dk=kmax/(nx/2).. ff=k.

leading to 2 ωdt k= sin cdt 2 Numerical Methods in Geophysics The Fourier Method ....Fourier Method . with the usual Ansatz p =e n j i ( kjdx −nω ) dt we obtain ∂ p = −k e 2 x n j 2 t n j 2 i ( kjdx −ωndt ) 4 2 ωdt i ( kjdx −ωndt ) ∂ p = − 2 sin e dt 2 .Dispersion and Stability ..

Dispersion and Stability 2 ωdt k= sin cdt 2 2 −1 kcdt ω = sin ( ) dt 2 What are the consequences? a) when dt << 1.Fourier Method .636 Numerical Methods in Geophysics The Fourier Method . k max cdt ≤1 2 cdt / dx ≤ 2 / π ≈ 0. sin-1 (kcdt/2) ≈ kcdt/2 and w/k=c -> practically no dispersion b) the argument of asin must be smaller than one.

Comparison with FD .8 5 % o t r e..4 1 .5 0 .9 1 1 .3 1 .Fourier Method . = .5 0 0 . green-difference Numerical Methods in Geophysics The Fourier Method . FD 3 -point operator red-analytic.8 0 ..1 1 .5 0 0 0 1 Gusins a e as p c 0 20 0 40 0 60 0 1 0 2 0 3 0 3p in-2od r T 6 s Er r=5 . blue-numerical. ro 0 3 2 1 0 .2 T e( e ) im s c 1 .5 0 .5 Example of acoustic 1D wave simulation.5 0 .10Hz S uc tim fuc n o r e e ntio 1 0 .6 .

5 0 .5 0 -0 . rro .5 0 -0 .8 0 .5 0 .5 Example of acoustic 1D wave simulation.8 .9 8 % 1 G u sins a e as pc 0 2 0 3 0 1 0 .1 1 .4 1 . green-difference Numerical Methods in Geophysics The Fourier Method .3 1 . blue-numerical.10Hz S u etim fu c n o rc e n tio 1 0 .5 0 20 0 40 0 60 0 0 1 0 5p in -2o e T=7 s E r=3 2 6 ot rd r. . FD 5 -point operator red-analytic.9 1 1 .2 T e(s c im e ) 1 .Fourier Method .Comparison with FD .

..5 0 1 0 .5 0 .Fourier Method .4 1 .7 5 4 1 0 .5 Example of acoustic 1D wave simulation.1 1 . = 5 .9 1 1 .8 0 .5 0 .3 1 . Fourier operator red-analytic. green-difference Numerical Methods in Geophysics The Fourier Method .Comparison with FD .10Hz S uc tim fuc n o r e e ntio 1 0 . blue-numerical.5 0 . ro .5 0 0 0 1 Gusins a e as p c 0 20 0 40 0 60 0 1 0 2 0 3 0 F uie -2od r T 3 s Er r=2 2 0 % o r r r e.2 T e( e ) im s c 1 .

5 Example of acoustic 1D wave simulation.5 0 0 0 1 Gusins a e as p c 0 20 0 40 0 60 0 1 0 2 0 3 0 3p in-2od r T 7 s Er r=1 6 3 % o t r e.. FD 3 -point operator red-analytic. ro 5 .8 .5 0 .9 1 1 . blue-numerical. green-difference Numerical Methods in Geophysics The Fourier Method .8 0 .2 T e( e ) im s c 1 .5 0 1 0 .Fourier Method .5 0 .1 1 .20Hz S uc tim fuc n o r e e ntio 1 0 .0 8 1 0 .4 1 .5 0 .Comparison with FD ..3 1 . = .

Comparison with FD .8 .1 1 .2 T e( e ) im s c 1 .9 1 1 .5 Example of acoustic 1D wave simulation.5 0 0 0 1 Gusins a e as p c 0 20 0 40 0 60 0 1 0 2 0 3 0 5p in-2od r T 7 s Er r=4 . green-difference Numerical Methods in Geophysics The Fourier Method . ro 5 4 7 1 0 .8 0 . FD 5 -point operator red-analytic.3 1 .Fourier Method .2 8 % o t r e.5 0 0 . blue-numerical..20Hz S uc tim fuc n o r e e ntio 1 0 .5 0 .4 1 . = .5 0 ..5 0 .

1 1 .5 0 .4 1 .3 1 . green-difference Numerical Methods in Geophysics The Fourier Method .Comparison with FD .5 0 1 0 .Fourier Method . = 4 .5 0 1 Gusins a e as p c 0 0 20 0 40 0 60 0 0 1 0 F uie -2od r T 3 s Er r=1 .8 0 . Fourier operator red-analytic.2 T e( e ) im s c 1 .5 Example of acoustic 1D wave simulation..5 0 .9 1 1 . blue-numerical. ro 8 1 4 2 0 3 0 1 0 .0 3 % o r r r e..20Hz S uc tim fuc n o r e e ntio 1 0 .5 0 .

4s 3 point7.Table Difference (%) between numerical and analytical solution as a function of propagating frequency 160 140 120 100 80 60 40 20 0 Numerical Methods in Geophysics Simulation time 5.8s 33.Fourier Method .0s 5 point Fourier 5 Hz 10 Hz 20 Hz The Fourier Method .Comparison with FD .

1981. We now introduce a delta source in space and time ∂t2 p = δ ( x)δ (t ) + c 2 ∆p the formal solution to this equation is 1 δ (t − x / c ) p ( x. 65) Numerical Methods in Geophysics The Fourier Method . Quantitative Seismology. Freeman+Co. It is also useful for numerical solutions. p. t ) = 4πc 2 x (Full proof given in Aki and Richards.Numerical solutions and Green’s Functions The concept of Green’s Functions (impulse responses) plays an important role in the solution of partial differential equations. Let us recall the acoustic wave equation ∂t2 p = c 2 ∆p with ∆ being the Laplace operator.

but with amplitude proportional to 1/r. that in homogeneous media the same source time function which is input at the source location will be recorded at a distance r. Can we use this property in our numerical simulations? What happens if we solve our numerical system with delta functions as sources? Numerical Methods in Geophysics The Fourier Method .Numerical solutions and Green’s Functions 1 δ (t − x / c ) p ( x.solutions. why?) . t ) = 4πc 2 x In words this means (in 1D and 3D but not in 2D. An arbitrary source can evidently be constructed by summing up different delta .

Numerical solutions and Green’s Functions
1 0 . 8 0 . 6 0 . 4 0 . 2 0 0 1 0 . 8 0 . 6 0 . 4 0 . 2 0 0 1 0 . 8 0 . 6 0 . 4 0 . 2 0 0 2 0 0 4 0 0 6 0 0 8 0 0 1 0 0 0 2 0 0 4 0 0 6 0 0 8 0 0 1 0 0 0

Source is a Delta function in space and time

3 point operator

5 point operator

Fourier Method Impulse response (analytical)
2 0 0 4 0 0 6 0 0 8 0 0 1 0 0 0

Time steps
Numerical Methods in Geophysics

Impulse response (numerical
The Fourier Method

Numerical solutions and Green’s Functions
3 point operator
1 0 9 8 7 6 5 4 3 2 1 0 50 0 1 0 9 8 7 6 5 4 3 2 1 0 50 0

5 point operator
1 0 9 8 7 6 5 4 3 2 1

Fourier Method

Impulse response (numerical convolved with source

Impulse response (analytical) concolved with source

Numerical Methods in Geophysics

Frequency increases

10 00

10 50

10 00

10 50

0 50 0

10 00

10 50

The Fourier Method

Fourier Method - Summary

The Fourier Method can be considered as the limit of the finite-difference method as the length of the operator tends to the number of points along a particular dimension. The space derivatives are calculated in the wavenumber domain by multiplication of the spectrum with ik. The inverse Fourier transform results in an exact space derivative up to the Nyquist frequency. The use of Fourier transform imposes some constraints on the smoothness of the functions to be differentiated. Discontinuities lead to Gibb’s phenomenon. As the Fourier transform requires periodicity this technique is particular useful where the physical problems are periodical (e.g. angular derivatives in cylindrical problems).

Numerical Methods in Geophysics

The Fourier Method

strains and stresses) at selected elements . displacements) • Calculate desired quantities (e.Finite Elements – the concept How to proceed in FEM analysis: • Divide structure into pieces (like LEGO) • Describe behaviour of the physical quantities in each element • Connect (assemble) the elements at the nodes to form an approximate system of equations for the whole structure • Solve the system of equations involving unknown quantities at the nodes (e.g.g.

FEM is the most widely applied computer simulation method in engineering. ABACUS. Today spectral elements is an attractive new method with applications in seismology and geophysical fluid dynamics The required grid generation techniques are interfaced with graphical techniques (CAD). SMART. etc. ANSYS.) . Originally designed for problems in static elasticity. MATLAB.g. Today a large number of commercial FEM software is available (e.Finite Elements – Why? FEM allows discretization of bodies with arbitrary shape.

Finite Elements – Examples .

. regular grid .. Domain D The key idea in FE analysis is to approximate all functions in terms of basis functions ϕ .. In FE problems – similar to FD – the functional values are known at a discrete set of points. so that ~ u ≈ u = ∑ ciϕ i i =1 N .. ...Discretization – finite elements As we are aiming to find a numerical solution to our problem it is clear we have to discretize the problem somehow. . irregular grid ...

y and b are vectors and A is a matrix. Note that x. → yAx = yb y ∈ ℜn We first look at Poisson’s equation (e.. wave equation without time dependence) − ∆u ( x) = f ( x) where u is a scalar field.g.Finite elements – basic formulation Let us start with a simple linear system of equations Ax = b |*y and observe that we can generally multiply both sides of this equation with y without changing its solution. f is a source term and in 1-D ∂2 ∆ = ∇2 = 2 ∂x .

... why are we doing this? . and integrate this equation over the whole domain.. − ∫ ∆uv = ∫ fv D − ∫ ∆uvdx = ∫ fvdx 0 0 1 D 1 .. 1]. .... be patient .Formulation – Poisson’s equation We now multiply this equation with an arbitrary function v(x). (dropping the explicit space dependence) − ∆uv = fv . For reasons of simplicity we define our physical domain D in the interval [0.

1 1 − ∫ ∆uvdx = ∫ fvdx 0 0 − ∫ ∆uvdx = [ ∇uv ] 0 + ∫ ∇v∇udx 1 0 0 1 1 we assume for now that the derivatives of u at the boundaries vanish so that for our particular problem − ∫ ∆uvdx = ∫ ∇v∇udx 0 0 1 1 .. partially integrate the left-hand-side of our equation ....Partial Integration .

. This is also true for our approximate numerical system ~ ∇u ∇vdx = ∫ fvdx ∫ 0 0 1 1 .. .. with u being the unknown function. where ...... ∫ ∇u∇vdx = ∫ fvdx 0 0 1 1 .. so that we arrive at . ~ u = ∑ ciϕ i i =1 N was our choice of approximating u using basis functions...

. The simplest choice are of course linear functions: + grid nodes blue lines – basis functions ϕ i 1 0 9 8 7 6 5 4 3 2 1 i 1 ϕ i ( x) =  0 for x = xi for x = x j ..The basis functions we are looking for functions ϕ with the following property . j ≠ i .. otherwise we are free to choose any function ..

.The discrete system v = ϕk 1 The ingredients: ~ u = ∑ ciϕ i i =1 N ~ ∇u ∇vdx = ∫ fvdx ∫ 0 0 1  n  ∫ ∇ ∑ ciϕ i ∇ϕ k dx = ∫ f ϕ k dx  i =1  0 0 . leading to .... 1 1 .

. ∑ c ∫ ∇ϕ ∇ϕ dx = ∫ f ϕ dx i =1 i i k k 0 0 n 1 1 ......The discrete system . the coefficients ck are constants so that for one particular function ϕ k this system looks like . probably not to your surprise this can be written in matrix form bi Aik = g k A b = gk T ik i .

. with the even less surprising solution bi = A ( ) T −1 ik gk remember that while the bi’s are really the coefficients of the basis functions these are the actual function values at node points i as well because of our particular choice of basis functions...The solution .

Basis functions and element Linear Quadratic Trangles Quadrangles .

[0.1]. e..g. . we now introduce an approximation for u using our previous basis functions. and after partial integration ∂ t2uϕ j dx − v 2 ∫ ∇u∇ϕ j dx = ∫ fϕ j dx ∫ 0 0 0 1 1 1 ... using the same ideas as before we multiply this equation with an arbitrary function and integrate over the whole domain.The Acoustic Wave Equation 1-D How do we solve a time-dependent problem such as the acoustic wave equation? ∂ t2u − v 2 ∆u = f where v is the wave speed.

.. ...The Acoustic Wave Equation 1-D ~ u ≈ u = ∑ ci (t )ϕ i ( x) i =1 N note that now our coefficients are time-dependent! . and . ~ ∂ t2u ≈ ∂ t2u = ∂ t2 ∑ ci (t )ϕ i ( x) i =1 N together we obtain 1 1   2  1 ∂ t2 ci ∫ ϕ iϕ j dx  + v ∑ ci ∫ ∇ϕ i ∇ϕ j dx  = ∫ fϕ j ∑ 0  i   i 0  0 which we can write as ...

 M T c + v 2 AT c = g .... How can we solve this time-dependent problem? . in Matrix form ..Time extrapolation 1 1   2  1 ∂ t2 ci ∫ ϕ iϕ j dx  + v ∑ ci ∫ ∇ϕ i ∇ϕ j dx  = ∫ fϕ j ∑ 0  i   i 0  0 mass matrix M stiffness matrix A b ..... remember the coefficients c correspond to the actual values of u at the grid points for the right choice of basis functions .

let us use a finite-difference approximation for the time derivative .  ck +1 − 2c + ck −1  2 T M   + v A ck = g 2 dt   T ..FD extrapolation  M T c + v 2 AT c = g ... leading to the solution at time tk+1 : ck +1 = ( M T ) −1 ( g − v 2 AT ck ) dt 2 + 2ck − ck −1 we already know how to calculate the matrix A but how can we calculate matrix M? [ ] ....

A=zeros(nx). else A(i. elseif j==i+1 M(i. elseif i+1==j A(i. A(i.j)=-1/h(i-1). for i=2:nx-1. for j=2:nx-1.Matrix assembly Mij % assemble matrix Mij Aij % assemble matrix Aij M=zeros(nx). end end end for i=2:nx-1. elseif i==j+1 A(i.j)=-1/h(i).j)=1/h(i-1)+1/h(i). elseif j==i-1 M(i. if i==j. else M(i. for j=2:nx-1.j)=0.j)=0. end end end . if i==j. M(i.j)=h(i)/6.j)=h(i)/6.j)=h(i-1)/3+h(i)/3.

m .Numerical example – regular grid This is a movie obtained with the sample Matlab program: femfd.

Finite Elements . or triangular (tetrahedral) elements and are thus more flexible in terms of grid geometry The FE method is mathematically and algorithmically more complex than FD The FE method is well suited for elasto-static and elastodynamic problems (e. crustal deformation) .g.Summary • • • • • FE solutions are based on the “weak form” of the partial differential equations FE methods lead in general to a linear system of equations that has to be solved using matrix inversion techniques (sometimes these matrices can be diagonalized) FE methods allow rectangular (hexahedral).