15
Differences Among Difference Schemes NUMERICAL METHODS FOR PDES William L. Ruys

Differences Among Difference Schemes

Embed Size (px)

Citation preview

Page 1: Differences Among Difference Schemes

Differences Among Difference Schemes

NUMERICAL METHODS FOR PDES

Will iam L. Ruys

Page 2: Differences Among Difference Schemes

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

Page 3: Differences Among Difference Schemes

Second Order Linear PDEs

𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2

+E

• Evolution with DiffusionParabolic

• Steady StateElliptic

• Evolution with ConservationHyperbol

ic

Page 4: Differences Among Difference Schemes

Finite Difference ApproximationsFORWARD DIFFERENCEBACKWARD DIFFERENCE

𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2

SECOND ORDER CENTERED DIFFERENCE

𝜕𝑢𝑖 , 𝑗

𝜕 𝑥 =𝑢𝑖+1 , 𝑗−𝑢𝑖 , 𝑗

Δ𝑥𝜕𝑢𝑖 , 𝑗

𝜕 𝑥 =𝑢𝑖 , 𝑗−𝑢𝑖 −1 , 𝑗

Δ𝑥

𝜕2𝑢𝑖 , 𝑗

𝜕 𝑥2=𝑢𝑖+1 , 𝑗−2𝑢𝑖 , 𝑗+𝑢𝑖− 1 , 𝑗

(Δ𝑥 )2

Page 5: Differences Among Difference Schemes

Von-Neumann Analysis• A Finite Difference Equation converges to its PDE when it

is stable• Lax-Equivalence Theorem

• 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 𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2

Page 6: Differences Among Difference Schemes

1D Heat-Diffusion EquationA PARABOLIC PDE – TEMPERATURE DISTRIBUTION IN A ROD

𝜕𝑢𝜕𝑡 =𝑘 𝜕

2𝑢𝜕 𝑦 2

Forward Time Difference!

𝑢𝑖𝑛+1=𝑢𝑖

𝑛+𝑘 Δ𝑡Δ𝑥2

[𝑢𝑖+1𝑛 −2𝑢𝑖 , 𝑗+1+𝑢𝑖−1

𝑛 ]

Backward Time

Difference! Centered Space Difference !

𝑢𝑖𝑛=−𝑘 Δ𝑡Δ𝑥2

𝑢𝑖+1

𝑛+1

+[1+𝑘 Δ𝑡Δ𝑥2 ]𝑢𝑖𝑛+1+

−𝑘 Δ𝑡Δ𝑥2

𝑢𝑖−1

𝑛+1

BTCS FTCS

Page 7: Differences Among Difference Schemes

Comparison of FTCS and BTCSBTCS

• Implicit• Slow• Unconditionally Stable

FTCS

• Explicit• Fast• Conditionally Stable

• Only when

𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2

Page 8: Differences Among Difference Schemes

Error Analysis• Both schemes have an error O() and

O()

𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2

Page 9: Differences Among Difference Schemes

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

Page 10: Differences Among Difference Schemes

Laplace’s EquationAN ELLIPTIC PDE – STEADY STATE 2D HEAT

𝜕2𝑢𝜕𝑥2

+𝜕2𝑢𝜕 𝑦2

=0Centered

Differences!

𝑢𝑖 , 𝑗=𝑢𝑖+1 , 𝑗+𝑢𝑖−1 , 𝑗+𝑢𝑖 , 𝑗+ 1+𝑢𝑖 , 𝑗−1

4

Page 11: Differences Among Difference Schemes

Jacobi IterationIterations through Grid: 999

𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2𝑢𝑖 , 𝑗𝑛+1=

𝑢𝑖+1 , 𝑗𝑛 +𝑢𝑖− 1 , 𝑗

𝑛 +𝑢𝑖 , 𝑗+1𝑛 +𝑢𝑖 , 𝑗− 1

𝑛

4

Page 12: Differences Among Difference Schemes

Gauss-SeidelIterations through Grid: 692

𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2𝑢𝑖 , 𝑗𝑛+1=

𝑢𝑖+1 , 𝑗𝑛 +𝑢𝑖− 1 , 𝑗

𝑛+1 +𝑢𝑖 , 𝑗+1𝑛 +𝑢𝑖 , 𝑗− 1

𝑛+1

4

Page 13: Differences Among Difference Schemes

Successive Over Relaxation Iterations through Grid: 395

𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2𝑢𝑖 , 𝑗𝑛+1= (1−𝜔 )𝑢𝑖 , 𝑗

𝑛 +𝜔𝑢𝑖+1 , 𝑗𝑛 +𝑢𝑖−1 , 𝑗

𝑛+1 +𝑢𝑖 , 𝑗+ 1𝑛 +𝑢𝑖 , 𝑗−1

𝑛+1

4

Page 14: Differences Among Difference Schemes

Iterations Needed to Increase Accuracy

0 1 2 3 4 5 6 7 8 9 100

1000

2000

3000

4000

5000

6000

7000

8000

9000

10000

SOR Linear (SOR) JacobiPolynomial (Jacobi) Gauss Polynomial (Gauss)

Number of Times Error Threshold is Halved from 0.10

Num

ber

of It

erat

ions

𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2

Page 15: Differences Among Difference Schemes

High Frequency Error Dampening

𝑒𝑖𝛼 𝑥

𝐹 ∘

𝛻2

Jacobi Iteration Gauss-Seidel