Professional Documents
Culture Documents
3 Conservation Laws
Modern Finite Difference Methods for Conservation Laws
a + b + c = 0, −a + c = 1, a+c =0
Fourth derivatives:
u4 − 4u3 + 6u2 − 4u1 + u0
u (4) (x0 ) = + O(h),
h4
u2 − 4u1 + 6u0 − 4u−1 + u−2
u (4) (x0 ) = + O(h2 ),
h4
Difference Formula for Two-Dimension
Uniform Grid
Mixed derivatives
1
uxy (x0 , y0 ) = (u1,1 − u1,−1 − u−1,1 + u−1,−1 ) + O(h2 )
4h2
Laplacian
1
∇2 u(x0 , y0 ) = (u1,0 + u0,1 + u−1,0 + u0,−1 − 4u0,0 ) + O(h2 )
h2
1
∇2 u(x0 , y0 ) = (−60u0,0 + 16(u1,0 + u0,1 + u−1,0 + u0,−1 )
12h2
−(u2,0 + u0,2 + u−2,0 + u0,−2 )) + O(h4 )
Linear Advection Equation
ut + aux = 0
u(x, 0) = u0 (x)
u(x, t) = u0 (x − at)
Basic Finite Difference Schemes for Linear
Advection Equation
Combine the spatial and temporal discretization together, we list
some finite-difference scheme below
uin+1 −uin u n −u n
Upwind (first-order) k + a i h i−1 =0
u n+1 − 12 (ui+1
n +u n )
i−1
n −u n
ui+1 i−1
Lax-Friedrichs scheme, i k +a 2h =0
Lax-Wendroff scheme
a2 k 2
uin+1 = uin − ak n n
2h (ui+1 − ui−1 ) + 2h2
n
(ui+1 − 2uin + ui−1
n )
Homework:
1 write a computing program using the above listed schemes to
the linear advection equation. Use periodic boundary
conditions and Gaussian initial conditions.
Quantitative Properties of Finite Difference
Schemes
Theorem
The Lax-Richtmyer equivalence theorem. A consistent finite
difference scheme for a partial differential equation for which the
intial value problem is well-posed is convergent if and only if it is
stable
This implies
1 n h2 φn − φni−1 h2
(φi+1 +φni−1 ) = φni + φxx +O(h4 ), i+1 = φx + φxxx +O(h4 ).
2 2 2h 6
Substituting these expressions in the scheme, we obtain
1 1 1
e n = kφtt − k −1 h2 φxx + ah2 φxxx + O(k 4 + k −1 h4 + k 2 )
2 2 6
So e n → 0 as h, k → 0, i.e., it is consistent, as long as k −1 h2 → 0.
Note that reducing time step (k → 0) with a fixed spatial length h
leads to inconsistency for this scheme.
A Consistent Scheme may NOT Converge
Consider the forward time forward space scheme
uin+1 −uin u n −u n
k + a i+1h i = 0. It is easy to verify it is NOT stable using
the domain dependence. This scheme can be rewritten as
ak n
uin+1 = uin − (u − uin ) = (1 + λ)uin − λui+1
n
(1)
h i+1
where λ = ak/h. It is easy to show it is consistent (Exercise).
Assume a = 1. The solution of the PDE is a shift of u0 to the
right by t. If we take the initial condition as
( (
1 if − 1 ≤ x ≤ 0 0 1 if − 1 ≤ ih ≤ 0
u0 (x) = ⇒ ui =
0 elsewhere 0 elsewhere
Theorem
A finite-difference scheme with constant coefficients
X r r
X
uin+1 = n
am ui+m is stable if and only if Ĝ ( ξ) := ak e −ikξ
m=−l m=−l
satisfies max |Ĝ (ξ)| ≤ 1.
−π≤ξ≤π
ui − ui−1 ∂u h ∂ 2 u h2 ∂ 3 u
= − + + O(h3 )
h ∂x 2 ∂x 2 6 ∂x 3
centered, second-order
ui+1 − ui−1 ∂u h2 ∂ 3 u
= + + O(h4 )
h ∂x 6 ∂x 3
centered, fourth-order
∂ m+1 u m+1 ∂
m+2 u
ut + aux = bhm + ch (2)
∂x m+1 ∂x m+2
to O(hm+2 ), where b and c are rational numbers determined by
the particular finite-difference scheme.
The even derivative on the right-side of (2) produces
amplitude error, or numerical dissipation.
The odd-order derivative on the right side of (2) produces a
wave-number-dependent phase error known as numerical
dispersion.
Compact Differencing
High order scheme depends on a larger stencil. The
sixth-order scheme
3 3 1
ux = δ2h u − δ4h u + δ6h u + O(h6 ) (3)
2 5 10
where δmh u = (ui+m/2 − ui−m/2 )/(mh), provides only
marginal improvement over the fourth-order scheme.
Rewrite the second-order central difference into
h2 2
δ2h u = 1+ δh ux + O(h4 ),
6
u −2u +u
where δh2 = δh (δh u) = i+1 h2i i−1 . Expanding the
finite-difference operator yields the following O(h4 ) accurate
scheme
ui+1 − ui−1 1
= ((ux )i+1 + 4(ux )i + (ux )i−1 ) (4)
2h 6
which is calculated on three-point stencil. At intermediate
numerical resolution, the compact fourth-order scheme (4) is
typically more accurate than the sixth-order scheme (3).
Conservation Laws in Ideal MHD Equations
Definition
A finite-difference approximation to the scalar conservation law is
u n+1 −u n fˆi+ 1 −fˆi− 1
in conservative form if it can be written as i k i + 2 h 2 = 0
where fˆi+ 1 is numerical flux approximation of the form
2
fˆi+ 1 = fˆ(ui−r , ..., ui+s ), r , s are integers, and satisfy the consistent
2
condition fˆ(u0 , u0 , ..., u0 ) = f (u0 ).
Exercise: verify that Lax-Friedrichs and Lax Wendroff schemes are
conservative schemes and derive the form of fˆi+ 1 .
2
Theorem
The conservative scheme will converge to a weak solution if it
converges (Wendroff and Lax 1960)
The nonconservative scheme may not converge to a weak solution
if the solution is discontinuous.
Examples
d ū(xi , t) 1
=− f (u(xi+ 1 , t)) − f (u(xi− 1 , t))
dt ∆xi 2 2
1
R xi+ 21
where ū(xi , t) = ∆xi xi− 1 u(ξ, t)dξ is the cell average. The finite
2
volume discretization is to approximate flux f (u(xi+ 1 , t)) using a
2
numerical flux fˆ 1 = h(u − 1 , u + 1 ) where u ± 1 are the
i+ 2 i+ 2 i+ 2 i+ 2
approximate values of u at interface from both side. The
two-argument function h is a monotone flux that satisfies
consistent condition h(u, u) = f (u).
Procedure to Construct Flux for Finite
Volume Scheme
where θ ∈ [1, 2]. The larger the θ, the less dissipative the
scheme.
minmod limiter : θ = 1,
monotone central limiter : θ = 2
High Order Finite-Volume Reconstruction
Problem: Given k = r + s + 1 cell average, ūi−r , ..., ūi+s , find a
polynomial pi (x), of degree at most k − 1, such that it is a k-th
orderR accurate approximation to the function u(x), and
1 xi+1/2
∆xj xj−1/2 p(ξ)dξ = ūj ,, j = i − r , ..., i + s.
Rx
Algorithm: Consider primitive function U(x) = −∞ u(ξ)dξ. We
have
i
XZ xj+1/2 i
X
U(xj+ 1 ) = u(ξ)dξ = ūj ∆xj
2
j=−∞ xj−1/2 j=−∞
p(x) := P 0 (x)
Basic Idea of ENO: find the “smoothest” stencil among all the
possible stencils with k + 1 consecutive points. Algorithm: Start
with two point stencil and polynomial
P 1 (x) = U[xi−1/2 ] + U[xi−1/2 , xi+1/2 ](x − xi−1/2 ), add one point
to the stencil in each step.
If |U[xi−1/2 , xi+1/2 , xi+3/2 ]| < |U[xi−3/2 , xi−1/2 , xi+1/2 ]|,
choose the 3-point stencil as S3 (i) = {xi−1/2 , xi+1/2 , xi+3/2 };
otherwise, take S3 (i) = {xi−3/2 , xi−1/2 , xi+1/2 }
The procedure is continued, according to the smaller of the
absolute values of the two relevant divided differences, until
the desired number of points in the stencil is reached.
WENO (Weighted ENO) Reconstruction
Basic Idea of WENO: instead of using only one of the candidate
stencils to form the reconstruction, one uses a convex combination
of all of them.
Suppose the k candidate stencils
Sr (i) = {xi−r , ..., xi−r +k−1 }, r = 0, k − 1, produce k different
reconstructions to the value ui+ 1 , we denotes
2
k−1
(r )
X
ui+ 1 = crj ūi−r +j , r = 0, ..., k − 1
2
j=0
s 1
2 2
1 2 B 2 B 2
cf ,s = a ± + 2
a + 2 2
− 4a ca ,
2 ρ ρ
are the
q speeds of fast and slow magneto-sonic waves, and
a = γp ρ is the speed of the acoustic wave.
Eight waves
Dimensional Split
Godunov split: u n+1 = Lxdt Lydt (u n )
Strang split u n+2 = Lxdt Lydt Lydt Lxdt (u n )
unsplit scheme:
Method of lines (MOL) approach: PDE→ODE, and then
Runge-Kutta time integration.
Lax-Wendroff Approach: replace the time-derivatives with
spatial derivatives, then using the spatial discretization.
The Lax-Wendroff approach has smaller stencil than the MOL
approach.
The dimensional split achieves only up to second order schemes.
But the CFL limit is more relax for the split scheme than for the
unsplit scheme.
Staggered Grid and Constraint Transport
n+1 n ∆t
bx,i+1/2,j = bx,i+1/2,j − (Ei,j+1 − Ei,j )
∆y
∆t
byn+1
,i,j+1/2 = byn,i,j+1/2 + (Ei+1,j − Ei,j )
∆x
∇ · b n = 0 ⇒ ∇ · b n+1 = 0,
where (∇ · b)i,j :=
(bx,i+1/2,j − bx,i−1/2,j )/∆x +
(by ,i,j+1/2 − by ,i,j−1/2 )/∆y
Series Expansion Method
1 X X X
w̃k = [ ûp v̂q + ûp v̂q + ûp v̂q ] 6= N ŵk
N
k=p+q k+N=p+q k−N=p+q
N N Z
X dUn X dφn
(φn , φk ) +a Un φk = 0, for k = 1, ..., N
dt s dx
n=1 n=1