Sie sind auf Seite 1von 101

Numerical methods for hyperbolic balance laws with discontinuous flux functions and applications in radiotherapy

Numerische Verfahren f¨ur hyperbolische Bilanzgleichungen mit unstetiger Flussfunktion und Anwendungen in der Strahlentherapie

von Nadine Pawlitta

27.10.2011

Masterarbeit in Mathematik

vorgelegt der Fakult¨at f¨ur Mathematik, Informatik und Naturwissenschaften der Rheinisch-Westf¨alischen Technischen Hochschule Aachen

Angefertigt bei Prof. Dr. Martin Frank Lehrstuhl f¨ur Mathematik CCES

Zweitgutachter Prof. Dr. Michael Herty Lehrstuhl C f¨ur Mathematik

3

Danksagung

Ich m¨ochte mich an dieser Stelle bei all denen bedanken, die mich bei der Anfertigung meiner Masterarbeit unterst¨utzt haben.

Besonderer Dank gilt Herrn Professor Martin Frank f¨ur die Betreuung dieser Arbeit und f¨ur die vielen hilfreichen Anregungen.

Zudem bedanke ich mich bei den Mitarbeitern des MathCCES und meinen Freunden und Kommilitonen f¨ur die freundliche Atmosph¨are und fachliche Unterst¨utzung.

Nicht zuletzt m¨ochte ich mich auch bei meiner Familie bedanken, ohne die dieses Studium niemals m¨oglich gewesen w¨are.

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

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, ˜)

¯

1

ρ(x) x

Ψ 1 (x, ˜) = 0,

¯

ρ(x) x

1

Ψ 0 (x, ˜) χ

¯

Ψ 1 (x,

¯

˜)

˜) = T ) Ψ 1 (x, ˜)

¯

¯

Ψ 0 (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

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

t u(x, t) + x f (u(x, t)) =

0,

x R, t > 0

u(x, 0) = u 0 (x),

x R

(1.1)

where f C 1 (R) and u 0

The equation u t + (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 x 1 and x 2 at time t can be described by

L (R).

x

x 2

1

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

x

x

1

2

u(x, t)dx = f (u(x 1 , t)) f (u(x 2 , t)) .

(1.2)

Assuming that u and f are smooth, this results in

∂t

x

x

1

2

u(x, t)dx =

x

x

1

2

x f (u(x, t)) dx

10

1 Introduction to hyperbolic conservation laws

which can be written as

x

x

1

2

t u(x, t) + x f (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

t u(x, t) + a x u(x, t) = 0

(1.3)

is a special case of (1.1) with a = f (u) since (f (u)) x = f (u)u x = au x . 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) = u 0 (x), the solution of this equation is given by u(x, t) = u 0 (x at) as

t u 0 (x at) + a x u 0 (x at) = au 0 (x at) + au 0 (x at) = 0.

Therefore, for arbitrary x 0 , the solution u(x, t) is constant along the so-called character- istics X(t) = x 0 + at of the equation because

d dt u(X(t), t) = u t (X(t), t) + X (t)u x (X(t), t)
d
dt u(X(t), t) = u t (X(t), t) + X (t)u x (X(t), t) = u t + au x = 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 u 0 simply shifts to the right in time, as can be seen in figure 1.2.

initial condition, time t=0

1 0 0 25 50
1
0
0
25
50

time t=300

1 0 0 25 50
1
0
0
25
50

time t=150

1 0 0 25 50
1
0
0
25
50

time t=450

1 0 0 25 50
1
0
0
25
50

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

since the system

can be written as

u t + Au x = 0

u t +

(f (u)) x

= 0

u t +

f (u)u x = 0

if f is smooth and f (u) = A R m×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

u t + Au x = 0

v t + diag(λ 1 ,

R 1 u t + R 1 ARR 1 u x = 0

, λ m )v x = 0

v

p

t

+ λ p v p = 0,

x

for p = 1

m

with R 1 u =: v and therefore, the original system is equivalent to a system of m in-

dependent advection equations. always hyperbolic.

Note that a scalar, first-order differential equation is

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

C i = (x i1/2 , x i+1/2 )

with size ∆x i = x i+1/2 x i1/2 and ∆x i = ∆x in the case of a uniform grid as pictured in figure 1.3.

t n+1

t n

x
x

x

i-1

x

i

x

i+1

t

Figure 1.3: Example for a uniform grid.

The approximation u n be expressed as

i

to the average value of the solution over C i at time t n can then

u n

i

x C i

1

u(x, t n )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 C i

u(x, t)dx = f u(x i1/2 , t) f u(x i+1/2 , t) .

Integration over time and rearrangement gives

t

C i u(x, t n+1 )dx C i u(x, t n )dx =

t

n

n+1

t

f u(x i1/2 , t) dt

t

n

n+1

f u(x i+1/2 , t) dt

x C i

1

u(x, t n+1 )dx =

x C i

1

u(x, t n )dx

t

x t

t

1

t

n

n+1

f u(x i+1/2 , t) dt

t

t

1

t

n

n+1

f u(x i1/2 , t) dt

where ∆t = t n+1 t n is one time step. The method should therefore have the form

t

n+1

i

u

= u n i

x (F

n

i+1/2 F

i1/2 )

n

(1.4)

with u n approximated as before and the average flux F

i

n i1/2 as

F

n

i1/2

t

1

t

n

t n+1

f u(x i1/2 , t) dt.

This can be computed by means of a numerical flux function F where it is assumed for now that the flux F i1/2 depends only on the values u n i1 and u n so that

n

i

i1/2 = F(u n i1 , u n

F

n

i

).

(1.5)

Thus, the method is defined by the flux and approximates the value u n+1

i

u

n+1

i

= u n i

x t F(u n , u i+1 n ) − F(u n

i

i1 , u n

i

) ,

by

(1.6)

which is the standard formulation of a finite volume method. More generally, if the flux F i1/2 depends on u n im up to u i+m1 by

n

n

, the method is given

u

n+1

i

= u n i

t

x F(u n

im+1 ,

, u n i+m ) − F(u im

n

,

.

.

. , u n

i+m1 ) .

Let N then describe the numerical method as

N(u n

im ,

, u n

i+m ) = u n

i

t x F(u im+1

n

,

, u n i+m ) − F(u im

n

,

.

.

. , u n

i+m1 ) .

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 F i1/2 = f (u), F must

n

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 mx, t),

, u(x + mx, t)) u(x, t + ∆t)) .

(1.7)

The numerical method is now said to be consistent if

t0 L(., t) = 0.

lim

Furthermore, if the error can be written as

L(., t) ct p

(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 |x i | 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) ct p

L(., t) c˜∆x p

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(., tt) − N t (u 0 (.)) 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 ∆x p as well. For a constant C it then holds that

= Cx p

log

= log C + 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) = u 0 (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 u n+1

using a three point stencil con-

sisting of u n

i

i1 ,u n

i

and u n

i+1

, the domain of dependence is the set

D(x, t) = x˜ x x t x˜ x + x t

t

t

as can be seen in figure 1.4. There the value at the point (x i , t n+1 ) depends on (x i1 , t n ),

(x i , t n ) and (x i+1 , t n ) and these in turn on (x i2 , t n1 ) up to (x i+2 , t n1 ) and so on, so that the edges of the resulting triangle can be described by t x x t and t x+ x t.

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

t n+1

t n

t n-1

x i x i-2 x i-1 x i+1 x i+2
x i
x i-2
x i-1
x i+1
x i+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

which can be reduced to

where the number ν =

at

x

x x t x at x + x

t

t t,

at

x

1

is called the courant number.

(1.9)

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

u n u

i

n

j

N(u n ) ≥ N(u

i

n

j

)

and it is called monotonicity-preserving if

u

0

i

u

0

j

u n u

i

n

j .

Another requirement deals with the total variation of a function. For an arbitrary function g the total variation is defined as

T V (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 u n this simplifies to

TV (u n ) =

i=−∞

|u n u n

i

i1 |.

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 (u n+1 ) TV (u n )

for u n+1 = N(u n ). 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 F i1/2 according to the structure of the solution in order to achieve better results. For the constant-coefficient advection equation u t + au x = 0 it was shown that the solution is constant along the characteristics, that

= u(x i + at, t n+1 ). Hence, if a is positive, u(x i , t n+1 ) depends only on the

values of u at time t n to the left of x i and the same should hold for u n+1 . In other words,

the flux F i1/2 should be determined by u i1

is u(x i , t n )

n

i

n

n

. Choosing

i1/2 = F(u n i1 , u n

F

n

i

) = au n

i1

in (1.4) yields the first-order upwind method for the advection equation as

u

n+1

i

= u n

i

at

x

(u n u i1 n ).

i

(1.10)

It is important to observe that this ansatz is only correct if u(x i , t n+1 ) depends solely on u(x i1 , t n ), 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(x i , t n+1 ) = u(x i at, t n ) and therefore x i at x i x = x i1 . 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 C i . In the second part this is no longer the case and the CFL condition is breached.

t n+1

t n

x i x i-1 x i+1
x i
x i-1
x i+1

t n+1

t n

x i x i-1 x i+1
x i
x i-1
x i+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 ν =

at

x

= 1 because then

which complies with

u

n+1

i

= u n (u n u n

i

i

i1 ) = u i1

n

,

u(x i , t n+1 ) = u(x i at, t n ) = u(x i x, t n ) = u(x i1 , t n ).

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(x i1 , t n ) and u(x i , t n ) to compute u(x i , t n+1 )

since u(x i , t n+1 ) = u(x i at, t n ) =

u(x i νx, t n ). This is the result of the evaluation of the linear interpolation polynomial through x i1 and x i at the point x i at. The polynomial has the form

which simplifies to

u n + u n

i

i1 u n

x i1 x

i (x x i ) = u n u n

i

i

i1 u n

i

x

(x x i ),

u n + ν(u n

i

i1 u n

i

when inserting x = x i at.

) = u n ν(u n u n

i

i

i1 )

1 Introduction to hyperbolic conservation laws

19

t n+1

t n

to hyperbolic conservation laws 19 t n+1 t n x i-1 x -aΔt i x i
to hyperbolic conservation laws 19 t n+1 t n x i-1 x -aΔt i x i

x i-1

x -aΔt i x i
x -aΔt
i
x i
conservation laws 19 t n+1 t n x i-1 x -aΔt i x i Figure 1.6:

Figure 1.6: The upwind method for ν < 1.

Properties of the upwind method

examining the local truncation error (1.7) that is given as

The method is of first order as can be shown by

L(x i , t n ) =

1

t (u(x i , t n ) ν(u(x i , t n ) u(x i1 , t n )) u(x i , t n+1 )) .

Replace u(x i1 , t n ) and u(x i , t n+1 ) by their Taylor series expansion

u(x i1 , t n ) = u(x i , t n )

u(x i , t n+1 ) = u(x i , t n ) +

x u x (x i , t n ) + 1 2 x 2 u xx (x i , t n ) + O(∆x 3 ),

t u t (x i , t n ) + 1 2 t 2 u tt (x i , t n ) + O(∆t 3 ),

which yields

L(x i , t n ) =

=

=

t u(x i , t n ) ν u(x i , t n ) u(x i , t n ) + ∆x

1

u x (x i , t n ) 1 2 x 2 u xx (x i , t n ) − O(∆x 3 )

u(x i , t n ) t

u t (x i , t n ) 1 2 t 2 u tt (x i , t n ) − O(∆t 3 )

t νx u x (