Professional Documents
Culture Documents
OF COMPACTFINITE
DIFFERENCE
METHODS
FOR THE NUMERICAL
SOLUTION
OF PDE
by
Mohammad Ozair Ahmed
191
Bibliothque nationale
National Library
ofCanada
du Canada
Acquisitions and
Bibliographie SeMces
Acquisitions et
services bibliographiques
395,rue Wellington
OtiawaON K1AOfU4
Canada
and moving mesh methods. both of which have attracted much attention recently due
to their efficiency and high order accuracy. In order to study the properties of the
numerical solutions such as accuracy, consistency, and stability, we use the method
of modified equations. We simplify the tedious procedure of obtaining the modified
equations by using the cornputer algebra language Waple. In order to evduate the
relative effectiveness of the various numerical schemes, we carry out a number of
relevant experiments using appropriate equations such as the heat equatioil, the onedimensional gas equation, the Van der Pol equation, and the Kuramoto-Sivashinsky
equation.
\Ve show that compact methods can yield high order accuracy for a relatively
low computational cost. We show that only rhree point computational grid points
are required to achieve a fourth order accurate solution. We develop a new family
of compact methods, that give matrices that can be factored analytically leading to
improved cornputational efficiency.
By using the equidistributicn pnnciple as a guide, we implement the moving mesh
method for the one-dimensional gas equation. The moving mesh methods give better
results t han the standard uniform mesh methods.
iii
In the rnemory of
My brother:
and
My cousin:
Omar Tariq
ACKNOWLEDGEMENTS
1 would like to express my deep gratitude to my t hesis supervisors Professors Henning
Rasmussen and Robert Malcoh Corless for their expert guidance, active cooperation,
and stirnulating discussions at al1 stages of rny research work.
1 take this opportunity to thank Dr. Kenzu Abdella for his sincere academic help
TABLE OF CONTENTS
CERTIFICATE OF EXAMINATION
ii
ABSTRACT
iii
DEDICATION
iv
ACKNOWLEDGEMENTS
TABLE OF CONTENTS
vi
LIST OF TABLES
xi
LIST OF FIGURES
xii
Chapter 1 Introduction
2.1 Introduction
................................
.......
2.2.1
2.2.2
.........
13
...........................
14
15
vi
19
2.4 Results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
21
Conclusions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
2.3.2
2.5
35
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
35
...............
36
& + cf,
= O.
3.2.1
3.2.2
= dJzz.
3.2.3
+ cf,
. . . . . . . . 36
.........
45
= dJzz . . . . . . .
47
3.3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
49
Chapter 4
4.1
Compact Methods
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
..............
4.2.3
Difference scheme using a compact scheme for u, and a Backward Euler scheme for ut. . . . . . . . . . . . . . . . . . . . .
4.2.4
Difference scheme using compact scheme for u, and a CrankNicolson scheme for ut. . . . . . . . . . . . . . . . . . . . . . .
..............
4.4
4.5
Results
4.5.1
...................................
Influence of rounding errors . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . 66
....
67
................................
70
4.8 Conclusions
65
Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
5.2 Formulation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
76
............................
77
.......
78
5.3.2
78
5.3.3
79
5.3.4
...........
80
5.3.5
5.3 Methodsofsolution
. . . . . . . . . . . . 80
..........................
83
84
94
6.1
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
94
................................
95
6.2 Formulation
. . . . . . . . . . . . . . . . . . . . . . 97
99
.......
99
6.4.2
6.4.3
.......
102
6.4.4
. . . . . . . . . . 103
6.4.5
. . . . . . . . . . 106
108
7.1 Introduction
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
4.o
.....
126
. . . . . . . . . . . . . . . . . . . . . . . . . . 128
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132
138
140
.....
A.2 Stability analysis for the Lax-Wendroff scheme of the equation (3.3)
A.3 Stability .4nalysis for the
A.4 Stability
140
. 143
151
. . . . . . . . . . . . . . . . 151
ft
+ cf,
REFERENCES
VITA
. . . ..... . ..
. 154
....
159
LIST OF TABLES
2.1
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
5.1 Time taken by various methods to solve the KS equation with a = 13.
att=1.0.
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 87
.....................
88
114
LIST OF FIGURES
Results for y' = y2. The dashed line is the exact solution y = 1/(1
t), while the solid line is a good numerical solution of the modified
equation (2.11). The diamond signs are the resuits of applying RK2
method with fixed tirne-step h = 0.1 to equation (2.2). . . . . . . . .
Results for y' = y*. The dashed line is the exact solution y = 1/(1
t), while the solid line is a good numerical solution of the modified
equation (2.13). The diamond signs are the results of applying Euler's
method with fixed time-step h = 0.1 to equation (2.2). . . . . . . . .
Results for the y' = y* - t. The dashed line is the exact solution to
equation (2.11), while the diamond signs are a good numerical solution of the modified equation (2.17). The solid line is the result of
applying RK2 method with Lxed tirne-step h = 0.3 to equation (2.14).
Increasing the order of the modified equation does not bring greater
quantitative agreement. Decreasing the stepsize, however, does bring
the two curves into quantitative as well as qualitative agreement.
..
Results for y" + y = O. The dashed Line is the exact solution sin(t) +
cos(t), while the diamond signs are a good numerical solution of the
modified equation (2.21). The solid line is the result of applying Euler's
xii
2.5 Results for y" + y = O. The diamond signs are the logarithm of the
absolute difference between a good numerical solution of the modified
equation (2.21)and the result of applying Euler's method with fixed
tirne-step h = 0.01 to equation (2.19).The solid line is the logarithm
of the absolute difference between the exact solution sin(t)+cos(t), and
the result of applying Euler's method with fixed time-step h = 0.01 to
equation (2.19).We see the solution to the modified equation fits the
. . . . . . . . . . . . . . . . . . . . 30
numerical solution much better.
+ y = O.
2.6
2.7
Results for the Van der Pol equation for c = 1. The dashed line is
the exact solution to equation 'y - (1 - y2)y' y = O. The diamond
signs are a good numerical solution of the modified equation (2.29) for
2.8
32
Results for the Van der Pol equation for r = 10. The dashed Iine is
33
2.9 Results for the Van der Pol equation for c = 1/100. The dashed line is
the exact solution to equation y"- 1/100(1-y2) yt+y = O. The diamond
signs are a good numerical solution of the modified equation (2.29) for
c = 1/100. The solid line is the approximate solution computed by
Euler's method with fked time-step h = 0.1 to equation (2.27) for
=1/100. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
The solid line is the logarithm of the absolute difference between the
exact solution XsZ
i nt( m ) and the result of applying FOCM3 to equation (4.39). The diamond signs are the logarithm of the absolute difference between the exact solution r Z
sin(rx)
t
and the result of applying
FOCMZ to equation (4.39).The dashed line is the logarithm of the
absolute difference between the exact solution e-"2t sin(?rz) and the
result of applying scheme (4.29) to equation (4.39). The plus signs
are the logarithm of the absolute difference between the exact solution solution e-"" sin(sz) and the result of applying the second order
Crank-Nicolson rnethod to equation (4.39). . . . . . . . . . . . . . .
72
4.3 Rounding Enors in Compact Formulas. The solid line is the maximum
73
1.4 Plot of errors (residual and exact) in the heat equation solution by
FOCM3 on a log scale. The steeper sloped line (siope very nearly 5 al1
along) is the residuai error, while the exact error does not behave so
nicely, for smdl h, levelling out at about 1.0e - 6. . . . . . . . . . .
74
86
89
3.1 Solutions of
5.2
...........................
The logarithm of the absolute difference between the exact and numerical solution of KS equation for a = O at t = 1.0. . . . . . . . . . . .
Logarithm of the absolute difference between the reference solution
(solution obtained using SOCM with 1000 points) of KS equation and
solutions using other four methods at t = 1.0 and a = 13. The line
O - O is the logarithm cf the absolute difference between solution
using SOFDM method and the reference solution, the dashed line is
logarithm of the absolute difference between solution using SOFDM
method and the reference solution, the line + - - + is the logarithm of
the absolute difference between solution using FOCMl method and the
reference solution, and the line O - O is the logarithm of the absolute
difference between solution using FOCM2 method and the reference
solution. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Plot of the density of the gas obtained using (a) SOFDM method
(b) SOFDM2 method ( c ) FOFDM method (d) FOCMl method (e)
FOCM2 method (j)FOCM3 method at t = 0.15. . . . . . . . . . . .
Plot of the density of the gas at t = 0.15.
...............
...............
Plot of the interna1 energy per unit mass of the gas at t = 0.15.
...
Plots of density of the gas at t = 0.15. The diamond signs are the
solution obtained using MMPDE5. The dashed line is the solution
obtained using uniform mesh. . . . . . . . . . . . . . . . . . . . . . . 134
Plots of velocity of the gas at t = 0.15. The diamond signs are the
solution obtained using MMPDE5. The dashed line is the solution
obtained using uniform mesh. . . . . . . . . . . . . . . . . . . . . . . 135
Plots of pressure of the gas at t = 0.15. The diamond signs are the
solution obtained using MMPDE5. The dashed line is the solution
obtained using uniform mesh. . . . . . . . . . . . . . . . . . . . . . . 136
Plots of interna1 energy of the gas t = 0.15. The diamond signs are
the solution obtained using MMPDE5. The dashed line is the solution
obtained using uniform mesh. . . . . . . . . . . . . . . . . . . . . . . 137
Amplification factor modulus for upwind scheme. The solid line is the
graph of IGI ( A 4 for v = 0.5, the diarnond signs are the graph of IGJ
( A 4 for v = 0.75, the dashed line is the g a p h of IG( (A.4) for v = 1.0,
and the plus signs are the g a p h of lGl ( A 4 for u = 1.25. . . . . . . 147
Relative phase error of upwind scheme. The solid line is the g a p h of
$14. (-4.5)
for v = 0.25, the diarnond signs are the graph of @/#e(A.5)
for v = 0.5, the dashed line is the graph of 4/4. (A.5) for v = 1.O, and
the plus signs are the graph of i$/& (A.5) for u = 0.75, . . . . . . . . 148
Amplification factor modulus for Lax-Wendroff scheme. The solid line
is the graph of (G(
(A.9) for u = 0.25, the diamond signs are the graph
of IGI (A.9) for v = 0.5, the dashed line is the graph of IGI (A.9) for
v = 1.0,and theplussignsare t h e g a p h o f IG( (A.9) forv=0.75.
. 149
.4mplification factor modulus for FTCS scheme. The diamond signs
are the g a p h of G (A.11) for r = 116, the solid line is the graph 1GI.
(A.12) for T = 116, the plus signs are the graph of G (8.11)for r = 1/2,
and the dashed line is the graph IGel (A.12) f o r r = 112. . . . . . . . 150
Chapter 1
Introduction
With the continuing advances in computer technology, numerical methods have becorne important tuols for solving most of today's industrial and engineering problems.
Since a large portion of these problems involve some kind of differential equations,
numerical methods of differential equations have been used to solve a wide range of
real-world problems such as weather and climate forecasts, geological exploration,
and biologicai applications. The rnethods range frorn simple finite difference schemes
such as Euler's scheme to more complicated higher order numericai schernes for partial
differential equations.
The literature on numerical methods for ciiffereatiai equations and their analysis
is so extensive. and the subject has been studied so intensively, that it is perhaps
surprising that there are still new and useful things to Say, even for simple finite
difference methods. This thesis does so, however. In particular, we revive a "wellknown" but heretofore not often used method of analysis, namely the method of
modified equations. We also show how to construct a new famiiy of compact finite
diEerence schemes.
Both of these developments, which allow construction of special methods for
parabolic PDE and indeed ordinary two-point boundary value problems, and allow
analyses "tailored" to the particular problem being solved, are made possible by the
development of packages in the computer algebra language Maple. The package for
the method of modified equations is new for this thesis. The package for finite m e r -
ence generation was written by Jacek Rokicki and Robert Corless (181.
The developments of this thesis are of interest because although while a wide
selection of methods and analyses are aiready available, none of these methods are
effective for every type of application. Therefore, studying and undentanding the
success and limitations of the various methods is important. Although no simple
tests exist For carrying out such studies, there are various ways of assessing the a p
propriateness of a given numencal scheme for solving a differential equation. An
effective approach that will be considered in this thesis is the method of modified
equation. With this approach, a modified equation, which is an approximating differential equation that is a more accurate mode1 of what is actually solved numerically
by the use of the given numerical scheme, is determined and studied. This provides
us with very valuable qualitative and quantitative information regarding the numer-
ical solution for the finite difference scheme being used. Properties of the numerical
solution such as accuracy, consistency and stability can be obtained by analyzing the
modified equations.
While this technique has been known to be useful for some time [24, 661, it has
not been used much in practice. The main reason for this is that, typicaily, obtaining
a modified equation involves a lot of tedious algebraic manipulation, which rnakes the
met hod of rnodified eqcation quite unat tractive for hand cornputation. In this t hesis,
we use the cornputer algebra progrwn Maple to eliminate the difnculty.
In this thesis, while we shall explore a wide range of numencal methods, Our
main focus will be o r compact methods and moving mesh methods. Compact methods have attracted a great deal of interest recently due to their ability to yield a
higher order of accuracy for an equivalent computationai cost than the classical finite
dinerence methods [13, 501. Moving mes& methods are also considerably more efficient than the standard uniform fixed mesh 6nite dinerence schemes. By considering
numerical experiments using appropriate equations such as the heat equation, the
one-dimensional gas equation, and the Kuramoto-Sivashinksy equation (33, 43, 471
we study the relative effectiveness of the vaxious methods.
In Chapter 4:
we
tial equations called compact methods. By solving the heat equation using various
fourth order compact methods, we demonstrate the capabiiity of compact methods
to yield higher order approximations for relatively low computational effort. It is
confirmed that fourth order accuracy can be achieved using only three computational
grid points, which is the typical requirement for classical second order h i t e m e r ence schemes. Moreover, the rnatrix which arises from the compact method retains a
pact methods that we cal1 'fast' compact methods because the matrices that arise
can be factored analytically. leading to improved computational efficiency on serial
machines. These methods are constructed using the FINDIF program (in Maple)
written by Rokicki and Corless [18]. We aiso show that these fast compact methods
are appropriate for stifT systems, even though the Jacobian matrices that arise are
dense, because while dense they are related to the inverses of banded matrices, aad
this allows fast cornputation of Jacobian-vector products.
In Chapter 5, w in-estigzto the numerical solutions of the well-known KuramotoSivashinksy equation, which is a fourth order non-linear partial differential equation
that arises in the context of angular phase turbulence and thermal diffusion. Here, we
compare various numerical schemes including a second order finite difference method,
a second order compact method, a fourth ordcr finite difference rnethod, and two
parameter a. It is found that, in agreement with the literature, the maximum amplitude of the solutions is quite sensitive to this parameter. The maximum amplitude for
large a cases is an increasing function of a. while for small values of a,the maximum
amplitude decreases with increasing a. While al1 the numerical methods exhibit this
behaviour, as well as agreeing with the expected asymptotic solution, the fourth order
compact methods give superior performance both in t e m s of accuracy and efficiency.
This is consistent with the findings of Chapter 4.
In Chapter 6, we deal with the numerical solution of the one-dimensional gas
dynamics equation [61]. The gas dynamics equation is commonly used for testing
numerical methods for non-linear hyperbolic conservation laws. Here, it is sslved
using six dinerent compact and non-compact explicit schemes.
moving mesh methods can be considerably more efficient than the traditiond uni-
form mesh methods. This raises the possibility of combining fast compact methods
Chapter 2
In this chapter, we consider the method of modified equation for ordinary differential
equations (ODEs).By considering a number of useful examples including single fint
and higher order ODEs,we demonstrate the value of modified equations for obtaining
useful insight into the qualitative and quantitative behaviour of various numerical
schemes. In order to obtain the modified equations, we follow the work of Corless [14],
who utilized hlaple for first order pro blems. In this chapter, we extend Corless's work
and extend the Maple irnplementation to higher order problems. Maple programs for
modified equations are given in Appendix B. Following the brief introduction in the
following section, we present results for single first order ODEs followed by results for
higher order ODEs. Concluding remarks are presented at the end of the chapter. An
alternate explanation can be found in [2].
2.1 Introduction
When we solve a given differential equation using a numerical algorithm, we approximate the actuai dzerentiai equation by a different one which we soIve exactly. The
rnethod of modified equations is a technique of determining the approximating differential equation that is actually solved exactly by the numencal algorithm. The
approximating differential equation which is solved by the numerical algorithm is
called a 'modified equation' ('MDE). Modified equations are not unique, and there
are various ways of obtaining them. This is a type of backward error analysis [15].
Modified equations axe very useful in assessing and studying solutions obtained by
numerical algorithms since they provide us with more qualitative understanding of the
numerical solution t han the dinerence equations that define the numerical algonthm
being used. Mathematical modellers are quite used to interpreting individual terms
of their equations as having a meaning for their paxticular problem. For example,
in x
+ 2Px + x
viscous damping (sometimes purely positive and sometimes purely negative causing
exponential growth), that introduce diffusion, and that introduce dispersion.
The more usual analytical concepts of order of accuracy and consistency are also
available via the method of rnodified equations. In particular, the global order of
accuracy of the method is more easily understood with this approach because the
Grobner- Alexeev nonlinear variation of constants formula (see e.6 (151) States that
the global error can be written as
where 6 is the defect, residual, or deviation from the true equation, and G is a function
which depends on the exact solution, but which can be assumed to remain bounded for
the purpose of analysis. In Our case, 6 is the difference between the modified equation
and the original equation. If this difference is 0(h2),Say, then we see irnmediately
that for compact time intervals (fixed t h e intervals O
error d l approach zero like h2 in the lirnit as h
is less conceptual difnculty than with the more usual local error approach, in which
the reason for the l o s of an order of accuracy is not trivial to see, and the role of
compactness is also not as clear a s with formula (2.1).
h),
where #
is the functional form obtained from the particular numerical scheme. Then x(t,)=u,,,
where t, =
xk,,
size, and p is the order of the method. Given un, a modified equation
a differential equation
un = y ( t,)
(MDE)is
solution. We give example in next section which will rnake this clear.
We look for such modified equations because they are easier to understand qual-
i tatively t han the difference equations t hat define the numerical met hod being used.
Thus. the modified equation can be used to evaluate various qualities or properties of
the numerical method, such as order of accuracy, consistency, and stability. In other
words, the rnodified equation is very useful in understanding the behaviour of the
numerical solution. The purpose of a rnodified equation, then, is explanation of the
numerical result. Warming and Hyett [66]used MDEs to investigate consistency and
infinite number of higher order derivatives. If al1 terms involving these higher-order
derivatives vanish as h + O, then the MDE becomes identical to the exact differential
equation in the limit h
-+ O.
-t
O, then the
for initial value problerns using Maple. This problem was solved by hand by G d fiths and Sanz-Serna [24] by expanding the finite difference and solving the resulting
linear systern. In [12], Calvo, Munia, and Sanz-Sema showed how to systematicdly
construct modified systerns of any order based on work by Hairer [25]. A Maple implementation b r the single first order ODEs was written by R. M. Corless in June
1993. We extended the first order ODEs version of the implementation to higher
order
ODEs. The Maple programs for modified equations are given in Appendix B,
The modified equation is denved by first expanding each term of the numerical a g
proximation in the Taylor series about h = O and then eliminating higher derivatives
of the differential equation by dgebraic manipulation. Even though there are in-
finitely rnany terms of the rnodified equation, in practice only the first several lower
order terms need to be computed. The extra terms that appear in the modified equa-
tion represent a type of truncation error and can be used to analyze the accuracy and
consistency of the given aigorithm.
2.2.1 Example: A Modified Equation for y' = y*
Here we will derive the fifth order modified equation for the problem y' = yZ (81 for a
second order Runge-Kutta method. In the same way, one can find a modified equation for any problem of any order for any one-step numencal method.
The key idea of the method of modified equations is that we may obtain an
infinite-order modified equation for our numerical method simply by setting the 10cal truncation error to zero, expanding it in a Taylor series, and interpreting the
resulting equation as a new differential equation for a new function. By construction,
the difference equstion of our numerical method produces results which satisfy this
modified equation exactly. .4s we will see, this equation is an infinite-order singular
perturbation. It will be more convenient to derive from it a modified equation of the
same (differential) order as we started with. The local truncation error is defined
as the difference between the numerical solution y,+,
u ( t ) which
u(t,)
satisfies the differential equation exactly but starts at the initial condition
= yn. By convention, this quantity is divided by the step size h. Thus the local
truncation error is
We now look for a new function w ( t ) which makes the local truncation e n o r indentically zero, and interpolates the numerical solution. Thus w(t) = y,, w (t+ h) =
and, with k2 caiculated with w(t) instead of y,,
d
i d2
= z ~ ( t) k2 ( h ,w ( t ) , t ) - h - ~ ( t )
2 dt2
i ,d3
+ 6-h
-w(t) +
dt3
WCmay choose any convenient order to work to work to. Here we choose
We keep only terms of 0 ( h 4 )here because d2w/dt2is multiplied by h in (2.5). Contiming to differentiate, we get
and
Using the order one approximation to w'. w", w"', and wc4) from equations (2.5) -
This is an expression for wc5) that is accurate to first order that contains only w and
no derivatives. In the same, way one can find an 0(h2)expression for w ( ~ an
) , 0(h3)
expression for w", an 0 ( h 4 ) for w", and finally the following 0 ( h 5 )expression for w' :
This is the fifth order modifieci equation for the problern y' = y2 for the RK2method. The exact solution of equation (2.11) is O(hS), close to the numerical solution
of equation (2.2) obtained by RK2-method on finite time intervals. See Table 2.1.
-4s h + 0, (2.11) approaches w' = w 2 , the same equation as the original one.
The eight order modified equation for the equation (2.2) using this method is given
below
.4s h
-t
(2.2). The lowest-order term in (2.13) is O(h) because Euler's method is first order.
-t
- t, which
With the substitution y = - w t / w . the equation (2.14) reduces to the weU known
Airy equation.
where Ai. Bi are Airy functions. See [49.67. 68, 691 for a general analysis and history
of the Airy equation. For numerical solution of the Airy equation, see [17].
The fourth order modified equation for equation (2.14) for the M2-method is given
by the following equation
As h
-t
.A complete Maple program that implements the method of modified equations was
developed by R. M. Corless in June 1993 for a first order
nience, the use of such programs eiiminate algebraic errors that may be introduced
in handling very long and complicated expressions. Here we extend this so that it
can deal with higher order ODES In order to demonstrate this extension, we will
consider the following second order dinerential equations which can be ttansformed
into a qrstem of two first order equations.
+y =O
By substitution
u l = y
112
and
= y'.
U' = *du)
where
and
The fifth order modified equation for (2.19) for Euler's method is given by
w h ~ wM7 is the variable of the modified equation of the original differential equation.
venience and easy comprehension. (For this simple example a human can find the
N = oo modified equation).
example.
A Modified Equation for RK-2 Method for (2.18):
The 5th order modified equation for (2.19) for the RK2-method is given by
where a = 1 + h2/6
CF' = e
As h
cos(at)
sin(at)
- sin(at)
cos(at)
approximation of (3.19).
.As we mentioned in the introduction the method of modified equations can be used
to investigate the stability of numerical solutions. In this example we see that the
%IDEgives us interest ing insight into the stability behaviour of our numeric solution.
The above result implies that the numerical method introduces a qualitative change
in the characteristics of our solution, since here b represents a negative damping, that
is, exponential growth, and a represents the frequency of oscillation. Note that the
o ( l / h 3 ) .Moreover,
b > O so the numerical solution is unstable on long time scales. For Euler's method
(from the previous su bsection), we have b = h/2 0 ( h 2 ) ,which is again > O for srnad
are very usehl in assessing the accuracy and convergence of numericd methods and
makes modified equations very valuable. Here, it is worth noting that if the exact solution of the modified equation is not available, then higher order numerical schemes
such an eight order Runge-Kutta method can be utilized to provide an accurate solution of the modified equation, if desired, but this is never necessary.
The four-stage, 4th order Runge-Kutta method for a system of two first-order differ-
ential equations is
Likewise the 6th order modified equation for (2.19) for the RKCmethod is given by
-4s h
-t
RK4
introduces positive damping into this equation, and thus on long t h e scales we have
exponential decay of the solution. In some ways, this is to be preferred to exponential
growth, but it must be rernembered that this is just as incorrect for this problern,
where
and
The 3rd order modified equation for Euler's rnethod applied to the Van der Pol equation is
where
In the limit as
As h
+ 0,
approximation of (2.27). In next section, we will discuss the solutions for 3 dif5erent
values of e :
For now, note the nonuniform effects cf the numerical method: the order in which
we take the limits (c -r O and h
-t
2.4
Results
of the problem y' = y*. the numerical solution obtained using the method of RK2
with stepsize h = 0.1. and the solution of the modified equation (2.1 1). The solution
of the modified equation represents the result obtained by the numerical rnethod to
graphical accuracy. Thus we have shown that the exact solution of the modified
equation (2.11) is closer to the numerical solution of the original problern y' = y2
than the exact solution of y' = y2 is.
Figure 2.2 shows the graphs of the exact solution of the problem
the numerical solution obtained using the Euler's method with stepsize h = 0.1,
and the solution of the 8th order rnodified equation (2.13). We see that for smail t ,
have such spurious fixed points. Thus the finite-order modified equation may not be
a good mode1 of what the Euler solution is doing for large times 1151. This limitation
(also for Figure 2.3) on the usefulness of the method of modified equations must be
kept in mind, but in fact the standard analysis also sueers these flaws-they
are just
clear, here. See [62, 631 for a discussion of longtirne asymptotic analysis of initial
value problems.
Figure 2.3 shows the graphs of the exact solution of the problem
the numerical solution obtained using the RK2 method with stepsize h = 0.3, and
the solution of the rnodified equation (2.17). The solution of the modified equation
nearly interpolates the RK2 method solution until it reaches a spurious k e d point.
This spurious solution behaviour occurs for large times, for t = 0(l/h2) in RK2
solution (321, and thus the method of modified equations as presented here cannot
explain the apparently smooth spurious solution. This conclusion is general: finiteorder rnodified equations may not help in examining long-term asymptotic behavior
of numerical methods [lj].
Figure 2.4 shows the graphs of the exact solution
solution. Even though the exact solution is quite different from the numerical solution
for t vaiues above 0.3, the modified solution overlaps with the numerical solution for
al1 the time in the g a p h . Thus the solution of the modified equation agrees with the
numerical solution.
Figures 2.5 shows the graph of the logaxithm of the absolute difference between
the exact solution of the equation (2.18)
y ( t ) = sin(t)
+ cosjt)
and Euler's method solution with the stepsize h = 0.01, and the l o g a d h m of absolute
difference between the solution of modified equation (2.2 1) and numerical solution.
Figure 2.6 shows the graph of the same logaxithm of the absolute differences as
shown in F i y r e 2.5, except that in this figure. the numerical method is the M 2 method, and the stepsize h is 0.1. In both figures, the difference between the solutions
of the modified equation and the numerical method is essentially zero ou this time
respectively. Here we use Euler's method, and the stepsize h is 0.1. In al1 three
cases, our method is very successful. The numerical solution is very well represented
2.5
Conciusions
In this chapter, we investigated the method of modified equations as a tool to analyze the qualitative and quantitative behaviour of numerical solutions of differential
equations. We showed through specific first order and higher order problems that the
method of modified equations can yield numerical solution properties suc? as accurac- consistency, and stability We also extended the previous work of Corless [14]
to
next chapter, we shall further extend this work to study partial differential equations.
2
h
Table 2.1: Exact and numencal solutions of (2.2) and a good numerical solution of (2.1 l).
Figure 2.2: Results for y' = y2. The dashed line is the exact solution
y = 1 /(1 - t ), while the solid Iine is a good numerical
solution of the modified equation (2.13). The diamond
signs are the results of applying Euler's method with fixed
tirne-step h = 0.1 to equation (2.2).
Figure 2.3: Results for the y' = y2 - t. The dashed line is the exact
solution to equation (2.14), while the diamond signs are a
good numerical solution of the rnodified equation (2.17).
The solid line is the result of applying RK2 method with
fked the-step h = 0.3 to equation (2.14). Increasing
the order of the modified equation does not bring greater
quantitative agreement. Decreasing the stepsize, however, does bring the two c w e s into quantitative as well
as quakative agreement.
+y
= O.
Figure 2.6: Results for y" + y = O. The diamond signs are the logarithm of the absolute differeoce between a good numerical solution of the modified equation (2.23) and the result of applying the RK2 method with fixed time-step
h = 0.1 to equation (2.19). The solid line is the logarithm of the absolute clifference between the exact solution sin(t) + cos@),and the result of applying the RK2
method with bced tirne-step h = 0.1 to equation (2.19).
Figure 2.7: Results for the Van der Pol equation for c = 1. The
- (1 -
+ y = O.
Figure 2.8: Results for the Van der Pol equation for c = 10. The
dashed line is the exact solution to equation y" - 10(1 y2)y' + y = O. The diamond signs are a good numerical solution of the modified equation (2.29) for c = 10.
The solid iine is the approximate solution computed by
Euler's method with fixed time-step h = 0.1 to equation
(2.27) for c = 10.
Figure 2.9: Results for the Van der Pol equation for c = 1/100.
The dashed hne is the exact solution to equation y" 1/100(1 - y2)y' y = O. The diamond signs are a good
numencd solution of the moified equation (2.29) for
c = 1/100. The solid line is the approxmate solution
computed by Euler's method with fked tirne-step h = 0.1
to equation (2.27) for a = 1/100.
Cbapter 3
The Method of Modified Equations (PDEs)
3.1 Introduction
The benefits of using modified equations in analyzing numerical schemes and their
solut ions that were discussed in the previous chapter for ordinary differential equations also apply for partial differential equations. The general technique of developing
modified equations for partial dinerential equations was presented by Warming and
Hyett [66]in 1974. While we follow a procedure similar to that of Warming and Hyett,
the main difference here is that the derivation of the modified equations is carried
out using Maple. The benefit of using Maple is that the highly tedious procedure of
obtaining modified equations for riurnerical methods can be simplified greatly.
Consider the general linear PDE [29]
f denotes the exact solution, and L, represents a possibly nonlinear operator involving the spatial derivatives in x. The finite difference equation (FDE)that
approximates the exact PDE is obtained by replacing the partial derivatives ft and
L, ( f ) by the finite difference approximations f, and L, ( f ), respectively. Thus the
FDE is
where
IDE is the actual PDE that is solved by the FDE or at least a better approximation to what the FDE solves.
The &IDE is derived by expanding each term in the FDE in the Taylor series at
some base point. Effectively, this changes the FDE back into a PDE.This analysis is
thus similar to what was done in Chapter 2 for ODES. Time derivatives higher than
first-order and mixed time and space derivatives are eliminated by differentiation of
the >IDE itself. The MDE must contain al1 of the t e m s appearing in the exact
3.2.1
6 + cf,
PDEs.
= O.
First we will derive the MDE for the upwind difference approximation [46] of the
following equation:
(2,
n)
and using backward space difference for f,, in (3.3), we have the following difference
equat ion:
. Thus
Equation (3.5) is the upwind approximation 1.161 of the equation (3.3) in the case
c > O. Xow write the Taylor series for terms f:+'
and f:-,
in (3.5). Thus
Canceling zero-order terms, dividing through by At, and rearranging terms yields the
following equation
:1
derivatives and the mixed time and space derivatives from equation (3.6). It is important to ernphasize that the original partial differential equation (3.3) should not be
used to eliminate the unwanted time derivatives. In general, a solution of the partial
differential equation will not satisfy the difference equation. Since the modified equa-
tion is to represent the difference equation, the original partial differential equation
should play no role in the elimination of the higher-order tirne derivatives. Tyler [65]
and Roache [57] differ from this prescription for obtaining the rnodified equation. In
their approach, the time derivatives higher than first order and mixed time and space
derivatives are determined by differentiating the exact partial differential equation.
The proper method to eliminate higher order time derivatives and the mixed time
and space derivatives from (3.6) requires repeated differentiation of equation (3.6)
itself. We differentiate equation (3.6) with respect to time to obtain the following
expression for
Itt.
ftt
fzt
fL1.
= C.f,+Az
(f
7f& -
2
* * -
To obtain the following expression for ftu, we differentiate (3.9) with respect to t.
Replace values of
fZzt,/-.
Equation (3.15) is a modified equation for the upwind scheme [46] for the equation (3.3) in the case c > O. The right-hand side of the modified equation (3.15) is
the truncation error since it represents the difference between the original PDE and
The lowest-order term of the truncation error in the present case contains the
partial derivative f,,, which makes this term similar to the viscous term in the one-
# 1, the
upwind differencing scheme introduces an "artificial viscosity" into the solution. This
This is
the direct result of the odd denvative terms which appear in the truncation error.
.As a result of dispersion, phase relations between various waves are distorted. The
combined effect of dissipation and dispersion is sometimes referred to as difision.
Diffusion tends to spread out sharp dividing lines which may appear in the computationai region. In general, if the lowest-order term in the truncation error contains an
even denvative, the resulting solution will predominately exhibit dissipative errors [SI.
On the other hand, if the leading term is an odd derivative, the resulting solution will
predominately exhibit dispersive enors [5].
where Cm and CZ,+~represent the coefficients of the even and odd spatial derivative
terms respectively. W m i n g and Hyett [66]have shown that in the small wave number limit where d l higher order terms negligible, the necessary condition for stability is
where C(21)represents the coefficient of the lowest-order even derivative term in the
right-hand side of a modified equation. Theg also showed that a more cornpiete stability analysis leads to the following general necessq and sufficient condition.
The lowest-order even derivative coefficient in the right-hand side of the modified
equation (3.15) is C(2 = 21), so 1 = 1. Rom the inequality (3.18), if v = cAt/Az,
then a necessary condition for stability is C(2)> O, i.e.
or v < 1, which is obtain.ed fiom the von Neumann stability analysis (see appendix A).
Warming and Hyett have also shown that the relative phase error for ciifference
schernes applied to the equation (3.3) is
where k is the wave number. For small wave numbers, we need only retain the lowestorder term. For the upwind differencing scheme, if 0 = k h and c > O we fmd that
Definition 2: The order of a finite difference approximation of a partial differential equation is the rate at which the global error of the h i t e difference solution
approaches zero as the size of the grid spacings approach zero 1291.
ftl:
(2,
a):
is deter-
rnined by differentiating the partial differential equation (3.3) with respect to time.
Thus
Dropping the truncation error terms, we have the following Lax-Wendroff approximation to the equation (3.3):
Now mite the Taylor series for the terms f:+' and
and
fi$:
The modified equation is obtained by eliminating the higher-order time derivatives and the mixed time and space derivatives fiom the equation (3.33) by repeated
As the leading term in (3.34) is an odd derivative, the solution of the equation
For the modified equation (3.34): the condition of stability (3.18) is C(4= 21) > 0,
-t
O and Ar
-t
fi = d f n
for the forward-time centered-space (FTCS)approximation. Replacing
(3.35)
by the k t -
f,
(2,
n), and
(2,
by the second-
f?+'. Thus
Canceling zero-order terms, dividing through by At, and reananging terms yields
Now we have to eliminate higher order time derivatives and the mixed time and
space derivatives from the (3.39) by repeated differentiation of equation (3.39) itseif
to obtain the rnodified equation
-4s the leading term in equation (3.40) is an even derivative, the solution of the
equation (3.35) for the FTCS approximation (3.37) predominately e-xhibits dissipative errors (51.The lowest-order even derivative in the right-hand side of the modified
equation (3.40) is 2. Therefore for the modified equation (3.40),the stability condition is
C(2 = 21) > O, which implies that d > O. However this yields no useful
w hich implies
Hence, the necessary and sufficient condition for stability is r < 112, which is the
well-known stability condition. In the above expression r is d s .
Jt
-P
O, equation (3.40) a p
This means the FTCS approximation (3.37) of PDE is first order accurate in At and
second order accurate in k.
3.2.3 Example: A Modified Equation for
ft + cf,
= df,.
fi by the
(2,
(2,
n + 1) be the base point. Substituting the Taylor series for al1 terms
The MDE is obtained by eliminating the higher-order time derivatives and the
mixed time and space derivatives from the above equation by repeated differentiation
As the leading t e m in (3.44) is an even denvative, the solution of the equation (3.41) for the BTCS approximation (3.42) predominately exhibits dissipative
errors [5]. The lowest-order even derivative in the right-hand side of the modified
equation (3.44) is 2. Therefore for the rnodified equation (3.44), the stability analysis
tion (3.41). This means approximation (3.42) of the equation (3.41) is unconditionally
stable.
Consistency: As At + O and 4 x
It + cf,
= df,,
BTCS approximation (3.42) of PDE (3.41) is fiat order accurate in At and second
order accurate in Ax.
3.3 Conclusion
For numencal methods such as the Lax-Wendroff scheme could be simplified greatly
using Maple. This allows one to consider complicated initial and boundary vdue
problems and still obtain the modified equations relatively easily. Through specific
problems, we showed the value of rnodified equations in studying solution behaviours
including physicai interpretation, accuracy, consistency, and stability.
Chapter 4
Compact Methods
In this chapter, we will consider three founh order compact numerical schemes for
partial differential equations. We check the accuracy of the developed schemes by
solving a simple parabolic problem, the heat equation. We also compare the equivalent
second order scheme with fourth order compact numerical schemes which aiso use
three nodes to obtain a fourth order accuracy. The results clearly confirm that the
fourth order compact methods are significantly uperior t o any of the second order
rnethods considered in this chapter. We also develop some new compact methods,
called 'fast' compact methods, and give some analysis of their expected performance.
4.1
Introduction
sary derivatives as unknown. The relations of these function and derivative values
yield simple tridiagonal equations, which can be easiiy solved. A comparison of the
fourth order results with the second order results are presented for the heat equation.
The comparison clearly suggests that the accuracy achieved by these fourth order
computations are significantly better than second order procedures.
The usual objection to fourth order schemes cornes from the additional nodes (besides
the standard three) necessary to achieve the higher order accuracy. Besides the
fourth order and compact, and it retains tridiagonal form. Hence, the matrix solution
can be accomplished by the Thomas aigorithm (641.
We follow the procedure of Pettigrew & Rasmussen [52] to derive this method for
the heat equation
and
4 x 7 0 ) = f (4 ,
order using only three grid points Say, xi-, , zi, and xi+ I . In order to derive the cornpact method, we introduce new variables for the derivatives [Sl]. Let us denote first
and second derivatives of u w.r.t x by F and S, respectively:
We shall first derive a relationship between the values of F and u a t the grid
points. Since F=u,, it is clear that
Hence, we have a relationship between u and F. This is the first difference equation.
In order to obtain the second equation, we start by evaluating (4.1) at the midpoint i. Then equation (4.1) becomes
(2,
n), we get
t e m , we carry out
fourth order
We have now replaced the differential equation (4.1) by the two dinerence equations
(4.6) and (4.11).
Now we have to look at the boundaries. Let us first consider the Ieft boundary
In order to get the second equation, we start with the differentid equation at the
points O and 1
From (4.9) and (4.8), we have the following expressions for Su and SI:
We have five equations (4.13)-(4.17). If we eliminate %, S;, u;, and @ nom these
five equations, we get the following second Merence equation, valid at z = 0:
In a similar manner, we can derive the following two difference equations for u
For each point, we have two difference equations. If we write them al1 together, we
have the following fourth order compact scherne for u.,.
Next, we compare the accuracy of the method with the usual five-point centered difference scheme of the fourth order. The relation between F and u in this method is
The accuracy of this scheme is easily obtained by Taylor expansions of the above
equations. The resulting t runcation error is
F, =
U:
- (-)1 h 4 ~ ( 5, )
180
and
Fi =
IL:
- (f)h4d" ,
and
Although the new scheme and the standard representation both represent fourth order
accuracy. the compact method should generate slightiy more accurate results due to
the smaller coefficients of the truncation error terms.
for ut.
Since the initial condition u(x, O) = f (x) implies that u l = f ( z i ) for each i =
O, 1. ...m. these values can be used in the above equations to find the value of u: for
UA
...m.
The additional
entries of the form u: can be determined. If the procedure is re-applied once a.U the
rnanner.
Systems (4.28) gives a system of linear equations for the unknowns u and F. The
equations (4.28) are a coupled set and must be solved simultaneously. Thus, the
integration technique now consists of solving at each time step the block tridiagonal
spstem generated by equations (4.28), instead of the usuai scalar tridiagonal matrix.
'low we coosider another and more efficient compact method. To denve this scheme,
we
suppose that the values of the derivatives at the given grid points are also known.
We utilize the FINDIF [18] package in Maple in order to derive this method. For the
second derivative of u with respect to x, FINDIF gives
Then by implementing the boundary conditions (4.2), we get the system of equations
iLlu" = A u ,
w here
and
Hence, we solve a set of linear equations (4.31) for u" and replace the values of
ut' in the heat equation (4.1).
(MOL) [3]. FOCMI is a dxerencing technique which contains the function and
al1 necessary 6rst derivatives as unknowns. In contrast FOCM2 is a differencing
technique, which contains the function and al1 necessary derivatives (including second
and higher derivatives) as unknowns. In the first compact method, we replace the
4.4
Now we will develop a new fourth order compact method by modification of FOCMP,
so we cal1 it Fourth Order Compact Method 3 (FOCM3). Modifications of
FOCM2 to
na1 matriv for the system of equations defining second derivatives for interior points.
We wish to preserve tridiagonality at the end points. Indeed we look for boundary
formulae which give the following two equations (also derived using FINDIF):
Both formulae are 0 ( h 4 ) .If we choose Our left-hand boundary formula instead to be
taken from [71] we can factor the resulting tridiagonal system exactly if c is chosen
properly. The qstem is
with k = I/c. and D = dia& c, .. . ,c). It is curious that the lack of constant diagonal~here is what leads to the exact factorization and consequent efficiency of the
method. The solution to Mid' = b can now be found by the recurrence relations
for i = 2,3,
, n, and
for i = n - l , n - 2,
- - a ,
1. If we choose c = 5
+ 2&
the
The total cost for evaluation of this derivative is O ( R )flops, where n is the number
of grid points. More important than this, the constant hidden in the O(n) syrnbol
is very small, since only multiplications (no divisions) are involved, and no storage
is necessary beyond one constant. This makes the method particularly suitable for
settings where the number of points may change, although we do not explore that
extension. in this thesis.
Application: Consider
ut
= Uzz
(4.41)
three fourth order compact difference schemes and the second-order Crank-Nicolson
scheme [Il].
Figure 4.2 shows the g a p h of logarithrn of the absolute difference between the exact
solution of the equation (4.39) and the numericd solutions obtained using the secondorder Crank-Nicolson scheme and logarithm of the absolute difference between the
exact solution of the equation (4.39) and the numerical solutions obtained using al1
three fourth order compact methods. From the Figure 4.2 it is clear that FOCM3
appears to be in this exarnple the rnost accurate among three compact methods,
followed by FOCM2 and FOCM1.
Figure 4.3 shows that the compact fourth order second derivative formula does not
suffer from rounding errors an' more than the explicit formula
does. Both formulas exhibit fourth order accuracy as h is diminished (using a Fibonnaci sequence of g i d points on the test problem f (z) = sin(sx)* on O 5 z 5 1) until
h is about 10-~. when the best accuracy is reached and rounding errors take over.
4.6
with the initial and boundary conditions u ( x ,O) = sin(lrz) and u(0,t) = u(1,t) = 0,
that the fast compact method that we cal1 FOCM3 is actually, and not just formally,
founh order accurate.
It is fast because not onlg is the linear system tridiagonai or pentadiagonal, but it also
has its upper left corner modified so that we may factor the matrix analytically, i.e.
in 0 (1) flops. This modification requires special-purpose finite difference fomulae for
the derivatives at the boundaries. but this is relatively simple to do using the Maple
share l i b r e package FINDIF [Ml.We will compute a residual for this equation to
show its accuracy.
.A sixth-order formula for evaluation of u, (Appendix C) will be used to compute
the residual accurately. We expect the residual
form making the modified equation for this method and this equation into
One method of wri&ing that FOCM3 is a fourth order would be to attempt to solve
the modified equation (4.14),and compare its solution with the numerical solution of
the heat equation generated by FOCM3. One would expect better agreement than
between the numerical solution of the heat equation generated by FOCM3 and the
exact solution of the heat equation.
another approach.
Instead, we compute ut accurately by interpolation of the MOL solution, dong
each grid line, and compute u,
used in FOCM3) . We then cornpute the residual r(z,t) = ut- u, and see how the
size of r varies as we Vary h, the spatial grid size. We use the sixth order formula for
u,, and fourth order formula for ut (both derived using FINDIF). The values of At
We computed residuals with 7, 15, 31, 63, and 127 grid points. We plot the
residuals and the exact errors on a log scale in Figure 4.4. We see that the residual
apparently behaves as 0 ( h 5 ) ,not 0 ( h 4 ) .while the exact error behaves like 0(h4) only
initially. CVe believe that the extra order of accuracy in the residual is an artifact
of the fact that the test function is nearly an eigenfunction for the second derivative
operator. and that with another test function, we would get only 0(h4)accuracy. We
do not understand the global error behaviour, but we believe that it might reflect
rounding error propagation in the time integation. One way to test this would be to
implement compensated summation [27] in the Matlab ODE integators to see if it
would improve this behaviout.
In this section, we will show that compact methods allow fast Jacobian-vector multiplicat ion, by considering Burgea' equation
B2,we have
defining Vz
bf2Vzz= B2V
defining V,.
Conceptually. VZ = Ml -'BI 1' and L i z = 114-' B2V. M I and hl2 are special tridiagonal matrices, and V, and V,, can be found in O(nj Rops, but M ~ - ' Band
~
are full (dense).
= -diag ( V ) K + XV,,
= f (1') , say.
We use the first form to calculate the RHS, of course. What is the Jacobian
J=%?
Consider the jth column J =
. W, h m
Mz-'B2
()J
the Jacobian J is
B~
and thus 0(n3) flops in the solution of the linear equations needed for implicit timestepping.
This is a standard trick in optimization codes and automatic differentiation, for example (George Corliss, private communication). If we define
Jw=
F(Ir+ ew) - F ( V )
c
If F(Ir)can be evaluated in O ( n ) Aops, then so can Jv. Higher order accuracy can
be obtained but is not usually important here. where approximate Jacobians are used
anyway.
Finallg. many PDEs are rather simple, being polynornial or rational at worst.
Exact Jacobian cdculations are not too difficult by hand, and automatic differentiation is available for more difficult equations.
techniques for the solution of the linear systems (e.g. (1 - h J ) V f k f'1 = F(V(") can
be expected to be efficient [IO, 281.
4.8
Conclusions
In this chapter, we studied, the efficiency and accuracy of the fourth order compact
methods for solving partial differential equations. For the heat equation, we were able
to show the superior performance of the fourth order compact methods. Generally
we expect to obtain a relatively higher performance with compact rnethods. When
compared with the second order methods, the fourth order compact method, which
d s o uses only three nodes, gives results that are significantly more accurate. We also
checked the level of accuracy for the fourth order compact method and showed that
compact met hods generally can take advantage of fast Jacobian-vector multiplication.
Thiis one can expect that these methods will be useful and efficient in the numerical method of lines for the solution of partial differential equations, which generaily
gives rise to stiff systems, because when the resulting nonlinear systems for irnplicit
met hods are solved using iterative techniques, a fast Jacobian-vector multiplication
is important.
-3.5
....
T
-4
4.5
<.
.'.
.... ......
*~
"
........ ........
......................* . _ _ _-..-..
_..
---.........
S..
.-.....
.... .....
....* - .
- m .
. S .
sa,
-5 Cs.,.'
-O
-5.5
-6 -
--,,,*-~--"-----O----------
*.-----
&-'----
/---
----.
---
+------_-_S.--
a-.
- 16.
Figure 4.4: Plot of enors (residual and exact) in the heat equation
solution by FOCM3 on a log scale. The steeper sloped
line (slope very nearly 5 all dong) is the residual error,
while the exact error does not behave so nicely, for small
h, levelling out at about 1.0e - 6.
Chapter 5
Numerical Procedures for the Kuramoto-Sivashinsky Equation
second order compact method. fourth order finite difference method, fourth order
compact method 1, and founh order compact method 2. We will also study the effect
of cr on the behaviour of the numerical solution. While al1 the numericd methods
show good agreement with the expected asymptotic behaviour for the parameter a,
the best result is obtained from the fourth order compact method 2. In the following
section, a bnef introduction is presented followed by a formulation and method of
solution as well as results and discussions. Concluding remarks are given at the end
of the chapter.
5.1 Introduction
There has been considerable attention to the Kurarnoto-Sivashinsky (KS) equation
in recent years. (see for example [43, 33, 471). One motivation for the great interest
and Sivashinsky were motivated by the study of non-linear stability of traveling waves.
Hence, the qualitative and quantitative study of the KS equation is of great interest
in analogy with the Burgers' and the Navier-Stokes equations. The KS equation is
used also in pattern formation modeling and other areas of applications. A list of
references related to these applications is given in [35]. In addition to the physical
motivations, the KS eqriaticn ir
3f
rich dynamical properties (cf. [61'[20], [34], [35], and [48]). Of particular signifieance
is the connection with the theory of inertial manifolds. Both when used as a mode1 or
when seen as a mat hematically relevant dpamical system, the KS equation requires
numerical solutions. In this chapter, we will use a wriety of numerical schemes to solve
the KS equation. In addition to obtaining insights to the qualitative and quantitative
behaviour of the KS equation, this exercise will also provide us with some level of
cornparison on the performance of the various schemes.
5.2
Formulation
= cos(x).
(5.3)
schemes;
1. Second Order Finite Difference Method
(SOFDM)
(FOCM2).
In each of these methods, we utilize the method of lines (MOL)[3]for (5.1). The MOL
is a classical technique for converting PDE into a system of differential equations. It
can be done in two ways. The first one consists of discretizing in time t and then
solving a boundary value ODE problem by BVP codes such as COLSYS, COLCON,
and AUTO [ y ] . This approach is caUed the transverse method of lines. The second
scheme involves discretizing in the space-like independent variables and leaving the
time variable t alone, and then solving an initial value problem for temporal t by
IVP codes, such as LSODE,LSODI [28], and DASSL [53]. This approach is called
the longitudinal method of iines. We will use the longitudinal approach, and the
resulting ODE systems are solved using the double precision version of the stiff ODE
solver LSODE 1281. Default values of the parameters of tirne integration in
LSODE
are used. The method of time integration is chosen as the backward differentiation
formulas (BDF) with chord iteration, for which an approximate Jacobian is computed
by
LSODE intemally using finite differences. For people farniliar with LSODE, these
remarks rneans that we took iopt = O and mf = 22. We took relative and absolute
tolerances equal t a 10m8. Al1 computations are obtained using a pentium (12OMhz)
cornputer with 16 MB RAM. In the following sections, we describe al1 five numerical
met hods.
We replace the x domain [O. 2a]by a discrete set of points x, = ih for i = 0,1,2...,n,
where h =
%. CVe use central differences for the first, second, and fourth derivatives
with respect to x. We find the following system of ODES for the discretized variables
ut:
Equation (5.4) dong with the appropriate boundary and initiai conditions, completely
define the solution.
we write the
KS equation as
We then use a central difference approximation for the first and second spatial derivatives to obtain the following systern of linear algebraic equations and first order nonlinear differential equations:
dui
4
= -- (vi-,
dt
h2
sui
- 274 + v ~ + -~ CtVi
) - -(4+i- ui-,)
2h
Each tirne we cal1 LSODE to solve ODEs (5.8) we have to solve linear algebraic
equations (5.7).
differences for the fim, second, and fourth spatial derivatives which give the following
systern of ODEs:
requires.
In order to derive the appropriate finite difference equations, we first introduce
new variables for the derivatives [51]. Let us denote first derivatives of u and v w.r.t.
x by F and f ,
u,
=F
and
vZ= f .
Each time we cal1 LSODE to solve ODES, we have to solve three set of linear algebraic
equations for F, f , and v. In this method, we find u, u,, u, and ,u
directly.
and u.,
package in Maple in order to derive this method. For the fim derivative, FINDIF
gives:
w here
Similarly for the second and fourth derivatives, we have the system of equations
where and u" and d4)are cohmn matrices like u' and
d4),
respectively, and replace t hese values in (5.1).
5.4 Results and Discussion
Using the five different schemes descnbed in the previous section, we carried out
various numerical experiments to investigate the behaviour of the solution of the KS
equation. We solved the KS equation by
exact solution, and compare this solution with solutions obtained using the other four
methods. For these four methods,
Ive
and 70 points if the method is fourth order. As a test, we take cr = 13 and compute
the solution at time t = 1.0. From Figure 5.1, we note that the general behaviour
of solutions of KS equation is found to be the same for al1 schemes. The time taken
by each scheme is summarized in Table 5.1. Table 5.2 shows the maximum n o m
L, and La n o m s of the error between the solution obtained from the method 2 and
solutions obtained from other four methods. From the table, it seerns that methods
4 8~ 5, 2.e. fourth order compact methods 1 & 2, give
FOFDM at t h e t = 1.0
NOTE TO USERS
UMI
of the solution is highly dependent on a. For n values exceeding 15, the maximum
amplitude continuously increases with increasing a,while for smaller values of a the
in this study. The study showed that the fourth order compact methods give the best
results both in t e m s of accuracy and efficiency as we found in the previous chapter.
1 .
4 .
Figure 5.1: Solutions of KS equation for a = 13, at t = 1.0 obtained using ( a ) SOFDM method (6) SOCM method
(c) FOFDM method (d) FOCMl method (e) FOCM2
rnethod.
SOFDM
500
1168.5
FOFDM
r
L
Met hod
Max. Norm
SOFDM
FOFDM
time t = 1.0. The solid is the the solution for a = 15, the
diamond signs are solution for a = 22.5, the dashed line
is solution for cr = 30, and the plus signs axe solution for
a = 120.
Figure 5.5: The logarithm of the absolute difference between the exact and numericd solution of KS equation for a! = O at
t = 1.0.
Fiy r e 5.6: Logarithm of the absolute difference between the reference solution (solution obtained using SOCM with 1000
points) of K S equation and solutions using other four
methods at t = 1.0 and a = 13. The line o - O is
the logarthm of the absolute dinerence be tween solution
using SOFDM method and the reference solution, the
dashed line is logarithm of the absolute difference between solution using SOFDM method and the reference
solution, the line + - - + is the logarithm of the absolute
difference between solution using FOCMI method and
the reference solution, and the line O - O is the logarithm of the absolute difference between solution using
FOCM2 method and the reference solution.
Chapter 6
The Cas Dynamics Equation
Because the gas dynamic equation system exhibits most of the features of general
schemes including finite difference methods and the compact methods developed in
Chapter 1.
6.1
Introduction
Over the past few decades there has been considerable interest in models for physical
of codes. This problem represents the next level of complexity after Burgers' equation.
We use various numerical schemes including finite Merence methods and compact
methods in which we use the method of !in=. In using the method of lines, the spacelike independent variables are discretized, while the time variable is kept continuous.
This typically leads to a system of nonlinear ordinary dinerential equations (ODE)
which must be solved along with a set of initial conditions. Since ODE methods apply
equdly well to nonlinear problems, there is no need for linearity in the discretized
spatial de~vatives.To solve the resulting ODE,we use the
viscosity to the system. In the next section, we present the governing equations and
the corresponding initial conditions. In section 3, we discuss the conversion of the
equations suitable for use of the program LSODE,and in section 4 we outline the
various discretization met hods considered. Finally, in section 5, we present a short
discussion and conclusions.
6.2
Formulation
and
where r , m,p, and E denote density, momentum, pressure, and energy per unit volume respectively. These equations represent the conservation of m a s , momentum,
and energy, respectively. For convenience, we write these equations in a vector form
w here
and
We also use the equation of state for an ideal gas to express the interna1 energy
per unit m a s , e, as a function of p and
T.
where y > 1 is the constant ratio of specific heats, taken here as 7 = 1.4, conespond-
Therefore, the governing system includes equations (6.1) , (6.2), (6.3), and (6.9) for
the three independent variables, r , m, and E. We use the following initial and boundary conditions:
If we attempt to convert (6.4) to a f o m for suitable for use of the program LSODE
directly, replacing Uzby the appropriate linear combination of U values as an approximation, we get a system of first order differential equations. When the boundary
conditions are applied, we might be asking LSODE to compute approximate solutions
to initial value problems with discontinuous solutions. This could well be too much to
ask from LSODE.Thus, to make the problem sirnpler, we use the classical technique
of adding artificial viscosity to the hyperbolic system, by adding a term proportional
to
LI,.
rt
m,+
+ rn, = Ar,,,
($+ p )
= hm.,,
z
and
in vector form;
r(-0.5, t ) = 1.0000,
E(-0.5,t ) = 2.5000,
r(O.5, t ) = 0.1250,
and
E(0.5, t) = 0.2500.
(6.22)
It is weiI known that for hyperbolic conservation laws, even smooth initial conditions c m produce solutions which eventudy become discontinuous. Hence when we
speak here of a solution of (6.4), we will mean a weak solution. In [40], Lax proves
6.4
Methods of solution
In the following sections, we describe the numerical methods we used to solve the
problem. Default values of parameters of time integration in LSODE are used (i.e.,
iopt = O). The method of time integration is chosen as the implicit Adams method
with functional iteration (no Jacobian matrix is involved. mf =IO). We took relative
and absolute tolerances equal to IO-^. -411computations are obtained using a Pentium
use central differences for the first and second spatial (x) derivatives. We find the
following systern of ODES for the discretized variables ri, mi, and Ei:
mi- 1
- = -dt
ri-
(Et-1
+ pi-1)
where p is given by equation (6.9). The above equations along with the appropriate
boundary and initial conditions completely define the solutions of (6.19).
6.4.2
mt + s = Au,,
(6.29)
We then use a central difference approximation for the first spatial derivatives to ob-
tain the following system of algebraic equations and first order ODES:
i
["
2h
ri+i
(E*+~
+~
m-1( ~ i - 1 + ~ - i )
--
+ l )
ri- 1
Each time we cal1 LSODE to solve these ODEs, we have to solve five sets of linear
algebraic equations for t., u, s,
2,
and W .
ODEs:
dEi 1
- - -dt
12h
[-
mi-2
ri-2
mi- 1
(E;-* + pi-2) - 8-
ri- i
(Ei-1+ pi-l)
using fewer grid points than the five grid points that a standard fourth order approximations requires. The idea is to approximate (6.19) by two difference equations of
fourth order using only three g i d points, Say x,-1, x,, and zi+i.
In order to derive the appropriate finite difference equations, we first set the derivatives equal to some lunctions [51]:
and
We shall frst derive a relationship between the values of r and u a t the grid points.
This is the first difference equation. In order to obtain the second equation, we start
b evaluating (6.16) at the midpoint. Thus
dr,
- = -Ui
dt
+ ASt,
an expression for S,. If we express r,- and ri+, in Taylor expansions about the point
i, we get
where we have replaced r , with Si. In order to remove the h4ri(4)t e m , we carry out
the same procedure for u and get
q+l
h3
3
h6
+ -ri(6)
(c, t ) .
60
We now substitute the expression for SIinto (6.47) and rearrange. Thus we get, to
fourth order,
We have now replaced the PDE (6.16)by system of IVP (6.46) and (6.49).In a
similar manner, we can derive two IVP for (6.17) and (6.18). If we write ail these
difference equations together, we have the following fourth order compact scheme for
(6.19):
of equations to solve.
m, mz and
%.
r , and r-.
El and E=.
We use the FINDIF Maple package to derive this method. For example, for the first
derivative of m FINDIF gives the following:
where
m= [ _ ] .
m,
w here
and m" is a column matrix sirnilar to ml. Hence, we have to solve equations (6.62)
and (6.63) for n' and
($
+ p),,
and (f
(e
mlf
Now we will develop a new fourth order compact method. We will derive this new
compact method by rnodiqring FOCM2, so we c d it the Fourth Order Compact
*, n - 1, which gives us
a tridiagonal matrix in the system of equations defining first derivatives for interior
points. We would like to preserve tridiagonality at the end points, and indeed we
look for boundary formulae giving the equations
t 58m4 - llm5),
(6.64)
and
Both formulae are 0(h4). If we choose our left-hand boundary formula to be instead,
which is an O(hJ) approximation (whatever c is), then following an idea from 1711,
we can factor the resubing tridiagonal system exactly if c is chosen properly. The
system is
hlL=
If c = 2 + fi,or c = 1/(2
where
+ f i ) ,then Ml
with k = l/c, and D = diag(c, c, . . . ,c). It is curious that the lack of constant diagonal~here is what leads to the exact factorization and consequent efficiency of the
method.
and
(6.67) and (6.68) are darnped. Therefore for c = 2 + f i ,the recurrences (6.67) and
,n - 1, which
gives us a tridiagonal rnatrix in the systern of equations defining one second deriva-
tives at interior points. For boundary points we have the following formulae:
We can factor the resulting tridiagonal system exactly if ci is chosen properly. The
system is
n/12 =
+ 2&).
that this compact method is faster than other two fourth order compact methods.
See Table 6.1.
6.5
Using the six schemes described in the previous section. we canied out numerical experiments to investigate the behaviour of the solution of the Gas Dynamics equation.
We computed the solution at time t = 0.15, the final time for the profiles presented
in the review by Sod [61].From Figures 6.1, we noted that the computed general
behaviour of the density of the gas is the sarne for dl schemes. The same is true for
the velocity, the pressure. and the internai energy of the gas. The time taken by the
various schemes is summarized in the Table 6.1. It is clear that the FOCM3 scheme
talces the least amount of t h e to compute the solution at the given tolerance. A
relatively large number of points are needed by the fourth order methods to resolve
the sharp discontinuity in the solution. The SOFDM2 seems to take the longest time
for computation, perhaps because a large number of function evaluations are needed
for the required accuracy. Figures 6.2 to 6.5 show the graphs of density, velocity,
pressure, and internal energy per unit mass of the gas, respectively.
6.6
Conclusions
14
**
II
*.
4a
Fiope 6.1: Plot of the density of the gas obtained using (a) SOFDM
method ( b ) SOFDM2 method (c) FOFDM method
(d) FOCMl method ( e ) FOCM2 method (f) FOCM3
method at t = 0.15.
Method
SOFDM
1000
154.6
FOCMZ
Chapter 7
Moving Mesh Methods
In this chapter, we reviea the development of some moving mesh methods for partial
differential equations. and apply them to the gas dynamics equation with artificial viscosity. To do this. we use an approach based on the equidistribution principle, which
tends to distribute the solution error equally over the domain subintervals. In order to
demonstrate the implementation of the met hod, we will revisit the one-dimensionai
gas equation that was studied in the previous chapter. It will be confirmed that
the moving mesh method is considerably more efficient than the traditional uniform
rnesh.
7.1
Introduction
The efficiency of a numerical algorithm for solving a class of problerns can be critically
affected by its cornputer implementation. Adaptive mesh methods are much more
efficient than uniform mesh methods for solving time-dependent partial differentiai
equations with large gradients such as shock waves, propagated b o u n d q layers, etc.
(e.g., see [26]). There are three common approaches for adaptive mesh methods:
1. The h-refinement methods, which add or delete mesh points according to the
profile of the solution and control the mesh points by the estimated local errors
of the solution.
2. The prefinement methods, which alter the order of the numerical method to fit
the local solution characteristics.
3. The rnoving mesh methods, in which a fixed number of mesh points move automatically to rninimize the estimated errors of the solution.
Here some moving mesh partial differential equations (MMPDEs) are derived for
solving one-dimensional initial =lue problems.
7.2
respectively, whose domains are assumed to be the i n t e n d [O, 11, then a one-t*one
coordinate transformation between these domains can be written as:
where t denotes time. For a given uniform mesh on the computational domain,
{xa, 31,.
.,xn}.
(7.3)
Thus on this computational mesh, the values of any arbitrary function f can be writ-
ten as
To develop the moving mesh method we use an approach which is directly based on
the EP. The EP, which was first introduced by de Boor [9] for solving BVPs for ODES,
is based upon the simple idea that if some measure of the enor bI(x,t) (monitor
function) is available, then we select the mesh points n : O = xo < X I < . . . < xn-
< xn = 1
such that the contributions to the solution error over each subintenml are equalized
(or "distributed equallp"). illathemati~ally~
the goal of finding moving meshes
w here
cl we obtain
[, we obtain
These are two differential forms of the EP (7.8). Since none of the three EPs given by
equations (7.8), (7.10),and (7.11) contain the node speed x ( C , t ) ,they will be called
quasi-static equidistribution principles (QSEPs) [31!.
Here are some examples of rnonitor functions commonly used:
1. -4rc length:
M ( z , t ) = (1 +
2. Local truncation error:
M ( z , t ) = (1+ (urrt )2 ) q
3. Singlestep error:
M ( z , t ) = (1 + (uttt)2)a'
7.3 Moving Mesh Partial Differential Equation
(MMPDEs)
In this section, we will review the derivation MMPDEs from QSEPs. Hereafter, we
Here 2 denotes
g ~ ~Now, differentiate
~ ~ ~ (7.12)
. with respect to C to get the follow-
ing equation:
Now differentiate (7.10).the differential form of the EP w.r.t. time [54, 551 to obtain.
To derive MMPDE from the differential form of the EP (7.11), write (7.11) at a later
time t + T (O 5 r
1)
We can regard (7.17) as a condition to regularize the mesh rnovement. Using the
expansions
~lf(z(C
t +, r ) ,t
+ 7) =
M ( z ( ( ,t ) , t ) + r i a z M ( x ( [ ,t ) ,t ) +
T at
- M ( x ( < , t ) .t ) + O(?)
in (7.14), we obtain
(7.18)
The MMPDE (7.19) contains the term - $ - & ( M g ) , which measures how closely
the mesh z(<, t ) satisfies the QSEP. When x(<,t) is not equidistributed, then the
MMPDE given by equation (7.19) moves the mesh toward equidistribution even when
culate, is a relatively unimportant term. Therefore one can argue that it is reasonable
to drop the term
aTx
"* or both
and
simplified MMPDE
"
sT and x-
-S&(M$),
In this section, we shall review some moving mesh methods based on attraction and
repulsion pseudo-forces between nodes [31]. A node attracts others when a measure
of the truncation error at this point is larger than average. If the measure is smaller
than average, the neighboring nodes are repelled. Methods considered here compute
node speed in response to deviation in an error rneasure from some average value. An
error measure. denote by IV, is generally related to some error function. In particular,
the error measure is usually expressed by
although the function iZ.I here may be slightly different from that in (7.23). This may
be motivated, e.g., by taking a simple approximation for (7.23) such as the midpoint
rule,
The error functions are often chosen to be proportional to the first and/or second
derivatives of the physical solutions. Probably the most common choices in practice
are the arc-length and curvature monitor hinction. In [4], Anderson computes the
node speed by
the nodes towards regions where the error is large. It also forces the mesh to have
zero speed whenever the mesh is equidistributed.
and
~t-tl
- Wi-1).
Denote X by !:
7.5
We now give a cornplete description of the moving mesh method. Consider a timedependent problem of the Form
subject to appropriate boundary and initial conditions, where f represents a differential operator invoiving only spatial derivatives. Using the coordinate transformation
(.l),(7.32) can be rewritten in quasi-Lagangian form
We follow [30] in the choice of discretization for u,, but we note that other choices
are possible (upwinding, or compact methods), and it is not clear which is best. Next,
discretizing by using a central difference scheme for the spatial derivatives, we obtain
where
For a given monitor function M ( z , t), we have to solve the coupled system of
equations (7.34), one of the moving mesh partial difFerentia1 equations (MMPDEs),
and the corresponding boundary and initial conditions for the mesh x and solution
u. We use the method of lines (MOL) [3] to conven PDEs into a system of ordinary differential equations (ODES)and solve the system of (ODES) using a double
precision version of the ODE solver LSODI.(281
We now give a more complete description of the moving mesh method by considering
a simple exarnple, the one-dimensional gas dynarnics equations.
Method
To apply a moving mesh method, we have to write the gas dyuaruics equations with
artificial viscosity (6.19) as
w here
G = Au;, - [F(U)1,7
the vector
(7.36)
difference approximations for first and second derivatives on a moving grid are given
b~
We now use the transformation (7.1) to write (7.35)in the quasi-lagrangian form
recomrnends using arc length [58]. Here we also choose M to be the arc length monitor function
We will present r
d t s of
hIMPDE5 i.e. (7.22) in space with centered finite differences on the uniform mesh
(7.2) and use the method of lines. We have the following discrete approximation of
bIMPDE5:
where
IV here
where 7 > O is the smoothing parameter, and j, a nonnegative integer, is the smoothing index. The summation is understood to contain only elements with indices between zero and n. Thus we see that we have reduced the problem to solving two sets
of equations (7.38) and (7.40). The initial condit,ions for xi is a uniform mesh, i.e.
x(O)=O
and
i-(n)=O.
(7.48)
.As we mentioned before, the systems of ODESare solved using the double precision
version of the ODE solver LSODI [28]. For our calculation we assume a relative and
absolute tolerance of IO-?
pararneters
r),
p, and r we have chosen the following values since they give the most
accurate result:
r,~= 2,
c. c.
r.c
P=%
and
= IO-^.
Results
Thc problem
(7.22)
with n = 100 at t = 0.15. The results are compared with a reference solution (dashed
lines in the figures) obtained by LSODI,using the method of lines with standard
central differences on (6.19) and 1000 equdly spaced rnesh points, with absolute and
relative tolerances IO-? As we can see in the figure, the moving mesh method gives
results similar to the standard uniform mesh method even though the number of
points used in the moving mesh method is an order of magnitude smaller than that
used for the regular rnesh. Although the numerical experiment is carried out only for
the gas dynarnics equation, Our result strongiy indicates that the moving mesh met hod
is generally better than the standard uniform mesh methods. Other experiments on
the parameters
77,
p, and
for these parameten. Other moving rnesh formulations have also been considered.
However. the best results were obtained using the moving mesh method described in
t his chapter.
7.8
Conclusions
In this chapter, we rederived the moving mesh partial dBerential equations for one
dimensionai initial value problerns. The derivation is based on the Equidistribution Principle, and the implementation is demonstrated by considering the onedimensional gas equation that was discussed in the previous chapter. It is c o n h e d
that the moving mesh method yields equally accurate results as the uniform me&
Although al1 the results in this chapter are well known (see [30]),we intended this
as a useful summary for our intended future work of combing compact methods with
moving meshes.
Figure 7.1: Plots of density of the gas at t = 0.15. The diamond signs
are the solution obtained using MMPDE5. The dashed
line is the solution obtained using uniform mesh.
-0.4
-0.2
0.2
0.4
Figure 7.4: Plots of intemal energy of the gas t = 0.15. The diamond
signs are the solution obtained using MMPDE5. The
dashed Line is the solution obtained using uniform mesh.
Chapter 8
Future Work
The method of modified equations was derived in Chapter 3 was applied to partial
differential equations in one space dimension. It would be of interest to extend this
work to twvo and three space dimensions and see what additionai information, both
qualitative and quantitative, we can obtain about the properties of different numerical
schemes. The deveiopment of a Mapie progam to derive these modified equations
autornatically for a given ordinary or partial equation and a prescribed numerical
procedure would be interesting.
The compact finite difference methods and moving mesh methods that we have
derived. look very promising but have not been applied to enough different problems
that we can conclude that they are really useful and can be considered an improvement on standard methods. -4 systematic study of the applicability of them to a
large number of different problems, both iinear and nonlinear, should be carried out.
of a certain accuracy, more equations must be solved, so it is not clear that will
necessarily be faster than second order methods.
4. How useful are these methods for problems modcled by a system of diffusive-
Extensions to two and three space dimensions would also be of interest. We used
only a simple monitor function based on arc length. In many problems it might be
more interesting and useful to include the curvature in the monitor function.
The development of compact methods For a system of partial differential equations
is quite tedious, so it would be useful to study the application of a computer algebra
systern. such as Maple, to derive the numerical formulae for a given problem and
produce the relevant Fortran or C++ code.
Appendix .4
von Neumann Stability .4nalysis
In this appendix, we will discuss Fourier or von Neumann method for stability analysis
for the difference schemes used in Chapter 3.
A.1
The upwind scheme of the equation (3.3) is given by the following equation:
where v =
e.In
where I =
ak is a real
wave number,
w here
VCOSP)*
+ (-usinp)*li
is plotted in Fiy r e A.1 for several values of u. It is clear from this plot that u must be
less than or equd to 1 if the von Neumann stability condition JGJ5 1 is to be met.
The amplification factor, equation (A.3), can ais0 be expressed in the exponential
form for a cornplex number
The phase angle for the exact solution of the convection equation (de) is deterrnined in a similar manner once the amplification factor is known. In order to find
the exact amplification factor, we substitute the eiementd solution
into the equation (3.3) and find that a = -Ikc, which gives
which reduces to
where
and
The relative phase shift error after one time step is given by
and plotted in Figure A.2 for several values of v . For small wave numbers (Le., small
If the relative phase error exceeds 1 for a given value of P, the corresponding Fourier
component of the numerical solution has a wave speed geater than the exact solution.
This is a leading phase error. If the relative phase error is less than 1, the wave speed
of the numerical solution is less than the exact wave speed. This is a lagging phase
error. The upsind differencing method has a leading phase error for 0.5
A .
1' '
is plotted in Figure A.3 for several values of u. It is clear hom this plot that u must
-,Op
The Lax-Wendroff differencing method has a predominantly lagging phase error ex-
< v < 1.
To find G, substituting equation (A.2) into Equation (A.lO) and simplifying, we get
G = 1+2r(cosp- 1 ) ,
(A.11)
-1 5 1 + 2 r ( c o s B - 1) 5 1.
The upper limit is aiways satisfied for r 2 1, because (cos 4 - 1) varies between -2
and O as b ranges from -00 to m. For the lower limit
implies
&
7-
S (1 - cos 8) -
into
which reduces to
(A. 12)
Hence, the amplitude of the exact solution decreases by the factor erB2 dunng
one time step, assuming no boundary condition influence. The amplification factor
(.4.11)
is plotted in Figure A.4 for two
FTCS (3.37)
i.
d 4 t (fzl
(fs'
- 12')
=- 2f:+' + fz':')
2 Ax
Arc2
1cAt
- f: + --
(A. 13)
To find G.we substitute equation jA.2) in equation (A.13) and simplify to get
Since 1 - cos$ 2 O for al1 values of ,O, IGI 5 1 for ail values of v and r. Thus the
mond signs are the graph of IGI (A.4) for u = 0.75, the
dashed line is the gaph of IGl (A.4) for v = 1.0, and the
plus signs are the graph of (GI (A.4) for = 1.25.
Figure A.2: Relative phase error of upwind scheme. The solid iine is
the graph of @/4=(A.5) for u = 0.25, the diamond signs
are the g a p h of q5/q5= (A.5) for u = 0.5, the dashed line
is the g a p h of 4/ge (A.5) for u = 1.0, and the plus signs
are the graph of 4/& (A.5) for v = 0.75,
.+....
+.*-
. . . O
f...-...-..
0.5
1.5
Beta
2.5
Figure -4.4:Amplification factor rnodulus for FTCS scheme. The diamond signs are the graph of G (-4.11) for T = 116,the
solid line is the graph 1G.l (A.12) for r = 116,the plus
signs are the graph of G (A.11) for r = 112, and the
dashed line is the graph (Gel(A.12) for r = 1/2.
3.5
Appendix B
Maple Programs for MDEs
In this appendix we give the fint version of a Maple prograrn for modified equations.
1
is included here because it is the one that is actudly used in this thesis.
> D(h) := 0;
# h
is constant.
D ( h ) :=O
# t is
The equation is
f := ( t a u ) -> v-2;
By equating truncation errors (Griffiths & Sanz-Serna, p. 998),we get the follow-
w f ( t )= (w(t
+ h ) - w ( t ) ) / h- C d k ) ( t ) h ( ' - ' ) / k !
k=2
linear system.
Now replace al1 t hose higher derivat ives.
> for k from 2 to n do
W.
k := convert ( s e r i e s (D ( W(k-1)
.
Now we must substitute until w.k contains only w and Db)(w) for j
>
> kW
od;
>
od;
>
u - k := collect(u.k,h,factor) :
terms.
>
>
v . j := convert(series(subs((DPOk)(w)~.k,u.j),h,Order-(j-l)),polyn~m):
>
w.j := collect(v.j,h,factor):
>
od ;
> od;
--
8.2
Here we give the Maple program for the method of modified equations for y'' + y = O
by the classical Euler's method. To find a rnodified equation for any second order
ODE,we have to change the definition of matrices A and lu below and/or change the
method.
h is constant.
D( t ) := 1
> vith(1inalg) :
Warning: new definition for
Warning: new definition for
nom
trace
The equation is
yM+y=0
respect to.
- u)*(l/h) - SI;
We eliminate the higher-order terms by differentiation, and solution of the resulting linear system.
> u:=array[l. . n , l . .2J:
> for m from 1 to 2 do
>
> od:
w [l
,ml :=eval(ul Cm, 11 ;
>
od;
> k.
>
for 1 from 1 to 2 do
>
>
>
>
od;
>
>
od;
>
u[k,i] :=eval(w[k,l3);
>
w[k,21 :=eval(uCkD21);
od:
>
>
od:
od:
a2
modeqv :=
>
>
>
>
CwC1,2]~1);
Following is the Maple progam for the method of modified equations for ft+cf, = O
by Lau-Wendroff method. To
D[l](f) i.e derivative of f w.r.t. t. If there is second derivative with respect z in the
given PDE,then in the defination of u ,the coefficient of second order derivative term
say c is multiplied by ht.
> h[t]:=(t,x)->h[t]:
# h-t
is constant. I t is delta t.
ht := ( t , z )
> h[x] :=(t ,x)->h[x]
-+ hl
h, := ( t J ) + h,
# t
t := ( t J ) 3 t
#
x := ( t , x ) + x
# c
is constant.
>
The equation is
f;"
+ c2J$/(2h;)(.f"+i - 2 * I; + fj-l);
and s2 is f&, .
1-c2*h[t]a2*(sl-2*f+s2)/(2*h[x] -2) :
fi;
od ;
od ;
od ;
f o r r from p to 2 do
W . (k+(a-2)*p+(n-3)*j-(j-l)*(j-2)*1/2-(2*n-5)
.(k+r+(n-2)*p+(n-3)*j-(j-l)*(j-2)*1/2=(2*n-3)
. (k+(n-2)*p+(n-3)*j-(j-l)*(j-2)*1/2-(2*n-S)) :=
convert (mtaylor(subs( (D Cl1 Wk-(r+p+j -3) 1) ( (D L21Wk+p+j-3) ( f )
v . r . k . (p+j-1) , W . (k+r+(n-3)*p+(n-3)*j-(j-1)*(~-2)*1/2-(2*n-4))
.(k+(n-~!*p+(n-3)*j-(j-l)*(j-2)*1/2-(2*n-4}
.(k+r+(n-3)*p+(n-3)+j-(j-l)s(jw2)*1/2-(2*n-4)))
,[h [tl ,h l x ] ,Order) ,polynom) ;
f o r m f r o m 1 t o (n-1) do
for s from 1 t o 2 do
if n<=5 then
q:=O:
else
for q from O to (11-51 do
>
>
>
>
>
>
>
>
>
>
>
>
>
od ;
fi;
od ;
od;
od ;
od ;
od ;
else
p:=2:
1:=2:
r:=2:
for k from p+j to n do
for s from 1 to 2 do
if n<=5 then
q:=o:
z:=o:
else
for q from O t o (11-51 do
od ;
od ;
fi;
od ;
od ;
u. (k+(n-2)*p+(n-3)*j-(j-l)*(j-2)*1/2-(2*n-5))
. (k+r+(n-2)*p+(a-3)*~-( j-1)*( j-2)*1/2-(2*n-3)
.(k+(n-2)*p+(n-3)*j-(j-1)*(j-2)*1/2-(2*n-S)
:=
convert (mtaylor(subs ( (DCl] @~(k-(r+p+j-3)1) ((D[2]@P(r+p+j-3)
w.r.k. (p+j-1) , W . (k+r+(n-3)*p+(n-3)*j-(j-l)*(j-2)*1/2-(2*n-4))
.(k+(n-2)*p+(n-3)*j-(j-l)*(j-2)*1/2-(2*n-4))
.(k+r+(n-3)*p+(n-3)*j-(j-l)*(j-2)*1/2-(2*n-4)))
,Eh Ctl ,h [XI
1 ,Order) ,polynom);
for m from 1 to (n-1) do
for s from 1 t o 2 do
if n<=S then
q:=O:
else
for q from O to (n-5) do
(f )=
od;
fi;
od:
> vl:=simplify("):
> f o r q from 2 t o n do
> v.q:=coilect (v. (q-1) ,(DC21aQq)( f 1) :
> od:
Appendix C
Sixth-Order Formula for u,,
This worksheet explores the use of the Share Library Package FINDIF to generate a
high-order accurate compact finite difference formula for the second derivative of a
function aven on a uniform grid.
W e now set up the pentadiagonal stencil and mask for a high-order
formula for
We create compact formulas by telling FINDIF that we know the values of f and f"
at al1 points except the centre, where we know only f.
> mask := CCO,21,CO,21,COI,C0,21,10,211;
,") ;
1 I
simple := -
We want a simple formula, and setting the Free parameter to zero gives us a simple
sixth-order formula, namely
> (DQQ2)(f1(O) = simple Cl]
":
CVe modify this so we may factor T exactly (we have to construct special formulas
for the first row and the 1 s t row, anyway, so we might as well do so in a way that
>
L := matrix(5,5,0):
2 , @ + a 2= I I }
,p = R O O ~ O
-z4
~ (+ 4 - 11-z2) j
That is, if we choose 0 to be one of the four roots of chat quartic, and then a to
For stability reasons, we choose cr to be the larger one. We may as well choose the
positive root (it makes no difference). It is easy to see that this value of alpha and
beta will do to factorize T regardless of its dimension.
> alpha := alphas [31 ;
C :=
'cj:
> d i f exp-left
:= c* (DQ12)Cf) (0)+2*(DQQ2)
(f) (h) ;
d z f e q d e f t := C D ( ~f) )(( O ) + 2 ~ ( * ) ( / ) ( h )
>
Now the right edge. The mask remains the same, but we change the stencil.
> rightedge := b e q ( [(k-?)*hl ,k=l.-811 ;
>
>
REFERENCES
Mohammad O. Ahmed and Robert M. Corless. The method of modified equations in Maple. In Electronic Pmceedings 3rd International IMA CS conference
on Applications of Cornputer Algebra, 1997.
[3] W. F . Ames. Numerical Methods /or Partial Diflerential Equations. Academic,
York, 1984.
[6] D . .4rmbruster, J. Guckenheimer, and P. Holmes. Kuramoto-Sivashinsky dy-
October 1974.
[14] Robert M. Corless. Maple program for method of modified equations. Private
communzcata'on, 1993.
[El Robert M. Corless. Error backward. In Contempomry Mathematics, edited by
Peter Kloeden and Ken Pdmer, volume 172, pages 31-62. American Mathematical Society, 1994.
[16] Robert M. Corless. An elementary solution of a minimax problern arising in
formulae. In ICIAM
/ GAMM795, ~WwnericalAnolysis,
Scientific Computing,
Cornputer Science, Hambvrg July 3-7, 1995, volume 76, pages 381-382, 1996.
(191 J. E. Flaherty, J. M. Coyle, R. Ludwig, and S. F. Davis. Adaptive finite element
1964.
[22] D. Gottlieb, L. Lustman, and S. Orzag. Spectral calculations of one-dimensional
(251 Ernst Hairer, Syvert P. Norsett, and Gerhard Wanner. Solving Ordznary Differentzal Equations, volume 1. Number 8 in Computational Mathematics. Springer-
(261 D. F. Hawken, J. J. Gottlieb, and J. S. Hansen. Review of some adaptive nodemovement techniques in finite element and finite difference solutions of
PDEs.
[?BI
.A.
[31]W. Huang, Y. Ren, and R. D. Russell. Moving mesh partial differential equations
[34] J.G. H p a n ,
292, 1986.
[35] J.
O/
[40]P. D.Lay. Weak solutions of nonlinear hyperbolic equations and their numericd
computation. Communications on Pvre and Applied Mathematics, 7:159-193,
1954.
[dl] P. D.
Pmctzccl Ap-
Physica
D,12:391-395, 1984.
D, 16:153-183. 1985.
[49]F. MT.J. Olver. Introduction to Asymptotics and Special Functions. Academic,
?iew York, 1974.
Dyke, vol-
1996.
[53] L. R. Petzold. A description of DASSL: A differential/algebric system solver.
SAND82-8637, Sandia Labs., Livemore, Cal., 1982.
[54]
Y. Ren. Ph.D Thesis. Theory and compvtataon of moving mesh methodi for
solving tirne-dependent partial differential epuations. Simon Fraser University,
1992.
[55] Y. Ren and R. D. Russell. Moving mesh techniques based upon equidistribution.
[56] R. D. Richtmyer and K. W. Morton. Difference Methods for Initial- Value Problems. John Wiley & Sons, New York, 1967.
[57] P. J. Roache. Comput~tiondFluzd Dynamics. Hermosa Publishers, Albuqerque,
1972.
[66]R. F. Wanning and B. J. Hyett. The modiiied equation approach to the stabity
and accuracy of Bnite merence methods. J. Cornput. Phys., l 4 : 1 5 H 79, 1974.
[67]W.Wasow. Asymptotic Expansions for Ordinary D2&rentiaf Equations. Interscience Pub. (John Wiley), New York, 1965.
[68]
[71]W. M. Yan and K. L. Chung. -4 fast algorithm for solving special tridiagonal
systerns. Compuling, ZX?O3-2ll, 1994.
IMAGE EVALUATION
TEST TARGET (QA-3)
APPLIED 4 IMAGE.lnc
=
---:
,
=
=Fex: 716128&5989