Professional Documents
Culture Documents
DISCRETIZATION SCHEMES
In this chapter we will revisit the three types of partial dierential equations, i.e. elliptic equations, parabolic equations and hyperbolic equations, and look at discretization
methods for the various types of equations. Although the revision of the three basic types
of equations is necessary to gain a basic knowledge in CFD, the three types play an important role in time-dependent incompressible Navier-Stokes equations. Incompressibility
and the pressure have an elliptic character, viscosity is modelled by a parabolic equation
and the convective terms are hyperbolic. The major problem in incompressible viscous
ows is to nd numerical methods which account for the various types. This course is
devoted to that exercise.
3.1
Elliptic schemes
Elliptic partial dierential equations consist of equations for which no real characteristic
directions exist, see Chapter 2. These equations were associated with problems in which
information travels innitely fast through the domain.
In this chapter we would like to consider three methods to discretize elliptic equations.
An introduction to panel methods has already been given in the course Aerodynamics-B
(AE2-110). For a more extensive treatment of panel methods one is referred to Chapter 4.
45
46
DISCRETIZATION SCHEMES
The nite dierence method employs Taylor series expansions to approximate the dierential equation under consideration, while the nite volume method utilizes the integral
form associated with the elliptic problem.
r~ 2 u = b
in
;
(3.1)
r~ 2u b w d
= 0 ;
(3.2)
in which w is a so-called test function. If u satises the Poisson equation (3.1) then
obviously this integral equation is satised for all w. However, if (3.2) is satised for all
w, then u must be a solution of the Poisson equation (3.1). Using partial integration (3.2)
can be re-written as
Z
@u @w
@x @x
@u @w
@y @y
bw d
+
@u
wd = 0 :
@n
(3.3)
@2w
u
+
u bw d
+
@x2
@y 2
@u
wd
@n
@w
d =0;
@n
(3.4)
47
or equivalently
Z n
~ 2w
u bw d
+
@u
wd
@n
@w
d =0:
@n
(3.5)
Now assume that the boundary has been split into 1 and 2 such that = 1 [ 2 and
1 \ 2 = ; and suppose that on 1 Dirichlet boundary conditions have been prescribed
and on 2 Neumann boundary conditions, i.e.
q=
u = u on
@u
= q on
@n
(3.6)
r~ 2 w u bw d
+
qw d +
qw d
@w
u d
1 @n
@w
d = 0 :(3.7)
@n
r~ 2u b w d
(q
q) w d
+
(u u)
@w
d =0:
@n
(3.8)
At rst sight this result might seem contradictory to (3.2) but in this equation it was
already assumed that u satised the prescribed boundary conditions. If (3.8) is satised
for all w the integrands of all three integrals have to vanish separately meaning that the
partial dierential equation is satised in the domain
and both boundary conditions
are satised on 1 and 2 .
For boundary integral methods equation (3.7) will be used. From now on, however,
we will use a very specic set of functions for w denoted as u , in which u satises the
equation
r~ 2 u + (x; y) = 0 ;
(3.9)
48
DISCRETIZATION SCHEMES
in which (x; y ) denotes the Dirac delta distribution1. The Dirac delta distribution is
dened as
Z
<2
(3.10)
for an arbitrary point (xa ; ya ) 2 <2 . A solution which satises (3.9) is called the fundamental solution. Inserting this particular solution in (3.7) using the fact that
Z
r~ 2u u d
=
(xi ; yi)u d
= u(xi ; yi ) ;
(3.11)
yields for b = 0
u(xi ; yi) +
uq d +
uq d =
qu d +
qu d :
(3.12)
u =
1
lnr ;
2
(3.13)
u =
1
:
4r
(3.14)
Aerodynamicists immediately recognize in these solutions the velocity potential for a sink
with unit strength. This serves also as motivation for the fact that in Chapter 3 of
Fundamentals of Aerodynamics, by John D. Anderson, Jr. the panel source panel method
was introduced. (See Aerodynamics-B, AE2-110).
We now proceed by taking the point (xi ; yi) in the Dirac delta distribution on the
boundary of the domain . This leads to the problem that some singular integrals have
1 Also
called the Dirac delta function. However this operator is the limit of functions, but is itself not
a function in the classical sense
49
to be evaluated. For convenience, we consider (3.12) before the boundary conditions have
been inserted, i.e. the equation
u(xi ; yi ) +
uq d =
u q d :
(3.15)
Suppose we assume that the boundary is a smooth line in two dimensions or a smooth
surface in three dimensions. Around the point (xi ; yi ) the surface integrals are slightly
changed as depicted in Fig 3.1 for the two dimensional case.
(xi,yi)
Figure 3.1: Small detour around the singular point (xi ; yi ) on panel i.
This small detour is denoted by . The contribution of this small change of
limit for ! 0 for for both surface integrals is given by (for two dimensions)
lim
!0
Z
qu d
1
=
lim
2 !0
Z
q ln d
= lim
!0
nq
ln = 0 :
in the
(3.16)
lim
x!1
ln x
=0:
x
(3.17)
So this integral evaluated near the singular point (xi ; yi) does not contribute to to the
boundary integral formulation. The second integral which must be checked in the vicinity
of the singular point (xi ; yi ) is
lim
!0
Z
uq d
= lim
!0
Z
1
u d
2
= lim
!0
o
1
= u(xi ; yi) :
2
2
(3.18)
50
DISCRETIZATION SCHEMES
The factor 1=2 which appears in this limit depends on the fact that the integral was
evaluated on a smooth part of the curve. If the limit for ! 0 had been taken for a point
positioned at a kink in the curve this value has to be altered.
So for a point (xi ; yi) on the boundary
1
u(x ; y ) +
2 i i
uq d =
qu d :
(3.19)
In the boundary integrals the singular points have already been accounted for. This
equation has to be set up for all points (xi ; yi ) on the boundary . The solution of the
boundary integral method is the function u which satises (3.19) for all point (xi ; yi ) 2 .
In order to do this analytically a solid background in both complex function theory and
linear analysis is required which is beyond the scope of this course. We therefore turn to
a numerical approximation of these integrals. The rst step in the approximation consists
of approximating the boundary by straight segments denoted by j and we furthermore
assume that u and q are constant over such segments. See Fig 3.2.
51
N
1 i X
u +
2
j =1
q d
uj =
N
X
j =1
u d
qj :
(3.20)
These N equations for the N unknowns, ui j 2 and q i j 1 , can be solved as soon as the
integrals for u and q have been evaluated. These integrals represent the in
uence of
panel j on the solution near panel i and are therefore called the in
uence coecients.
The integrals will be abbreviated by
H^ ij
q d
and
Gij
u d :
(3.21)
With this notation we can now write the linear system for the unknowns ui as
N
N
X
1 i X
u + H^ ij uj =
Gij q j :
2
j =1
j =1
(3.22)
H ij
H^ ij
when i 6= j ;
1
ij
^
H + 2 when i = j
(3.23)
leads to
N
X
j =1
H ij uj
N
X
j =1
Gij q j ;
(3.24)
or in matrix form
H ~u = G~q :
(3.25)
The matrices H and G are N N matrices, whereas the vectors ~u and ~q are vectors of
length N . Note that each panel in
uences every other panel which results in full matrices
H and G. So here we have N equations for 2N unkowns.
52
DISCRETIZATION SCHEMES
Now bear in mind that the boundary is made up of two disjunct portions 1 , where
u is prescribed and 2 , where q is prescribed. In the discrete case this means that N1
elements of the vector ~u are given on 1 and N2 values are given in the vector ~q, with,
obviously N1 + N2 = N . Splitting the matrices and vectors with respect to the unknowns
and the prescribed values leads to the system
A~x = f~ ;
(3.26)
in which
A = H 0 G0 ;
H b) (~ub + ~qb) :
(3.27)
ui
qu d
uq d ;
(3.28)
where the point at which ui is evaluated is not necessarily on the boundary. This leads
accordingly to its discrete analogue
ui
N
X
j =1
Gij q j
N
X
H^ ij uj ;
j =1
(3.29)
H^ ii =
q d =
@u @r
d =0;
@r @n
i
(3.30)
Gii
1
u d =
i
2
ln
1
d :
r
(3.31)
53
l
=
2
(3.32)
Gii
=
=
=
=
1
1 point2
1
1 point2
ln
d =
ln
dr
2 point1
r
controlpointi
r
Z
1 l
1
lim ln
d
2 !0
l=2
Z
1
1
1 l
ln
+ lim
ln
d
!0
2
l=2
1 l
1
ln
+1 :
2
l=2
(3.33)
54
DISCRETIZATION SCHEMES
@2u @2u
+
=0:
@x2 @y 2
(3.34)
ui,j
j=1
j=0
i=0 i=1 i=2
i=N
ui 1 = ui
ui = ui ;
2 The
@u x2 @ 2 u
x +
@x i
2 @x2 i
x3 @ 3 u x4 @ 4 u
5 ;
+
+
O
x
6 @x3 i
24 @x4 i
(3.35)
(3.36)
extension to more complex geometries and non-uniform meshes will be treated in chapter 7
55
@u x2 @ 2 u x3 @ 3 u x4 @ 4 u
+
+
+ O x5 :
ui+1 = ui + x +
2
3
4
@x i
2 @x i
6 @x i
24 @x i
(3.37)
Taking a linear 2combination of these three equations, such that the leading order term
in x is equal to @@xu2 yields
ui
2ui;j + ui+1;j
=
x2
1;j
@ 2 u x2 @ 4 u
4
:
2 + 12 @x4 + O (x )
@x
{z
}
|
Modied or equivalent dierential operator
(3.38)
This equation shows that if we would replace the second order derivative of u with respect
to x by the left hand side of (3.38) we would actually solve the modied or equivalent
dierential operator up to fourth order in x. However, by decreasing x, i.e. by
rening the mesh the second order term in x will become less in
uential, if the fourth
order derivative of u at (i; j ) is bounded!
For x ! 0 we would have
lim
x!0
ui
1;j
2ui;j + ui+1;j @ 2 u
= 2:
x2
@x
(3.39)
If this is the case for a discretization scheme, the scheme is called consistent.
Consistency is one of the major requirements for a numerical scheme, and, as it turns
out, the discrete approximation by (3.38) is consistent.
The leading order error that we make in approximating the second order derivative
by (3.38) is given by
x2 @ 4 u
:
12 @x4
(3.40)
This error is called the truncation error. We see that if we half x, the error becomes
four times smaller. This is due to term x2 in the truncation error. The method is
called second order accurate. For a general approximation with truncation error xp the
method is p-th order accurate.
A similar discretization can be obtained for the second order derivative with respect
to y yielding for the Laplace operator
ui
1;j
2ui;j + ui;j +1
=0:
y 2
(3.41)
56
DISCRETIZATION SCHEMES
The modied dierential equation is now given by
@ 2 u @ 2 u x2 @ 4 u y 2 @ 4 u
+
+
+
=0:
@x2 @u2 12 @x4 12 @y 4
(3.42)
j+1
-4
j-1
1
i-1
i+1
1;j
(3.43)
The coecients are usually depicted in the grid as shown in Fig. 3.5
57
test
r~ 2 u d
test =
@u
d
test @n
test
= 0 ; for each
test
:
test ,
(3.44)
then the solution must
j+1
test
test
j-1
i-1
i+1
@u
d
test @n
test
=0:
(3.45)
58
DISCRETIZATION SCHEMES
This boundary integral can be decomposed into four separate integrations over e , the
eastern boundary, n the northern boundary, w the western boundary and s , well ...
you probably already guessed what the 's' stands for.
The part over
Z
@u
d
@n
e
can approximated by
ui+1;j ui;j
d
x
e
y ui+1;jx ui;j :
(3.46)
@u
d
test @n
y
test
ui+1;j ui;j
u
u
+ x i;j +1 i;j
x
y
y
ui;j
ui
x
1;j
x
ui;j
ui;j
y
(3.47)
Although this might look like a new scheme division by the area of
test again gives
the well-known 5-point stencil (3.41).
By choosing dierent control volumes or dierent integration rules, dierent schemes
may be obtained, see Exercise 3.20
3.2
Parabolic schemes
Parabolic schemes stem from the same degeneration from which we obtained the elliptic
schemes as a limiting case of hyperbolic schemes with innite wave speeds, see Example 12.
The standard parabolic equation we are going to consider in this section is the so-called
heat equation, given by
@T
@t
@2T
=0:
@x2
(3.48)
This equation can be solved by the nite dierence method, in which the partial dierential
equation (3.48) is considered, or by the nite volume method which employs an equivalent
integral formulation. This equation contains a 'time-derivative' and we are going to spend
some time to consider the problem how well the numerical solution behaves in time. We
are going to do this for the partial dierential equation and the numerical scheme. This
analysis considers the problem of well-posedness and stbility. Let us consider the nite
dierence method rst.
59
Tin = Tin ;
Tin+1
(3.49)
Tin + t
@T n t2 @ 2 T n
+ O(t3 ) ;
+
2
@t i
2 @t i
(3.50)
and
Tin1
Tin
Taking a linear combination of these 4 grid values and choosing the coecients such that
the leading order term in t and x represents the dierential equation, i.e.
@T
@t
@2T
+ O (t; x) ;
@x2
(3.52)
60
DISCRETIZATION SCHEMES
yields
Tin+1 Tin
t
Tin 1
2Tin + Tin+1
=0:
x2
(3.53)
x2 @ 4 T
+ O t2 ; x4 ;
4
12 @x
(3.55)
x2 @ 4 T
+ O t2 ; x4 = 0 :
4
12 @x
(3.56)
The truncation error also shows that the discretization (3.53) is rst order in time due
to the appearance of the t in the truncation error and second order in space due to the
appearance of x2 in the truncation error.
@u
= P (x; t; u; @=@x)u + F (x; t) ; x 2 Rs ; 0 t T ;
@t
(3.57)
61
u(x; 0) = f (x) ; x 2 Rs :
(3.58)
@v
= P (x; t; v; @=@x)v + F + F ; x 2 Rs ; 0 t T ;
@t
(3.59)
v (x; 0) = f + f ; x 2 Rs :
(3.60)
We now require that the solution v to the perturbed problem is in the neighborhood of
the solution u of the original problem, i.e.
ku vk K fkF k + kf kg ; 0 t T :
For linear equations the perturbation in the solution, u = v
@u
= P (x; t; @=@x)u + F ; x 2 Rs ; 0 t T ;
@t
(3.61)
u, will satisfy
(3.62)
u(x; 0) = f ; x 2 Rs :
(3.63)
The desired estimate readily follows if we can show the following estimate for the original
problem
kuk K fkF k + kf kg ;
0tT :
(3.64)
(Note that in order to use such an estimate we rst have to chose a suitable norm.)
62
DISCRETIZATION SCHEMES
Suppose that the initial condition u(x; 0) can be represented by a Fourier mode as
follows
(3.65)
(3.66)
We now study the amplitude u^ of this Fourier mode in time. Note that we use Fourier
analysis since the Fourier transform converts partial derivatives in multiplications by ! .
Example 14
(3.67)
with solution
u^ = e
^a!t f^(! )
(3.68)
u(x; t) = e^!(x
!t) f^(! )
(3.69)
Note that the amplitude of the solution does not grow or decay.
Example 15
(3.70)
u(x; t) = e^!x
!2 t f^(! )
(3.71)
63
(3.72)
This solution grows exponentially fast as a function of the time t. Note that the higher
the frequency ! the faster the explosion of the solution.
These three examples demonstrate that every dierentiation with respect to x leads
to an aditional factor ^! in the equation for u^. This in turn eects the coecient of t in
the exponential. We can therefore state the following
Theorem 1
Consider
ut = P (@=@x)u ;
(3.73)
^ ^!x :
u(x; 0) = fe
(3.74)
(3.75)
The polynomial P (^! ) is called the Fourier symbol or brie
y the symbol of the dierential equation. In the discrete case we will shortly encounter the discrete analogue of the
symbol.
Sofar, we only considered one Fourier component. The idea is to rewrite general initial
conditions
u(x; 0) = f (x) ;
(3.76)
Z 1
^!x f (x) dx
(3.77)
64
DISCRETIZATION SCHEMES
such that
1
f (x) = p
2
Z 1
e^!x f^(! ) d! :
(3.78)
For each individual term e^!x f^(! ) we can establish the time evolution, so the integrated
result will be
1
u(x; t) = p
2
Z 1
(3.79)
If we are able to bound P (^! ) we can prevent unattenuated growth of the solution so
we have
Denition 1
(3.80)
Ket ;
(3.81)
for all t 0.
(3.82)
This is an equation of the form (3.64). Note that this denition of well-posedness allows
the solution to grow to innity for t ! 1, but on every bounded time interval the solution
remains bounded independent of ! .
A stronger requirement would be to state that the solution remains bounded at all
time. This requirement is called stability.
65
(3.83)
K; t0:
(3.84)
!0;
(3.85)
When
P (^!)t
e
for t ! 1 ;
Example 17
t =
0 @=@x
@=@x 0
;
(3.86)
gives
P (^! ) =
0 ^!
^! 0
(3.87)
with eigenvalues ^! , therefore jeP (^!)t j = 1. This means that the problem is neutrally
stable. (i.e. no growth and no decay).
Example 18
t =
0
@=@x
@=@x 0
;
(3.88)
leads to a P (^! ) having eigenvalues ! and therefore jeP (^!)t j = e!t , so this problem is
ill-posed.
66
DISCRETIZATION SCHEMES
Example 19
t = xx ;
(3.89)
P (^! ) = ! 2 =)
P (^!)t
e
=e
!2 t
(3.90)
This problem is well-posed if > 0 in which case the solution will be strongly stable. For
= 0 the problem will be neutrally stable and for > 0 the problem is unstable.
So far we have seen instances where we could bound the solution by the initial conditions, which is only part of the stability requirement of (3.64). Inhomogeneous linear
partial dierential equations can be converted to homogeneous linear dierential equations
with new 'initial conditions' using the Principle of Duhamel. Consider
@
@u
= P (x; t; )u + F (x; t) :
@t
@x
(3.91)
The question is now how to incorporate the inhomogeneous term F (x; t) in our wellposedness estimate? The trick is the following. Consider the auxiliary equation for
v (x; t; ) given by
@v
@
= P (x; t; )v ; t ;
@t
@x
(3.92)
v (x; ; ) = F (x; ) :
(3.93)
Then the solution to the inhomogeneous problem (3.91) with initial condition u(x; 0) = 0
is given by
u(x; t) =
Z t
0
v (x; t; ) d :
(3.94)
67
@u
= v (x; t; t) +
@t
= F (x; t) +
Z t
0
Z t
0
= F (x; t) + P
@v
(x; t; ) d
@t
Z t
0
v (x; t; ) d
= F (x; t) + P u(x; t)
(3.95)
When we want to solve for u(x; 0) = f (x) we can split the solution into two parts,
u = u1 + u2 where u1 satises the homogeneous dierential equation supplemented with
inhomogeneous initial conditions and u2 satises the inhomogeneous dierential equations
with homogeneous initial conditions.
Example 20
@
@u
= P ( )u + F (x; t) ; t 0 ;
@t
@x
(3.96)
u(x; 0) = f (x) :
(3.97)
Combining Duhamel's principle and Fourier analysis gives the solution (see Exercise ??.)
Z
1
1
v (x; t; ) = p
e^!x eP (^!)(t
2 1
= S (t )F :
) F^ d!
(3.98)
With this formal denition of the operator S the solution of the homogeneous problem u1
can be written as
u1 = S (t)f :
(3.99)
Superposition and Duhamel give the solution to the inhomogeneous problem with inhomogeneous initial conditions
u(x; t) = S (t)f +
Z t
0
S (t )F (x; ) d :
(3.100)
68
DISCRETIZATION SCHEMES
kS (t)f k Ket kf k ;
(3.101)
ku(; t)k
Ket
Z t
kf k +
kF (; )k d :
(3.102)
ku(; t)k KT kf k +
Z t
0
kF k d ;
0tT :
(3.103)
The ideas presented above only deal with well-posedness and stability of partial dierential equations. Similar criteria can be developed for the discrete analogue of a partial
dierential equation. This will concern the stability of the numerical scheme. Furthermore, we can consider the discrete scheme as perturbation of the the dierential equation,
this is essentially the issue of consistency. Suppose we have a numerical scheme such as
the discrete heat equation
Tin+1 Tin
t
Tin 1
2Tin + Tin+1
=0:
x
(3.104)
For this equations we can require similar conditions on the parameters as for the partial
dierential equation. So if we perturb this dierence equation with a small right-hand-side
and modify the the initial conditions slightly, the question is: will the numerical solution of
the perturbed problem be in the vicinity of the unperturbed problem, regardless whether
the numerical problem approximates the dierential equation or not. The way to establish
well-posedness or stability equals the procedure for the dierential equation. We insert
a Fourier mode, determine the symbol and require that the solution remains bounded.
Suppose that Tin is the solution of the dierence scheme (3.104) and T~in is the solution of
the perturbed dierence equation, then the dierence ni satises
ni +1 ni
t
ni 1
2ni + ni+1
= Fin ;
x2
(3.105)
69
0i = fi ;
(3.106)
If the boundary conditions are assumed to be periodic the error ni can be decomposed
as a Fourier series in space at time level n. In general this decomposition will lead to a
Fourier integral, but since only a nite number of waves can be represented on a grid, the
integral reduces to a nite Fourier sum, see Fig. 3.8.
Figure 3.8: High wavenumber waves are represented on a nite grid as low wavenumber
waves, taken from [9]
In the one dimensional domain of length L the complex Fourier representation re
ects
the region (0; L) onto the negative part ( L; 0), and the fundamental frequency corresponds to the maximum wave length of max = 2L. The associated wavenumber k = 2=
attains its minimum value kmin = =L. The maximum wavenumber, on the other hand is
associated with the smallest waves which can be represented on the mesh, which depends
on the smallest wave lengths which are resolvable. The shortest wave length is clearly
equal to min = 2x, see Fig. 3.9, and consequently kmax = =x.
70
DISCRETIZATION SCHEMES
Figure 3.9: Fourier representation of the error on the interval (-1,1), taken from [9]
Therefore with a mesh index i, ranging from 0 to N , with xi = i x and x = L=N
all the harmonics represented on the nite mesh are given by
; j = 0; : : : ; N ;
kj = jkmin = j = j
L
N x
(3.107)
with the maximum number j being associated with the maximum frequency. Hence with
kmax = =x the highest value of j is equal to the number of mesh intervals. The error
can therefore be written as
ni
jX
=N
j= N
where ^ =
jX
=N
j= N
Ejn e^ij=N ;
(3.108)
= kj x =
j
;
N
(3.109)
71
and covers the whole domain ( ; ) in steps of =N . The region around = 0 corresponds to the low frequency modes, whereas the region near = is associated with the
rapidly oscillating functions. In particular = corresponds to the highest frequency
representable on the mesh, namely with waves of wave length 2x.
Since we are dealing with linear schemes no interaction takes place between the various
harmonics, so in order to study the behaviour of the error it suces to analyze the
behaviour of just one particular wave, say Ejn exp(^i), just as we did for the partial
dierential equations. If we insert this mode into the dierence equation we obtained for
the heat equation we get
k n ^(i
E e
x2 j
1)
2e^i + e^(i+1) :
(3.110)
After division by exp(^i) and using the fact that exp(^) + exp( ^) = 2 cos we obtain
Ejn+1
Ejn +
2kt n
E (cos 1) = 0 :
x2 j
(3.111)
We now impose the following stability criterion on this wave: The amplitude Ejn is not
allowed to grow in time, i.e. the ratio
jGj =
E n+1
j
n
Ej
1 ; 8 :
(3.112)
So this requirement can be compared to neutral stability (jGj = 1) and absolute stability
(jGj < 1) considered for partial dierential equations.
The quantity G introduced here is called the amplication function and jGj is called
the amplication factor, and it is a function of the time step t, the mesh size x and
the physical parameter k. The condition (3.112) applied to the heat equation gives
G=1+
2kt
(cos
x2
1) :
(3.113)
4k
x2
G1;
(3.114)
72
DISCRETIZATION SCHEMES
4kt
x2
1 =) t
x2
:
2k
(3.115)
So we see that the scheme will be stable if the time step satises (3.115). Therefore the
scheme is called conditionally stable.
The stability based on the decomposition of the error in Fourier modes is called the
Von Neumann stability analysis. Note that the assumption was made that the boundary
conditions were periodic. Although this will not be the case in general, the Von Neumann
stability analysis gives a rather good criterion for stability.
The3 Von Neumann stability analysis mimicks the stability analysis we have given
before for partial dierential equations. The reason we used Fourier analysis was to
convert a partial dierential equation to an ordinary dierential equation. However, in
the dierence equation we don't have partial derivatives, so we have another way of
assessing the stability of the scheme.
Consider the semi-discrete system given by
@ T~
= AT~ + F~ ;
@t
(3.116)
m I ) ~xm = 0 ; m = 0; : : : ; N :
(3.117)
(3.118)
X
3 The
~
=X
@t
1 @T
AXX
| {z
I
1~
}T
to obtain
+ X 1 F~ :
following part is taken from the lecture notes by dr. S.J. Hulsho
(3.119)
73
w~ = X
T;
~ = X 1 F~ ;
G
(3.120)
(3.121)
@ w~
~;
= w~ + G
@t
(3.122)
w_ m = m wm + Gm ; m = 0; 1; : : : ; N :
(3.123)
or
~
G
if m 6= 0 :
m
(3.124)
T~ (t) =
N
X
m=0
Cm em t~xm + X
1F
~
(3.125)
Where the Cm 's are constant determined by the initial conditions. The homogeneous
solution, given by the summation term, represents the time-dependent or transient portion
of T~ . The particular solution, which is equivalent to A 1 F~ , represents the nal steady
state solution which is achieved for eigensystems with negative real part. Note that the
conversion to (3.125) is only possible when the matrix A is diagonizable. When we have
Jordan blocks, things are slightly more complicated, but the ultimate conclusion remains
the same. Although the long term bahaviour for non-diagonizable matrices is the same
as for diagonizable, the initial solution may start to grow, see Exrcise 15.
74
DISCRETIZATION SCHEMES
@u @u
@~u
c
+ c = 0 =)
=
@t
@x
@t
2x
B
B
B
B
B
B
@
0
1
1
0 1
1 0 1
1
0
1
C
C
C
C~
Cu :
C
A
(3.126)
While for the heat equation with periodic boundary conditions we have
0
@2T
@T
=k 2
@t
@x
@ T~
=
@t
=)
B
B
k B
B
x2 B
B
@
2
1
1
2
1
1
2 1
2
1
1
2
1
C
C
C
C T~
C
C
A
(3.127)
In both cases, the matrices A of the discretizations are examples of circulent matrices of
the form
2
6
6
4
b0
b3
b2
b1
b1
b0
b3
b2
b2
b1
b0
b3
b3
b2
b1
b0
3
7
7
5
(3.128)
(3.129)
m =
N
X
j =0
bj e^(2jm=(N +1)) :
(3.130)
75
m =
^c
sin ; m = 0; : : : ; N ;
x
(3.131)
where
2m
;
N +1
(3.132)
while for the central discretization of the linear heat equation we have
m =
2k
(cos
x2
1) :
(3.133)
The eigenvalues for the two semi-discrete systems appear plotted in the complex plane
in Figure 3.10. Inspection of the expression for the general solution (3.125) reveals that
the solution generated by both discretizations behaves in a manner similar to the solutions of the partial dierential equations which they try to approximate (see for example
Exarcise 16 and 17). In the case of the linear heat equation, the negative real part of
of results in a transient solution which decays in time, mimicking the exact diusion
process. In contrast, the pure imaginary 's of the linear convection discretization will
result in the unattenuated propagation of the initial conditions, which also occurs in the
exact solution of the PDE.
In general, the solution to the semi-discrete system need not behave in manner analogous to the exact solution. Consider for example the upwind discretization of the linear
convection equation
@ui
c
=
(u
@t
x i
ui 1 ) ;
(3.134)
m =
c
(cos
x
1 + ^ sin ) ;
(3.135)
@ui
c
=
(u
@t
x i+1
ui ) ;
(3.136)
76
DISCRETIZATION SCHEMES
m =
c
(cos
x
1 + ^ sin ) :
(3.137)
The eigenvalues of both discretizations (multiplied by x=c) appear plotted in Fig. 3.11.
As the eigenvalues of the upwind discretization include both imaginary and negative real
parts, the exact semi-discrete solution will result in an unphysical decay of the initial
conditions as it is propagated. A more striking example is given by the downwind discertization, whose exact semi-discrete solutions will amplify in time without bound. It is
interesting to note that the unbounded downwind discretization is also distateful from a
physical point of view, as it does not respect the characteristic directions of information
propagation present in the original partial dierential equation. Although it is tempting
to view downwind discretizations as always leading to unstable numerical methods, the
prognosis is incomplete without considering the approximate method used for advancing
the semi-discrete system in time.
In a manner similar to the semi-discrete system, many of the properties of the fully
discrete system are described by the eigenvalues of the fully discrete matrix C . It is
the application of the time-march method which establishes a relationship between the
eigenvalues of C and those of the semi-discrete matrix A. For example, consider the
77
(3.138)
m I ) ~ym = 0 ; m = 0; : : : ; N ;
(3.139)
or
(1 m ) I + tX
AX ~ym = 0 ;
(3.140)
form which
m = 1 + m t :
(3.141)
78
DISCRETIZATION SCHEMES
The systems (3.116) and (3.122) provide equivalent representations of the semi-discrete
system, in terms of two groups of variables related to eachother by a linear transformation.
The solution of the fully discrete system derived through the application of the time march
can also be equivalently determined using either sets of variables. We therefore consider
a single equation form the decoupled system (3.122)
@w
= w + G :
@t
(3.142)
In general, the application of the time march method will produce a fully discrete equation
of the form
wn+1 = wn + k :
(3.143)
(3.144)
which describes the same relation between and as found from the decoupled system.
In general, it is easiest to derive the relation by considering the time march applied
to a single equation from the decoupled system.
In general the solution of (3.143) may be expressed as
wn = C n +
(3.145)
wn = w0 n + k
1 n
:
1
(3.146)
wn = C (1 + t)n +
Gt
:
t
(3.147)
Note that if we have a good approximation of the eigenvalues of the spatial operator, , we
have a good approximation of the steady state solution, irrespective of the time-marching
79
method used (as long as the time stepping scheme is absolutely stable). In the rare case
where we have the exact eigenvalues of the spatial operator, the steady state solution will
be exact. This fact allows us to use cheap lower order accurate time stepping methods to
reach the nal steady state. Form this equation we also see that if we want the transients
to remain bounded the modulus of j1 + tj should be less or equal to 1. If we apply this
to the heat equation for which the eigenvalues of the semi-discrete system were given by
m =
2k
(cos
x2
1) ;
(3.148)
we obtain
11+
2kt
(cos
x2
1) 1 :
(3.149)
x2
;
2k
(3.150)
which is in agreement with the stability limit obtained by the application of the Von
Neumann stability analysis.
In order to test the stability requirement for the heat equation Fig. 3.12 displays the
solution of the heat equation for t = x2 =2k after 0, 50, 100, 200, 500, 1000, 2000 and
5000 timesteps. We see that the initial solution decays and spreads out, exactly as we
expect.
If we increase the time step a little bit, for instance if we take t = 1:2x2 =2k, small
perturbation will grow exponentially fast. Note that no perturbations have been added to
the initial solution. The perturbations are generated from rounding-o errors. Fig. 3.13
displays the solution after 30, 35, 40 and 45 time steps.
ordinary dierential equations and fully discrete equations. Stability analysis of a discrete
scheme requires that the discrete solution of perturbed dierence scheme remains in the
vicinity of the solution of the unperturbed dierence scheme in a similar vein as we did
for partial dierential equations. Note that the numerical approximation itself can be
considered as a perturbation to the dierential equation. In this case not only the forcing
term and the initial conditions are perturbed (by numerical approximation), but the
dierential operator itself is perturbed.
80
DISCRETIZATION SCHEMES
5
10
20
Figure 3.12: The solution of the heat equation at various time levels using the maximum
allowable time step based on linear stability analysis
Note 3 We started this discussion with well-posedness and the fact that the solu-
tion should depend continuously on the data. This is a reasonable starting point. What
would the world be like, if a small change in the boundary conditions would lead to a
totally dierent answer? This would prohibit the comparison between experiment and
calculation, because in experiments always small perturbations are present and in calculations rounding-o error provide the small perturbations. However, there are physical
phenomena where a small change in the data does lead to a completely dierent solution.
A well-known example is transition. Just below a certain Reynolds number the
ow is
nicely laminar, whereas slightly above the critical Reynolds number the
ow eld changes
dramatically. This small change in Reynolds number plays the role of `a small change
in the data'. It is one of todays challenges to develop numerical schemes and analytical
tools to capture these phenomena as well. So well-posedness precludes very interesting
physical phenomena.
81
4
2
1
1
0
0
0
10
20
10
20
4
10
3
5
0
-5
-1
-10
-2
-3
10
20
10
20
Figure 3.13: Numerical solution of the heat equation 1.2 times the maximum allowable
time step based on linear stability analysis. Solution after 30 time steps (upper left),
solution after 35 time steps (upper right), solution after 40 time steps (lower left) and
solution after 45 time steps (lower right).
@T
@t
@2T
=0;
@x2
(3.151)
is equivalent to
Z t2 Z x2
@T
t1
x1
@t
@2T
k 2
@x
dxdt = 0 ;
8t1 ; t2 > 0
and x1 ; x2 2 < :
(3.152)
82
DISCRETIZATION SCHEMES
Now consider the the control volume in space-time shown in Fig. 3.14 We are going to
n+1
test
test
n-1
i-1
i+1
(i 12 )x
@2T
k 2 dxdt =
@x
@T
@t
Z tn+1
tn
@T ((i + 12 )x; t)
k
@x
Z (i 1 )x
2
@T ((i
(i 21 )x
1
2 )x; t)
@x
(3.153)
dt :
Now we need to approximate the remaining integrals. We will use the so-called mid-point
rule to do so. The mid-point rule is given by
Z b
a
a+b
(b a) :
f (x) dx f
2
(3.154)
Tin
@T n+ 2
t k
@x i+ 12
1!
@T n+ 2
=0:
k
@x i 12
(3.155)
83
Now we need to approximate the gradients of T at time level n + 21 . One possibility would
be to set
@T n+ 2
k
@x i+ 12
@T n
k
@x i+ 21
Tin+1 Tin
k x :
(3.156)
This would yield the same dierence equation as obtained for the nite dierence method.
The conrmation of this claim is left as an exercise.
Alternatively we can approximate the gradient by
@T n+ 2
k
@x i+ 12
1 @T n
@T n+1
k +k
2
@x i+ 21
@x i+ 21
(3.157)
in which
@T n
k
@x i+ 12
k Ti+1x Ti :
(3.158)
Tin+1
Tin x
kt 1 n+1
T
x 2 i 1
2Tin+1 + Tin+1+1 +
1 n
T
2 i 1
2Tin + Tin+1
= 0 :(3.159)
This is an implicit scheme for the heat equation and one has to solve a tridiagonal
system to obtain T at time level n + 1.
Example 21
E n+1
E n x
kt n+1
E (cos 1) + E n (cos 1) = 0 ;
x
(3.160)
84
DISCRETIZATION SCHEMES
or
kt
n+1 = 1 + k t (cos 1) E n :
(cos
1)
E
x2
x2
(3.161)
And therefore
G=
(3.162)
kt
> 0 =) k > 0 :
x2
(3.163)
If this is the case the scheme is stable for all x and t and therefore the scheme is
called unconditionally stable. The restriction k > 0 is not a real restriction, because the
partial dierential equation would become unstable if k < 0 as we have seen earlier. See
also Exercise 7.
In this section the nite dierence method and the nite volume method for a sample
parabolic equation have been treated. An important new concept that was introduced
was the concept of stability. We already had the concept of consistency of the discrete
scheme. These two requirements for a scheme lead to an important theorem. Alternative
ways to discretize the heat equation will be treated in Exercise 8 and 9.
Theorem 2
Lax Theorem
For a well-posed initial value problem and a consistent disretization scheme, stability
is a necessary and sucient condition for convergence.
The same concepts will play a role in the next section where hyperbolic schemes will
be discussed.
85
Hyperbolic schemes
The last type of equations to be considered are of hyperbolic type. Just like in the
previous two sections we will rst consider the direct discretization of the dierential
form by means of the nite dierence method. This approach will be followed by the
nite volume method.
In this section we consider the hyperbolic equation
@u
@u
+a =0:
@t
@x
(3.164)
This equation has to be supplemented with initial conditions and boundary conditions (if
we consider a nite spatial domain). If we consider an innite spatial domain and impose
the initial condition
u(x; 0) = f (x) ;
the solution is given by
u(x; t) = f (x at) :
(3.165)
The solution is constant along the characteristic as was already established in Chapter 2.
Although this specic hyperbolic equation might seem it bit arbitrary, it is in fact
a rather generic equation. We have seen in Chapter 2, Example 2.30, that a system of
hyperbolic equations can be written in diagonal form in which equation has the form
(3.164).
In contrast to the elliptic and parabolic equations the nite speed with which information is carried through the computational domain and particularly the direction in
which the information is passed will play a dominant role in the numerical approach to
hyperbolic equations. As in the previous two section we will start with nite dierence
method.
86
DISCRETIZATION SCHEMES
point uni and its two neighborig points. A Taylor series expansion of these two neighboring
points gives
ui 1 = ui
@u x2 @ 2 u
x +
@x i
2 @x2 i
x3 @ 3 u
+ O x4 ;
3
6 @x i
ui = ui ;
@u x2 @ 2 u x3 @ 3 u
+
+ O x4 :
ui+1 = ui + x +
2
3
@x i
2 @x i
6 @x i
ui 1 + ui +
ui+1 ( + +
)ui + (
x2 @ 2 u
( +
)
+ (
2 @x2 i
@u
)x +
@x i
x3 @ 3 u
x4 @ 4 u
5 :
)
+
(
+
)
+
O
x
6 @x3 i
24 @x4 i
(3.166)
++
=0
x +
x = 1
(3.167)
(3.168)
This yields
@u (1 x)ui+1 + 2 xui
@x i
2x
(1 + x)ui
(3.169)
We see that in contrast to the elliptic and parabolic equation we have an additional
parameter to play with. For = 0 the approximation to the rst order derivative
becomes second order accurate.
87
Of course we do not have to restrict ourselves to the value ui and its direct neighbors,
see Exercise ??.
Time discretisation For the time discretization we will use the points uni and uni +1 just
like we did for the parabolic equation. Expanding uni +1 in terms of uni and its derivatives
gives
@u n uni +1 uni
t :
@t i
(3.170)
un
un
uni +1 uni
+ a i+1 i 1 = 0 :
t
2x
(3.171)
This is an explicit nite dierence scheme, because the new value uni +1 can be expressed
directly in terms of the known values from the previous time level. No linear system of
equations needs to be solved. In order to assess convergence of this scheme we have to
check whether the scheme is consistent and stable.
Consistency Using the Taylor series expansions we see that (3.171) approximates the
equation
@u
@u t @ 2 u
x2 @ 3 u
+a +
+
a
+ O(t2 ; x4 ) :
2
3
@t
@x 2 @t
6 @x
(3.172)
This equation is called the equivalent dierential equation (also called the modied
dierential equation). This is the equation we are approximating even better than the
one we started out to approximate initially. The additional terms
T =
t @ 2 u
x2 @ 3 u
+
a
+ O(t2 ; x4 ) :
2 @t2
6 @x3
(3.173)
are called the truncation error. Consistency now requires that the truncation error
tends to zero for t and x tending to zero. From (3.173) we see T ! 0 if both
88
DISCRETIZATION SCHEMES
t; x ! 0, provided utt and uxx remain bounded! The order of the scheme is given by
the leading order terms in the truncation error, so the FTCS scheme is order O(t; x2 ).
e^(j
1)
=0;
(3.174)
E n+1
E n + E n 2^ sin = 0 ;
2
(3.175)
=
at
;
x
(3.176)
jGj
by
n+1
E
En
1
for all :
(3.177)
The quantity G is called the amplication function. For the FTCS-scheme G is given
G = 1 ^ sin :
(3.178)
So
jGj2 = 1 + 2 sin2 ;
(3.179)
89
and therefore the scheme is unconditionally unstable. Nearly all error modes will grow
in time. There are exactly two modes which are stable. Which modes?
The rather disappointing conclusion is that the FTCS scheme is not convergent. This
could already be seen from the equivalent dierential equation (3.172). Using the fact
that the exact solution satises ut + aux = 0 we can convert the leading order error in t
in an spatial error
t @ 2 u a2 t @ 2 u
=
;
2 @t2
2 @x2
(3.180)
and we therefore approximate up to order O(t2 ; x2 ) the modied dierential equation
@u
@u
+a =
@t
@x
a2 t @ 2 u
:
2
| 2{z @x }
negative diusion
(3.181)
This is a convection-diusion equation with a negative diusion coecient ( a2 t2 =2)
and we have seen in Chapter 2 that the diusion equation with negative coecient blows
up in time. So the explicit rst order approximation in time results in an unstable scheme.
Let us therefore change this approximation in order to remove this deciency.
uni +1 uni
2t
uni+1 uni 1
+a
=0:
2x
(3.182)
This scheme is consistent and marginally stable, see Exercise 11, if j j = jat=xj 1.
Marginally stable means that the amplication factor is equal to 1 for all t and x.
For non-linear problems this is often to strict. Another disadvantage is that the leapfrog
scheme is that it requires two time levels to start the time integration ("The method is
not self-starting"), so in addition to the solution u(x; 0) = f (x) at t = 0 we also need
4 Leapfrog:
in Dutch "bokjespringen"
90
DISCRETIZATION SCHEMES
= sign(a)=x
then the following discretisation for @u=@x is obtained
@u
@x
8 ui ui 1
<
x
if a > 0
ui+1 ui
x
if a < 0
:
(3.183)
uni +1 = uni
uni
uni 1 :
(3.184)
91
G = 1 2 sin2
2
^ sin ;
(3.185)
1) on the
01:
(3.186)
The scheme is therefore conditionally stable. The limitation on the time step for a given
spatial step x is given by
0 t
x
:
a
(3.187)
Note that this restriction is less severe than the stability condition for the explicit scheme
for the heat equation, see the previous section. For negative wave speeds the scheme
(3.184) becomes unstable.
The requirement that 0 1 can be geometrically interpreted as follows:
Characteristic dx/dt=a
n+1
a t
i-1
i+1
92
DISCRETIZATION SCHEMES
T =
@2u
ax
(1 ) 2 ; ;
2
@x
(3.188)
showing that the scheme is only rst order accuarte in space and time and that the
equivalent equation has a dissipative term with a numerical viscosity coecient ax(1
)=2. So whereas the exact solution transports the initial solution unaltered through the
domain with velocity a, this scheme damps the solution (if 6= 1) untill after a long
time the initial prole is completely lost. This phenomenon is shown in Figs. 3.16 and
3.17. In Fig. 3.16 = 1 and the initial signal is transported undisturbed through the
computational domain. Fig. 3.17 is the numerical solution obtained by taking = 0:5. In
this case the amplitude of the discrete solution decays as result of the numerical diusion
and the initial solution is smeared out.
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
10
20
Figure 3.16: Upwind discetization of the linear convection equation with = 1:0
Another way to see that the upwind scheme introduce articial diusion is to rewrite
93
uni +1 uni uni uni 1 uni +1 uni uni+1 uni 1 ax uni+1 2uni + uni 1
+a
=
+a
= 0 :(3.189)
t
x
t
2x
2
x2
So essentially we are solving the original unstable FTCS scheme with a diusion term
with diusion coecient ax=2. Since this added diusion is a result of the numerical
scheme and depends on the numerical parameters, in this case x, it is called articial
diusion or numerical diusion. As already mentioned this numerical diusion damps
the original solution in the case where there is no physical diusion present. But even
if physical diusion is present such as is the case in the Navier-Stokes equations one has
to make sure that the articial diusion does not dominate the physical diusion, since
this would lead to erronous conclusions. A well-known case would be to solve the NavierStokes equations at a Reynolds number of 106 , but due to the numerical diusion we are
only modelling a
ow with Reynolds number of 50. This is one of the major drawbacks
of upwind schemes. To list just a few
The low accuracy of the scheme, only rst order in space and time;
The addition of false diusion to the system, and
The need to nd the proper directions of the wave speeds
Example 22
@2
@t2
c2
@2
=0:
@x2
(3.190)
@u
@t
c2
@v
@t
@v
=0
@x
(3.191)
@u
=0
@x
Multiplying this systen with the matrix L whose rows consist of the left eigenvectors
L=
1
1
c
c
(3.192)
94
DISCRETIZATION SCHEMES
1
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
10
20
Figure 3.17: Upwind discetization of the linear convection equation with = 0:5
gives
@
@
(u + cv ) c (u + cv ) = 0
@t
@x
(3.193)
@
@
(u cv ) + c (u cv ) = 0
@t
@x
We see, yet again, that the equations for u + cv and u cv are completely decoupled and we
can treat them as separate convection equations with characteristic speeds c, respectively.
Applying the rst order upwind scheme to these two equations gives, assuming c > 0
cvin+1
t
cvin
uni + cvin
c
+c
cvin
cvin
uni 1 + cvin 1
x
=0
(3.194)
=0
95
uni +1 uni
t
vin+1
t
vin
uni+1
c
vin+1
2uni + uni 1
2x
2uni + uni 1
2x
vin+1
2
c
vin 1
=0
2x
uni+1
uni 1
2x
(3.195)
=0
I leave it to the reader to show that this scheme is indeed consistent, stable and rst order
accurate in time and space. See also Exercise 19.
This example shows how to apply the upwind scheme to rst order systems. The need to
rst diagonalize the system, then to apply upwinding and to nally rewrite everything in
the original unknowns may be cumbersome, especially when one deals with large system
or system where the velocity c is determined by the solution, in which you don't know in
advance how to discretize the system, see also Exercise 13.
If c = 0 the viscosity term is completely lost. For problems occuring in gas dynamics
this will be the case at stagnation points and at sonic points. For negative propagation
speeds c < 0, the following one sided scheme is stable
uni +1 = uni
(uni+1
uni ) :
(3.196)
G = 1 + 2 sin2
2
^ ;
(3.197)
(3.198)
The reason these schemes are called upwind schemes stems from the fact that the
discretization depends on the direction of the
ow and only points upwind or upstream
of the point considered are taken in consideration.
This has an immediate eect on the number and type of boundary conditions which
can or must be prescribed. For the scheme the scheme (3.184) we need to prescribe a
value at point i = 0 when we want to discretize at the point i = 1. Similarly, when using
(3.196) in the point i = N 1 the value unN should be prescribed. This is in agreement
with the physical situation.
96
DISCRETIZATION SCHEMES
uni +1 = uni
n
u
2 i+1
uni 1 ;
(3.199)
is to replace the rst occurance of uni in this scheme by the average of the two neighboring
points (uni+1 + uni 1 )=2 which leads to the scheme
uni +1 =
n
u
2 i+1
1 n
ui+1 + uni 1
2
uni 1 :
(3.200)
I personally think this is a very elegant solution, because the scheme turns out the be
stable for 1 1. Apply the Von Neumann analysis to establish this fact! But
the question remains, how can this `small' modication stabalize the scheme? In order to
analyze this let us write the Lax-Friedrichs scheme in a more conventional form
uni +1 = uni
n
u
2 i+1
(3.201)
1 n
u
2 i+1
uni + uni 1 =
(3.202)
so what we essentially have done by replacing uni by the average of its two neighboring
points is to introduce articial diusion to the system just like we have done for the
upwind scheme. An advantage, however, is that we don't have to make a distinction
between the sign of the waves. Especially for systems of hyperbolic rst order equations
this circumvents the necessity to diagonalize the system rst, to nd the proper wave
directions. The articial diusion coecient is given by x2 =(2t) as can be seen from
(3.202).
uni +1 = uni + t
@u t2 @ 2 u
+
+ O(t3 ) :
@t
2 @t2
(3.203)
97
uni +1 = uni
at
@u a2 t2 @ 2 u
+
+ O(t3 ) :
@x
2 @x2
(3.204)
uni +1
= uni
(3.205)
This scheme is called the Lax-Wendro scheme. Note that this scheme also adds an
amount of numerical dissipation to the scheme to stabilize it. This scheme is second order
accurate both in space and time.
The Lax-wendro scheme given above is called the one-step Lax-Wendro scheme,
beacuse the new value uni +1 is obtained in one step. An alternative form is the following
+1=2
Step 1: uni+1
=2 =
1 n
at n
ui+1 + uni +
u
2
2x i+1
at n+1
u
x i+1=2
(3.207)
This is just one way of decomposing the Lax-Wendro scheme into two steps and it is
called the Richtmyer scheme. These methods have been developed in the mid 1960's and
are currently being re-invented in the nite element world.
Although the two-step scheme given above is equivalent to the one-step Lax-Wendro
method, dierences will be introduced if these schemes are applied to non-linear PDE's.
@u
dx + a (u(x2 ) u(x1 )) = 0 :
@t
(3.208)
98
DISCRETIZATION SCHEMES
@
@t
Z x2
x1
u dx = au(x1 ) au(x2 ) :
(3.209)
u =
jx2 x1 j
Z x2
x1
u dx :
(3.210)
(f (x2 )
f (x1 )) ;
(3.211)
in which f denotes the
ux function (see Chapter 1) which in this specic example is
equal to f = au.
At this stage still no numerical approximation has been applied. The rst approximation we will introduce is to assume that the solution u is constant over the interval under
consideration. If for the intevals we choose [xi 1=2 ; xi+1=2 ] centered around the mesh point
xi we get the approximate solution as shown in Fig. 3.18.
u
uni+1
uni+2
uni
uni-1
uni-2
i-2
i-1
i-3/2
i+1
i
i-1/2
i+1/2
i+2
i+3/2
99
@ ui
=
@t
f (xi+1=2 ) f (xi
1=2 )
1=2 ; xi+1=2 ].
(3.212)
If we now integrate this with respect to time form t = nt to (n + 1)t we obtain
uni +1
uni
t ^
=
f (xi+1=2 ) f^(xi
x
1=2 )
(3.213)
where f^ denotes the time average of the physical
ux over the time interval [nt; (n+1)t].
So far we have only assumed that the solution is piecewise constant in the cells, but apart
from this assumption (3.213) is still exact. Since u is constant in each cell ui ui .
What we have to do now is to advance the solution in time. After t seconds the
exact solution will look like the one shown in Fig. 3.19. The next step is to calculate the
a t
a t
a t
a t
uni+1
uni+2
uni
uni-1
n
ui-2
i-2
i-1
i-3/2
i+1
i
i-1/2
i+1/2
i+2
i+3/2
uni +1 =
at n
u
x i
uni 1 :
(3.214)
100
DISCRETIZATION SCHEMES
So this more physical approach of exactly convecting the piecewise constant solution and
averaging leads to the familiar rst order upwind scheme.
In general this procedure is not possible, therefore we are going to introduce a numerical
ux function.
This
ux function will in general depend on all the nearby values ui, so if f~ denotes
the numerical
ux
(3.215)
uni +1
uni =
t ~
f
x i+1=2
f~i
1=2
(3.216)
As can be seen from Fig. 3.18 the value of the
ux at the interfaces of the cells is
multi-valued. A reasonable choice therefore seems
a
f~i+1=2 = (ui + ui+1 ) :
2
(3.217)
Inserting this in (3.216) leads to the FTCS scheme which proved to be unconditionally
unstable.
However, just after the solution has started to change with respect to time, it is the
situation as sketched between Fig. 3.18 and 3.19 the physical
ux is given by f^i+1=2 = aui
and therefore it makes sense to use as numerical
ux
f~i+1=2 = aui :
(3.218)
Inserting this in (3.216) gives the rst order upwind scheme. Note that if a < 0 all the
plateaus in Fig. 3.19 would have been shifted to the left and dening f~i+1=2 = aui+1 would
seem the natural procedure.
Numerical modelling in terms of the nite volume method can be rened by chosing
better approximations of f~ to f^ and to use a higher order polynomial with the cell, instead
of the constant values that were used in this example.
For the linear case considered here is, it was rather easy to deduce how the step
function at the interface would evolve in time. For non-linear hyperbolic problems, such
3.4. OVERVIEW
101
as the Euler equations, the time dependent solution resulting from a step in the initial
conditions gives rise to the so-called Riemann problem. This problem will be treated in
the course Gas Dynamics (AE4-140 and AE4-141).
The numerical schemes based on solving the Riemann problem or an approximate
Riemann problem will be discussed in the course Numerical Methods in Aerodynamics,
part II (AE4-152).
3.4
Overview
This chapter addressed the numerical treatment of the various types of dierential equations. Boundary integral methods, nite dierence methods and nite volume methods
have been considered. For time-dependent problems the issue of stability has been extensively treated, both for partial dierential equations and dierence equations. This
chapter now concludes with a few exercises in which you have to apply the ideas treated
in this chapter.
3.5
Exercises
Exercise 6
@2u @2u
+
= 0 ; (x; y ) 2 [0; 1] [0; 1] :
@x2 @y 2
This equation is solved using a nite volume method in which the control volumes are
chosen around the point (i; j ) as shown in Fig. ??
a Assuming x = y and using the midpoint integration rule determine the FV
discretization.
b What is the order of the scheme obtained.
c Chose a global node numbering in the mesh and determine the the shape of the
resulting matrix.
d Using the FV scheme as described above. How would one incorporate a prescribed
boundary condition at the left boundary, i.e. for i = 0.
102
DISCRETIZATION SCHEMES
j+1
test
test
y
j-1
x
i-1
i+1
Exercise 7
@T
@t
@2T
=0:
@x2
1<x<1; t>0:
(3.219)
Tin+1 Tin
t
k n+1
Ti 1
x2
2Tin + Tin+1
; (3.220)
in which 0 1.
a Calculate the truncation error of this scheme.
b For which is the scheme second order accurate both in space and time?
c Perform a stability analysis. For which does the scheme becomes unconditionally stable?
Exercise 8
Tin+1 Tin
2t
Tin+1
2Tin + Tin 1
=0:
2x
(3.221)
3.5. EXERCISES
103
Analyze the stability for this scheme. Hint: For multi-level schemes write the difference equation in matrix form as follows: Insertion of the harmonic E n exp(^i)
in the above scheme gives a relation for the amplitude at three dierent time levels,
i.e. E n 1 , E n and E n+1 . This can be written in matrix form as
E n+1
En
z
G
}|
a b
c d
{
En
En 1
(3.222)
Determine the coecients in the matrix, the G-matrix in this case. The stability
condition now states that the eigenvalues of the matrix G satisfy jG j 1.
Exercise 9
TIn+1 Tin
2t
Tin+1
(3.223)
Exercise 10
..
.
(ux)i i 1
(ux)i
(ux)i+1
..
.
C
C
C
C
C
A
B
B
AB
B
B
@
..
.
ui 1
ui
ui+1
..
.
1
C
C
C
C
C
A
104
DISCRETIZATION SCHEMES
Exercise 11
Show that the leapforg scheme (3.182) is consistent. What is the order
of the scheme. Apply Von Neumann analysis to determine under which conditions the
scheme is stable.
Exercise 12
@u
@u
+ a + u = 0 :
@t
@x
(3.224)
Show that this solution ultimately decays to zero if > 0 and exponentially grows in time
if < 0.
In order to tackle this problem we have decided to use a leapfrog scheme given by
uni +1 uni
2t
+a
uni+1 uni 1
+ uni = 0
2x
(3.225)
uni +1
uni 1 = 2 (uni
uni 1 ) :
Calculate the amplication matrix and show the connection with the previous equation.
In order to understand why the leapfrog scheme behave so poorly we look at the equation
dw
= w ;
dt
(3.226)
and apply the leapfrog scheme. For which values of will this scheme be stable? What
kind of restrictions does this impose on the semi-discrete eigenvalues. How do these results
compare to the conclusions obtained for the Richardson scheme, Exercise 8?
Exercise 13
8 @u
< @t
+ a @u
@x =
: @v
@t
@v
+ a @x
@v
@x
= c2 @u
@x
(3.227)
3.5. EXERCISES
105
b Determine the characteristic speeds, determine the matrix L consisting of the left
eigenvectors and show that the compatibility equations are given by
8 @
< @t (cu
v ) + (a + c) @x@ (cu v ) = 0
: @
@t (cu + v ) + (a
c) @x@ (cu + v ) = 0
c Use a rst order upwind discretization and a forward Euler integration in time to
discretize the compatibility equations. Assume a > 0 and make a distinction between
a < c and a > c.
d Transform the discrete equations back to the original variables by premultiplying the
discrete equation by the matrix R consisting of the right eigenvectors. Show that
this yields a consistent discretization of (3.227). Determine the order of the scheme.
e Analyze the stability of the discrete version of (3.227) obtained in 2d.
Exercise 14
Proof Theorem 1.
Exercise 15
@~u
= A~u ;
@t
(3.228)
B
B
B
=B
B
B
@
0
..
.
..
.
..
.
1
0
..
.
..
.
0 ::: :::
1 0 :::
1 0
0 1
..
. 0
1
C
C
C
C
C
C
A
(3.229)
and
ui (x; 0) = C0 (x) ; 0 i N :
(3.230)
Show that A is non-diagonizable and determine the exact solution. Show that although
the real part of all eigenvalues may be less than zero the solution will initially grow in
time. Does this have any implications for the long time behaviour of the system?
106
DISCRETIZATION SCHEMES
Exercise 16
m =
2k
(cos
x2
1) ; =
2m
:
N +1
(3.231)
@2
:
@x2
(3.232)
@ 2 Tm
= m Tm ; x 2 [0; L] ;
@x2
(3.233)
with periodic boundary conditions Tm (0) = Tm (L) and @Tm (0)=@x = @Tm (L)=@x. Show
that the eigenvalues of the dierential operator (3.232) and eigenfunctions are given by
m =
4km2 2
and Tm (x) = e^mx=L :
L2
(3.234)
Plot the rst 25 eigenvalues of the dierential operator (3.232) and the semi-discrete
eigenvalues for various values of N . Do the semi-discrete eigenvalues converge to the
eigenvalues of the dierential operator? Proof the convergence
lim m = m :
N !1
(3.235)
Note that based on this analysis it seems a reasonable idea to set up a numerical approximation of the form
T h (x; t)
N
X
i=0
i (t)Ti (x) ;
(3.236)
where the Ti (x) are the eigenfunctions of the dierential operator given above. Set up an
equation for the i 's and solve for all i 's. How do we nd the integration constants for
the i 's?
This numerical approach is known as the spectral collocation scheme. A very interesting feature of this approach is that adding more terms in the expansion (3.236) reduces
the error in the numerical approximation exponentially.
3.5. EXERCISES
Exercise 17
mined to be
cm =
107
The semi discrete eigenvalues for the pure convection equation were deter-
^c
sin :
x
(3.237)
For the upwind and downwind discretization the eigenvalues were determined to be
um =
c
(cos
x
c
(cos
x
1 + ^ sin ) ;
(3.238)
respectively. Show that in the limit N ! 1 all three m 's converge to the same limit.
Show that this unique limit value for the semi-discrete eigenvalues is an eigenvalue of the
linear convection operator
@
:
@x
(3.239)
Determine the correspondig eigenfunctions and use these eigenfunctions to set up a spectral collocation scheme as proposed in the previous exercise. How does this approach
compare with the Fourier symbol method discussed in this chapter.
Exercise 18
Use a Taylor series expansion to develop a higher order spatial approximation for the linear convection equation using the point ui 2, ui 1, ui, ui+1 and ui+2 .
Determine the coecients such that the approximation to @u=@x is O(x4 ). If we apply
this higher order scheme to a linear convection equation with periodic boundary conditions, it will give rise to a circulant semi-discrete matrix. Determine the eigenvalues, ho
m
of this matrix. Do these eigenvalues converge to the same limiting values as determined
in the previous exercise for very large values of N ? How does the higher order scheme
eect stability if we use the explicit Euler time marching method?
Exercise 19
It is fairly easy to write a code to solve the problem discussed in Example 22.
Write such a code for periodic boundary conditions and experiment with various values
of the CFL-number. For which values of the CFL number is the scheme stable. Can you
prove this.
108