Chapter 2 Introduction to Finite Di erence Methods

23

Transcript of Chapter 2 Introduction to Finite Di erence Methods

Page 1: Chapter 2 Introduction to Finite Di erence Methods

Chapter �

Introduction to Finite Di�erence

Methods

��� Constructing Di�erence Operators

Our initial study will involve the solution of time�dependent partial di�erential equtions in

one space variable� We�ll begin by introducing some elementary �nite di�erence operators

and examining their basic properties� Following this� in Sections ��� and ���� respectively�

we�ll use these di�erence operators to solve simple wave propagation and heat conduction

problems� With this plan� let us partition the upper half of the �x� t�plane into uniform

cells of size x�t as shown in Figure ������ The grid intersection with the Cartesian

coordinates xj � jx and tn � nt is denoted as �j� n and the restriction of the solution

of the partial di�erential equation to the grid is denoted as

unj � u�jx� nt� ������

Finite di�erence approximations of unj are denoted as Unj and are obtained by replacing

derivatives of u at xj and tn with algebraic expressions involving u at points neighboring

�xj� tn� Di�erence approximations may be constructed in a variety of ways� but the use

of Taylor�s formula is probably the simplest for our present purposes� To begin� let us

use Taylor�s formula to express unj�� in terms of unj and its derivatives as

unj�� � unj ��u

�xnjx

�����u

�x�njx� � � �

k���ku

�xknjxk

�k ����k��u

�xk��nj��xk��� ������

Page 2: Chapter 2 Introduction to Finite Di erence Methods

� Finite Di�erence Methods

n

1

2

t

xj21

(j,n)

-2 -1 0

Figure ������ A partition of the upper half of the �x� t�plane into uniform cells of sizex�t�

The last term in ������� the remainder� involves the evaluation of �uk����xk�� at x �

�j �x and nt� with � an unknown point on ��� ��

As an example� suppose that we retain the �rst two terms �k � � in ������ and solve

for ��u��xnj to obtain

�uxnj �

unj�� � unjx

��

��uxx

nj��x� ������

Neglecting the remainder term� we get the formula for the �rst forward �nite di�erence

approximation of ux as

�Uxnj �

Unj�� � Un

j

x� ������a

The neglected remainder term in ������

�nj � �uxnj �

unj�� � unjx

� ��

��uxx

nj��x� � � � � �� ������b

is called the local discretization error or local truncation error�

Backward �nite di�erence approximations can be developed by expanding unj�� in a

Page 3: Chapter 2 Introduction to Finite Di erence Methods

���� Di�erence Operators �

Taylor�s series about �xj� tn to obtain

unj�� � unj � ��u

�xnjx

�����u

�x�njx� � � �

���k

k���ku

�xknjxk

���k��

�k ����k��u

�xk��nj��xk��� � � � � �� ������

Retaining the �rst two terms in ������ and neglecting the remainder gives the �rst

backward �nite di�erence approximation of �uxnj as

�Uxnj �

Unj � Un

j��

x� ������a

The local discretization error is again obtained from the remainder term as

�nj ��

��uxx

nj��x� � � � � �� ������b

The approximations of �uxnj given by ������ and ������ are directional� A centered

�nite di�erence approximation of the �rst derivative can be obtained by retaining the

�rst three terms �k � � in ������ and ������ and subtracting the resulting expressions

to get

�Uxnj �

Unj�� � Un

j��

�x� ������a

The local discretization error is obtained from the remainder terms as

�nj � ��

��uxxx

nj��x�� �� � � � �� ������b

The discretization error of the centered formula ������ is O�x� while those of the

forward and backward formulas ������ and ������ are O�x� Since the centered formula

converge at a faster rate than either of the two directional formulas� it would normally

be preferred� however� we shall see examples �Section ��� where this is not the case�

Obviously� Taylor�s series can also be used to construct approximations of time deriva�

tives� The �rst forward di�erence approximation of ut at �xj� tn is

�Utnj �

Un��j � Un

j

t� ������a

The local discretization error is

�nj � ��

��utt

n��j t� � � � �� ������b

Page 4: Chapter 2 Introduction to Finite Di erence Methods

� Finite Di�erence Methods

The same approach can be used to construct approximations of higher derivatives�

For example� a centered di�erence approximation of �uxxnj can be obtained by retaining

the �rst four terms in ������ and ������ and adding the resulting expressions to get

�Uxxnj �

Unj�� � �Un

j Unj��

x�� ������a

The discretization error of this approximation is

�nj � ��

���uxxxx

nj��x�� �� � � � �� ������b

where the � of ������ is a generic symbol and has no relation to the � used in ������ or

������b�

Centered di�erences only have a higher order of accuracy than forward or backward

di�erences on uniform grids� To see this� consider three points xj��� xj� and xj�� of a

nonuniform grid as shown in Figure ������ Let xL � xj � xj�� and xR � xj�� � xj

and construct the Taylor�s series expansions

j

n + 1

j - 1

R

j + 1

xL

∆ ∆x

n

Figure ������ Two neighboring intervals of a nonuniform grid�

unj�� � unj xR�uxnj

�x�R�uxx

nj O�x�R� �������a

unj�� � unj �xL�uxnj

�x�L�uxx

nj O�x�L� �������b

Divide �������a by xR� divide �������b by xL� and subtract the results to get

�uxnj �

��unj�� � unjxR

unj � unj��

xL��

��xR �xL�uxx

nj O�x�� �������a

Page 5: Chapter 2 Introduction to Finite Di erence Methods

���� Di�erence Operators �

where x � max�xL�xR� Let us also divide �������a by xR� divide �������b by

xL� and add the results to get

�uxxnj �

xR xL�unj�� � unjxR

�unj � unj��

xL��

��xR �xL�uxxx

nj O�x��

�������b

The approximations of �uxnj and �uxx

nj that are obtained by retaining the �rst terms

of �������a and �������b are only accurate to O�x� If xL � xR� the uxx terms

in �������a and the uxxx terms in �������b cancel and the accuracy of both formulas is

O�x��

It will be convenient to have a shorthand operator notation for the �nite di�erence

operators in the same way that such notation is used for derivatives� The notation

shown in Table ����� is relatively standard and will be used throughout these notes�

For simplicity� we have suppressed the time dependence and only show spatial di�erence

operators in Table ������ Thus� we have assumed that u is a function of x only with uj �

u�x� Temporal di�erence operators are de�ned in analogous fashion� Some examples

follow�

Operator Symbol De�nition

Forward Di�erence uj � uj�� � ujBackward Di�erence r ruj � uj � uj��Central Di�erence uj � uj���� � uj����Average � �uj � �uj���� uj������Shift E Euj � uj��Derivative D Duj � �uxj

Table ������ De�nition of �nite di�erence operators�

Example ������ The centered di�erence formula ������a can be expressed in terms of

the central di�erence and averaging operators and �� Observe that

�uj � ��uj���� � uj���� ��

��uj�� � uj���

Thus�

�ujx

�uj�� � uj��

�x�

Page 6: Chapter 2 Introduction to Finite Di erence Methods

� Finite Di�erence Methods

Example ������ An operator appearing to a positive integral power is iterated� thus�

�uj � �uj���� � uj���� � uj�� � �uj uj���

Thus� the centered second di�erence approximation ������a of the second derivative can

be written as

�uxxj ��ujx�

Example ������ Let us expand uj�� in a Taylor�s series about xj to obtain

uj�� � uj x�uxj �

�x��uxxj � � � �

or� using the derivative operator D de�ned in Table ������

uj�� � �� xD �

�x�D� � � � �uj�

We may use the Taylor�s series expansion of the exponential function and the shift oper�

ator of Table ����� to write this in the short�hand form

Euj � uj�� � e�xDuj�

We can� thus� infer the identity between the shift� exponential� and derivative operators

E � e�xD� �������

Additional relationships can be obtained by noting that uj � �E � �uj� which implies

that � E � � or E � � � Treating the operators in ������� as algebraic quantities�

we �nd

xD � lnE � ln�� � ��

��

�� � � � � � �������a

where the series expansion of ln�� x� jxj � �� has been used� A similar relation in terms

of the backward di�erence operator can be constructed by noting that r � ��E��� thus�

xD � lnE � �ln���r � r �

�r�

�r� � � � � �������b

These identities can be used to derive high�order �nite di�erence approximations of

the �rst derivative� For example� retaining the �rst two terms in �������a

xDuj � ���

���uj�

Page 7: Chapter 2 Introduction to Finite Di erence Methods

���� Di�erence Operators �

or

xDuj � ��uj�� � uj��

��uj�� � �uj�� uj��

or

Duj ��uj�� �uj�� � �uj

�x�

This formula can be veri�ed as an O�x� approximation of �uxj�

The formal manipulations used in Examples ����� � ����� have to be veri�ed as being

rigorous� Estimates of local discretization errors must also be obtained� Nevertheless�

using the formal operators of Table ����� provides a simple way of developing high�order

�nite di�erence approximations�

Problems

�� High�order centered di�erence approximations can be constructed by manipulating

identities involving the central di�erence operator ����� Chapter �

uj � uj���� � uj�����

���� Use Taylor�s series expansions of a function u�x on a uniform mesh of spacing

x to show that

uj���� � e�

x�Duj� uj���� � e

��x

�Duj

where Duj � u��jx� Use the de�nition of the central di�erence operator to

infer

� � sinhx

�D�

or� inverting�

xD � � sinh��

�� �

�����

��

����� � � � � �

This relationship can be used to construct central di�erence approximations

of ux�

���� Use the result of Question ��� to show that

x�D�uj � x��uxxj � �� ��

���

��� � � � �uj�

Truncating this relationship gives higher�order centered di�erence approxima�

tions of the second derivative�

Page 8: Chapter 2 Introduction to Finite Di erence Methods

� Finite Di�erence Methods

��� Simple Di�erence Schemes for a Kinematic Wave

Equation

We have developed more than enough �nite di�erence formulas to begin solving some

simple problems� Let us begin with the kinematic wave propagation problem

ut a�uux � �� �� � x ��� t � �� ������a

u�x� � � �x� �� � x ��� ������b

where the wave speed a�u is a real function of u� We have neglected boundary conditions

for our initial study� so� in order to have a �nite spatial domain� we will require that �x

either have compact support

�x � �� jxj � X�

or be periodic

�x X � �x�

where X is a positive constant�

Perhaps the simplest strategy for solving ������ is to approximate both time and

spatial derivatives by �rst�forward di�erences� As in Section ���� let us cover the half�

plane t � � by a uniform rectangular space�time mesh having cells of size x�t �Figure

������ evaluate ������a at �jx� nt� and use the forward di�erence approximations

������� ����� to obtain

�utnj a�unj �ux

nj �

un��j � unjt

�t

��utt

n��j a�unj �

unj�� � unjx

�x

��uxx

nj��� � ��

������a

Neglecting the second�order derivative terms in the local discretization errors� we obtain

the �nite di�erence equation

Un��j � Un

j

t a�Un

j Unj�� � Un

j

x� ��

Solving for Un��j � we obtain

Un��j � �� �n

j Unj � �n

jUnj��� ������b

Page 9: Chapter 2 Introduction to Finite Di erence Methods

���� A Kinematic Wave Equation �

j j + 1

n + 1

n

Figure ������ Computational stencil of the forward time�forward space �nite di�erencescheme ������b�

where

�nj � a�Un

j t

x� ������

The parameter �nj is called the Courant number�

The �nite di�erence equation ������b involves three points as indicated in the stencil

of Figure ������ It is easy to solve using the prescribed initial data ������b� Knowing

U�j � �jx for all j� we calculate U�

j for all j of interest� Then� knowing U�j for all j�

we repeat the process to obtain U�j � etc�

Forward di�erences are appropriate for approximating time derivatives in this type

of marching procedure� but it seems reasonable to also consider backward di�erences or

centered di�erences for approximating the spatial derivatives in ������a� Thus� using

������� ����� in ������a we obtain the forward time�backward space di�erence scheme

Un��j � ��� �n

j Unj �n

jUnj��� ������

Using ������� ����� in ������a yields the forward time�centered space di�erence scheme

Un��j � Un

j ��nj

��Un

j�� � Unj��� ������

These two schemes have the computational stencils shown in Figure ������ They are

used in exactly the same way as the forward time�forward space scheme ������b� Each

scheme has about the same computational complexity�

The question to ask at this juncture is whether or not there are any signi�cant di�er�

ences between the three schemes ������b� ������� and ������� We have not yet studied

Page 10: Chapter 2 Introduction to Finite Di erence Methods

�� Finite Di�erence Methods

n + 1

n

j + 1j - 1 j j + 1 j - 1 jj

Figure ������ Computational stencils of the forward time�backward space scheme �������left and the forward time�centered space scheme ������ �right�

their discretization errors� however� based on the analyses of Section ���� we might expect

that solutions obtained by ������ have a higher order of spatial accuracy than those ob�

tained by either ������b or ������ �cf� ������b� �����b� �����b� This would be enough to

abandon schemes ������b and ������� if it were the only di�erence between the methods�

Let�s apply the methods to two simple examples�

Example ������ Consider ������ with a � � and

�x �

�x� if x � ��� if x � �

The solution of this problem is easily obtained by the method of characteristics �Section

��� as

u�x� t � �x� t�

which is a sloping ramp moving in the positive x direction with unit speed�

Let us� rather arbitrarily� choose x � ���� and t � ���� and solve this problem

for several spatial locations and a few time levels by the forward time�forward space and

forward time�backward space �nite di�erence schemes ������b and ������� respectively�

The Courant number �nj � ��� in each case� The results are shown in Tables ����� and

����� and Figure ������

The solution obtained by the forward time�forward space scheme ������b bears little

resemblance to the exact solution� It is oscillatory and growing as the time level increases�

The solution obtained by the forward time�backward space di�erence scheme ������

appears to be a good approximation of the exact solution� We will be more precise about

the accuracy in Section ���� for now� we seek an explanation for the catastrophic failure

Page 11: Chapter 2 Introduction to Finite Di erence Methods

���� A Kinematic Wave Equation ��

n j�� �� �� �� � � � � �

� ���� ���� ���� ���� ��� ��� ��� ��� ���� ����� ����� ����� ����� ��� ��� ��� ��� ���� ���� ���� ���� ������ ��� ��� ��� ��� ���� ����� ����� ������ ������ ��� ��� ��� ��� ���� ���� ������ ������ ������ ��� ��� ��� ��� ���� ������ ������ ������ ������ ��� ��� ��� ��� ���

Table ������ Solution of Example ����� using the forward time�forward space scheme������b�

n j�� �� �� �� � � � � �

� ���� ���� ���� ���� ��� ��� ��� ��� ���� ����� ����� ����� ����� ����� ��� ��� ��� ���� ���� ���� ���� ���� ���� ������ ��� ��� ���� ����� ����� ����� ����� ����� ������ ������ ��� ���� ���� ���� ���� ���� ���� ������ ������ ������ ���� ����� ����� ����� ����� ����� ������ ������ ������ ������

Table ������ Solution of Example ����� using the forward time�backward space scheme�������

of the forward time�forward space scheme ������b� To rule out the possibility that the

problems could be due to a lack of smoothness in the data and to further study the

performance of these two schemes� let us study a second example�

Example ������ Consider ������ with a � � and

�x � sinx�

hence� the exact solution is the traveling sinusoidal wave

u�x� t � sin�x� t�

We�ll solve this initial value problem on � � x � �� using x � ����� and t � ������

so �nj � ���� Solutions of the forward time�forward space ������b and forward time�

backward space ������ schemes are shown in Figure ������ The forward space scheme

appears to be working� however� its solution is increasing in amplitude� Oscillations are

not present on this time scale but would appear had we computed for longer times� �The

Page 12: Chapter 2 Introduction to Finite Di erence Methods

�� Finite Di�erence Methods

−0.5

0

0.5

0

0.05

0.1

0.15

0.2

0.25−0.8

−0.7

−0.6

−0.5

−0.4

−0.3

−0.2

−0.1

0

x

t

U

−0.5

0

0.5

0

0.05

0.1

0.15

0.2

0.25−0.8

−0.7

−0.6

−0.5

−0.4

−0.3

−0.2

−0.1

0

x

t

U

Figure ������ Solutions of Example ����� obtained by the forward time�forward spacescheme ������b �top and forward time�backward space scheme ������ �bottom� Eachsolution has a Courant number of ����

Page 13: Chapter 2 Introduction to Finite Di erence Methods

���� A Kinematic Wave Equation ��

oscillations take longer to develop with smoother initial data� Once again� the backward

space scheme is producing a reasonable approximation of the exact solution�

Let us postpone treatment of the forward time�centered space scheme ������ and

seek to understand the di�culty with scheme ������b� Thus� consider ������ when a is

a positive constant� The solution of ������ at a point �x� t is determined by the initial

data at the point �x� at� � �Figure ������

De�nition ������ The domain of dependence of a point �x� t for the initial value prob�

lem ������� is the set of all points at t � � that determine the solution at �x� t�

Remark �� De�nition ����� is particular to ������� It will have to be amended to

account for inhomogeneous equations� vector systems� and initial�boundary value prob�

lems�

As noted� the domain of dependence of the point �x� t for the initial value problem

������ is the single point �x � at� �� In a similar manner� let us use De�nition �����

to identify domains of dependence of the �nite di�erence schemes ������b and �������

The solution of the forward time�backward space scheme ������ at a point �jx� nt

is determined by the initial data on the interval ��j�nx� jx� at t � � �Figure ������

Thus� following De�nition ������ we�ll call this interval the domain of dependence of the

point �jx� nt for the di�erence scheme ������� The domain of dependence of the

forward time�forward space scheme ������b� however� is the interval �jx� �j nx��

which cannot possibly be correct �Figure ������ This scheme does not use the correct

initial data to determine the solution at �jx� nt� These simple arguments lead to

the famous Courant� Friedrichs� Lewy Theorem ��� �� which we�ll state in the context of

�������

Theorem ������ �Courant Friedrichs Lewy�� A necessary condition for the conver�

gence of the solution of a �nite�di�erence approximation to the solution of ������� for

arbitrary initial data is that the domain of dependence of the �nite�di�erence approxima�

tion contain the domain of dependence of the partial di�erential equation ��������

Remark �� We�ll give a formal de�nition of convergence in the next section� however�

informally� convergence implies that the solution of the di�erence scheme approaches the

Page 14: Chapter 2 Introduction to Finite Di erence Methods

�� Finite Di�erence Methods

02

46

8

0

1

2

3

4−3

−2

−1

0

1

2

3

xt

U

02

46

8

0

1

2

3

4−1

−0.5

0

0.5

1

xt

U

Figure ������ Solutions of Example ����� obtained by the forward time�forward spacescheme ������b �top and forward time�backward space scheme ������ �bottom� Eachsolution has a Courant number of ����

Page 15: Chapter 2 Introduction to Finite Di erence Methods

���� A Kinematic Wave Equation ��

������ ������ ���� ������ ���� ���� ������

������������������������������

��������

������������

��������

��������

������������

������

������������

������������

��������

��������

��������������

��������

������ ����

������������

��������

������������

��������

���� ������ ���� ����

��������

(j,n) (j,n)

Figure ������ Domains of dependence of the solution of ������� the solution of �������left� and the solution of ������b �right for a point �jx� nt�

solution of the partial di�erential equation as the space and time steps are reduced�

Remark �� Theorem ����� implies that ������b is useless when a is positive and that

������ is useless when a is negative� Thus� we should maintain � � a � x�t for

������ and �x�t � a � � for ������b� Stated in terms of the Courant number� we

should maintain � � �nj � � for ������ and �� � �n

j � � for ������b�

Remark � The Courant� Friedrichs� Lewy Theorem is applicable under more general

circumstances than stated here� It is� furthermore� usual to state it as a stability condition

rather than one on the convergence of a di�erence scheme� We�ll consider other forms of

the theorem in Chapter ��

Proof� We use a straight forward contradiction argument� Since the di�erence scheme is

required to converge for all initial conditions� consider space�time points where the two

domains of dependence are disjoint and choose initial data that is nonzero on the domain

of dependence of the partial di�erential equation and zero on the domain of dependence

of the di�erence scheme� The solution of the di�erence scheme must be trivial at these

points� whereas the solution of the partial di�erential equation at the same points will be

nonzero� Re�ning the mesh so that the two domains of dependence remain disjoint does

not alter this conclusion� hence� the solution of the di�erence equation cannot possibly

Page 16: Chapter 2 Introduction to Finite Di erence Methods

�� Finite Di�erence Methods

converge to that of the partial di�erential equation� Therefore� the domain of dependence

of the di�erence scheme must contain that of the partial di�erential equation�

Problems

�� Suppose a is a positive constant� The scheme ������ only depends on the Courant

number �nj which� for Examples ����� and ������ is the constant at�x� Is there

a particular choice of the Courant number on ��� �� that produces more accurate

solutions than others� Answer the same question for ������b when a � ��

�� What restrictions� if any� should be placed on the Courant number �nj for the

forward time�centered space scheme ������ to satisfy the Courant� Friedrichs� Lewy

theorem� We must� of course� study the behavior of ������� however� prior to doing

this in Chapter �� experiment by applying the method to the problems of Examples

����� and ������ Use the same mesh spacings as the earlier examples�

��� A Simple Di�erence Scheme for the Heat Equa�

tion

Let us determine whether similar or di�erent phenomena occur when solving a simple

initial�boundary value problem for the heat conduction equation� In particular� consider

ut � �uxx� � � x � �� t � �� ������a

u�x� � � �x� � � x � �� ������b

u��� t � u��� t � �� ������c

where the di�usivity � is positive�

In order to construct �nite�di�erence approximations of ������� �i introduce a uni�

form grid of spacing x � ��J � J � �� and t on the strip ��� � � �t � � �Figure

������ �ii evaluate ������a at the mesh point �jx� nt� and �iii replace the partial

derivatives by forward time ������ and centered space ������ di�erences to obtain

Page 17: Chapter 2 Introduction to Finite Di erence Methods

���� A Heat Equation ��

xJ0

(j,n)

j21

t

n

1

2

Figure ������ Computational grid used for the �nite di�erence solution of the heat con�duction problem �������

un��j � unjt

�t

��utt

n��j � ��

unj�� � �unj unj��x�

�x�

���uxxxx

nj���� ������a

where �� � � � �� � � � �� �With second spatial derivatives in ������ there seems

little point in using forward or backward spatial derivatives and we have not done so�

Neglecting the discretization error terms� we get the �nite di�erence scheme

Un��j � Un

j

t� �

Unj�� � �Un

j Unj��

x�������b

or� solving for Un��j �

Un��j � rUn

j�� ��� �rUnj rUn

j��� ������a

where

r � �t

x�� ������b

The initial and boundary conditions ������b� �����c are

U�j � �jx� j � �� �� � � � � J� ������c

Page 18: Chapter 2 Introduction to Finite Di erence Methods

�� Finite Di�erence Methods

Un� � Un

J � �� n � �� ������d

The computational stencil for ������a is shown in Figure ������ The parameter r is

analogous to the Courant number ������ for the kinematic wave equation �������

���� ���� ����

����

n

j - 1 j j + 1

n + 1

Figure ������ Computational stencil of the forward time�centered space scheme ������afor the heat conduction equation ������a�

The solution of ������a is obtained in the same manner as the �nite di�erence

solutions of ������b and ������ for the kinematic wave equation ������� Thus� us�

ing the initial data ������c� we calculate a solution U�j at the interior mesh points�

j � �� �� � � � � J � �� of time level � using ������a with j ranging from � to j � �� The

boundary conditions ������d with n � � determine U�� and U�

J � Knowing the discrete

solution at time level �� we proceed to determine it at time level �� etc� in the same

manner�

Example ������ Let us use the forward time�centered space scheme ������a to obtain

an approximate solution of ������ with � � � and the initial data

�x �

��x� if � � x � ������� x� if ��� � x � �

In Section ���� we saw that the exact Fourier series solution of this problem is

u�x� t ��Xk�

�k��e�k

���t sin k�x�

We�ll solve this problem with x � ��� �J � �� and either t � ����� or ����� Again�

the selection of these parameters is rather arbitrary� Using ������b with t � ����� and

x � ��� gives r � ���� Similarly� with t � ���� we �nd r � �� The two solutions are

Page 19: Chapter 2 Introduction to Finite Di erence Methods

���� A Heat Equation ��

t n x � � ��� ��� ��� ��� ��� ���j � � � � � � � �

��� � ��� ��� ��� ��� ��� ��� �������� � ��� ��� ��� ��� ��� ���� �������� � ��� ��� ��� ��� ����� ����� ���������� � ��� ��� ��� ����� ����� ����� ���������� � ��� ��� ��� ����� ����� ����� ���������� � ��� ��� ����� ����� ����� ����� ���������� � ��� ��� ����� ����� ����� ����� ���������� � ��� ����� ����� ����� ����� ����� ���������� � ��� ����� ����� ����� ����� ����� ���������� � ��� ����� ����� ����� ����� ����� ���������� �� ��� ����� ����� ����� ����� ����� �����

Table ������ Solution of Example ����� using the forward time�centered space scheme������a with r � ����

t n x � � ��� ��� ��� ��� ��� ���j � � � � � � � �

��� � ��� ��� ��� ��� ��� ��� ������� � ��� ��� ��� ��� ��� ��� ������� � ��� ��� ��� ��� ��� ��� ������� � ��� ��� ��� ��� ��� ���� ������� � ��� ��� ��� ��� ���� ��� ����

Table ������ Solution of Example ����� using the forward time�centered space scheme������a with r � ��

t n x � ����j � � x � ����j � �jun� � Un

� j jun� � Un� j

����� � ������ ��������� �� ����� �������� ��� ����� �����

Table ������ Errors at x � ��� �j � � and x � ��� �j � � for the solution of Example����� using the forward time�centered space scheme ������a with r � ����

shown in Tables ����� and ����� for a few time steps� Errors of the solution with r � ���

at x � ��� and ��� are presented in Table ����� for a few times� The solutions are also

shown in Figure ������

As shown in Tables ����� and ������ the solution of ������a with r � ��� is producing

a reasonable approximation of the exact solution� The larger errors at x � ��� for

Page 20: Chapter 2 Introduction to Finite Di erence Methods

�� Finite Di�erence Methods

small times are due to the discontinuity in the initial data there� When r � �� the

�nite di�erence solution bears little resemblance to the exact solution� As with the

forward time�forward space scheme ������b for the kinematic wave equation ������� it

is oscillatory and increasing in amplitude� Apparently� some restriction must be placed

on r� however� the explanation for this restriction is not as simple as it was with �������

We�ll discuss it in the next chapter�

Page 21: Chapter 2 Introduction to Finite Di erence Methods

���� A Heat Equation ��

00.2

0.40.6

0.81

0

0.002

0.004

0.006

0.008

0.010

0.2

0.4

0.6

0.8

1

xt

U

00.2

0.40.6

0.81

0

0.01

0.02

0.03

0.04−2

−1

0

1

2

3

xt

U

Figure ������ Solutions of Example ����� obtained by the forward time�centered spacescheme ������a with r � ��� �top and r � � �bottom�

Page 22: Chapter 2 Introduction to Finite Di erence Methods

�� Finite Di�erence Methods

Page 23: Chapter 2 Introduction to Finite Di erence Methods

Bibliography

��� R� Courant� K�O� Friedrichs� and H� Lewy� On the partial di�erential equations of

mathematical physics� Technical Report NYO������ New York University� New York�

����� Translated by P� Fox�

��� R� Courant� K�O� Friedrichs� and H� Lewy� �Uber die partiellen di�erenzenglechungen

der mathematischen physik� Mathematische Annalen� ���������� ����� Also see ����

��� L� Lapidus and G�F� Pinder� Numerical Solution of Partial Di�erential Equations in

Science and Engineering� Wiley�Interscience� New York� �����

��