Modified Equation

advertisement
18.336 spring 2009
lecture 16
02/19/08
Modified Equation
Idea: Given FD approximation to PDE
Find another PDE which is approximated better by FD scheme.
Learn from new PDE about FD scheme.
Ex.: ut = cux
n
n
Ujn+1 − Ujn
Ujn+1 − Uj−1
Ujn+1 − 2Ujn + Uj−1
Lax-Friedrichs:
−c
−
=0
Δt
2Δx
2Δt
1
1
1
1
Taylor: ut + utt Δt−cux − cuxxx Δx2 −
uxx Δx2 −
uxxxx Δx4 +. . .
2
6
2Δt
24Δt
1�
Δx2 �
= (ut − cux ) +
utt Δt − uxx
+ ...
2 ����
Δt
=c2 uxx
�
1 2
Δx2 �
= (ut − cux ) +
c Δt −
uxx
2
Δt
Modified equation:
Δx2
cΔt
ut − cux =
(1 − r2 )uxx
r=
2Δt
Δx
Advection-diffusion equation with diffusion constant
Δx2
−
D=
( ����
1
r2
)
����
2Δt
added diffusion
antidiffusion by central differencing
Ex.: Upwind:
ut − cux = 12 cΔx(1 − r)uxx
(exercise)
Compare:
−→ DLF = 34 Δx , DUW = 14 Δx
For c = 1, r = 12
Upwind less diffusive than LF.
Ex.: Lax-Wendroff
ut − cux = 16 cΔx2 (r2 − 1)uxxx
(uxx cancels by construction)
Advection-dispersion equation with dissipation constant
µ = − 16 cΔx2 (1 − r2 )
Disturbances behave like Airy’s equation
Message:
First order methods behave diffusive.
Second order methods behave dispersive.
1
More on Advection Equation
ut + cux = 0
So far:
1. Upwind:
⎧
Ujn − Ujn−1
⎪
⎪
⎪
−c
c>0
⎨
Δx
Ujn+1 − Ujn
=
⎪
Δt
U n − Ujn
⎪
⎪
⎩
−c j+1
c<0
Δx
⎫
⎪
⎪
⎪
⎬
→
e = O(Δt) + O(Δx)
⎪
⎪
⎪
⎭
2. Lax-Friedrichs/Lax-Wendroff:
Ujn+1 − Ujn
Ujn+1 − Ujn−1
Ujn+1 − 2Ujn + Ujn−1
=
+θ
Δt
2Δx
(Δx)2
(Δx)2
→
e = O(Δt) + O(Δx2 )
LF: θ =
2Δt
Δt 2
c → e = O(Δt2 ) + O(Δx2 )
LW: θ =
2
Semidiscretization:
Uj+1 − Uj−1
+ O(Δx2 )
Central: ux =
2Δx
⎡
⎤
⎡
⎤
⎡
⎤
0
1
−1
(ux )1
u1
. .
.
.
.
.
⎢
⎥
1
⎢ −1
⎢ .
⎥
⎥
⎥ ⎢ .
Matrix
⎣
.
⎥ ·
⎣
.
⎦
.
⎦
=
2Δx
⎢
.
.
.
. . . . 1 ⎦
⎣
(ux )k
uk
1
−1 0
�
��
�
=A
T
A = −A ⇒ eigenvalues purely imaginary
Need time discretization that is stable for u̇ = λu with λ = iµ, µ ∈ R
Linear Stability for ODE:
Region of absolute stability = {λ ∈ C : method stable for u̇ = λu}
2
Ex.:
Forward Euler
un+1 = un + λΔtun
= (1 + λΔt)un
Backward Euler
1
un+1 =
un
1 − λΔt
Trapezoidal
1 + 12 λΔt
n+1
u
=
1 − 12 λΔt
RK2
Adams-Bashforth 3
Stable if |1 + λΔt| ≤ 1
RK4
Can also use higher order discretization of ux
(up to spectral). If central ⇒ need ODE solver for timestep
that is stable for u̇ = iµu.
Spurious Oscillations
Stable does not imply “no oscillations.”
Ex.: Lax-Wendroff
Image by MIT OpenCourseWare.
Overshoots remain
bounded ⇒ stable.
Still bad (e.g. density can
become negative)
3
Total Variation:
�
�
T V (u) =
|uj+1 − uj | ≈ |ux (x)|dx “total up and down”
j
Method total variation diminishing (TVD), if
T V (un+1 ) ≤ T V (un ).
Bad News: Any linear method for advection that is TVD,
is at most first order accurate.
[i.e.: high order → spurious oscillations]
Remedy: Nonlinear Methods:
1. Flux-/Slope- Limiters
� conservation laws; limit flux → TVD
2. ENO/WENO
(weighted) essentially non-oscillatory
(essentially TVD; no noticeable spurious oscillations)
ENO/WENO
Approximate ux by interpolation.
ENO: At each point consider multiple interpolating polynomials (through
various choices of neighbors). Select the most “stable” one to define ux .
WENO: Define ux as weighted average of multiple interpolants.
Higher order when u smooth, no overshoots when u non-smooth.
4
Ex.: Fifth order WENO
Image by MIT OpenCourseWare.
s1 =
s2 =
s3 =
a1 =
a2 =
13
(v
12 1
13
(v
12 2
13
(v
12 3
− 2v2 + v3 )2 + 14 (v1 − 4v2 + 3v3 )2
− 2v3 + v4 )2 + 14
(v2 − v4 )2
− 2v4 + v5 )2 + 14 (3v3 − 4v4 + v5 )2
vj =
1
/(�
10
6
/(�
10
3
/(�
10
+ s1 )2
+ s2 )2
� = 10−6 · max(vj 2 )
j
a3 =
+ s3 )2
sa = a1 + a2 + a3
w1 = asa
1
w2 =
w3 =
w=
�
Uj+1 − Uj
Δx
a2
sa
a3
sa
1
(w1
6
· (2v1 − 7v2 + 11v3 ) + w2 · (−v2 + 5v3 + 2v4 ) + w3 · (2v3 + 5v4 − v5 ))
�
Left sided approximation to ux at x4
Right sided approximation to ux at x3
ut + cux = 0
Upwind WENO with FE:
�
�
Ujn+1 − Ujn
−c · WENOleft Ujn > 0
=
−c · WENOright Ujn ≤ 0
Δt
TVD time stepping
Consider method that is TVD with FE.
Is it also TVD with high order time stepping?
In general: “no.”
But for special class of ODE schemes: “yes.”
Strong Stability Preserving (SSP) methods
5
Ex.: FE (un ) = un + Δtf (un )
RK3-TVD
u
n+1 =
13 u
n + 23 FE (
34 u
n + 14 FE(FE(u
n )))
Convex combination of FE steps
⇒ Preserves TVD property
Compare: Classical RK4 cannot by written this way.
It is not SSP.
Popular approach for linear advection:
ut + cux = 0
RK3-TVD in time, upwinded WENO5 in space.
2D/3D: Tensor product in space.
Image by MIT OpenCourseWare.
WENO5-stencil
6
MIT OpenCourseWare
http://ocw.mit.edu
18.336 Numerical Methods for Partial Differential Equations
Spring 2009
For information about citing these materials or our Terms of Use, visit: http://ocw.mit.edu/terms.
Download