Professional Documents
Culture Documents
FUNDAMENTALS OF FDM
In FDM, derivatives are replaced by a proper difference formula based on the Taylor
series expansions of a function:
The difference formula above is of order 1 with the truncation error being
proportional to x
To obtain higher order difference formula for the first derivative, Taylor series
expansion of the function is used from both side of x
The difference formula above is of order 2 with the truncation error being
proportional to ( x)2
TYPICAL DIFFERENCE FORMULAS
Typical difference formulas Space index form
Forward
First derivatives
Backward
One – dimension (1D)
Centered
derivatives
Second
Centered
Typical difference formula Space index form
Forward
First derivatives
Backward
Two – dimension (2D)
Centered
derivatives
Second
Centered
SOLVING TIME-INDEPENDENT PDES
1. Divide the computational domain into subdomains
2. Derive the difference formulation for the given PDE by replacing all
derivatives with corresponding difference formulas
3. Apply boundary conditions to the points on the domain boundaries
4. Apply the difference formulation to every inner points of the
computational domain
5. Solve the resulting algebraic system of equations
𝑢0 𝑢1 𝑢2 𝑢3
𝑢4
2. Using the Centered difference for second derivatives (1D) we have:
𝑑 2 𝑢 𝑢0 − 2𝑢1 + 𝑢2
=
𝑑𝑥 2 ∆𝑥 2
3. 𝑢0 = 0 ; 𝑢4 = 0
4.
𝑢0 − 2𝑢1 + 𝑢2
− 𝑢1 = −𝑥12
∆𝑥 2
𝑢1 − 2𝑢2 + 𝑢3
− 𝑢2 = −𝑥22
∆𝑥 2
𝑢2 − 2𝑢3 + 𝑢4
− 𝑢3 = −𝑥32
∆𝑥 2
−(2 + ∆𝑥 2 ) 1 0 𝑢1 −𝑥12 ∆𝑥 2
( 1 −(2 + ∆𝑥 2 ) 1 ) ( 𝑢2 ) = (−𝑥22 ∆𝑥 2 )
0 1 −(2 + ∆𝑥 2 ) 𝑢3 −𝑥32 ∆𝑥 2
−2.0625 1 0 𝑢1 −0.0039
( 1 −2.0625 1 𝑢
) ( 2 ) = (−0.015625)
0 1 −2.0625 𝑢3 −0.035156
5. Algebraic solution and graph (using Microsoft Excel)
𝑢1 = 0.01722484 𝑢2 = 0.031626232 𝑢3 = 0.032379264
0.03
0.02
U
0.01
0
0 0.25 0.5 0.75 1
X
𝜕𝑢 𝜕 2 𝑢
= 0 ≤ 𝑥 ≤ 1, 𝑡 > 0
𝜕𝑡 𝜕𝑥 2
Initial condition: 𝑢(0, 𝑥) = 0
Boundary conditions: 𝑢(𝑡, 0) = 0 , 𝑢(𝑡, 1) = 1
Solution:
1.
2. For time discretization, we use the backward difference for first derivatives:
𝑗+1 𝑗
𝜕𝑢 𝑢𝑖 −𝑢𝑖
= (red arrow)
𝜕𝑡 ∆𝑡
For space discretization, we can use either Explicit method or Implicit method:
• Explicit:
𝑗 𝑗 𝑗
𝜕 2 𝑢 𝑢𝑖−1 − 2𝑢𝑖 + 𝑢𝑖+1
= (𝑝𝑢𝑟𝑝𝑙𝑒 𝑎𝑟𝑟𝑜𝑤)
𝜕𝑥 2 ∆𝑥 2
• Implicit:
𝑗+1 𝑗+1 𝑗+1
𝜕2 𝑢 𝑢𝑖−1 −2𝑢𝑖 +𝑢𝑖+1
= (blue arrow)
𝜕𝑥 2 ∆𝑥 2
1 Explicit method
0.8
t=0.04
0.6
t=0.08
u
t=0.12
0.4
t=0.16
0.2 t=0.20
t=infinite
0
0 0.25 0.5 0.75 1
x
IMPLICIT METHOD:
x 0 0.25 0.5 0.75 1
n t u(n,0) u(n,1) u(n,2) u(n,3) u(n,4)
0 0 0 0 0 0 1
1 0.01 0 0.001835 0.015137 0.123047 1
2 0.02 0 0.006089 0.038767 0.219128 1
3 0.03 0 0.012698 0.066702 0.295304 1
4 0.04 0 0.021297 0.096338 0.356604 1
5 0.05 0 0.031417 0.126082 0.40665 1
Implicit method
1
0.8
t=0.04
0.6 t=0.08
u
t=0.12
0.4
t=0.16
0.2 t=0.20
t=infinite
0
0 0.25 0.5 0.75 1
x