# Classification of Partial Differential Equations. Equations.

Parabolic Equation (Diffusion Eq.) Hyperbolic Equation (Advection Eq.) p q ( q) Elliptic Equation (Poisson Eq.) [Multi-Grid Method]

2nd Order Linear Partial Differential Equation
A ∂2 f ∂2 f ∂2 f ∂f ∂f +B + C 2 + D + E + Ff + G = 0 2 ∂x ∂x∂y ∂y ∂x ∂y
Elliptic Parabolic Hyperbolic

B 2 − 4 AC < 0 B 2 − 4 AC = 0 B 2 − 4 AC > 0

Characteristics of the partial differential equation is determined by the highest order derivative term.
1

2

Typical Equations
Elliptic Equation q Poisson Eq.
(A = C = 1, B = 0)

Partial Differential Equation in space
・Boundary Problems (Boundary Conditions)
d2 f = ρ = const 1D Poisson Eq. dx 2

∂2 f ∂2 f + =ρ ∂x 2 ∂y 2

(0 ≤ x ≤ 1)
f (1) = 0

Parabolic Equation Diffusion Eq. （A=κ， B = C = 0） Hyperbolic E H b li Equation ti Wave Eq.
(A = −c2，B = 0，C = 1)

∂f ∂2 f =κ 2 ∂t ∂x

Boundary Condition : f (0) = 0, 2D Poisson Eq Eq.
∂2 f ∂2 f + = ρ = const ∂x 2 ∂y 2

∂ f ∂ f − c2 2 = 0 2 ∂t ∂x
2 2
3

(x ∈ S)
is given at the surface - S

Boundary Conditions : f

4

Differential Equation in time
・Initial Condition
Time goes in one way

Partial Differential Equation in time and space
・Initial Boundary Problem t a ou da y ob e
One-dimensional diffusion equation：

Newton Eq. ：

d r =F dt 2

2

(t0 ≤ t ≤ t1 )
& & r (t0 ) = r0

Initial Condition： r (t0 ) = r0 ,

∂f ∂2 f =κ 2 ∂t ∂x

(0 ≤ x ≤ 1)

dv dr =F, = v (t0 ≤ t ≤ t1 ) ： dt dt Initial Condition： r (t0 ) = r0 , v (t0 ) = v0
5

Initial Condition： f ( x, 0) = f 0 ( x )

(0 ≤ x ≤ 1)

Boundary Condition： f (0, t ) = 0 , f (1, t ) = 0

6

Discretization in time and space (Notation)
n+ f i −1 1

Time and Space Cone for p Information travel

f i n +1

n+ f i +1 1

t =t Δt
xN = 1
Δx
n +1

n +1

t

n +1
n f i −1

f i n +1 fi n
i
n f i +1

n f i −1

fi n
xi

n f i +1

t
t =t
n

n

i−1

i+1

x1 = 0

xi −1

xi +1

t

n −1

f ( xi , t n ) = f i

n

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

xi −1

xi

xi +1

7

8

Introduction to finite Difference Method
Finite Difference Approximation
Differential operators are replaced by finite difference expressions

Forward Difference
Taylor Expansion Series

f ( xi + Δx) = f ( xi ) +

∂f 1 ∂2 f Δx + ∂x x=xi 2 ∂x2
Δx +
x= xi

Δx2 +
x= xi

1 ∂3 f 6 ∂x3

Δx3 + ⋅ ⋅ ⋅
x= xi

Derivation of finite difference expressions

f − fi ∂f → i +1 ∂x Δx
9

fi+1 − fi ∂f 1 ∂2 f = + Δx ∂x x=xi 2 ∂x2 = ∂f + O(Δx) ∂x x=xi

1 ∂3 f 6 ∂x3

Δx2 + ⋅ ⋅ ⋅
x= xi

(1)

The accuracy of the finite difference is the first order of Δx .
10

Backward Difference
Taylor Expansion Series

Central Difference
Subtracting (2) from (1) ,

∂f f ( xi − Δx) = f ( xi )− ∂x
f i − f i −1 ∂f = Δx ∂x = ∂f ∂x

1 ∂2 f Δx + 2 ∂x 2 x = xi

x = xi

1 ∂3 f Δx − 6 ∂x 3
2

Δx + ⋅ ⋅ ⋅
3 x = xi

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

∂f ∂x

Δx +
x = xi

1 ∂3 f 3 ∂x3

Δx3 + ⋅ ⋅ ⋅
x = xi

x = xi

1 ∂2 f − 2 ∂x 2 + O(Δx)

x = xi

1 ∂3 f Δx + 6 ∂x 3

Δx + ⋅ ⋅ ⋅
2 x = xi

Δx 2 + ⋅ ⋅ ⋅
x = xi

x = xi

x = xi

(2)

=

∂f ∂x

+ O(Δx 2 )
x = xi

The accuracy of the finite difference is the first order of Δx .
11

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

Accuracy of Finite Difference Expressions
Error = k x cos k x xi − F .D.

Typical Finite Difference Expressions yp p for 1st-order derivative 1st∂f ∂x ∂f ∂x ∂f ∂x ∂f ∂x ∂f ∂x = = = = = f i +1 − f i Δx f i +1 − f i −1 2Δx − f i + 2 + 4 f i +1 − 3 f i 2Δx − f i + 2 + 6 f i +1 − 3 f i − 2 f i −1 6Δx − f i + 2 + 8 f i +1 − 8 f i −1 + f i − 2 12Δx

10 10 10

0 −1 1 −2 −3 −4 −5 −6 −7

f i +1 − f i Δx

(Δx )

E Error

f i +1 − f i −1 2Δx

(Δx )
2

k x = 2π 2π f i = sin k x xi

10 10 10 10

(Δx )
2

− f i + 2 + 8 f i +1 − 8 f i −1 + f i − 2 12Δx

(Δx )
3

Source Code

10

10

−3

10

−2

Δx

10

−1

10

0
13

(Δx )
4
14

Finite Difference for 2nd-order d i ti f 2nd- d derivative 2 d
By adding (1) to (2) ,

Typical Finite Difference Expressions for 2nd-order derivative 2ndf − 2 f i −1 + f i ∂2 f (Δx ) = i+2 2 ∂x Δx 2 f − 2 f i + f i −1 ∂2 f = i +1 Δx 2 2 2 ∂x Δx ∂ 2 f − f i + 2 + 16 f i +1 − 30 f i + 16 f i −1 − f i − 2 = Δx 4 2 2 ∂x 12Δx

f ( xi + Δx) + f ( xi − Δx) = 2 f ( xi ) +

∂ f ∂x 2
2

Δx 2 +
x = xi

1∂ f 12 ∂x 4
4

Δx 4 + ⋅ ⋅ ⋅
x = xi

fi+1 − 2 fi + fi−1 ∂2 f = 2 Δx2 ∂x = ∂2 f ∂x2

x= xi

1 ∂4 f + 12 ∂x4 + O(Δx2 )

Δx + ⋅ ⋅ ⋅
2 x= xi

( ) ( )

x= xi

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

Game G

Rule: get a new value by replacing the average about surroundings

Game G

Rule: get a new value by replacing the average about surroundings

1

Replacing with the average
1
1/5

1/5 2/5 2/5 2/5 2/5 2/5 2/5 2/5 1/5

Initial

1

1 1

1
2/5 1/5

17

18

Game G

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 , j −1 f i +1, j

i : grid index in the x-direction j : grid index in the y-direction

This average p ocess is s a e age process s

f i *j = ,
19

f i , j + f i +1, j + f i −1, j + f i , j +1 + f i , j −1 5
20

Game Game
f
n +1 i, j

Game Game
When we regard Δ t = 1.0, Δ x = Δ y = 1.0, κ = 1/5,

=

n n f i ,nj + f i +1, j + f i −1, j + f i ,nj +1 + f i ,nj −1

5
n : present value n+1 : the value after average f g

f i ,nj+1 − f i ,nj Δt

n n f i +1, j − 2 f i ,nj + f i −1, j

Δx 2

f i ,nj +1 − 2 f i ,nj + f i ,nj −1 Δy 2

2-dimendional diff i equation 2 di di l diffusion ti

By subtracting f i , j from both side

f i ,nj+1 − f i ,nj =

f

n i +1, j

−2f + f
n i, j

n i −1, j

+f 5

n i , j +1

−2f + f
n i, j

n i , j −1

⎛ ∂2 f ∂2 f ∂f = κ⎜ 2 + 2 ⎜ ∂x ∂t ∂y ⎝
21

⎞ ⎟ ⎟ ⎠
22

Parabolic Equation P b li E ti
1-dimeisional diffusion diff i eq.

1-dimensional

Diffusion Equation
∂φ ∂ 2φ =κ 2 ∂t ∂x
φ nj +1 − φ nj Δt
We can reduce to κ : diffusion coefficient

∂φ ∂ φ =κ 2 ∂t ∂x
2

κ : diffusion coefficient

Applying the forward finite difference to the time derivative term and the center finite difference to the spatial difference,

→ Increasing entropy
Particle Collision Process from the microscopic view Thermal Conduction： Electron Collision Conduction： Viscousity: Ion Collision Nuclear Reactor： Reactor： Neutron Collision

φ nj +1 − 2φ nj + φ nj −1 Δx 2

φ nj +1 = φ nj + μ φ nj +1 − 2φ nj + φ nj −1
where

(

)
24

23

μ=

κΔt Δx 2

Sample Sample Program 1
#include "xwin.h" #define N 101 int main() { double f[N], fn[N], x[N], mu = 0.25; int j, icnt 0; i t j i t=0 while(icnt < 100) { for(j=1; f (j 1 j < N-1; j++) { N1 fn[j] = f[j] + mu*(f[j+1] - 2.0*f[j] + f[j-1]); } for(j=0; j < N; j++) f[j] = fn[j]; /* updating */ } }
Source Code
25

Stability Analysis (1/3） (1/3）
von Neumann’s Method
n n ik ⋅ jΔx Assuming the perturbation φ j = δφ e

Where the notation i is the imaginary, k is the wave number, j is grid index, jΔx is the grid position.
n +1 n n n n Substituting into φ j = φ j + μ φ j +1 − 2φ j + φ j −1

(

)

δφ n +1 e ik ⋅ jΔx = δφ n e ik ⋅ jΔx + μ δφ n e ik ⋅( j +1) Δx − 2δφ n e ik ⋅ jΔx + δφ n e ik ⋅( j −1) Δx φ φ φ

(

)
26

Stability Analysis (2/3） (2/3）
n+1 step／n step : amplitude ratio step／

Stability Analysis (3/3） (3/3）
Amplitude ratio:

δφnj +1 δφnj = 1 + μ e − ikΔx − 2 + eikΔx = 1 − 2μ(1 − cos kΔx)
cos kΔx =

(

)

δφnj +1 δφnj = 1 − 2μ(1 − cos kΔx)

μ< 0 ： unstable, 0 < μ < 1/2 : stable 1/2 < μ : unstable depending on the value k We consider only the case of 0 < κ,

eikΔx + e − ikΔx 2

δφn +1 δφn < 1

： The amplitude of the perturbation decrease in time time. The calculation is stable.
27

1 μ< 2

1 Δx 2 Δt < 2 κ
28

We h W have to choose Δt satisfying the condition, b t Δt should t h ti f i th diti but h ld 2 with decrease of Δx. be decrease propotionally to Δx

2-dimendional

Diffusion Equation
⎛ ∂2 f ∂2 f ∂f = κ⎜ 2 + 2 ⎜ ∂x ∂t ∂y ⎝ ⎞ ⎟ ⎟ ⎠

Forward Difference in time Central Difference in space

O(Δt ) O(Δx 2 )
+κ f i ,nj +1 − 2 f i ,nj + f i ,nj −1 Δy 2
Source Code
29

f i ,nj+1 − f i ,nj Δt

n n f i +1, j − 2 f i ,nj + f i −1, j

Δx 2