SlideShare a Scribd company logo
1 of 15
Differences Among Difference Schemes
NUMERICAL METHODS FOR PDES
William L. Ruys
Objectives
• Understand the classification of Second Order Linear PDEs
• Understand the Finite Difference Methods
• How to discretize an equation
• How to analyze convergence
• Implement and Analyze Schemes for
• A Parabolic PDE: 1D Heat-Diffusion Equation
• An Elliptic PDE: Laplace’s Equation
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
Second Order Linear PDEs
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
𝐴
𝜕2 𝑢
𝜕𝑥2 + 𝐵
𝜕2 𝑢
𝜕𝑥𝜕𝑦
+ 𝐶
𝜕2 𝑢
𝜕𝑦2 + 𝐷
𝜕𝑢
𝜕𝑥
+E
𝜕𝑢
𝜕𝑦
+ 𝐺 = 0
• 𝐵 − 4𝐴𝐶 = 0
• Evolution with DiffusionParabolic
• 𝐵 − 4𝐴𝐶 < 0
• Steady StateElliptic
• 𝐵 − 4𝐴𝐶 > 0
• Evolution with ConservationHyperbolic
Finite Difference Approximations
FORWARD DIFFERENCEBACKWARD DIFFERENCE
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
SECOND ORDER CENTERED DIFFERENCE
𝜕𝑢𝑖,𝑗
𝜕𝑥
=
𝑢𝑖+1,𝑗 − 𝑢𝑖,𝑗
Δ𝑥
𝜕𝑢𝑖,𝑗
𝜕𝑥
=
𝑢𝑖,𝑗 − 𝑢𝑖−1,𝑗
Δ𝑥
𝜕2
𝑢𝑖,𝑗
𝜕𝑥2
=
𝑢𝑖+1,𝑗 − 2𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗
Δ𝑥 2
Von-Neumann Analysis
• A Finite Difference Equation converges to its PDE when it is stable
• Lax-EquivalenceTheorem
• Break the solution into its Fourier modes and examine one of them.
• Let 𝑢𝑖
𝑛
= 𝑄 𝑚
𝑒 𝑖𝛼𝑥
in the difference equation (Where 𝑖 is the imaginary unit)
• Solve for the amplification factor, 𝑄
• Stable when 𝑄 ≤ 1
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
1D Heat-Diffusion Equation
A PARABOLIC PDE – TEMPERATURE DISTRIBUTION IN A ROD
𝜕𝑢
𝜕𝑡
= 𝑘
𝜕2
𝑢
𝜕𝑦2
𝑢𝑖
𝑛+1
= 𝑢𝑖
𝑛
+
𝑘Δ𝑡
Δ𝑥2 [𝑢𝑖+1
𝑛
− 2 𝑢𝑖,𝑗+1 + 𝑢𝑖−1
𝑛
]
Centered Space Difference !
𝑢𝑖
𝑛
=
−𝑘Δ𝑡
Δ𝑥2 𝑢𝑖+1
𝑛+1
+ 1 +
𝑘Δ𝑡
Δ𝑥2 𝑢𝑖
𝑛+1
+
−𝑘Δ𝑡
Δ𝑥2 𝑢𝑖−1
𝑛+1
BTCS FTCS
Comparison of FTCS and BTCS
BTCS
• Implicit
• Slow
• Unconditionally Stable
FTCS
• Explicit
• Fast
• Conditionally Stable
• Only when
𝑘Δ𝑡
Δ𝑥2 ≤
1
2
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
Error Analysis
• Both schemes have an error O(Δ𝑥2) and O(Δt)
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
Different Boundary Conditions - Example
DIRICHLET
• Heat escapes out of the sides
• Temperature at boundaries is fixed
NEUMANN
• Heat is trapped
• Heat Flux at boundaries is fixed
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
Laplace’s Equation
AN ELLIPTIC PDE – STEADY STATE 2D HEAT
𝜕2
𝑢
𝜕𝑥2
+
𝜕2
𝑢
𝜕𝑦2
= 0
𝑢𝑖,𝑗 =
𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 + 𝑢𝑖,𝑗+1 + 𝑢𝑖,𝑗−1
4
Jacobi Iteration
Iterations through Grid: 999
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
𝜕2
𝑢
𝜕𝑥2 +
𝜕2
𝑢
𝜕𝑦2 = 0
𝑢 𝑥, 0 = 50
𝑢 𝑥, 𝐻 = 0
𝑢 0, 𝑥 = 0
𝑢 𝐿, 𝑥 = 0
𝑢𝑖,𝑗
𝑛+1
=
𝑢𝑖+1,𝑗
𝑛
+ 𝑢𝑖−1,𝑗
𝑛
+ 𝑢𝑖,𝑗+1
𝑛
+ 𝑢𝑖,𝑗−1
𝑛
4
Gauss-Seidel
Iterations through Grid: 692
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
𝜕2
𝑢
𝜕𝑥2 +
𝜕2
𝑢
𝜕𝑦2 = 0
𝑢 𝑥, 0 = 50
𝑢 𝑥, 𝐻 = 0
𝑢 0, 𝑥 = 0
𝑢 𝐿, 𝑥 = 0
𝑢𝑖,𝑗
𝑛+1
=
𝑢𝑖+1,𝑗
𝑛
+ 𝑢𝑖−1,𝑗
𝑛+1
+ 𝑢𝑖,𝑗+1
𝑛
+ 𝑢𝑖,𝑗−1
𝑛+1
4
Successive
Over Relaxation
Iterations through Grid: 395
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
𝜕2
𝑢
𝜕𝑥2 +
𝜕2
𝑢
𝜕𝑦2 = 0
𝑢 𝑥, 0 = 50
𝑢 𝑥, 𝐻 = 0
𝑢 0, 𝑥 = 0
𝑢 𝐿, 𝑥 = 0
𝑢𝑖,𝑗
𝑛+1
= 1 − 𝜔 𝑢𝑖,𝑗
𝑛
+ 𝜔
𝑢𝑖+1,𝑗
𝑛
+ 𝑢𝑖−1,𝑗
𝑛+1
+ 𝑢𝑖,𝑗+1
𝑛
+ 𝑢𝑖,𝑗−1
𝑛+1
4
Iterations Needed to Increase Accuracy
0
2000
4000
6000
8000
10000
12000
0 1 2 3 4 5 6 7 8 9 10
NumberofIterations
Number of Times Error Threshold is Halved from 0.10
SOR Jacobi Gauss Linear (SOR) Poly. (Jacobi) Poly. (Gauss)
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2
High Frequency Error Dampening
𝑒 𝑖𝛼𝑥
𝐹∘
𝛻2Jacobi Iteration Gauss-Seidel

More Related Content

Similar to Differences Among Difference Schemes

9023a85169c3a624b9493f6e992848fcb8932f42340efcdf865b15380ad94688_Lecture-27_E...
9023a85169c3a624b9493f6e992848fcb8932f42340efcdf865b15380ad94688_Lecture-27_E...9023a85169c3a624b9493f6e992848fcb8932f42340efcdf865b15380ad94688_Lecture-27_E...
9023a85169c3a624b9493f6e992848fcb8932f42340efcdf865b15380ad94688_Lecture-27_E...GAURAVKUMAR37337
 
Intro. to quantum chemistry
Intro. to quantum chemistryIntro. to quantum chemistry
Intro. to quantum chemistryRawat DA Greatt
 
hydro chapter_4_b_pipe_network_by louy Al hami
hydro  chapter_4_b_pipe_network_by louy Al hami hydro  chapter_4_b_pipe_network_by louy Al hami
hydro chapter_4_b_pipe_network_by louy Al hami Louy Alhamy
 
Berlin - Conceptual Aspects of Gauge-Gravity Duality
Berlin - Conceptual Aspects of Gauge-Gravity DualityBerlin - Conceptual Aspects of Gauge-Gravity Duality
Berlin - Conceptual Aspects of Gauge-Gravity DualitySebastian De Haro
 
A short introduction to Quantum Computing and Quantum Cryptography
A short introduction to Quantum Computing and Quantum CryptographyA short introduction to Quantum Computing and Quantum Cryptography
A short introduction to Quantum Computing and Quantum CryptographyFacultad de Informática UCM
 
Intro-QM-Chem.ppt
Intro-QM-Chem.pptIntro-QM-Chem.ppt
Intro-QM-Chem.pptsami97008
 
Convex optimization methods
Convex optimization methodsConvex optimization methods
Convex optimization methodsDong Guo
 
Advance enginering mathematics
Advance enginering mathematicsAdvance enginering mathematics
Advance enginering mathematicsUttam Trasadiya
 
what_are_Derivative.pdf
what_are_Derivative.pdfwhat_are_Derivative.pdf
what_are_Derivative.pdfPatrickNokrek
 
Chap-2 Preliminary Concepts and Linear Finite Elements.pptx
Chap-2 Preliminary Concepts and  Linear Finite Elements.pptxChap-2 Preliminary Concepts and  Linear Finite Elements.pptx
Chap-2 Preliminary Concepts and Linear Finite Elements.pptxSamirsinh Parmar
 
Bounded arithmetic in free logic
Bounded arithmetic in free logicBounded arithmetic in free logic
Bounded arithmetic in free logicYamagata Yoriyuki
 
Root Locus Technique.pptx
Root Locus Technique.pptxRoot Locus Technique.pptx
Root Locus Technique.pptxdeepthi717118
 

Similar to Differences Among Difference Schemes (20)

9023a85169c3a624b9493f6e992848fcb8932f42340efcdf865b15380ad94688_Lecture-27_E...
9023a85169c3a624b9493f6e992848fcb8932f42340efcdf865b15380ad94688_Lecture-27_E...9023a85169c3a624b9493f6e992848fcb8932f42340efcdf865b15380ad94688_Lecture-27_E...
9023a85169c3a624b9493f6e992848fcb8932f42340efcdf865b15380ad94688_Lecture-27_E...
 
Unit vi
Unit viUnit vi
Unit vi
 
Differential equations
Differential equationsDifferential equations
Differential equations
 
9 pd es
9 pd es9 pd es
9 pd es
 
Intro. to quantum chemistry
Intro. to quantum chemistryIntro. to quantum chemistry
Intro. to quantum chemistry
 
NANO266 - Lecture 2 - The Hartree-Fock Approach
NANO266 - Lecture 2 - The Hartree-Fock ApproachNANO266 - Lecture 2 - The Hartree-Fock Approach
NANO266 - Lecture 2 - The Hartree-Fock Approach
 
hydro chapter_4_b_pipe_network_by louy Al hami
hydro  chapter_4_b_pipe_network_by louy Al hami hydro  chapter_4_b_pipe_network_by louy Al hami
hydro chapter_4_b_pipe_network_by louy Al hami
 
Berlin - Conceptual Aspects of Gauge-Gravity Duality
Berlin - Conceptual Aspects of Gauge-Gravity DualityBerlin - Conceptual Aspects of Gauge-Gravity Duality
Berlin - Conceptual Aspects of Gauge-Gravity Duality
 
Dissertation
DissertationDissertation
Dissertation
 
A short introduction to Quantum Computing and Quantum Cryptography
A short introduction to Quantum Computing and Quantum CryptographyA short introduction to Quantum Computing and Quantum Cryptography
A short introduction to Quantum Computing and Quantum Cryptography
 
Intro-QM-Chem.ppt
Intro-QM-Chem.pptIntro-QM-Chem.ppt
Intro-QM-Chem.ppt
 
Intro-QM-Chem.ppt
Intro-QM-Chem.pptIntro-QM-Chem.ppt
Intro-QM-Chem.ppt
 
Convex optimization methods
Convex optimization methodsConvex optimization methods
Convex optimization methods
 
Advance enginering mathematics
Advance enginering mathematicsAdvance enginering mathematics
Advance enginering mathematics
 
what_are_Derivative.pdf
what_are_Derivative.pdfwhat_are_Derivative.pdf
what_are_Derivative.pdf
 
Chap-2 Preliminary Concepts and Linear Finite Elements.pptx
Chap-2 Preliminary Concepts and  Linear Finite Elements.pptxChap-2 Preliminary Concepts and  Linear Finite Elements.pptx
Chap-2 Preliminary Concepts and Linear Finite Elements.pptx
 
Bounded arithmetic in free logic
Bounded arithmetic in free logicBounded arithmetic in free logic
Bounded arithmetic in free logic
 
Module_VI.pdf
Module_VI.pdfModule_VI.pdf
Module_VI.pdf
 
Root Locus Technique.pptx
Root Locus Technique.pptxRoot Locus Technique.pptx
Root Locus Technique.pptx
 
Bird’s-eye view of Gaussian harmonic analysis
Bird’s-eye view of Gaussian harmonic analysisBird’s-eye view of Gaussian harmonic analysis
Bird’s-eye view of Gaussian harmonic analysis
 

Differences Among Difference Schemes

  • 1. Differences Among Difference Schemes NUMERICAL METHODS FOR PDES William L. Ruys
  • 2. Objectives • Understand the classification of Second Order Linear PDEs • Understand the Finite Difference Methods • How to discretize an equation • How to analyze convergence • Implement and Analyze Schemes for • A Parabolic PDE: 1D Heat-Diffusion Equation • An Elliptic PDE: Laplace’s Equation 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2
  • 3. Second Order Linear PDEs 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2 𝐴 𝜕2 𝑢 𝜕𝑥2 + 𝐵 𝜕2 𝑢 𝜕𝑥𝜕𝑦 + 𝐶 𝜕2 𝑢 𝜕𝑦2 + 𝐷 𝜕𝑢 𝜕𝑥 +E 𝜕𝑢 𝜕𝑦 + 𝐺 = 0 • 𝐵 − 4𝐴𝐶 = 0 • Evolution with DiffusionParabolic • 𝐵 − 4𝐴𝐶 < 0 • Steady StateElliptic • 𝐵 − 4𝐴𝐶 > 0 • Evolution with ConservationHyperbolic
  • 4. Finite Difference Approximations FORWARD DIFFERENCEBACKWARD DIFFERENCE 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2 SECOND ORDER CENTERED DIFFERENCE 𝜕𝑢𝑖,𝑗 𝜕𝑥 = 𝑢𝑖+1,𝑗 − 𝑢𝑖,𝑗 Δ𝑥 𝜕𝑢𝑖,𝑗 𝜕𝑥 = 𝑢𝑖,𝑗 − 𝑢𝑖−1,𝑗 Δ𝑥 𝜕2 𝑢𝑖,𝑗 𝜕𝑥2 = 𝑢𝑖+1,𝑗 − 2𝑢𝑖,𝑗 + 𝑢𝑖−1,𝑗 Δ𝑥 2
  • 5. Von-Neumann Analysis • A Finite Difference Equation converges to its PDE when it is stable • Lax-EquivalenceTheorem • Break the solution into its Fourier modes and examine one of them. • Let 𝑢𝑖 𝑛 = 𝑄 𝑚 𝑒 𝑖𝛼𝑥 in the difference equation (Where 𝑖 is the imaginary unit) • Solve for the amplification factor, 𝑄 • Stable when 𝑄 ≤ 1 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2
  • 6. 1D Heat-Diffusion Equation A PARABOLIC PDE – TEMPERATURE DISTRIBUTION IN A ROD 𝜕𝑢 𝜕𝑡 = 𝑘 𝜕2 𝑢 𝜕𝑦2 𝑢𝑖 𝑛+1 = 𝑢𝑖 𝑛 + 𝑘Δ𝑡 Δ𝑥2 [𝑢𝑖+1 𝑛 − 2 𝑢𝑖,𝑗+1 + 𝑢𝑖−1 𝑛 ] Centered Space Difference ! 𝑢𝑖 𝑛 = −𝑘Δ𝑡 Δ𝑥2 𝑢𝑖+1 𝑛+1 + 1 + 𝑘Δ𝑡 Δ𝑥2 𝑢𝑖 𝑛+1 + −𝑘Δ𝑡 Δ𝑥2 𝑢𝑖−1 𝑛+1 BTCS FTCS
  • 7. Comparison of FTCS and BTCS BTCS • Implicit • Slow • Unconditionally Stable FTCS • Explicit • Fast • Conditionally Stable • Only when 𝑘Δ𝑡 Δ𝑥2 ≤ 1 2 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2
  • 8. Error Analysis • Both schemes have an error O(Δ𝑥2) and O(Δt) 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2
  • 9. Different Boundary Conditions - Example DIRICHLET • Heat escapes out of the sides • Temperature at boundaries is fixed NEUMANN • Heat is trapped • Heat Flux at boundaries is fixed 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2
  • 10. Laplace’s Equation AN ELLIPTIC PDE – STEADY STATE 2D HEAT 𝜕2 𝑢 𝜕𝑥2 + 𝜕2 𝑢 𝜕𝑦2 = 0 𝑢𝑖,𝑗 = 𝑢𝑖+1,𝑗 + 𝑢𝑖−1,𝑗 + 𝑢𝑖,𝑗+1 + 𝑢𝑖,𝑗−1 4
  • 11. Jacobi Iteration Iterations through Grid: 999 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2 𝜕2 𝑢 𝜕𝑥2 + 𝜕2 𝑢 𝜕𝑦2 = 0 𝑢 𝑥, 0 = 50 𝑢 𝑥, 𝐻 = 0 𝑢 0, 𝑥 = 0 𝑢 𝐿, 𝑥 = 0 𝑢𝑖,𝑗 𝑛+1 = 𝑢𝑖+1,𝑗 𝑛 + 𝑢𝑖−1,𝑗 𝑛 + 𝑢𝑖,𝑗+1 𝑛 + 𝑢𝑖,𝑗−1 𝑛 4
  • 12. Gauss-Seidel Iterations through Grid: 692 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2 𝜕2 𝑢 𝜕𝑥2 + 𝜕2 𝑢 𝜕𝑦2 = 0 𝑢 𝑥, 0 = 50 𝑢 𝑥, 𝐻 = 0 𝑢 0, 𝑥 = 0 𝑢 𝐿, 𝑥 = 0 𝑢𝑖,𝑗 𝑛+1 = 𝑢𝑖+1,𝑗 𝑛 + 𝑢𝑖−1,𝑗 𝑛+1 + 𝑢𝑖,𝑗+1 𝑛 + 𝑢𝑖,𝑗−1 𝑛+1 4
  • 13. Successive Over Relaxation Iterations through Grid: 395 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2 𝜕2 𝑢 𝜕𝑥2 + 𝜕2 𝑢 𝜕𝑦2 = 0 𝑢 𝑥, 0 = 50 𝑢 𝑥, 𝐻 = 0 𝑢 0, 𝑥 = 0 𝑢 𝐿, 𝑥 = 0 𝑢𝑖,𝑗 𝑛+1 = 1 − 𝜔 𝑢𝑖,𝑗 𝑛 + 𝜔 𝑢𝑖+1,𝑗 𝑛 + 𝑢𝑖−1,𝑗 𝑛+1 + 𝑢𝑖,𝑗+1 𝑛 + 𝑢𝑖,𝑗−1 𝑛+1 4
  • 14. Iterations Needed to Increase Accuracy 0 2000 4000 6000 8000 10000 12000 0 1 2 3 4 5 6 7 8 9 10 NumberofIterations Number of Times Error Threshold is Halved from 0.10 SOR Jacobi Gauss Linear (SOR) Poly. (Jacobi) Poly. (Gauss) 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2
  • 15. High Frequency Error Dampening 𝑒 𝑖𝛼𝑥 𝐹∘ 𝛻2Jacobi Iteration Gauss-Seidel