Chapter 9 - Numerical Methods For 1D Unsteady Heat & Wave Equations
Chapter 9 - Numerical Methods For 1D Unsteady Heat & Wave Equations
Last lecture:
Methods for BVP
This lecture:
Chapter 9
(PDEs)
9.1 Effects of Convection, Diffusion and Dispersion on Transport --- Linear KDV-Burgers Equation
𝜕𝑢 𝜕𝑢 𝜕2 𝑢 𝜕3 𝑢
+ 𝑐 = 𝜈 2 + 𝐷 3 (1)
𝜕𝑡 𝜕𝑥 𝜕𝑥 𝜕𝑥
መ 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)
= 𝑓(𝑥 − 𝑐𝑡)
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
𝜕𝑢 𝜕𝑢 𝜕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
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.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 𝑡] 𝑑𝑥
−∞
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”
This lecture:
* መ
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.
𝑛 𝑛 𝑛 +𝑢𝑛
𝜕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)
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
𝑛
𝑢𝑚−1 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚−1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 − 1)ℎ ] (18)
𝑛
𝑢𝑚+1 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚+1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 + 1)ℎ ]
𝑛+1 = 𝑟𝑢 𝑛
𝑢𝑚 𝑛 𝑛
* Substituting (18) into (15): 𝑚+1 + 1 − 2𝑟 𝑢𝑚 + 𝑟𝑢𝑚−1 (15)
0 4r sin2(kh/2) | 2
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
𝑚 𝑚−1
Eqn.: =𝜈 2 (14)
𝛥𝑡 (𝛥𝑥)
𝑛
𝑢𝑚 = 𝑔𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚 ),
𝑛
𝑢𝑚−1 = 𝑔𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚−1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘(𝑥𝑚 −ℎ)]= 𝑢𝑚
𝑛 𝑒𝑥𝑝(−𝑖𝑘ℎ)
𝑛
𝑢𝑚+1 = 𝑔𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚+1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘(𝑥𝑚 +ℎ)]= 𝑢𝑚
𝑛 𝑒𝑥𝑝(+𝑖𝑘ℎ)
𝜌−1 𝑒𝑥𝑝(+𝑖𝑘ℎ)−2+𝑒𝑥𝑝(−𝑖𝑘ℎ)
{ −𝜈 2
𝑛
} 𝑢𝑚 =0
𝛥𝑡 ℎ
𝜌−1 𝑒𝑥𝑝(+𝑖𝑘ℎ)−2+𝑒𝑥𝑝(−𝑖𝑘ℎ)
=𝜈
𝛥𝑡 ℎ2
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
𝑛
𝑢𝑚−1 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚−1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 − 1)ℎ ] (18)
𝑛
𝑢𝑚+1 = 𝑔 𝑡 𝑛 𝑒𝑥𝑝(𝑖𝑘𝑥𝑚+1 ) = 𝑔𝑛 𝑒𝑥𝑝[𝑖𝑘 𝑥0 + (𝑚 + 1)ℎ ]
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 = 𝜈𝛥𝑡 / (𝛥𝑥 )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(-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
𝛥𝑡 (𝛥𝑥)
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)
𝑚
m-1 m m+1 x
𝑛+1
−𝑟𝑢𝑚−1 𝑛+1
+ 1 + 2𝑟 𝑢𝑚 𝑛+1
− 𝑟𝑢𝑚+1 𝑛
= 𝑢𝑚 (29)
Need to solve𝑢𝑚−1
𝑛+1 𝑛+1 , 𝑢 𝑛+1 simultaneously. Use tri-diagonal solver.
, 𝑢𝑚 𝑚+1
* 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
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+2𝑟 2𝑟 𝑐𝑜𝑠( 𝑘ℎ) ± 1 − 4𝑟 2 𝑠𝑖𝑛2 ( 𝑘ℎ) (35)
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 𝑚
𝑛+1 −𝑢𝑛−1
𝑢𝑚 𝑛
𝑢𝑚+1 −2𝑢𝑚𝑛 +𝑢𝑛
Algorithm: 𝑚
= 𝜈 𝑚−1
2𝛥𝑡 (𝛥𝑥)2
unconditionally unstable
𝜕𝑢 𝜕𝑢
+ 𝑐 𝜕𝑥 = 0 (41)
𝜕𝑡
𝑐𝛥𝑡
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 𝜆 = = 𝐶𝑜𝑢𝑟𝑎𝑛𝑡 𝑛𝑢𝑚𝑏𝑒𝑟
𝛥𝑥
𝑛+1 −𝑢𝑛
𝑢𝑚 𝑛 −𝑢𝑛
𝑢𝑚
𝑚
+ c 𝛥𝑥𝑚−1 =0 (47)
𝛥𝑡
𝜕𝑢 𝜕𝑢 𝛥𝑡 𝜕2 𝑢 𝛥𝑥 𝜕2 𝑢 𝛥𝑡 2 𝜕3 𝑢 𝛥𝑥 2 𝜕3 𝑢
+ 𝑐 𝜕𝑥 = − 2 𝜕𝑡 2 + 𝑐 2 𝜕𝑥 2 − −𝑐 +. . . (50)
𝜕𝑡 6 𝜕𝑡 3 6 𝜕𝑥 3
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 𝜕𝑥
𝜕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 𝜕𝑥
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
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, -5x5 (60)
𝜕𝑡
0.8
0.6 IC
Comments: u_num
u_exact
Numerical diffusion smears out the sharp discontinuity 0.4 u_MPDE
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.
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
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)
𝜕𝑢 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)
This lecture:
𝜕𝑢 𝜕𝑢 𝛥𝑥 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.
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
𝜕𝑢 𝜕𝑢 𝜕2 𝑢 𝜕𝑢 𝜕𝐹 𝜕2 𝑢
Model equation: + 𝑐 𝜕𝑥 = 𝜈 𝜕𝑥 2 (linear) Or + =𝜈 (linear or nonlinear)
𝜕𝑡 𝜕𝑡 𝜕𝑥 𝜕𝑥 2
1 2
𝑟 𝜆 Or 𝜆2 2r
2
Mesh (or Cell) Reynolds number or mesh Peclet number
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
Unit Im Unit Im
circle circle r
r
𝜆 1-2r 𝜆
q
1-2r 2r Re 2r Re
𝑛+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
𝜕𝑡
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
0.6 0.95
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