0% found this document useful (0 votes)
109 views

Chapter 9 - Numerical Methods For 1D Unsteady Heat & Wave Equations

This lecture discusses finite difference methods for solving partial differential equations (PDEs). It focuses on the linear Korteweg–de Vries–Burgers (KDV-Burgers) equation as a model equation to examine the effects of convection, diffusion, and dispersion on transport. Convection alone preserves the shape of the transport quantity u(t,x) but shifts it to the right at a speed c. Diffusion reduces the amplitudes of higher frequency components over time, smoothing out spikes. Dispersion causes different frequency components to travel at different speeds, with higher frequencies moving faster, reducing the maximum amplitude of u(t,x). The combined effects of convection, diffusion

Uploaded by

Ajay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
109 views

Chapter 9 - Numerical Methods For 1D Unsteady Heat & Wave Equations

This lecture discusses finite difference methods for solving partial differential equations (PDEs). It focuses on the linear Korteweg–de Vries–Burgers (KDV-Burgers) equation as a model equation to examine the effects of convection, diffusion, and dispersion on transport. Convection alone preserves the shape of the transport quantity u(t,x) but shifts it to the right at a speed c. Diffusion reduces the amplitudes of higher frequency components over time, smoothing out spikes. Dispersion causes different frequency components to travel at different speeds, with higher frequencies moving faster, reducing the maximum amplitude of u(t,x). The combined effects of convection, diffusion

Uploaded by

Ajay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 60

Lecture 36

Last lecture:
Methods for BVP

This lecture:

Chapter 9

Finite Difference Methods for

Partial Differential Equations

(PDEs)
9.1 Effects of Convection, Diffusion and Dispersion on Transport --- Linear KDV-Burgers Equation

i. Model Eqn. for transport (of wave, mass, momentum, energy,…)

𝜕𝑢 𝜕𝑢 𝜕2 𝑢 𝜕3 𝑢
+ 𝑐 = 𝜈 2 + 𝐷 3 (1)
𝜕𝑡 𝜕𝑥 𝜕𝑥 𝜕𝑥

c = convection (or advection) speed


n = diffusion coefficient
D = dispersion coefficient
Domain of interest: -<x<.
Initial condition: u(t=0, x) = f(x) (= exp(-x2) for example)

Question: what roles do c, n, and D play in the transport of u?


Or what physical phenomena are associated with c, n, and D?
𝜕𝑢 𝜕𝑢 𝜕2𝑢 𝜕3𝑢
Exact solution for Linear KDV-Burgers Equation: +𝑐 =𝜈 2+𝐷 3
𝜕𝑡 𝜕𝑥 𝜕𝑥 𝜕𝑥

Method: using Fourier transformation in space


1 ∞ −𝑖𝑘𝑥 𝑑𝑥
𝑢(𝑡,
ො 𝑘) = ‫׬‬ 𝑢(𝑡, 𝑥)𝑒 (2a)
2𝜋 −∞

ො 𝑘)𝑒 𝑖𝑘𝑥 𝑑𝑘
𝑢(𝑡, 𝑥) = ‫׬‬−∞ 𝑢(𝑡, (inverse FT) (2b)

Apply (2b) to (1), we obtain



𝜕𝑢
+ 𝑖𝑐𝑘 𝑢ො = −𝜈𝑘 2 𝑢ො − 𝑖𝐷𝑘 3 𝑢ො (3)
𝜕𝑡

I.C. ො = 0, k) = ‫׬‬−∞ 𝑓 𝑥 𝑒 −𝑖𝑘𝑥 𝑑𝑥 = 𝑓መ 𝑘
𝑢(t (4)

መ 1 ∞ 2
For f(x) = exp(-x2), 𝑓(𝑘) = 2𝜋 ‫׬‬−∞ 𝑒 −𝑥 𝑒 −𝑖𝑘𝑥 𝑑𝑥
2 ∞ −𝑥 2 1 −𝑘 2/4
= න 𝑒 𝑐𝑜𝑠( 𝑘𝑥)𝑑𝑥 = 𝑒
2𝜋 0 2 𝜋

Integrating (3) w.r.t. t and applying (4) => ො 𝑘) = 𝑓መ 𝑘 𝑒𝑥𝑝[ −𝑖𝑘𝑐𝑡 − 𝜈𝑘 2 𝑡 − 𝑖𝐷𝑘 3 𝑡]
𝑢(𝑡,


ො 𝑘)𝑒 𝑖𝑘𝑥 𝑑𝑘 =‫׬‬−∞ 𝑓መ 𝑘 𝑒𝑥𝑝[ 𝑖𝑘𝑥 − 𝑖𝑘𝑐𝑡 − 𝜈𝑘 2 𝑡 − 𝑖𝐷𝑘 3 𝑡] 𝑑𝑥
Inverse Fourier transformation =>: 𝑢(𝑡, 𝑥) = න 𝑢(𝑡,
−∞
Taking the real part we obtain,

𝑢 𝑡, 𝑥 = 𝑅𝑒 ‫׬‬−∞ 𝑓መ 𝑘 𝑒𝑥𝑝(−𝜈𝑘 2 𝑡) 𝑒𝑥𝑝 𝑖𝑘 𝑥 − 𝑐 + 𝐷𝑘 2 𝑡 (6)

For some special 𝑓መ 𝑘 , close form solution may be obtained;


otherwise, accurate numerical integration can be applied to obtain “exact” solution given by (6).
ii. Effect of Convection: c=1; n=D=0 1.2
c=1
∞ u(t=0)
Eq. (6)  𝑢 𝑡, 𝑥 = 𝑅𝑒 ‫׬‬−∞ 𝑓መ 𝑘 𝑒𝑥𝑝 𝑖𝑘(𝑥 − 𝑐𝑡) 1
u(t=1)

= 𝑓(𝑥 − 𝑐𝑡)
0.8
For IC: u(t=0, x)=f(x)= exp(-x2),
n =0
c=1
 u(t, x)= exp[-(x-ct)2], 0.6 D=0

• No damping since n=0.


0.4
• No dispersion since D=0.
• Linear convection alone  shape of u(t, x) is preserved. 0.2

• All wave components are traveling to right at speed c=1. 0


-3 -2 -1 0 1 2 3 4 x
ii. Effect of Convection + Diffusion (c=1, n=0.1, D=0):

𝜕𝑢 𝜕𝑢 𝜕2 𝑢
+ 𝑐 = 𝜈 2 (1)
𝜕𝑡 𝜕𝑥 𝜕𝑥

𝑢 𝑡, 𝑥 = 𝑅𝑒 ‫׬‬−∞ 𝑓መ 𝑘 𝑒𝑥𝑝(−𝜈𝑘 2 𝑡) 𝑒𝑥𝑝 𝑖𝑘(𝑥 − 𝑐𝑡)
Solution at t=0 and t=1:
Effect of diffusion: 1.2
u c =1
1 D=0
መ −𝑘 2 /4
I.C.: 𝑓(𝑘) = 𝑒
2 𝜋 1 IC; t=0

D=0, n =0, t=1


Diffusion reduces amplitudes of all components (except k=0). n =0.1, t=1
0.8
n =0.2, t=1

Because of 𝑒𝑥𝑝(−𝜈𝑘 2 𝑡)
term in the integration, 0.6
high-k components (short waves) are damped out more quickly.
0.4
Very spiky initial profiles will become smooth later.
0.2

0
-3 -2 -1 0 1 2 3 4 x
iii. Effect of Convection + Dispersion (c=1, n=0, D=0.1)

𝜕𝑢 𝜕𝑢 𝜕2 𝑢 𝜕3 𝑢
+ 𝑐 =0 ∗ 2 + 𝐷 3 (1)
𝜕𝑡 𝜕𝑥 𝜕𝑥 𝜕𝑥

Solution at t=0 and t=1: 𝑢(𝑡, 𝑥) = න 𝑓መ 𝑘 𝑒𝑥𝑝[ 𝑖𝑘𝑥 − 𝑖𝑘𝑐𝑡 − 𝜈𝑘 2 𝑡 − 𝑖𝐷𝑘 3 𝑡] 𝑑𝑥
1.2 −∞
u c =1 n =0
IC; t=0
1
D=0, n =0, t=1
D=0.1, t=1 c(k) = c +Dk2
0.8
D=0.2, t=1

0.6 D=0.4, t=1

0.4

0.2

0 Role of dispersion:
-0.2 • It causes waves of different k to travel at different wave speed.
-0.4
x
High-k components (short waves) travel faster than the low-k
-4 -2 0 2 4 6 8 10 12
components (long waves).

• The maximum amplitude of u(t, x) at D>0 is reduced. It is not caused by “damping” or “diffusion”.
It is caused by the dispersion or spreading out of all components due to different wave speed
iv. Effect of Convection (c=1)+ Diffusion +Dispersion

𝜕𝑢 𝜕𝑢 𝜕2 𝑢 𝜕3 𝑢
+ 𝑐 =n ∗ 2 + 𝐷 3 (1)
𝜕𝑡 𝜕𝑥 𝜕𝑥 𝜕𝑥

𝑢(𝑡, 𝑥) = න 𝑓መ 𝑘 𝑒𝑥𝑝[ 𝑖𝑘𝑥 − 𝑖𝑘𝑐𝑡 − 𝜈𝑘 2 𝑡 − 𝑖𝐷𝑘 3 𝑡] 𝑑𝑥
−∞

𝑒𝑥𝑝{ 𝑖𝑘[𝑥 − 𝑐+Dk2 𝑡]} ∗ exp(−𝜈𝑘 2 𝑡)


Solution at t=0 and t=1:
=𝑒𝑥𝑝{ 𝑖𝑘[𝑥 − c(k)𝑡]} ∗ exp(−𝜈𝑘 2 𝑡)
1.2
u c=1 IC; t=0
1
D=0, n =0, t=1 c(k)  c +Dk2
n =0.1, t=1 , D=0
0.8
D=0.2, t=1 , n=0
D=0.2, n =0.1, t=1
• All components are “convected” to the right.
0.6

0.4 • Short waves travel faster; initial profile gets dispersed when D≠0.
0.2

0
• All components (except for k=0) suffer from “damping”

-0.2 through diffusion & the amplitude is reduced.


-0.4
-4 -2 0 2 4 6 8 10 12 x
Lecture 37
Last lecture:
KDV-Burgers equation

This lecture:

Finite Difference Methods for Heat Eqn.


9.2 Finite Difference Method for Parabolic Equations

9.2.1 Model Problems for finite domain


𝜕𝑢 𝜕2 𝑢
= 𝜈 2 (7)
𝜕𝑡 𝜕𝑥

IC. u(t=0, x)= f(x), 0x1. (8)


B.C. u(t, x=0)=u(t, x=1)=0 (9)

* Analytical solution via separation of variables


𝑢(t, x) = σ∞ 2
𝑘=1 𝑎𝑘 𝑠𝑖𝑛( 𝑘𝜋𝑥) 𝑒𝑥𝑝[−𝜈 (𝑘𝜋𝑡 ) ] (10)

Coefficient an can be found using standard sine series expansion,


1
𝑎𝑘 = 2 ‫׬‬0 𝑓 𝑥 𝑠𝑖𝑛(𝑘𝜋𝑥)𝑑𝑥 (11)

* መ
The role of ak in (10) is similar to that of 𝑓(𝑘) in (6).

* Typically, only a few terms are needed in (10) due to exponential decay with increasing k.

* We can use (10) to compare with the numerical solution.


9.2.2 Explicit method for parabolic equation 𝜕𝑢 𝜕2𝑢
=𝜈 2
𝜕𝑡 𝜕𝑥

Discretize the PDE at (m, n)


𝜕𝑢 𝑛 𝑛+1 −𝑢𝑛
𝑢𝑚 𝑚
* Forward difference in time: ቚ ≈ (12)
𝜕𝑡 𝑚 𝛥𝑡

𝑛 𝑛 𝑛 +𝑢𝑛
𝜕2 𝑢 𝑢𝑚+1 −2𝑢𝑚 𝑚−1
* Central difference in space: ቚ ≈ (13)
𝜕𝑥 2 𝑚 (𝛥𝑥 ) 2

𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
 𝑚
=𝜈 2
𝑚−1
(14)
𝛥𝑡 (𝛥𝑥)

 𝑛+1 = 𝑟𝑢 𝑛
𝑢𝑚 𝑛 𝑛
𝑚+1 + 1 − 2𝑟 𝑢𝑚 + 𝑟𝑢𝑚−1 (15)

𝜈𝛥𝑡
where r = (𝛥𝑥)2 (16)

* This is an explicit procedure since everything on the RHS is known.


𝑛+1 𝑛 𝑛 𝑛
Numerical Example 𝑢𝑚 = 𝑟𝑢𝑚+1 + 1 − 2𝑟 𝑢𝑚 + 𝑟𝑢𝑚−1

2𝑥, 0 ≤ 𝑥 ≤ 0.5
IC 𝑢(0, 𝑥) = ቊ
2 − 2𝑥, 0.5 < 𝑥 ≤ 1

∞ 8 (−1)𝑚
𝑢𝑒𝑥𝑎𝑐𝑡 (𝑥, t) = σ𝑚=0 2 𝑠𝑖𝑛[ (2𝑚 + 1)𝜋𝑥] 𝑒𝑥𝑝[−𝜈 2𝑚 + 1 𝜋𝑡 2] (17)
𝜋 (2𝑚+1)2

Choose n =1, Dx=0.05 (20 intervals).

i) Dt=0.0012  r = 𝜈𝛥𝑡 / (𝛥𝑥 )2 = 0.0012/0.052 = 0.48 IC


1 u; t=0.0156 r=0.52
Dt=0.0013  (𝛥𝑥 )2
u_exact
ii) r =𝜈𝛥𝑡 / = 0.0013/0.052 = 0.52 u; t=0.0312
u_exact
0.8 u; t=0.0624
u_exact
Solutions are accurate
at r=0.48 0.6

Solutions oscillate and 0.4


then blow up at r=0.52.
Unstable 0.2

Why results of r=0.48 and


0
r=0.52 are so different? 0 0.2 0.4 x 0.6 0.8 1
von Neumann stability analysis

* Consider the exact solution given by (17).


∞ 8 (−1)𝑚
𝑢𝑒𝑥𝑎𝑐𝑡 (𝑥, t) = σ𝑚=0 2 𝑠𝑖𝑛[ (2𝑚 + 1)𝜋𝑥] 𝑒𝑥𝑝[−𝜈 2𝑚 + 1 𝜋𝑡 2] (17)
𝜋 (2𝑚+1)2

The RHS has a typical “sin(kx)” factor in its dependence on x.


So will the numerical error since it is 0 at two ends due to known BCs.
Thus the solution for the ERROR (represented also by “u” hereinafter) may be also expressed as
u(t, x) ~ g(t) exp(ik x) (~ error)
𝑛 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥 + 𝑚ℎ ], h=Dx
𝑢𝑚 𝑚 0

𝑛
𝑢𝑚−1 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚−1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 − 1)ℎ ] (18)
𝑛
𝑢𝑚+1 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚+1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 + 1)ℎ ]
𝑛+1 = 𝑟𝑢 𝑛
𝑢𝑚 𝑛 𝑛
* Substituting (18) into (15): 𝑚+1 + 1 − 2𝑟 𝑢𝑚 + 𝑟𝑢𝑚−1 (15)

𝑔𝑛+1 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + 𝑚ℎ ] = r* 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 + 1)ℎ ] + (1-2r)* 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + 𝑚ℎ ]


+ r* 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 − 1)ℎ ] (19)
Let r = 𝑔𝑛+1 / 𝑔𝑛 = amplification factor (20)
Eq. (19)  {r - 𝑟 𝑒𝑥𝑝(𝑖𝑘ℎ) − (1−2r) − 𝑟 𝑒𝑥𝑝(𝑖 − 𝑘ℎ) } 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + 𝑚ℎ ] = 0
r = 𝑟 𝑒𝑥𝑝(𝑖𝑘ℎ) + (1−2r) + 𝑟 𝑒𝑥𝑝(−𝑖𝑘ℎ)
= 1-2r +2 𝑟 cos(kh) = 1 – 4r sin2(kh/2) (21)
* Requirement for stability:
| r |1 (22)
so that the numerical solution will not grow to infinity as n→.
| 1 – 4r sin2(kh/2) | 1 for all q = kh

0  4r sin2(kh/2) |  2

Since q = kh/2 can take the value of /2, we must have 0  4r  2

0 r= 𝜈𝛥𝑡 / (𝛥𝑥 )2  1/2 (23)


for the explicit scheme to be stable.

* Clearly, r=0.48 satisfies the stability requirement (23);


but r=0.52 does not.
A simpler approach to derive amplification factor r

𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
𝑚 𝑚−1
Eqn.: =𝜈 2 (14)
𝛥𝑡 (𝛥𝑥)
𝑛
𝑢𝑚 = 𝑔𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚 ),

𝑛
𝑢𝑚−1 = 𝑔𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚−1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘(𝑥𝑚 −ℎ)]= 𝑢𝑚
𝑛 𝑒𝑥𝑝(−𝑖𝑘ℎ)

𝑛
𝑢𝑚+1 = 𝑔𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚+1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘(𝑥𝑚 +ℎ)]= 𝑢𝑚
𝑛 𝑒𝑥𝑝(+𝑖𝑘ℎ)

𝑛+1 = 𝑔𝑛+1 𝑒𝑥𝑝(𝑖𝑘𝑥 ) = r𝑔𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥 ) = r 𝑢 𝑛


𝑢𝑚 𝑚 𝑚 𝑚

𝜌−1 𝑒𝑥𝑝(+𝑖𝑘ℎ)−2+𝑒𝑥𝑝(−𝑖𝑘ℎ)
 { −𝜈 2
𝑛
} 𝑢𝑚 =0
𝛥𝑡 ℎ
𝜌−1 𝑒𝑥𝑝(+𝑖𝑘ℎ)−2+𝑒𝑥𝑝(−𝑖𝑘ℎ)
=𝜈
𝛥𝑡 ℎ2

 r = 𝑟 𝑒𝑥𝑝(𝑖𝑘ℎ) + (1−2r) + 𝑟 𝑒𝑥𝑝(−𝑖𝑘ℎ)


same as Eq. (21)

We will use this simpler approach to analyze stability of other schemes.


Lecture 38
Last lecture:
Explicit Methods for Parabolic PDE
This lecture:

Other Finite Difference Methods for Parabolic PDE

Accuracy

Stability

Convergence
von Neumann stability analysis for explicit scheme

The solution for the ERROR (represented also by “u” hereinafter) may be also expressed as

u(t, x) ~ g(t) exp(ik  x) (~ error) TYPO last time!

u(t, x) ~ g(t) exp(ikx) (~ error)

𝑛 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥 + 𝑚ℎ ], h=Dx


𝑢𝑚 𝑚 0

𝑛
𝑢𝑚−1 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚−1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 − 1)ℎ ] (18)
𝑛
𝑢𝑚+1 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚+1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 + 1)ℎ ]

Define r = 𝑔𝑛+1 / 𝑔𝑛 = amplification factor = growth factor


𝑛+1 = 𝑟𝑢 𝑛
𝑢𝑚 𝑛 𝑛
Then 𝑚+1 + 1 − 2𝑟 𝑢𝑚 + 𝑟𝑢𝑚−1

 r = 1 – 4r sin2(kh/2) = 1 – 4r sin2(q /2) (21)


Explicit method for parabolic equation

r = 1 – 4r sin2(kh/2) = 1 – 4r sin2(q /2) (21)


r = 𝜈𝛥𝑡 / (𝛥𝑥 )2

Highest k:
Growth factor r as a function of q=kh
1.5 qmax= kmaxh = 
r Explicit scheme for heat equation
r=0.48  kmaxh= 
1

r=0.52
0.5
0 

h=𝛥𝑥
0
0 0.5 1 1.5 2 2.5 3 q=kh 2
f
1
-0.5
0
0 5 10 15 20
-1
-2
-1
The shortest wavelength that 2 grids
-1.5
less than -1 can represent is a half-wave.
 kmax= /h
Explicit method for parabolic equation

r = 1 – 4r sin2(kh/2) = 1 – 4r sin2(q /2) (21)

r = 𝜈𝛥𝑡 / (𝛥𝑥 )2

Growth factor r
• True growth factor based on PDE 1.5
r Explicit scheme for heat equation
2 r=0.48
𝜕𝑢 𝜕 𝑢 1
=𝜈 2
𝜕𝑡 𝜕𝑥 exact
Let u(t, x) ~ g(t) exp(ikx) 0.5

 g′= - 𝜈 k2g
0
0 0.5 1 1.5 2 2.5 3 q=kh
 g(t) = c*exp(-𝜈 k2t)
-0.5
g(t+Dt)= c*exp(-𝜈 k2(t+Dt))
-1
 rexact= g(t+Dt)/g(t) = exp(-𝜈 k2 Dt)

= exp(-r k2h2) -1.5

= exp(-rq 2)
𝑛+1 𝑛 𝑛 𝑛
Accuracy of the explicit scheme 𝑢𝑚 = 𝑟𝑢𝑚−1 + 1 − 2𝑟 𝑢𝑚 + 𝑟𝑢𝑚∓1 (15)

𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
𝑚 𝑚−1
Eq. (15) is the algorithm we use. It comes from (14): =𝜈 2
𝛥𝑡 (𝛥𝑥)

Consider (14) and apply Taylor series expansion at (n, m):

t
n+1
n

x
m-1 m m+1

𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
𝑚 𝑚−1
From Eq. (14): 0= - 𝜈 2
𝛥𝑡 (𝛥𝑥)
𝑛 𝑛 𝑛
𝜕𝑢 𝑛 𝛥𝑡 𝜕2 𝑢 𝜕2 𝑢 𝛥𝑥 2 𝜕4 𝑢
= ቚ + ቚ +. . . −𝜈 ቚ + ቚ +. . .
𝜕𝑡 𝑚 2 𝜕𝑡 2 𝑚 𝜕𝑥 2 𝑚 12 𝜕𝑥 4 𝑚

𝑛 𝑛 𝑛
𝜕𝑢 𝜕2 𝑢 𝛥𝑡 𝜕2 𝑢 𝛥𝑥 2 𝜕4 𝑢
= − 𝜈 𝜕𝑥 2 + ቚ − 𝜈 12 𝜕𝑥 4 ቚ +. . . (24)
𝜕𝑡 𝑚 2 𝜕𝑡 2 𝑚 𝑚
𝑛+1 = 𝑟𝑢 𝑛
𝑢𝑚 𝑛 𝑛
Accuracy of the explicit scheme 𝑚+1 + 1 − 2𝑟 𝑢𝑚 + 𝑟𝑢𝑚−1 (15)

𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
𝑚 𝑚−1
Eq. (14): 0 = -𝜈 2
𝛥𝑡 (𝛥𝑥)
𝑛 𝑛 𝑛
𝜕𝑢 𝜕2 𝑢 𝛥𝑡 𝜕2 𝑢 𝛥𝑥 2 𝜕4 𝑢
= − 𝜈 𝜕𝑥 2 + 2 𝜕𝑡 2 ቚ − 𝜈 12 𝜕𝑥 4 ቚ +. . . (24)
𝜕𝑡 𝑚 𝑚 𝑚

The algorithm given by (15) does not produce a solution that satisfies the original PDE.
The numerical solution satisfies a modified PDE (MPDE) with addition truncation error terms like

𝑛 𝑛
𝛥𝑡 𝜕2 𝑢 𝛥𝑥 2 𝜕4 𝑢
T.E. = 2 𝜕𝑡 2 𝑚
ቚ − 𝜈 2 𝜕𝑥 4 ቚ +. . . (25)
𝑚

i) T.E. = O(Dt, Dx2)


ii) T.E. → 0 as Dt→0 and Dx→0 so that the solution can satisfy the original PDE in the limit.
iii) This numerical scheme is consistent since the original PDE can be recovered in the limit of
Dt→0 and Dx→0.
Convergence

A numerical solution converges to the exact solution at (t, x) when


Dt→0 and Dx→0.

* Lax’s equivalence theorem


For one-step method, consistency + stability = convergence
* For the explicit scheme with r=0.48, it is consistent and stable =>
Numerical solution converges to exact solution in the limit Dt→0 and Dx→0.
* For the explicit scheme with r=0.52, it is consistent but not stable.
Thus, numerical solution does not converge to exact solution in the limit Dt→0 and Dx→0.
9.2.3 Implicit method for parabolic equation

Discretize the PDE at (m, n+1) t n+1


n

m-1 m m+1 x

* Backward difference in time: 𝜕𝑢 𝑛+1 𝑛+1 −𝑢𝑛


𝑢𝑚 𝑚
ቚ ≈ (26)
𝜕𝑡 𝑚 𝛥𝑡

𝑛+1 𝑛+1 −2𝑢𝑛+1 +𝑢𝑛+1


𝜕2 𝑢 𝑢𝑚+1 𝑚 𝑚−1
* Central difference in space: ቚ ≈ (27)
𝜕𝑥 2 𝑚 (𝛥𝑥) 2

𝑛+1 −𝑢𝑛 𝑛+1 𝑛+1 +𝑢𝑛+1


𝑢𝑚 𝑢𝑚+1 −2𝑢𝑚
 𝑚
= 𝜈 2
𝑚−1
(28)
𝛥𝑡 (𝛥𝑥)

 𝑛+1
−𝑟𝑢𝑚−1 𝑛+1
+ 1 + 2𝑟 𝑢𝑚 𝑛+1
− 𝑟𝑢𝑚+1 𝑛
= 𝑢𝑚 (29)

 Need to solve𝑢𝑚−1
𝑛+1 𝑛+1 , 𝑢 𝑛+1 simultaneously. Use tri-diagonal solver.
, 𝑢𝑚 𝑚+1

It is more complicated than the explicit scheme in general.


* Accuracy (T.E.) & Stability

Apply Taylor series expansion


𝑛+1 −𝑢𝑛 𝑛+1 𝑛+1 +𝑢𝑛+1
𝑢𝑚 𝑚 𝑢𝑚+1 −2𝑢𝑚 𝑚−1
-𝜈 2
𝛥𝑡 (𝛥𝑥)
𝑛+1 𝑛+1 𝑛+1
𝜕𝑢 𝜕2 𝑢 𝛥𝑡 𝜕2 𝑢 𝛥𝑥 2 𝜕4 𝑢
= 𝜕𝑡 − 𝜕𝑥 2 − 2 𝜕𝑡 2 ቚ − 𝜈 12 𝜕𝑥 4 ቚ +. . .
𝑚 𝑚 𝑚

T.E.= O(Dt, Dx2) -- same as in the explicit scheme

* Stability: t n+1
n

𝑛 = 𝑔𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥 ),
𝑢𝑚 𝑚
m-1 m m+1 x
𝑛+1 = 𝑔𝑛+1 𝑒𝑥𝑝(𝑖𝑘𝑥 )= r𝑔𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥 ) = r 𝑢 𝑛
𝑢𝑚 𝑚 𝑚 𝑚
𝑛+1
𝑢𝑚−1 = 𝑔𝑛+1 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚−1 ) = r𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘(𝑥𝑚 −ℎ)]= 𝑢𝑚
𝑛 r 𝑒𝑥𝑝(−𝑖𝑘ℎ)

𝑛+1
𝑢𝑚+1 = 𝑔𝑛+1 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚+1 ) = r 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘(𝑥𝑚 +ℎ)]= 𝑢𝑚
𝑛 r 𝑒𝑥𝑝(+𝑖𝑘ℎ)
* Accuracy (T.E.) & Stability

* Stability:
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛+1 −2𝑢𝑛+1 +𝑢𝑛+1
𝑢𝑚+1
𝑚 𝑚 𝑚−1
- 𝜈 2 =0
𝛥𝑡 ℎ
Growth factor r
𝜌−1 𝜌𝑒 𝑖𝑘ℎ −2𝜌+𝜌𝑒 −𝑖𝑘ℎ 1.2
 { -𝜈 } 𝑛
𝑢𝑚 =0 r Implicit scheme for heat equation
𝛥𝑡 ℎ2 Implicit r=1
1
exact r=1
r = 1+ 2rr [ cos(kh) -1 ]
0.8

r = 1/[1 + 4𝑟 𝑠𝑖𝑛2 ( 𝑘ℎ/2)] 0.6

0.4
Requirement for stability:
0.2
0 r (31)
0
0 0.5 1 1.5 2 2.5 3 q
which is usually true for positive diffusivity/viscosity.
 Implicit scheme is unconditionally stable.
0.6 0.6
r=0.8
r=0.4
u; t=0.05 u; t=0.05
u_exact u_exact
u; t=0.1 u; t=0.1
U_exact U_exact
0.4 0.4

0.2 0.2

0 0
x 0 0.2 0.4 x 0.6 0.8 1
0 0.2 0.4 0.6 0.8 1

Solutions for r=0.4 and 0.8 are both stable and accurate:
9.2.4 Other schemes for parabolic equation

i) DuFort-Frankel method
𝜕𝑢 𝑛+1 −𝑢𝑛−1
𝑢𝑚 𝜕2 𝑢 𝑛
𝑢𝑚+1 𝑛+1 −𝑢𝑛−1 +𝑢𝑛
−𝑢𝑚
𝑚 𝑚 𝑚−1
Algorithm: ≈ , ≈
𝜕𝑡 2𝛥𝑡 𝜕𝑥 2 (𝛥𝑥) 2

𝑛+1 −𝑢𝑛−1
𝑢𝑚 𝑛
𝑢𝑚+1 𝑛+1 −𝑢𝑛−1 +𝑢𝑛
−𝑢𝑚
𝑚 𝑚 𝑚−1
= 𝜈 2 (2-step method) (32)
2𝛥𝑡 (𝛥𝑥)
𝑛 3 𝑛 𝑛
𝛥𝑡 2 𝜕2 𝑢 1 2𝜕 𝑢 𝛥𝑥 2 𝜕4 𝑢
Accuracy: T.E. = 𝛥𝑥 + 3 𝛥𝑡 𝜕𝑡 3 ቚ − 𝜈 12 𝜕𝑥 4 ቚ +. . . (33)
𝜕𝑡 2 𝑚 𝑚 𝑚

𝜌−𝜌−1 𝑒 𝑖𝑘𝛥𝑥 −𝜌−𝜌−1 +𝑒 −𝑖𝑘𝛥𝑥


Stability: = 𝜈 (34)
2𝛥𝑡 (𝛥𝑥)2

1
𝜌= 1+2𝑟 2𝑟 𝑐𝑜𝑠( 𝑘ℎ) ± 1 − 4𝑟 2 𝑠𝑖𝑛2 ( 𝑘ℎ) (35)

|r|<1 whether r is real or complex; unconditionally stable.


Problem: consistency is not guaranteed since if 𝛥 𝑡Τ𝛥 𝑥 2 does not go to zero,
T.E. will be finite even if Dt→0 and Dx→0.
2
Remedy: use small values of 𝛥 𝑡Τ𝛥 𝑥
ii) Crank-Nicolson method
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛+1 𝑛+1 𝑛+1 𝑛 𝑛 +𝑢𝑛
Algorithm: 𝑚 𝜈 𝑢𝑚+1 −2𝑢𝑚 +𝑢𝑚−1 𝑢𝑚+1 −2𝑢𝑚 𝑚−1
=2 + (36)
𝛥𝑡 (𝛥𝑥)2 (𝛥𝑥)2
𝑛+1 𝑛+1 − 𝑟𝑢 𝑛+1 = 𝑟𝑢 𝑛 𝑛 𝑛
−𝑟𝑢𝑚−1 + 2 + 2𝑟 𝑢𝑚 𝑚+1 𝑚−1 + 2 − 2𝑟 𝑢𝑚 + 𝑟𝑢𝑚+1

Use tri-diagonal solver.

1 3 𝑛+1/2 𝜕4 𝑢
𝑛+1/2
𝛥𝑥 2 𝜕4 𝑢
𝑛+1/2
T.E. = 𝛥𝑡 2 𝜕 𝑢ቚ −
1
𝛥𝑡 2 ቚ +𝜈 ቚ +. . . (37)
Accuracy: 12 𝜕𝑡 3 𝑚 8 𝜕𝑡 2 𝜕𝑥 2 𝑚 6 𝜕𝑥 4 𝑚

 second order accuracy


Growth factor r
Stability: 1.2
r Crank-Nicholson scheme for heat equation
−𝑟r𝑒 −𝑖𝑘ℎ + 2 + 2𝑟 r − 𝑟r𝑒 𝑖𝑘ℎ 1
= 𝑟𝑒 −𝑖𝑘ℎ + 2 − 2𝑟 + 𝑟𝑒 𝑖𝑘ℎ Crank-Nicholson
0.8
exact
1−𝑟 1−𝑐𝑜𝑠(𝑘ℎ)
r = 1+𝑟 1−𝑐𝑜𝑠(𝑘ℎ)
0.6 r=0.48

1−2𝑟sin2(q /2) 0.4 Very accurate


=
1+2sin2(q /2)
0.2

 |r|  1 unconditionally stable for r>0. 0


0 0.5 1 1.5 2 2.5 3 q=kh
iii) Leap-Frog method

𝑛+1 −𝑢𝑛−1
𝑢𝑚 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
Algorithm: 𝑚
= 𝜈 𝑚−1
2𝛥𝑡 (𝛥𝑥)2

Accuracy: T.E. = O((Dt)2, (Dx)2)

𝜌−𝜌−1 𝑒 𝑖𝑘𝛥𝑥 −2+𝑒 −𝑖𝑘𝛥𝑥


Stability: = 𝜈
2𝛥𝑡 (𝛥𝑥)2

𝜌 = -4𝑟 𝑠𝑖𝑛2 ( 𝑘ℎ/2) ± 1 + 16𝑟 2 𝑠𝑖𝑛4 ( 𝑘ℎ/2)

unconditionally unstable

Do not use this type of discretization for parabolic eqn.


Lecture 39
Last lecture:
Finite Difference Methods for Parabolic PDE
This lecture:

Finite Difference Methods for Hyperbolic Eqns


9.3 Finite Difference Method for Hyperbolic (Wave) Equations

9.3.1. Model Problems for finite domain


𝜕𝑢 𝜕𝑢
𝜕𝑡
+ 𝑐 𝜕𝑥 = 0 (41)

IC. u(t=0, x)= f(x), (42)

* Analytical solution for traveling wave


𝑢(𝑡, 𝑥) = 𝑓(𝑥 − 𝑐𝑡) for unbounded domain (43)

Finite domain, 0x1, B.C. such as u(t, x=0) = u0 (44)


will determine solution.
No downstream BC should be specified.
9.3 Finite Difference Method for Hyperbolic (Wave) Equations

𝜕𝑢 𝜕𝑢
+ 𝑐 𝜕𝑥 = 0 (41)
𝜕𝑡

IC. u(t=0, x)= f(x), (42)


B.C. u(t, x=0) = u0 (44)
9.3.2. Explicit methods for wave equation
𝜕𝑢 𝑛+1 −𝑢𝑛
𝑢𝑚 𝑚
Forward in time: = ,
𝜕𝑡 𝛥𝑡
𝑛 𝑛
𝜕𝑢 𝑢𝑚+1 − 𝑢𝑚−1
i) Central in space: =
𝜕𝑥 2𝛥𝑥
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 𝑛
−𝑢𝑚−1
𝑚
+c =0 (45)
𝛥𝑡 2𝛥𝑥

𝜌−1 𝑒 𝑖𝑘𝛥𝑥 −𝑒 −𝑖𝑘𝛥𝑥


Stability: + 𝑐 =0
𝛥𝑡 2𝛥𝑥

𝑐𝛥𝑡
r =1-i 𝛥𝑥
𝑠𝑖𝑛( 𝑘𝛥𝑥) (46)

𝑐𝛥𝑡 2
|𝜌| = 1+ 𝛥𝑥
𝑠𝑖𝑛( 𝑘ℎ) ≥1 => unconditionally unstable
𝜕𝑢 𝜕𝑢
ii) Upwind difference + 𝑐 𝜕𝑥 = 0 (41)
𝜕𝑡

𝜕𝑢 𝑛+1 −𝑢𝑛
𝑢𝑚 𝜕𝑢 𝑛 −𝑢𝑛
𝑢𝑚
𝑚 𝑚−1
= , = (backward difference in space)
𝜕𝑡 𝛥𝑡 𝜕𝑥 𝛥𝑥
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛 −𝑢𝑛
𝑢𝑚
 𝑚
+ c 𝛥𝑥𝑚−1 =0 (47)
𝛥𝑡

𝜌−1 1 − 𝑒 −𝑖𝑘𝛥𝑥
Stability: +𝑐 =0
𝛥𝑡 𝛥𝑥
𝑐𝛥𝑡 𝑐𝛥𝑡
 r =1- (1 − 𝑐𝑜𝑠( 𝑘𝛥𝑥)) − 𝑖 𝑠𝑖𝑛( 𝑘𝛥𝑥) (48)
𝛥𝑥 𝛥𝑥
𝑐𝛥𝑡
Let 𝜆 = = 𝐶𝑜𝑢𝑟𝑎𝑛𝑡 𝑛𝑢𝑚𝑏𝑒𝑟
𝛥𝑥

 r = 1- 𝜆 2 sin2(q /2) – i 𝜆 2 sin (q /2) cos (q /2)

 r2 = 1- 4𝜆 sin2(q /2) + 4 𝜆2sin2(q /2) = 1- 4𝜆 (1- 𝜆) sin2(q /2)

r2 <1 require 1- 𝜆 >0


𝑐𝛥𝑡
i.e. 𝜆= = 𝐶𝑜𝑢𝑟𝑎𝑛𝑡 𝑛𝑢𝑚𝑏𝑒𝑟 ≤ 1 (49)
𝛥𝑥

In order for the upwind difference scheme to remain stable.


𝜕𝑢 𝜕𝑢
ii) Upwind difference + 𝑐 𝜕𝑥 = 0 (41)
𝜕𝑡

𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛 −𝑢𝑛
𝑢𝑚
𝑚
+ c 𝛥𝑥𝑚−1 =0 (47)
𝛥𝑡

Accuracy: Taylor series expansion on (47) =>


𝑛 𝑛
1 𝑛 𝜕𝑢 𝑛 𝛥𝑡 2 𝜕2 𝑢 𝛥𝑡 3 𝜕3 𝑢 𝑛
𝑢𝑚 + 𝛥𝑡 𝜕𝑡 ቚ + ቚ + 6 𝜕𝑡 3 ቚ . . . −𝑢𝑚
𝛥𝑡 𝑚 2 𝜕𝑡 2 𝑚 𝑚
𝑛 𝑛
1 𝑛 𝑛 𝜕𝑢 𝑛 𝛥𝑥 2 𝜕2 𝑢 𝛥𝑥 3 𝜕3 𝑢
+ 𝑐 𝛥𝑥 𝑢𝑚 − 𝑢𝑚 + 𝛥𝑥 𝜕𝑥 ቚ − ቚ + 6 𝜕𝑥 3 ቚ . . . =0
𝑚 2 𝜕𝑥 2 𝑚 𝑚

𝜕𝑢 𝜕𝑢 𝛥𝑡 𝜕2 𝑢 𝛥𝑥 𝜕2 𝑢 𝛥𝑡 2 𝜕3 𝑢 𝛥𝑥 2 𝜕3 𝑢
 + 𝑐 𝜕𝑥 = − 2 𝜕𝑡 2 + 𝑐 2 𝜕𝑥 2 − −𝑐 +. . . (50)
𝜕𝑡 6 𝜕𝑡 3 6 𝜕𝑥 3

 T.E. = O(Dt, Dx)

Eq. (50) contains information more than just the truncation error.
We can get the numerical diffusion and dispersion as well.
Thus we need to eliminate time derivatives on the RHS of (50).
Modified partial differential equation (MPDE)

𝜕𝑢 𝜕𝑢 𝛥𝑡 𝜕2 𝑢 𝛥𝑥 𝜕2 𝑢 𝛥𝑡 2 𝜕3 𝑢 𝛥𝑥 2 𝜕3 𝑢
 + 𝑐 𝜕𝑥 = − +𝑐 − −𝑐 +. . . (50)
𝜕𝑡 2 𝜕𝑡 2 2 𝜕𝑥 2 6 𝜕𝑡 3 6 𝜕𝑥 3

𝜕
We take [𝐸𝑞. (50)] on both sides to obtain
𝜕𝑡

𝜕2 𝑢 𝜕2 𝑢 𝛥𝑡 𝜕3 𝑢 𝛥𝑥 𝜕3 𝑢 𝛥𝑡 2 𝜕4 𝑢 𝛥𝑥 2 𝜕4 𝑢
+ 𝑐 𝜕𝑡𝜕𝑥 = − 2 𝜕𝑡 3 + 𝑐 2 𝜕𝑥 2𝜕𝑡 − −𝑐 +. . . (51)
𝜕𝑡 2 6 𝜕𝑡 4 6 𝜕𝑥 3 𝜕𝑡

𝜕
We then take –c 𝜕𝑥 [𝐸𝑞. (50)] on both sides to obtain

𝜕2 𝑢 𝜕 𝑢 2 𝑐𝛥𝑡 𝜕3 𝑢 3
𝛥𝑥 𝜕 𝑢 𝛥𝑡 2 𝜕4 𝑢 𝛥𝑥 2 𝜕4 𝑢
−𝑐 𝜕𝑡𝜕𝑥 − 𝑐 2 𝜕𝑥 2 = − 𝑐 2 2 𝜕𝑥 3 +𝑐 + 2
𝑐 6 𝜕𝑥 4 +. . . (52)
2 𝜕𝑡 2 𝜕𝑥 6 𝜕𝑡 3 𝜕𝑥

Add (51) & (52) =>

𝜕2 𝑢 𝜕 𝑢 2 1 𝜕3 𝑢 𝑐 𝜕3 𝑢 𝑐 𝜕3 𝑢 𝑐 2 𝜕3 𝑢
= 𝑐 2 𝜕𝑥 2 + 𝛥𝑡 − 2 𝜕𝑡 3 + 2 𝜕𝑡 2 𝜕𝑥 + 𝑂 𝛥𝑡 +𝛥𝑥 − + 𝑂 𝛥𝑥 (53)
𝜕𝑡 2 2 𝜕𝑥 2 𝜕𝑡 2 𝜕𝑥 3
𝜕𝑢 𝜕𝑢 𝛥𝑡 𝜕2 𝑢 𝛥𝑥 𝜕2 𝑢 𝛥𝑡 2 𝜕3 𝑢 𝛥𝑥 2 𝜕3 𝑢
 + 𝑐 𝜕𝑥 = − 2 𝜕𝑡 2 + 𝑐 2 𝜕𝑥 2 − −𝑐 +. . . (50)
𝜕𝑡 6 𝜕𝑡 3 6 𝜕𝑥 3

𝜕2 𝑢 𝜕 𝑢 2 1 𝜕3 𝑢 𝑐 𝜕3 𝑢 𝑐 𝜕3 𝑢 𝑐 2 𝜕3 𝑢
𝜕𝑡 2
= 𝑐 2 𝜕𝑥 2 + 𝛥𝑡 − 2 𝜕𝑡 3 + 2 𝜕𝑡 2 𝜕𝑥 + 𝑂 𝛥𝑡 +𝛥𝑥 2 𝜕𝑥 2 𝜕𝑡
− 2 𝜕𝑥 3
+ 𝑂 𝛥𝑥 (53)
𝜕2
Now take [𝐸𝑞. (50)] on both sides to obtain
𝜕𝑥 2

𝜕3 𝑢 𝜕3 𝑢
= −𝑐 3 + 𝑂(𝛥𝑡, 𝛥𝑥) (54)
𝜕𝑡𝜕𝑥 2 𝜕𝑥
𝜕
Take [𝐸𝑞. (53)] on both sides to obtain
𝜕𝑡
𝜕3 𝑢 2 𝜕3 𝑢 3
𝜕 𝑢
= 𝑐 𝜕𝑥 2𝜕𝑡 + 𝑂(𝛥𝑡, 𝛥𝑥) = - 𝑐 3 𝜕𝑥 3 +𝑂(𝛥𝑡, 𝛥𝑥) (55)
𝜕𝑡 3
𝜕
Take [𝐸𝑞. (53)] on both sides to obtain
𝜕𝑥
𝜕3 𝑢 2 𝜕3 𝑢
= 𝑐 𝜕𝑥 3 + 𝑂(𝛥𝑡, 𝛥𝑥) ( 56)
𝜕𝑡 2 𝜕𝑥

Substitute (54-56) into (53), we obtain


𝜕2 𝑢 𝜕 𝑢2 𝑐 3 𝜕3 𝑢 𝑐 3 𝜕3 𝑢 𝑐 2 𝜕3 𝑢 𝑐 2 𝜕3 𝑢
𝜕𝑡 2
= 𝑐 2 𝜕𝑥 2 + 𝛥𝑡 2 𝜕𝑥 3
+ 2 𝜕𝑥 3 + 𝑂 𝛥𝑡 +𝛥𝑥 − 2 𝜕𝑥 3 − 2 𝜕𝑥 3
+ 𝑂 𝛥𝑥
2 𝜕2 𝑢 𝜕3 𝑢
= 𝑐 𝜕𝑥 2 + 𝑐 3 𝛥𝑡 + 2
𝑐 𝛥𝑥 𝜕𝑥 3 + 𝑂(𝛥𝑡 𝛥𝑥, 𝛥𝑥 𝛥𝑥)

Eq. (50) 𝜕𝑢 𝜕𝑢 𝛥𝑥 𝜕2 𝑢 𝛥𝑥 2 𝜕3 𝑢
+ 𝑐 𝜕𝑥 = 𝑐 2 1−𝜆 −𝑐 2𝜆2 − 3𝜆 + 1 +. . . (57)
𝜕𝑡 𝜕𝑥 2 6 𝜕𝑥 3
𝜕𝑢 𝜕𝑢 𝛥𝑥 𝜕2 𝑢 𝛥𝑥 2 𝜕3 𝑢
+ 𝑐 𝜕𝑥 = 𝑐 2 1−𝜆 −𝑐 2𝜆2 − 3𝜆 + 1 +. . . (57)
𝜕𝑡 𝜕𝑥 2 6 𝜕𝑥 3

= KDV-Burger’s equation with


𝛥𝑥
numerical diffusion coefficient = 𝜈 = 𝑐 (1 − 𝜆) (58)
2
𝛥𝑥 2
numerical dispersion coefficient 𝐷 = −𝑐 6 (2𝜆2 − 3𝜆 + 1) (59)

Clearly, if 𝜈<0, negative diffusion will cause numerical solution to blow up.

𝛥𝑥 𝑐𝛥𝑡
Thus, we must have 𝜈=𝑐 (1 − 𝜆)>0  ≤ 1 when c>0.
2 𝛥𝑥

𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 𝑛
−𝑢𝑚
𝑚
If c<0, we need to use + c 𝛥𝑥 =0
𝛥𝑡

in order to retain the “upwind” feature---information is convected numerically from the upstream to down stream
Numerical Example:

𝜕𝑢 𝜕𝑢
Solve: + 𝑐 𝜕𝑥 = 0, -5x5 (60)
𝜕𝑡

IC. u(t=0, x )= step function, (61)

Discretization: Dx=0.1, Dt=0.025


 l=0.25, n =0.0375, D=-0.000625
1.2
Numerical implementation of step function at t=0: u Solution at t=1

um=1 for x<0; um=0.5 for x=0; um=0.0 for x>0. 1

0.8

0.6 IC
Comments: u_num
u_exact
Numerical diffusion smears out the sharp discontinuity 0.4 u_MPDE

The effects of numerical diffusion & dispersion are


0.2
predicted well by the MPDE.
0
-2 -1 0 1 2 x
Lecture 40
Last lecture:
Finite Difference Methods (upwind scheme) for Hyperbolic Eqns
This lecture:

Other Finite Difference Methods for Hyperbolic Eqns


𝜕𝑢 𝜕𝑢
Exact growth factor for wave equation + 𝑐 𝜕𝑥 = 0 (41)
𝜕𝑡

Let u(t, x) ~ g(t) exp(ikx) Upwind difference


𝑐𝛥𝑡 𝑐𝛥𝑡
 g′+ ik 𝑐 g = 0 r =1- 𝛥𝑥
(1 − 𝑐𝑜𝑠( 𝑘𝛥𝑥)) − 𝑖 𝛥𝑥
𝑠𝑖𝑛( 𝑘𝛥𝑥) (48)
 g(t) = A*exp(-ik 𝑐 t) = 1-l(1 − 𝑐𝑜𝑠 q) − 𝑖l𝑠𝑖𝑛q
→ u(t, x) ~ A*exp(ik(x - 𝑐 t)) ~ travelling wave. | r | = 1− 4𝜆 (1− 𝜆) sin2(q /2)
g(t+t)= A*exp(-ik 𝑐 (t+t)) Less than 1 => numerical damping
 rexact = g(t+t)/g(t) = exp(-ik 𝑐 t) f =tan−1 −l𝑠𝑖𝑛q/[1−l(1 − 𝑐𝑜𝑠 q) ]
= exp(-ikhl) = exp(-ilq)  f /fe = relative phase shift error after one time step
𝑐𝛥𝑡
l== 𝐶𝑜𝑢𝑟𝑎𝑛𝑡 𝑛𝑢𝑚𝑏𝑒𝑟 tan−1 −l𝑠𝑖𝑛q/[1−l(1−𝑐𝑜𝑠 q)]
𝛥𝑥 =
a) | rexact | = 1, no damping for any wavelength k. −lq
f /fe: deviation from 1 --- phase shift error
b) Exact phase angle fe = -lq.
Right travelling wave (c>0) = 1 --- no phase error
1
sin(kx) • After n time steps,
sin[k(x-cDt)]
r n = |r| n exp(nf)
0 1 2 3 4 5 6 7
Phase = nf
Sin(fe) Phase error = n (fe -f)
-1
damped amplitude
Growth factor |r| Relative phase error f/fe
1.4
1.2 0.75
1.2 Leading
1
1
1 0.5 & 1
0.8
0.8
0.25 & 0.75 Lagging
0.6
l=0.25 0.6 l=0.25
0.4 l=0.4 l=0.4 0.4
0.4 0.4
l=0.5 l=0.5
0.2 l=0.75 0.2 l=0.75
l=1 0.5 l=1 0.25
0 0
0 0.5 1 1.5 2 2.5 3 0 0.5 1 1.5 2 2.5 3
q

Strong numerical damping If f /fe >1 for a given q =kh, the corresponding Fourier
component (k) of the numerical solution has a wave
speed greater than the exact solution, and this is a leading
phase error.

If f /fe <1 the numerical wave speed is less than


the exact wave speed, and this is a lagging phase error.
𝜕𝑢 𝜕𝑢
9.3.3 Euler Implicit method for wave equation + 𝑐 𝜕𝑥 = 0 (41)
𝜕𝑡

* Discretize the PDE at (m, n+1) 𝜕𝑢


𝑛+1 𝑛+1
𝑢𝑚 𝑛
− 𝑢𝑚
Backward difference in time: ቤ ≈
𝜕𝑡 𝑚 𝛥𝑡
𝜕𝑢 𝑛+1 −𝑢𝑛+1
𝑢𝑚+1
Central difference in space: = 𝑚−1
𝜕𝑥 2𝛥𝑥
𝑛+1 −𝑢𝑛 𝑛+1 𝑛+1
𝑢𝑚 𝑚 𝑢𝑚+1 −𝑢𝑚−1
+c =0 (62)
𝛥𝑡 2𝛥𝑥
𝜌−1 𝑒 𝑖𝑘𝛥𝑥 −𝑒 −𝑖𝑘𝛥𝑥
* Stability: + 𝑐𝜌 =0
𝛥𝑡 2𝛥𝑥
1
r = 1+𝑖𝜆 𝑠𝑖𝑛(𝑘𝛥𝑥)  |r| = 1/ 1 + 𝜆2 𝑠𝑖𝑛2 ( 𝑘𝛥𝑥) 1 always (63)
tan−1 −l𝑠𝑖𝑛q
f /fe = −lq
𝜕𝑢 𝜕𝑢 2
𝛥𝑡 𝜕 𝑢 𝛥𝑥 2 3
𝜕 𝑢
* Truncation error and MPDE: + 𝑐 𝜕𝑥 = 𝑐 2 2 𝜕𝑥 2 −𝑐 (1 + 2𝜆2 ) 𝜕𝑥 3 +. . . (64)
𝜕𝑡 6

Numerical diffusion: 𝜈 = 𝑐 2 𝛥𝑡/2


𝛥𝑥 2
Numerical dispersion: D = −𝑐 (1 + 2𝜆2 )
6

T.E. = O(t, (x)2)


Growth factor |r| Relative phase error f/fe
1.05 1.2
Implicit & central difference Implicit & central difference
1
0.25
1
0.95 0.4
0.9 0.8
0.5
0.85 Large phase error
0.6
0.8 (lagging) for high k
0.75 l=0.25
l=0.25
0.75 0.4
l=0.4 1 l=0.4
0.7 l=0.5 l=0.5
l=0.75 0.2 l=0.75
0.65 l=1 l=1
0.6 0
0 0.5 1 1.5 2 2.5 3 q 0 1 2 3

Very dissipative for


intermediate k
Numerical example: same setup as given by (60-61)

i) Discretization using: x=0.1, t=0.025


 l=0.25, 𝜈 =0. 0125, D= -0.001875.
Comparing with the upwind scheme: 𝜈 =0. 0375, D= -0.000625.
Euler implicit scheme has smaller dissipation but larger dispersion large lagging phase error for high k
1.2
Comments: u Solution at t=1
Euler Implicit
Euler implicit scheme has stronger dispersion (which causes the 1

waves to move slower since D<0).


0.8
This is why the oscillation (a wave phenomenon) develops
0.6 IC
behind the wave front instead of ahead of the front. u_num
u_exact
The leading order diffusion and dispersion in the numerical 0.4 u_MPDE
solution can usually be understood and predicted using the
0.2
MPDE.
0
-2 -1 0 1 2 x
ii) Discretization using: x=0.05, t=0.0125
 l=0.25, 𝜈 =0. 00625, D= -0.00046875.

Smaller x & t bring the agreement between the numerical and Dispersion (phase) error 4 times
the MPDE solution much closer. smaller now
1.2
The remaining difference is caused by the higher order errors Solution at t=1
Euler Implicit
neglected in the MPDE. 1

The overshoot is about 0.07256 in this numerical solution, 0.8


IC
with 𝜈 =0. 00625, D= -0.00046875. u_exact
0.6 u_num
In the previous case, the overshoot is about 0.10356,
u_MPDE
with 𝜈 =0. 0125, D= -0.001875. 0.4

Clearly, reducing the dispersion coefficient is more effective. 0.2

0
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2 x
𝜕𝑢 𝜕𝑢
Various schemes for the 1st order linear wave equation 𝜕𝑡
+𝑐
𝜕𝑥
=0 (41)

Method Discretized Equation


𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛 −𝑢𝑛
𝑢𝑚
1st order upwind 𝑚
+ c 𝛥𝑥𝑚−1 =0 Rusanov (3rd order accurate in t)
𝛥𝑡
Euler implicit
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑚
𝑛+1 −𝑢𝑛+1
𝑢𝑚+1 𝑚−1 1 1 𝑛 1
𝛥𝑡
+c 2𝛥𝑥
=0 𝑢𝑗+1Τ2 = 𝑢𝑗+1 + 𝑢𝑗𝑛 − 𝜆 𝑢𝑗+1
𝑛
− 𝑢𝑗𝑛
2 3
𝑛+1 −(𝑢𝑛
𝑢𝑚 𝑛 𝑛 𝑛
Lax 𝑚+1 +𝑢𝑚−1 )/2 𝑢𝑚+1 −𝑢𝑚−1
𝛥𝑡
+c 2𝛥𝑥
=0 2
2 1 2
𝑢𝑗 = 𝑢𝑗𝑛 − 𝜆 𝑢𝑗+1Τ2 − 𝑢𝑗−1Τ2
𝑛+1 −𝑢𝑛−1
𝑢𝑚 𝑛 −𝑢𝑛
𝑢𝑚 3
Leap-Frog 𝑚
+ c 𝛥𝑥𝑚−1 =0
2𝛥𝑡
𝑛+1 −𝑢𝑛 𝑛+1 −𝑢𝑛+1 𝑛 𝑛 𝑢𝑗𝑛+1 = 𝑢𝑗𝑛 − 𝜆[−2𝑢𝑗+2
𝑛 𝑛
+ 7𝑢𝑗+1 𝑛
− 7𝑢𝑗−1 𝑛
+ 2𝑢𝑗−2 ]
Crank- 𝑢𝑚 𝑚 𝑢𝑚+1 𝑚−1 𝑢𝑚+1 −𝑢𝑚−1
+c +c =0
𝛥𝑡 4𝛥𝑥 4𝛥𝑥 3 2 2
Nicolson − 𝜆 𝑢𝑗+1 − 𝑢𝑗−1
Lax-
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑚
𝑛
𝑢𝑚+1 𝑛
−𝑢𝑚−1 1 2
𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
𝑚−1
8
+ c = 𝑐 𝛥𝑡 2
𝛥𝑡 2𝛥𝑥 2 (𝛥𝑥) 𝜔 𝑛 𝑛
Wendroff − 𝑢𝑗+2 − 4𝑢𝑗+1 + 6𝑢𝑗𝑛 − 4𝑢𝑗−1
𝑛 𝑛
+ 𝑢𝑗−2
𝑛+1 −𝑢𝑛 𝑛 𝑛
24
MacCormack 𝑢𝑚 𝑚 𝑢𝑚+1 −𝑢𝑚
= −𝑐 ; (predictor)
𝛥𝑡 𝛥𝑥 added to ensure numerical stability.
𝑛+1 = 1 [𝑢 𝑛 + 𝑢 𝑛+1 − 𝑐𝛥𝑡 (𝑢 𝑛+1 −𝑢 𝑛+1 )] (corrector)
𝑢𝑚 2 𝑚 𝑚 𝑚 𝑚−1
𝛥𝑥
𝜆 1
Rusanov
& 4𝜆2 − 𝜆4  𝜔3
Lax-Wendroff & MacCormack Scheme
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 𝑛
−𝑢𝑚−1 1 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
𝑚 2 𝑚−1
+ c = 𝑐 𝛥𝑡 2
𝛥𝑡 2𝛥𝑥 2 (𝛥𝑥)
MacCormack Scheme =
It is derived from a Taylor-series expansion as follows: Lax-Wendroff scheme
𝑛+1 𝑛 𝜕𝑢 1 2 𝜕2 𝑢 for linear wave equation
𝑢𝑚 = 𝑢𝑚 + 𝛥𝑡 + (𝛥𝑡) + O[(𝛥𝑡)3 ]
𝜕𝑡 2 𝜕𝑡 2
Using the wave equations
𝜕𝑢 𝜕𝑢 𝜕2 𝑢 𝜕2 𝑢
= -c 𝜕𝑥 , = 𝑐 2 𝜕𝑥 2
𝜕𝑡 𝜕𝑡 2

𝜕𝑢 1 𝜕2 𝑢
 𝑢𝑚
𝑛+1 = 𝑢 𝑛 - c𝛥𝑡
𝑚 + (𝑐𝛥𝑡) 2
2 + O[(𝛥𝑡) 3]
𝜕𝑥 2 𝜕𝑥

central difference
T.E. of O[(Δx)2, (Δt)2]
MPDE:
2
𝜕𝑢 𝜕𝑢 𝛥𝑥 𝜕3𝑢 𝛥𝑥 3
𝜕4𝑢
+𝑐 = −𝑐 1− 𝜆2 −𝑐 𝜆 1− 𝜆2 +. . .
𝜕𝑡 𝜕𝑥 6 𝜕𝑥 3 8 𝜕𝑥 4
Growth factor r = 1-l2 (1 − 𝑐𝑜𝑠 q) − 𝑖l𝑠𝑖𝑛q
tan−1 −l𝑠𝑖𝑛q/[1−l2 (1−𝑐𝑜𝑠 q)]
Relative phase error f /fe =
−lq
Growth factor |r| Relative phase error f/fe
1.2 1.4
Lax-Wendroff scheme
1
1 1.2
0.25 0.75
1 1
0.8
0.4
0.8
l=0.25
0.6 0.5
l=0.4 0.6 l=0.25 0.5
l=0.5 l=0.4 0.4
0.4 0.25
l=0.75 0.4 l=0.5
0.75 l=0.75
0.2 l=1
0.2
l=1
0 0
0 0.5 1 1.5 2 2.5 3 q 0 0.5 1 1.5 2 2.5 3 q
𝜕4 𝑢
Damping comes from term in MPDE predominantly lagging phase error
𝜕𝑥 4

𝜕𝑢 𝜕𝑢 𝜕 2𝑛 𝑢 𝜕 2𝑛+1 𝑢
+𝑐 = ෍ 𝐶2𝑛 + 𝐶2𝑛+1 𝐶2 =0
𝜕𝑡 𝜕𝑥 𝜕𝑥 2𝑛 𝜕𝑥 2𝑛+1
𝑛=1 𝛥𝑥 2
𝐶3 = −𝑐 6 1 − 𝜆2
Necessary condition for stability is (-1)M-1 𝐶2𝑀 >0 𝛥𝑥 3
𝐶4 = −𝑐 8 𝜆 1 − 𝜆2 < 0
𝐶2𝑀 = coefficient of the lowest-order even derivative term
Numerical example: same setup as given by (60-61)

i) Discretization using: x=0.1, t=0.025 & 0.05


 l=0.25 & 0.5 => D= -0.0015625 & -0.00125.

Lax-Wendroff scheme for wave equation


1.3
Comments:
1.2
Lax-Wendroff scheme has stronger dispersion (which causes the 1.1
1 x=0.1
waves to move slower since D<0). 0.9
0.8 c=1
Larger t results in smaller dispersion coefficient in this case 0.7
0.6 u; dt=0.025 t=1
which in turn gives smaller dispersion error. 0.5
0.4 u; dt=0.05
0.3
0.2
0.1
0
-0.1
-1 -0.5 0 0.5 1 1.5 2
Lecture 41
Last lecture:

Other Finite Difference Methods for Hyperbolic Eqns

This lecture:

Finite Difference Methods

for Convection-Diffusion Eqn


tan−1 −l𝑠𝑖𝑛q/[1−l2 (1−𝑐𝑜𝑠 q)]
Growth factor r = 1-l2 (1 − 𝑐𝑜𝑠 q) − 𝑖l𝑠𝑖𝑛q f /fe = −lq

Growth factor |r| Relative phase error f/fe


1.2 1.4
Lax-Wendroff scheme
1
1 1.2
0.25 0.75
1 1
0.8
0.4
0.8
l=0.25
0.6 0.5
l=0.4 0.6 l=0.25 0.5

0.4 l=0.5 l=0.4 0.4


0.25
l=0.75 0.4 l=0.5
0.75 l=0.75
0.2 l=1
0.2
l=1
0 0
0 0.5 1 1.5 2 2.5 3 q 0 0.5 1 1.5 2 2.5 3 q
𝜕4 𝑢
Damping comes from term in MPDE predominantly lagging phase error
𝜕𝑥 4

𝜕𝑢 𝜕𝑢 𝜕 2𝑛 𝑢 𝜕 2𝑛+1 𝑢 𝐶2 =0
+𝑐 = ෍ 𝐶2𝑛 + 𝐶2𝑛+1 (65)
𝜕𝑡 𝜕𝑥 𝜕𝑥 2𝑛 𝜕𝑥 2𝑛+1 𝛥𝑥 2
𝑛=1 𝐶3 = −𝑐 6 1 − 𝜆2
Necessary condition for stability is (-1)M-1 𝐶2𝑀 >0 𝛥𝑥 3
𝐶4 = −𝑐 8 𝜆 1 − 𝜆2 < 0
𝐶2𝑀 = coefficient of the lowest-order even derivative term
Numerical example: same setup as given by (60-61)

i) Discretization using: Dx=0.1, Dt=0.025 & 0.05


 l=0.25 & 0.5 => D= -0.0015625 & -0.00125.

Lax-Wendroff scheme for wave equation


1.3
Comments:
1.2
Lax-Wendroff scheme has stronger dispersion (which causes the 1.1
1 Dx=0.1
waves to move slower since D<0). 0.9
0.8 c=1
Larger Dt results in smaller dispersion coefficient in this case 0.7
0.6 u; dt=0.025 t=1
which in turn gives smaller dispersion error. 0.5
0.4 u; dt=0.05
0.3
0.2
0.1
0
-0.1
-1 -0.5 0 0.5 1 1.5 2
Correction:

Various schemes for the 1st order linear wave equation


𝜕𝑢 𝜕𝑢
+ 𝑐 𝜕𝑥 = 0 (41)
𝜕𝑡

Method Discretized Equation


𝑛+1 𝑛 𝑛 𝑛
1st order upwind 𝑢𝑚 −𝑢𝑚 + c 𝑢𝑚 −𝑢𝑚−1 = 0
𝛥𝑡 𝛥𝑥
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛+1 −𝑢𝑛+1
𝑢𝑚+1
Euler implicit 𝑚
+c 𝑚−1
=0
𝛥𝑡 2𝛥𝑥

Leap-Frog 𝑛+1 −𝑢𝑛−1


𝑢𝑚 𝑛
𝑢𝑚+1 𝑛
−𝑢𝑚−1
𝑚
+ c =0
2𝛥𝑡 2𝛥𝑥

r = i 𝜆 sinq  1− 𝜆sin2q  |r | = 1 → no damping

𝜕𝑢 𝜕𝑢 𝛥𝑥 2 2 𝜕3 𝑢 𝛥𝑥 4 𝜕5 𝑢
MPDE: + 𝑐 = −𝑐 1− 𝜆 −𝑐 9𝜆4 − 10𝜆2 +1 −. . .
𝜕𝑡 𝜕𝑥 6 𝜕𝑥 3 120 𝜕𝑥 5
i) Discretization using: Dx=0.1, Dt= 0.05
 l=0.5 => D= -0.00125.

Leap Frog for linear wave eqn


1.4
n=1 step using Euler explicit.
1.2

0.8

0.6 initial
u_LeapFrog(t=1)
0.4
exact
0.2

-0.2
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2

! This scheme is very dispersive


9.4 Methods for convection-diffusion equation

𝜕𝑢 𝜕𝑢 𝜕2 𝑢 𝜕𝑢 𝜕𝐹 𝜕2 𝑢
Model equation: + 𝑐 𝜕𝑥 = 𝜈 𝜕𝑥 2 (linear) Or + =𝜈 (linear or nonlinear)
𝜕𝑡 𝜕𝑡 𝜕𝑥 𝜕𝑥 2

where 𝜈 = true (physical) diffusion coefficient


9.4.1 FTCS method t
n+1
* Discretize the PDE at (m, n)
𝑛
n
𝑛+1 𝑛
𝜕𝑢 𝑢𝑚 − 𝑢𝑚
Forward difference in time: ቤ ≈
𝜕𝑡 𝑚 𝛥𝑡
Central difference in space: 𝜕𝑢 𝑛
𝑢𝑚+1 𝑛
−𝑢𝑚−1 m-1 m m+1 x
=
𝜕𝑥 2𝛥𝑥
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 𝑛
−𝑢𝑚−1 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
𝑚 𝑚−1
+c =𝜈 2 (66)
𝛥𝑡 2𝛥𝑥 (𝛥𝑥)
T.E. & MPDE:
𝜕𝑢 𝜕𝑢 2 𝛥𝑡 𝜕2 𝑢 𝑐 𝛥𝑥 2 1 𝜕3 𝑢
+ 𝑐 𝜕𝑥 = (𝜈 − 𝑐 2 ) 𝜕𝑥 2 + 3 (3𝑟 − 𝜆2 − ) +…
𝜕𝑡 2 𝜕𝑥 3
𝛥𝑡 𝛥𝑡 𝛥𝑡 𝛥𝑡 𝛥𝑡
Heuristic stability requirement: 𝐶2 = (𝜈 − 𝑐 2 )  0  𝜈𝑐 2  𝜈 2 𝑐 2
2 2 𝛥𝑥 2 𝛥𝑥 2

1 2
 𝑟 𝜆 Or 𝜆2  2r
2
Mesh (or Cell) Reynolds number or mesh Peclet number

* Transport equation for u (mass, momentum, energy, or concentration): u


𝜕𝑢 𝜕𝑢 𝜕2𝑢
= −𝑐 +𝜈 2
𝜕𝑡 𝜕𝑥 𝜕𝑥 𝛥𝑢

Order of magnitude estimates for contributing terms:


𝛥𝑥

Contribution to
𝜕𝑢 𝜕𝑢
due to convection ~ 𝑐 𝜕𝑥 ~ 𝑐
𝛥𝑢 x
𝜕𝑡 𝛥𝑥
𝜕𝑢 𝜕2 𝑢 𝛥𝑢
Contribution to due to diffusion ~ 𝜈 𝜕𝑥 2 ~ 𝜈
𝜕𝑡 𝛥𝑥 2
𝛥𝑢 𝛥𝑢 𝑐𝛥𝑥
Ratio of convection to diffusion: 𝑐 𝛥𝑥
/[𝜈 𝛥𝑥 2
] = 𝜈

𝑐𝛥𝑥
Define: ReDx = ~ Cell Reynolds number
𝜈
𝑐𝛥𝑥 𝑐𝛥𝑡 𝛥𝑥 2 𝜆
Or PeDx = ~ Cell Peclet number = =𝑟
𝜈 𝛥𝑥 𝜈𝛥𝑡
Stability requirement

1 2 2
Heuristic stability analysis requires 𝑟 𝜆  PeDx  but this is not sufficient.
2 𝜆
Growth factor:
r = 1+2r(cosq -1) - i 𝜆 sinq
= 1-2r +2r cosq - i 𝜆 sinq
= ellipse centered at x=1-2r
with semi-major axis 2r, semi-minor axis 𝜆.  1. semi-major axis 2r 1
& semi-minor axis 𝜆 1

Unit Im
2. Ellipse must be fully inside the unit circle
circle 𝜆2  2𝑟  1
(touching is ok)
r
A
1-2r 𝜆 radius of curvature of ellipse at vertex point A is
2r Re 𝜆2 /(2𝑟)
 𝜆2  2𝑟
& it must be less than 1
for the ellipse to stay inside the unit circle.
Stability requirement

Growth factor: r = 1-2r +2r cosq - i 𝜆 sinq

Unit Im Unit Im
circle circle r
r
𝜆 1-2r 𝜆
q
1-2r 2r Re 2r Re

stable 𝜆2  2𝑟 & r < ½ unstable l < 1, r < ½ but 𝜆2  2𝑟

If r = ½ & l < 1, FTCS scheme 𝑢𝑚


𝑛+1 = (r- l/2 ) 𝑢 𝑛
𝑚+1 + (1 − 2𝑟) 𝑢𝑚 + (r+ l/2) 𝑢𝑚−1
𝑛 𝑛

𝑛+1 = 𝑢 𝑛
is stable but gives incorrect result: 𝑢𝑚 𝑚−1
𝜕𝑢 𝜕𝑢 𝜕2 𝑢
Numerical example: + 𝑐 𝜕𝑥 = 𝜈 𝜕𝑥 2 for 0  x  1; BCs: u(t, 0)=1, u(t, 1)=0
𝜕𝑡

𝑛+1 = (r- l/2 ) 𝑢 𝑛


𝑚+1 + (1 − 2𝑟) 𝑢𝑚 + (r+ l/2) 𝑢𝑚−1
𝑛 𝑛
FTCS 𝑢𝑚
c=1, 𝜈 =0.1, Dx=0.05, Dt=0.01
l =0.2, r =0.4 PeDx =0.5
1
uexact(x) = 1−𝑒 𝑐/𝑣 [1 − 𝑒 𝑐 1−𝑥 /𝑣
] for steady state
 𝜆 =0.04  2𝑟 = 0.8  stable
2

Linear convection-diffusion problem Linear convection-diffusion problem


1.2 1.2
u;t=0 u;t=0.5
1 1

0.8 0.8
u;t=3 exact steady
0.6 0.6

0.4 0.4

0.2 0.2

0 0
0 0.2 0.4 0.6 0.8 1 0 0.2 0.4 0.6 0.8 1
𝜕𝑢 𝜕𝑢 𝜕2 𝑢
Numerical example: 𝜕𝑡
+ 𝑐 𝜕𝑥 = 𝜈 𝜕𝑥 2 for 0  x  1

𝑛+1 = (r- l/2 ) 𝑢 𝑛


𝑚+1 + (1 − 2𝑟) 𝑢𝑚 + (r+ l/2) 𝑢𝑚−1
𝑛 𝑛
𝑢𝑚
c=1, 𝜈 = 0.02, Dx=0.05, Dt=0.02
r =0.16, l =0.4 PeDx =2.5 1
uexact(x) = 1−𝑒 𝑐/𝑣 [1 − 𝑒 𝑐 1−𝑥 /𝑣 ] for steady state
 𝜆2 =0.16 2𝑟 = 0.32  stable
Linear convection-diffusion problem Grid level oscillation since PeDx=2.5>2
r- l/2=0.16-0.2 = -0.04<0 1.4
u;t=4 exact steady 1.15
r- l/2<0  1.2
1.1
𝛥𝑡 𝛥𝑡 1
𝜈 𝛥𝑥 2 < c 2𝛥𝑥 1.05

 PeDx >2 0.8


1

0.6 0.95

 Grid level oscillation Nx-2 Nx


0.4 0.9

0.2 0.85
0.6 0.7 0.8 0.9 1

0
0 0.2 0.4 0.6 0.8 1 Consider m=Nx-1. BC: uNx=0
At steady state, FTCS:
um= 0+(1-2r) um + (r+ l/2) um-1
 um= (r+ l/2)/(2r) um-1 > um-1 because r<l/2
9.4.2 Various schemes for the nonlinear Burger’s equation.

𝜕𝑢 𝜕𝐹 𝜕2𝑢
+ =𝜈 2, F=u2/2
𝜕𝑡 𝜕𝑥 𝜕𝑥
h=Dx , l = cDt/Dx; c = F/u
𝑛+1 𝑛 𝑛 𝑛 𝑛
𝑢𝑚 − 𝑢𝑚 𝐹𝑚𝑛 − 𝐹𝑚−1 𝑢m+1 𝑛
− 2𝑢𝑚 + 𝑢𝑚−1
1st order upwind + =𝜈 if cm >0
𝛥𝑡 𝛥𝑥 ൫𝛥𝑥 )2
𝑛+1 − 𝑢 𝑛 𝑛 𝑛 𝑛 𝑛 𝑛 + 𝑢𝑛
Lax method 𝑢𝑚 m+1 + 𝑢m−1 Τ2 𝐹m+1 − 𝐹m−1 𝑢m+1 − 2𝑢𝑚 m−1
+ =𝜈
𝛥𝑡 2𝛥𝑥 ൫𝛥𝑥 )2
𝑛+1 − 𝑢 𝑛−1 𝑛 𝑛 𝑛 𝑛 + 𝑢𝑛
Leap-Frog 𝑢𝑚 𝑚 𝐹𝑚+1 − 𝐹m−1 𝑢𝑚+1 − 2𝑢𝑚 𝑚−1
+ =𝜈
2𝛥𝑡 𝛥𝑥 ൫𝛥𝑥 )2
𝑛+1 − 𝑢 𝑛 𝑛 𝑛 𝑛 + 𝑢𝑛
𝑢𝑚 𝑚 𝐹m+1 − 𝐹𝑚𝑛 𝑢m+1 − 2𝑢𝑚 𝑚−1
MacCormack =− +𝜈
𝛥𝑡 𝛥𝑥 ൫𝛥𝑥 )2
𝑛+1 − 𝑢 𝑛 𝑛 𝑛+1 𝑛 𝑛 + 𝑢𝑛 𝑛+1 𝑛+1 + 𝑢 𝑛+1
𝑢𝑚 𝑚 1 𝐹m+1 − 𝐹𝑚𝑛 𝐹𝑚𝑛+1 − 𝐹𝑚−1 𝑢𝑚+1 − 2𝑢𝑚 𝑚−1 𝑢𝑚+1 − 2𝑢𝑚 𝑚−1
= − − +𝜈 +
𝛥𝑡 2 𝛥𝑥 𝛥𝑥 (𝛥𝑥)2 (𝛥𝑥)2

You might also like