numerical methods for hyperbolic balance laws with ... · in the following, numerical methods are...
TRANSCRIPT
Numerical methods for hyperbolic balance
laws with discontinuous flux functions and
applications in radiotherapy
Numerische Verfahren fur hyperbolische Bilanzgleichungen mit unstetiger
Flussfunktion und Anwendungen in der Strahlentherapie
von
Nadine Pawlitta
27.10.2011
Masterarbeit in Mathematik
vorgelegt der
Fakultat fur Mathematik, Informatik und Naturwissenschaften
der Rheinisch-Westfalischen Technischen Hochschule Aachen
Angefertigt bei
Prof. Dr. Martin Frank
Lehrstuhl fur Mathematik CCES
Zweitgutachter
Prof. Dr. Michael Herty
Lehrstuhl C fur Mathematik
3
Danksagung
Ich mochte mich an dieser Stelle bei all denen bedanken, die mich bei der Anfertigung
meiner Masterarbeit unterstutzt haben.
Besonderer Dank gilt Herrn Professor Martin Frank fur die Betreuung dieser Arbeit
und fur die vielen hilfreichen Anregungen.
Zudem bedanke ich mich bei den Mitarbeitern des MathCCES und meinen Freunden
und Kommilitonen fur die freundliche Atmosphare und fachliche Unterstutzung.
Nicht zuletzt mochte ich mich auch bei meiner Familie bedanken, ohne die dieses
Studium niemals moglich gewesen ware.
Contents
1 Introduction to hyperbolic conservation laws 9
1.1 Definition of conservation laws . . . . . . . . . . . . . . . . . . . . . . . . 9
1.1.1 The advection equation . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2 Theory of numerical methods . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.2.1 Convergence . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.3 Numerical methods for linear equations . . . . . . . . . . . . . . . . . . . 17
1.3.1 The Upwind method . . . . . . . . . . . . . . . . . . . . . . . . . . 17
1.3.2 Godunov’s method . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
1.3.3 The Lax-Wendroff method . . . . . . . . . . . . . . . . . . . . . . . 22
2 The advection equation with non constant velocity 27
2.1 Theoretical analysis . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
2.2.1 The Upwind method on a nonuniform grid . . . . . . . . . . . . . 30
2.2.2 The Upwind method on a uniform grid . . . . . . . . . . . . . . . 33
2.2.3 The Lax-Wendroff method . . . . . . . . . . . . . . . . . . . . . . . 41
2.3 Comparison and evaluation of the derived methods . . . . . . . . . . . . . 45
3 Nonlinear partial differential equations 55
3.1 Analysis of nonlinear equations . . . . . . . . . . . . . . . . . . . . . . . . 55
3.1.1 Burgers equation . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
3.2 Numerical methods for nonlinear equations . . . . . . . . . . . . . . . . . 58
3.2.1 The Lax-Friedrichs method . . . . . . . . . . . . . . . . . . . . . . 59
3.3 Nonlinear equations with spatially varying, discontinuous flux function . . 64
3.3.1 The Lax-Friedrichs method on a nonuniform grid . . . . . . . . . . 65
3.3.2 The Lax-Friedrichs method on a uniform grid . . . . . . . . . . . . 68
3.3.3 Flux functions with arbitrary, piecewise constant coefficient . . . . 71
4 Applications in radiotherapy 77
4.1 A model for dose calculation . . . . . . . . . . . . . . . . . . . . . . . . . 77
5
6 Contents
4.2 Solution of the 1D model . . . . . . . . . . . . . . . . . . . . . . . . . . . 78
4.3 Numerical experiments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.3.1 Homogeneous test case . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.3.2 One-dimensional dose calculation . . . . . . . . . . . . . . . . . . . 85
5 Conclusions and outlook 91
Introduction
Radiotherapy is a way of treating diseases like cancer by using ionizing radiation that
destroys the cells in the treated area. At the same time, the damage to the surrounding
tissue should be as small as possible. For this reason, the needed dose of radiation
has to be determined accurately. The difficulty that gave rise to this thesis is that the
radiation has to pass tissues of different density. For example, a particle that travels
through air looses much less energy than one that travels through bone. The density
can be described by a function ρ that is space dependent and can obtain values from
approximately 1, which corresponds to water, to 10−3, which is air. In this situation, the
change between the different areas and therefore densities is abrupt, so ρ is a piecewise
constant function. It can be ascertained with the data of a Computer Tomography scan
which is performed before the treatment.
The dose of radiation can then be computed by analyzing the transport of the radiation
particles. This transport can be described by a hyperbolic balance law, which is a system
of partial differential equations with a source term. In this thesis, a system of two first
order equations of the form
∂εΨ0(x, ε)− 1
ρ(x)∂xΨ1(x, ε) = 0,
∂εΨ1(x, ε)− 1
ρ(x)∂x
(Ψ0(x, ε)χ
(Ψ1(x, ε)
Ψ0(x, ε)
))= T (ε)Ψ1(x, ε)
is considered as a model for the radiative transport.
Usually, there exist several different numerical methods to solve such equations with high
accuracy, but the difference in the velocity makes them computationally too expensive
and therefore infeasible. The reason for this is the so-called CFL condition which is a
necessary condition for stability of the numerical methods. It establishes a connection
between the time step size and the spatial step size that depends on the density ρ. For
small values of ρ, as is the case when modeling air, the CFL condition demands a much
smaller time step size than spatial step size. Therefore, the existing standard methods
would solve the equation with a time step size that is only needed for particles that
travel through air and is much smaller than necessary for particles that travel through
7
8 Introduction
water.
The aim of this thesis is to find a numerical method that is better suited for this problem
by adjusting existing methods so that they no longer require such a small time step size.
Note that there does not exist sufficient theoretical knowledge of such situations. While
it will be possible to derive methods that solve the given equations, there is no theory
that provides the means to evaluate the methods analytically.
In the following, numerical methods are derived for one-dimensional systems of equations
by gradually extending methods for more simple problems. The first chapter gives a
general introduction to first-order, hyperbolic partial differential equations without such
a discontinuous coefficient and introduces basic numerical methods for the special case
of linear equations. In the second chapter, these methods are modified to solve linear
equations with the addition of a piecewise constant coefficient which will later on be the
density ρ. The results of these two chapters will be used in the third to solve nonlinear
equations, first without and then with the discontinuous coefficient. This yields the basis
for the fourth chapter. There, the numerical methods are validated and applied to dose
calculation in radiotherapy.
1 Introduction to hyperbolic conservation
laws
This chapter introduces the basics of hyperbolic partial differential equations and their
solutions and is mostly based on [11] and [12]. After establishing some theoretical facts
about such equations, the finite volume method for solving them is derived and analyzed
for convergence to the true solution. Following this, two basic methods for the special
case of a linear equation are presented.
1.1 Definition of conservation laws
Consider the initial value problem or Cauchy problem
∂
∂tu(x, t) +
∂
∂xf(u(x, t)) = 0, x ∈ R, t > 0 (1.1)
u(x, 0) = u0(x), x ∈ R
where f ∈ C1(R) and u0 ∈ L∞(R).
The equation ut + (f(u))x = 0 is the differential form of a conservation law. In order to
derive it, examine the one-dimensional example of the flow of a substance with density
u through a pipe. The mass between two points x1 and x2 at time t can be described by∫ x2
x1
u(x, t)dx.
Conservation of mass then means that the mass of the substance does not change within
the pipe but rather through flux at the boundaries of the pipe. In case this flux can be
described by the function f , it gives the integral form of the conservation law
∂
∂t
∫ x2
x1
u(x, t)dx = f (u(x1, t))− f (u(x2, t)) . (1.2)
Assuming that u and f are smooth, this results in
∂
∂t
∫ x2
x1
u(x, t)dx = −∫ x2
x1
∂
∂xf (u(x, t)) dx
9
10 1 Introduction to hyperbolic conservation laws
which can be written as∫ x2
x1
(∂
∂tu(x, t) +
∂
∂xf (u(x, t))
)dx = 0.
This yields the first introduced differential form of the conservation law.
1.1.1 The advection equation
The advection equation
∂
∂tu(x, t) + a
∂
∂xu(x, t) = 0 (1.3)
is a special case of (1.1) with a = f ′(u) since (f(u))x = f ′(u)ux = aux. It models the
advection of a substance in a fluid with velocity a.
It is easy to verify that, given an initial condition u(x, 0) = u0(x), the solution of this
equation is given by u(x, t) = u0(x− at) as
∂
∂tu0(x− at) + a
∂
∂xu0(x− at) = −au′0(x− at) + au′0(x− at) = 0.
Therefore, for arbitrary x0, the solution u(x, t) is constant along the so-called character-
istics X(t) = x0 + at of the equation because
d
dtu(X(t), t) = ut(X(t), t) +X ′(t)ux(X(t), t) = ut + aux = 0.
t
x
Figure 1.1: Characteristics for the advection equation.
Figure 1.1 shows for example some characteristics for an advection equation with positive
1 Introduction to hyperbolic conservation laws 11
velocity. The value of the solution u is the same on each point of one characteristic, this
means that in practice, the initial value u0 simply shifts to the right in time, as can be
seen in figure 1.2.
0 25 500
1initial condition, time t=0
0 25 500
1time t=150
0 25 500
1time t=300
0 25 500
1time t=450
Figure 1.2: Solution of the advection equation at different time steps.
In higher dimensions, a linear, constant-coefficient equation like the advection equation
becomes a linear system
ut +Aux = 0
since the system
ut + (f(u))x = 0
can be written as
ut + f ′(u)ux = 0
if f is smooth and f ′(u) = A ∈ Rm×m is the Jacobian of f . Such a system is called
hyperbolic if the matrix A is diagonalizable with real eigenvalues λ1, . . . , λm, that is
A = R diag(λ1, . . . , λm)R−1
12 1 Introduction to hyperbolic conservation laws
where R is the matrix that is composed of the corresponding eigenvectors. As a result
ut +Aux = 0 ⇔ R−1ut +R−1ARR−1ux = 0
⇔ vt + diag(λ1, . . . , λm)vx = 0
⇔ vpt + λpvpx = 0, for p = 1 . . .m
with R−1u =: v and therefore, the original system is equivalent to a system of m in-
dependent advection equations. Note that a scalar, first-order differential equation is
always hyperbolic.
1.2 Theory of numerical methods
The basic idea of the so-called finite volume methods is to divide the spatial domain
into a mesh and to approximate the integral of u over each cell in the mesh. In the
one-dimensional case, one of those cells is an interval
Ci = (xi−1/2, xi+1/2)
with size ∆xi = xi+1/2 − xi−1/2 and ∆xi = ∆x in the case of a uniform grid as pictured
in figure 1.3.
t
x
tn
tn+1
xixi-1 xi+1
Figure 1.3: Example for a uniform grid.
The approximation uni to the average value of the solution over Ci at time tn can then
be expressed as
uni ≈1
∆x
∫Ciu(x, tn)dx.
1 Introduction to hyperbolic conservation laws 13
This can be used to construct a numerical method for the solution of the PDE. The
starting point is the integral form (1.2) of the conservation law
∂
∂t
∫Ciu(x, t)dx = f
(u(xi−1/2, t)
)− f
(u(xi+1/2, t)
).
Integration over time and rearrangement gives∫Ciu(x, tn+1)dx−
∫Ciu(x, tn)dx =
∫ tn+1
tn
f(u(xi−1/2, t)
)dt−
∫ tn+1
tn
f(u(xi+1/2, t)
)dt
⇔ 1
∆x
∫Ciu(x, tn+1)dx =
1
∆x
∫Ciu(x, tn)dx
− ∆t
∆x
(1
∆t
∫ tn+1
tn
f(u(xi+1/2, t)
)dt− 1
∆t
∫ tn+1
tn
f(u(xi−1/2, t)
)dt
)where ∆t = tn+1 − tn is one time step. The method should therefore have the form
un+1i = uni −
∆t
∆x(Fni+1/2 − F
ni−1/2) (1.4)
with uni approximated as before and the average flux Fni−1/2 as
Fni−1/2 ≈1
∆t
∫ tn+1
tn
f(u(xi−1/2, t)
)dt.
This can be computed by means of a numerical flux function F where it is assumed for
now that the flux Fni−1/2 depends only on the values uni−1 and uni so that
Fni−1/2 = F(uni−1, uni ). (1.5)
Thus, the method is defined by the flux and approximates the value un+1i by
un+1i = uni −
∆t
∆x
(F(uni , u
ni+1)−F(uni−1, u
ni )), (1.6)
which is the standard formulation of a finite volume method.
More generally, if the flux Fni−1/2 depends on uni−m up to uni+m−1, the method is given
by
un+1i = uni −
∆t
∆x
(F(uni−m+1, . . . , u
ni+m)−F(uni−m, . . . , u
ni+m−1)
).
Let N then describe the numerical method as
N (uni−m, . . . , uni+m) = uni −
∆t
∆x
(F(uni−m+1, . . . , u
ni+m)−F(uni−m, . . . , u
ni+m−1)
).
A method that can be written thusly is called conservative or in conservation form.
The following sections examine this condition for ∆t before specifying a method by
choosing a numerical flux function.
14 1 Introduction to hyperbolic conservation laws
1.2.1 Convergence
An obvious property of the numerical method should be that the computed solution
converges to the exact one if the grid is refined, that is for ∆x,∆t→ 0. The Equivalence
Theorem of Lax and Richtmyer (see [9]) states that stability is necessary and sufficient
for convergence of a linear, consistent method. Therefore, there are two conditions that
have to be fulfilled to achieve convergence.
• Consistency deals with the error in one time step, it is given when the differential
equation is locally well approximated. For the numerical flux function F this
means that in the special case where u is constant and Fni−1/2 = f(u), F must
satisfy F(u, u) = f(u).
• Stability is the property that the error of a time step does not increase too much.
In the following, both attributes will be examined in more detail.
Consistency Consider the error caused by the application of the numerical method
after one time step. This error is called the local truncation error, it compares the true
solution at a time t + ∆t with the true solution at time t after one step of the method
and is given as
L(x, t) =1
∆t(N (u(x−m∆x, t), . . . , u(x+m∆x, t))− u(x, t+ ∆t)) . (1.7)
The numerical method is now said to be consistent if
lim∆t→0
‖L(., t)‖ = 0.
Furthermore, if the error can be written as
‖L(., t)‖ ≤ c∆tp (1.8)
for a constant c and arbitrary, smooth initial data, the method is of order p. In this
thesis, the discrete 1-norm ‖x‖1 =∑
i |xi| is used, though other norms can be used as
well, but they might give different results.
Instead of determining the order analytically, it can be estimated graphically as well. If
the ratio of ∆x and ∆t is set to be constant,
‖L(., t)‖ ≤ c∆tp ⇔ ‖L(., t)‖ ≤ c∆xp
1 Introduction to hyperbolic conservation laws 15
for some other constant c. Since it will later on be important to observe the error at
every time step, consider in this thesis from now on the error
ε :=1
T
T∑t=1
∥∥∆x(u(., t∆t)−N t(u0(.))∥∥
1
where N t means that N has been applied t times. Therefore, the error ε is the weighted
sum of the difference of the exact solution and the computed one at each point in space
and time. If the method is now of order p, then ε can be estimated by ∆xp as well. For
a constant C it then holds that
ε = C∆xp ⇔ log ε = logC + p log ∆x.
For this reason, the logarithm of the error can be interpreted as a straight line with slope
p. To assess the order p simply compute the error for different values of ∆x and plot
them as a function of log ∆x.
Stability A necessary condition for stability is the so-called CFL condition, named after
Courant, Friedrichs and Lewy [4]. For the advection equation (1.3) it was shown above
that the solution is constant along the characteristics and u(x, t) = u0(x− at) for arbi-
trary x and t. In other words, the solution at a point (x, t) depends on the initial data
only at one point x− at. Because of this, the numerical solution should as well depend
on at least this point, or rather on the point on the respective characteristic that was
computed one time step before. This set of points is called the domain of dependence
D(x, t) of the PDE at the point (x, t) and simply takes the form D(x, t) = x− at for
the advection equation.
The CFL condition now states for the general case that a numerical method can only be
convergent if the domain of dependence of the PDE is a subset of the numerical domain
of dependence.
For a method of the form (1.6), which computes un+1i using a three point stencil con-
sisting of uni−1,uni and uni+1, the domain of dependence is the set
D(x, t) =
x
∣∣∣∣x− ∆x
∆tt ≤ x ≤ x+
∆x
∆tt
as can be seen in figure 1.4. There the value at the point (xi, tn+1) depends on (xi−1, tn),
(xi, tn) and (xi+1, tn) and these in turn on (xi−2, tn−1) up to (xi+2, tn−1) and so on, so
that the edges of the resulting triangle can be described by t 7→ x− ∆x∆t t and t 7→ x+ ∆x
∆t t.
Hence, for the CFL condition to be fulfilled, the domain of dependence of the given PDE
has to be situated inside this triangle.
16 1 Introduction to hyperbolic conservation laws
tn
tn+1
tn-1
xixi-1 xi+1xi-2 xi+2
Figure 1.4: Three point stencil.
For the advection equation, the domain of dependence is the set D(x, t) = x− at and
therefore
x− ∆x
∆tt ≤ x− at ≤ x+
∆x
∆tt,
which can be reduced to ∣∣∣∣a∆t
∆x
∣∣∣∣ ≤ 1 (1.9)
where the number ν =∣∣a∆t
∆x
∣∣ is called the courant number.
Monotonicity and Total Variation There are other properties that are connected to
the convergence of a method and will be analyzed further here. The first is the concept of
monotonicity. It is reasonable to demand that if the solution is monotone on an interval,
the numerical solution should be monotone as well. Based on this notion, a numerical
method N is called monotone if
uni ≥ unj ⇒ N (uni ) ≥ N (unj )
and it is called monotonicity-preserving if
u0i ≥ u0
j ⇒ uni ≥ unj .
Another requirement deals with the total variation of a function. For an arbitrary
function g the total variation is defined as
TV (g) = lim supε→0
1
ε
∫ ∞−∞|g(x)− g(x− ε)|dx.
1 Introduction to hyperbolic conservation laws 17
For the special case of the piecewise constant function or rather grid function un this
simplifies to
TV (un) =∞∑
i=−∞|uni − uni−1|.
The total variation can be used to measure oscillations in a function. To avoid the
appearance of oscillations which are only the result of the computations and have no
physical meaning, the total variation of the solution should not increase. A numerical
method is therefore called total variation diminishing (TVD) or more appropriately total
variation non-increasing if
TV (un+1) ≤ TV (un)
for un+1 = N (un). Furthermore, monotonicity implies TVD and TVD implies mono-
tonicity preserving, so it suffices to proof monotonicity when testing a numerical method
for all three properties.
1.3 Numerical methods for linear equations
Derive now the basic numerical methods for the solution of the advection equation and
analyze them for convergence as described above.
1.3.1 The Upwind method
It is reasonable to choose the flux function Fni−1/2 according to the structure of the
solution in order to achieve better results. For the constant-coefficient advection equation
ut + aux = 0 it was shown that the solution is constant along the characteristics, that
is u(xi, tn) = u(xi + a∆t, tn+1). Hence, if a is positive, u(xi, tn+1) depends only on the
values of u at time tn to the left of xi and the same should hold for un+1i . In other words,
the flux Fni−1/2 should be determined by uni−1. Choosing
Fni−1/2 = F(uni−1, uni ) = auni−1
in (1.4) yields the first-order upwind method for the advection equation as
un+1i = uni −
a∆t
∆x(uni − uni−1). (1.10)
It is important to observe that this ansatz is only correct if u(xi, tn+1) depends solely
on u(xi−1, tn), which makes the above choice of the flux sensible. This is given by the
18 1 Introduction to hyperbolic conservation laws
CFL condition for the advection equation (1.9) because u(xi, tn+1) = u(xi−a∆t, tn) and
therefore xi − a∆t ≥ xi −∆x = xi−1. Figure 1.5 first depicts the case where the CFL
condition is fulfilled because it takes more than one time step for the characteristics to
cross one spatial interval Ci. In the second part this is no longer the case and the CFL
condition is breached.
tn
tn+1
xixi-1 xi+1
tn
tn+1
xixi-1 xi+1
Figure 1.5: Two examples where the CFL condition is fulfilled and breached.
It should be noted that the upwind method for the advection equation is exact if ν =a∆t∆x = 1 because then
un+1i = uni − (uni − uni−1) = uni−1,
which complies with
u(xi, tn+1) = u(xi − a∆t, tn) = u(xi −∆x, tn) = u(xi−1, tn).
The latter is a property of the exact solution of the PDE and is given by following the
characteristics. In most cases though, ν is strictly smaller than 1, which leads to the
situation in figure 1.6.
Another possibility to derive the upwind method is to take the convex combination
of u(xi−1, tn) and u(xi, tn) to compute u(xi, tn+1) since u(xi, tn+1) = u(xi − a∆t, tn) =
u(xi−ν∆x, tn). This is the result of the evaluation of the linear interpolation polynomial
through xi−1 and xi at the point xi − a∆t. The polynomial has the form
uni +uni−1 − unixi−1 − xi
(x− xi) = uni −uni−1 − uni
∆x(x− xi),
which simplifies to
uni + ν(uni−1 − uni ) = uni − ν(uni − uni−1)
when inserting x = xi − a∆t.
1 Introduction to hyperbolic conservation laws 19
tn
tn+1
xixi-1 ix -aΔt
Figure 1.6: The upwind method for ν < 1.
Properties of the upwind method The method is of first order as can be shown by
examining the local truncation error (1.7) that is given as
L(xi, tn) =1
∆t(u(xi, tn)− ν(u(xi, tn)− u(xi−1, tn))− u(xi, tn+1)) .
Replace u(xi−1, tn) and u(xi, tn+1) by their Taylor series expansion
u(xi−1, tn) = u(xi, tn)−∆xux(xi, tn) +1
2∆x2uxx(xi, tn) +O(∆x3),
u(xi, tn+1) = u(xi, tn) + ∆t ut(xi, tn) +1
2∆t2utt(xi, tn) +O(∆t3),
which yields
L(xi, tn) =1
∆t
[u(xi, tn)− ν
(u(xi, tn)− u(xi, tn) + ∆xux(xi, tn)− 1
2∆x2uxx(xi, tn)−O(∆x3)
)−u(xi, tn)−∆t ut(xi, tn)− 1
2∆t2utt(xi, tn)−O(∆t3)
]=
1
∆t
[−ν∆xux(xi, tn) +
1
2ν∆x2uxx(xi, tn) + νO(∆x3)
−∆t ut(xi, tn)− 1
2∆t2utt(xi, tn)−O(∆t3)
]= −a ux(xi, tn) +
1
2a∆xuxx(xi, tn) +
a
∆xO(∆x3)
− ut(xi, tn)− 1
2∆tutt(xi, tn)− 1
∆tO(∆t3).
In a last step, use that for the advection equation
ut + aux = 0 ⇒ ut = −aux ⇒ utt = (−aux)t = (−aut)x = a2uxx,
20 1 Introduction to hyperbolic conservation laws
so that
L(xi, tn) =1
2a∆xuxx(xi, tn)− 1
2a2∆tuxx(xi, tn) +O(∆x2,∆t2)
=1
2a(∆x− a∆t)uxx(xi, tn) +O(∆x2,∆t2).
Since the uxx term has the most influence on the local truncation error, it was proven
that the method is of first order in time and space.
This can be verified graphically as explained in section 1.2.1. Figure 1.7 shows an
example for the solution of the advection equation with velocity a = 1. The initial
condition is a part of the arc tangent on the interval [0, 1000]. Since the upwind method
then requires a boundary condition for x = 0, assume for simplicity that the value un0is given. Furthermore, the Courant number is ν = 0.9 and the step size ∆x is given as
10i/20 with i = −20, . . . , 20. The plot shows the base 10 logarithm of the error depending
on the logarithm i/20 of the step size. As can be seen, the slope and with it the order
is indeed 1.
1 0.5 0 0.5 12
1
0
1Upwind
least squares approximation(slope 1.0052)error
Figure 1.7: The logarithmic error plot of the upwind method for the solution of the
advection equation with an arc tangent as initial condition
It is easy to verify further that this method is TVD and monotonicity preserving as an
1 Introduction to hyperbolic conservation laws 21
additional property since
TV (un+1) =∞∑
i=−∞
∣∣un+1i − un+1
i−1
∣∣=
∞∑i=−∞
∣∣(1− ν)(uni − uni−1) + ν(uni−1 − uni−2)∣∣
≤∞∑
i=−∞(1− ν)
∣∣uni − uni−1
∣∣+
∞∑i=−∞
ν∣∣uni−1 − uni−2
∣∣= (1− ν)TV (un) + νTV (un)
= TV (un).
1.3.2 Godunov’s method
The upwind method can be interpreted as a special case of Godunov’s method which de-
termines the values un+1i with the REA algorihm. Here, REA stands for Reconstruction,
Evolution and Averaging which is done as follows.
1. Reconstruction step: Define a piecewise polynomial u(x, tn) from the current so-
lution uni .
2. Evolution step: Use u(x, tn) as an initial condition for the given differential equa-
tion and compute its solution u(x, tn+1) after one time step ∆t.
3. Averaging step: Determine the new cell average un+1i by computing the average of
u(x, tn+1) over the interval Ci = (xi−1/2, xi+1/2), that is
un+1i =
1
∆x
∫Ciu(x, tn+1)dx.
The second step requires the solution of a so-called Riemann problem, which is the
hyperbolic equation with the discontinuous initial condition
u0(x) =
ul, for x ≤ xi+1/2,
ur, for x > xi+1/2.
The upwind method for the advection equation is the result of this method when using
the piecewise constant function
u(x, tn) = uni , for all x ∈ Ci
in the first step so that ul = uni and ur = uni+1 in the Riemann problem. Such an
approach can obviously be improved by using a more precise reconstruction. This idea
gives rise to the next section.
22 1 Introduction to hyperbolic conservation laws
1.3.3 The Lax-Wendroff method
In [10], Lax and Wendroff proposed the Lax-Wendroff method, which is an improvement
of the upwind method in terms of the order of consistency. To derive the method, begin
with the Taylor series expansion of u to get
u(xi, tn+1) = u(xi, tn) + ∆tut(xi, tn) +1
2∆t2utt(xi, tn) +O(∆t3).
The time derivatives can be replaced using the advection equation (1.3) as
ut + aux = 0
⇒ ut = −aux⇒ utt = (−aux)t = (−aut)x = a2uxx.
The O(∆t) and O(∆x) terms will be omitted in the following. This yields
u(xi, tn+1) = u(xi, tn)− a∆tux(xi, tn) +1
2a2∆t2uxx(xi, tn).
In a last step, approximate the spatial derivatives with central differences
ux(xi, tn) =u(xi+1, tn)− u(xi−1, tn)
2∆x,
uxx(xi, tn) =ux(xi+1/2, tn)− ux(xi−1/2, tn)
∆x
=u(xi+1,tn)−u(xi,tn)
∆x − u(xi,tn)−u(xi−1,tn)∆x
∆x
=u(xi+1, tn)− 2u(xi, tn)− u(xi−1, tn)
∆x2.
Together, this results in
u(xi, tn+1) = u(xi, tn)− a∆t
2∆x(u(xi+1, tn)− u(xi−1, tn))
+a2∆t2
2∆x2(u(xi+1, tn)− 2u(xi, tn)− u(xi−1, tn))
so the Lax-Wendroff method for the advection equation has the form
un+1i = uni −
a∆t
2∆x
(uni+1 − uni−1
)+
1
2
(a∆t
∆x
)2 (uni+1 − 2uni + uni−1
). (1.11)
Alternatively, use a quadratic interpolation instead of a linear one as was done for
the upwind method. The data points (xi+1, uni+1), (xi, u
ni ) and (xi−1, u
ni−1) give the
interpolation polynomial
uni+1 +uni+1 − uni
∆x(x− xi+1) +
uni+1 − 2uni + uni−1
2∆x2(x− xi+1)(x− xi),
1 Introduction to hyperbolic conservation laws 23
which is the same as (1.11) for x = xi − a∆t.
The method can be written in conservation form since
un+1i = uni −
a∆t
2∆x
(uni+1 − uni−1
)+
1
2
(a∆t
∆x
)2 (uni+1 − 2uni + uni−1
)= uni −
∆t
∆x
(a
2
(uni+1 − uni−1
)− a2∆t
2∆x
(uni+1 − 2uni + uni−1
))= uni −
∆t
∆x(Fni+1/2 − F
ni−1/2)
with
Fni−1/2 = F(uni−1, uni ) =
a
2
(uni + uni−1
)− a2∆t
2∆x
(uni − uni−1
).
Properties of the Lax-Wendroff method and comparison with the upwind method.
As mentioned before, the method is of second order. Analytically it can be proven by
the same approach as for the upwind method. Begin with
L(xi, tn) =1
∆t
[u(xi, tn)− ν
2(u(xi+1, tn)− u(xi−1, tn))
+ν2
2(u(xi+1, tn)− 2u(xi, tn) + u(xi−1, tn))− u(xi, tn+1)
].
Replace u(xi+1, tn), u(xi−1, tn) and u(xi, tn+1) again by their Taylor series expansion
u(xi±1, tn) = u(xi, tn)±∆xux(xi, tn) +1
2∆x2uxx(xi, tn)± 1
6∆x3uxxx(xi, tn) +O(∆x4),
u(xi, tn+1) = u(xi, tn) + ∆t ut(xi, tn) +1
2∆t2utt(xi, tn) +
1
6∆t3uttt(xi, tn) +O(∆t4).
The local truncation error then becomes
L(xi, tn) =1
∆t
[u(xi, tn)− ν
2
(2∆xux(xi, tn) +
1
3∆x3uxxx(xi, tn)
)+ν2
2
(2u(xi, tn) + ∆x2uxx(xi, tn) + 2O(∆x4)− 2u(xi, tn)
)−u(xi, tn)−∆t ut(xi, tn)− 1
2∆t2utt(xi, tn)− 1
6∆t3uttt(xi, tn)−O(∆t4)
]=
1
∆t
[−ν∆xux(xi, tn)− ν
6∆x3uxxx(xi, tn) +
ν2
2∆x2uxx(xi, tn)− ν2O(∆x4)
−∆t ut(xi, tn)− 1
2∆t2utt(xi, tn)− 1
6∆t3uttt(xi, tn)−O(∆t4)
]= −aux(xi, tn)− 1
6a∆x2uxxx(xi, tn) +
a2
2∆tuxx(xi, tn)− a2∆t
∆x2O(∆x4)
− ut(xi, tn)− 1
2∆tutt(xi, tn)− 1
6∆t2uttt(xi, tn)−O(∆t3).
24 1 Introduction to hyperbolic conservation laws
In a last step, write the time derivatives as space derivatives by means of the advection
equation
ut = −aux ⇒ utt = a2uxx ⇒ uttt = −a3uxxx,
to get
L(xi, tn) = −1
6a∆x2uxxx(xi, tn) +
1
6a3∆t2uxxx(xi, tn) +O(∆x3,∆t3)
=1
6a(a2∆t2 −∆x2)uxxx(xi, tn) +O(∆x3,∆t3).
The method is in fact of second order, because the coefficient of the uxxx term depends
on ∆t2 and ∆x2. Figure 1.8 proves this as well, it shows the logarithmic error plot for
the example that was used to illustrate the order of the upwind method in the previous
section.
1 0.5 0 0.5 15
4
3
2
1
0Lax Wendroff
least squares approximation(slope 2.0060)error
Figure 1.8: The logarithmic error plot of the Lax-Wendroff method for the solution of
the advection equation with an arc tangent as initial condition.
However, the Lax-Wendroff method does not necessarily give much better results than
the upwind method. One disadvantage is that the Lax-Wendroff method is not TVD as
can be seen in figure 1.9.
There the upwind method smoothes the discontinuities and therewith compresses the
function while the general form is conserved. With the Lax-Wendroff method this is not
the case and oscillations are generated. Another disadvantage is that the Lax-Wendroff
method no longer has second order in such situations. The definition and the proof of
the order were based on the assumption that the solution is sufficiently smooth. This
is not given for this example and thus the theoretical order of both the upwind and
the Lax-Wendroff method is no longer reached. Figure 1.10 illustrates this problem in
1 Introduction to hyperbolic conservation laws 25
0 10 20
0
0.2
0.4
0.6
0.8
1
initial condition
0 10 200.2
0
0.2
0.4
0.6
0.8
1
1.2Upwind at time t=100
0 10 200.2
0
0.2
0.4
0.6
0.8
1
1.2Lax Wendroff at time t=100
Figure 1.9: Solution of the advection equation using the upwind and the Lax-Wendroff
method.
the form of the logarithmic error plots for the above example. While the order of the
upwind method is approximately 0.6 instead of 1, the order of the Lax-Wendroff method
decreases by 1.3 to 0.7 and therefore is only marginally better than the one of the upwind
method.
2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 01.5
1
0.5
0
0.5Upwind
least squares approximation(slope 0.5954)error
2 1.8 1.6 1.4 1.2 1 0.8 0.6 0.4 0.2 01.5
1
0.5
0
0.5Lax Wendroff
least squares approximation(slope 0.7118)error
Figure 1.10: Logarithmic error plot for the upwind and the Lax-Wendroff method.
2 The advection equation with non
constant velocity
2.1 Theoretical analysis
Consider now the advection equation as described in section 1.1.1 with the only difference
that the velocity a is no longer constant and equation (1.3) takes the form
∂
∂tu(x, t) + a(x)
∂
∂xu(x, t) = 0. (2.1)
Here a(x) is restricted to a piecewise constant function of the form
a(x) =
a1, if x ≤ α,
a2, if x ≥ α
with 0 < a1 ≤ a2 and α an arbitrary value in space where the velocity changes. This
generalization causes the characteristics to no longer have the same slope as illustrated
in figure 2.1. The slope is constant as long as the characteristics do not cross the jump
α where they kink.
t
xαFigure 2.1: Characteristics for the advection equation with piecewise constant velocity.
Like in the constant-coefficient case, the solution of the corresponding initial value prob-
lem is constant along the characteristics. For an arbitrary x0 ≥ α, they can be written
27
28 2 The advection equation with non constant velocity
as
X(t) = x0 + a2t,
so that the problem reduces to the constant-coefficient case. For x0 < α, the character-
istics can cross the position of the jump, hence
X(t) =
x0 + a1t, if x0 + a1t ≤ α ⇔ t ≤ α−x0a1
=: t∗,
x0 + a1t∗ + a2(t− t∗), else.
The result of this kink in some of the characteristics and the different slopes is that the
initial value u0 shifts to the right as before but with different speed on each side of the
jump, so that the solution dilates at the jump as shown in figure 2.2.
0 25 500
1initial condition, time t=0
0 25 500
1time t=50
0 25 500
1time t=75
0 25 500
1time t=100
Figure 2.2: Solution of the advection equation with piecewise constant velocity at differ-
ent time steps. Here a1 = 0.1, a2 = 1 and the jump lies at α = 10.
These solutions can be computed by examining the characteristics at one point. For the
example in figure 2.3 it holds that u(x1, tn) = u(x2, tn+1) and u(x5, tn) = u(x6, tn+1)
for the solutions along the characteristics that do not cross the jump and u(x3, tn) =
u(α, t∗) = u(x4, tn+1) for the one that does.
2 The advection equation with non constant velocity 29
(x ,t )n+12
(x ,t )n1
(x ,t )n+14 (x ,t )n+16
(x ,t )n3 (x ,t )n5
t n+1
t n
t*
Figure 2.3: The solution to the PDE is constant along each of the three possible shapes
of the characteristics.
For the solution u(x, t) this means that if x ≤ α, one simply has to follow the charac-
teristic with slope a1 until it reaches time t = 0 where u is known through the initial
condition. The same holds for the characteristics with slope a2 if x is sufficiently bigger
than α because if x ≥ α+ a2t, the characteristic does not cross the jump. For values of
x in between, one additionally needs to determine the time t∗ where the characteristic
crosses the jump, that is
x4 = α+ a2(tn+1 − t∗) = x3 + a1(t∗ − tn) + a2(tn+1 − t∗)
⇔ t∗ =α+ a2tn+1 − x4
a2. (2.2)
Overall, this yields the solution as
u(x, t) =
u0(x− a1t), if x ≤ α,
u0
((1− a1
a2
)α+ a1
a2x− a1t
), if α < x < α+ a2t,
u0(x− a2t), if x ≥ α+ a2t
where u0
((1− a1
a2
)α+ a1
a2x− a1t
)= u0(α− a1t
∗) = u0
(α− a1
(α+a2t−x
a2
)).
It is easy to prove that this is indeed the solution of the PDE by examining the three
cases. For x ≤ α, one obtains
ut + a1ux = (u0(x− a1t))t + a1 (u0(x− a1t))x
= −a1u′0(x− a1t) + a1u
′0(x− a1t) = 0.
30 2 The advection equation with non constant velocity
The case x ≥ α + a2t is analogue with a2 instead of a1. For α < x < α + a2t, inserting
the solution in the PDE results in
ut + a2ux =
(u0
((1− a1
a2
)α+
a1
a2x− a1t
))t
+ a2
(u0
((1− a1
a2
)α+
a1
a2x− a1t
))x
= −a1u′0
((1− a1
a2
)α+
a1
a2x− a1t
)+ a2
a1
a2u′0
((1− a1
a2
)α+
a1
a2x− a1t
)= 0.
2.2 Methods
In this section, different methods for solving the advection equation with piecewise con-
stant velocity a(x) =
a1, if x ≤ α,
a2, if x ≥ αwhere a1 ≤ a2 are introduced and analyzed. The
problem that arises when the velocity is no longer constant is that the CFL condition
ν = a(x)∆t∆x ≤ 1 has still to be fulfilled. Since the step size ∆t is generally constant, the
spatial step size ∆x has to be chosen complying the CFL condition for all values of a(x).
Alternatively, the stencil of the method has to be adapted to a(x). The following sec-
tions derive different methods that are suited for the given situation and analyze them
theoretically. At the end of the chapter in section 2.3, they will be compared with each
other by means of exemplary computations.
2.2.1 The Upwind method on a nonuniform grid
The most simple numerical method for solving the advection equation is the upwind
method as introduced in section 1.3.1. This section studies the ansatz of using such a
simple upwind method with the modification of an adaptive spatial step size to conform
to the change in a.
Consider a piecewise constant step size
∆x =
∆x1, if x ≤ α,
∆x2 = a2a1
∆x1, if x ≥ α
where ∆x1 is the chosen value for the smaller step size. Then
∆t =ν∆x
a(x)=ν∆x1
a1=ν∆x2
a2
with ν ≤ 1, so that the CFL condition is satisfied.
2 The advection equation with non constant velocity 31
Special case
To simplify matters, assume for now that the spatial grid is constructed in such a way
that the jump lies on a grid point, so that the characteristics through the grid points do
not cross the jump between time steps. This results in the situation depicted in figure
2.4.
t n+1
t nα x
Figure 2.4: The grid points and corresponding characteristics on a nonuniform grid with
courant number ν = 1.
Since the characteristics do not kink during a time step and ν = a1∆t∆x1
= a2∆t∆x2
, one can
apply the upwind method
un+1i = uni − ν(uni − uni−1)
as in section 1.3.1 on the nonuniform grid with the step sizes ∆x1 and ∆x2.
This method was constructed so that it conserves the properties of the upwind method
for the constant coefficient advection equation. The proof that the method is of first
oder and TVD remains the same as in section 1.3.1.
General case
In a next step, consider an analogous method without the constraint that the jump lies
on a grid point. There are two possible approaches to adjust the above method, which
are illustrated in figure 2.5. Before, the jump separated the area with small step size
from the one with bigger step size. Since this is no longer possible, the grid must be
constructed in such a way that the jump lies either in an interval of small step size or
in one of bigger step size.
As can be observed in the figure, the jump in an interval of smaller step size ∆x1 may
result in the characteristic crossing a grid point. Whether this happens depends on the
velocity a and the position of the jump in relation to the grid. The nearer the jump lies
32 2 The advection equation with non constant velocity
t n+1
t n xα
t n+1
t n xα
Figure 2.5: The grid points and corresponding characteristics on a nonuniform grid,
where the jump is located in an interval of size ∆x2 (left) or ∆x1 (right).
to the right boundary of the interval, the higher is the possibility of the characteristic
staying in the interval. Using this approach would therefore require the method to make
a case distinction and then adjust the computations accordingly.
This can be avoided by using the other approach. Creating the grid so that the jump is in
the bigger interval of size ∆x2 ensures that no characteristic through a point (xi, tn+1)
crosses one spatial interval in one time step. This implies that the ordinary upwind
method can be used for all values except for un+1γ+1 where γ is the grid point to the left
of the jump with γ =⌊
α∆x1
⌋and α ∈ [xγ , xγ+1).
Derivation of the numerical method The most simple method for this case is to just
keep using the upwind method and to ignore that the value un+1γ+1 is then computed with
the velocity a2, which is not correct because the velocity changes at the jump. In doing
so, the properties of the method remain as before.
To improve on this, change the computation of un+1γ+1. In section 1.3.1 it was pointed
out that the upwind method can be interpreted as a linear interpolation. To compute a
value un+1i , insert the point x∗ := xi − a1∆t, where the characteristic through (xi, tn+1)
reaches tn, into the interpolation polynomial to the data points (xi−1, tn) and (xi, tn).
This can be done in this situation as well. The thus derived method is then based on
the idea of following the characteristics and is basically no upwind method anymore.
At first, compute the value x∗ for this situation. Equation (2.2) stated that the char-
acteristic through (xγ+1, tn+1) passes the jump at time t∗ = 1a2
(α − xγ+1 + a2tn+1).
2 The advection equation with non constant velocity 33
Therefore,
x∗ = xγ+1 − a2(tn+1 − t∗)− a1(t∗ − tn)
= α− a1(t∗ − tn)
=
(1− a1
a2
)α+
a1
a2xγ+1 − a1∆t. (2.3)
The value of the interpolation polynomial to (xγ , tn) and (xγ+1, tn) at x∗ is
unγ+1 +unγ+1 − unγ
∆x2(x∗ − xγ+1) = unγ+1 +
(1− a1
a2
)(α− xγ+1)− a1∆t
∆x2(unγ+1 − unγ ),
which is then the value of un+1γ+1. Thus, the method has the form
un+1i =
uni +
(1−a1
a2
)(α−xi)−a1∆t
∆x2(uni − uni−1), if i = γ + 1 for α ∈ [xγ , xγ+1),
uni − ν(uni − uni−1), else.
Note that if α + a2∆t ≤ xγ+1, the characteristic through (xγ+1, tn+1) does not reach
the jump and therefore does not kink. In that case, it is not necessary to compute un+1γ+1
differently and all the properties of the upwind method are conserved as it was the case
when the grid was constructed on the jump.
Since both approaches, the ordinary upwind method and the modified method, only differ
in the computation of one value and have the same properties, they yield essentially the
same results. The small difference in un+1γ+1 has no noticeable influence on the computation
of the values adjacent to it, so that its part in the error is minimal and, because of
rounding in the computations, not noticeable.
2.2.2 The Upwind method on a uniform grid
Consider now an upwind method on a uniform grid as an alternative to the above
examined upwind method on a nonuniform grid. The idea is to construct the grid
uniformly according to the smaller velocity a1 so that for given ∆x, ∆t = ν∆xa1
with
ν ≤ 1. In this case, the CFL condition may not be fullfilled to the right of the jump
because a2∆t∆x = a2
a1ν and a2
a1≥ 1 for a1 ≤ a2. Therefore, the method computes the
solution to the right of the jump with a bigger stencil.
Under these conditions, the grid is constructed in such a way that to the left of the jump,
the interval between each of the points xi−1 and xi at time tn is only crossed by the
characteristic that passes through (xi, tn+1). To the right of the jump, this is still the
case in a way, but the characteristics pass several spatial intervals in one time step since
34 2 The advection equation with non constant velocity
the slope of the characteristics to the right of the jump is s := a2a1≥ 1 times bigger than
the one to the left. Assume here that s is an integer, otherwise it has to be replaced by⌈a2a1
⌉. Furthermore, some of the characteristics now cross the jump during a time step,
which results in more than one characteristic passing the intervals around the jump at
time tn.
Special case
At first, limit the analysis to the case that the jump lies on a grid point like in the
previous section. Let β′ ≥ α be the smallest grid point for which the characteristic
through (β′, tn+1) does not reach the jump at time tn and let β = α + s ≥ β′. Denote
further α, β and β′ the indices of α, β and β′, that is xα = α, xβ = β and xβ′ = β′ where
β = α+s and β′ = α+⌈a2∆t∆x
⌉= α+dsνe. An example for this situation is illustrated in
figure 2.6. Note that β = β′ if the Courant number is sufficiently big, so that dsνe = s.
t n+1
t nα
xβ' β
Figure 2.6: The grid points and corresponding characteristics on a uniform grid.
Derivation of the numerical method As for the nonuniform grid, start with using the
upwind method and adjust the stencil accordingly. That means, compute
un+1i = uni − ν(uni − unj )
where the grid point xj has yet to be determined. As the figure suggests, there are three
different cases that have to be examined when computing the solution at (xi, tn+1).
They are distinguished from each other by the position of xi in relation to α and β.
2 The advection equation with non constant velocity 35
For xi ≤ α, simply take xj = xi−1 as for the constant coefficient advection equation.
For the case xi ≥ β, note again that the slope of the corresponding characteristics is s
times bigger than for xi ≤ α, so the stencil should be s times broader, which implies
xj = xi−s. Therefore, un+1α depends on unα−1 and un+1
β on unα, so that un+1i should be
computed with unα−1 for α < xi < β. Altogether, the upwind method is
un+1i =
uni − ν(uni − uni−1), if i ≤ α,
uni − ν(uni − unα−1), if α < i < β,
uni − ν(uni − uni−s), if i ≥ β.
(2.4)
As mentioned before, s should be replaced by⌈a2a1
⌉if s is no integer. Then, ∆t could
be bigger on the interval with broader stencil, so the coefficient µ would change. Thus,
fixing the coefficient is a simplification in this case.
A distinctive feature of this method lies in the computations for α < xi < β since they
all use the value unα−1. This results in a stair-step like pattern as illustrated in figure
2.7.
Figure 2.7: Solution using the upwind method. The right figure shows a magnification
of the dashed rectangle in the left figure.
Nevertheless, the method is convergent and the discontinuities become smaller with a
36 2 The advection equation with non constant velocity
smaller step size. To confirm this, examine the method for the TVD property.
TV (un+1) =∞∑
i=−∞
∣∣un+1i − un+1
i−1
∣∣=
α∑i=−∞
∣∣un+1i − un+1
i−1
∣∣+∣∣un+1α+1 − u
n+1α
∣∣+
β−1∑i=α+2
∣∣un+1i − un+1
i−1
∣∣+∣∣∣un+1β− un+1
β−1
∣∣∣+∞∑
i=β+1
∣∣un+1i − un+1
i−1
∣∣ .Compute each part separately, for the first one
α∑i=−∞
∣∣un+1i − un+1
i−1
∣∣ =
α∑i=−∞
∣∣uni − ν(uni − uni−1)− uni−1 + ν(uni−1 − uni−2)∣∣
=α∑
i=−∞
∣∣(1− ν)(uni − uni−1) + ν(uni−1 − uni−2)∣∣
≤ (1− ν)α∑
i=−∞
∣∣uni − uni−1
∣∣+ να∑
i=−∞
∣∣uni−1 − uni−2
∣∣since 0 ≤ ν ≤ 1. For the second term, it holds∣∣un+1
α+1 − un+1α
∣∣ =∣∣unα+1 − ν(unα+1 − unα−1)− unα + ν(unα − unα−1)
∣∣= (1− ν)
∣∣unα+1 − unα∣∣ .
In the third one,
β−1∑i=α+2
∣∣un+1i − un+1
i−1
∣∣ =
β−1∑i=α+2
∣∣uni − ν(uni − unα−1)− uni−1 + ν(uni−1 − unα−1)∣∣
=
β−1∑i=α+2
∣∣uni − uni−1 − ν(uni − uni−1)∣∣
≤ (1− ν)
β−1∑i=α+2
∣∣uni − uni−1
∣∣ .The fourth part is given as∣∣∣un+1
β− un+1
β−1
∣∣∣ =∣∣∣unβ − ν(unβ − u
nβ−s)− u
nβ−1 + ν(unβ−1 − u
nα−1)
∣∣∣=∣∣∣(1− ν)
(unβ − u
nβ−1
)+ ν
(unβ−s − u
nα−1
)∣∣∣≤ (1− ν)
∣∣∣unβ − unβ−1
∣∣∣+ ν∣∣∣unβ−s − unα−1
∣∣∣
2 The advection equation with non constant velocity 37
and the last as
∞∑i=β+1
∣∣un+1i − un+1
i−1
∣∣ =∞∑
i=β+1
∣∣uni − ν(uni − uni−s)− uni−1 + ν(uni−1 − uni−s−1)∣∣
=∞∑
i=β+1
∣∣(1− ν)(uni − uni−1) + ν(uni−s − uni−s−1)∣∣
≤ (1− ν)∞∑
i=β+1
∣∣uni − uni−1
∣∣+ ν∞∑
i=β+1
∣∣uni−s − uni−s−1
∣∣ .Together, this yields
TV (un+1) ≤ (1− ν)
∞∑i=−∞
∣∣uni − uni−1
∣∣+ ν
α∑i=−∞
∣∣uni−1 − uni−2
∣∣+ ν∣∣∣unβ−s − unα−1
∣∣∣+ ν∞∑
i=β+1
∣∣uni−s − uni−s−1
∣∣ ,so that the method is TVD if the last three summands add up to ν
∞∑i=−∞
∣∣uni − uni−1
∣∣.Since β = α+ s,
(∗) :=α∑
i=−∞
∣∣uni−1 − uni−2
∣∣+∣∣∣unβ−s − unα−1
∣∣∣+∞∑
i=β+1
∣∣uni−s − uni−s−1
∣∣=
α−1∑i=−∞
∣∣uni − uni−1
∣∣+∣∣unα − unα−1
∣∣+∞∑
i=α+s+1
∣∣uni−s − uni−s−1
∣∣=
α−1∑i=−∞
∣∣uni − uni−1
∣∣+∣∣unα − unα−1
∣∣+∞∑
i=α+1
∣∣uni − uni−1
∣∣=
∞∑i=−∞
∣∣uni − uni−1
∣∣and it is guaranteed that the small discontinuities do not become oscillations.
To be able to compute a solution without this feature, try improving the method by
using the same ansatz as was done for the nonuniform grid.
Case 1. For the solution at xi ≤ α, simply take the upwind method as introduced in
section 1.3.1, that is
un+1i = uni −
a1∆t
∆x(uni − uni−1), if i ≤ α. (2.5)
38 2 The advection equation with non constant velocity
Use now a linear interpolation to derive the method for xi > α as well. For the inter-
polation error to be minimal, the data points have to be chosen as close as possible to
the point where the polynomial is evaluated, that means the grid points directly to the
left and right. For xi ≤ α, this was given by taking (xi−1, tn) and (xi, tn), which is no
longer the case for xi > α.
Case 2. The characteristics through all the points (xi, tn+1) with α < xi < β′ end
between xα and xα−1 at time tn. Therefore, the method should compute the solution at
(xi, tn+1) by means of (xα, tn) and (xα−1, tn). The interpolation polynomial to this two
data points is
unα +unα − unα−1
xα − xα−1(x∗ − xα) = unα +
x∗ − α∆x
(unα − unα−1).
To determine x∗, observe that the characteristics through (xα+j , tn+1) with j = 1, . . . , β′−α− 1 pass the jump at time tn+1 − j∆t with a constant time interval ∆t. It holds that
α+ a2j∆t = xα+j ∀ j = 1, . . . , β′ − α− 1 ⇒ ∆t =∆x
a2,
so that for the characteristic through (xi, tn+1) with j = i− α
x∗ = α− a1(∆t− j∆t) = α− a1
(∆t− j∆x
a2
)= α− a1∆t+ (i− α)
∆x
s.
In the interpolation polynomial, this gives
unα +−a1∆t+ (i− α)∆x
s
∆x(unα − unα−1) = unα +
(i− αs− a1∆t
∆x
)(unα − unα−1)
so that
un+1i = unα +
(i− αs− ν)
(unα − unα−1), if α < xi < β′. (2.6)
Case 3. To the right of the jump, the exact solution at (xi, tn+1) with xi ≥ β′ depends
on (xi − a2∆t, tn). The point xi − a2∆t = xi − sν∆x lies between the grid points
xi−dsνe∆x = xi−dsνe and xi−dsνe+1, so a numerical method should compute the solution
using these two points. Using a linear interpolation through xi−dsνe and xi−dsνe+1 yields
the interpolation polynomial
uni−dsνe +uni−dsνe+1 − u
ni−dsνe
xi−dsνe+1 − xi−dsνe(x∗ − xi−dsνe) = uni−dsνe +
uni−dsνe+1 − unidsνe
∆x(x∗ − xi−dsνe).
Inserting x∗ = xi − sν∆x results in
uni−dsνe +xi − sν∆x− xi−dsνe
∆x(uni−dsνe+1 − u
ni−dsνe),
2 The advection equation with non constant velocity 39
so the solution is
un+1i = uni−dsνe + (dsνe − sν)(uni−dsνe+1 − u
ni−dsνe), if i ≥ β′. (2.7)
Combining the solutions (2.5), (2.6) and (2.7) of the three cases, the method can then
be written as
un+1i =
uni − ν(uni − uni−1), if i ≤ α,
unα +(i−αs − ν
)(unα − unα−1), if α < i < β′,
uni−dsνe + (dsνe − sν)(uni−dsνe+1 − uni−dsνe), if i ≥ β′.
(2.8)
While the approach of following the characteristics to modify the upwind method changed
the method for the nonuniform grid only at one point, the method for the uniform grid is
altered much more. This has the advantage of yielding a more accurate solution without
the additional discontinuities that where generated in the example of figure 2.7. The
proof that this method is TVD can be found in the appendix.
General case
Relax now the restriction that the jump lies on a grid point and modify the above
methods accordingly. Depending on the position of the jump in relation to the grid
points, the characteristics that cross the jump in a time step end either in the interval of
the jump or the one to the left. Figure 2.8 shows both possibilities and it can be observed
that the farther to the right of the interval the jump lies, the more characteristics stay
in the interval of the jump.
t n+1
t n xα β'
t n+1
t n xα β' ββ
Figure 2.8: The grid points and corresponding characteristics on a uniform grid.
Keep the notation of before, that is s = a2a1
. Since α is now no grid point, let γ again be
the grid point to the left of the jump, so that γ =⌊α
∆x
⌋and α ∈ [xγ , xγ+1). Furthermore,
adjust the values of β and β′ as β = γ + s+ 1 and β′ =⌈α+a2∆t
∆x
⌉=⌈α
∆x + sν⌉.
40 2 The advection equation with non constant velocity
Derivation of the numerical method The simple upwind method is the same as (2.4)
with α substituted by γ, that is
un+1i =
uni − ν(uni − uni−1), if i ≤ γ,
uni − ν(uni − unγ−1), if γ < i < β,
uni − ν(uni − uni−s), if i ≥ β.
Since this method is essentially the same as method (2.4), it has the same properties
and creates the same stair-shaped discontinuities as depicted in figure 2.7. Prove again
that these small discontinuities do not oscillate for smaller Courant number by verifying
the TVD property. The first part of the proof is the same as before if α is substituted
by γ. Differences occur when proving that
(∗) :=
γ∑i=−∞
∣∣uni−1 − uni−2
∣∣+∣∣∣unβ−s − unγ−1
∣∣∣+∞∑
i=β+1
∣∣uni−s − uni−s−1
∣∣ =∞∑
i=−∞
∣∣uni − uni−1
∣∣ ,because now γ =
⌊α
∆x
⌋and β = γ + s+ 1, so that
(∗) =
γ−1∑i=−∞
∣∣uni − uni−1
∣∣+∣∣unγ+1 − unγ−1
∣∣+∞∑
i=γ+s+2
∣∣uni−s − uni−s−1
∣∣≤
γ−1∑i=−∞
∣∣uni − uni−1
∣∣+∣∣unγ+1 − unγ
∣∣+∣∣unγ − unγ−1
∣∣+∞∑
i=γ+2
∣∣uni − uni−1
∣∣=
∞∑i=−∞
∣∣uni − uni−1
∣∣ .Consider now again the modified upwind method. For xi ≤ γ and xi ≥ β′, the value un+1
i
can be computed in the same way as derived in case 1 and 3 before, only the case γ < xi <
β′ has to be treated differently. The easiest but therefore less accurate ansatz is to make
a linear interpolation as before and use the data points (xγ−1, unγ−1) and (xγ+1, u
nγ+1) to
cover both intervals [xγ−1, xγ) and [xγ , xγ+1) where the characteristic through (xi, tn+1)
might reach the point (x∗, tn). In section 2.2.1, x∗ was already determined as
x∗ =
(1− a1
a2
)α+
a1
a2xi − a1∆t.
The interpolation polynomial is
unγ+1 +unγ+1 − unγ−1
xγ+1 − xγ−1(x∗ − xγ+1) = unγ+1 +
x∗ − xγ+1
2∆x(unγ+1 − unγ−1),
2 The advection equation with non constant velocity 41
so that
un+1i = unγ+1 +
x∗ − xγ+1
2∆x(unγ+1 − unγ−1)
= unγ+1 +
(1− a1
a2
)α+ a1
a2xi − a1∆t− xγ+1
2∆x(unγ+1 − unγ−1)
= unγ+1 +1
2
((1− 1
s
)α
∆x+i
s− ν − γ − 1
)(unγ+1 − unγ−1),
which overall yields
un+1i =
uni − ν(uni − uni−1), if i ≤ γ,
unγ+1 + 12
((1− 1
s
)α
∆x + is − ν − γ − 1
)(unγ+1 − unγ−1), if γ < i < β′,
uni−dsνe + (dsνe − sν)(uni−dsνe+1 − uni−dsνe), if i ≥ β′.
As a somewhat more efficient approach, one could as well determine beforehand, for
which i ∈ (γ, β′) the value un+1i should be computed via (xγ−1, u
nγ−1) and (xγ , u
nγ ), or
via (xγ , unγ ) and (xγ+1, u
nγ+1). This depends on x∗, if x∗ < γ, use the first pair and if
x∗ > γ, the second. For x∗ = γ, both yields the same result. These inequalities can be
solved to get
x∗ =
(1− a1
a2
)α+
a1
a2xi − a1∆t < γ
⇔ xi < sγ + sa1∆t+ (1− s)α
⇔ i < sγ + sν + (1− s) α∆x
.
The same computations as before then give
un+1i =
uni − ν(uni − uni−1), if i ≤ γ,
unγ +((
1− 1s
)α
∆x + is − ν − γ
)(unγ − unγ−1), if γ < i ≤ sγ + sν + (1− s) α
∆x ,
unγ +((
1− 1s
)α
∆x + is − ν − γ
)(unγ+1 − unγ ), if sγ + sν + (1− s) α
∆x < i < β′,
uni−dsνe + (dsνe − sν)(uni−dsνe+1 − uni−dsνe), if i ≥ β′.
(2.9)
As for the special case above, the proof of the TVD property for this method is in the
appendix.
2.2.3 The Lax-Wendroff method
The last two sections provided different, simple methods for the solution of the advection
equation with non constant velocity and therefore ensure that a numerical solution can
42 2 The advection equation with non constant velocity
be computed. In the following, these results shall be improved in the sense of gaining
a method of higher order. As before, derive the Lax-Wendroff method and adjust it to
the two cases of a nonuniform and uniform grid by following the characteristics. The
approach of using the ordinary Lax-Wendroff method will not be examined further since
it can be derived similarly to the Upwind method. Furthermore, the aim is to gain a
method that is as accurate as possible and even for the Upwind method, the modified
method yielded somewhat better results.
Nonuniform grid
Consider the situation of section 2.2.1 now without the assumption that the jump lies
on a grid point, that is α ∈ [xγ , xγ+1) with γ =⌊
α∆x1
⌋. For all i /∈ γ, γ + 1, the
stencil of the Lax-Wendroff method lies in an interval of constant step size, so that the
Lax-Wendroff method of section 1.3.3 can be used.
When computing the value un+1γ , only the different step sizes have to be considered.
Interpolate using the data points (xγ+1, tn), (xγ , t
n) and (xγ−1, tn) to get the polynomial
unγ+1 + (unγ+1 − unγ )x∗ − xγ+1
∆x2+
(unγ+1 − unγ
∆x2−unγ − unγ−1
∆x1
)(x∗ − xγ+1)(x∗ − xγ)
∆x1 + ∆x2
where x∗ = γ − a1∆t = γ − ν∆x1, so that
un+1γ = unγ+1 − (unγ+1 − unγ )
ν∆x1 + ∆x2
∆x2
+
(unγ+1 − unγ
∆x2−unγ − unγ−1
∆x1
)(ν∆x1 + ∆x2)ν∆x1
∆x1 + ∆x2
= unγ − (unγ+1 − unγ )ν∆x1
∆x2+
(unγ+1 − unγ
∆x2−unγ − unγ−1
∆x1
)(ν∆x1 + ∆x2)ν∆x1
∆x1 + ∆x2.
For un+1γ+1, the Lax-Wendroff method uses the data points (xγ+2, t
n), (xγ+1, tn) and
(xγ , tn), so that the step size between these points is ∆x2, but now the characteris-
tic crosses the jump. The interpolation polynomial is then the same as in section 1.3.3,
namely
uni+1 +uni+1 − uni
∆x2(x∗ − xi+1) +
uni+1 − 2uni + uni−1
2∆x22
(x∗ − xi+1)(x∗ − xi),
and x∗ =(
1− a1a2
)α+ a1
a2xi−a1∆t with i = γ+1 as in the other situations before where
the characteristic crossed the jump. Together
un+1γ+1 = unγ+2 +
x∗ − xγ+2
∆x2
(unγ+2 − unγ+1
)+
(x∗ − xγ+2)(x∗ − xγ+1)
2∆x22
(unγ+2 − 2unγ+1 + unγ
)
2 The advection equation with non constant velocity 43
where
x∗ − xγ+2 = x∗ − xγ+1 −∆x2
and
(x∗ − xγ+2)(x∗ − xγ+1) = (x∗ − xγ+1)2 −∆x2(x∗ − xγ+1).
Inserting this yields
un+1γ+1 = unγ+2 −
(unγ+2 − unγ+1
)+x∗ − xγ+1
∆x2
(unγ+2 − unγ+1 −
1
2
(unγ+2 − 2unγ+1 + unγ
))+
(x∗ − xγ+1)2
2∆x22
(unγ+2 − 2unγ+1 + unγ
)= unγ+1 +
x∗ − xγ+1
2∆x2
(unγ+2 − unγ
)+
(x∗ − xγ+1)2
2∆x22
(unγ+2 − 2unγ+1 + unγ
)= unγ+1 +
(1− a1
a2
)(α− xγ+1)− ν∆x1
2∆x2
(unγ+2 − unγ
)+
((1− a1
a2
)(α− xγ+1)− ν∆x1
)2
2∆x22
(unγ+2 − 2unγ+1 + unγ
).
Overall, the Lax-Wendroff method for a nonuniform grid is then defined as
un+1i =
uni − (uni+1 − uni )ν∆x1∆x2
+(uni+1−uni
∆x2− uni −uni−1
∆x1
)(ν∆x1+∆x2)ν∆x1
∆x1+∆x2, if i = γ,
uni +
(1−a1
a2
)(α−xi)−ν∆x1
2∆x2
(uni+1 − uni−1
)+
((1−a1
a2
)(α−xi)−ν∆x1
)2
2∆x22
(uni+1 − 2uni + uni−1
), if i = γ + 1,
uni − ν2
(uni+1 − uni−1
)+ν2
2
(uni+1 − 2uni + uni−1
), else.
Uniform grid
The difference between the upwind method and the Lax-Wendroff method on a uniform
grid is the higher order interpolation. Since the step size ∆x is now constant, the
interpolation polynomial for three arbitrary data points (xi−1, tn), (xi, t
n) and (xi+1, tn)
44 2 The advection equation with non constant velocity
has the form
uni+1 + (uni+1 − uni )x∗ − xi+1
∆x+ (uni+1 − 2uni + uni−1)
(x∗ − xi+1)(x∗ − xi)2∆x2
=uni+1 + (uni+1 − uni )x∗ − xi −∆x
∆x+ (uni+1 − 2uni + uni−1)
(x∗ − xi)2 −∆x(x∗ − xi)2∆x2
=uni +
((uni+1 − uni )− 1
2(uni+1 − 2uni + uni−1)
)x∗ − xi
∆x+ (uni+1 − 2uni + uni−1)
(x∗ − xi)2
2∆x2
=uni + (uni+1 − uni−1)x∗ − xi
2∆x+ (uni+1 − 2uni + uni−1)
(x∗ − xi)2
2∆x2.
According to the cases examined in section 2.2.2, the corresponding data points and x∗
have to be inserted. Note again that α ∈ [xγ , xγ+1), γ =⌊
α∆x1
⌋and β′ =
⌈α+a2∆t
∆x
⌉=⌈
α∆x + sν
⌉with s = a2
a1.
The first case, i ≤ γ, is not affected by the jump, so that the ordinary Lax-Wendroff
method with (xi−1, tn), (xi, t
n), (xi+1, tn) and x∗ = xi − a1∆t can be used with
un+1i = uni −
ν
2
(uni+1 − uni−1
)+ν2
2
(uni+1 − 2uni + uni−1
).
The second case, γ < i < β′, was subdivided into the two cases where the intervals
[xγ−1, xγ ] and [xγ , xγ+1] were differentiated. This is no longer necessary when using
three data points for the interpolation as both intervals are covered by one interpolation
polynomial. Thus, choose (xγ−1, tn), (xγ , t
n) and (xγ+1, tn), while the point x∗ remains
x∗ =(
1− a1a2
)α+ a1
a2xi − a1∆t as before. The result is then
un+1i = unγ + (unγ+1 − unγ−1)
x∗ − xγ2∆x
+ (unγ+1 − 2unγ + unγ−1)(x∗ − xγ)2
2∆x2
= unγ +1
2
((1− a1
a2
)α
∆x+i
s− ν − γ
)(unγ+1 − unγ−1)
+1
2
((1− a1
a2
)α
∆x+i
s− ν − γ
)2
(unγ+1 − 2unγ + unγ−1).
In the third case, i ≥ β′, the higher velocity had to be considered, so the data points
(xi−dsνe, tn) and (xi−dsνe+1, t
n) and x∗ = xi− a2∆t = xi− sν∆x were used. Now adding
(xi−dsνe−1, tn) yields
un+1i = uni−dsνe + (uni−dsνe+1 − u
ni−dsνe−1)
x∗ − xi−dsνe2∆x
+ (uni−dsνe+1 − 2uni−dsνe + uni−dsνe−1)(x∗ − xi−dsνe)2
2∆x2
= uni−dsνe +1
2(dsνe − sν)(uni−dsνe+1 − u
ni−dsνe−1)
+1
2(dsνe − sν)2(uni−dsνe+1 − 2uni−dsνe + uni−dsνe−1).
2 The advection equation with non constant velocity 45
Altogether, the thus obtained Lax-Wendroff method on a uniform grid is
un+1i =
uni − ν2
(uni+1 − uni−1
)+ ν2
2
(uni+1 − 2uni + uni−1
), if i ≤ γ,
unγ + 12
((1− a1
a2
)α
∆x + is − ν − γ
)(unγ+1 − unγ−1)
+12
((1− a1
a2
)α
∆x + is − ν − γ
)2(unγ+1 − 2unγ + unγ−1), if γ < i < β′,
uni−dsνe + 12(dsνe − sν)(uni−dsνe+1 − u
ni−dsνe−1)
+12(dsνe − sν)2(uni−dsνe+1 − 2uni−dsνe + uni−dsνe−1), if i ≥ β′.
It was explained in section 1.3.3 that the Lax-Wendroff method for the constant coeffi-
cient advection equation generates oscillations if the initial condition is not sufficiently
smooth, therefore it is not TVD. The same holds then for the above methods since
they are essentially the same method, only on a different grid with different advection
velocities. For this reason, the methods will not be examined analytically but rather
computationally, which is the content of the next section.
2.3 Comparison and evaluation of the derived methods
The aim of this section is to gain a better understanding of the influence of the initial
condition and the jump in advection velocity on the numerical solution. Theoretically,
the Lax-Wendroff method is of higher order than the upwind method and should there-
fore yield better results. Practically, this might not be the case as soon as the solution
is no longer differentiable, which is nearly always the case at the jump in velocity. Bear
in mind that the exact solution of the advection equation is simply the initial condition
shifted along the spatial axis. If now a non constant part of the initial condition crosses
the jump, the difference in velocity results in the creation of a kink in the solution. An
example for this can be found in figure 2.2 of section 2.1.
Consider now three different situations.
• A sufficiently smooth initial condition without extrema where the jump creates a
minimal kink in the solution.
• A smooth initial condition with extrema where the jump creates a minimal kink
in the solution.
• An initial condition with extrema where the jump creates a much sharper kink in
the solution.
46 2 The advection equation with non constant velocity
Because of such a kink in the solution, one would expect the order of the upwind and
the Lax-Wendroff method to reduce from the first to the third case. Furthermore, the
order of the Lax-Wendroff method should decrease more than that of the upwind method
because of the extrema.
To verify this assumption, examine an example for each situation stated above. The
Courant number is given as ν = 0.9, the velocity as a1 = 0.1 and a2 = 1, the spatial
interval is [0, 1000] and the temporal one [0, T ] with T =(αa1
+ 1000−αa2
)/2. The initial
conditions are then defined in the following way.
1. A part of the arctan, u0(x) = arctan (0.01(x− 100))+ π2 , with the jump at x = 800,
where the function appears nearly constant. This is the same example as was used
to illustrate the order of the upwind and Lax-Wendroff method without a jump in
section 1.3.1 and 1.3.3.
2. A sine wave, u0(x) = sin(
2πx1000
), with the jump at the maximum x = 250, so that
mostly the part with almost zero slope passes the jump.
3. The same sine wave, u0(x) = sin(
2πx1000
), with the jump at x = 500.
The solution to all three examples is depicted in figure 2.9. It is computed with both
the upwind and the Lax-Wendroff method on a uniform and a nonuniform grid. As a
boundary condition at x = 0, assume for simplicity that the initial conditions above are
valid for x ≤ 0 and that the corresponding value un0 is known at all times. Furthermore,
for the Lax-Wendroff method, compute the value at the right boundary with the upwind
method instead. The following figures show the logarithmic error plots with step size
10i/20 for i = −20, . . . , 20.
Consider first how the error is computed. It should foremost be noted that the computed
order of the method is the slope of the least squares approximation to the error values.
If the error values lie almost on a straight line, this slope is a good approximation to the
order. If there are greater fluctuations in the set of all error values, the approximation
might be much less exact. A small difference between the computed slopes therefore
does not necessarily mean that one method is of higher order than the other.
Another factor that influences the error values and the computed order is the definition
of the grid. In case the jump lies on a grid point, the grid is constructed around the
jump, that means that the jump is fixed as a grid point and the other grid points are
constructed to the left and right of it with the corresponding step size up to the boundary
of the spatial interval. This approach is generally not used in praxis. Usually, the first
grid point is the left boundary of the spatial interval and the others are defined according
2 The advection equation with non constant velocity 47
(1) 0 200 400 600 800 1000
1
2
3
time t=0
0 200 400 600 800 1000
1
2
3
time t=100
0 200 400 600 800 1000
1
2
3
time t=300
(2) 0 200 400 600 800 10001
0
1
time t=0
0 200 400 600 800 10001
0
1
time t=30
0 200 400 600 800 10001
0
1
time t=60
(3) 0 200 400 600 800 10001
0
1
time t=0
0 200 400 600 800 10001
0
1
time t=10
0 200 400 600 800 10001
0
1
time t=100
Figure 2.9: Solution of the three examples at different times.
to the step size. Whether the jump then lies on a grid point or not depends on the step
size. One result of this construction of the grid is that the grid points do not always
coincide and the error is computed at different points of the spatial interval, which leads
to the observed fluctuations. The second result is that the ratio of the number of grid
points and the step size is not constant. Take the given interval [0, 1000] with step size
∆x = 100. If the jump were to lie at x = 500, there would be the eleven grid points
48 2 The advection equation with non constant velocity
0, 100, . . . , 1000, whereas there would only be the ten grid points 50, 150, . . . , 950 if the
jump would lie at x = 550. Therefore, the number of grid points can vary, which is not
considered in the computation of the error and is another reason why the fluctuations
occur that can be seen in the figures. This effect is worse if the grid is constructed so
that the jump lies on a grid point because then not only the distance of the last grid
point to the boundary of the interval, but also the first grid point influences the number
of grid points. Figure 2.10 illustrates this for the first example by comparing the uniform
and nonuniform modified upwind method for different definitions of the grid.
1 0.5 0 0.5 1
3
2
1
0
1
example 1, uniform modified Upwind, jump on grid point
least squares approximation(slope 0.9938)error
1 0.5 0 0.5 1
3
2
1
0
1
example 1, nonuniform modified Upwind, jump on grid point
least squares approximation(slope 0.9938)error
1 0.5 0 0.5 1
3
2
1
0
1
example 1, uniform modified Upwind, jump between grid points
least squares approximation(slope 1.0067)error
1 0.5 0 0.5 1
3
2
1
0
1
example 1, nonuniform modified Upwind, jump between grid points
least squares approximation(slope 1.0056)error
Figure 2.10: Error plots for example 1 with the modified Upwind method.
Note that all of the methods can be adjusted to the more general case of an advection
equation with arbitrary, piecewise constant velocity. This would require an additional
distinction by cases for each jump and the grid could no longer be constructed so that all
2 The advection equation with non constant velocity 49
jumps lie on a grid point. Furthermore, the case where the velocity decreases at a jump
would need to be examined as well. The approach is analogue, but somewhat easier,
since at most one characteristic through a grid point crosses the jump in a time step.
This fact is verified in figure 2.11. In the uniform case, the method has to be constructed
so that the border between bigger and smaller stencil lies on the grid point to the right
of the jump. For the nonuniform case, the ordinary upwind method can be used where
the grid has to be constructed as in the figure.
t n+1
t n x
t n+1
t n x
Figure 2.11: The grid points and corresponding characteristics on a uniform and nonuni-
form grid for a decreasing advection velocity.
Thus, there are two reasons why the methods for which the jump lies between grid points
should be preferred and are used solely in the following. First, the greater oscillations in
the error values and second, the fact that the grid has to be constructed independently
of the jump to generalize the method for more than one jump.
Consider now the error plots in the three figures 2.12, 2.13 and 2.14. It should be noted
that the slope for the upwind method has approximately the value one in all cases al-
though a kink arises in the solution due to the jump. For the example in figure 1.10,
the discontinuity in the initial condition led to the slope of the upwind method falling
to 0.6. The only difference between these two situations is that the kink is now only
a discontinuity in the derivative, whereas it was a discontinuity in the solution itself in
the other example. This leads to the assumption that the upwind method yields good
results as long as there are no discontinuities in the initial condition.
Observe as well that for a nonuniform grid, there is no difference between the upwind
and the modified upwind method as mentioned when deriving the two. On a uniform
grid on the other hand, the modified method yields much better results since the order
is slightly higher, the error for each step size is smaller and there are less oscillations in
the error values. With the solution for example 1 being nearly smooth, this is hardly
noticeable but for example 2 and 3 it can be seen clearly. The reason lies mostly in the
50 2 The advection equation with non constant velocity
1 0.5 0 0.5 1
3
2
1
0
1
example 1, uniform Upwind
least squares approximation(slope 1.0082)error
1 0.5 0 0.5 1
3
2
1
0
1
example 1, nonuniform Upwind
least squares approximation(slope 1.0056)error
1 0.5 0 0.5 1
3
2
1
0
1
example 1, uniform modified Upwind
least squares approximation(slope 1.0067)error
1 0.5 0 0.5 1
3
2
1
0
1
example 1, nonuniform modified Upwind
least squares approximation(slope 1.0056)error
1 0.5 0 0.5 1
3
2
1
0
1
example 1, uniform modfied Lax Wendroff
least squares approximation(slope 1.3550)error
1 0.5 0 0.5 1
3
2
1
0
1
example 1, nonuniform modified Lax Wendroff
least squares approximation(slope 1.0937)error
Figure 2.12: Error plots for example 1.
2 The advection equation with non constant velocity 51
1 0.5 0 0.5 1
2
1
0
1
example 2, uniform Upwind
least squares approximation(slope 1.0108)error
1 0.5 0 0.5 1
2
1
0
1
example 2, nonuniform Upwind
least squares approximation(slope 1.0178)error
1 0.5 0 0.5 1
2
1
0
1
example 2, uniform modified Upwind
least squares approximation(slope 1.0530)error
1 0.5 0 0.5 1
2
1
0
1
example 2, nonuniform modified Upwind
least squares approximation(slope 1.0178)error
1 0.5 0 0.5 1
2
1
0
1
example 2, uniform modified Lax Wendroff
least squares approximation(slope 1.2725)error
1 0.5 0 0.5 1
2
1
0
1
example 2, nonuniform modified Lax Wendroff
least squares approximation(slope 1.1319)error
Figure 2.13: Error plots for example 2.
52 2 The advection equation with non constant velocity
1 0.5 0 0.5 1
2
1
0
1
example 3, uniform Upwind
least squares approximation(slope 0.9809)error
1 0.5 0 0.5 1
2
1
0
1
example 3, nonuniform Upwind
least squares approximation(slope 1.0144)error
1 0.5 0 0.5 1
2
1
0
1
example 3, uniform modified Upwind
least squares approximation(slope 1.0033)error
1 0.5 0 0.5 1
2
1
0
1
example 3, nonuniform modified Upwind
least squares approximation(slope 1.0144)error
1 0.5 0 0.5 1
2
1
0
1
example 3, uniform modified Lax Wendroff
least squares approximation(slope 1.1248)error
1 0.5 0 0.5 1
2
1
0
1
example 3, nonuniform modified Lax Wendroff
least squares approximation(slope 1.0398)error
Figure 2.14: Error plots for example 3.
2 The advection equation with non constant velocity 53
somewhat lesser accuracy around the jump as depicted in figure 2.7, which corresponds
to the third example.
The modified Lax-Wendroff method, while still of higher order than the ordinary and
modified upwind method, reaches at most the order 1.355 in example 1 where the jump
resulted in only a small kink in the solution. For this example, the difference between the
uniform and nonuniform Lax-Wendroff method is rather conspicuous as it is too high to
be a result of the fluctuations in the error terms. In fact, the nonuniform methods yield
in all cases nearly the same or a smaller slope than the corresponding uniform methods.
The reason for this is the bigger step size ∆x2, the solution to the right of the jump is
computed with a bigger step size and is less accurate. While the error is computed by
weighting the error of one point in time and space with the corresponding step size so
that the difference in ∆x is considered, the lesser accuracy of the solution is neglected.
For this reason, the error is additionally smaller for the uniform methods, even if the
slope is nearly the same. An example for this are the solutions of the upwind method in
figures 2.13 and 2.14 where the jump lies between grid points.
The only advantage of the nonuniform method over the uniform one is that the bigger
step size needs fewer computations and is computationally less expensive. The nonuni-
form method should be preferred in a situation where the initial condition is sufficiently
smooth, so that the lesser accuracy on the area with bigger step size does not result in
a much higher error.
Regarding the choice between upwind and Lax-Wendroff method, consider the advan-
tage of the higher order against the disadvantage of the higher computational complexity.
Compare the error plots for the uniform Lax-Wendroff method for the three examples.
The sharper the kink that was created by the jump, the lesser became the order of the
method. Since there are very few cases where the initial condition would be shaped so
that only a small or no kink would arise with time, the upwind methods seems to be
better suited for this situation.
3 Nonlinear partial differential equations
This chapter is based on the theory that was presented in section 1.2 and elaborates on
the nonlinear case as described in [11] and [12]. Until now, only the advection equation
and numerical methods for its solution were examined. Use the acquired results now to
study the solution of other, nonlinear equations and derive corresponding methods.
3.1 Analysis of nonlinear equations
Consider the conservation law
∂
∂tu(x, t) +
∂
∂xf(u(x, t)) = 0 (3.1)
where f(u) is now a nonlinear function of u. The so-called quasilinear form of this
equation is given by differentiating f , so that
∂
∂tu(x, t) + f ′(u(x, t))
∂
∂xu(x, t) = 0
if f is smooth. Use this form to get a better idea of the solution of the equation. As
was done for the advection equation in section 1.1.1, determine the characteristics X(t)
of the equation under the assumption that u(x, t) is smooth. It holds
d
dtu(X(t), t) = ut(X(t), t) +X ′(t)ux(X(t), t) = 0
⇔ X ′(t) = f ′ (u(X(t), t)) ,
so that u(x, t) is constant along the characteristics. Furthermore, because X ′(t) =
f ′ (u(X(t), t)) = f ′(const) = const, X(t) is a straight line. While this agrees with the
properties of the advection equation, the crucial difference lies in the slope of the char-
acteristics. For the advection equation, all characteristics had slope a. For an arbitrary
equation they have a constant slope f ′(u(X(t), t)) which is different for each character-
istic though. For this reason, the characteristics may cross each other over time, so that
shock formations arise and the solution can no longer be traced by the characteristics
as was done for the advection equation. This will later be examined further.
55
56 3 Nonlinear partial differential equations
At first, note that the solution can still be determined analytically under certain assump-
tions. Consider for this a smooth initial condition u(x, 0) = u0(x) and a sufficiently small
time interval [0, T ] in which the characteristics do not collide and the solution remains
smooth. The characteristic X(t) through a point (x, 0) has the slope
f ′(u(X(t), t)) = f ′(u(x, 0)) = f ′(u0(x)),
so that the characteristic itself is given by
X(t) = x+ f ′(u0(x))t.
For the solution this means that
u(x, t) = u0(x) with x = x+ f ′(u0(x))t (3.2)
for every (x, t) with t ∈ [0, T ]. If T is chosen so that the characteristics do cross, then
(3.2) has no unique solution and the solution of the differential equation can no longer
be computed by means of the characteristics.
There are basically three ways in which the initial condition can change over time. The
first possibility is that the characteristics do not cross on a certain area, but rather
fan out. This results in a so-called rarefaction wave, that means that the value of the
solution in the area is rarefied. The other possibility is the exact opposite where the
value is compressed by the characteristics converging, which generates a compression
wave. The merging or crossing of the characteristics creates shock waves across which
the solution becomes discontinuous.
The problems that therefore arise when dealing with nonlinear equations, is that there
is possibly more than one solution and that these solutions are no longer smooth, so
that they do not fulfill the differential equation at discontinuities. This motivates the
definition of weak solutions, which only fulfill the integral form of the conservation law
and not the differential one. Under the assumption that the solution u is smooth, start
with multiplying the differential equation with a test function φ(x, t) ∈ C10 , which is a
continuous function with compact support, and integrate over time and space, so that∫ ∞0
∫ ∞−∞
(ut + f(u)x)φ(x, t) dx dt = 0.
Now use integration by parts to transfer the derivatives to φ
0 =
∫ ∞0
∫ ∞−∞
(ut + f(u)x)φ(x, t) dx dt
= −∫ ∞
0
∫ ∞−∞
(uφt + f(u)φx) dx dt+
∫ ∞−∞
[uφ]∞0 dx+
∫ ∞0
[f(u)φ]∞−∞dt.
3 Nonlinear partial differential equations 57
Since φ has compact support, it is zero at infinity, so it holds∫ ∞0
∫ ∞−∞
(uφt + f(u)φx) dx dt = −∫ ∞−∞
u(x, 0)φ(x, 0) dx.
The function u that satisfies this equation is then called a weak solution of the differential
equation.
This weak solution can be used to determine the speed s with which a shock propagates
with time. It can be computed by examining the Riemann problem on a sufficiently
small interval around the shock, so that the initial condition for the problem is given by
ul and ur where ul is the value to the left of the shock and ur the one to the right. The
Rankine-Hugoniot condition gives the shock speed as
s =f(ul)− f(ur)
ul − ur. (3.3)
The problem with the concept of weak solutions is that they are not necessarily unique
while one would assume that the differential equation describes a physical situation that
is unique. To check which of the possible weak solutions is the right one in the sense of
its physical meaning, consider different so-called entropy conditions. One example is the
entropy condition by Lax, which states that for convex f , the shock speed must fulfill
f ′(ul) > s > f ′(ur).
There exist several more approaches to finding weak solutions and proving that they are
physically admissible; they can for example be found in [12] and will not be elaborated
here further.
3.1.1 Burgers equation
Exemplify the above theory by means of the inviscid Burgers equation
ut +
(1
2u2
)x
= 0
with f(u) = 12u
2. It can be written in the quasilinear form
ut + uux = 0
and has the characteristics
X(t) = x+ u0(x)t.
58 3 Nonlinear partial differential equations
Therefore, if u0 is monotonically increasing, the characteristics fan out and never cross.
In this case, the solution of the equation is unique at all times and is given implicitly by
u(x, t) = u0(x− u0(x)t).
Figure 3.1(a) shows this case for the example of u0(x) = arctan(x). On the other hand, if
u0 is monotonically decreasing on an arbitrary small interval, the characteristics at this
interval cross at some point and only a weak solution of the equation can be found. Such
a situation can be illustrated by considering u0(x) = − arctan(x) as in figure 3.1(b).
(a) (b)
Figure 3.1: The initial condition and some corresponding characteristics for
(a) u0(x) = arctan(x) and (b) u0(x) = − arctan(x).
Both examples will be used later on in this chapter to examine the numerical method
which will be introduced in the following sections.
3.2 Numerical methods for nonlinear equations
The derivation of numerical methods for nonlinear differential equations is more difficult
than for the linear case, because in most cases, there exists no unique solution and the
method should converge to the right weak solution.
A standard example where this is not the case is given in [11] as the Riemann problem
u0i =
1, for i < 0,
0, for i ≥ 0
3 Nonlinear partial differential equations 59
for Burger’s equation. Adjusting the upwind method of section 1.3.1 to the nonlinear
case yields
un+1i = uni −
∆t
∆xuni (uni − uni−1),
which results in uni = u0i for all i and n, so that the solution converges to u0, which is
no weak solution.
A numerical method for a nonlinear equation should hence have the properties described
in section 1.2.1 and compute the right weak solution, so it should fulfill some entropy
condition. Note that the CFL condition is still a necessary condition for stability, but it
is now given by ∣∣∣∣∆t
∆xf ′(u)
∣∣∣∣ ≤ 1 for the solution u of (3.1), (3.4)
since information propagates with the slope of the characteristics, which is f ′.
For systems of equations, f ′(u) is replaced by the biggest eigenvalue λmax of the Jacobian
f ′. The reason for this is that the equation
ut + f ′(u)ux = 0
can be written as
vpt + λpvpx = 0, for p = 1 . . .m
with f ′ = R diag(λ1, . . . , λm)R−1 and R−1u =: v as described in section 1.1.1.
Since f ′ depends on u and is not necessarily monotone, the value un+1i can either depend
on a value to the right or to the left. For this reason, an upwind method as used up
to now does not seem to be the best approach. The next section introduces a better
alternative for this situation.
3.2.1 The Lax-Friedrichs method
According to the above explanation, the stencil of a method for solving nonlinear equa-
tions should be centered. Under this condition, the easiest choice is to use the two
points directly to the left and right. Thus, the Lax-Friedrichs method is derived by first
choosing the numerical flux as
Fni−1/2 =1
2(f(uni−1) + f(uni ))
60 3 Nonlinear partial differential equations
and then replacing uni by the average 12(uni+1 + uni−1), so that
un+1i =
1
2(uni+1 + uni−1)− ∆t
2∆x(f(uni ) + f(uni+1)− f(uni−1)− f(uni ))
=1
2(uni+1 + uni−1)− ∆t
2∆x(f(uni+1)− f(uni−1)) (3.5)
and the flux is then given by
Fni−1/2 = F(uni−1, uni ) =
1
2
(f(uni−1) + f(uni )
)− ∆x
2∆t(uni − uni−1).
In order to examine the order of the method, consider again the local truncation error for
the special case of the advection equation, as was done for the upwind and Lax-Wendroff
method in chapter 1. For the Lax-Friedrichs method, the error is defined as
L(xi, tn) =1
∆t
[1
2(u(xi+1, tn) + u(xi−1, tn))
− ∆t
2∆x(au(xi+1, tn)− au(xi−1, tn))− u(xi, tn+1)
].
Apply Taylor series expansion to replace u(xi+1, tn), u(xi−1, tn) and u(xi, tn+1) by
u(xi±1, tn) = u(xi, tn)±∆xux(xi, tn) +1
2∆x2uxx(xi, tn) +O(∆x3),
u(xi, tn+1) = u(xi, tn) + ∆t ut(xi, tn) +1
2∆t2utt(xi, tn) +O(∆t3)
in the local truncation error so that
L(xi, tn) =1
∆t
[1
2
(2u(xi, tn) + ∆x2uxx(xi, tn) + 2O(∆x3)
)− a∆t
2∆x(2∆xux(xi, tn))
−u(xi, tn)−∆t ut(xi, tn)− 1
2∆t2utt(xi, tn)−O(∆t3)
]=
1
∆t
[1
2∆x2uxx(xi, tn) +O(∆x3)− a∆t ux(xi, tn)
−∆t ut(xi, tn)− 1
2∆t2utt(xi, tn)−O(∆t3)
]=
∆x2
2∆tuxx(xi, tn) +
1
∆tO(∆x3)− aux(xi, tn)
− ut(xi, tn)− 1
2∆t utt(xi, tn)−O(∆t2).
Now, use that
ut = −aux ⇒ utt = a2uxx
3 Nonlinear partial differential equations 61
for the advection equation so that the first order derivatives cancel each other out. Then,
the error has the form
L(xi, tn) =∆x2
2∆tuxx(xi, tn)− 1
2a2∆t uxx(xi, tn) +O(∆x2,∆t2)
=1
2∆t
(∆x2
∆t2− a2
)uxx(xi, tn) +O(∆x2,∆t2).
At this point, the Lax-Friedrichs method differs from the upwind and Lax-Wendroff
method that where of first and second order respectively. A reduction of either the
spatial or time step size resulted in a more accurate solution as long as the step sizes
fulfilled the CFL condition. For the Lax-Friedrichs method, this is no longer the case.
If the spatial step size is constant,
lim∆t→0
∆t
(∆x2
∆t2− a2
)= lim
∆t→0
(∆x2
∆t−∆ta2
)=∞
and the method diverges for decreasing ∆t. Therefore, the relation between ∆t and ∆x
has to be fixed so that ∆x∆t is constant. In that case, the above limit changes to
lim∆t→0
∆t
(∆x2
∆t2− a2
)= lim
∆t→0C∆t = 0
for some constant C and the method converges with first order accuracy. The step
size ∆t that results in the most accurate solution can be determined by minimizing
∆t(
∆x2
∆t2− a2
). The CFL condition states that ∆t ≤ ∆x
a so that
∆x2
∆t−∆ta2 ≥ ∆x2
∆xa
− ∆x
aa2 = 0.
Therefore, the time step size should be chosen as big as the CFL condition allows.
As a further property, the Lax-Friedrichs method is TVD, which can be proved as follows.
TV (un+1) =∑i∈Z
∣∣un+1i − un+1
i−1
∣∣=∑i∈Z
∣∣∣∣12(uni+1 + uni−1)− ∆t
2∆x(f(uni+1)− f(uni−1))
−1
2(uni + uni−2) +
∆t
2∆x(f(uni )− f(uni−2))
∣∣∣∣=∑i∈Z
∣∣∣∣12(uni+1 − uni −
∆t
∆x(f(uni+1)− f(uni ))
+uni−1 − uni−2 +∆t
∆x(f(uni−1)− f(uni−2))
)∣∣∣∣ .
62 3 Nonlinear partial differential equations
The mean value theorem states
f(uni+1)− f(uni ) = f ′(ξi+1/2)(uni+1 − uni ), for ξi+1/2 ∈ [uni , uni+1],
so that
TV (un+1) =∑i∈Z
∣∣∣∣(1
2−
∆tf ′(ξi+1/2)
2∆x
)(uni+1 − uni )
+
(1
2+
∆tf ′(ξi−2+1/2)
2∆x
)(uni−1 − uni−2)
∣∣∣∣ .Because of the CFL condition (3.4),∣∣∣∣∆tf ′(ξj+1/2)
2∆x
∣∣∣∣ ≤ 1
2for arbitrary j ∈ Z
and therefore
TV (un+1) ≤∑i∈Z
(1
2−
∆tf ′(ξi+1/2)
2∆x
) ∣∣uni+1 − uni∣∣
+∑i∈Z
(1
2+
∆tf ′(ξi−2+1/2)
2∆x
) ∣∣uni−1 − uni−2
∣∣=∑i∈Z
(1
2−
∆tf ′(ξi−1+1/2)
2∆x
) ∣∣uni − uni−1
∣∣+∑i∈Z
(1
2+
∆tf ′(ξi−1+1/2)
2∆x
) ∣∣uni − uni−1
∣∣=∑i∈Z
∣∣uni − uni−1
∣∣ = TV (un).
Consider again the example of Burgers equation with the initial condition u0(x) =
± arctan(x). Figure 3.1 suggests that for u0(x) = arctan(x) a rarefaction wave occurs.
This is indeed the case as figure 3.2 shows.
The initial condition u0(x) = − arctan(x) should, according to the characteristics, result
in a compression wave that becomes a shock with time. This shock then propagates
with the speed s given by the Rankine-Hugoniot condition in (3.3), so that
s =f(ul)− f(ur)
ul − ur=
12u
2l −
12u
2r
ul − ur=
1
2(ul + ur) = 0
since ul = −ur for the initial condition. The solution should therefore converge to
u(x, t) =
π2 , for x < 0,
−π2 , for x > 0,
3 Nonlinear partial differential equations 63
0100 1002
0
2
0 1001002
0
2
0 1001002
0
2
Figure 3.2: The solution to Burgers equation with initial condition u0(x) = arctan(x) at
different time steps.
0 1001002
0
2
0 1001002
0
2
0 1001002
0
2
Figure 3.3: The solution to Burgers equation with initial condition u0(x) = − arctan(x)
at different time steps.
which is displayed in figure 3.3.
Analogously, if the initial condition where of the form u0(x) = − arctan(x) + c for some
constant c, the shock would propagate with speed c. A problem that should be noted
is that in cases like this, the step size ∆x has to be sufficiently small. Take for example
the initial condition on the interval [−100, 100] with step size ∆x = 10. The result of
the low accuracy is that the solution after one time step is too different from the real
solution and thus evolves differently.
64 3 Nonlinear partial differential equations
3.3 Nonlinear equations with spatially varying, discontinuous
flux function
Extend the analysis now to equations like (3.1) with the addition of a discontinuous,
space dependent coefficient
a(x) =
a1, if x ≤ α,
a2, if x ≥ α
in the flux where it is assumed that 0 < a1 ≤ a2. The differential equation then has the
form
∂
∂tu(x, t) + a(x)
∂
∂xf(u(x, t)) = 0, (3.6)
or alternatively the quasilinear form
∂
∂tu(x, t) + a(x)f ′(u(x, t))
∂
∂xu(x, t) = 0.
Such equations are difficult to handle since some of the existing theory for nonlinear
equations does not apply. As a matter of fact, this situation is not yet completely
understood and there are many unanswered questions. For example, it is not possible to
use the concept of entropy solutions and thus to guarantee convergence to the right weak
solution as before. For this reason, the theoretical aspects are from now on neglected.
However, it is still possible to compute the characteristics as in the autonomous case in
section 3.1, as long as they do not cross the jump where they kink. The slope is then
given as
X ′(t) = a(X(t))f ′ (u(X(t), t)) ,
so that the characteristic through the point (x, 0) is
X(t) = x+ a(x)f ′(u0(x))t
for x ≤ α and X(t) ≤ α so that a(x) = a1, or for x ≥ α and X(t) ≥ α so that a(x) = a2.
If the characteristic does cross the jump, distinguish the two cases x ≤ α and x ≥ α. For
x ≤ α, the first part of the characteristic has a slope with the factor a1 and the second
part with a2. Therefore
X(t) = x+ a1f′(u0(x))t∗ + a2f
′(u0(x))(t− t∗)
3 Nonlinear partial differential equations 65
with
x+ a1f′(u0(x))t∗ = α ⇔ t∗ =
α− xa1f ′(u0(x))
.
The case x ≥ α is the same for interchanged values of a, that is
X(t) = x+ a2f′(u0(x))t∗ + a1f
′(u0(x))(t− t∗)
with
t∗ =α− x
a2f ′(u0(x)).
For the advection equation, the change of the characteristics had a great impact on the
solution of the equation in the sense that it contained a kink that was not part of the
initial condition. For the nonlinear case, the kink in the characteristics creates such a
kink in the solution as well, but this is of less importance now if a problem where a
shock is generated by the crossing of characteristics is considered. Figure 3.4 shows the
same example of figure 3.1 with the addition of the coefficient a(x). For example (a), the
kink in the characteristics creates a kink in the solution while the solution would remain
smooth otherwise. In example (b), the jump does not make a big difference, apart from
the fact that the characteristics converge sooner.
The influence of the factor a on the shape of the characteristics has to be considered for
the CFL condition as well. Therefore, take the CFL condition (3.4) and add the factor
a, yielding ∣∣∣∣∆t
∆xaf ′(u)
∣∣∣∣ ≤ 1 for the solution u of (3.6). (3.7)
How to choose the time and spatial grid specifically depends on the choice between a
uniform and nonuniform grid as in chapter 2. The adjustment of the Lax-Friedrichs
method for these two cases is the content of the next section. Note that the approach
of modifying the method by following the characteristics, as was done in section 2.2, is
now no longer possible, because the slope of the characteristic through a point (xi, tn+1)
is no longer known.
3.3.1 The Lax-Friedrichs method on a nonuniform grid
Use the results of section 2.2.1 to derive the Lax-Friedrichs method on a nonuniform
grid. Define a piecewise constant step size
∆x =
∆x1, if x ≤ α,
∆x2 = a2a1
∆x1, if x ≥ α.
66 3 Nonlinear partial differential equations
(a) (b)
Figure 3.4: The initial condition and some corresponding characteristics for the modified
Burger’s equation ut + a(x)uux = 0 with a1 = 0.5 and a2 = 1 and the initial
condition (a) u0(x) = arctan(x) and (b) u0(x) = − arctan(x). The vertical
line marks the jump across which the characteristics kink.
The CFL condition then determines ∆t with∣∣∣∣ ∆t
∆xiai max f ′
∣∣∣∣ =∆t
∆xiai max
∣∣f ′∣∣ =: ν ≤ 1 for i = 1, 2,
so that
∆t =ν∆x1
a1 max |f ′|=
ν∆x2
a2 max |f ′|.
Now one can simply use the Lax-Friedrichs method (3.5) with the addition of the coef-
ficient a(x). Denote again γ =⌊
α∆x1
⌋with α ∈ [xγ , xγ+1) the grid point where the step
size changes. To the left of the jump with x ≤ xγ−1,
un+1i =
1
2(uni+1 + uni−1)− a1∆t
2∆x1(f(uni+1)− f(uni−1)).
Analogously, to the right with x ≥ xγ+1, it holds that
un+1i =
1
2(uni+1 + uni−1)− a2∆t
2∆x2(f(uni+1)− f(uni−1)).
3 Nonlinear partial differential equations 67
At the border between the step sizes for xi = xγ , the points xi−1 and xi+1 have a different
distance to xi, so that
un+1γ =
1
2(unγ+1 + unγ−1)− a1∆t
2∆x1f(unγ−1) +
a2∆t
2∆x2f(unγ+1)
=1
2(unγ+1 + unγ−1)− a1∆t
2∆x1
(f(unγ−1)− f(unγ+1)
).
For µ = a1∆t∆x1
= a2∆t∆x2
, the Lax-Friedrichs method is then given as
un+1i =
1
2(uni+1 + uni−1)− µ
2(f(uni+1)− f(uni−1)).
Note that there are two possible situations in which this method is less accurate, because
the wrong value for a was chosen. First, consider the grid point xγ . If the slope of the
characteristic through (xγ , tn+1) is negative, the characteristic crosses the jump in the
time interval [tn, tn+1] and the factor a2 should be replaced with the average of a on the
interval [xγ , xγ+1]. Analogously, if the slope of the characteristic through (xγ+1, tn+1)
is positive, the characteristic crosses the jump as well and the same effect arises. By
ignoring this, the method becomes much simpler, as was the case for the upwind method
for the advection equation.
To get an idea whether the computed solution is sensible, consider again Burger’s equa-
tion with the addition of the piecewise constant coefficient a
ut + a(x)uux = 0.
The nonuniform Lax-Friedrichs method is then
un+1i =
1
2(uni+1 + uni−1)− µ
4((uni+1)2 − (uni−1)2).
Figure 3.5 shows the computed solution of this equation at different times with the
initial condition u0(x) = arctan(x − 100) and a(x) =
0.1, if x ≤ α,
1, if x ≥ α,with the jump
at α = 100. This example is chosen because it yields a somewhat nice solution in the
sense that it contains none of the problems that arise for nonlinear equations. Because
u0(α) = 0, the characteristics do not cross the jump and because the initial condition is
strictly monotonic increasing, the characteristics fan out and do not coincide. A similar
situation was illustrated in figure 3.4(a). As expected, the part to the left of the jump
propagates further left and the part to the right further right. Because of the different
values of a, this happens much faster at the right, so that a kink in the solution arises
at the position of the jump.
68 3 Nonlinear partial differential equations
0 100 2002
0
2
0 100 2002
0
2
0 100 2002
0
2
Figure 3.5: Solution of the nonuniform Lax-Friedrichs method.
3.3.2 The Lax-Friedrichs method on a uniform grid
After successfully constructing a method for a nonuniform grid, do the same for a uni-
form grid. As for the upwind method in section 2.2.2, this is more difficult than on
a nonuniform grid. The reason for this is that the characteristics to the right of the
jump pass more than one spatial interval in a time step because of the higher velocity
a2. For the upwind method, the result was that all the values un+1i for γ < i < β were
computed by means of the value unγ−1, which generated small discontinuities in the form
of a stair-step like pattern. It will be seen that the same happens for the Lax-Friedrichs
method on a uniform grid.
Start with defining the uniform grid. Like before, choose the time step size for given
spatial step size according to the CFL condition for the smaller value of a. That is for
fixed ∆x, set
∆t =ν∆x
a1 max |f ′|.
The solution to the left of the jump can then be computed with the ordinary Lax-
Friedrichs method while the solution to the right requires a broader stencil. The approach
to deriving the method is the same as for the upwind method, that is fix the method as
un+1i =
1
2(unj + unk)− µ
2(f(unj )− f(unk))
for µ = a1∆t∆x and determine the indices j and k accordingly. Note that as described
in section 2.2.2, defining the method with constant coefficient µ is a simplification if
s is no integer and thus replaced by⌈a2a1
⌉. For γ =
⌊α
∆x
⌋with α ∈ [xγ , xγ+1) and
β = γ + a2a1
= γ + s, distinguish the cases i < γ, γ ≤ i < β and i ≥ β.
3 Nonlinear partial differential equations 69
As mentioned before, for i < γ, it suffices to define j = i+ 1 and k = i− 1, which is the
stencil of the ordinary Lax-Friedrichs method, so that
un+1i =
1
2(uni+1 + uni−1)− µ
2(f(uni+1)− f(uni−1)).
Unlike for the upwind method, consider i < γ instead of i ≤ γ because the stencil of the
Lax-Friedrichs method at the point xγ contains the jump.
For i ≥ β, the factor a2 is s times bigger than a1, so that the stencil should be s times
bigger as well. Therefore, take j = i+ s and k = i− s, which yields
un+1i =
1
2(uni+s + uni−s)−
µ
2(f(uni+s)− f(uni−s)).
The case γ ≤ i < β is more difficult. Note that according to the two cases before,
un+1γ−1 =
1
2(unγ + unγ−2)− µ
2(f(unγ )− f(unγ−2)) ⇒ j = γ, k = γ − 2,
un+1β
=1
2(unβ+s + unβ−s)−
µ
2(f(unβ+s)− f(unβ−s)) ⇒ j = γ + 2s, k = γ,
so that it should hold that j ∈ [γ, γ + 2s] and k ∈ [γ − 2, γ]. This is indeed reason-
able, because the characteristics through the points (xi, tn+1) reach at most the interval
(xγ−1, xγ ] at time tn. The reason for this is the same as for the uniform upwind method,
since the different slope f ′ is already included in the step size ∆t. Furthermore, for nega-
tive f ′, the characteristics through (xi, tn+1) cross at most s spatial intervals. Together,
the stencil should be chosen so that k = γ − 1 and j = i+ s, which gives
un+1i =
1
2(uni+s + unγ−1)− µ
2(f(uni+s)− f(unγ−1)).
Altogether, the uniform Lax-Friedrichs method has the form
un+1i =
12(uni+1 + uni−1)− µ
2 (f(uni+1)− f(uni−1)), if i < γ,
12(uni+s + unγ−1)− µ
2 (f(uni+s)− f(unγ−1)), if γ ≤ i < β,
12(uni+s + uni−s)−
µ2 (f(uni+s)− f(uni−s)), if i ≥ β.
The fact that the solution is computed by means of unγ−1 for all γ ≤ i < β results in the
already announced discontinuities, that were observed for the uniform upwind method.
To illustrate this, consider again the example of the previous section. For the differential
equation
ut + a(x)uux = 0
70 3 Nonlinear partial differential equations
the method is given as
un+1i =
12(uni+1 + uni−1)− µ
4 ((uni+1)2 − (uni−1)2), if i < γ,
12(uni+s + unγ−1)− µ
4 ((uni+s)2 − (unγ−1)2), if γ ≤ i < β,
12(uni+s + uni−s)−
µ4 ((uni+s)
2 − (uni−s)2), if i ≥ β.
Examining the problem for u0(x) = arctan(x − 100) and a(x) =
0.1, if x ≤ α,
1, if x ≥ α,with
the jump at α = 100 yields the solution that is presented in figure 3.6.
0 100 2002
0
2
0 2001002
0
2
0 100 2002
0
2
Figure 3.6: Solution of the uniform Lax-Friedrichs method.
As for the nonuniform method, the computed solution has the expected form. Addition-
ally, a stair-step like pattern arises directly to the right of the jump, which is illustrated
in figure 3.7 and could already be observed for the upwind method in chapter 2.
95 100 1250.25
1.25
10095 1250.25
1.25
10095 1250.25
1.25
Figure 3.7: Detail of the solution of the uniform Lax-Friedrichs method at the right of
the jump.
3 Nonlinear partial differential equations 71
The method on the uniform grid is at a disadvantage, because it requires additional
boundary conditions. The method on the nonuniform grid can be used for the solution
at all grid points except for the first and the last one. On the uniform grid, it is not
possible to compute the solution at the last s grid points, since it would require the
value of the solution outside the spatial interval. There exist different approaches to
defining boundary conditions, some can for example be found in [12], but they will not
be elaborated on here.
To simplify matters, the values at points outside of the interval are replaced by the value
at the right boundary. Whether this definition of the method yields acceptable results
depends on the shape of the solution at all times. Consider again the example of the
arctan up to the time step, that is illustrated in the third part of figure 3.6. At all times,
the straight line π2 is an asymptote of the solution. Therefore, the value at the right
boundary is approximately the same as the values further to the right, if the spatial
interval were longer and they were computed as well. For this reason, the approach can
be used in this situation for both the uniform and the nonuniform method.
3.3.3 Flux functions with arbitrary, piecewise constant coefficient
Up to now, only equations with one jump were considered, where the jump separated
an area with smaller coefficient a1 from an area with bigger coefficient a2. Expand this
now to the more general case with the coefficients given as
a(x) =
a1, if x ≤ α1,
a2, if α1 ≤ x ≤ α2,
a3, if x ≥ α2
for a1 ≤ a2 and a2 ≥ a3. Since this example contains both the transition from smaller
to bigger and from bigger to smaller coefficient, the results of this section can be used
in all situations with arbitrary, piecewise constant coefficient.
Start with the Lax-Friedrichs method on a nonuniform grid. Here, the addition of the
second jump does not require a change of the method, as figure 3.8 suggests. The domain
of dependence of the PDE at a grid point contains all possible characteristics through
this grid point and the CFL condition specifies the step size. Together, this guarantees
that the domain of dependence of a point (xi, tn+1) is a subset of the interval [xi−1, xi+1],
so that no distinction of cases is necessary. For this reason, the Lax-Friedrichs method
un+1i =
1
2(uni+1 + uni−1)− µ
2(f(uni+1)− f(uni−1))
72 3 Nonlinear partial differential equations
with µ = a1∆t∆x1
for
∆x =
∆x1, if x ≤ α1,
∆x2 = a2a1
∆x1, if α1 ≤ x ≤ α2,
∆x3 = a3a1
∆x1, if x ≥ α2,
and ∆t =ν∆x1
a1 max |f ′|
can be used as before.
t n+1
t n xα 1 α 2
Figure 3.8: The nonuniform grid for two jumps and the domain of dependence at different
grid points.
Note that in this situation, the step size ∆x1 and thus ∆x2 should be chosen small
enough in relation to the distance between the jumps. Otherwise, there exists only one
interval of size ∆x2. This is illustrated in figure 3.9. As can be seen, a part of the
bigger interval contains no characteristics. Therefore, it would be more accurate to use
a smaller ∆x2 and to add more grid points as the dashed lines in the figure suggest.
Since this is difficult to implement, the step size has to be chosen so that the area that
contains no domain of dependence is relatively small.
t n+1
t n xα 1 α 2
Figure 3.9: The example of figure 3.8 if the distance between the jumps is small in
relation to the step size.
Examine the method for a uniform grid next. In contrast to the nonuniform case, this is
3 Nonlinear partial differential equations 73
much more complicated. The situation for the first jump at α1 is the same as in section
3.3.2. For the second jump at α2, observe in figure 3.10 that principally the same holds,
only reversed. Assume that a1 ≤ a3 ≤ a2 and define the step size according to a1, so
x
t n+1
t n
α 1 α 2
Figure 3.10: The uniform grid for two jumps and the domain of dependence at different
grid points.
that for given ∆x,
∆t =ν∆x
a1 max |f ′|.
Then define s2 = a2a1
and s3 = a3a1
as the factors by which the coefficients a2 and a3
are bigger than a1 and assume further that they are integer or replace them by the
next bigger integer. Keep in mind that si describes the maximal number of spatial
intervals that a characteristic passes in a time step, so one could as well define s1 = 1.
Furthermore, let γ1 =⌊α1∆x
⌋and γ2 =
⌈α2∆x
⌉be the grid points to the left of α1 and to
the right of α2 respectively. Lastly, set β1 = γ1 +s2, β2 = γ2−s2 and β3 = γ2 +s3. Now,
consider all the possible cases. The first three were already examined in the previous
section, so only the notation needs to be adjusted.
• i < γ1: un+1i = 1
2(uni+s1 + uni−s1)− µ2 (f(uni+s1)− f(uni−s1))
• γ1 ≤ i < β1: un+1i = 1
2(uni+s2 + unγ1−s1)− µ2 (f(uni+s2)− f(unγ1−s1))
• β1 ≤ i ≤ β2: un+1i = 1
2(uni+s2 + uni−s2)− µ2 (f(uni+s2)− f(uni−s2))
The fourth case corresponds to the second when interchanging the left and right side
and correcting the indices.
• β2 < i ≤ γ2: un+1i = 1
2(unγ2+s3 + uni−s2)− µ2 (f(unγ2+s3)− f(uni−s2))
The fifth case is similar, with the only difference that a characteristic with negative slope
is not bounded by xγ2+s3 .
74 3 Nonlinear partial differential equations
• γ2 < i < β3: un+1i = 1
2(uni+s3 + uni−s2)− µ2 (f(uni+s3)− f(uni−s2))
For the last case, like the first and third, the corresponding stencil does not contain a
jump, so the stencil is given by s3.
• β3 ≤ i: un+1i = 1
2(uni+s3 + uni−s3)− µ2 (f(uni+s3)− f(uni−s3))
Altogether, define the method as
un+1i =
12(uni+s1 + uni−s1)− µ
2 (f(uni+s1)− f(uni−s1)), if i < γ1,
12(uni+s2 + unγ1−s1)− µ
2 (f(uni+s2)− f(unγ1−s1)), if γ1 ≤ i < β1,
12(uni+s2 + uni−s2)− µ
2 (f(uni+s2)− f(uni−s2)), if β1 ≤ i ≤ β2,
12(unγ2+s3 + uni−s2)− µ
2 (f(unγ2+s3)− f(uni−s2)), if β2 < i ≤ γ2,
12(uni+s3 + uni−s2)− µ
2 (f(uni+s3)− f(uni−s2)), if γ2 < i < β3,
12(uni+s3 + uni−s3)− µ
2 (f(uni+s3)− f(uni−s3)), if β3 ≤ i.
Obviously, this can be quite confusing, which only worsens for more jumps. On the other
hand, the uniform grid yields a more accurate solution. If for example a2 a1, a3, the
nonuniform method would define a much bigger step size between the two jumps, which
could yield a solution that is too inexact in this area.
As was the case for the nonuniform method, the uniform method is based on the as-
sumption that the distance between the jumps is relatively big, so that γ1 ≤ β1 ≤ β2 ≤γ2 ≤ β3. If the distance is smaller, a characteristic could pass both jumps in one time
step as depicted in figure 3.11. In this case, the above scheme is no longer valid. An
x
t n+1
t n
α 1 α 2
Figure 3.11: The example of figure 3.10 if the distance between the jumps is small in
relation to the step size.
3 Nonlinear partial differential equations 75
alternative scheme could be
un+1i =
12(uni+s1 + uni−s1)− µ
2 (f(uni+s1)− f(uni−s1)), if i < γ1,
12(unγ2+s3 + unγ1−s1)− µ
2 (f(unγ2+s3)− f(unγ1−s1)), if γ1 ≤ i < β3,
12(uni+s3 + uni−s3)− µ
2 (f(uni+s3)− f(uni−s3)), if β3 ≤ i.
For this distinction between the possible situations to not be necessary, the step size
should be chosen small enough as required for the nonuniform method.
In the next chapter, the two modified versions of the Lax-Friedrichs method will be used
for the computation of the solution of some test cases, including the calculation of the
dose in radiotherapy.
4 Applications in radiotherapy
4.1 A model for dose calculation
In this chapter, the derived methods will be applied to the radiation transport problem.
In [2] and [5], the particle transport is described by
∂ε(SM (x, ε)Ψ0(x, ε)
)−∇xΨ1(x, ε) = 0,
∂ε(SM (x, ε)Ψ1(x, ε)
)−∇xΨ2(x, ε) = Ttot(x, ε)Ψ
1(x, ε). (4.1)
Here, Ψ(x, ε,Ω) is the fluence in phase space with the space variable x ∈ Rd, the energy
ε > 0 of a particle and the flight direction Ω in the unit sphere S2. Note that the energy
ε assumes the role of the time variable of the previous chapters. Ψ0, Ψ1 and Ψ2 define
the moments of Ψ in angle, that is
Ψ0(x, ε) =
∫S2
Ψ(x, ε,Ω) dΩ,
Ψ1(x, ε) =
∫S2
ΩΨ(x, ε,Ω) dΩ,
Ψ2(x, ε) =
∫S2
(Ω⊗ Ω)Ψ(x, ε,Ω) dΩ,
so that Ψ0 is a scalar, Ψ1 a vector and Ψ2 a tensor. Furthermore, SM (x, ε) is the stopping
power that describes the energy loss of a particle and Ttot(x, ε) is the transport coefficient
that models angular deviations. Because both are influenced by the density ρ(x) of the
tissue, it is assumed that they can be written as
SM (x, ε) = ρ(x)S(ε), Ttot(x, ε) = ρ(x)T (ε)
for some functions S(ε) and T (ε). As mentioned in the introduction, the density ρ is a
piecewise constant function whose values differ by a high factor. For example, air has
approximately density 10−3 and water density 1. The solution of (4.1) then yields the
sought after dose
D(x) =
∫ ∞0
S(ε)Ψ0(x, ε) dε,
77
78 4 Applications in radiotherapy
which is the amount of energy that reaches a point x.
Since the system (4.1) consists of two equations with three unknowns, some further
assumptions are needed to close the system. In [2], an entropy minimization strategy is
used and the system is transformed to the so-called M1 model
∂ε(ρ(x)S(ε)Ψ0(x, ε)
)−∇xΨ1(x, ε) = 0,
∂ε(ρ(x)S(ε)Ψ1(x, ε)
)−∇xDe
(Ψ1(x, ε)
Ψ0(x, ε)
)Ψ0(x, ε) = ρ(x)T (ε)Ψ1(x, ε), (4.2)
where
De(f) =1− χ(f)
2Id +
3χ(f)− 1
2
f
‖f‖⊗ f
‖f‖is the Eddington tensor with the Eddington factor
χ(f) =3 + 4‖f‖2
5 + 2√
4− 3‖f‖2.
Now, only an initial condition is needed to solve the system of equations. Denote εmax
as the highest possible energy of a particle and consider the energy interval (0, εmax).
The initial condition is given as
Ψ0(x, εmax) = δ > 0, Ψ1(x, εmax) = 0
and (4.2) is solved for ε from εmax to 0.
4.2 Solution of the 1D model
Restrict the following analysis to the one-dimensional case d = 1. The system (4.2) then
reduces to
∂ε(ρ(x)S(ε)Ψ0(x, ε)
)− ∂xΨ1(x, ε) = 0,
∂ε(ρ(x)S(ε)Ψ1(x, ε)
)− ∂x
(Ψ0(x, ε)χ
(Ψ1(x, ε)
Ψ0(x, ε)
))= ρ(x)T (ε)Ψ1(x, ε). (4.3)
To be able to use the Lax-Friedrichs method as derived in section 3.3.3, this system needs
to be transformed so that the energy derivative only contains Ψ0 and Ψ1 respectively. In
addition, only homogeneous systems with the right side equal to zero were examined up
to now, but the equations in this chapter all contain a source term ρTΨ1 in the second
equation which needs to be regarded as well.
Following the approach in [2], use a change of variables to transform the system. Denote
u(x, ε) =
(Ψ0(x, ε)
Ψ1(x, ε)
).
4 Applications in radiotherapy 79
In a first step, multiply (4.3) with S(ε) to obtain
S∂ε(ρSΨ0
)− ∂xSΨ1 = 0,
S∂ε(ρSΨ1
)− ∂x
(SΨ0 χ
(SΨ1
SΨ0
))= ρTSΨ1,
since S(ε)∂xf(u(x, ε)) = ∂x (S(ε)f(u(x, ε))). By defining
u(x, ε) := S(ε)u(x, ε),
this is the same as
S∂ε
(ρΨ0
)− ∂xΨ1 = 0,
S∂ε
(ρΨ1
)− ∂x
(Ψ0 χ
(Ψ1
Ψ0
))= ρT Ψ1.
Secondly, it holds that ∂ε (ρ(x)u(x, ε)) = ρ(x)∂ε (u(x, ε)) and dividing the system by
ρ(x) > 0 yields
S∂εΨ0 − 1
ρ(x)∂xΨ1 = 0,
S∂εΨ1 − 1
ρ(x)∂x
(Ψ0 χ
(Ψ1
Ψ0
))= T Ψ1.
In a last step, let
ε : R+ → R+, ε 7→∫ ε
0
1
S(t)dt
be a change of variables. This is valid because S(ε) > 0 so that ε is monotonically
increasing. Then define further
u(x, ε) := u(x, ε),
so that S(ε)∂εu(x, ε) = ∂εu(x, ε) and ∂xf(u(x, ε)) = ∂xf(u(x, ε)), and the system can be
written as
∂εΨ0(x, ε)− 1
ρ(x)∂xΨ1(x, ε) = 0,
∂εΨ1(x, ε)− 1
ρ(x)∂x
(Ψ0(x, ε)χ
(Ψ1(x, ε)
Ψ0(x, ε)
))= T (ε)Ψ1(x, ε). (4.4)
For the homogeneous case, (4.3) has the form
∂ε (ρSu)− ∂xf (u) = 0 (4.5)
80 4 Applications in radiotherapy
with the flux function
f(u) =
(Ψ1
Ψ0 χ(Ψ1/Ψ0
)) .It was just shown that this is equivalent to
∂εu−1
ρ(x)∂xf(u) = 0,
which conforms to (3.6) with a(x) = 1ρ(x) as introduced in section 3.3. Therefore, (4.5)
can be solved with the methods that were derived in the previous chapters.
On a nonuniform grid, the Lax-Friedrichs method for this equation is
uni =1
2(un+1i+1 + un+1
i−1 )− µ
2(f(un+1
i+1 )− f(un+1i−1 )). (4.6)
Here, the solution is computed for ε from εmax to 0, so that εn = εn+1 − ∆ε and the
temporal index, or in this case the one describing the energy, is counted backwards.
Furthermore, the step size ∆x(x) is chosen depending on the density ρ(x) and the
coefficient µ is now given by µ = ∆ε2ρ(x)∆x(x) . More precisely, the scheme has the form
(Ψ0)ni =1
2
((Ψ0)n+1
i+1 + (Ψ0)n+1i−1
)− µ
2
((Ψ1)n+1
i+1 − (Ψ1)n+1i−1
),
(Ψ1)ni =1
2
((Ψ1)n+1
i+1 + (Ψ1)n+1i−1
)− µ
2
((Ψ0)n+1
i+1 χ
((Ψ1)n+1
i+1
(Ψ0)n+1i+1
)− (Ψ0)n+1
i−1 χ
((Ψ1)n+1
i−1
(Ψ0)n+1i−1
)).
To apply this method in the inhomogeneous case, a discretization of the source term
is necessary. This gives rise to some difficulties when computing the solution because
the source term depends on the solution Ψ1 that is multiplied with the possibly large
transport coefficient. Such a problem is called stiff and some numerical methods for
solving it require a very small step size ∆ε in order to be stable.
According to [12], one possible approach to solving this equation without reducing the
step size is to split the problem. In a first step, the solution to the homogeneous system
is computed as described before. In a second step, the ordinary differential equation
∂εu(x, ε) =
(0
T (ε)Ψ1(x, ε)
)
is solved. This equation contains a further difficulty since the transport coefficient de-
pends on ε while the numerical method uses the variable ε. A constant step size ∆ε
seldom implies a constant step size ∆ε, so it is not easy to compute εn from εn. A possi-
ble solution to this problem will be presented later on when computing some examples.
4 Applications in radiotherapy 81
For the solution of the ODE, the most simple approach is to just discretize the derivative
implicitly
∂εu(x, ε) =u(x, ε+ ∆ε)− u(x, ε)
∆ε⇒ u(x, ε) = u(x, ε+ ∆ε)−∆ε
(0
T (ε)Ψ1(x, ε)
).
Combining these two steps yields the scheme
uni =1
2(un+1i+1 + un+1
i−1 )− µ
2
(f(un+1
i+1 )− f(un+1i−1 )
)−∆εΣn
i (4.7)
with Σni =
(0
(Ψ1)ni Tn
)where Tn = T (εn) is the discretization of the transport coeffi-
cient. Hence,
(Ψ0)ni =1
2
((Ψ0)n+1
i+1 + (Ψ0)n+1i−1
)− µ
2
((Ψ1)n+1
i+1 − (Ψ1)n+1i−1
),
(Ψ1)ni =1
1 + ∆ε Tn
[1
2
((Ψ1)n+1
i+1 + (Ψ1)n+1i−1
)−µ
2
((Ψ0)n+1
i+1 χ
((Ψ1)n+1
i+1
(Ψ0)n+1i+1
)− (Ψ0)n+1
i−1 χ
((Ψ1)n+1
i−1
(Ψ0)n+1i−1
))].
For the uniform grid, the scheme can be written similarly, but since it depends on the
number of discontinuities in ρ and requires several distinctions of the different stencils
that are used, it will not be written down explicitly.
For the computation of the dose, use that
D(x) =
∫ ∞0
S(ε)Ψ0(x, ε) dε
=
∫ εmax
0S(ε)Ψ0(x, ε) dε
=
N−1∑n=0
∫ εn
εn+1
S(ε)Ψ0(x, ε) dε
=N−1∑n=0
εn − εn+1
2
(S(εn)Ψ0(x, εn) + S(εn+1)Ψ0(x, εn+1)
)=
N−1∑n=0
εn − εn+1
2
(Ψ0(x, εn) + Ψ0(x, εn+1)
)with ε0 = εmax, εN = 0 and εn = ε(εn) and with the trapezoidal rule. To compute this,
determine each summand after the corresponding step of the above scheme (4.7) and
add them together. As for the discretization of the source term, the values for εn need
to be known to be able to do so.
82 4 Applications in radiotherapy
4.3 Numerical experiments
In this section, the previous results are validated by means of some test cases.
4.3.1 Homogeneous test case
At first, consider the simple example of the Riemann problem suggested in [2]. The
initial condition is given as
Ψ0(x, εmax) =
0.5, if x < 0.5
3, if x > 0.5, Ψ1(x, εmax) = 0
for x ∈ [0, 1], the transport coefficient as T (ε) = 0 and the stopping power as S(ε) = 1
for ε ∈ [0, 0.2]. Therefore, the differential equation contains no source term and
u(x, ε) = u(x, ε) = u(x, ε)
with ε = ε, so that the transformations of the previous section become redundant.
Furthermore, the density is defined as
ρ(x) =
1, if x < 0.3,
0.01, if 0.3 < x < 0.5,
1, if x > 0.5.
Figure 4.1 shows the solution u(x, 0) = u(x, 0) of the M1 model for εmax = 0.2 that was
computed with the Lax-Friedrichs method with ∆ε = 1310−3 and with the spatial step
sizes ∆x = 10−3 for the uniform grid and ∆x1 = 10−3, ∆x2 = 10−1 and ∆x3 = 10−3 for
the nonuniform grid. As introduced in chapter 3, these step sizes are required by the
CFL condition
∆ε ≤ ∆x(x)1ρ1|λmax|
= ∆x(x),
where |λmax| = 1 is an estimation of the biggest eigenvalue of f ′ that was computed with
prior knowledge of the structure of the solution of the Riemann problem.
Note again that both methods were constructed under the assumption that a sufficient
number of grid points lies between the two jumps in density. In this case, the step sizes
∆x and ∆x2 for the uniform and nonuniform method have to be small enough in relation
to the width 0.2 of the interval (0.3, 0.5) where ρ(x) = 0.01.
As can be seen, both methods yield essentially the same results. They differ only slightly
in the areas with nonzero slope as illustrated in the magnification in figure 4.2. The
4 Applications in radiotherapy 83
0 0.2 0.4 0.6 0.8 11
0.5
0
0.5
1
1.5
2
2.5
3
3.5uniform
0
1
0 0.2 0.4 0.6 0.8 11
0.5
0
0.5
1
1.5
2
2.5
3
3.5nonuniform
0
1
0 0.2 0.4 0.6 0.8 10.005
0
0.005
0.01
0.015
0.02
0.025
0.03
0.035
0.04
nonuniform 0 uniform
0
Figure 4.1: Solution of the Riemann problem using the uniform method and the nonuni-
form method and their difference.
0.58 0.6 0.62
1.8
2
2.2
2.4
2.6
2.8
3uniform
0
1
0.58 0.6 0.62
1.8
2
2.2
2.4
2.6
2.8
3nonuniform
0
1
0.58 0.6 0.62
0
1
2
3
4
5
6
7
8
9
x 10 3
nonuniform 0 uniform
0
Figure 4.2: Magnification of the solutions in figure 4.1.
more important difference of the two methods is the number of grid points. While there
are 1000 grid points for the uniform method, there are only 802 for the nonuniform
one. Because 600 steps in energy are needed for εmax = 0.2, the consequence of this
difference is that for the uniform method, 6 · 105 values u(xi, εn) need to be computed
and for the nonuniform method only 4.812 · 105. Therefore, the nonuniform method is
computationally less expensive for the given step size.
To check whether the computed solution is correct, consider again system (4.4). A
84 4 Applications in radiotherapy
further change of variables with
x : R+ → R+, x 7→∫ x
0ρ(t)dt
and
u(x, ε) := u(x, ε)
transforms the system to
∂εΨ0(x, ε)− ∂xΨ1(x, ε) = 0,
∂εΨ1(x, ε)− ∂x
(Ψ0(x, ε)χ
(Ψ1(x, ε)
Ψ0(x, ε)
))= T (ε)Ψ1(x, ε). (4.8)
This is a system without the discontinuous coefficient ρ and can be solved easily and
accurately. Since it is written in the tilde variables, the initial conditions have to be
transformed accordingly. Because x(0.5) = 0.302, they are given as
Ψ0(x, εmax) =
0.5, if x < 0.302
3, if x > 0.302, Ψ1(x, εmax) = 0.
Then, the solution u(x, ε) of this Riemann problem should fulfill
u(x, ε) = u(x, ε).
Figure 4.3 shows the solution Ψ0(x, 0) and its transformation Ψ0(x, 0) from the x-plane
to the x-plane. Since the thus constructed Ψ0 and the previously computed Ψ0 in figure
4.1 match, the derived methods are indeed valid for the homogeneous case.
Figure 4.4 shows the normalized dose D(x) for this example.
4 Applications in radiotherapy 85
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10.5
0
0.5
1
1.5
2
2.5
3
3.5
!0
!0
Figure 4.3: Solution of the Riemann problem in the x-plane and its transformation to
the x-plane.
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 10
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
normalized dose
Figure 4.4: Normalized dose for the homogeneous test case.
4.3.2 One-dimensional dose calculation
Examine now an example that was used in [7] and is better suited for dose calculation.
There, a part of the body is irradiated such that the radiation enters the body at the left
boundary. When interpreting the energy as time, this means that an initial condition
should be zero everywhere except at the left boundary. With increasing time, the initial
radiation propagates to the right and further into the tissue. Here, x ∈ [xmin, xmax] =
86 4 Applications in radiotherapy
[0, 9], ε ∈ [εmin, εmax] = [0.01, 10] and the initial condition is given as
Ψ0(x, εmax) =
105 exp(−200(εmax − 9.9)2), if x = xmin
0, else,
Ψ1(x, εmax) = 0.95 ·Ψ0(x, εmax)
and for smaller energies ε, a boundary condition of the form
Ψ0(xmin, ε) = 105 exp(−200(ε− 9.9)2), Ψ1(xmin, ε) = 0.95 ·Ψ0(xmin, ε),
Ψ0(xmax, ε) = 0, Ψ1(xmax, ε) = 0
is used. Furthermore, consider an area x ∈ [0, 9] that is composed of water, air and
again water, so that
ρ(x) =
1, if 0 ≤ x ≤ 4,
10−3, if 4 < x < 6,
1, if 6 ≤ x ≤ 9.
The stopping power and the transport coefficient are given in form of a table that is the
result of previous computations that are based on cross section data as explained in [5].
The needed values are then determined with a linear interpolation of the values in the
table.
The same idea is used for the computation of the grid points εn. In a first step, construct
a set of grid points εi that covers the examined energies. After that, compute for each εi
the corresponding ε(εi) and save both sets. It is then possible to use a linear interpolation
with the nodes εi and values εi in order to compute other values ε from ε(ε). Obviously,
this approach is not ideal since the accuracy of the interpolation depends on the position
of the nodes and the interpolation has to be done in each time step.
The experiments in the previous section showed that the derived methods yield an
accurate solution of the M1 model without a source term and with the stopping power
S(ε) = 1. To first test whether the scheme is valid for an inhomogeneous equation with
arbitrary stopping power, consider the case ρ ≡ 1 so that the area [0, 9] is composed of
only water. Figure 4.5 shows the results of the computed dose for different spatial step
sizes. Since the biggest eigenvalue of f is now approximately 3, the energy step size is
chosen as ∆ε = 13∆x because of the CFL condition.
To be able to interpret these results, compare the dose with the lowest step size ∆x =
10−2.5 to the results of some other methods. The first benchmark is the Monte Carlo
4 Applications in radiotherapy 87
0 1 2 3 4 5 60
0.2
0.4
0.6
0.8
1
dx = 10 1
dx = 10 1.5
dx = 10 2
dx = 10 2.5
Figure 4.5: Normalized dose for εmax = 10 on water.
code PENELOPE (see [13]) which is a probabilistic method that is one of the standard
approaches to dose calculation. The other benchmark is as well a common Monte Carlo
code by the name GEANT4 (see e.g. [1]). The dose for each of the three methods is
depicted in figure 4.6.
0 1 2 3 4 5 60
0.2
0.4
0.6
0.8
1
PENELOPEGEANT4Lax Friedrichs for dx = 10 2.5
Figure 4.6: Comparison of the computed dose with the results of GEANT4 and
PENELOPE.
It was explained in [5] that the difference at the left boundary is a result of the M1 model
which does not capture all the physical effects and thus, does not yield exactly the same
88 4 Applications in radiotherapy
results as the Monte Carlo methods. Apart from that, the derived method yields good
results. As figure 4.5 suggests, the method converges for a refined grid, as the descent of
the dose to the right of the interval steepens. This can be verified by plotting the `1-error
of each dose with ∆x = 10−18i−1, i = 0, . . . , 11, in comparison to the most accurate dose
for ∆x = 10−2.5 as was done in figure 4.7. There, a linear interpolation was used to
expand each dose onto the grid with step size ∆x = 10−2.5 so that the values at each
grid point can be compared.
2.25 2 1.75 1.5 1.25 15.3
5.8
6.3
6.8
Figure 4.7: Logarithmic error plot for the computed doses.
Thus, it was shown that the method is able to correctly handle the transport coefficient
and the transformation to the ε variables because of the stopping power.
In a last step, compute the dose with the discontinuous coefficient ρ in order to prove
that the method is able to compute the correct dose for the application. To do so, the
nonuniform method is used for the M1 model with the spatial step sizes ∆x1 = ∆x3 =
10−3 and ∆x2 = 100 and with the energy step size ∆ε = 1310−3. Figure 4.8 shows the
solution u(x, ε) after different amounts of steps in energy ε. Since the radiation that
passes the air cavity does not loose much energy because of the low density, one would
expect the dose to behave similar to figure 4.6 with the difference, that it is shifted from
the left to the right border of the air cavity like the solution in figure 4.8.
Starting at the energy ε(εmax) = ε(10) = 5.1878, the step size ∆ε = 1310−3 requires 15562
steps to reach the energy 4.6667 ·10−4 > 2.5171 ·10−4 = ε(0.01). This is the advantage of
the derived methods over the ordinary Lax-Friedrichs method. Here, the CFL condition
4 Applications in radiotherapy 89
0 2 4 6 8
0
4
8
12
16x 104 solution after 500 steps
0
1
0 2 4 6 8
0
1.5
3
4.5
6x 104 solution after 4000 steps
0
1
0 2 4 6 8
0
0.625
1.25
1.875
2.5x 104 solution after 10000 steps
0
1
0 2 4 6 8
0
20000
10000
5000
15000
solution after 12000 steps
0
1
0 2 4 6 8
0
3000
6000
9000
12000solution after 14000 steps
0
1
0 2 4 6 8
0
2000
4000
6000
8000solution after 15562 steps
0
1
Figure 4.8: Solution u(x, ε) of the M1 model at different energies.
demands a step size ∆ε that is smaller than ∆x or ∆x1 respectively. For the ordinary
method, the CFL condition states that for all x
∆ε ≤ ∆x1
ρ(x) |λmax|=
1
3ρ(x)∆x
so that ∆ε ≤ 1310−3∆x. This means that the step size for the ordinary method is given
by the minimal value of ρ and for the modified method by the maximal value of ρ. For
the dose calculation this results in a computation time for the ordinary method that
90 4 Applications in radiotherapy
is approximately a thousand times higher than for the modified method. Indeed, the
ordinary Lax-Friedrichs method would require the computation of about 1.4 ·1011 values
u(x, ε) while the modified method on a uniform grid needs about 1.4 · 108 values and on
a nonuniform grid 1.1 · 108. Generally, it holds that the more different the values of the
coefficient ρ, the better are the modified methods in comparison to the ordinary ones.
0 2 4 6 80
0.2
0.4
0.6
0.8
1
PENELOPEmodified Lax Friedrichs
Figure 4.9: Comparison of the computed dose with the results of PENELOPE.
The corresponding dose to figure 4.8 and the dose computed with PENELOPE are
displayed in figure 4.9. The difference near the left boundary was already mentioned to
be a result of the M1 model. On the interval (4, 6), the density is very small so that the
particles get transported much faster. This is the reason why the dose remains nearly
constant on this interval. Furthermore, it explains the great difference between the two
doses, since their value on the interval is influenced by their value at x = 4 and the dose
of the M1 model is higher there. This was already the case in the example in figure 4.6,
now the dose is essentially just shifted to the right from x = 4 to x = 6 as expected.
Altogether, the observed differences are results of the M1 model for which the method
yields an accurate solution.
5 Conclusions and outlook
In this thesis, the Lax-Friedrichs method was successfully modified in order to solve
one-dimensional systems of hyperbolic balance laws with a discontinuous flux function.
The aim was to derive a method that does not require a very fine grid like common
methods do because of the CFL condition. This was done by gradually generalizing eas-
ier problems and validating them by means of some examples, starting with the upwind
method for the scalar advection equation and ending with the modified Lax-Friedrichs
method for dose calculation in radiotherapy. There are two versions of the final method.
The first was constructed for a uniform spatial grid where the stencil of the method was
adjusted to the piecewise constant coefficient in the flux. The other version was defined
on a nonuniform grid which was chosen according to the coefficient. Both methods were
then applied to some examples including the dose calculation for radiotherapy.
It can be observed that it depends on the given situation whether the uniform or the
nonuniform method should be preferred. In chapter 2.3, the results suggested that the
uniform upwind method is better than the nonuniform one since it yielded a greater
order and smaller error. However, these observations were valid for arbitrary examples
and situations where the coefficient a(x) had values between 0.1 and 1. If the difference
between the values of a(x) is much bigger and if the initial condition is confined to a
special structure, then the results change. In the application, an initial condition would
define some values at the left boundary from where the radiation originates and it would
be zero everywhere else. This was the case in the example of section 4.3.2. Before,
the disadvantage of the nonuniform method was the lesser accuracy in areas of bigger
coefficient a(x). Now, there is only a limited interval of energies for which the nonzero
part of the initial condition passes through the spatial interval with bigger a(x) and
which would therefore require a smaller step size. In comparison to the uniform method,
the resulting inaccuracy is only a minor disadvantage that is made up for by the much
lesser computing time and the much simpler form of the scheme. The same conclusion
was reached for the example in section 4.3.1. For this reason, the nonuniform method is
better suited for the application in dose calculation.
Nevertheless, both methods have a great advantage over a standard method. For the
91
92 5 Conclusions and outlook
example of the one-dimensional dose calculation in section 4.3.2, the computation time
of the modified methods was proven to be approximately a thousand times smaller than
for an ordinary method. The reason for this was the restriction of the energy step size
due to the CFL condition. It was explained that the difference in computation time
depends on the quotient of the maximum and minimum value of the coefficient ρ, which
is especially high for dose calculation.
The derived methods can be applied to higher dimensional problems as well. For exam-
ple, a two-dimensional conservation law can be written as
∂
∂tu(x, t) +
∂
∂x(1)f(u(x, t)) +
∂
∂x(2)g(u(x, t)) = 0,
where x =
(x(1
x(2)
)and f and g describe the flux in the direction of x(1) and x(2)
respectively. As suggested in [12], the x-plane can be subdivided into rectangles
Cij = [x(1)i−1/2, x
(1)i+1/2]× [x
(2)j−1/2, x
(2)j+1/2]
with ∆x(1) = x(1)i+1/2 − x
(1)i−1/2 and ∆x(2) = x
(2)j+1/2 − x
(2)j−1/2. The approximation to the
average value of the solution over Cij then has the form
unij ≈1
∆x(1)∆x(2)
∫ x(2)j+1/2
x(2)j−1/2
∫ x(1)i+1/2
x(1)i−1/2
u(x, tn) dx(1)dx(2)
and it can be computed by means of the numerical method
un+1ij = unij −
∆t
∆x(1)
(Fni+1/2,j − F
ni−1/2,j
)− ∆t
∆x(2)
(Gni,j+1/2 −G
ni,j−1/2
)where Fn and Gn are the average flux functions of f and g. Now, the same approach as
for the one-dimensional case can be used by considering each spatial dimension separately
and the derived Lax-Friedrichs method can be generalized to higher dimensions.
In the application, the system 4.4 needs to be solved and the change of variables was
only done for the energy which is always one-dimensional. Therefore, the solution of the
system and hence the dose can be computed as described for the one-dimensional case.
For further studies, note that the aim of this thesis was to foremost derive a method that
is suited for the given situation. For this reason, only simple methods were considered
and modified. As a possible improvement, a replacement of the Lax-Friedrichs method
could be examined with the purpose of constructing a method of higher order. In
addition, the method uses some approximations that could be improved upon, like the
discretization of the source term or the computation of ε from ε.
Appendix
Show that the modified upwind method on a uniform grid of section 2.2.2 is TVD. To
do so, use the same approach as for the simple upwind method and analyze the total
variation for each case in the definition of the method separately.
Start with the proof for the special case where the jump lay on a grid point. There, the
method was defined as
un+1i =
uni − ν(uni − uni−1), if i ≤ α,
unα +(i−αs − ν
)(unα − unα−1), if α < i < β′,
uni−dsνe + (dsνe − sν)(uni−dsνe+1 − uni−dsνe), if i ≥ β′.
For the total variation it holds
TV (un+1) =∞∑
i=−∞
∣∣un+1i − un+1
i−1
∣∣=
α∑i=−∞
∣∣un+1i − un+1
i−1
∣∣+∣∣un+1α+1 − u
n+1α
∣∣+
β′−1∑i=α+2
∣∣un+1i − un+1
i−1
∣∣+∣∣∣un+1β′− un+1
β′−1
∣∣∣+∞∑
i=β′+1
∣∣un+1i − un+1
i−1
∣∣For the first summand,
α∑i=−∞
∣∣un+1i − un+1
i−1
∣∣ =α∑
i=−∞
∣∣(1− ν)uni + νuni−1 − (1− ν)uni−1 − νuni−2
∣∣=
α∑i=−∞
∣∣(1− ν)(uni − uni−1) + ν(uni−1 − uni−2)∣∣
≤ (1− ν)α∑
i=−∞
∣∣uni − uni−1
∣∣+ να∑
i=−∞
∣∣uni−1 − uni−2
∣∣ ,where the last inequality holds, because 0 ≤ ν ≤ 1. The second term is given as∣∣un+1
α+1 − un+1α
∣∣ =
∣∣∣∣unα +
(1
s− ν)
(unα − unα−1)− unα + ν(unα − unα−1)
∣∣∣∣=
1
s
∣∣unα − unα−1
∣∣ .
93
94 Appendix
Because β′ = α+ dsνe, the third summand can be written as
β′−1∑i=α+2
∣∣un+1i − un+1
i−1
∣∣=
β′−1∑i=α+2
∣∣∣∣unα +
(i− αs− ν)
(unα − unα−1)− unα −(i− 1− α
s− ν)
(unα − unα−1)
∣∣∣∣=
β′−1∑i=α+2
∣∣∣∣1s (unα − unα−1)
∣∣∣∣ = (β′ − α− 2)
∣∣∣∣1s (unα − unα−1)
∣∣∣∣ =dsνe − 2
s
∣∣unα − unα−1
∣∣ .The fourth part resembles the second, as it is defined by two different cases as∣∣∣un+1
β′− un+1
β′−1
∣∣∣=
∣∣∣∣unβ′−dsνe + (dsνe − sν)(unβ′−dsνe+1 − unβ′−dsνe)− u
nα −
(β′ − 1− α
s− ν)
(unα − unα−1)
∣∣∣∣=
∣∣∣∣unα + (dsνe − sν)(unα+1 − unα)− unα −(dsνe − 1
s− ν)
(unα − unα−1)
∣∣∣∣≤ (dsνe − sν)
∣∣unα+1 − unα∣∣+
(ν − dsνe − 1
s
) ∣∣unα − unα−1
∣∣ .Obviously, (dsνe − sν) ≥ 0 and
(ν − dsνe−1
s
)≥ 0, since(
ν − dsνe − 1
s
)≥ 0 ⇔ ν ≥ dsνe − 1
s⇔ sν ≥ dsνe − 1 = bsνc
is always satisfied. Finally, the fifth term is
∞∑i=β′+1
∣∣un+1i − un+1
i−1
∣∣=
∞∑i=α+dsνe+1
∣∣∣uni−dsνe + (dsνe − sν)(uni−dsνe+1 − uni−dsνe)
−uni−1−dsνe − (dsνe − sν)(uni−dsνe − uni−1−dsνe)
∣∣∣=
∞∑i=α+1
∣∣uni + (dsνe − sν)(uni+1 − uni )− uni−1 − (dsνe − sν)(uni − uni−1)∣∣
=
∞∑i=α+1
∣∣uni − uni−1 + (dsνe − sν)(uni+1 − uni ) + (sν − bsνc − 1)(uni − uni−1)∣∣
≤ (dsνe − sν)∞∑
i=α+1
∣∣uni+1 − uni∣∣+ (sν − bsνc)
∞∑i=α+1
∣∣uni − uni−1
∣∣ .
Appendix 95
Altogether, the method is TVD because it holds, that
TV (un+1)
≤ (1− ν)α∑
i=−∞
∣∣uni − uni−1
∣∣+ να∑
i=−∞
∣∣uni−1 − uni−2
∣∣+dsνe − 1
s
∣∣unα − unα−1
∣∣+ (dsνe − sν)
∣∣unα+1 − unα∣∣+
(ν − dsνe − 1
s
) ∣∣unα − unα−1
∣∣+ (dsνe − sν)
∞∑i=α+1
∣∣uni+1 − uni∣∣+ (sν − bsνc)
∞∑i=α+1
∣∣uni − uni−1
∣∣= (1− ν)
α∑i=−∞
∣∣uni − uni−1
∣∣+ να−1∑i=−∞
∣∣uni − uni−1
∣∣+ ν∣∣unα − unα−1
∣∣+ (dsνe − sν)
∞∑i=α
∣∣uni+1 − uni∣∣+ (sν − bsνc)
∞∑i=α+1
∣∣uni − uni−1
∣∣= (1− ν)
α∑i=−∞
∣∣uni − uni−1
∣∣+ να∑
i=−∞
∣∣uni − uni−1
∣∣+ (dsνe − sν)
∞∑i=α+1
∣∣uni − uni−1
∣∣+ (sν − bsνc)∞∑
i=α+1
∣∣uni − uni−1
∣∣=
α∑i=−∞
∣∣uni − uni−1
∣∣+ (dsνe − bsνc)∞∑
i=α+1
∣∣uni − uni−1
∣∣ = TV (un)
Now, prove analogously that the method is still TVD if the jump lies between grid
points. Denote t := sγ + sν + (1− s) α∆x , then the method can be written as
un+1i =
uni − ν(uni − uni−1), if i ≤ γ,
unγ + i−ts (unγ − unγ−1), if γ < i ≤ t,
unγ + i−ts (unγ+1 − unγ ), if t < i < β′,
uni−dsνe + (dsνe − sν)(uni−dsνe+1 − uni−dsνe), if i ≥ β′.
Therefore, the total variation is composed of seven different summands
TV (un+1) =
γ∑i=−∞
∣∣un+1i − un+1
i−1
∣∣︸ ︷︷ ︸
(1)
+∣∣∣un+1γ+1 − u
n+1γ
∣∣∣︸ ︷︷ ︸(2)
+
t∑i=γ+2
∣∣un+1i − un+1
i−1
∣∣︸ ︷︷ ︸
(3)
+∣∣un+1t+1 − u
n+1t
∣∣︸ ︷︷ ︸(4)
+
β′−1∑i=t+2
∣∣un+1i − un+1
i−1
∣∣︸ ︷︷ ︸
(5)
+∣∣∣un+1β′− un+1
β′−1
∣∣∣︸ ︷︷ ︸(6)
+
∞∑i=β′+1
∣∣un+1i − un+1
i−1
∣∣︸ ︷︷ ︸
(7)
.
96 Appendix
For these, it holds that
(1) =
γ∑i=−∞
∣∣uni − ν(uni − uni−1)− uni−1 + ν(uni−1 − uni−2)∣∣
≤ (1− ν)
γ∑i=−∞
∣∣uni − uni−1
∣∣+ ν
γ∑i=−∞
∣∣uni−1 − uni−2
∣∣ ,
(2) =
∣∣∣∣unγ +γ + 1− t
s(unγ − unγ−1)− unγ + ν(unγ − unγ−1)
∣∣∣∣≤(γ + 1− t
s+ ν
)︸ ︷︷ ︸
=(1− 1s )(
α∆x−γ)+ 1
s≥0
∣∣unγ − unγ−1
∣∣ ,
(3) =t∑
i=γ+2
∣∣∣∣unγ +i− ts
(unγ − unγ−1)− unγ −i− 1− t
s(unγ − unγ−1)
∣∣∣∣=
t∑i=γ+2
∣∣∣∣1s (unγ − unγ−1)
∣∣∣∣ =t− γ − 1
s
∣∣unγ − unγ−1
∣∣ ,
(4) =
∣∣∣∣unγ +t+ 1− t
s(unγ+1 − unγ )− unγ −
t− ts
(unγ − unγ−1)
∣∣∣∣ =1
s
∣∣unγ+1 − unγ∣∣ ,
(5) =
β′−1∑i=t+2
∣∣∣∣unγ +i− ts
(unγ+1 − unγ )− unγ −i− 1− t
s(unγ+1 − unγ )
∣∣∣∣=
β′−1∑i=t+2
∣∣∣∣1s (unγ+1 − unγ )
∣∣∣∣ =β′ − t− 2
s
∣∣unγ+1 − unγ∣∣ ,
(6) =
∣∣∣∣unβ′−dsνe + (dsνe − sν)(unβ′−dsνe+1 − unβ′−dsνe)− u
nγ −
β′ − 1− ts
(unγ+1 − unγ )
∣∣∣∣≤∣∣∣unβ′−dsνe − unγ ∣∣∣+ (dsνe − sν)
∣∣∣unβ′−dsνe+1 − unβ′−dsνe
∣∣∣+
∣∣∣∣ β′ − 1− ts
∣∣∣∣ ∣∣unγ+1 − unγ∣∣ ,
Appendix 97
(7) =∞∑
i=β′+1
∣∣∣uni−dsνe + (dsνe − sν)(uni−dsνe+1 − uni−dsνe)
−uni−dsνe−1 − (dsνe − sν)(uni−dsνe − uni−dsνe−1)
∣∣∣=
∞∑i=β′+1
∣∣∣(dsνe − sν)(uni−dsνe+1 − uni−dsνe)− (dsνe − sν − 1)(uni−dsνe − u
ni−dsνe−1)
∣∣∣=
∞∑i=β′+1
∣∣∣(dsνe − sν)(uni−dsνe+1 − uni−dsνe)− (bsνc − sν)(uni−dsνe − u
ni−dsνe−1)
∣∣∣≤ (dsνe − sν)
∞∑i=β′+1
∣∣∣uni−dsνe+1 − uni−dsνe
∣∣∣+ (sν − bsνc)∞∑
i=β′+1
∣∣∣uni−dsνe − uni−dsνe−1
∣∣∣ .Overall, it holds for the total variation
TV (un+1) = (1) + (2) + (3) + (4) + (5) + (6) + (7)
≤ (1− ν)
γ∑i=−∞
∣∣uni − uni−1
∣∣+ ν
γ+1∑i=−∞
∣∣uni−1 − uni−2
∣∣+
(β′ − t− 1
s+
∣∣∣∣ β′ − t− 1
s
∣∣∣∣) ∣∣unγ+1 − unγ∣∣+∣∣∣unβ′−dsνe − unγ ∣∣∣
+ (dsνe − sν)∞∑i=β′
∣∣∣uni−dsνe+1 − uni−dsνe
∣∣∣+ (sν − bsνc)∞∑
i=β′+1
∣∣∣uni−dsνe − uni−dsνe−1
∣∣∣=
γ∑i=−∞
∣∣uni − uni−1
∣∣+∞∑
i=β′−dsνe+1
∣∣uni − uni−1
∣∣+∣∣∣unβ′−dsνe − unγ ∣∣∣
+
(β′ − t− 1
s+
∣∣∣∣ β′ − t− 1
s
∣∣∣∣) ∣∣unγ+1 − unγ∣∣
=
b α∆xc∑i=−∞
∣∣uni − uni−1
∣∣+∞∑
i=d α∆x+sνe−dsνe+1
∣∣uni − uni−1
∣∣+∣∣∣und α∆x+sνe−dsνe − u
nb α∆xc
∣∣∣+
(β′ − t− 1
s+
∣∣∣∣ β′ − t− 1
s
∣∣∣∣) ∣∣∣unb α∆xc+1− unb α∆xc
∣∣∣=
b α∆xc∑i=−∞
∣∣uni − uni−1
∣∣+
∞∑i=b α∆x+sνc−bsνc+1
∣∣uni − uni−1
∣∣+∣∣∣unb α∆x+sνc−bsνc − u
nb α∆xc
∣∣∣+
(β′ − t− 1
s+
∣∣∣∣ β′ − t− 1
s
∣∣∣∣) ∣∣∣unb α∆xc+1− unb α∆xc
∣∣∣ .
98 Appendix
Since⌊α
∆x + sν⌋− bsνc =
⌊α
∆x + sν − bsνc⌋∈ ⌊α
∆x
⌋,⌊α
∆x
⌋+ 1, the above equates to
TV (un) if the last term is zero. This is the case if
β′ − t− 1
s≤ 0 ⇔ β′ ≤ t+ 1
⇔⌈ α
∆x+ sν
⌉≤ s
⌊ α
∆x
⌋+ sν + (1− s) α
∆x+ 1
⇔⌊ α
∆x+ sν
⌋≤ α
∆x+ sν + s
⌊ α
∆x
⌋− 1
s
α
∆x,
and therefore, if 1sα
∆x is small enough in relation to the other terms, which is the case in
all relevant examples.
Bibliography
[1] John Allison et al. Geant4 Developments and Applications. IEEE Trans. Nucl.
Sci., 53:270–278, 2006.
[2] Christophe Berthon, Martin Frank, Celine Sarazin, and Rodolphe Turpault. Nu-
merical methods for balance laws with space dependent flux: Application to radio-
therapy dose calculation. Commun. Comput. Phys., 10(5):1184–1210, 2011.
[3] Francois Bouchut. Nonlinear Stability for Finite Volume Methods for Hyperbolic
Conservation Laws, volume 4 of Frontiers in Mathematics. Birkhauser, 2004.
[4] Richard Courant, Kurt O. Friedrichts, and Hans Lewy. Uber die partiellen Differen-
zengleichungen der mathematischen Physik. Math. Ann., 100(1):32–74, 1928.
[5] Roland Duclous, Bruno Dubroca, and Martin Frank. A deterministic partial dif-
ferential equation model for dose calculation in electron radiotherapy. Phys. Med.
Biol., 55(13):3843–3857, 2010.
[6] Martin Frank, Hartmut Hensel, and Axel Klar. A fast and accurate moment method
for the Fokker-Planck equation and applications to electron radiotherapy. SIAM J.
Appl. Math., 67(2):582–603, 2007.
[7] Martin Frank and Edgar Olbrant. Generalized Fokker-Planck theory for electron
and photon transport in biological tissue: application to radiotherapy. Comput.
Math. Methods Med., 11(4):313–339, 2010.
[8] Hartmut Hensel, Rodrigo Iza-Teran, and Norbert Siedow. Deterministic model for
dose calculation in photon radiotherapy. Phys. Med. Biol., 51(3):675–693, 2006.
[9] Peter Lax and Robert D. Richtmyer. Survey of the Stability of Linear Finite Dif-
ference Equations. Comm. Pure Appl. Math., 9(2):267–293, 1956.
[10] Peter Lax and Burton Wendroff. Systems of Conservation Laws. Comm. Pure Appl.
Math., 13(2):217–237, 1960.
99
100 Bibliography
[11] Randall J. Leveque. Numerical Methods for Conservation Laws. Number 3 in
Lecture Notes in Mathematics. Birkhlauser, 1994.
[12] Randall J. Leveque. Finite Volume Methods for Hyperbolic Problems. Number 31
in Cambridge Texts in Applied Mathematics. Cambridge University Press, 2002.
[13] Francesc Salvat, Jose M. Fernandez-Varea, and Josep Sempau. Penelope-2008: A
Code System for Monte Carlo Simulation of Electron and Photon Transport. Issy-
les-Moulineaux: OECD Nuclear Energy Agency, 2008.
[14] Eleuterio F. Toro. Riemann Solvers and Numerical Methods for Fluid Dynamics.
A practical Introduction. Springer, 1997.
Erklarung
Hiermit versichere ich, dass ich die vorliegende Arbeit selbstandig und ohne Benutzung
anderer als der angegebenen Quellen und Hilfsmittel angefertigt habe. Alle Zitate sind
als solche kenntlich gemacht.
Aachen, den 27.10.2011