Chapter 01 - Introduction To Finite Difference
Chapter 01 - Introduction To Finite Difference
• Introduction
• Final = 45 (2 hours)
• Total = 75
Chapter 01
Navier-Stokes Equations
Introduction
Heat Equation
Introduction
• Partial Differential Equations (PDEs) are the dominant form of governing equations in modeling.
• Many PDEs cannot be solve analytically.
• To solve them, we use a lot of assumptions.
Heat Equation
Navier-Stokes Equations
Introduction
• The most common schemes are: Finite Difference, Finite Volume and Finite Element.
• Here, we will study Finite Difference as it is easy and simple.
What is Finite Difference?
• Taylor series can applied if the function 𝑢(𝑥) and its derivatives are:
• Single valued
• Finite
• Continuous
1 1
𝑢 𝑥 + Δ𝑥 = 𝑢 𝑥 + 𝑢′ 𝑥 Δ𝑥 + 𝑢′′ 𝑥 Δ𝑥 2 + 𝑢′′′ 𝑥 Δ𝑥 3 + ⋯ (𝑎)
2 6
1 1
𝑢 𝑥 − Δ𝑥 = 𝑢 𝑥 − 𝑢′ 𝑥 Δ𝑥 + 𝑢′′ 𝑥 Δ𝑥 2 − 𝑢′′′ 𝑥 Δ𝑥 3 + ⋯ (𝑏)
2 6
First Derivative - Forward Difference
1 1
𝑢 𝑥 + Δ𝑥 = 𝑢 𝑥 + 𝑢′ 𝑥 Δ𝑥 + 𝑢′′ 𝑥 Δ𝑥 2 + 𝑢′′′ 𝑥 Δ𝑥 3 + ⋯ (𝑎)
2 6
1 1
𝑢 𝑥 − Δ𝑥 = 𝑢 𝑥 − 𝑢′ 𝑥 Δ𝑥 + 𝑢′′ 𝑥 Δ𝑥 2 − 𝑢′′′ 𝑥 Δ𝑥 3 + ⋯ (𝑏)
2 6
1 1
𝑢 𝑥 + Δ𝑥 − 𝑢 𝑥 = 𝑢′ 𝑥 Δ𝑥 + 𝑢′′ 𝑥 Δ𝑥 2 + 𝑢′′′ 𝑥 Δ𝑥 3 + ⋯
2 6
𝑢 𝑥 + Δ𝑥 − 𝑢 𝑥
𝑢′ 𝑥 = + 𝑂(Δ𝑥)
Δ𝑥
Error Order
1 1
𝑢 𝑥 − 𝑢 𝑥 − Δ𝑥 = 𝑢′ 𝑥 Δ𝑥 − 𝑢′′ 𝑥 Δ𝑥 2 + 𝑢′′′ 𝑥 Δ𝑥 3 + ⋯
2 6
𝑢 𝑥 − 𝑢 𝑥 − Δ𝑥
𝑢′ 𝑥 = + 𝑂(Δ𝑥)
Δ𝑥
Error Order
1 ′′′
𝑢 𝑥 + Δ𝑥 − 𝑢 𝑥 − Δ𝑥 = 2𝑢′ 𝑥 Δ𝑥 + 𝑢 𝑥 Δ𝑥 3 + ⋯
3
𝑢 𝑥 + Δ𝑥 − 𝑢 𝑥 − Δ𝑥
𝑢′ 𝑥 = + 𝑂(Δ𝑥 2 )
2Δ𝑥
Error Order
𝑢 𝑥 + Δ𝑥 + 𝑢 𝑥 − Δ𝑥 = 2𝑢 𝑥 + Δ𝑥 2 𝑢′′ 𝑥 + 𝑂(Δ𝑥 4 )
𝑢 𝑥 + Δ𝑥 − 2𝑢 𝑥 + 𝑢 𝑥 − Δ𝑥
𝑢′′ 𝑥 = + 𝑂(Δ𝑥 2 )
Δ𝑥 2
Error Order
𝑢 𝑥 + Δ𝑥 − 𝑢 𝑥
𝑢′ 𝑥 =
Δ𝑥
𝑢 𝑥 − 𝑢 𝑥 − Δ𝑥
𝑢′ 𝑥 =
Δ𝑥
Central Difference – Second Order accurate 𝑂(Δ𝑥2) Central Difference – Second Order accurate 𝑂(Δ𝑥2)
𝑢 𝑥 + Δ𝑥 − 𝑢 𝑥 − Δ𝑥 𝑢 𝑥 + Δ𝑥 − 2𝑢 𝑥 + 𝑢 𝑥 − Δ𝑥
𝑢′ 𝑥 = 𝑢′′ 𝑥 =
2Δ𝑥 Δ𝑥 2
Partial derivatives
𝑖, 𝑗 + 1
𝑢 𝑥, 𝑡 𝑜𝑟 𝑢 𝑥, 𝑡 … 𝑒𝑡𝑐.
𝑖 − 1, 𝑗 𝑖, 𝑗 𝑖 + 1, 𝑗
𝑥 , 𝑦 , 𝑡 𝑎𝑟𝑒 𝑖𝑛𝑑𝑒𝑝𝑒𝑛𝑑𝑒𝑛𝑡 𝑣𝑎𝑟𝑖𝑎𝑏𝑙𝑒𝑠 𝑢𝑖,𝑗
𝑡 = 𝑗Δt or y = 𝑗Δ𝑦
And i , j are integers 𝑖, 𝑗 − 1
Δt orΔy
Δ𝑥 𝒙
𝑥 = 𝑖Δ𝑥
Notation System
t or 𝒚
𝑖, 𝑗 + 1
𝑖 − 1, 𝑗 𝑖, 𝑗 𝑖 + 1, 𝑗
𝑢𝑖,𝑗
𝑡 = 𝑗Δt or y = 𝑗Δ𝑦
𝑖, 𝑗 − 1
Δt orΔy
Δ𝑥 𝒙
𝑥 = 𝑖. Δ𝑥
Partial derivatives
𝑑𝑢 𝑢𝑖+1,𝑗 − 𝑢𝑖−1,𝑗 𝑖, 𝑗 + 1
= , 𝑒𝑟𝑟𝑜𝑟 𝑂(Δ𝑥 2 )
𝑑𝑥 𝑖,𝑗
2Δ𝑥
𝑖 − 1, 𝑗 𝑖, 𝑗 𝑖 + 1, 𝑗
𝑢𝑖,𝑗
𝑑𝑢 𝑢𝑖,𝑗+1 − 𝑢𝑖,𝑗−1
𝑡 = 𝑗Δt or y = 𝑗Δ𝑦
𝑖, 𝑗 − 1
= , 𝑒𝑟𝑟𝑜𝑟 𝑂(Δ𝑦 2 )
𝑑𝑦 𝑖,𝑗
2Δ𝑦
Δt orΔy
𝑑𝑢 𝑢𝑖,𝑗+1 − 𝑢𝑖,𝑗
= , 𝑒𝑟𝑟𝑜𝑟 𝑂(Δ𝑡)
𝑑𝑡 𝑖,𝑗
Δ𝑡
Δ𝑥 𝒙
𝑥 = 𝑖. Δ𝑥
Partial derivatives
𝑖, 𝑗 + 1
𝑑2𝑢 𝑢𝑖+1,𝑗 − 2𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗
= , 𝑒𝑟𝑟𝑜𝑟 𝑂(Δ𝑥 2 )
𝑑𝑥 2 𝑖,𝑗
Δ𝑥 2
𝑖 − 1, 𝑗 𝑖, 𝑗 𝑖 + 1, 𝑗
𝑢𝑖,𝑗
𝑡 = 𝑗Δt or y = 𝑗Δ𝑦
𝑖, 𝑗 − 1
Δt orΔy
Δ𝑥 𝒙
𝑥 = 𝑖. Δ𝑥
Second Order PDE’s
The General Transport Equation
𝜕𝜙
𝜌 + 𝜌𝑉 ∙ 𝛻𝜙 = 𝛻 ∙ Γ𝜙 𝛻𝜙 + 𝑆𝜙
𝜕𝑡
Where:
𝑉 = 𝑢𝑖 + 𝑣𝑗 + 𝑤𝑘
𝜕 𝜕 𝜕
𝛻≡ 𝑖+ 𝑗+ 𝑘
𝜕𝑥 𝜕𝑦 𝜕𝑧
Second Order PDE’s
The General Transport Equation Terms
𝜕𝜙
𝜌 + 𝜌𝑉 ∙ 𝛻𝜙 = 𝛻 ∙ Γ𝜙 𝛻𝜙 + 𝑆ด
𝜙
ถ 𝜕𝑡
Transient or Convective Term Diffusion term Source term
Unsteady term
𝜕2𝑇 𝜕2𝑇
+ =0 Laplace’s equation
𝜕𝑥 2 𝜕𝑦 2
𝜕2𝑇 𝜕2𝑇
+ + 𝑞𝑔𝑒𝑛 = 0 Poisson’s equation
𝜕𝑥 2 𝜕𝑦 2
𝜕𝑇 𝜕2𝑇
=𝛼 2 Transient or unsteady 1-D conduction
𝜕𝑡 𝜕𝑥
Examples of Second Order PDE
𝜕2𝑢 𝜕 2𝑢
2
= 𝛼2 2
𝜕𝑡 𝜕𝑥
𝑏2 − 4𝑎𝑐 > 0