High-Order Finite Difference Methods for Wave Equations
Time Integration Scheme
MIN-HUNGCHEN, CHUN-HAO TENG Department of Mathematics
National Cheng Kung University Tainan City 701, Taiwan
Outline
1 Time Integration Scheme (I) Preliminaries
Stability of Runge-Kutta Methods High-Order Runge-Kutta methods Numerical Experiment
Reference
2 Time Integration Scheme (II) RK for inhomogeneous system Numerical experiment
Reference
Outline
1 Time Integration Scheme (I) Preliminaries
Stability of Runge-Kutta Methods High-Order Runge-Kutta methods Numerical Experiment
Reference
2 Time Integration Scheme (II) RK for inhomogeneous system Numerical experiment
Reference
1D Advection Equation
Example
Consider the 1D advection equation
ut+ ux = 0 x∈ [0, 1] t≥ 0, u(x, 0) = f (x) x∈ [0, 1],
u(0, t) = u(1, t) t≥ 0, which has the exact solution
u(x, t) = f (x − t), x∈ [0, 1], t≥ 0.
Refer to Numerical Scheme
Method of Lines (MOL) Discretization
To numerically approximate a function u and its derivative du/dx, we consider the finite difference approximation of the form
vxj(t) = vj+1(t) − vj−1(t) 2hx
where hx= 1/L and
vj(t) ≈ u(xj, t), vxj(t) ≈ du dx(xj, t),
denote the numerical approximations of u and dudx evaluated at the grid points, xj = jhx.
Method of Lines (MOL) Discretization (Contd.)
Let v(t) = [v0(t), ..., vL(t)]T, vx(t) = [vx0(t), ..., vxL(t)]T. We can discretize the PDE by
dv
dt = Lv(t), where
L = −1 2hx
0 1 −1
−1 0 1
. .. ... ...
−1 0 1
1 −1 0
Then, we can solve the system numerically using numerical methods for ODE systems. Refer to PDE
Approximation of the Linear Operator
In general, we can write the method in a vector form dv
dt = Lv(t), which has the exact solution
v(t) = eLtv(0),
where eLtis the matrix exponential. The exponential ezcan be approximated by an linear operator, for example, a finite Taylor series
eLht ' K(L, ht) =
m
X
i=0
(Lht)i i!
Stability of Linear Operators
The finite difference approximation is
v(t + ht) = vn+1= K(L, ht)vn,
where t = nht, with step size ht, and the matrix K(L, ht)is the approximation to the matrix exponential eLht. The fully discrete method is strongly stable provided that
K(L, ht)n
≤ C(T).
A sufficient condition for strong stability is that
K(L, ht)
≤ 1 + κht,
for some bounded κ and all sufficiently small values of ht. In practice, condition is the above with κ = 0. Refer to ROS
Criteria to Choosing the Time Integration Scheme
Two classes of popular methods:
Linear Multi-step Methods.
Runge-Kutta Methods Criteria:
Accuracy Stability Efficiency Storage
Linear Multi-step Methods (LMM)
In general, an s-step LMM has the form
s
X
j=0
αjvn+j = ht s
X
j=0
βjL(vn+j, tn+j).
The value vn+sis computed from this equation in terms of the previous values vn+s−1, vn+s−2,..., vn and L values at these points (which can be stored and re-used if L is expensive to evaluate).
Runge-Kutta Methods (RK)
An s-stage explicit Runge-Kutta method is k1 = L(vn, nht)
ki = L
vn+ ht i−1
X
j=1
aijki, (n + ci)ht
vn+1= vn+ ht s
X
i=1
biki,
where the choice of the constants aij, ci and bi determines the accuracy and efficiency of the overall method.
RK v.s. LMM
RK methods have several advantages over LMM:
The methods are self-starting.
The time step ht can be changed at any point.
RK requires less storage (for high order methods.) and some disadvantages:
Runge-Kutta methods require evaluating L several times each time step.
(Butcher barriers) Higher-order RK methods require more stages. (for u0(t) = f (u, t))
order p 1 2 3 4 5 6 7 8
Stages 1 2 3 4 5 6 7 8 9 10 11
Table:Number of stages to achieve a specified order
Outline
1 Time Integration Scheme (I) Preliminaries
Stability of Runge-Kutta Methods High-Order Runge-Kutta methods Numerical Experiment
Reference
2 Time Integration Scheme (II) RK for inhomogeneous system Numerical experiment
Reference
Stability of Runge-Kutta Methods
To study the linear stability of these methods we consider a linear scalar equation
du dt = λ u,
for which the general s-stage s-order method can be expressed as a truncated Taylor expansion of the exponential functions
vn+1=
s
X
i=1
(λ ht)i i! vn.
Thus, the method is stable for a region of λ ht for which
s
X
i=1
(λ ht)i i!
≤ 1.
Stability
Stability of Runge-Kutta Methods-Linear System
Consider the linear system du
dt = A uwhere A is a constant m× m matrix. Suppose that A is diagonalizable and we have
A= RΛR−1 and Λ = R−1AR,
where Λ = diag(λ1, ..., λm)is the diagonal matrix of eigenvalues and R is the matrix of eigenvectors.
Let w = R−1uand we have dw
dt = Λ w
or dwp
dt = λpwp, 1 ≤ p ≤ m.
The overall method is stable if each of the scalar problems is stable.
Stability regions for some explicit RK methods
Figure:Stability regions for Runge-Kutta methods (
Ps i=1
zi i!
≤ 1.)
Outline
1 Time Integration Scheme (I) Preliminaries
Stability of Runge-Kutta Methods High-Order Runge-Kutta methods Numerical Experiment
Reference
2 Time Integration Scheme (II) RK for inhomogeneous system Numerical experiment
Reference
High-Order Runge-Kutta Methods
Classical fourth-order accurate, four-stage Runge-Kutta method
Low-storage Runge-Kutta methods
Linear m-stage m-order Runge-Kutta methods
Classical fourth-order accurate Runge-Kutta Methods
The classical fourth-order accurate, four-stage method is k1= L(vn, nht)
k2= L
vn+1
2htk1, n +1 2ht
k3= L
vn+1
2htk2, n +1 2ht
k4= L (vn+ htk3, (n + 1)ht) vn+1= vn+ht
6(k1+ 2k2+ 2k3+ k4).
Low-storage RK methods
Thes-stage low-storage method is v0= vn
∀ j ∈ [1, . . . , s] :
( kj = ajkj−1+ htL vj, (n + cj)ht
vj = vj−1+ bjkj
vn+1= vs
where the constants aj, bjand cjare chosen to yield the desired order, s − 1, of the method. For the method to be self-starting we require that a1 = 0. We need only two storage levels (2N) containing kjand vjto advance the solution.
Five-stage Fourth-order Low Storage RK Methods
The constants for a five-stage fourth-order Runge-Kutta method (RK4S5) are
a1 = 0 b1= 1432997174477
9575080441755 c1= 0 a2 = −567301805773
1357537059087 b2= 5161836677717
13612068292357 c2= 1432997174477 9575080441755
a3 = −2404267990393
2016746695238 b3= 1720146321549
2090206949498 c3= 2526269341429 6820363962896
a4 = −3550918686646
2091501179385 b4= 3134564353537
4481467310338 c4= 2006345519317 3224310063776
a5 = −1275806237668
842570457699 b5= 2277821191437
14882151754819 c5= 2802321613138 2924317926251
See Carpenter and Kennedy (1994)
Stability regions for RK4S5
Figure:Stability regions for RK4S5
Linear m-stage m-order RK Methods
SSPRK linear (m,m) The class of m stage Methods given by:
v(i) = v(i−1)+ htLv(i−1), i= 1, . . . , m − 1 v(m)=
m−2
X
k=0
αm,kv(k)+ αm,m−1
v(m−1)+ htLv(m−1) ,
where α1,0 = 1 and αm,k= 1
kαm−1,k−1, k= 1, . . . , m − 2 αm,m−1= 1
m!, αm,0= 1 −
m−1
X
m=1
αm,k
See Gottlieb, Shu and Tadmor (2001) Modified Scheme
Stability regions for linear SSPRK Methods
Figure:Stability regions for Runge-Kutta methods
Compact Scheme
RK4S5 v.s. SSPRK
Comparison:
Low Storage: RK4S5:2N; SSPRK:3N Efficiency: ?
RK4S5 v.s. SSPRK:Stability regions
Figure:Stability regions for Runge-Kutta methods
Compact Scheme
RK4S5 v.s. SSPRK: Efficiency
3D test problem
N method Error dt CFL T/dt ops Ratio
80 RK4S5 4.00e − 9 1.25e − 3 .3/3 800 4000 SSPRK7 1.48e − 9 3.55e − 3 .85/3 282 1974 2.03 40 RK4S5 3.39e − 7 3.75e − 3 .45/3 267 1335
SSPRK7 2.14e − 7 7.09e − 3 .85/3 141 987 1.35 2D test problem
N method Error dt CFL T/dt ops Ratio
80 RK4S5 3.33e − 9 1.88e − 3 .3/2 533 2665 SSPRK7 1.34e − 9 5.32e − 3 .85/2 188 1316 2.02 40 RK4S5 1.78e − 7 3.75e − 3 .3/2 267 1335
SSPRK7 1.94e − 7 1.06e − 2 .85/2 94 658 2.03 Table: RK4S5 v.s. SSPRK: (7th order SBP operator)
Note: ops = T/dt · # of stages.
RK4S5 v.s. SSPRK: Efficiency (Contd.)
3D test problem
N method Error dt CFL T/dt ops Ratio
80 RK4S5 3.32e − 7 3.745e − 3 .9/3 267 1335 SSPRK5 2.96e − 7 7.194e − 3 1.73/3 139 695 1.92 40 RK4S5 8.20e − 6 8.3333e − 3 1/3 120 600
SSPRK5 9.90e − 6 1.449e − 2 1.73/3 69 345 1.74 2D test problem
N method Error dt CFL T/dt ops Ratio
80 RK4S5 4.31e − 7 6.25e − 3 1/2 160 800
SSPRK5 2.68e − 7 1.09e − 2 1.73/2 92 460 1.74 40 RK4S5 6.85e − 6 1.25e − 2 1/2 80 400
SSPRK5 8.64e − 6 2.17e − 2 1.73/2 46 230 1.74 Table: RK4S5 v.s. SSPRK: (5th order SBP operator)
Note: ops = T/dt · # of stages.
Outline
1 Time Integration Scheme (I) Preliminaries
Stability of Runge-Kutta Methods High-Order Runge-Kutta methods Numerical Experiment
Reference
2 Time Integration Scheme (II) RK for inhomogeneous system Numerical experiment
Reference
Sample Code
Location:
http://www.math.ncku.edu.tw/∼mhchen/HOFD/sample.zip advection_pbc.m: Solve the 1D advection equation with periodic boundary condition.
Diff_cpt4.m: 4th order compact difference operator.
Spectrum_ROS_pbc.m: Plot the ROS and the spectrum.
f1.m-f8.m: Describe the boundary of ROS of RK.
Example
Example
Consider the 1D advection equation
ut+ ux= 0 x∈ [0, 1] t≥ 0, u(x, 0) = sin(2πx) x∈ [0, 1],
u(0, t) = u(1, t) t≥ 0, which has the exact solution
u(x, t) = sin(2π(x − t)), x∈ [0, 1], t≥ 0.
Compact Fourth-Order Scheme
To numerically approximate a function u and its derivative du/dx, we consider the fourth order compact difference approximation of the form
1
4vxj−1+ vxj+1
4vxj+1= 3 2
vj+1− vj−1 2h
where
vj ≈ u(xj) vx = vxj≈ du dx(xj).
Eigenvalue Spectrum of the Compact Scheme
Figure:Eigenvalue Spectrum:(Left) N=40; (Right) N=80
ROS_RK ROS_RK4S5
Figure:(left) RK4 with CFL= 1.5; (right) RK4S5 with CFL= 1.8.
Summary
Steps to solve a PDE
1 Approximate the spatial differential operators. (FDM, FVM, FEM, Spectral Methods)
2 Study the stability of the resulting semi-discrete scheme
3 Study the eigenvalue spectrum of the resulting ODE system
4 Choose a time integrating scheme (RK, LMM, etc) and determine the CFL number
5 Solve the ODE system by an appropriate time integration scheme
Outline
1 Time Integration Scheme (I) Preliminaries
Stability of Runge-Kutta Methods High-Order Runge-Kutta methods Numerical Experiment
Reference
2 Time Integration Scheme (II) RK for inhomogeneous system Numerical experiment
Reference
Reference
J. S. Hesthaven, S. Gottlieb and D. Gottlieb, “Spectral Methods for Time-Dependent Problems.”
Randall LeVeque, “Finite Difference Methods for Ordinary and Partial Differential Equations: Steady-State and Time-Dependent Problems.”
Outline
1 Time Integration Scheme (I) Preliminaries
Stability of Runge-Kutta Methods High-Order Runge-Kutta methods Numerical Experiment
Reference
2 Time Integration Scheme (II) RK for inhomogeneous system Numerical experiment
Reference
Time Discretization
Example
Numerical Scheme: (SBP operators) Refer to Penalty method
dv
dt + h−1P−1Qv = h−1τ q00(v0− g(t))P−1e0, Let us write the semi-discrete schemes as
d
dtv = Lv + Φ(t)
where v(t) = (vj(t))1≤j≤K, L consists the difference operator modified by the SAT term, and Φ contains the time explicit boundary conditions.
Question
How do we implement a RK method to solve the semi-discrete scheme?
Classical RK4
k1= L(vn, nht) =Lvn+ Φ(tn) k2= L
vn+1
2htk1, n + 1 2ht
=L(vn+1
2htk1) + Φ(tn+1/2) k3= L
vn+1
2htk2, n + 1 2ht
=L(vn+1
2htk2) + Φ(tn+1/2) k4= L (vn+ htk3, (n + 1)ht) =L(vn+ htk3) + Φ(tn+1) vn+1= vn+ht
6(k1+ 2k2+ 2k3+ k4).
Question
How do we implement a RK method to solve the semi-discrete scheme?
Classical RK4
k1= L(vn, nht) =Lvn+ Φ(tn) k2= L
vn+1
2htk1, n + 1 2ht
=L(vn+1
2htk1) + Φ(tn+1/2) k3= L
vn+1
2htk2, n + 1 2ht
=L(vn+1
2htk2) + Φ(tn+1/2) k4= L (vn+ htk3, (n + 1)ht) =L(vn+ htk3) + Φ(tn+1) vn+1= vn+ht
6(k1+ 2k2+ 2k3+ k4).
Implementation of Classical RK4-I
Run Wave_RK4C_1D.m
N Error Ratio
20 1.544e − 2 - 40 2.013e − 3 7.67 80 2.5428e − 4 7.92 Table: Classical RK4
Implementation of Classical RK4-II
ODE system: d
dtu = Du + φ(t)e0, D = Q/hx
Numerical solution:
k1= Dvn+ g0e0 k2= D(vn+1
2htk1) + g1e0
k3= D(vn+1
2htk2) + g2e0
k4= D(vn+ htk3) + g3e0 vn+1= vn+ht
6(k1+ 2k2+ 2k3+ k4).
Implementation of Classical RK4-III
Approximation Solution:
uapp(ht) =
4
X
l=0
(Dht)l l! un+
4
X
l=1 l−1
X
i=0
Dl−i−1hlt
l! φ(i)(tn) e0
Numerical solution:
vn+1=
4
X
l=0
(Dht)l
l! vn+ (1 6ht+1
6h2tD+ 1
12h3tD2+ 1
24h4tD3)g0e0 + (1
3ht+1
6h2tD+ 1
12h3tD2)g1e0
+ (1 3ht+1
6h2tD)g2e0+ (1
6ht)g3e0
Implementation of Classical RK4-IV
D3: 1
24D3h4tg0= 1
24D3h4tφ(tn)
⇒ g0= φ(tn) D2: 1
12D2h3tg0+ 1
12D2h3tg1= 1
6D2h3tφ(tn) + 1
24D2h4tφ0(tn)
⇒ g1= φ(tn) +1 2htφ0(tn) D1: . . .
⇒ g2= φ(tn) + φ(tn)ht
2 +φ00(tn) 2! (ht
2)2 D0: . . .
⇒ g3= φ(tn) + φ0(tn)ht+φ00(tn)
2! h2t +φ(3)(tn) 3! h3t
Implementation of Classical RK4-V
Run Wave_RK4CM_1D.m
N Error Ratio Order
20 4.677e − 4 - -
40 3.111e − 5 15.034 3.91 80 1.977e − 6 15.734 3.98 80 1.242e − 7 15.922 3.99 Table: Modified Classical RK4
Modified SSP-RK Methods
v(0) = vn,
v(i) = v(i−1)+ htLv(i−1)+ htS(i), i= 1, ..., m, vn+1 =Pm
k=0αm,kv(k),
where the ht denotes the time step and the coefficients αm,k, namely
α1,0 = 1
αm,k = 1kαm−1,k−1, k= 1, ..., m − 2, αm,m = m!1, αm,m−1 = 0, αm,0= 1 −Pm
k=1αm,k. and
S(i)= (I + ht∂t)i−1S(tn), where I denotes the identity operator. SSPRK
Outline
1 Time Integration Scheme (I) Preliminaries
Stability of Runge-Kutta Methods High-Order Runge-Kutta methods Numerical Experiment
Reference
2 Time Integration Scheme (II) RK for inhomogeneous system Numerical experiment
Reference
Sample Code-SBP 1D
Location:
http://www.math.ncku.edu.tw/∼mhchen/HOFD/wave.zip Wave_SSPRK_1D.m: Solve the 1D problem with SSPRK.
Wave_RK4S5_1D.m: Solve the 1D problem with RK4S5.
Wave_SSPRK_2D.m: Solve the 2D problem with SSPRK.
Mx_2D.m, My_2D.m:
Diff_CompFD77451_e1.m: 5th order SBP operator.
coefb.m and coefbin.m: Coefficients for SSPRK.
Spectrum_ROS.m: Plot the ROS and the spectrum.
f1.m-f8.m: Describe the boundary of ROS of RK.
1D Example
Example
Consider the 1D advection equation
ut+ ux= 0 x∈ [0, 1] t≥ 0, u(x, 0) = sin(ωx) x∈ [0, 1],
u(0, t) = sin(−ωt) t≥ 0, which has the exact solution
u(x, t) = sin(ω(x − t)), x∈ [0, 1], t≥ 0.
Numerical Scheme: (SBP operators) dv
dt + h−1P−1Qv = h−1τ q00(v0− g(t))P−1e0,
Refer to Inhomogeneous ODE System
Eigenvalue Spectrum
Numerical Scheme: (SBP operators) dv
dt + h−1P−1Qv = h−1τ q00(v0− g(t))P−1e0,
To investigate the stability of the one dimensional scheme, we need to find the eigenvalue spectra of the operators:
L = −h−1P−1Q + h−1τ q00P−1E0
= h−1P−1(−Q + τ q00E0) where
E0 =diag(1, 0, 0, ..., 0) ∈ ML+1.
Figure:Eigenvalue spectra of the fifth order accurate operator
−h−1P−1Q + h−1τ q00P−1E0, for various values of N and τ .
Eigenvalue Spectrum with ROS
Figure:Stability envelope of fifth order accurate SSP-RK and the spectra of the 5th order scheme with CFL = 1.73. Computational parameters: N = 40 and τ = 2
Figure:L2-error history of the fifth order (left) and the seventh order (right) 1D schemes with CFL = 1.73 .
2D Example
Example
Let us consider the two dimensional advection problem
ut+ ux+ uy = 0 x, y ∈I2= [0, 1]2 t≥ 0 u(x, y, 0) = sin(ω(x + y)) x, y ∈I2
u(0, y, t) = sin(ω(y − 2t)) y∈ [0, 1] t≥ 0 u(x, 0, t) = sin(ω(x − 2t)) x∈ [0, 1] t≥ 0 which has the exact solution of the form
u(x, y, t) = sin(ω(x + y − 2t)), x, y ∈ [0, 1], t≥ 0.
Numerical Scheme
dv
dt + Dxv + Dyv = r, where
Dx = IM+1⊗ h−1x P−1x Qx, Dx = h−1y P−1y Qy⊗ IL+1,
r = h−1x τ1
M
X
j=0
qx00(v0j− g1(yj, t))(eyj⊗ P−1x ex0)
+ h−1y τ2
L
X
i=0
qy00(vi0− g2(xi, t))(P−1y ey0⊗ exi).
Eigenvalue Spectrum-2D
For the two dimensional scheme, the corresponding operator L takes the form
L = IM+1⊗ h−1x P−1x (−Qx+ τ1qx00Ex0) + h−1y P−1y (−Qy+ τ2qy00Ey0) ⊗ IL+1
where Ex0∈ ML+1and Ey0∈ MM+1are explicitly given by Ex0=diag(1, 0, 0, ..., 0), Ey0=diag(1, 0, 0, ..., 0).
Eigenvalue Spectrum-2D (contd.)
Let λxi, i = 0, 1, ..., L and λyj, j = 0, 1, ..., M denote the eigenvalues of the one dimensional operators
h−1x P−1x (−Qx+ τ1qx00Ex0) and h−1y P−1y (−Qy+ τ2qy00Ey0), respectively. Then, denoted by λijthe eigenvalues of L are
λij= λxi + λyj,
followed by Lemma. Immediately, this gives a rough estimate on the largest eigenvalue in magnitude as
max |λij| ≤ 2 max(|λxi|, |λyj|).
Figure:L2-error history of the fifth order 2D schemes. Computational time steps are computed with CFL = 1.73/2 .
Outline
1 Time Integration Scheme (I) Preliminaries
Stability of Runge-Kutta Methods High-Order Runge-Kutta methods Numerical Experiment
Reference
2 Time Integration Scheme (II) RK for inhomogeneous system Numerical experiment
Reference
Reference
M. H. Carpenter, D. Gottlieb, S. Abarbanel and W.S. Don,
“The theoretical accuracy of Runge-Kutta time
discretizations for the initial boundary value problem: a study of the boundary error.” SIAM Journal on Scientific Computing, 1995.
M-H Chen, B. Cockburn and F. Reitich, “High-order RKDG Methods for Computational Electromagnetics.” Journal of Scientific Computing, 2005.