FINITE DIFFERENCE
AND PDE
Finite differences
Finite volumes
- time-dependent PDEs
-> robust, simple concept, easy to
parallelize, regular grids, explicit method
Finite elements - -> implicit approach, matrix inversion, well founded, static and time-dependent PDEs
irregular grids, more complex algorithms, engineering problems
- time-dependent PDEs
-> robust, simple concept, irregular grids, explicit method
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 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 x2
)
(
)
(
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
x2
)
(
)
(
forward difference backward difference centered differenceThe
big
question:How good are the FD approximations?
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 f x dx f x dx f x dx f x x fTaylor 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 ) ( dx 1 ) ( ) ( ' '' ' 3 '' 2 ' dx O x f x f dx x f dx x f dx dx x f dx x f
... 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 ) ( dx 1 ) 2 / ( ) 2 / ( 2 ' '' ' 3 ' dx O x f x f dx x f dx dx dx x f dx x f ' ' ' ! 3 ) 2 ( ' ' ! 2 ) 2 ( ' ) 2 ( ) 2 ( 3 2 f dx f dx 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 f dx f dx f dx f dx x f ' ' ' ! 3 ) ( ' ' ! 2 ) ( ' ) ( ) ( 3 2 f dx f dx f dx f dx x f ' ' ' ! 3 ) 2 ( ' ' ! 2 ) 2 ( ' ) 2 ( ) 2 ( 3 2 f dx f dx f dx f dx x f
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. (Derivation on the board).
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 (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 points per wavelength.
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
Partial Differential Equations
by Lale Yurttas, Texas A&M
PERSAMAAN DIFERENSIAL PARSIAL
• Persamaan Umum
• Menyatakan bagaimana variabel tak bebas Ø berubah
terhadap variabel bebas x,y. Disini a,b,c,d,e,f, dan g mungkin merupakan fungsi dari Ø
0
2 2 2 2 2
g
f
y
e
x
d
y
c
y
x
b
x
a
Jenis2 PDP
• Ditentukan oleh harga b2-4ac
< 0, eliptic = 0, parabolic > 0, hyperbolic • Adveksi… • Difusi…. • Gelombang…
JENIS-JENIS
by Lale Yurttas, Texas A&M
The Laplacian Difference Equations/
0 4 0 2 2 2 2 0 , 1 , 1 , , 1 , 1 2 1 , , 1 , 2 , 1 , , 1 2 1 , , 1 , 2 2 2 , 1 , , 1 2 2 2 2 2 2 j i j i j i j i j i j i j i j i j i j i j i j i j i j i j i j i j i T T T T T y x y T T T x T T T y T T T y T x T T T x T y T x Tby Lale Yurttas, Texas A&M
University Chapter 29
Laplacian difference equation.
Holds for all interior points
Laplace Equation
O[(x)2]
by Lale Yurttas, Texas A&M
• In addition, boundary conditions along the edges must be specified to obtain a unique solution.
• The simplest case is where the temperature at the boundary is set at a fixed value, Dirichlet boundary condition.
• A balance for node (1,1) is:
• Similar equations can be developed for other interior points to result a set of simultaneous equations.
0
4
0
75
0
4
21 12 11 10 01 11 10 12 01 21
T
T
T
T
T
T
T
T
T
T
by Lale Yurttas, Texas A&M
150 4 100 4 175 4 50 4 0 4 75 4 50 4 0 4 75 4 33 23 32 33 23 13 22 23 13 12 33 32 22 31 23 32 22 12 21 13 22 12 11 32 31 21 22 13 21 11 12 21 11 T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T T
• The result is a set of nine simultaneous equations with nine unknowns:
x
Diffusion
Equation
Diffusion
2 2
x
h
D
t
h
h
x
dh
u
D
x
x
x
du
d du
u
x
x
h
du
h
x
x t
x
d
u
h
x
x t
x
dh
u
D
x
du
h
t
x
0
t
2 2h
h
D
t
x
Diffusion EquationNumerical Solution of Diffusion Eq.
( )
h i
(
1)
h i
(
1)
h i
1( )
(
1)
h
h i
h i
x
x
x
h
2(
1)
( )
h
h i
h i
x
x
2 2 2 11
h
h
h
x
x
x
x
x
t
x t 1 2 ・・・・・ i-1 i i+1 ・・・・ N 1 2 ・・ j-1 j j+ J)
,
( j
i
h
)
1
,
1
(
i
j
h
t
j
i
h
j
i
h
t
h
(
,
1
)
(
,
)
2 2 2(
1, )
( , )
( , )
(
1, )
(
1, ) 2 ( , )
(
1, )
h
D
h i
j
h i j
h i j
h i
j
D
x
x
x
x
h i
j
h i j
h i
j
D
x
2( ,
1)
( , )
{ (
1, ) 2 ( , )
(
1, )}
h i j
h i j
D t
h i
j
h i j
h i
j
x
Unknown KnownNumerical Solution of Diffusion Equation
x
t
x t 1 2 ・・・・・ i-1 i i+1 ・・・・ N 1 2 ・・ j-1 j j+ J Initial Condition (Given)
22
( )
( )
(
1) 2
( )
(
1)
2
( )
( )
new old old old old
new old
do
,N-1
end do
do
,N-1
end do
i
t
h
i
h
i
h
i
h
i
h
i
D
x
i
h
i
h
i
2( ,
1)
( , )
D t
{ (
1, ) 2 ( , )
(
1, )}
h i j
h i j
h i
j
h i j
h i
j
x
Contoh
• Cari solusinya dengan step size 0,2
• Jumlah titik solusi n=((2-1)/0,2)-1=4
• Kita dapatkan 4 persamaan, satu untuk tiap titik yang dicari.
6
)
2
(
,
1
)
1
(
,
4
2
3
2 2 2
y
x
y
y
dx
dy
dx
y
d
Penyelesaian dengan Beda Hingga
Persamaannya:
Buat persamaan untuk semua titik, mulai dari i=1, hingga i=4 x0=a x1 x2 x3 x4 x5=b 2 1 1 2 1 1
4
2
2
3
2
i i i i i i ix
y
h
y
y
h
y
y
y
Domain Solusi
y5=6
y0=1
Penyelesaian dg Finite Diff.
• Dengan h = 0,2
• Buat persamaan untuk semua titik, mulai dari i=1,
hingga i=4
• Masukkan nilai-nilai x1=1,2 hingga x4 =1,8 dan kondisi
batas y0 = 1 dan y5 = 6
2
1
1
48
17
,
5
4
5
,
32
y
i
y
i
y
i
x
i
Kondisi batas
• Dirichlet atau fixed boundary, misal C(0) = Co
• Neuman atau natural boundary,
misal dC/dx = 0
• Robin/ Cauchy boundary condition,
misal dC/dx + C = 0
• Penerapan dalam finite difference dengan menambahkan
penyelesaian
persamaan
parabolik
dengan
skema
eksplisit
persamaan diferensial,
ditulis dalam bentuk metode beda hingga,
penyelesaian
persamaan
eliptik
laplace
….equation
Stabilitas skema eksplisit
k