Finite Difference Methods for the ... Wave Equation

advertisement
18.336 spring 2009
lecture 15
02/13/08
Finite Difference Methods for the One-Way
Wave Equation
�
ut = cux
u(x, 0) = u0 (x)
Solution: u(x, t) = u0 (x + ct)
Information travels to the left
with velocity c.
Image by MIT OpenCourseWare.
Three Approximations:
⎧
Ujn+1 − Ujn
⎪
⎪
c
upwind
⎪
⎪
⎪
Δx
⎪
⎪
⎪
⎨
Ujn+1 − Ujn
Ujn − Ujn−1
=
c
downwind
⎪
Δt
Δx
⎪
⎪
⎪
⎪
⎪
⎪
U n − Ujn−1
⎪
⎩ c j+1
centered
2Δx
Accuracy:
Taylor expansion of solution u
u(x, t + Δt) − u(x, t)
1
1
= ut + utt Δt + uttt (Δt)2 + O((Δt)3 )
Δt
2
6
1
1
u(x + Δx, t) − u(x, t)
= ux + uxx Δx + uxxx (Δx)2 + O((Δx)3 )
Δx
2
6
1
u(x + Δx, t) − u(x − Δt, t)
= ux + uxxx (Δx)2 + O((Δx)4 )
2Δx
6
Substitute into FD scheme:
1
Upwind: ut + utt Δt −cux − 12 cuxx Δx + O(Δt2 ) + O(Δx2 )
����
�2 �� �
=cux
= 12 c2 uxx Δt
Leading order error:
1
u Δt − 12 cuxx Δx = 12 c2 uxx Δt − 12 cuxx Δx = 12 cuxx Δx(r − 1)
2 tt
cΔt
Δx
Courant number
= 0 if r = 1
r=
� 1
First order if r =
1
Downwind: Analogous: first order
Centered: ut + 12 utt Δt − cux − 16 cuxxx Δx2 + O(Δt2 ) + O(Δx4 )
Δt → First order in time
Δx2 → Second order in space
Stability:
G−1
eikΔx − 1
=c
Δt
Δx
ikΔx
⇒ G = 1 − r + re
Upwind:
⇒ |G| ≤ |1 − r| + |reikΔx | = 1, if 0 ≤ r ≤ 1
� �� �
CFL-Condition
conditionally stable
Image by MIT OpenCourseWare.
Downwind: G = 1 + r − re−ikΔx
unstable
Image by MIT OpenCourseWare.
eikΔx − e−ikΔx
= 1 + ir sin(kΔx)
Centered: G = 1 + r
2
unstable
Image by MIT OpenCourseWare.
2
Messages:
1. Upwind works (CFL-condition on stability)
2. Centered needs a fix
Add Diffusion:
n
Ujn+1 − Ujn
Ujn+1 − Ujn−1
Uj+1
− 2Ujn + Ujn−1
=c
+θ
Δt
2Δx
(Δx)2
Replace Ujn by average:
�
�
Ujn+1 − λ2 Ujn+1 + (1 − λ)Ujn + λ2 Ujn−1
Ujn+1 − Ujn−1
=c
Δt
2Δx
Δt
where λ = 2
θ
(Δx)2
How much diffusion?
Lax-Friedrichs:
(Δx)2
2Δt
1−r
Ujn−1
2
� �� �
Eliminate Ujn by λ = 1 ⇒ θ =
Ujn+1 =
1+r
2 �
� ��
≥0(for |r|≤1)
Ujn+1 +
r=
≥0(for |r|≤1)
Monotone scheme
Accuracy: First in time, Second in space (exercise)
Stability: G = ir sin(kΔx) + cos(kΔx)
�
��
� � �� �
central difference
diffusion
conditionally stable |r| ≤ 1
Image by MIT OpenCourseWare.
Lax-Wendroff:
Δt 2
c
2
n
Δt 2 Uj +1 − 2Ujn + Ujn−1
+
c
2
(Δx)2
Choose θ to get second order in time: θ =
Ujn+1 − Ujn
Ujn+1 − Ujn−1
=c
Δt
2Δx
3
cΔt
Δx
Accuracy: ut + 12 utt Δt+ 16 uttt Δt2 −cux − 16 cuxxx Δx2 − Δt
c2 uxx − Δt
c2 uxxxx Δx2
2
24
= 16 uttt Δt2 − 16 cuxxx Δx2 = O(Δt2 ) + O(Δx2 )
ut − cux = 0
1
u Δt
2 tt
−
Δt 2
c uxx
2
=0
Stability: λ = r2
r2 + r ikΔx
r2 − r −ik(Δx)
e
+ (1 − r2 ) +
e
2
2
= (1 − r2 ) + r2 cos(kΔx) + ir sin(kΔx)
G=
Worst case: kΔx = π ⇒ G = 1 − 2r2
Stable if |r| ≤ 1
Image by MIT OpenCourseWare.
4
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