01-1 Finite Difference Method
01-1 Finite Difference Method
Heiner Igel
1 Introduction
Motivation
History
Finite Differences in a Nutshell
Motivation
Simple concept
Robust
Easy to parallelize
Regular grids
Explicit method
History
History
History
History
History
History
History
p pressure
c acoustic velocity
s source term
Finite Differences
Forward derivative
f (x + dx) − f (x)
dx f (x) = lim
dx → 0 dx
Centered derivative
f (x + dx) − f (x − dx)
dx f (x) = lim
dx → 0 2dx
Backward derivative
f (x) − f (x − dx)
dx f (x) = lim
dx → 0 dx
Finite Differences
Forward derivative
f (x + dx) − f (x)
dx f + ≈
dx
Centered derivative
f (x + dx) − f (x − dx)
dx f c ≈
2dx
Backward derivative
f (x) − f (x − dx)
dx f − ≈
dx
1
f (x + dx) = f (x) + f 0 (x) dx + 2! f 00 (x) dx 2 + O(dx 3 )
f (x+dx)−f (x) 1
dx = f 0 (x) + 2! f 00 (x) dx + O(dx 2 )
Using the same approach - adding the Taylor Series for f (x + dx)
and f (x − dx) and dividing by 2dx leads to:
f (x+dx)−f (x−dx)
2dx = f 0 (x) + O(dx 2 )
Higher Derivatives
f (x+dx)−f (x)
− f (x)−fdx(x−dx) f (x + dx) − 2f (x) + f (x − dx)
∂x2 f ≈ dx
=
dx dx 2
Higher Derivatives
1
af (x + dx) = a f (x) + f 0 (x) dx + f 00 (x) dx 2 + . . .
2!
bf (x) = b [f (x)]
1
cf (x − dx) = c f (x) − f 0 (x) dx + f 00 (x) dx 2 − . . .
2!
Higher Derivatives
a−c =0 ⇒ b=− 2
2
dx
2! 1
a+c = c=
dx 2 dx 2
High-Order Operators
a + b + c +d +e = 0
2a + b − d − 2e = 0
1
4a + b + d + 4e =
2dx 2
8a + b − d − 8e = 0
16a + b + d + 16e = 0
High-Order Operators
High-Order Operators
Finite-Difference Approximation of
Wave Equations
Acoustic waves in 1D
p̈ = c 2 ∂x2 p + s
p(x) |x=0,L = 0
Acoustic waves in 1D
p → p(x, t) pressure
c → c(x) P-velocity
s → s(x, t) source term
Acoustic waves in 1D
Starting from the continuous description of the partial differential
equation to a discrete description. The upper index will correspond to
the time discretization, the lower index will correspond to the spatial
discretization
Acoustic waves in 1D
j −1 j j +1
Acoustic waves in 1D
dt 2 h n i
pjn+1 = cj2 pj+1 − 2pj
n
+ p n
j−1 + 2pjn − pjn−1 + dt 2 sjn
dx 2
The initial condition of our wave simulation problem is such that
everything is at rest at time t = 0:
Acoustic waves in 1D
where xs and ts are source location and source time and δ()
corresponds to the delta function
Acoustic waves in 1D
A delta function contains all frequencies and we cannot expect that our
numerical algorithm is capable of providing accurate solutions
Operating with a band-limited source-time function:
Example
Example
Example
ω λ
c = = = λf
k T
where c is velocity, T is period, λ is wavelength, f is frequency, and
ω = 2πf is angular frequency
dominant wavelength of f0 = 20Hz
substantial amount of energy in the wavelet is at frequencies
above 20 Hz
=⇒ λ = 17m and λ = 7m for frequencies 20Hz and 50Hz,
respectively
% Time extrapolation
for it = 1 : nt,
(...)
% Space derivatives
for j=2:nx-1
d2p(j)=(p(j+1)-2*p(j)+p(j-1))/dxˆ 2;
end
% Extrapolation
pnew=2*p-pold+cˆ 2*d2p*dtˆ 2;
% Source input
pnew(isrc)=pnew(isrc)+src(it)*dtˆ 2;
% Time levels
pold=p;
p=pnew;
(...)
Result
Summary