Properties of Numerical Methods
Properties of Numerical Methods
The following criteria are crucial to the performance of a numerical algorithm: 1. Consistency 2. Stability 3. Convergence 4. Conservation 5. Boundedness The discretization of a PDE should become exact as the mesh size tends to zero (truncation error should vanish) Numerical errors which are generated during the solution of discretized equations should not be magnied The numerical solution should approach the exact solution of the PDE and converge to it as the mesh size tends to zero Underlying conservation laws should be respected at the discrete level (articial sources/sinks are to be avoided) Quantities like densities, temperatures, concentrations etc. should remain nonnegative and free of spurious wiggles
These properties must be veried for each (component of the) numerical scheme
Consistency
Relationship: discretized equation dierential equation
Truncation errors should vanish as the mesh size and time step tend to zero Example. Pure convection equation CDS in space, FE in time: Taylor series expansions: un i 1 Hence, = un i x +
u n x i u t
+ v u x = 0 discretized by
un i
+ t
n i
u n t i
(t)2 2 3u x3 n i
2u t2
n i
+ ...
(x)2 2
2u x2 u t
(x)3 6 n i
+ ... where
+1 un un i i t
n un i+1 ui1 v 2x
+ v u x
+ = 0
n
t = 2
2u t2
n i
(x)2 v 6
3u x3
+ O[(t)2 , (x)4 ]
i
residual of the dierence scheme for the exact nodal values um j = u(j x, mt)
Stability
Relationship: numerical solution of discretized equations exact solution of discretized equations
Denition 1 Denition 2
Numerical errors (roundo due to nal precision of computers) should not be allowed to grow unboundedly The numerical solution itself should remain uniformly bounded
Stability analysis: can only be performed for a very limited range problems Matrix method: Aun+1 = Bun un+1 = Cun , where C = A1 B
is assumed to be a linear operator. In practice un = u n + en so that un+1 = Cun u n+1 = C u n en+1 = Cen for the numerical solution un of the discretized equations for the exact solution u n of the discretized equations for the roundo error en incurred in the solution process
i.e., the error evolves in the same way as the solution and is bounded by ||e|| ||C ||n ||e0 ||, ||C || (C ) = maxi |i | spectral radius of C
Unstable schemes: if (C ) > 1 then ||C || 1 and the errors may grow Example. Convection-diusion equation CDS in space, FE in time: or
+1 un = un i i
+1 un un i i t
u t
u + v u = d x x2 discretized by
n un i+1 ui1 v 2x
a=+
b = 1 2 c=
2
, m = m N
i2 = 1 = eim j
aj +1 + bj
(m)
+ cj 1 = m j
(m)
(m)
divide by j m = 1, . . . , N
(m)
m = 1 + 2 (cos m 1) + i2 sin m ,
pure diusion: = 0
|m | 1 if
conditionally stable
am (t)eikm x
Fourier series
lmax = 2L lmin = 2x
i2 = 1,
i.e. the error is a superposition of harmonics 2 characterized by their wave number km = l m (for wave length lm ) and amplitide am (t) Discretization x =
L N
0 x0
x xi1 xi xi+1
L xN x
km = m L =
m N x ,
m = km x = m N
Here m is the phase angle, m is the number of waves tted into the interval (L, L) and x determines the highest frequency resolvable on the mesh
en j =
m
im j an , me
where
0 n an m = an m
Due to linearity, the error satises the discretized equation and so does each n im j , m harmonic. Hence, it suces to check stability for en j = am e Amplication factor Gm
+1 an m = n = m am
Remark. The accuracy of approximation can be assessed by analyzing phase errors i.e. the actual speed of harmonics as compared to the exact speed
+1 n un un un j j j +1 uj 1 +v =0 t 2x
The resulting dierence equation for the error can be written as (an+1 an )eij + Divide by eij n i(j +1) a (e ei(j 1) ) = 0, 2 =v t x
n i i an+1 = an ) 2 a (e e
= 1 i sin
|G|2 = 1 + 2 sin2 1
+1 n un un un j j j u j 1 +v =0 t x
which yields
i sin
Stability restriction |G|2 1 means that G must lie within the unit circle in the complex plane. This leads to the CFL condition v>0 v<0 01
x v
for accuracy reasons it is desirable to have 1; some schemes are exact for = 1 (unit CFL property) 3. Let
u t
00000000000 11111111111 11111111111 00000000000 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111 00000000000 11111111111
+1 +1 n+1 un un un j j j +1 uj 1 +v =0 t 2x
G=
1 1+i sin
It follows that
= |G|2 = G G
1+ 2
1 sin2
unconditional stability
convection-diusion equation
2
Exact solution:
u(x, t) = eik(xvt)k
dt
= a(t)eikx ,
a(t) = eikvtk
dt
a wave with exponentially decaying amplitude traveling at constant speed Amplication factor |Gex | = e , Amplitude error Phase error = Gex =
a(tn+1 ) a(tn )
= e(+i)
= k 2 dt,
|Gnum | |Gex |
= |Gnum |e
arg(Gnum ) arg(Gnum ) = =v numerical dispersion = arg(G v ex ) arg(Gnum ) where v = k is the numerical propagation speed t Harmonics travel too fast if > 1 (leading phase error) and too slow in the case < 1 (lagging phase error)
Convergence
Relationship: numerical solution of discretized equations exact solution of the dierential equation
Denition: A numerical scheme is said to be convergent if it produces the exact solution of the underlying PDE in the limit h 0 and t 0 Lax equivalence theorem: stability + consistency = convergence
For practical purposes, convergence can be investigated numerically by comparing the results computed on a series of successively rened grids The rate of convergence is governed by the leading truncation error of the discretization scheme and can also be estimated numerically: u = uh + e(u)hp + . . . = u2h + e(u)(2h)p + . . . = u4h + e(u)(4h)p + . . . u2h uh e(u)hp (1 2p ) u4h u2h e(u)h (1 2 )2
p p p
log p
log 2
Conservation
Physical principles should apply at the discrete level: if mass, momentum and energy are conserved, they can only be distributed improperly Integral form of a generic conservation law u dV + t V accumulation f n dS =
S V
q dV,
f = v u d u ux function
inux
source/sink
Caution: nonconservative discretizations may produce reasonably looking results which are totally wrong (e.g. shocks moving with a wrong speed) even nonconservative schemes can be consistent and stable correct solutions are recovered in the limit of very ne grids Problem: it is usually unclear whether or not the mesh is suciently ne
Discrete conservation
1. Any nite volume scheme is conservative by construction both locally (for every single control volume) and globally (for the whole domain) 2. A nite dierence scheme is conservative if it can be written in the form
+1 fi+1/2 fi1/2 un un i i + =q t x
which is equivalent to a vertex-centered nite volume discretization 3. Any nite element scheme is conservative, at least globally
N
i 1,
i=1 V
uh + fh qh dV = 0, t
i = 1, . . . , N
+ fh qh dV = 0
uh dV +
f S h
n dS =
qh dV
Boundedness
Convection-dominated / hyperbolic PDEs P e 1, Re 1
spurious undershoots and overshoots occur in the vicinity of steep gradients quantities like densities, temperatures and concentrations become negative the method may become unstable or converge to a wrong weak solution
1 1
low-order
0.8 0.8 0.6 0.6
0.4
0.4
0.2
0.2
high-order
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Idea: make sure that important properties of the exact solution (monotonicity, positivity, nonincreasing total variation) are inherited by the numerical one
f x
=0
+1 un = H (un ; i) i
such that i
i, j
Then
n vi un i,
n+1 +1 vi un , i
+1 n un un un i u i 1 i i +v = 0, t x
Derivatives
H (un ;i) un i
= 1 ,
H (un ;i) un i1
t = v x
Lax-Wendro theorem: If a monotone consistent and conservative method converges, then it converges to a physically acceptable weak solution
(monotone if linear)
n un i ui+1 ,
i, n
T V (u) =
u x
dx
is a
nonincreasing function of time for any physically admissible weak solution Total variation diminishing methods T V (un+1 ) T V (un ), Classication monotone (monotone if linear) where TVD T V (un ) =
i n |un i u i 1 |
monotonicity-preserving
is total variation diminishing (TVD) provided that the coecients satisfy ci1/2 0, Semi-discrete problem ci+1/2 0,
dui dt
fi+1/2 fi1/2 x
Idea: switch between high- and low-order ux approximations depending on the local smoothness of the solution so as to enforce Hartens conditions:
L H fi+1/2 = fiL +1/2 + i+1/2 [fi+1/2 fi+1/2 ]
+ v u x = 0,
v > 0,
f = vu
Smoothness indicator
upwind dierence central dierence
ri =
u i u i 1 ui+1 ui
2+
(ri ) ri
(ri1 ) ,
ci+1/2 = 0 1D stencil
ui u i+1 u i1
Standard ux limiters:
(r) =
r +|r | 1+|r |
MC superbee
x i1 xi x i+1