Anda di halaman 1dari 8

Classification of Partial 2nd Order Linear

Differential Equations.
Equations. Partial Differential Equation

∂2 f ∂2 f ∂2 f ∂f ∂f
A + B + C + D + E + Ff + G = 0
∂x 2
∂x∂y ∂y 2
∂x ∂y
„ Parabolic Equation (Diffusion Eq.)
„ Hyperbolic Equation (Advection Eq.) Elliptic B 2 − 4 AC < 0

p Equation
„ Elliptic q ((Poisson Eq.)
q) Parabolic B 2 − 4 AC = 0

[Multi-Grid Method] Hyperbolic B 2 − 4 AC > 0

Characteristics of the partial differential equation


is determined by the highest order derivative
term.
1 2

Partial Differential Equation


Typical Equations
in space
Elliptic Equation
∂2 f ∂2 f ・Boundary Problems (Boundary Conditions)
q
Poisson Eq. + =ρ
(A = C = 1, B = 0)
∂x 2 ∂y 2
d2 f
1D Poisson Eq. = ρ = const (0 ≤ x ≤ 1)
dx 2
Parabolic Equation Boundary Condition : f (0) = 0, f (1) = 0
∂f ∂2 f
Diffusion Eq. =κ 2
(A=κ, B = C = 0)
∂t ∂x 2D Poisson Eq
Eq.

∂2 f ∂2 f
+ = ρ = const (x ∈ S)
Hyperbolic
H b li Equation
E ti ∂x 2 ∂y 2
∂ f
2
∂ f
2
Wave Eq. − c2 2 = 0 Boundary Conditions : f is given at the surface - S
(A = −c2,B = 0,C = 1)
∂t 2
∂x
3 4
Partial Differential Equation
Differential Equation in time
in time and space
・Initial Condition t a Boundary
・Initial ou da y Problem
ob e
Time goes in one way
One-dimensional diffusion equation:
2
d r
Newton Eq. : =F (t0 ≤ t ≤ t1 ) ∂f ∂2 f
dt 2 =κ 2 (0 ≤ x ≤ 1)
Initial Condition: r (t0 ) = r0 , r&(t0 ) = r&0 ∂t ∂x

Initial Condition: f ( x, 0) = f 0 ( x ) (0 ≤ x ≤ 1)
dv dr
: =F, = v (t0 ≤ t ≤ t1 )
dt dt Boundary Condition: f (0, t ) = 0 , f (1, t ) = 0
Initial Condition: r (t0 ) = r0 , v (t0 ) = v0

5 6

Discretization in time Time and Space


p Cone for
and space (Notation) Information travel

f i −n1+1 f i n +1 f i +n1+1 f i n +1
t =t n +1 n +1
t
f i −n1 fi n f i +n1
Δt n
f i −n1 fi n f i +n1 t
i−1 i i+1
t =t n
n −1
x1 = 0 xi −1 xi xi +1 xN = 1
t
Δx

n +1
f ( xi , t n ) = f i f ( xi + Δx, t n + Δt ) = f i +1
n xi −1 xi xi +1

7 8
Introduction to finite
Difference Method Forward Difference

Finite Difference Approximation Taylor Expansion Series

Differential operators are replaced by finite ∂f 1 ∂2 f 1 ∂3 f


difference expressions f ( xi + Δx) = f ( xi ) + Δx + Δx2 + Δx3 + ⋅ ⋅ ⋅
∂x x=xi 2 ∂x2 x= xi
6 ∂x3 x= xi

Derivation of finite difference expressions fi+1 − fi ∂f 1 ∂2 f 1 ∂3 f


= + Δx + Δx2 + ⋅ ⋅ ⋅
Δx ∂x x=xi 2 ∂x2 x= xi
6 ∂x3 x= xi

∂f f − fi ∂f
→ i +1 =
∂x x=xi
+ O(Δx) (1)
∂x Δx
The accuracy of the finite difference is the first order of Δx .
9 10

Backward Difference Central Difference


Taylor Expansion Series Subtracting (2) from (1) ,

∂f 1 ∂2 f 1 ∂3 f ∂f 1 ∂3 f
f ( xi − Δx) = f ( xi )− Δx + Δx − 2
Δx + ⋅ ⋅ ⋅
3 f ( xi + Δx) = f ( xi − Δx) + 2 Δx + Δx3 + ⋅ ⋅ ⋅
∂x x = xi 2 ∂x 2 x = xi
6 ∂x 3 x = xi
∂x x = xi 3 ∂x3 x = xi

f i − f i −1 ∂f 1 ∂2 f 1 ∂3 f f i +1 − f i −1 ∂f 1 ∂3 f
= − Δx + Δx + ⋅ ⋅ ⋅
2
= + Δx 2 + ⋅ ⋅ ⋅
Δx ∂x x = xi 2 ∂x 2 x = xi
6 ∂x 3 x = xi 2Δx ∂x x = xi 6 ∂x3 x = xi
∂f ∂f
= + O(Δx)
∂x (2) = + O(Δx 2 )
x = xi
∂x x = xi

The accuracy of the finite difference is the first order of Δx . The accuracy of the finite difference is the second order of Δx .
11 12
Accuracy of Finite Difference Typical
yp Finite Difference Expressions
p
Expressions for 1st-
1st-order derivative
f i +1 − f i
∂f f i +1 − f i
Error 10
0
Δx = (Δx )
= k x cos k x xi − F .D. −1
1 ∂x Δx
10
∂f f i +1 − f i −1
10
−2
f i +1 − f i −1
∂x
=
2Δx
(Δx )
2

2Δx
Error

−3
∂f − f i + 2 + 4 f i +1 − 3 f i
k x = 22π
π
10
= (Δx )
2
E

10
−4
∂x 2Δx
f i = sin k x xi ∂f − f i + 2 + 6 f i +1 − 3 f i − 2 f i −1
10
−5

− f i + 2 + 8 f i +1 − 8 f i −1 + f i − 2 ∂x
=
6Δx
(Δx )
3

−6
10 12Δx
∂f − f i + 2 + 8 f i +1 − 8 f i −1 + f i − 2
Source Code 10
−7
−3 −2 −1 ∂x
=
12Δx
(Δx )
4

10 10 Δx 10 10
0
13 14

Finite Difference Typical Finite Difference Expressions


for
f 2nd-
2nd
2 d-order
d d derivative
i ti for 2nd-
2nd-order derivative
By adding (1) to (2) ,
∂2 f f − 2 f i −1 + f i
f ( xi + Δx) + f ( xi − Δx) = 2 f ( xi ) +
∂ f 2
Δx 2 +
1∂ f 4
Δx 4 + ⋅ ⋅ ⋅
= i+2 (Δx )
∂x 2 12 ∂x 4
∂x 2
Δx 2
x = xi x = xi
∂2 f f i +1 − 2 f i + f i −1
fi+1 − 2 fi + fi−1 ∂2 f 1 ∂4 f
∂x 2
=
Δx 2
Δx 2( )
= 2 + Δx + ⋅ ⋅ ⋅
2

Δx2 ∂x 12 ∂x4
∂ 2 f − f i + 2 + 16 f i +1 − 30 f i + 16 f i −1 − f i − 2
( )
x= xi x= xi

∂2 f = Δx 4
= + O(Δx2 ) ∂x 2
12Δx 2

∂x2 x= xi

The accuracy of the finite difference is the second order of Δx .


15 16
G
Game Rule: get a new value by replacing
the average about surroundings G
Game Rule: get a new value by replacing
the average about surroundings

Replacing 1/5
1 with the 2/5 2/5 2/5
average
1 1 1 2/5 1 2/5
Initial 1/5 1/5
1
2/5 2/5 2/5

1/5

17 18

G
Game Rule: get a new value by replacing
the average about surroundings Game
Game
f i , j +1

f i −1, j f i , j f i +1, j i : grid index in the x-direction


f i , j −1 j : grid index in the y-direction

Thiss average
a e age p
process
ocess is
s
f i , j + f i +1, j + f i −1, j + f i , j +1 + f i , j −1
f i *, j =
5
19 20
Game
Game Game
Game
n +1
f i ,nj + f i +n1, j + f i −n1, j + f i ,nj +1 + f i ,nj −1 When we regard Δ t = 1.0, Δ x = Δ y = 1.0, κ = 1/5,
f =
f i ,nj+1 − f i ,nj f i +n1, j − 2 f i ,nj + f i −n1, j f i ,nj +1 − 2 f i ,nj + f i ,nj −1
i, j
5
=κ +κ
n : present value Δt Δx 2 Δy 2
n+1 : the value after
f average
g
2 di
2-dimendional
di l diff
diffusion
i equation
ti
By subtracting f i , j from both side
∂f ⎛ ∂2 f ∂2 f ⎞
f i ,nj+1 − f i ,nj =
f n
i +1, j −2f + fn n
i −1, j +f n
i , j +1 −2f + f
n n
i , j −1 = κ⎜⎜ 2 + 2 ⎟⎟
∂t ⎝ ∂x ∂y
i, j i, j

5 ⎠
21 22

1-dimensional
P b li E
Parabolic Equation
ti Diffusion Equation
∂φ ∂ φ ∂φ ∂ 2φ
=κ 2
2
1-dimeisional
diff i eq.
diffusion =κ 2 κ : diffusion coefficient
∂t ∂x κ : diffusion coefficient
∂t ∂x
Applying the forward finite difference to the time derivative term
and the center finite difference to the spatial difference,
Image of diffusion equation: spreading distribution
with fading out.
out φ nj +1 − φ nj φ nj +1 − 2φ nj + φ nj −1

→ Increasing entropy Δt Δx 2
( )
Particle Collision Process from the microscopic view
Thermal Conduction:
Conduction: Electron Collision
We can reduce to φ nj +1 = φ nj + μ φ nj +1 − 2φ nj + φ nj −1
Viscousity: Ion Collision
κΔt
Nuclear Reactor:
Reactor: Neutron Collision where μ=
23 Δx 2 24
Sample Program 1
Sample Stability Analysis (1/3)
(1/3)
#include "xwin.h"
#define N 101 von Neumann’s Method
n ik ⋅ jΔx
Assuming the perturbation φ j = δφ e
n
int main() {
double f[N], fn[N], x[N], mu = 0.25; Where the notation i is the imaginary, k is the wave
i t j,
int j icnt
i t = 0;
0 number, j is grid index, jΔx is the grid position.

while(icnt < 100) {


f (j 1 j < N-1;
for(j=1; N 1 j++) {
n +1 n
(
Substituting into φ j = φ j + μ φ j +1 − 2φ j + φ j −1
n n n
)
fn[j] = f[j] + mu*(f[j+1] - 2.0*f[j] + f[j-1]);
} δφ n +1 e ik ⋅ jΔx = δφ n e ik ⋅ jΔx
for(j=0; j < N; j++) f[j] = fn[j]; /* updating */
}
} + μ δφ(
φ n e ik ⋅( j +1) Δx − 2δφ
φ n e ik ⋅ jΔx + δφ
φ n e ik ⋅( j −1) Δx )
Source Code
25 26

Stability Analysis (2/3)


(2/3) Stability Analysis (3/3)
(3/3)
/n step : amplitude ratio
n+1 step
step/
Amplitude ratio: δφnj +1 δφnj = 1 − 2μ(1 − cos kΔx)

(
δφnj +1 δφnj = 1 + μ e − ikΔx − 2 + eikΔx ) μ< 0 : unstable,
0 < μ < 1/2 : stable
1/2 < μ : unstable depending on the value k
= 1 − 2μ(1 − cos kΔx) We consider only the case of 0 < κ,
eikΔx + e − ikΔx 1 1 Δx 2
cos kΔx =
2 μ< Δt <
2 2 κ
δφn +1 δφn < 1 : The amplitude of the perturbation
decrease in time
time. W have
We h to
t choose
h Δt satisfying
ti f i the
th condition,
diti butt Δt should
b h ld
The calculation is stable. be decrease propotionally to Δx with decrease of Δx.
2
27 28
2-dimendional
Diffusion Equation
∂f ⎛ ∂2 f ∂2 f ⎞
= κ⎜⎜ 2 + 2 ⎟⎟
∂t ⎝ ∂x ∂y ⎠

Forward Difference in time O(Δt )


Central Difference in space O(Δx 2 )
f i ,nj+1 − f i ,nj f i +n1, j − 2 f i ,nj + f i −n1, j f i ,nj +1 − 2 f i ,nj + f i ,nj −1
=κ +κ
Δt Δx 2 Δy 2
Source Code
29

Anda mungkin juga menyukai