lecture 2. finite difference (fd) methods conservation law: 1d linear differential equation:
DESCRIPTION
FD Methods One-sided backward Leapfrog One-sided forward Lax-Wendroff Lax-Friedrichs Beam-WarmingTRANSCRIPT
Lecture 2
Finite Difference (FD) Methods
Conservation Law:
1D Linear Differential Equation:
0)J(U
(t,x)
t(t,x)
0UU
x(t,x)a
t(t,x)
(t,x)a(t,x) UJ
FD Methods
One-sided backward Leapfrog
One-sided forward Lax-Wendroff
Lax-Friedrichs Beam-Warming
One-sided backward
Difference equation:
)(i,j(i,j)-AΔxΔt(i,j) - ,j)(i 1UUU1U
i
i+1
i-1
j-1 j j+1
time
stepping
One-sided forward
Difference equation:
(i,j))-(i,jAΔxΔt(i,j) - ,j)(i U1UU1U
i
i+1
i-1
j-1 j j+1
time
stepping
Lax-Friedrichs
Difference equation:
)(i,j)-(i,jAΔxΔt
- )(i,j)(i,j,j)(i
1U1U2
1U1U211U
Leapfrog
Difference equation:
)(i,j)-(i,jAΔxΔt
,j)(i,j)(i
1U1U2
1U1U
Lax-Wendroff
Difference equation:
)(i,j(i,j))-(i,jAΔxΔt
)(i,j)-(i,jAΔxΔt
(i,j),j)(i
1UU21U2
1U1U2
U1U
22
2
Beam-Warming
Difference equation:
)(i,j)(i,j(i,j)-AΔxΔt
)(i,j)(i,j(i,j)-AΔxΔt
(i,j),j)(i
2U1U2U2
2U1U43U2
U1U
22
2
Time stepping
1st order methods in time:U(i+1) = F{ U(i) }
2nd order methods in time:U(i+1) = F{ U(i) , U(i-1) }
Starting A) U(2) = F{ U(1) } ( e.g. One-Sided )
method: B) U(3) = F{ U(2) , U(1) } ( Leapfrog )
Convergence
- Analytical solution- Numerical solution
Error function:
Numerical convergence (Norm of the Error function):
(t,x)u(i,j)U
))(),(()UE jxitu(i,j(i,j)
0,0E x (i,j)
Norms
Norm for conservation laws:
Other Norms (e.g. spectral problems)
dxu(x,y) u(x,y) ||
N
j
E(i,j) E(i,j)1
1
2
12
N
j
E(i,j) E(i,j)
Numerical Stability
Courant, Friedrichs, Levy (CFL, Courant number)
Upwind schemes for discontinity:
a > 0 : One sided forward a < 0 : One sided backward
txaCFL max
Lax Equivalence TheoremFor a well-posed linear initial value problem, the
method is convergent if and only if it is stable.
Necessary and sufficient condition for consistent linear method
Well posed: solution exists, continuous, unique;
- numerical stability (t)- numerical convergence (xyz)
Discontinuous solutionsAdvection equation:
Initial condition:
Analytic solution:
0UU
x(t,x)a
t(t,x)
0001
)(U0 xx
x
atxxt 0U),(U
Analytic vs Numerical
x = 0.01
Analytic vs Numerical
x = 0.001
Nonlinear EquationsLinear conservation:
Nonlinear conservation:
0UU
x(t,x)a
t(t,x)
0)U(U
Fxt
(t,x)
)U(U Fxx
(t,x)a
Nonlinear FD methodsLax-Friedrichslinear stencil:
nonlinear stencil:
)(i,j)-(i,jaΔxΔt
)(i,j)(i,j,j)(i
1U1U2
1U1U211U
))(i,j))-F((i,jF(ΔxΔt
)(i,j)(i,j,j)(i
1U1U2
1U1U211U
Nonlinear FD methods
Lax-Wendroff
MacCormack’s two step method:
)(i,j(i,j))-(i,jAΔxΔt
)(i,j)-(i,jAΔxΔt
(i,j),j)(i
1UU21U2
1U1U2
U1U
22
2
)(j-F(j)FΔxΔt(j)(i,j),j)(i
(i,j)-F)(i,jFΔxΔt(i,j)(j)
1U()U(2
UU211U
,U()1(UUU
FD Methods
Methods to supress numerical instabilities
Numerical diffusion (first order methods)
2
2UUUx(t,x)D
x(t,x)a
t(t,x)
22
2a
txI
txD
Numerical dispersion
Lax-Wendroff (or second order methods)
Beam-Warming method
Iaxtax 2
2
22
6
3
3UUUx(t,x)
x(t,x)a
t(t,x)
22
22 326
axta
xtIax
Numerical dispersion
( a > 0 ) ( a < 0 )
Numerical dispersion
( a > 0 ) ( a < 0 )
Convergence
Lax-Friedrichs:
Convergence:
xtC (i,j) E
0,0E x (i,j)
FD Methods
+ / Primitive+ / Fast
- / Accuracy- / Numerical instabilities
end
www.tevza.org/home/course/modelling-II_2011