Lecture 7 Finite Difference Method
Lecture 7 Finite Difference Method
Lecture 7 Finite Difference Method
𝜕𝑢 𝑢 , 𝑢, 1 𝜕 𝑢 ∆𝑥 𝜕 𝑢 ∆𝑥
⋯
𝜕𝑥 ,
∆𝑥 ∆𝑥 𝜕𝑥 ,
2! 𝜕𝑥 ,
3!
𝜕𝑢 𝜕 𝑢 ∆𝑥 𝜕 𝑢 ∆𝑥
𝑢 , 𝑢, ∆𝑥 ⋯ (2)
𝜕𝑥 ,
𝜕𝑥 ,
2! 𝜕𝑥 ,
3!
Similarly,
𝜕𝑢 𝑢, 𝑢 ,
𝑂 ∆𝑥 Truncation error
𝜕𝑥 ,
∆𝑥
𝜕𝑢 𝑢 , 𝑢 ,
𝑂 ∆𝑥
𝜕𝑥 ,
2∆𝑥
𝜕 𝑢 𝜕 𝑢 ∆𝑥
Adding up eqns.(1) & (2), we get, 𝑢 , 𝑢 , 2𝑢 , ∆𝑥 ⋯
𝜕𝑥 ,
𝜕𝑥 ,
12
𝜕𝑢 𝑢, 𝑢 ,
≅ Backward Finite Difference
𝜕𝑥 ,
∆𝑥
𝜕𝑢 𝑢 , 𝑢 ,
≅ Central Finite Difference
𝜕𝑥 ,
2∆𝑥
𝜕 𝑢 𝑢 , 2𝑢 , 𝑢 ,
≅ Second Derivative FD
𝜕𝑥 ,
∆𝑥
Numerical Methods Course
Dr. Khaled Ahmida
𝜕𝑢 𝑢 , 𝑢,
≅
𝜕𝑥 ,
∆𝑥
Forward difference
𝜕𝑢 𝑢 , 𝑢,
≅
𝜕𝑦 ,
∆𝑦
Numerical Methods Course
Dr. Khaled Ahmida
𝜕𝑢 𝑢, 𝑢 ,
≅
𝜕𝑥 ,
∆𝑥
Backward difference
𝜕𝑢 𝑢, 𝑢 ,
≅
𝜕𝑦 ,
∆𝑦
Numerical Methods Course
Dr. Khaled Ahmida
𝜕𝑢 𝑢 , 𝑢 ,
≅
𝜕𝑥 ,
2∆𝑥
Central difference
𝜕𝑢 𝑢 , 𝑢 ,
≅
𝜕𝑦 ,
2∆𝑦
Numerical Methods Course
Dr. Khaled Ahmida
𝜕 𝑢 𝑢 , 2𝑢 , 𝑢 ,
≅
𝜕𝑥 ,
∆𝑥
Second Derivative
𝜕 𝑢 𝑢 , 2𝑢 , 𝑢 ,
≅
𝜕𝑦 ,
∆𝑦
Numerical Methods Course
Dr. Khaled Ahmida
𝜕𝑢 𝜕𝑢 𝜕 𝑢 𝜕 𝑢 ∆𝑥 𝜕 𝑢 ∆𝑥
∆𝑥 ⋯ (3)
𝜕𝑦 ,
𝜕𝑦 ,
𝜕𝑥𝜕𝑦 ,
𝜕𝑥 𝜕𝑦 ,
2 𝜕𝑥 𝜕𝑦 ,
6
𝜕𝑢 𝜕 𝑢 ∆𝑥 𝜕 𝑢 ∆𝑥
𝑢 , 𝑢, ∆𝑥 ⋯ (2)
𝜕𝑥 ,
𝜕𝑥 ,
2! 𝜕𝑥 ,
3!
𝜕𝑢 𝜕𝑢 𝜕 𝑢 𝜕 𝑢 ∆𝑥 𝜕 𝑢 ∆𝑥
∆𝑥 ⋯ (4)
𝜕𝑦 ,
𝜕𝑦 ,
𝜕𝑥𝜕𝑦 ,
𝜕𝑥 𝜕𝑦 ,
2 𝜕𝑥 𝜕𝑦 ,
6
Numerical Methods Course
Dr. Khaled Ahmida
𝜕𝑢 𝜕𝑢 𝜕 𝑢 𝜕 𝑢 ∆𝑥 𝜕 𝑢 ∆𝑥
∆𝑥 ⋯ (4)
𝜕𝑦 ,
𝜕𝑦 ,
𝜕𝑥𝜕𝑦 ,
𝜕𝑥 𝜕𝑦 ,
2 𝜕𝑥 𝜕𝑦 ,
6
𝜕𝑢 𝜕𝑢
subtracting (3) from (4), and using the central FD for 𝜕𝑦
and we end up
𝜕𝑦
with, , ,
𝜕 𝑢 𝑢 , 𝑢 , 𝑢 , 𝑢 ,
𝑂 ∆𝑥, ∆𝑦
𝜕𝑥𝜕𝑦 ,
4∆𝑥∆𝑦
Numerical Methods Course
Dr. Khaled Ahmida
Mixed Derivative
𝜕 𝑢 𝑢 , 𝑢 , 𝑢 , 𝑢 ,
≅
𝜕𝑥𝜕𝑦 ,
4∆𝑥∆𝑦
Numerical Methods Course
Dr. Khaled Ahmida