Finite Difference Solution of Linear Second Order Elliptic Partial Differential Equations

Similar documents
Inner Product Spaces

General Framework for an Iterative Solution of Ax b. Jacobi s Method

Numerical Analysis Lecture Notes

Fourth-Order Compact Schemes of a Heat Conduction Problem with Neumann Boundary Conditions

Lecture Notes to Accompany. Scientific Computing An Introductory Survey. by Michael T. Heath. Chapter 10

Vector and Matrix Norms

Introduction to the Finite Element Method

10.2 ITERATIVE METHODS FOR SOLVING LINEAR SYSTEMS. The Jacobi Method

5 Numerical Differentiation

7 Gaussian Elimination and LU Factorization

Second Order Linear Partial Differential Equations. Part I

LINEAR ALGEBRA W W L CHEN

Metric Spaces. Chapter Metrics

Solving Systems of Linear Equations

Linearly Independent Sets and Linearly Dependent Sets

Inner product. Definition of inner product

SOLVING LINEAR SYSTEMS

LS.6 Solution Matrices

AN INTRODUCTION TO NUMERICAL METHODS AND ANALYSIS

Lecture 3: Finding integer solutions to systems of linear equations

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS

Numerical Methods I Solving Linear Systems: Sparse Matrices, Iterative Methods and Non-Square Systems

The Heat Equation. Lectures INF2320 p. 1/88

DIFFERENTIABILITY OF COMPLEX FUNCTIONS. Contents

FINITE DIFFERENCE METHODS

Data Mining: Algorithms and Applications Matrix Math Review

MATH10212 Linear Algebra. Systems of Linear Equations. Definition. An n-dimensional vector is a row or a column of n numbers (or letters): a 1.

MATRIX ALGEBRA AND SYSTEMS OF EQUATIONS. + + x 2. x n. a 11 a 12 a 1n b 1 a 21 a 22 a 2n b 2 a 31 a 32 a 3n b 3. a m1 a m2 a mn b m

3. Reaction Diffusion Equations Consider the following ODE model for population growth

Overview of Violations of the Basic Assumptions in the Classical Normal Linear Regression Model

Høgskolen i Narvik Sivilingeniørutdanningen STE6237 ELEMENTMETODER. Oppgaver

Linear Algebra Notes for Marsden and Tromba Vector Calculus

Similarity and Diagonalization. Similar Matrices

Factorization Theorems

1 Solving LPs: The Simplex Algorithm of George Dantzig

Au = = = 3u. Aw = = = 2w. so the action of A on u and w is very easy to picture: it simply amounts to a stretching by 3 and 2, respectively.

Mathematics Course 111: Algebra I Part IV: Vector Spaces

POISSON AND LAPLACE EQUATIONS. Charles R. O Neill. School of Mechanical and Aerospace Engineering. Oklahoma State University. Stillwater, OK 74078

Continued Fractions and the Euclidean Algorithm

1 VECTOR SPACES AND SUBSPACES

Class Meeting # 1: Introduction to PDEs

How To Prove The Dirichlet Unit Theorem

CITY UNIVERSITY LONDON. BEng Degree in Computer Systems Engineering Part II BSc Degree in Computer Systems Engineering Part III PART 2 EXAMINATION

1 Error in Euler s Method

5 Homogeneous systems

Linear Algebra I. Ronald van Luijk, 2012

1 if 1 x 0 1 if 0 x 1

SIXTY STUDY QUESTIONS TO THE COURSE NUMERISK BEHANDLING AV DIFFERENTIALEKVATIONER I

We shall turn our attention to solving linear systems of equations. Ax = b

1 Sets and Set Notation.

Numerical Analysis Lecture Notes

4.3 Lagrange Approximation

Row Echelon Form and Reduced Row Echelon Form

Reference: Introduction to Partial Differential Equations by G. Folland, 1995, Chap. 3.

a 11 x 1 + a 12 x a 1n x n = b 1 a 21 x 1 + a 22 x a 2n x n = b 2.

DERIVATIVES AS MATRICES; CHAIN RULE

Orthogonal Diagonalization of Symmetric Matrices

BANACH AND HILBERT SPACE REVIEW

19 LINEAR QUADRATIC REGULATOR

Introduction to Matrix Algebra

MATH 304 Linear Algebra Lecture 20: Inner product spaces. Orthogonal sets.

Bindel, Spring 2012 Intro to Scientific Computing (CS 3220) Week 3: Wednesday, Feb 8

Numerical Analysis Lecture Notes

FEGYVERNEKI SÁNDOR, PROBABILITY THEORY AND MATHEmATICAL

Notes on Orthogonal and Symmetric Matrices MENU, Winter 2013

Partial Fractions. Combining fractions over a common denominator is a familiar operation from algebra:

An Introduction to Partial Differential Equations

Iterative Solvers for Linear Systems

MATH 425, PRACTICE FINAL EXAM SOLUTIONS.

Chapter 6. Orthogonality

Chapter 6: Solving Large Systems of Linear Equations

Section Inner Products and Norms

(Quasi-)Newton methods

Mean value theorem, Taylors Theorem, Maxima and Minima.

4.5 Linear Dependence and Linear Independence

Advanced CFD Methods 1

Differential Relations for Fluid Flow. Acceleration field of a fluid. The differential equation of mass conservation

T ( a i x i ) = a i T (x i ).

Iterative Methods for Solving Linear Systems

Inner Product Spaces and Orthogonality

DATA ANALYSIS II. Matrix Algorithms

Solution of Linear Systems

The Characteristic Polynomial

Moving Least Squares Approximation

Notes on Determinant

88 CHAPTER 2. VECTOR FUNCTIONS. . First, we need to compute T (s). a By definition, r (s) T (s) = 1 a sin s a. sin s a, cos s a

The Method of Partial Fractions Math 121 Calculus II Spring 2015

t := maxγ ν subject to ν {0,1,2,...} and f(x c +γ ν d) f(x c )+cγ ν f (x c ;d).

Math 4310 Handout - Quotient Vector Spaces

MATHEMATICAL METHODS OF STATISTICS

Feature Commercial codes In-house codes

[1] Diagonal factorization

Systems of Linear Equations

Lecture 5 Principal Minors and the Hessian

Nonlinear Algebraic Equations Example

Example 4.1 (nonlinear pendulum dynamics with friction) Figure 4.1: Pendulum. asin. k, a, and b. We study stability of the origin x

Parabolic Equations. Chapter 5. Contents Well-Posed Initial-Boundary Value Problem Time Irreversibility of the Heat Equation

Lecture L3 - Vectors, Matrices and Coordinate Transformations

Transcription:

Chapter 1 Finite Difference Solution of Linear Second Order Elliptic Partial Differential Equations 1.1 Derivation of the equation Elliptic partial differential equations can be generally obtained from time dependent problems considering the so-called stationary case. In the stationary case the solution varies only with the spatial coordinates and not with time. If the solution is steady in time, then the time derivative term is equal to zero. 1.1.1. Example. Let us consider the one-dimensional heat conduction problem u t = 2 u, x (0, 1); x2 u(t, 0) = 0, u(t, 1) = 1, t 0; u(0, x) = u 0 (x), x [0, 1]. If the initial temperature is described by the linear function u 0 (x) = x, x [0, 1], then the solution of the problem is u(t, x) = x, that is the temperature is independent of time. This solution is called the stationary solution of the problem. The stationary solution can be obtained by setting u/ t = 0 and solving the ordinary differential equation u = 0, x (0, 1); u(0) = 0, u(1) = 1. For other initial functions, say u 0 (x) = x 2, the temperature will tend to the stationary solution. The general form of linear second order elliptic partial differential equations is div(d gradu) + f = 0 in Ω, (1.1.1) 1

where functions D = D(x) (coefficient of heat conduction) and f = f(t, x) (the heat source term) are known, and we have to determine the function u = u(t, x). (Function u is supposed to be continuous on Ω and differentiable in Ω.) In order to obtain a well-posed problem, we generally prescribe so-called boundary conditions on the boundary (denoted by Ω) of the domain Ω. There are three different types of boundary conditions. Dirichlet boundary condition. The function u is prescribed on the boundary, that is u(t, x) = g 1 (x), x Ω (g 1 is a given function). Neumann boundary condition. The (normal) derivative of u is prescribed on the boundary, that is u(t, x)/ n = g 2 (x), x Ω (g 2 is a given function). Robin boundary condition. The linear combination of u and its normal derivative is prescribed on the boundary, that is u(t, x)/ n + αu(t, x) = g 3 (x), x Ω (g 3 is a given function). If D is constant (say one) in (1.1.1), then the equation can be written in the form 2 u + f = 0 in Ω, (1.1.2) where 2 is the so-called Laplace operator, 2 u = 2 u +... + 2 u x 2 1 x 2 d (d is the dimension of Ω). Equation (1.1.2) is called Poisson equation and in case of f = 0 Laplace equation. In this lecture, we solve the Poisson equation with Dirichlet boundary condition on one and two-dimensional domains using the finite difference method. 1.2 One-dimensional Poisson equation with Dirichlet boundary condition 1.2.1 Setting up the problem The one-dimensional Poisson equation with Dirichlet boundary condition (so-called one-dimensional boundary problem) is a second order ordinary differential equation in the form u + f = 0, x (0, 1); u(0) = µ 1, u(1) = µ 2. We suppose that the solution u(x) is sufficiently smooth on (0, 1) and continuous on [0, 1]. Of course, the above problem can be solved exactly, integrating twice both sides of the equation and choosing the two constants of integration according the 2

boundary conditions. Nevertheless, we solve this problem numerically with the finite difference method, in order to understand the relations between the global error and the local truncation error, and to observe how stability connects these two types of errors. 1.2.2 The finite difference solution Let us divide the interval [0, 1] into n + 1 equal parts with the points 0 = x 0 < x 1 <... < x n < x n+1 = 1, where x i = ih (i = 0,..., n + 1) with h = 1/(n + 1). Moreover, let us introduce the notation u i for the approximation of û i = u(x i ) (i = 0,..., n + 1). Naturally, these values depend on h, albeit this is not indicated in the notation, furthermore u 0 = µ 1 and u n+1 = µ 2. We have n unknown values to compute: u 1,..., u n. If we replace u by the centered difference approximations at the points x i (i = 1,..., n), then we obtain the system of linear algebraic equations u i 1 2u i + u i+1 h 2 + f(x i ) = 0, (i = 1,..., n), which, multiplying each equation by 1, can be written in matrix form where u h = [u 1,..., u n ] IR n, A h u h = f h, (1.2.3) f h = [f(x 1 ) + µ 1 /h 2, f(x 2 ),..., f(x n 1 ), f(x n ) + µ 2 /h 2 ] and A h is the tridiagonal matrix A h = 1 h 2 2 1 0... 1 2 1 0... 0 1 2 1 0..................... 0 1 2 1... 0 1 2 IR n n. (1.2.4) The subscript h indicates the dependence on h. As we will see later system (1.2.3) can be solved uniquely, thus the finite difference solution do exists. 1.2.3 Stability of the method Let us define the so-called global error as z h = u h û h. Our goal is to prove the convergence of the method, that is to show that the magnitude of the global error 3

goes to zero if h tends to zero ( z h 0 as h 0). The magnitude of the global error can be measured, for instance, in maximum norm, z h = max i=1,...,n { z i }, or alternatively in 2-norm (Euclidean-norm), z h 2 = h(z1 2 +... + zn). 2 It is known that the centered difference approximation of the second order derivative of a sufficiently smooth function gives a second order accurate approximation, so we might hope that the global error also has the order of O(h 2 ). This is not trivial, because it is not the second derivative of the function u(x) that is approximated by finite differences, but the approximating values u 1,..., u n are computed using the exact values of the second derivative of u(x). Let us define the local truncation error as the vector w h = f h A h û h, (1.2.5) where we substitute the vector of the exact solutions into the reordered equation (1.2.3). Of course û does not generally satisfy the equation A h û h = f h exactly, the discrepancy between the two sides is the local truncation error. Combining equations (1.2.3) and (1.2.5) we obtain the system of linear equations A h (u h û h ) = A h z h = w h for the global error. If A 1 h exists, then applying the properties of induced matrix norms we have the estimation z h = A 1 h w h A 1 w h. We call the numerical method consistent if w h 0 as h 0. The numerical method is said to be stable if A 1 h exists for all sufficiently small step size h, and there is a constant C, independent of h, such that A 1 h C for all sufficiently small h. It is easy to see that stability + consistency = convergence, that is stability and consistency imply convergence, which is stated in general form in the so-called Lax theorem (P. Lax, 1953). 1.2.4 Consistency of the numerical scheme Consistency is usually the easy part to check in verifying the convergence of a numerical scheme. Albeit we do not know the true solution u(x), assuming the solution to be sufficiently smooth, we obtain with Taylor series expansion that w i = 1 12 h2 u (x i ) + O(h 4 ) = O(h 2 ), (i = 1,..., n). This shows that w h 0 (h 0), that is the method is consistent. 4 h

1.2.5 Stability in maximum norm In this section the stability of the numerical method will be proven introducing the notion of M-matrices. Definition 1.2.1. A square matrix A is said to be an M-matrix, if each offdiagonal element of the matrix is non-positive (a ij 0) and there exists a positive vector r > 0 such that Ar > 0. Theorem 1.2.2 (See Stoyan-Takó, Numerikus módszerek I., ELTE-TypoTEXBudapest, 1993) If A IR n n is an M-matrix, then (P1) A is regular ( A 1 ), (P2) A 1 is non-negative (A 1 0, so-called monotone matrix), (P3) the estimation A 1 r min i=1,...,n (Ar) i is valid. The maximum norm of a square matrix A IR n n is defined as A = max i=1,...,n { a i,1 + a i,2 +... + a i,n }. Theorem 1.2.3 The matrix A h in (1.2.4) is an M-matrix. Proof. It can be seen that the off-diagonal elements of the matrix defined in (1.2.4) are non-positive, moreover let us define the vector r IR n as r i = p(x i ) (i = 1,..., n), where p(x) = 1/4 (x 1/2) 2. It is trivial that r i > 0, that is r is a positive vector, and considering the relation p(x i 1) 2p(x i ) + p(x i+1 ) h 2 = p (x i ) = 2 (p(x) is a quadratic polynomial) we have A h r = 2e > 0, where e = [1,..., 1] IR n. This completes the proof. Because A h is an M-matrix, A h is regular, which imply that the numerical solution always exists. Moreover the estimation A 1 h 1 8 holds. Thus the numerical method is stable in maximum norm. The magnitude of the global error is equal to the magnitude of the truncation error, that is z h = O(h 2 ), thus the finite difference method is convergent. 1.2.4. Exercise. Prove the stability of the one-dimensional boundary problem in the Euclidean norm. (Hint: Because A 1 h is symmetric, its Euclidean norm is 5

equal to its spectral radius. The eigenvalues of matrix A h can be written in the form λ i = (2/h 2 )(1 cos(iπh)), (i = 1,..., n) ). 1.2.5. Exercise. Solve problem u + f = 0, x (0, 1); u (0) = µ 3, u(1) = µ 2 with the finite difference method. Approximate the zero derivative on the left-hand side with the one-sided expression or, alternatively, apply equations u 1 u 0 h = 0 u 1 2u 0 + u 1 h 2 + f(x 0 ) = 0, u 1 u 1 2h = µ 3. Prove the convergence of the above two methods. Compare the order of the two global error. 1.3 Two-dimensional Poisson equation with Dirichlet boundary condition 1.3.1 Setting up the problem After the discussion of the one-dimensional model problem, we apply the finite difference method for the two dimensional Poisson equation with Dirichlet boundary condition 2 u x + 2 u 2 y + f = 0, 2 u(x, y) = g(x, y), (x, y) Ω = (0, a) (0, b); (x, y) Ω. We suppose that the solution u(x, y) is sufficiently smooth on Ω and continuous on Ω. 1.3.2 The finite difference solution Let us divide the edges [0, a] and [0, b] of Ω into n 1 + 1 and n 2 + 1 equal parts, respectively, and define the step sizes h 1 = 1/(n 1 + 1) and h 2 = 1/(n 2 + 1). Let us denote the interior mesh points by P 1,..., P N, and the points on the boundary by P N+1,..., P N+N. We also define N = N + N. Naturally, N = n 1 n 2, N = 2(n 1 + n 2 ) + 4 and N = (n 1 + 2)(n 2 + 2). Denoting the approximation of the true 6

2 D D 2 2 2 E O 2 N solution û i = u(p i ) at a grid point P i by u i, and replacing the second derivatives with centered finite differences we obtain the system of linear equations u i x 2u i + u i+x h 2 1 + u i y 2u i + u i+y h 2 2 + f(p i ) = 0, i = 1,..., N. (1.3.6) Here we used the notation P i+x for the next grid point in positive x-direction and the notation P i x for the one in negative x-direction. P i y and P i+y are defined similarly (see the five-point stencil in Figure 1.3.1). Multiplying both sides by ( 1) E E N E E O Figure 1.3.1: The five-point stencil. the system can be written in matrix form as à h ũ h = f h, where fh = [f(p 1 ),..., f(p N )], ũ h = [u 1,..., u N] and matrix Ãh is an N N sparse matrix with the i-th row elements 1/h 2 1, 1/h 2 2 and 2/h 2 1 + 2/h 2 2 in the columns corresponding to the points P i x and P i+x, P i y and P i+y, and P i, respectively. Considering the relations u i = g(p i ) (i = N + 1,..., N + N ), we have only N unknown values: u 1,..., u N. Splitting the matrix à h in the form Ãh = [A h A ] (A h IR N N, A IR N N ) and the vector ũh as ũ h = [u h g h ] (u h = [u 1,..., u N ] IR N, g h = [g(p N+1 ),..., g(p N)] IR N ) we have the equation A h u h = f h := f h A g h. This equation has similar form like the one in the one-dimensional case. The elements of the vector f h and the matrix A h are known. In order to obtain the numerical solution we have to compute the vector u h, which consists of the approximating values for the true solution at the mesh points. Convergence means in this case that z h 0 as h := max{h 1, h 2 } 0. Our goal is to prove the convergence, which is implied by consistency and stability. 7

1.3.3 Consistency We have to calculate the local truncation error w h = f h A h û h. Assuming the solution to be sufficiently smooth, we obtain with Taylor series expansion that w i = h2 1 4 u 12 x (P i) + h2 2 4 u 4 12 y (P i) + O(h 4 1) + O(h 4 2) = O(h 2 ), 4 (i = 1,..., N). This shows that w h 0 (h 0), that is the method is consistent. 1.3.4 Stability in maximum norm We will show that A h is an M-matrix. This will show the existence and uniqueness of the finite difference solution and imply the stability. The off-diagonal elements of A h are trivially non-positive and the suitable positive vector can be constructed easily. Let us define the vector r = [p(p 1 ),..., p(p N )] with the quadratic function p(x, y) = a2 + b 2 4 Clearly r > 0, and because p(x, y) is quadratic we have ( x a ) ( 2 y b 2. (1.3.7) 2 2) p(p i x) 2p(P i ) + p(p i+x ) p(p i y) 2p(P i ) + p(p i+y ) h 2 1 h 2 2 ( 2 ) p = x (P i) + 2 p 2 y (P i) = 4, 2 i = 1,..., N. Thus A h r = 4e > 0, that is A h is an M-matrix and the estimation = A 1 h a2 + b 2 16 is true. For the global error we have z h a2 +b 2 16 w h = O(h 2 ), that is the method is convergent with second order. 1.3.1. Exercise. Let us apply the two types of ordering (rowwise and chessboard) depicted in Figure 1.3.2 in numbering the inner mesh points of the mesh. Sketch the structure of the matrix A h in both cases. 1.3.2. Exercise. Prove the stability of the finite difference solution of the twodimensional Poisson equation using the Euclidean norm. For simplicity suppose that h 1 = h 2 = h and n 1 = n 2 = n. 8

D D # ' $ % & D D # % '! $ " &! " # $ # $! "! " Figure 1.3.2: The rowwise and chessboard ordering of the grid points. 1.4 Solution of the linear system As we discussed in the previous sections the finite difference solution of elliptic equations results in systems of linear algebraic equations. In one dimension with uniform step-size, the matrix A h is a uniformly tridiagonal sparse symmetric matrix, while in two-dimension, albeit A h is symmetric, the elements of the matrix cannot be clustered adjacent to the main-diagonal of the matrix. The best thing we can do is the so-called rowwise ordering (see Exercise 1.3.1). What kind of methods can be used for the solution of the linear systems? There are two different ways of the solution: direct methods and iterative methods. Direct methods produces an exact solution (in exact arithmetic), while iterative methods result in a vector sequence which converges to the solution of the system. Direct methods have advantages solving systems with dense matrices (with few zeros). The best known direct method is the so-called Gaussian elimination. Here we have to store the whole coefficient matrix and the number of operations is O(N 3 ) (if A h IR N N ). Applying Gaussian elimination for systems coming from finite difference methods, there are possibilities to simplify the method taking the advantage of the special structure of the coefficient matrix achieving a number of operations O(N) (so-called Thomas-algorithm). Iterative methods are generally applied for sparse systems. The crucial question here the speed of the convergence of the vector sequence to the solution of the system. The most typical iterative methods, beyond the classical Jacobi and Gauss-Seidel iterations, are successive overrelaxation, conjugate gradient method and multigrid methods. For more details consult the book Stoyan-Takó, Numerikus módszerek I., ELTE-TypoTEXBudapest, 1993. 9

Chapter 2 Finite Difference Solution of Hyperbolic Partial Differential Equations 2.1 Setting up the problem In this chapter we will discuss finite difference methods for hyperbolic partial differential equations in one space dimension. Two types of equations are investigated. The first one is the so-called advection equation or one-way wave equation, which is second order, and has the form u t + a u x = f, x (0, 1) (2.1.1) u(0, x) = u 0 (x), u(t, 0) = µ 1 (t), if a 0, or u(t, 1) = µ 2 (t), if a 0. The second one is the so-called second order linear wave equation 2 u t 2 = 2 u a2 + f, x (0, 1), a > 0 (2.1.2) x2 u(0, x) = u 0 (x), u(t, 0) = µ 1 (t), u(t, 1) = µ 2 (t). The solutions of the above equations are waves, u = u(t, x) gives the amplitude of the wave at time instant t and the spatial coordinate x, moreover f = f(t, x) describes the density of outer forces. Because the stability of a difference scheme is usually independent of the source term f, we consider the above equations supposing that f is equal to zero. If f = 0, then (2.1.1) has a solution u(t, x) = u 0 (x at) (we suppose that u 0 is sufficiently smooth). As time evolves, the initial data simply propagates unchanged 10

to the right (a > 0) or to the left (a < 0). This is why we need boundary condition only at one of the ends of the interval. Equation (2.1.2) can be written as ( ) ( ) u u t + a u x t a u = 0, x which shows that the solution is a superposition of two waves u(t, x) = u 01 (x at) + u 02 (x + at). The first one propagates to the right, and the second one to the left. For the sake of further simplification we apply so-called periodic boundary condition which is defined as u(0, t) = u(1, t). Beside this choice we do not need to discretize the boundary conditions but the differential equation. 2.2 Numerical solution of the one-way wave equation We solve problem u t + a u = 0, x (0, 1) (2.2.3) x u(0, x) = u 0 (x), u(t, 0) = u(t, 1) by the finite difference method. As usual, we start with dividing the interval [0, 1] into equal parts, the number of subintervals is chosen for simplicity to be n 1 (h = 1/n), furthermore, we choose a time step τ > 0. Let us denote the approximation of û k j := u(kτ, jh) by u k j = u(kτ, jh) (j = 1,..., n; k = 0, 1,...). Naturally, u 0 j = u 0 (jh) (j = 1,..., n). 2.2.1 First try Discretization A natural discretization of the one-way wave equation is u k+1 j u k j τ + a uk j+1 u k j 1 2h = 0, where a forward and a centered finite difference is used in time and spatial coordinates, respectively. Using the notation q = aτ/h, we obtain the explicit form u k+1 j = u k j (q/2)(u k j+1 u k j 1). (2.2.4) These equations can be written also in an explicit matrix form as u k+1 h = A h u k h, 11

where u k h = [u k 1,..., u k n] and A h is a skew-symmetric matrix 1 q/2 0... 0 q/2 q/2 1 q/2 0... 0 q/2 1 q/2 0... A h =................ (2.2.5)... 0 q/2 1 q/2 q/2 0... 0 q/2 1 Definition of convergence We say that the numerical method is convergent if u k j û k j 0 as τ, h 0, where the point (t, x) = (kτ, jh) is fixed (k, j ). That is the method is convergent if the numerical solution at a fixed point tends to the true solution if the mesh is refined. For simplicity we suppose that τ and h tend to zero keeping the q = aτ/h to be constant. Introducing the global error at the k-th time level as z k h = u k h û k h, and the local approximation error as (ûk+1 wh k = 1 h A h ûh) k, τ we have z k+1 h = A h z k h τwh. k Thus the global error at the k-th time level can be written in the form from which we obtain z k h = A k hz 0 h τ z k h A k h z 0 h + τ k l=1 k l=1 A k l h wl 1 h, A k l h wl 1 h. If we apply the choice u 0 j = u 0 (jh), then the first term vanishes. The convergence of the method can be guaranteed by supposing that the powers of the matrix A h are uniformly bounded. Uniform boundedness means that A k h C for all sufficiently small τ, h and for each natural number k where C is independent of k and h. This is the so-called Lax-Richtmyer stability condition. The consistency and stability imply the convergence of the method. Indeed, using that the local truncation error is O(τ + h 2 ), we obtain that z k h τk C O(τ + h 2 ) = t C O(τ + h 2 ) (t is fixed), which shows the convergence. One can also see that the order of the global error is equal to the one of the local truncation error. We remark that the Lax-Richtmyer stability condition is satisfied if A h 1, since A k h A h k 1, but this condition is not necessary. If we have only A h 1 + c 1 τ (c 1 is constant) then we also have uniform boundedness A k h (1 + c 1 τ) k e c1τk = e c1t = constant. 2.2.1. Exercise. Prove that the local truncation error of the above method is O(τ + h 2 ). 12

Convergence in Euclidean norm We would like to show the uniform boundedness of A h in the Euclidean norm. It is easy to see that the eigenvalues of the matrix are λ l = 1 qi sin(2πlh) = 1 τa h i sin(2πlh), i = 1, (l = 1,..., n) This can be shown based on the consideration that matrices appearing in any standard finite difference methods have the same eigenvectors in the form u h = [u 1,..., u n ], where u j = exp(i2πljh) with l = 1,..., n. Inserting u j = exp(i2πljhξ) into (2.2.4) we have that A h u h = (1 qi sin(2πlh))u h, that is the l-th eigenvalue of A h is λ l, indeed. The matrix A h is the sum of the unit matrix I (all eigenvalues are equal to one) and a skew-symmetric matrix, which eigenvalues are purely imaginary and have the form ( τ a/h)i sin(2πlh). Thus the square of the Euclidean norm of A k h is A k h 2 2 = ( ϱ ( )) A k h A h = (max {1 + τ 2 a 2 ) k sin 2 (2πlh)} (1 + q 2 ) k l h 2 (ϱ(.) denotes the spectral radius of the matrix), which shows that this method is not stable, thus it is not convergent either. The eigenvalue λ l is also called amplification factor or growth factor (so-called von Neumann analysis). The growth factor simply expresses the growth in the amplitude of the eigenvector between to time levels. It is usually denoted by g(θ) with θ = 2πlh, and because g(θ) gives the Euclidean norm of A h we have the same stability conditions like for the Lax-Richtmyer stability. Thus stability can be guaranteed satisfying the relation g(θ) 1 or the weaker condition g(θ) 1+c 1 τ. If g(θ) = c 2 = constant > 1, then the method is unstable. The growth factor can be written for the above investigated finite difference method as g(θ) = (1 qi sin θ), thus g(θ) 2 = 1 + q 2 sin 2 θ > 1, that is the method is unstable. Our first try to solve the one-way wave equation with the finite difference method resulted in a non-convergent method, thus this method in not applicable in practice. 2.2.2 Lax-Friedrichs method Modify the finite difference scheme used in the previous section changing u k j the average of u k j 1 and u k j+1. So we obtain the scheme with u k+1 j = 1 2 (uk j 1 + u k j+1) (q/2)(u k j+1 u k j 1), which is called Lax-Friedrichs scheme. The local truncation error of the scheme is O(τ + h), and the growth factor is g(θ) = cos θ qi sin θ 13

Therefore, g(θ) 2 = cos 2 θ + q 2 sin 2 θ = 1 + (q 2 1) sin 2 θ and we can conclude that g(θ) 1 if q 2 1 0, which implies that a τ h 1, which is called Courant-Friedrichs-Lewy (shortly CFL) condition. Albeit the method is convergent for values q 1, the method is not popular because of its slow convergence. 2.2.2. Exercise. Prove that the local truncation error of the Lax-Friedrichs method is O(τ + h) and verify the expression for the growth factor! 2.2.3 The upwind scheme The upwind scheme for the one-way wave equation is defined as u k+1 j u k j τ = { a h (uk j u k j 1), if a 0 a h (uk j+1 u k j ), if a 0 The growth factor is for the case a 0 Therefore, g(θ) = 1 q + q cos θ iq sin θ. g(θ) 2 = 1 4(1 q)q sin 2 (θ/2) and we can conclude the CFL condition q = aτ/h 1. Thus the upwind scheme is convergent. This scheme has the order O(τ + h) again. In the next sections we discuss some higher order schemes. 2.2.3. Exercise. Prove that the local truncation error of the upwind scheme is O(τ + h) and verify the expression for the growth factor! 2.2.4 The leapfrog scheme The leapfrog scheme for the one-way wave equation is defined as u k+1 j u k j 2τ + a uk j+1 u k j 1 2h = 0. We can notice that thee time levels are involved, and we need the u 1 j values to get started with the method. 14