numerical methods for hyperbolic balance laws

Upload: sheng-wang

Post on 05-Apr-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    1/101

    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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    2/101

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    3/101

    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.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    4/101

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    5/101

    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 . . . . . . . . . . . . . . . . . . . 171.3.1 The Upwind method . . . . . . . . . . . . . . . . . . . . . . . . . . 17

    1.3.2 Godunovs 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    6/101

    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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    7/101

    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 fromapproximately 1, which corresponds to water, to 103, 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 connectionbetween 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/2/2019 Numerical Methods for Hyperbolic Balance Laws

    8/101

    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. Whileit 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.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    9/101

    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 byx2x1

    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

    x2x1

    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

    x2x1

    u(x, t)dx =

    x2x1

    xf(u(x, t)) dx

    9

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    10/101

    10 1 Introduction to hyperbolic conservation laws

    which can be written asx2x1

    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.

    Figure 1.1: Characteristics for the advection equation.

    Figure 1.1 shows for example some characteristics for an advection equation with positive

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    11/101

    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

    1

    initial condition, time t=0

    0 25 500

    1

    time t=150

    0 25 500

    1

    time t=300

    0 25 500

    1

    time 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 Rmm 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)R1

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    12/101

    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 R1ut + R

    1ARR1ux = 0

    vt + diag(1, . . . , m)vx = 0

    vpt + pvpx = 0, for p = 1 . . . m

    with R1u =: 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 theone-dimensional case, one of those cells is an interval

    Ci = (xi1/2, xi+1/2)

    with size xi = xi+1/2 xi1/2 and xi = x in the case of a uniform grid as pictured

    in figure 1.3.

    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

    Ci

    u(x, tn)dx.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    13/101

    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 Ci u(x, t)dx = fu(xi1/2, t) fu(xi+1/2, t) .Integration over time and rearrangement gives

    Ci

    u(x, tn+1)dx

    Ci

    u(x, tn)dx =

    tn+1tn

    f

    u(xi1/2, t)

    dt

    tn+1tn

    f

    u(xi+1/2, t)

    dt

    1

    x

    Ci

    u(x, tn+1)dx =1

    x

    Ci

    u(x, tn)dx

    t

    x

    1

    t

    tn+1tn

    f

    u(xi+1/2, t)

    dt 1

    t

    tn+1tn

    f

    u(xi1/2, t)

    dt

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

    un+1i = uni

    tx

    (Fni+1/2 Fni1/2) (1.4)

    with uni approximated as before and the average flux Fni1/2 as

    Fni1/2 1

    t

    tn+1tn

    f

    u(xi1/2, t)

    dt.

    This can be computed by means of a numerical flux function F where it is assumed for

    now that the flux Fni1/2 depends only on the values uni1 and u

    ni so that

    Fni1/2 = F(uni1, u

    ni ). (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(u

    ni1, u

    ni )

    , (1.6)

    which is the standard formulation of a finite volume method.

    More generally, if the flux Fni1/2 depends on unim up to u

    ni+m1, the method is given

    by

    un+1i = uni

    t

    x

    F(unim+1, . . . , u

    ni+m) F(u

    nim, . . . , u

    ni+m1)

    .

    Let N then describe the numerical method as

    N(unim, . . . , uni+m) = u

    ni

    t

    x

    F(unim+1, . . . , u

    ni+m) F(u

    nim, . . . , u

    ni+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.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    14/101

    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 sufficientfor 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 Fni1/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 mx, t), . . . , u(x + mx, t)) u(x, t + t)) . (1.7)

    The numerical method is now said to be consistent if

    limt0

    L(., t) = 0.

    Furthermore, if the error can be written as

    L(., t) ctp (1.8)

    for a constant c and arbitrary, smooth initial data, the method is of order p. In this

    thesis, the discrete 1-norm x1 = i |xi| is used, though other norms can be used aswell, 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) ctp L(., t) cxp

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    15/101

    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) Nt(u0(.))1where Nt 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

    = Cxp log = log C + p logx.

    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 uni1,uni and u

    ni+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 (xi1, tn),

    (xi, tn) and (xi+1, tn) and these in turn on (xi2, tn1) up to (xi+2, tn1) and so on, so

    that the edges of the resulting triangle can be described by t x xt t and t x+xt t.

    Hence, for the CFL condition to be fulfilled, the domain of dependence of the given PDE

    has to be situated inside this triangle.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    16/101

    16 1 Introduction to hyperbolic conservation laws

    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 atx 1 (1.9)

    where the number =

    atx

    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(u

    ni ) N(u

    nj )

    and it is called monotonicity-preserving if

    u0i u0j uni unj .

    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 sup0

    1

    |g(x) g(x )|dx.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    17/101

    1 Introduction to hyperbolic conservation laws 17

    For the special case of the piecewise constant function or rather grid function un this

    simplifies to

    T V(un) =

    i=

    |uni uni1|.

    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

    T V(un+1) T V(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 methodIt is reasonable to choose the flux function Fni1/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 + at, tn+1). Hence, if a is positive, u(xi, tn+1) depends only on the

    values ofu at time tn to the left ofxi and the same should hold for un+1i . In other words,

    the flux Fni1/2 should be determined by uni1. Choosing

    Fni1/2 = F(uni1, u

    ni ) = au

    ni1

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

    un+1i = uni

    at

    x(uni u

    ni1). (1.10)

    It is important to observe that this ansatz is only correct if u(xi, tn+1) depends solely

    on u(xi1, tn), which makes the above choice of the flux sensible. This is given by the

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    18/101

    18 1 Introduction to hyperbolic conservation laws

    CFL condition for the advection equation (1.9) because u(xi, tn+1) = u(xi at, tn) and

    therefore xi at xi x = xi1. 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.

    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 =atx = 1 because then

    un+1i = uni (u

    ni u

    ni1) = u

    ni1,

    which complies with

    u(xi, tn+1) = u(xi at, tn) = u(xi x, tn) = u(xi1, 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(xi1, tn) and u(xi, tn) to compute u(xi, tn+1) since u(xi, tn+1) = u(xi at, tn) =

    u(xi x, tn). This is the result of the evaluation of the linear interpolation polynomial

    through xi1 and xi at the point xi at. The polynomial has the form

    uni + uni1 u

    ni

    xi1 xi(x xi) = uni u

    ni1 u

    ni

    x(x xi),

    which simplifies to

    uni + (uni1 u

    ni ) = u

    ni (u

    ni u

    ni1)

    when inserting x = xi at.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    19/101

    1 Introduction to hyperbolic conservation laws 19

    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(xi1, tn)) u(xi, tn+1)) .

    Replace u(xi1, tn) and u(xi, tn+1) by their Taylor series expansion

    u(xi1, tn) = u(xi, tn) x ux(xi, tn) +1

    2x2uxx(xi, tn) + O(x

    3),

    u(xi, tn+1) = u(xi, tn) + t ut(xi, tn) +1

    2t2utt(xi, tn) + O(t

    3),

    which yields

    L(xi, tn) =1

    t

    u(xi, tn)

    u(xi, tn) u(xi, tn) + x ux(xi, tn)

    1

    2x2uxx(xi, tn) O(x

    3)

    u(xi, tn) t ut(xi, tn) 1

    2t2utt(xi, tn) O(t

    3)

    =1

    t

    x ux(xi, tn) +

    1

    2x2uxx(xi, tn) + O(x

    3)

    t ut(xi, tn) 1

    2t2utt(xi, tn) O(t

    3)

    = a ux(xi, tn) +1

    2 axuxx(xi, tn) +a

    x O(x3)

    ut(xi, tn) 1

    2tutt(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,

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    20/101

    20 1 Introduction to hyperbolic conservation laws

    so that

    L(xi, tn) =

    1

    2 axuxx(xi, tn)

    1

    2 a

    2

    tuxx(xi, tn) + O(x

    2

    , t

    2

    )

    =1

    2a(x at)uxx(xi, tn) + O(x

    2, 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    21/101

    1 Introduction to hyperbolic conservation laws 21

    additional property since

    T V(un+1) =

    i=

    un+1i u

    n+1i1

    =

    i=

    (1 )(uni uni1) + (uni1 uni2)

    i=

    (1 )uni uni1 +

    i=

    uni1 uni2

    = (1 )T V(un) + T V(un)

    = T V(un).

    1.3.2 Godunovs method

    The upwind method can be interpreted as a special case of Godunovs 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 = (xi1/2, xi+1/2), that is

    un+1i =1

    x

    Ci

    u(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 = u

    ni+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.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    22/101

    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

    2t2utt(xi, tn) + O(t

    3).

    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) atux(xi, tn) +1

    2a2t2uxx(xi, tn).

    In a last step, approximate the spatial derivatives with central differences

    ux(xi, tn) =u(xi+1, tn) u(xi1, tn)

    2x,

    uxx(xi, tn) =ux(xi+1/2, tn) ux(xi1/2, tn)

    x

    =u(xi+1,tn)u(xi,tn)

    x u(xi,tn)u(xi1,tn)

    x

    x

    = u(xi+1, tn) 2u(xi, tn) u(xi1, tn)x2 .

    Together, this results in

    u(xi, tn+1) = u(xi, tn) at

    2x(u(xi+1, tn) u(xi1, tn))

    +a2t2

    2x2(u(xi+1, tn) 2u(xi, tn) u(xi1, tn))

    so the Lax-Wendroff method for the advection equation has the form

    un+1i = uni

    at

    2x uni+1 u

    ni1 +

    1

    2 at

    x 2

    uni+1 2u

    ni + u

    ni1 . (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 (xi1, u

    ni1) give the

    interpolation polynomial

    uni+1 +uni+1 u

    ni

    x(x xi+1) +

    uni+1 2uni + u

    ni1

    2x2(x xi+1)(x xi),

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    23/101

    1 Introduction to hyperbolic conservation laws 23

    which is the same as (1.11) for x = xi at.

    The method can be written in conservation form since

    un+1i = uni

    at

    2x uni+1 u

    ni1 +

    1

    2 at

    x 2

    uni+1 2u

    ni + u

    ni1

    = uni t

    x

    a

    2

    uni+1 u

    ni1

    a2t

    2x

    uni+1 2u

    ni + u

    ni1

    = uni

    t

    x(Fni+1/2 F

    ni1/2)

    with

    Fni1/2 = F(uni1, u

    ni ) =

    a

    2

    uni + u

    ni1

    a2t

    2x

    uni u

    ni1

    .

    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 bythe same approach as for the upwind method. Begin with

    L(xi, tn) =1

    t

    u(xi, tn)

    2(u(xi+1, tn) u(xi1, tn))

    +2

    2(u(xi+1, tn) 2u(xi, tn) + u(xi1, tn)) u(xi, tn+1)

    .

    Replace u(xi+1, tn), u(xi1, tn) and u(xi, tn+1) again by their Taylor series expansion

    u(xi1, tn) = u(xi, tn) x ux(xi, tn) +1

    2x2uxx(xi, tn)

    1

    6x3uxxx(xi, tn) + O(x

    4),

    u(xi, tn+1) = u(xi, tn) + t ut(xi, tn) +

    1

    2 t2

    utt(xi, tn) +

    1

    6 t3

    uttt(xi, tn) + O(t4

    ).

    The local truncation error then becomes

    L(xi, tn) =1

    t

    u(xi, tn)

    2

    2x ux(xi, tn) +

    1

    3x3uxxx(xi, tn)

    +2

    2

    2u(xi, tn) + x

    2uxx(xi, tn) + 2O(x4) 2u(xi, tn)

    u(xi, tn) t ut(xi, tn)

    1

    2t2utt(xi, tn)

    1

    6t3uttt(xi, tn) O(t

    4)

    =1

    t x ux(xi, tn)

    6x3uxxx(xi, tn) +

    2

    2x2uxx(xi, tn)

    2O(x4)

    t ut(xi, tn) 1

    2t2utt(xi, tn)

    1

    6t3uttt(xi, tn) O(t

    4)

    = aux(xi, tn) 1

    6ax2uxxx(xi, tn) +

    a2

    2tuxx(xi, tn)

    a2t

    x2O(x4)

    ut(xi, tn) 1

    2tutt(xi, tn)

    1

    6t2uttt(xi, tn) O(t

    3).

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    24/101

    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 = a

    3uxxx,

    to get

    L(xi, tn) = 1

    6ax2uxxx(xi, tn) +

    1

    6a3t2uxxx(xi, tn) + O(x

    3, t3)

    =1

    6a(a2t2 x2)uxxx(xi, tn) + O(x

    3, 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

    0LaxWendroff

    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 notthe 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    25/101

    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.2

    Upwind at time t=100

    0 10 200.2

    0

    0.2

    0.4

    0.6

    0.8

    1

    1.2

    LaxWendroff 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 methoddecreases 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.5LaxWendroff

    least squares approximation(slope 0.7118)

    error

    Figure 1.10: Logarithmic error plot for the upwind and the Lax-Wendroff method.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    26/101

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    27/101

    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

    t

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

    u(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.

    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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    28/101

    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

    1

    initial condition, time t=0

    0 25 500

    1

    time t=50

    0 25 500

    1

    time t=75

    0 25 500

    1

    time 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.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    29/101

    2 The advection equation with non constant velocity 29

    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 x4a2

    . (2.2)

    Overall, this yields the solution as

    u(x, t) =

    u0(x a1t), if x ,

    u0

    1 a1a2

    + a1a2 x a1t

    , if < x < + a2t,

    u0(x a2t), if x + a2t

    where u0 1 a1a2 + a1a2x a1t = u0( a1t) = u0 a1 +a2txa2 .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

    = a1u0(x a1t) + a1u

    0(x a1t) = 0.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    30/101

    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 = u01 a1

    a2 +a1

    a2

    x a1tt + a2u01 a1

    a2 +a1

    a2

    x a1tx= a1u

    0

    1

    a1a2

    +

    a1a2

    x a1t

    + a2

    a1a2

    u0

    1

    a1a2

    +

    a1a2

    x 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. Theproblem that arises when the velocity is no longer constant is that the CFL condition

    = a(x)tx 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 ofa(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)=

    x1a1

    =x2

    a2

    with 1, so that the CFL condition is satisfied.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    31/101

    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.

    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 = a1tx1 =a2tx2

    , one can

    apply the upwind method

    un+1i = uni (u

    ni u

    ni1)

    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 beconstructed 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    32/101

    32 2 The advection equation with non constant velocity

    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 a1t, where the characteristic through (xi, tn+1)

    reaches tn, into the interpolation polynomial to the data points (xi1, 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).

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    33/101

    2 The advection equation with non constant velocity 33

    Therefore,

    x = x+1 a2(tn+1 t) a1(t

    tn)

    = a1(t tn)

    =

    1 a1a2

    +

    a1a2

    x+1 a1t. (2.3)

    The value of the interpolation polynomial to (x, tn) and (x+1, tn) at x is

    un+1 +un+1 u

    n

    x2(x x+1) = u

    n+1 +

    1 a1a2

    ( x+1) a1t

    x2(un+1 u

    n),

    which is then the value of un+1+1. Thus, the method has the form

    un+1i = uni +1

    a1a2

    (xi)a1t

    x2(un

    i un

    i1), if i = + 1 for [x

    , x

    +1),

    uni (uni u

    ni1), else.

    Note that if + a2t 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+1differently 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 u

    n+1

    +1 has no noticeable influence on the computationof 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 =x

    a1with

    1. In this case, the CFL condition may not be fullfilled to the right of the jump

    becausea2t

    x =a2a1 and

    a2a1 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 xi1 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    34/101

    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 bya2a1

    . 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 = +

    a2tx

    = + s. An example for this situation is illustrated in

    figure 2.6. Note that = if the Courant number is sufficiently big, so that s = 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 (u

    ni u

    nj )

    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 .

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    35/101

    2 The advection equation with non constant velocity 35

    For xi , simply take xj = xi1 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 = xis. Therefore, un+1 depends on u

    n

    1

    and un+1

    on un, so that un+1

    i

    should be

    computed with un1 for < xi < . Altogether, the upwind method is

    un+1i =

    uni (uni u

    ni1), if i ,

    uni (uni u

    n1), if < i < ,

    uni (uni u

    nis), 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 un1. 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    36/101

    36 2 The advection equation with non constant velocity

    smaller step size. To confirm this, examine the method for the TVD property.

    T V(un+1) =

    i=

    un+1i u

    n+1i1

    =

    i=

    un+1i un+1i1 + un+1+1 un+1 + 1i=+2

    un+1i un+1i1 +un+1

    un+1

    1

    + i=+1

    un+1i un+1i1 .Compute each part separately, for the first one

    i=

    un+1i u

    n+1i1

    =

    i=

    uni (u

    ni u

    ni1) u

    ni1 + (u

    ni1 u

    ni2)

    =

    i=

    (1 )(uni uni1) + (uni1 uni2) (1 )

    i=

    uni uni1 + i=

    uni1 uni2since 0 1. For the second term, it holdsun+1+1 un+1 = un+1 (un+1 un1) un + (un un1)

    = (1 )

    un+1 u

    n

    .

    In the third one,

    1i=+2

    un+1i un+1i1 = 1i=+2

    uni (uni un1) uni1 + (uni1 un1)=

    1i=+2

    uni uni1 (uni uni1) (1 )

    1i=+2

    uni u

    ni1

    .

    The fourth part is given asun+1

    un+11

    = un (un uns) un1 + (un1 un1)=(1 )un un1 + uns un1

    (1 )un un1 + uns un1

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    37/101

    2 The advection equation with non constant velocity 37

    and the last as

    i=+1

    un+1i un+1i1

    =

    i=+1

    uni (uni u

    nis) u

    ni1 + (u

    ni1 u

    nis1)

    =

    i=+1

    (1 )(uni uni1) + (unis unis1) (1 )

    i=+1

    uni uni1 + i=+1

    unis unis1 .Together, this yields

    T V(un+1) (1 )

    i= uni u

    ni1

    +

    i=

    uni1 uni2 + uns un1 + i=+1

    unis unis1 ,so that the method is TVD if the last three summands add up to

    i=

    uni uni1.Since = + s,

    () :=

    i=

    uni1 uni2 + un

    s un1

    +

    i=+1

    unis unis1=

    1i=

    uni uni1 + un un1 + i=+s+1

    unis unis1=

    1i=

    uni uni1 + un un1 + i=+1

    uni uni1=

    i=

    uni uni1and 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

    a1t

    x(uni u

    ni1), if i . (2.5)

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    38/101

    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 (xi1, 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 x1 at time tn. Therefore, the method should compute the solution at

    (xi, tn+1) by means of (x, tn) and (x1, tn). The interpolation polynomial to this two

    data points is

    un +un u

    n1

    x x1(x x) = u

    n +

    x

    x(un u

    n1).

    To determine x, observe that the characteristics through (x+j, tn+1) with j = 1, . . . ,

    1 pass the jump at time tn+1 jt with a constant time interval t. It holds that

    + a2jt = x+j j = 1, . . . , 1 t =

    x

    a2,

    so that for the characteristic through (xi, tn+1) with j = i

    x = a1(t jt) = a1

    t j

    x

    a2

    = a1t + (i )

    x

    s.

    In the interpolation polynomial, this gives

    un +a1t + (i )

    xs

    x

    (un un1) = u

    n +

    i

    s

    a1t

    x (un u

    n1)

    so that

    un+1i = un +

    i

    s

    (un u

    n1), if < xi <

    . (2.6)

    Case 3. To the right of the jump, the exact solution at (xi, tn+1) with xi depends

    on (xi a2t, tn). The point xi a2t = xi sx lies between the grid points

    xi sx = xis and xis+1, so a numerical method should compute the solution

    using these two points. Using a linear interpolation through xis and xis+1 yields

    the interpolation polynomial

    unis +unis+1 u

    nis

    xis+1 xis(x xis) = u

    nis +

    unis+1 unis

    x(x xis).

    Inserting x = xi sx results in

    unis +xi sx xis

    x(unis+1 u

    nis),

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    39/101

    2 The advection equation with non constant velocity 39

    so the solution is

    un+1i = unis + (s s)(u

    nis+1 u

    nis), 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 u

    ni1), if i ,

    un +

    is

    (un u

    n1), if < i <

    ,

    unis + (s s)(unis+1 u

    nis), 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 =

    +a2tx

    =

    x + s

    .

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    40/101

    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 u

    ni1), if i ,

    uni (uni u

    n1), if < i < ,

    uni (uni u

    nis), 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=

    uni1 uni2 + uns un1 +

    i=+1

    unis unis1 =

    i=

    uni uni1 ,because now =

    x

    and = + s + 1, so that

    () =1

    i=

    uni uni1 + un+1 un1 + i=+s+2

    unis unis1

    1i=

    uni uni1 + un+1 un+ un un1 + i=+2

    uni uni1

    =

    i=

    uni uni1 .

    Consider now again the modified upwind method. For xi and xi , the value un+1i

    can be computed in the same way as derived in case 1 and 3 before, only the case < xi , the second. For x = , both yields the same result. These inequalities can be

    solved to get

    x =

    1

    a1a2

    +

    a1a2

    xi a1t <

    xi < s+ sa1t + (1 s)

    i < s+ s+ (1 s)

    x

    .

    The same computations as before then give

    un+1i =

    uni (uni u

    ni1), if i ,

    un +

    1 1s

    x +

    is

    (un u

    n1), if < i s+ s+ (1 s)

    x ,

    un +

    1 1s

    x +

    is

    (un+1 u

    n), if s+ s+ (1 s)

    x < i <

    ,

    unis + (s s)(unis+1 u

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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    42/101

    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 (x1, tn) to get the polynomial

    un+1 + (un+1 u

    n)

    x x+1x2

    +

    un+1 u

    n

    x2

    un un1

    x1

    (x x+1)(x x)

    x1 + x2

    where x = a1t = x1, so that

    un+1 = un+1 (u

    n+1 u

    n)

    x1 + x2x2

    + un+1 u

    n

    x2

    un un1

    x1 (x1 + x2)x1x1 + x2= un (u

    n+1 u

    n)

    x1x2

    +

    un+1 u

    n

    x2

    un un1

    x1

    (x1 + x2)x1

    x1 + x2.

    For un+1+1, the Lax-Wendroff method uses the data points (x+2, tn), (x+1, t

    n) 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 u

    ni

    x2(x xi+1) +

    uni+1 2uni + u

    ni1

    2x22(x xi+1)(x

    xi),

    and x =

    1 a1a2

    + a1a2xi a1t with i = +1 as in the other situations before where

    the characteristic crossed the jump. Together

    un+1+1 = un+2 +

    x x+2x2

    un+2 u

    n+1

    +

    (x x+2)(x x+1)

    2x22

    un+2 2u

    n+1 + u

    n

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    43/101

    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 u

    n+1

    +

    x x+1x2

    un+2 u

    n+1

    1

    2

    un+2 2u

    n+1 + u

    n

    +(x x+1)2

    2x

    2

    2 un+2 2u

    n+1 + u

    n

    = un+1 +x x+1

    2x2

    un+2 u

    n

    +

    (x x+1)2

    2x22

    un+2 2u

    n+1 + u

    n

    = un+1 +

    1 a1a2

    ( x+1) x1

    2x2

    un+2 u

    n

    +

    1 a1a2

    ( x+1) x1

    22x22

    un+2 2u

    n+1 + u

    n

    .

    Overall, the Lax-Wendroff method for a nonuniform grid is then defined as

    un+1i =

    uni (uni+1 u

    ni )

    x1x2

    +

    uni+1uni

    x2

    uni uni1

    x1

    (x1+x2)x1

    x1+x2, if i = ,

    uni +

    1

    a1a2

    (xi)x1

    2x2

    uni+1 u

    ni1

    +

    1

    a1a2

    (xi)x1

    2

    2x22

    uni+1 2u

    ni + u

    ni1

    , if i = + 1,

    uni 2

    uni+1 u

    ni1

    + 22 uni+1 2uni + uni1 , 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 (xi1, tn), (xi, t

    n) and (xi+1, tn)

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    44/101

    44 2 The advection equation with non constant velocity

    has the form

    uni+1 + (uni+1 u

    ni )

    x xi+1x

    + (uni+1 2uni + u

    ni1)

    (x xi+1)(x xi)

    2x2

    = u

    n

    i+1 + (u

    n

    i+1 u

    n

    i )

    x xi x

    x + (u

    n

    i+1 2u

    n

    i + u

    n

    i1)

    (x xi)2 x(x xi)

    2x2

    = uni +

    (uni+1 u

    ni )

    1

    2(uni+1 2u

    ni + u

    ni1)

    x xi

    x+ (uni+1 2u

    ni + u

    ni1)

    (x xi)2

    2x2

    = uni + (uni+1 u

    ni1)

    x xi2x

    + (uni+1 2uni + u

    ni1)

    (x xi)2

    2x2.

    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 =

    +a2t

    x

    =

    x + s

    with s = a2a1 .

    The first case, i , is not affected by the jump, so that the ordinary Lax-Wendroff

    method with (xi1

    , tn), (xi, tn), (x

    i+1, tn) and x = x

    i a

    1t can be used with

    un+1i = uni

    2

    uni+1 u

    ni1

    +

    2

    2

    uni+1 2u

    ni + u

    ni1

    .

    The second case, < i < , was subdivided into the two cases where the intervals

    [x1, 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 (x1, tn), (x, t

    n) and (x+1, tn), while the point x remains

    x =

    1 a1a2

    + a1a2xi a1t as before. The result is then

    un+1

    i= un

    + (un

    +1 un

    1)

    x x

    2x+ (un

    +1 2un

    + un

    1)

    (x x)2

    2x2

    = un +1

    2

    1

    a1a2

    x+

    i

    s

    (un+1 u

    n1)

    +1

    2

    1

    a1a2

    x+

    i

    s

    2(un+1 2u

    n + u

    n1).

    In the third case, i , the higher velocity had to be considered, so the data points

    (xis, tn) and (xis+1, t

    n) and x = xi a2t = xi sx were used. Now adding

    (xis1, tn) yields

    un+1

    i

    = un

    is

    + (un

    is+1

    un

    is1

    )x xis

    2x

    + (unis+1 2unis + u

    nis1)

    (x xis)2

    2x2

    = unis +1

    2(s s)(unis+1 u

    nis1)

    +1

    2(s s)2(unis+1 2u

    nis + u

    nis1).

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    45/101

    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 u

    ni1

    +

    2

    2

    uni+1 2u

    ni + u

    ni1

    , if i ,

    un

    +

    1

    2 1 a1a2 x + is (un+1 un1)+12

    1 a1a2

    x +

    is

    2(un+1 2u

    n + u

    n1), if < i <

    ,

    unis +12(s s)(u

    nis+1 u

    nis1)

    +12(s s)2(unis+1 2u

    nis + u

    nis1), 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.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    46/101

    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

    + 1000a2

    /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) = sin2x1000

    , 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) = sin2x1000

    , 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 definitionof 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    47/101

    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 stepsize. 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    48/101

    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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    49/101

    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 upwindand 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    50/101

    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 LaxWendroff

    least squares approximation(slope 1.3550)

    error

    1 0.5 0 0.5 1

    3

    2

    1

    0

    1

    example 1, nonuniform modified LaxWendroff

    least squares approximation(slope 1.0937)

    error

    Figure 2.12: Error plots for example 1.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    51/101

    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 LaxWendroff

    least squares approximation(slope 1.2725)

    error

    1 0.5 0 0.5 1

    2

    1

    0

    1

    example 2, nonuniform modified LaxWendroff

    least squares approximation(slope 1.1319)

    error

    Figure 2.13: Error plots for example 2.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    52/101

    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 LaxWendroff

    least squares approximation(slope 1.1248)

    error

    1 0.5 0 0.5 1

    2

    1

    0

    1

    example 3, nonuniform modified LaxWendroff

    least squares approximation(slope 1.0398)

    error

    Figure 2.14: Error plots for example 3.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    53/101

    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.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    54/101

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    55/101

    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 equationsConsider 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. Aswas 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

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    56/101

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    57/101

    3 Nonlinear partial differential equations 57

    Since has compact support, it is zero at infinity, so it holds0

    (ut + 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 elaboratedhere 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) = 12u2. It can be written in the quasilinear form

    ut + uux = 0

    and has the characteristics

    X(t) = x + u0(x)t.

  • 8/2/2019 Numerical Methods for Hyperbolic Balance Laws

    58/101

    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