\documentstyle[12pt,utdiss]{report}
%\documentstyle[utdiss3]{report}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% \setlength{\unitlength}{0.0125in}%:used for pictures
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\II{I\!I}
\def\tableline{\noalign{\vskip2pt\hrule\vskip2pt}}
\input{psfig}
\begin{document}
\newcommand{\HALF}{ \frac{1}{2} }
\newcommand{\TWELTH}{ \frac{1}{12} }
\newcommand{\REST}{ I^H_h }
\newcommand{\PRO}{ I^h_H }
\newcommand{\QUARTER}{ \frac{1}{4}}
\newcommand{\PREF}{\hbox{{\tt pref}}}
\newcommand{\PSTF}{\hbox{{\tt pstf}}}
\newcommand{\PRE}{\hbox{{\tt pre}}}
\newcommand{\PST}{\hbox{\tt pst}}
\newcommand{\BSWEEPS}{\hbox{\tt bsweeps}}
\newcommand{\LMAX }{l_{{\rm max}}} 
\newcommand{\LMID }{l_{{\rm mid}}} 
\newcommand{\LONE}{{{\ell}_1}}
\newcommand{\LTWO}{{{\ell}_2}}
\newcommand{\lb}{\left(}
\newcommand{\rb}{\right)}
\newcommand{\lc}{\bigl(}
\newcommand{\rc}{\bigl)}
\newcommand{\Lc}{\Bigl(}
\newcommand{\Rc}{\Bigl)}
\newcommand{\lC}{\biggl(}
\newcommand{\rC}{\biggl)}
\newcommand{\LC}{\biggl(}
\newcommand{\RC}{\biggl)}
\newcommand{\tabspace}{0.5cm}
\newcommand{\T}{\hspace*{\tabspace}}
\newcommand{\CYCLE}{\hbox{{\tt cycle}}}
\newcommand{\LCOARSE }{l_{\rm coarse}} 
\newcommand{\IF}{\hbox{{\tt IF}}}
\newcommand{\DO}{\hbox{{\tt  DO}}}
\newcommand{\ENDDO}{\hbox{{\tt  END DO}}}
\newcommand{\ENDIF}{\hbox{{\tt END IF}}}
\newcommand{\THEN}{\hbox{{\tt THEN}}}
\newcommand{\ELSE}{\hbox{{\tt ELSE}}}
\newcommand{\CASE}{\hbox{\tt CASE}}
\newcommand{\OR}{\hbox{{\tt OR}}}
\newcommand{\TRUE}{\hbox{{ \tt TRUE}}}
\newcommand{\FALSE}{\hbox{{\tt FALSE}}}
\newcommand{\NOT}{\hbox{{\tt NOT}}}
\newcommand{\AND}{\hbox{{ \tt AND}}}
\newcommand{\ABS}{\hbox{{\tt ABS}}}
\newcommand{\MOD}{\hbox{{\tt MOD}}}
\newcommand{\NCYC}{\hbox{{\tt ncyc}}}
\newcommand{\LEVEL}{\hbox{l}}
\newcommand{\TAUMAX}{\tau_{\rm max}}
\newcommand{\CHAR}{\hbox{{\tt char}}}
\newcommand{\CLUSTER}{\hbox{{\tt CLUSTER}}}
\newcommand{\GMIN}{\hbox{{\tt gmin}}}
\newcommand{\GMAX}{\hbox{{\tt gmax}}}
\newcommand{\XMAX}{x_{\rm max}}
\newcommand{\YMAX}{y_{\rm max}}
\newcommand{\XMIN}{x_{\rm min}}
\newcommand{\YMIN}{y_{\rm min}}
\newcommand{\GRIDS}{\hbox{{\tt grids}}}
\newcommand{\JMAX}{J_{\rm max}}
\newcommand{\NG}{\hbox{{\tt ng}}}
\newcommand{\NF}{\hbox{{\tt nf}}}
\newcommand{\GRID}{\hbox{{\tt g}}}
\newcommand{\Q}{\hbox{{\tt q}}}
\newcommand{\LHEAD}{\hbox{{\tt lhead}}}
\newcommand{\GPP}{\hbox{{\tt gpp}}}
\newcommand{\GPNGH}{\hbox{{\tt gpngh}}}
\newcommand{\GPSIB}{\hbox{{\tt gpsib}}}
\newcommand{\GPCH}{\hbox{{\tt gpch}}}
\newcommand{\UNDEF}{\hbox{{\tt UNDEF }}}
\newcommand{\PP}{\hbox{{\tt P}}}
\newcommand{\GOTO}{\hbox{{\tt GOTO}}}
\newcommand{\JMIN}{j_{\rm min}} 
\newcommand{\JMINC}{J_{\rm min}} 
\newcommand{\SFJ} {\varrho}
\newcommand{\SFK} {\vartheta} 
\newcommand{\CJ} {\kappa} 
\newcommand{\CK} {\lambda} 
\newcommand{\PIL} {n_{\rm P}}
\newcommand{\XB} {\imath}
\newcommand{\YB} {\jmath} 
\newcommand{\LISTX} {\hbox{X}}
\newcommand{\LISTY} {\hbox{Y}}
\newcommand{\THETA} {\theta}
\newcommand{\THETAONER} {\theta_{\rm 1r }}
\newcommand{\THETATWOR} {\theta_{\rm 2r }}
\newcommand{\THETAONEP} {\theta_{\rm 1p }}
\newcommand{\THETATWOP} {\theta_{\rm 2p }}
\newcommand{\ORDER} {\hbox{\tt order}}

\title{Numerical techniques for the Initial\\ Value Problem for two black holes}\supervisor{Richard A. Matzner}
\author{Scott Alan Klasky}
\previousdegrees{B.S.}
\degree{DOCTOR OF PHILOSOPHY}
\address{10926 Jollyville Rd. \\
         Austin, TX 78759 \\
         U.S.A }
\graduationmonth{December}
\graduationyear{1994}

\copyrightpage
\titlepage
%\signaturepage

\begin{dedication}
To my parents Charles and Mary Klasky, and my fianc\'{e} Jennifer \\
for all their love, encouragement and support.
\end{dedication}

\acknowledgements
I wish to thank Matt Choptuik for all the help and  support that he has 
given to me.  I think that Matt helped and encouraged me more than anyone
else that I have met.  This dissertation is more or less a continuation of Matt's
Masters thesis.  Matt's guidance is in some sense {\em unprecedented}.
Throughout the years of working on the 
projects for this dissertation, Matt's advice was
usually correct, and always there.  Matt even spent the better half of his
European  trip correcting the many mistakes in this dissertation, 
I would recommend him to any interested student!

I would of course like to thank my advisor, Richard Matzner, 
who was always there to help me.  It was Richard who convinced me to stay
a graduate student, when I was about to give up.  I would also highly
recommend Richard as an advisor.

I would also like to thank many others who have all helped me
get through this, although not nearly in the extent of Matt's help. 
First I would like to thank Jennifer, who has constantly encouraged me
to work hard.  I would then like to thank my parents who have constantly 
supported me, both emotionally and financially. 
 
I would then like to thank my brother for constant encouragement through
my college years. I also thank Jennifer's parents, Doyle and Sonja, who
welcomed me into their family, and made Texas feel like home for me.

I also thank Armondo Colorado  for all his ``training''.
Armondo taught me how to concentrate on the problems that I was facing.
He is also the one who got me to lift weights that were three times
my body weight.  I would also like to thank Reid Guenther for being
my best friend, and for being a constant factor in ensuring my happiness 
here at U.T.~~I also want to thank Peter Anninos who has also been
a good role model, and friend for me.  Pete helped me many times, and
has always been there for me. 

Next I would like to thank Mijan Huq would helped me out with many computer
problems.   Mijan was also a great ``guinea pig''  for reading
this dissertation. Don Salisbury was also great help in proof reading 
reading sections of this dissertation.
Doug Cline was also a great help in gaining my interest in massively
parallel computing.
I also want to thank Jan Duffy for all the help she has given
me through the years to help get through all the paper work associated
with being a graduate student.  I would also like to thank Robert Harkness
for teaching me about the Cray's architecture, and helping me
proof read multiple copies of this dissertation.  He helped me with many
of the projects, especially with vectorizing some of the codes. 

I would especially like to thank Joan Centrella for introducing me to 
the field of numerical relativity.  Through her support and guidance,
I became a graduate student under Richard. 
%**************************************************************************
\cleardoublepage
%**************************************************************************
\abstract
I investigate numerical algorithms to solve the
initial value problem for two black holes. We study black hole collisions
for three main reasons.  First, black hole collisions
should be efficient generators of gravitational radiation and are prime
candidates for detection
by gravitational wave observatories. Second,
black holes are the ``point masses'' of general 
relativity,  making  studies of their interactions as relevant as the
Kepler problem is to Newtonian gravity. 
Thus, there is a high probability that
we may discover new information concerning the gravitational interaction.
Third, this is a difficult problem for numerical 
relativists and an apparently impossible problem without a numerical approach.
A major goal of numerical relativists is to compute ``general''
solutions to the Einstein equations, and the ability to solve the
black hole problem will take us much closer to this goal.
Analytical solutions to the Einstein equations are unavailable for
strong-field and highly time-dependent regimes.
These equations are a set of non-linear,
 coupled, hyperbolic,  and elliptic PDE's, which must be solved
numerically.
I use the space-plus-time approach which separates the
problem into an initial value problem and an evolution problem
to generate future (or past) data.

In this dissertation I solve 
one of the initial value (constraint) equations
using finite differencing in Cartesian coordinates.
This coordinate system allows for
multiple black holes and contains no coordinate singularities.
One of my major goals was to
overcome the difficulties associated with using this coordinate system,
since the coordinate
surfaces are not coincident with the domain boundaries.

This dissertation is mainly concerned with discovering and eliminating
deficiencies of my first
code written to solve the Hamiltonian constraint equation.
In doing so I have found several empirical
schemes  to generate extrapolatable solutions, 
needed to provide extremely
accurate initial data for wave prediction.
In particular I develop extensions to 
Multi Level Adaptive Techniques
to generate extrapolatable results.

With these new techniques I will be able to create 
``general'' solutions to the black hole initial value problem 
to a specifiable accuracy.
These techniques will be of substantial importance in evolving black hole
collisions
to prepare a library of expected gravitational radiation waveforms.

%**************************************************************************
\cleardoublepage
%**************************************************************************
\tableofcontents
%**************************************************************************
\cleardoublepage
%**************************************************************************
\listoftables
%**************************************************************************
\cleardoublepage
%**************************************************************************
\listoffigures
%**************************************************************************
\cleardoublepage
%**************************************************************************

\chapter[Introduction] {Introduction}
\section [General overview] {General overview}
\label{General-Overview}
Einstein's general theory of relativity is perhaps the most elegant
theory in all of physics.  Proposed in 1915 by Albert Einstein, it has
forever changed our understanding of the nature of gravity
and how it shapes 
our universe.  The beauty of this theory is that it links gravity with
space and time, in which the curvature of space-time is a direct
consequence of gravity.  Many predictions from this theory have been
experimentally verified to better than one percent
\cite{Wald}\cite{Weinberg}.   The classical tests of general 
relativity, 
namely the deflection and time delay of light and the 
perihelion 
shift of Mercury, 
test only the weak-field and stationary features of the 
theory. 
Even the binary pulsar PSR 1913+16 is not a test of general relativity
in a fully dynamical field regime, but we are able to indirectly  observe
gravitational waves from it.
There are, however, no direct  
theoretical 
experimental tests of the dynamical strong-field limits of general relativity.
The direct detection of gravitational radiation will provide the means
to more fully 
test Einstein's theory, and will eliminate   
skepticism of Einstein's theory that persists because we still 
have not 
been able to detect gravity waves.
From a theoretical point of view, the 
details of 
gravitational waveforms can be used as an additional test for general 
relativity and 
other alternative theories of gravitation.    

For more than 30 years, experimentalists have been working on 
gravitational antennas, but there has been no detection to date. 
The latest generation of detectors use Fabret-Perot 
interferometers, the largest of which will be known together as the 
Large scale Interferometer Gravity 
wave Observatory(LIGO). LIGO is designed to be sensitive enough to have a high 
probability 
of detecting gravitational waves emitted by the last few minutes of neutron
stars or black hole infall.
As discussed by Thorne \cite{Thorne}, the most obvious 
candidate for source of gravitational radiation  is 
the collision of two black holes.  This type 
of event 
should be the most astrophysically ``clean'' source for gravitational 
signals.  The strongest  gravitational wave production should arise from 
non-head on collisions, a fully three dimensional situation,
 and a 
very difficult one to model, requiring 
advanced numerical
techniques. This dissertation deals with some of these techniques which we
believe will aid in the quest of modeling general relativity in fully
three dimensional situations.

When dealing with numerical computations in physics, we are faced with 
the dilemma of choosing
between accuracy of the solution and available computational resources 
( {\sl i.e.}  CPU time and memory). 
This is because,  in general, when we model the equations on the computer,
 we discretize the system onto some mesh, via finite differencing,
finite elements, or finite volume.  The finer meshes generate more accurate
results, but use more CPU time and more memory.  Since we are limited in
CPU time and memory, we can only discretize the system to some degree which
will limit the accuracy of the solution. 
Complex problems which model three spatial dimensions use tremendous amounts
of computer memory and time, and therefore must use 
efficient algorithms and powerful supercomputers.
The goal of this dissertation is to develop algorithms  which are optimally
efficient, where the amount of 
computational work is proportional to the amount of real physical
change in the computed systems.
This is what Achi Brandt terms his ``golden'' rule\cite{Brandt1982} .

In order to deal with very large high performance computers, we must deal with
the issue of parallelization.  
Today's supercomputers are no longer single CPU's, but rather massively parallel
systems with numerous CPU's.
\footnote{  As of today, the largest MIMD machine is over 1800 CPU's on a 
Intel Paragon at Sandia Laboratory}  This issue of parallelization further 
complicates the development of 
computer codes, since we must worry about scalability; {\it i.e.} 
we want a code to run twice as fast if we use twice the 
number of processors.  

\section[Evolving black holes] {Evolving black holes}
\label{Evolving-black-holes}
The pursuit of numerical solutions to Einstein's equations first 
began in the 1960's when spherical collapse problems were carried out 
by May and White (1966),and others.  Hahn and Lindquist 
\cite{Hahn_Lindquist} (1964) attempted the first computation of the 
coalescence of two black holes, but  because of the lack of sufficient computer 
resources,  their attempt was only partially successful. 
It was not until the mid 1970's that Smarr,  \v{C}ade\v{z}  and Eppley 
revisited the 2-black hole problem. Smarr explored the head-on collision
of two black holes.  During this time, 
sufficient memory and computational speed was available to work with
axisymmetric black hole encounters; head-on non-spinning black holes.  This
was possible because this problem has only 2-spatial dimensions,
(evolving in time)  which requires far less
computer time and memory to model than cases which vary in all three 
spatial dimensions.
We shall consider time dependent codes.  Thus, our 3-dimensional
code is often referred to in the literature as a (3+1)-dimensional code,
the (+1) denoting time dependence.

Smarr and Eppley 
\cite{Smarr1975}\cite{Eppley1975} (1975) succeeded in
evolving the collision and 
coalescence of two black holes and obtained estimates of the
gravitational waveforms emitted.  
Today we are looking to evolve two black holes with non-aligned
momenta and non-aligned spins, 
a generically 3-dimensional problem.  We need these computations in 
order to prepare a library of waveforms expected for LIGO.  


\section[Choice of coordinate system]{Choice of coordinate system}
\label{Choice-of-coordinate-system}
The vast majority of numerical research on the
collision of two black holes performed to date has used the
\v{C}ade\v{z} coordinate system \cite{Cook1991}. 
These coordinates are shown in Figure~\ref{fig:cadez} \cite{CookKlasky}.
The \v{C}adez coordinates are body-fitted coordinates  
that become
spherical at large distances from the black holes and,
``split'' near the holes to encircle each throat.
Thus in Figure~\ref{fig:cadez}, we see two half circles where the two throats
are, and between the holes we see a singular point. 
Although \v{C}adez coordinates are
ideal for numerical studies of two black holes, they
cannot be extended to configurations
containing more than two black holes.  These coordinate grids contain
coordinate singularities which can cause problems for numerical
evolution schemes. 
Using Cartesian coordinates eliminates both of
these problems since there are  no coordinate singularities
and any number of black holes can, conceivably, be handled.
One of the key features of the
Cartesian approach is that points of the lattice~(\ref{CEQ7}) are
used to approximate the inner boundaries (i.e. the ``holes'') of
the solution domain.
Figure~\ref{fig:cart} illustrates a typical 
computational domain which might be used for the case of a
computation involving two holes in two dimensions.
The throats of the two holes are represented by 
the large circles, and the points in the domain are labeled by the 
smaller circles. 
The small dots are those points which are not
in the computational domain. 
 Here we see the biggest disadvantage of 
rectangular coordinates, namely there are very few points exactly on the
boundaries.  So, the coordinate  surfaces will no longer be coincident
with the domain boundaries at the black holes, 
making accurate
imposition of boundary conditions much more difficult       
than with adapted coordinates, such as \v{C}ade\v{z} coordinates.
Cartesian coordinates also tend to cover the
coordinate  surfaces 
less efficiently
than do \v{C}ade\v{z} coordinates. 
One way around this issue is to use compactified coordinates, since
this will then allow the grid spacing around the holes to be very
small, whereas far away from the holes the grid spacing would be very
large. 
Here, a compactified Cartesian coordinate system will allow us to set the
outer boundary to large distances from the strong field regime
while maintaining high
accuracy near the black holes \cite{Choptuik_masters}.
The problem with compactified coordinates is that  the 
effective physical spacing increases towards the outer boundary, and the 
information concerning  gravitational waveforms will be lost.
Thus, there is apparently a limit on how coarse the zoning can be. 
We believe that by using a rectangular coordinate system with no coordinate
singularities 
along with  adaptive gridding techniques, we should
be able to develop highly accurate evolution schemes to evolve the 
extremely accurate initial data 
we can already generate\cite{CookKlasky}. The adaptive gridding techniques
will dictate where more grid points will lie.  Thus, more grid points will
lie close to the throats, and fewer points will be used far away from the
throats. 
\section[Survey of existing work on the initial value problem]{Survey 
of existing work of the initial value problem}
\label{Survey-of-existing-work-on-the-Initial-value-problem}
Einstein's equations are tensor equations which treat the 
entire four dimensional spacetime concurrently. 
Arnowitt, Deser and Misner (ADM)\cite{ADM} 
decomposed this spacetime into a set of space-like slices stacked 
together and labeled by a time coordinate.  We refer to this decomposition
as the 3+1 ADM formalism.  Using this formalism it has been shown that 
general relativity has a well posed initial value problem, {\sl i.e.} 
one can find initial value data on a space-like slice that can be 
evolved using the geometrodynamic equations of motion of the 3+1 ADM
formalism, to generate the complete spacetime.
Unlike other theories in physics which allow us to freely specify the
initial conditions of a situation, general relativity dictates 
constraints in which not all of the  degrees of freedom are freely specifiable.
Work on the initial value problem began in 1944 by 
A. Lichnerowicz\cite{Lichnerowicz}. Years later
Choquet\cite{Choquet}, York and his collaborators\cite{York}\cite{Bowen1979}\cite{BowenYork}\cite{Bowen1982}\cite{Kulkarni1983} 
decomposed spacetime into a foliation of spacelike slices, and formulated
the initial value problem.
The key feature of York's procedure is that it provides us with a well-defined
prescription for which some degrees  of freedom are to be specified,
and other degrees
of freedom must be determined from the solution of the constraint equations.
These constraint equations are the initial value problem.


With York's 
formalism, one has a ``simple way'' of 
calculating the 
initial data with non-zero linear and angular momentum.  Once York 
formulated his scheme for solving  
``the initial value equations'', many investigators 
\cite{Thornburg1987}\cite{Cook1991}\cite{ChoptuikGRG}\cite{YorkPiran}
 computed numerical solutions describing
data for two black holes.  For example, York \cite{York}, 
Bowen\cite{Bowen1979b}, and  Bowen and York 
\cite{BowenYork} developed a formalism for specifying 
part of the initial 
data for a 
single black hole with non-zero linear and angular momenta.  Later, many 
authors, York and Piran\cite{YorkPiran}, Choptuik\cite{Choptuik_masters}, 
Rauber\cite{Rauber1986}, Thornburg\cite{Thornburg1987}, Cook and York\cite{Cook_York1990}, 
studied single-hole, axisymmetric initial-data sets 
based on this framework which used 
numerical methods 
to solve the Hamiltonian constraint.
In 1983, Kulkarni {\em et al.}\cite{Kulkarni1983}
developed a formalism for prescribing the initial data for multiple black
holes.  
Based on this formal approach, Bowen, Rauber, and York \cite{York1984} detailed 
an approach for specifying the initial data for two black holes with 
axisymmetric parallel spins.  
Rauber\cite{Rauber1986} attempted to solve these equations numerically, but
was unable to generate any complete solution. 

In was not until 1993 that three independent groups generated initial
data for two black holes 
with general spin and linear momentum \cite{CookKlasky}.
It was clear that all three of the methods were able to construct
useful initial data sets to be used in the simulation of black-hole collisions. 
The most accurate solutions were
generated by
Cook's\cite{CookKlasky} code which solved the finite differenced
\footnote{
Finite Difference methods are a way to generate discrete versions of 
differential equations using a set of Taylor series approximations, truncated
to some order, to approximate the differential equation.}
3+1 Hamiltonian constraint
\footnote{ The initial value problem involves the solution of the 
momentum and Hamiltonian constraint equations\cite{York}.  There is 
a prescription\cite{Cook1991} which determines the momentum constraint for
two black holes, but the Hamiltonian constraint equation involves the solution
of a partial differential equation  which we carry out numerically.}
equation on a \v{C}ade\v{z} coordinate grid;  the
difference equations were then solved via the multigrid algorithm\cite{Brandt1977}. 
Choptuik, Klasky, and Matzner also used finite difference techniques, but
this time on a uniform Cartesian grid.  The resulting equations were 
solved using a variant of 
line successive overrelaxation (LSOR)\cite{Young}.  The
approach developed by Dubal, Oliveria and Matzner\cite{CookKlasky},
 used  a global,
spectral-like method known as the multiquadric approximation scheme.  Here,
functions are approximated by a finite sum of weighted quadric basis 
functions which are continuously differentiable.
An important result of this paper was that Cook's code was 
precisely 
second order. Second order solutions have errors which have a leading error term
which is in the square of the discretization scale. These errors usually
result from truncating Taylor series expansions  to generate the 
difference equations.
  This allowed a kind of extrapolation,  Richardson 
extrapolation to achieve errors which were demonstrably fourth
order in the discretization 
scale, $h$.
Another important result of this paper was 
that the solutions obtained using 
Cartesian coordinates were successful in modeling the ``non-trivial''
boundary topologies. 
The multi
quadric method was an intriguing alternative approach, but there were
two main drawbacks: 
the ill-conditioning of the matrix
system to be solved, and the lack of formal numerical analysis.\footnote{What
we mean by the lack of numerical analysis for this approach, is that when
one increases the number points used 
in calculation, there is no formalism developed
to tell one how fast the error will be reduced.}

\begin{figure} [p]
   \caption{   A \v{C}ade\v{z} coordinate system.}
   \vskip 4in
   \label {fig:cadez}
   \centerline{\psfig{figure=cadez.ps}}
\end{figure}
\begin{figure} [p]
   \caption{   A Cartesian coordinate system.} 
   \label {fig:cart}
   \centerline{\psfig{figure=cart.ps}}
\end{figure}

\section[The goals of this dissertation] {The goals of this dissertation}
\label{The-goal-of-this-dissertation}
In this dissertation we describe numerical techniques which we will
use to construct
three-dimensional initial data for the collision of two black holes.
In particular we look at the solution of the Hamiltonian constraint
equation which is an elliptic partial differential equation with Robin
boundary conditions.
Here we also examine general linear elliptic systems with a large
number of unknowns.   Our goal is to develop techniques to solve 
elliptic systems using Multi Level Adaptive Techniques and obtain solutions
which can be extrapolated to fourth order accuracy.
In order to achieve this goal, we find it useful to look at systems which
are more simple than the 3d Hamiltonian constraint equation.

We use Cartesian coordinates although there are clearly two  major
disadvantages using these coordinates instead of \v{C}ade\v{z} coordinates.
The first disadvantage
is that the coordinates do {\em not\/} conform to the inner
boundaries (``holes'') of the problem domain.  This means that the
formulation of accurate differenced versions of the boundary
conditions is  considerably more involved here than those formulations
which use \v{C}ade\v{z} coordinates\cite{CookKlasky} .
Secondly, because we use
a {\em uniform\/} Cartesian grid ({\em constant\/} mesh increment,
$h$, in each of the coordinate directions), the combination of 1)
the need to resolve steep gradients near the holes and 2) limitations
on our computational resources (memory and time), places a severe
restriction on  the radius at which the outer edge of the
computational domain is located.  In practice this means that we
must use an adaptive mesh in order to impose the asymptotic
boundary condition~(\ref{OUTBC}) far away from the holes. 

Our hope is that by working with the initial value equations we can 
more readily address the complications induced by the non-trivial 
boundaries than we could by looking at them in an evolution code.  
The goal is not to produce the most accurate code to solve the 
initial value 
equation, since Cook already has a code that will solve to 
extrapolatable second order accuracy, but 
rather to develop numerical techniques which we should be able to use in 
a Cartesian evolution code.  Another goal is to incorporate the most 
powerful numerical solver for elliptic equations, multigrid, 
to solve our equations.  
All of the codes that we use are coded in {\tt FORTRAN 77}.

In Chapter 2, we give a brief discussion of the initial value problem
for general relativity.
We start with the ADM formalism,  then
use York's formalism to rewrite the initial value problem 
as a coupled quasi-linear set of elliptic partial differential 
equations (PDE's) for four ``potentials''
which can be viewed as the general relativistic generalization
of the familiar Newtonian gravitational potential.
Next, the two constraint 
equations which must be solved in order to obtain initial data for the
two black holes are presented\cite{Cookphd}  .

In Chapter 3, we discuss the basic numerical analysis needed  to solve
elliptic partial differential equations.  It is in this 
section that we will attempt to understand the need to use the most 
powerful numerical techniques to solve these equations. These more
powerful techniques must be used in order to obey Brandt's golden
rule\cite{Brandt1982} and because the coordinate surfaces are not coincident with
the domain boundaries at the black holes.
We introduce basic concepts of finite differencing and
present some traditional methods of solving elliptic equations\cite{Young}
\cite{Varga}.
In particular, we present the ``art'' of finite differencing around 
boundaries, which is much more difficult than differencing around interior
points.  We present only the traditional iterative methods for solving
elliptic equations,  and make no attempt to detail any of
these techniques.
These traditional methods are conceptually easier to understand 
than the more modern techniques, but unfortunately they
do not obey Brandt's golden rule.  
In particular, we use one of these methods (Line SOR) to solve the
Hamiltonian constraint for two black holes \cite{CookKlasky}.

In Chapter 4, we discuss the multigrid method for solving elliptic
equations.  The multigrid method is an algorithm which uses a series of
meshes to solve an elliptic partial differential equation.
We first  describe the basic philosophy of 
multigrid, and 
then discuss how one can develop and apply this technique in a general problem.
Next we introduce Richardson extrapolation, which is a technique that
can be used to obtain fourth 
order accurate solutions from second order accurate solutions. 
Deferred correction is also introduced.  This is a technique which allows one 
get more accurate, higher order, solutions, from low order solutions.
Finally 
we will describe the Adaptive Multiple Refinement (AMR) scheme based 
on the Berger and Oliger\cite{BergerOliger}, and 
Choptuik\cite{Choptuik_masters} algorithm.

In Chapter 5 we present our three dimensional, two black hole code.
Here we examine some solutions obtained using this code
and compare our results to results from other published codes.
We also present convergence studies to show that this code is only first order
accurate.

In Chapter 6 we present a series of test problems that address
different questions concerning the development of an adaptive multigrid code in
three dimensions for 
two black holes.  The first test is a model problem that focuses
on the multigrid methodology only.  The second problem addresses the 
development of adaptive codes.  Here we examine issues such as the cost 
of computation and data structures.  A third test examines 
the asymptotic condition, equation~(\ref{OUTBC}), 
which requires that  the spacetime be flat far away from the black holes. This
test not only allows us to see the difficulty in implementing
 non-trivial boundary
conditions in a multigrid algorithm, but also it implements deferred correction
and attempts to obtain extrapolatable solutions from this algorithm.
The fourth problem examines the issue of Richardson extrapolation  using 
a adaptive multigrid code, explained in Chapter~\ref{MLAT}. 
The fifth problem looks at the problem of designing an efficient multigrid
code in one dimension, when the grids are non-uniform.
The sixth problem combines the previous three to design
a general one dimensional multigrid code which has Robin boundary conditions.
\footnote{Robin boundary conditions are differential equations which
include the function and its first derivative.}
Finally, the last problem 
examines the development of a two dimensional 
multigrid code for a single black hole.

Chapter 7 summarizes our work and examines some of the critical
issues that need to be further investigated in future work. 

Finally, we present a parallel implementation of a 1D multigrid algorithm.
Since computers of today are using multiple CPU's, we feel that we should
examine the issue of parallelization of multigrid algorithms.  In particular,
we examine the overall effectiveness of our implementation.

%\clearpage
%**************************************************************************
\cleardoublepage
%**************************************************************************
\chapter[The initial value problem for 2 black holes ] {The initial value problem for 2 black holes}
\label{The-Initial-Value-Problem-for-2-black-holes}
This chapter provides a brief introduction to the initial value specification
formalism. 
This is not complete by any means, and we refer the reader to the
vast amount of literature written on this subject\cite{Cookphd} 
\cite{Choptuik_masters} \cite{York} \cite{Bowen1979} \cite{Evans}.
\section [Introduction] {Introduction}
\label{IVPIntroduction}
One of the most outstanding achievements of the general theory of relativity is
that there is no longer some preferred notion of time.  
In this chapter we will demonstrate
how to decompose spacetime into space plus time in a 
general way using the 
Arnowitt-Deser-Misner (ADM)formalism\cite{ADM},
allowing space to be separated from time. 
The need to do this becomes
apparent when we attempt to solve Einstein's equations numerically using
the space + time technique. 
If we use the various ``null cone approaches''
then we do not need to split space and time.
This procedure is well established and
we will give a brief summary of only the major steps necessary to
derive the initial value equations for two black holes\cite{Huq}.
We show how the ADM split of spacetime results in
a set of Cauchy surfaces parameterized by time.  Thus, the spacetime 
manifold
$M$ is separated into a family of spatial hypersurfaces $\Sigma_{t}$.   
Next we will follow
Wald's approach to derive the constraint equations\cite{Wald} .
We then outline York's procedure that,  when applied to the constraint
equations,  results in a set of equations that 
are of a form particularly amenable to numerical solution.
Finally we apply these equations to black hole spacetimes.


\section[The ADM approach] {The ADM approach}
\label{The-ADM-approach:-splitting-space-time-into-space-time}
In order to exploit the special nature of time in Einstein's equations,
we break the full, four-dimensional covariance to help reveal their
dynamical nature. Here we will use the usual geometric units
($G = c = 1$) and use the MTW\cite{MTW} sign conventions for the
metric and curvature. We also let the tensor indices $i,j$ run from one
to three whereas all other indices run from zero to three,( where the 
zero component is the time-like index). 
The 3+1 approach to general relativity involves a decomposition of the
4-dimensional spacetime manifold into an infinite family of edgeless
3-dimensional spacelike hypersurfaces; {\sl i.e.} we decompose spacetime
into space and time where each hypersurface, $\Sigma_t$ is at a certain
time, 
$t$.

This decomposition enables us to break the four-dimensional covariance 
of Einstein's equations,
\begin{eqnarray}
G_{\mu \nu} =  8 \pi T_{\mu \nu}, 
\end{eqnarray}
such that it is possible to pose them as a Cauchy problem\cite{Cookphd}.
Here $G_{\mu \nu}$ is the Einstein tensor, and $T_{\mu \nu}$ is the
stress energy tensor.
Einstein equations consist of 10 equations, of which 4 are the
initial value or  constraint equations and 6 are the evolution
equations.  The initial value equations are
\begin{eqnarray}
\label{ece}
G_{00} = 8 \pi T_{00} \nonumber \\
G_{0i} = 8 \pi T_{0i} 
\end{eqnarray}
which provide constraints on the initial data $g_{ij}$. 
The reason why these equations are known as constraint equations is
that, since these equations involve no second derivatives with
respect to time, they represent equations which must be satisfied at
all times, {\sl i.e.} constraints.  There is nothing surprising about
why these equations exist, since there is a direct analogy 
with Maxwell's equations \cite{YorkPiran}.  The reason why 
the $G_{00}$ equation represents the Hamiltonian constraint equation 
is that it involves the energy density.  The $G_{0i}$
equation involves the momentum density and thus it is called the
momentum constraint equation.

A relationship between the
components of the metric of spacetime $g_{\mu \nu}$ and those of the
spatial 3-metric
$\gamma_{ij}$ in the 3+1 split must be defined.
The standard 
Arnowitt-Deser-Misner (ADM) 
form for this metric is,
\begin{eqnarray}
\label{eqn:ADMmetric}
ds^2 = -\alpha^2 dt^2 + \gamma_{ij} \lb dx^i + \beta^i dt)(dx^j + \beta^j dt \rb,
\end{eqnarray}
where 
the functions $\alpha$ and $\beta^i$ are called the lapse and shift 
functions,
respectively. Here, $\alpha$ determines the lapse in proper time 
experienced by an observer moving between nearby hypersurfaces in the 
direction normal to the surfaces
while $\beta^i$ describes the shift in 
the
spatial coordinates between the two slices
relative to normal propagation.
We see that the introduction
of the lapse and shift are simply a manifestation of the fact that we 
have
chosen a particular coordinate system to 
label the events of our spacetime, (see Figure~\ref{ADMfig}).
We will now follow Wald's\cite{Wald} derivation 
in generating the initial value equations. 
Since the $\Sigma_t$ are level surfaces, at each point 
it is possible to construct a one-form, 
\begin{eqnarray}
n_a = -\alpha \nabla_a t,
\end{eqnarray}
where
\begin{eqnarray}
\alpha= -t^\alpha n_a = \lb n^a \nabla_a t \rb ^{-1}
\end{eqnarray}
 and $\nabla_a$ is the covariant four derivative.
\section[Projection tensors and the covariant derivative]{Projection tensors and the covariant derivative} 
\label{PTCD}
Now that we have decomposed space-time into space and time, we 
define the projection tensor needed to project an arbitrary
vector into the hypersurface, $\Sigma_t$. 
So, on every
$\Sigma_t$ 
we define
the projection tensors:
\begin{eqnarray}
\perp^a_b &\equiv& \delta^a_b + n^a n_b, \nonumber \\
N^a_b &\equiv& -n^a n_b .
\end{eqnarray}
The projection tensor, $\perp^a_b$, projects the free indices of a given
tensor into $\Sigma_t$.  Similarly $N^a_b$ projects the free indices 
normal to $\Sigma_t$.  
The projection tensor $\perp$  induces a 3-metric from the 4-metric:
\begin{eqnarray}
\gamma_{ab} = \perp_a^c \perp_b^d g_{cd} =  \lb g_{ab} + n_an_b \rb  .
\end{eqnarray}
where $\gamma^{ab}$ is the inverse of $\gamma_{ab}$ and $\gamma_{ab|c}=0$,
where $|$ denotes a covariant derivative in $\Sigma_t$.

The
3-covariant derivative $D$ induced on $\Sigma_t$, by $\nabla$
is obtained
by projecting every index of the tensor produced by 
$\nabla$
onto $\Sigma_t$. 
For instance, 
\begin{eqnarray}
D_a f &=& \perp^b_a \nabla_b f \nonumber, \nonumber \\
D_a v^b &=& \perp^c_a \perp^b_d \nabla_c v^d, \nonumber \\ 
D_a T^b_c &=&  \perp^d_a \perp^b_e \perp^f_c \nabla_d T^e_f. 
\end{eqnarray}
\begin{figure} 
\caption{ Spacetime displacement in the 3+1 formalism.}
\label{ADMfig}
\centerline{\psfig{figure=adm.ps}}
\end{figure}
\section[The constraint equations]{The constraint equations}
\label{The-constraint-equations}
We will start this section by defining the extrinsic curvature, 
and then proceed by deriving the constraint equations.
The extrinsic curvature tensor is a spacelike object which
determines the contraction and shear of the normals to
$\Sigma_t$ .
Thus, its trace is the average contraction of these normals.    The
extrinsic curvature can be thought of,  roughly, as the ``velocity''
of the 3-metric.
We let $v^a$ and $w^b$ be two vector fields, which we 
shall
project on the hypersurface using $\perp$, 
$$ \hat v^a = \perp^a_b v^b \ \ \ \ \ {\rm and} \ \ \ \hat w^b 
    = \perp^b_c w^c $$
Then, the extrinsic curvature of $\Sigma_t$ is defined by
\begin{eqnarray}
\bf{K} \lb \bf{\hat v},\bf{\hat w} \rb  &=& - \lb \nabla_a n_b \rb \hat v^a \hat w^b \nonumber \\
&=& \frac{1}{2} \lb  {\cal L}_{\bf n} \gamma_{ab} \rb  {\bf v}^a {\bf w}^b 
\end{eqnarray}
where ${\cal L}_{\bf n}$ is the Lie derivative along ${\bf n}$ . 
The Lie derivative , $ {\cal L}_{\bf n}$ describes the flow of points in the
direction of the vector field ${\bf n}$.:
. 
To derive the Hamiltonian constraint equation, we expand 
$ \gamma^{ac} \gamma^{bd} R^{\lb 4 \rb }_{abcd} $ as
\begin{eqnarray}
\label{hamcs}
g^{ac} g^{bd} \perp^m_a \perp^k_b \perp^l_c \perp^s_d R^{\lb 4 \rb }_{mkls} 
&=& \gamma^{ml} 
\gamma^{ks} R^{\lb 4 \rb}_{mkls} \nonumber \\
&=& \lb g^{ml} + n^m n^l \rb  \lb g^{ks} + n^k n^s \rb   R^{\lb 4 \rb }_{mkls} \nonumber \\
&=& R + 2R_{ab} n^a n^b  \nonumber \\
&=& 2 G_{ab} n^a n^b . 
\end{eqnarray}
The first Gauss-Codazzi equation\cite{Wald} is 
\begin{eqnarray}
\label{eqn:gc1}
\perp^m_a \perp^k_b \perp^l_c \perp^s_d R^{\lb 4 \rb }_{mkls} = R_{dcba} +
K_{ac} K_{bd} -
K_{bc} K_{ad}
\end{eqnarray}
which is identical to the left hand side of equation~(\ref{hamcs}).

Using the Einstein field equations~(\ref{ece})
and the first Gauss-Codazzi equation~(\ref{eqn:gc1}),
we can write the
Hamiltonian constraint in the form
\begin{eqnarray}
\label{ham_ceqn} 
R + K^2 - K_{ab}K^{ab} = 16 \pi \rho  ,
\end{eqnarray}
where
$$\rho = T_{ab} n^a n^b ,$$
is the local energy density.

We can derive the momentum constraint equations by looking at
\begin{eqnarray}
\label{eqn:mc1}
\perp^m_a n^n G_{mn} &=& \perp^m_a n^n \lb  R^{\lb 4\rb }_{mn} - 
\frac{1}{2}g_{mn} R \rb  
\nonumber \\
&=& \perp^m_a n^n R^{ \lb 4 \rb }_{mn}
\end{eqnarray}
and the second Gauss-Codazzi equation 
\begin{eqnarray}
\label{eqn:gc2}                                             
N^m_a \perp^n_b \perp^o_c \perp^p_d R^{\lb 4 \rb }_{mnop} = n_a \lb  D_d K_{cb} - D_c K_{db}  \rb .
\end{eqnarray}
where again $N^m_a$ is the projection tensor.
If we act on both sides of equation~(\ref{eqn:gc2}) with $n^ag^{bc}$ 
we get
\begin{eqnarray}
n^m \perp^p_d R^{\lb 4 \rb }_{mp} = D_c K^c_d - D_d R^c_c
\end{eqnarray}
which we can equate with equation~(\ref{eqn:mc1}) to derive the momentum 
constraint
\begin{eqnarray}
D_cK^c_d - D_d K^c_c = 8 \pi n^n \perp^m_d T_{mn}.
\end{eqnarray}
Finally, 
we use 
\begin{eqnarray}
  j^i \equiv \gamma^{ik} j_k
\end{eqnarray}
where
 \begin{eqnarray}
 j_k \equiv - n_a T^a_k 
 \end{eqnarray}
to write the momentum constraint in the form
\begin{eqnarray}
\label{eqn:mom_ceqn}
D_j \lb  K^{ij} - \gamma^{ij} K \rb  = 8 \pi j^i .
\end{eqnarray}
This equation is a vector equation, which is equivalent to 3 scalar equations.
Here $j^i$ is the momentum density.

\section[Conformal transformation of the constraints]{Conformal transformation of the constraints}
\label{ConTransCon}
In order to make the constraint equations easier to model numerically,
we will use the York\cite{York} procedure of conformal transformations. 
York\cite{York} provided a constructive way
to solve the constraint equations that involves solving elliptic partial
differential equations.

A key idea (originally suggested by 
Lichnerowicz in 1944)\cite{Lichnerowicz}
of York's approach
is to specify the physical data up to
conformal equivalence.
York's contributions (along with various coworkers)\cite{York}
include applying the conformal
and transverse-traceless decomposition of the 
constraint equations, 
as well
as developing a method of imaging applicable to tensors\cite{Cookphd} .
The chief success of York's work is that it puts the initial value equations
into a form which allows them to be solved with numerical methods, and in some
cases, by analytic means.
Before applying this formalism,  we will first choose a 
coordinate system with a
basis $({\bf n},{\bf e}_i)$ where ${\bf e}_i$ are spatial vectors,
and $\bf n$ is a time-like vector.  
Hereafter, we make 
the following identifications
$$ \gamma_{ab} \Longrightarrow \gamma_{ij}$$
$$ \perp^a_b \Longrightarrow  \delta^i_j $$
$$ D_a \Longrightarrow  \nabla_i . $$ 
where we now use latin indices $i,j$ , ( which range from 1 to 3)
to indicate that we are in the
basis.

We write the physical 3-metric in the conformal form
\begin{eqnarray}
\gamma_{ij} = \psi^4 \hat \gamma_{ij}
\label{trans}
\end{eqnarray}
where $\hat \gamma_{ij}$ is a background metric
which is to be freely specified.
(In the remainder of this chapter, a caret 
will denote a ``bare''
3-tensor which is related to the physical tensor via a conformal
transformation. Also, bare tensors have their indices raised and lowered 
with the bare metric.)
All quantities which are 
functions of the metric have transformation properties which
follow from~(\ref{trans}). In particular we find 
that
\begin{eqnarray}
 \Gamma^i_{jk} &=& \hat \Gamma^i_{jk} + 2 \psi^{-1} \lb  \delta^i_k 
\psi_{,k} + \delta^i_j 
\psi_{,k} - \hat \gamma^{il} \hat \gamma_{jk} \psi_{,l} \rb  \nonumber \\
R &=& \psi^{-4} \hat R - 8 \psi^{-5} \Delta \psi 
\end{eqnarray}
where $\Delta \psi = \gamma^{ij} \nabla_i\nabla_j \psi $.

The York procedure requires us to specify freely on the 
hypersurface the value 
of the mean extrinsic curvature, $Tr K$
\begin{eqnarray}
K \equiv Tr K = \gamma_{ij} K^{ij} .
\end{eqnarray}
Since $Tr K$ is assumed to be given, it is 
convenient to isolate 
the trace-free part, ${\hat A}^{ij}$,
of the bare extrinsic curvature, ${\hat K}^{ij}$:
\begin{eqnarray}
\label{eqn:2tt} 
\hat A^{ij} = \hat K^{ij} - \frac{1}{3} \hat \gamma^{ij} \hat K
\end{eqnarray}
Now Kulkarni\cite{Kulkarni} showed that for any symmetric rank-2 
tensor field ${\hat F}^{ij}$:
\begin{eqnarray}
\label{eqn:kulk1}
\nabla_i \hat F^{ij} = \psi^{-10}\hat  \nabla_i \lb  \psi \hat F^{ij} \rb  - 2 
\psi^{-1} \hat \gamma^{ij} 
\psi_{,i} \hat \gamma_{kl} \hat F^{kl}
\end{eqnarray}
In particular, ${\hat A}^{ij}$ will have this property.
This helps us in deriving a conformal transformation of the constraints
since the equations contain terms of this form.
Now we make the following transformations:
\begin{eqnarray}
\label{eqn:2tran}
 A^{ij} = \psi^{-10} \hat A^{ij} \nonumber \\
A_{ij} = \psi^{-2} \hat A^{ij} \nonumber \\
j^i = \psi^{-10} \hat j^i \nonumber \\
\rho = \psi^{-8} \hat \rho .
\end{eqnarray}
Using equations 
~(\ref{eqn:2tran}),~(\ref{eqn:kulk1}) and~(\ref{eqn:2tt}), we can rewrite the 
momentum constraint equation\cite{Kulkarni} as
\begin{eqnarray}
\label{eqn:2momceq}
\hat D_j \hat A^{ij}  - \frac{2}{3} \psi^6 \hat 
\gamma^{ij} \hat D_j K = 8 
\pi \hat j^i
\end{eqnarray}
and the Hamiltonian constraint as 
\begin{eqnarray}
\label{eqn:2hamceq}
8 \hat \Delta \psi - \hat R \psi - \frac{2}{3} \psi^5 K^2 + \hat A_{ij} 
\hat A^{ij} \psi^{-7} = -
16 \pi \hat \rho \psi^{-3}.
\end{eqnarray}

Here is where we see the beauty of York's procedure.  We are 
%simply 
left with
four equations which have the freely specifiable quantities: 1) the base
3-metric $\hat \gamma_{ij}$, 
2) the mean extrinsic curvature  $Tr K$, 3) a certain part of $\hat A_{ij}$
(\cite{YorkPiran}) ,
and  4) the conformally scaled 
energy and momentum densities $\hat \rho$ and $\hat j^i$.  
Once we 
specify these variables, we can solve the constraint equations for 
$\hat A_{ij} $ and $\psi$.   
We can construct the physical initial data using these variables.
 
\section[Application of the constraint equations to black hole spacetimes]{Application of the constraint equations to black hole spacetimes}
\label{ACEBHST}
The initial value equations are simplified when
one considers
conformally flat, maximal volume, vacuum slices.
Conformal flatness means that the physical metric, 
$\gamma_{ij}$, of the 
hypersurface may be written as
\begin{eqnarray}
\gamma_{ij} = \psi^4 f_{ij}
\end{eqnarray}
where $f_{ij}$ is the flat background 3-metric (previously ${\hat \gamma}_{ij}$)
Maximal volume means that  
$$ Tr K = 0 .$$ 
The standard $t$= constant hypersurfaces
 in Minkowskii spacetime also have this property.

The vacuum requirement means that there are no 
matter sources on the hypersurface:
$$ \hat \rho = \hat j^i = 0, $$
and finally we note that 
conformal 3-flatness implies ${\hat R}=0$.
Thus, the constraint equations take the much simplified
form
\begin{eqnarray}
\label{HAM}
8 \hat \Delta \psi = -  \psi^{-7} \hat A_{ij} \hat A^{ij}
\end{eqnarray}
and
\begin{eqnarray}
\label{eqn:2acmomceq}
\hat D_j \hat A^{ij} = 0.
\end{eqnarray}

For the black hole spacetimes that we consider,
the topology of the initial-data hypersurface is fixed to be two
asymptotically flat universes, {\sl i.e.} they tend to flat spacetimes
at large radii,
connected by an Einstein-Rosen bridge
\cite{Einstein_Rosen} for each black hole. Each bridge is a connection
to another identical universe and we require
that the bridges link only two identical universes.
To achieve the condition that bridges link only identical universes,
an isometry condition\cite{Weinberg} 
must be imposed.  This is derived from an inversion symmetry requirement
,which is
\begin{eqnarray}
\psi(r) = \frac{a}{r} \psi \lb  \frac{a^2}{r} \rb  \nonumber 
\end{eqnarray}
and has the effect of ensuring an inversion-symmetric solution with 
$r=a$ as a minimal surface.
The solution of the momentum constraint under these conditions was found
by Kulkarni {\em et al.} \cite{Kulkarni}.  Their solution was in the form 
of an infinite series generated by a method of images applied to tensors.
For the case of two black holes, an accurate numerical scheme for evaluating
the formal infinite series was developed by Cook\cite{Cook1991}.  To solve 
the momentum constraint, we give values for the radius $a_{\alpha}$ and
coordinate center $C^i_\alpha$, the linear momentum $P^i_{\alpha}$
and the spin $S^i_{\alpha}$, where $\alpha$ labels the hole.
Figure~\ref{fig:cart} shows $a_{\alpha}$ and $C^i_{\alpha}$ for two
holes. 

We use a routine developed by Matzner\cite{Matzner} 
based on Cook's work
which determines the solution of the momentum constraint.  

Given a solution of the momentum constraints, we then must solve the
Hamiltonian  constraint with some boundary conditions.  The isometry
condition applied to the physical metric at $a_\alpha$ yields the
following inner boundary condition for the conformal factor
\begin{eqnarray}
\label{INNERBC}
n^i_\alpha \hat D_i \psi _{\vert a_\alpha} + 
\frac{\psi}{2r_\alpha} _{\vert a_\alpha} = 0 
\end{eqnarray}
where 
\begin{eqnarray}
n^i_{\alpha} = \frac{x^i - C^i_{\alpha} }{r_\alpha} 
\end{eqnarray}
is the unit normal to the surface of the $\alpha$th isometry surface
and
\begin{eqnarray}
r_\alpha = \vert x^i -  C^i_\alpha \vert . 
\end{eqnarray}
The asymptotically flat condition sets the outer boundary condition to
\begin{eqnarray}
\psi \rightarrow 1 \ \ \ \ \ \ \ {\rm as} \qquad r \rightarrow \infty
\label{OUTBC}
\end{eqnarray}
where $r$ is measured from the ``hole'' singularity, which is 
somewhat arbitrary in the limit $r \to \infty$.
In practice, it is not often 
possible to model equations 
on grids with boundaries
set at $r\rightarrow\infty$.  However, a multipole
expansion can be performed
for the conformal factor and truncated at monopole order to
generate an approximate asymptotic boundary condition\cite{YorkPiran}
\begin{eqnarray}
r \frac{\partial \psi}{\partial r} = 1 - \psi + O \lb r^{-2} \rb 
\end{eqnarray}
We note that higher order approximate boundary conditions can be derived
\cite{Cook1991}.
We will not use these, however, since our 
ultimate
approach will be to use a very
large outer radius where $\psi \approx 1$.

To summarize, our goal is to solve the following equations given
values for the radii $a_{\alpha}$ and
coordinate centers $C^i_{\alpha}$, the linear momenta $P^i_{\alpha}$
and spins $S^i_{\alpha}$
\begin{eqnarray}
8 \nabla^2 \psi = -  \psi^{-7}  \hat A_{ij} \hat A^{ij} \nonumber \\
\end{eqnarray}
and
\begin{eqnarray}
 n^i_\alpha \hat D_i \psi _{\vert a_\alpha} +
\frac{\psi}{2r_\alpha} _{\vert a_\alpha} &=& 0 \nonumber \\
r \frac{\partial \psi}{\partial r} &=& 1 - \psi \nonumber
\end{eqnarray}

%**************************************************************************
\cleardoublepage
%**************************************************************************
\chapter[Numerical techniques] {Numerical techniques}
\label{NumericalTechniques}
In this chapter, we wish to present our philosophy of numerical analysis. 
In the first section  we present  the ``art'' of finite
differencing.  We call this an art since there are many ways to 
finite-difference an equation.
Some iterative algorithms will diverge for certain
differencing techniques whereas if we use other methods of differencing
we could make the algorithms converge.  

We use finite differencing techniques, (versus finite element
and finite volume methods), 
since they are often much easier to program than these two other methods.
Since the code that will be written to evolve the evolution equations
will probably be discretized by finite differencing, we can also gain
experience with the differencing around the boundaries of the holes. 

After discussing finite
differencing,  we  then present methods of  numerically solving elliptic 
partial differential equations.
Here, we look at three ``classic'' iterative
methods,( Jacobi, Gauss-Seidel, and Successive Over Relaxation), although
no attempt is made to describe all of the available techniques, nor is any 
particular method presented in detail. 
All of these techniques can be written in terms of a 
general matrix equation.  This general matrix equation, is a set 
of coupled equations, which describe how the solution will change from
one iteration to the next. 
For each method, the matrix eigenvalues will determine the rate of 
convergence.
Later we present interpolation and extrapolation techniques for high
order accuracy.  We present a general algorithm which will interpolate and
extrapolate to fourth order. 
These interpolation techniques work with all the systems considered in this
dissertation. That is, these techniques will be for
lattices with holes(spheres), cut out.  Next we present further 
enhancements to the interpolation algorithm, 
along with some alternative  approaches.
Finally, we pose a few model problems that we will
examine with more elaborate algorithms in Chapter~\ref{TEST1}. We assume that 
the reader is already familiar with the basic techniques.
\footnote{ Some classical references to this subject are Young\cite{Young},
Varga\cite{Varga}, Numerical Recipes\cite{Numerical-Recipes}, and 
Mitchell and Griffiths\cite{MittchelGriffiths}. }


\section [Spatial finite differencing] {Spatial finite differencing}
\label{SFD}
\subsection[Basic techniques]{Basic techniques}
\label{Basic-Techniques}
In describing spatial finite differencing it is perhaps best to start with a
model problem, and then expand from there to handle general problems.
Since we do not deal with systems which evolve in time, we will only
describe finite differencing for spatial varying systems.
In  all of our examples we will work in Cartesian
coordinates, and use uniform differencing, {\sl i.e.}, constant grid spacing
as shown in Figure~\ref{fig:3.1}.

\begin{figure}
\caption{ A discretized domain with uniform differencing.}
\label{fig:3.1}
\begin{center}
\input{f31.tex}
\end{center}
%\vskip 1in
\end{figure}

We will look at two example
systems: a one dimensional elliptic PDE, ( actually an
ODE, but we ignore this for our example), and a two dimensional elliptic
PDE.  It then should be intuitively obvious how to extend the ideas in
this section to three dimensions.
The computational domain we use is that of a lattice 
which has $n$ grid points on an edge. For example, the one dimensional
lattice which we use, is defined by
\begin{equation}
   \left\{ \left( ih \right) \right\},  \quad\quad
   i = 1 , 2, \cdots , n 
      \label{CEQ7}
\end{equation}
where $h$, is the (unique) discretization scale.  As a matter of
convenience, we will refer to {\em any} point with coordinates of
the form $\left( ih \right)$, with $i$ as an integers,
as a lattice point, even though it may not be contained in the
actual computational domain.
We now describe the techniques used to model the following equation
\begin{eqnarray}
\frac{\partial^2 u \lb x \rb }{\partial x^2}&=&f \lb x \rb   \qquad x \in [0,1] \nonumber \\
u \lb 0 \rb  &=& u_0 \nonumber \\
u \lb 1 \rb  &=& u_1  .
\label{eqn:1dexample}
\end {eqnarray}
This problem can also be represented as
\begin{eqnarray}
L u =f 
\end{eqnarray}
where $L$ represents  the differential operator in the system,
\begin{eqnarray}
L= \frac{\partial^2 u \lb x \rb }{\partial x^2},
\end{eqnarray}
in this case.
It is
important that the functions involved are smooth, {\sl i.e.} infinitely
differentiable, since we will not be
able to apply finite differencing if they are not smooth.
The first step in defining a finite difference problem is discretizing the
system, which means replacing the continuous domain by a discrete domain, 
as shown in Figure~\ref{fig:dd}.
Before we describe the discretization process any further, 
we direct the reader's attention to Table~\ref{notation} which defines
the notation which will be used throughout this text for discretized functions
and operators.
We also put all of our algorithms in a {\tt typewriter} font to emphasize our
computer instructions.  Each algorithm is pseudo-code taken from our
{\tt FORTRAN 77} codes.  Where possible, we eliminate most of the clutter in
the codes.
\begin{table}
\begin{caption}
{Notation used in this dissertation}
\label{notation}
\end{caption}
{\small
\begin{tabular}{ll} \hline\hline
$u \lb x \rb $      & Continuum function \\
$u^h $      & Discretized function, with grid spacing $h$ \\
$u^{ \lb n \rb }$   & Discretized function, which is being used \\
& in an iterative procedure at iteration number $n$  \\
$u^h[j]$    & One dimensional discretized function  with grid spacing $h$, \\
& representing the point at $x=x_j$ \\
$u[j]$      &One dimensional discretized function representing\\
& the point at $x=j$ \\
$u[J]$      &Capital letters generally mean that we are working \\
& with coarse and fine grids. The coarse grid functions \\
& are denoted with capital letters, and the fine grid \\
& have lower case letters.\\
$u^h[j,k]$  & Two dimensional discretized function with grid spacing  $h$,\\
& representing the point at $x=x_j,y=y_k$ \\
$u^h[j,k,l]$ & Three dimensional discretized function with grid spacing $h$,\\
& representing the point at $x=x_j,y=y_k$,$z=z_l$ \\
$L$         & Continuum differential operator \\
$L^h$       & Discretized (difference) operator\\
$\tilde u^h[j]$ & The newly updated value of $u^h[j]$ used in an\\
& iterative procedure ( see $u^{ \lb n \rb }$ ) \\
$ := $      & Assignment operator \\ 
$a(b)$      & $a \times 10^{\rm b} $ 
\\ \hline \hline
\end{tabular}
}
\end{table}
%
\begin{figure}
\caption{Replacement of a  continuous domain with a finite differenced discrete domain}
\label{fig:dd}
\vskip 1in
\begin{center}
\input{fdd.tex}
\end{center}
\end{figure}

Thus, we discretize the problem domain in the usual manner, by introducing
a uniform grid, ${x_j = j h}$, where $j
\in  \lb 1,\cdots,N \rb $ and $ h=\lb N-1 \rb ^{-1}$. 
The finite set of grid points is the discrete domain.  
Thus, the discretized model problem can now be represented as
\begin{eqnarray}
L^h u^h = f^h
\end{eqnarray}

Given the assumption
that $u$ is smooth, Taylor's theorem can be used to approximate the
derivatives of $u$ by linear combinations of various 
grid function values (or nodal values), $u[j]$.
For example, for $j = 2 \cdots N-1$  (interior points),
we can use the usual second order,
centered approximation for second derivatives
\begin{eqnarray}
\frac{\partial^2 u \lb x \rb }{\partial x^2} [j] = \frac{u[j+1] +
u[j-1] - 2u[j]}{h^2} + O \lb h^2 \rb  \quad 2 \le j \le N-1 .
\label{eqn:1dfdc}
\end{eqnarray}
The model problem uses Dirichlet boundary conditions; thus
the one dimensional finite differenced model problem becomes
\begin{eqnarray}
\label{ifd}
\frac{u[j+1] + u[j-1] - 2u[j]}{h^2} &=& f[j] + O \lb h^2 \rb  ) \quad 2 \le j \le N-1) \nonumber\\
u[1] &=& u \lb x \lb 1 \rb  \rb \nonumber \\
u[N] &=& u \lb x \lb N \rb \rb  
\label{eqn:1dfde}
\end{eqnarray}
This approximation may be defined from the Taylor series expansions 
\begin{eqnarray}
u \lb x+h \rb  &=& u \lb x \rb  + h~u_x \lb x \rb  + \frac{h^2}{2} u_{xx} \lb x \rb  + \cdots \nonumber \\
u \lb x-h \rb  &=& u \lb x \rb  - h~u_x \lb x \rb  + \frac{h^2}{2} u_{xx} \lb x \rb  + \cdots \nonumber \\
\end{eqnarray}
truncated at $O \lb h^4 \rb $.  
When we use equation~(\ref{ifd}) to represent the second derivative, the
leading order error term is in $O(h^2)$.  In general we will define the
truncation error as
\begin{eqnarray}
\tau^h \equiv L^h u - f.
\end{eqnarray}
The solution error is defined by
\begin{eqnarray}
\label{erroreqn}
e^h \equiv u^h - u
\end{eqnarray}
while  $\tau^h$ is the actual error of the difference solution.
We see that the truncation error to the model problem is
\begin{eqnarray}
\tau^h = \frac{h^2}{12}
\end{eqnarray}
which is called second order since the truncation error is of order $h^2$. 
We assert (and it can be shown) that 
the solution of these equations is an approximation to the solution of 
equation~(\ref{eqn:1dexample}) whose error is $O(h^2)$ as $h \rightarrow 0$. 
This is perhaps the most commonly used form for 
second derivatives, but
it is important to note that this is not the only second
order expression for this term. For example,
we  can use backward differencing to obtain
the formula:
\begin{eqnarray}
u_{xx}[j] = \frac{ \lb  2u[j] - 5u[j-1] + 4u[j-2] - u[j-3] \rb }{h^2}  + O \lb h^2 \rb,
\label{eqn:1dfdb}
\end{eqnarray}
or use forward differencing to obtain:
\begin{eqnarray}
u_{xx}[j] = \frac{ \lb  2u[j] - 5u[j+1] + 4u[j+2] - u[j+3] \rb }{h^2} + O \lb h^2 \rb . 
\label{eqn:1dfdf}
\end{eqnarray}

Higher order approximations, while more accurate for a given grid spacing,
in general require more work numerically,
(on a per-grid-point basis)
both for their evaluation and for
the solution of the algebraic equations resulting from their use.
If we want the finite differencing to be a higher
order, we then must include more points in the stencil.
As is often the case in finite-difference work, it is convenient to
describe the derivation of our discrete equations in terms of
{\em stencils}. The stencil associated with any given
finite-difference expression applied at some generic lattice point
$ \lb ih \rb $ is simply the set of  points (or neighborhood)
explicitly referenced in that expression.
We shall see later
that there are often convergence  problems when higher order schemes are
used with iterative solvers.

Now we shall extend these ideas to a two dimensional model problem,
\begin{eqnarray}
\frac{\partial^2 u \lb x,y \rb }{\partial x^2} + \frac{\partial^2 u \lb x,y \rb }{\partial y^2}
= f \lb x,y \rb  \quad x \in [0,1], y \in [0,1].
\label{eqn:2dexample}
\end{eqnarray}
Here again, we discretize the system using centered differencing 
\begin{eqnarray}
\lefteqn{u_{xx}[j,k] + u_{yy}[j,k] = h^{-2} \Lc u[j+1,k] + u[j-1,k]}  \nonumber \\
& & + u[j,k+1] + u[j,k-1] - 4u[j,k] \Rc  \nonumber \\
& & + O \lb h^2 \rb  \quad j \in [2,nx-1] , k \in [2,ny-1] .
\label{eqn:2dfdc}
\end{eqnarray}
This is the most commonly used finite difference expression for the Laplacian
$\nabla^2 u$, in the special case when the grid spacing in the $y$ direction
is equal to the grid spacing in the $x$ direction.   

One fast way of determining  if a stencil is going
to give convergence problems using iterative techniques,  is to check for 
diagonal dominance.\footnote{By convergence problems we mean to say
that by not having diagonal dominance, most iterative methods will probably
diverge.}  
We define diagonal dominance for a matrix $L$ with entries $L[j,k]$ by
\begin{eqnarray}
\Vert L[j,j] \Vert \geq \sum_{k=1, j \neq k}^{n}  \Vert L[j,k] \Vert ,
\end{eqnarray}
where at least one row must be have $\Vert L[j,j] \Vert > \sum_{k=1, j \neq k}^{n}  \Vert L[j,k] \Vert $. 

For example in  equation~(\ref{eqn:2dfdc}), the off diagonal terms add up to
4, as does the diagonal term.  Since the sum of the off diagonal terms is not
greater than the diagonal term, we should not expect convergence problems
from this equation
when we solve for $u[i,j]$. This is known as diagonal dominance.  When we look 
at equation~(\ref{eqn:1dfdb}) we see that the off diagonal terms add up to 10 
whereas the diagonal term is only 2.  We can  expect some convergence 
problems  using
most  iterative numerical solvers for this equation. 
Note that we do not claim
that diagonal dominance implies fast convergence.
Rather, the rule-of-thumb is that diagonally dominant systems 
can generally be solved iteratively using techniques such as the 
the Gauss-Seidel method described below.
Conversely, when we attempted to solve equation~(\ref{eqn:2dexample}) using
backwards differencing with a Gauss-Seidel algorithm,
the iteration did not converge. 
Thus, when we finite-difference elliptic systems,
we will always try to maintain diagonal dominance.

\subsection[Boundary finite differencing]{Boundaries}
\label{BouFD}
Perhaps the hardest part of finite differencing is working with 
boundaries.  We saw that in the previous section, it was quite elementary 
to apply finite differencing to 
generate interior equations.  
We can always apply second order central 
differencing for interior equations,
which is diagonally dominant.  When it comes to
treating boundary conditions (or even interior equations in the 
vicinity of boundaries)
we must be very careful in choosing the appropriate finite
difference stencil.  In this section, we shall first look
at a one  dimensional example using
a general boundary condition where the physical boundary 
coincides with a lattice point.
Next we look at the case when the physical boundary is no
longer coincident with a lattice point. 
After this, we shall look at some two dimensional cases
and comment on extensions to three dimensions. 

Before we start, we recall that we can easily generate $O \lb h^2 \rb $ accurate
expressions for use at interior points.
Thus, we shall want to be able to use at least 
$O \lb h^2 \rb $ approximations of the boundary equations; 
in fact our goal will actually
be to achieve $O \lb h^4 \rb $ accuracy on the boundaries.

\subsection[One dimensional boundary finite differencing]{One dimensional boundary finite differencing}
\label{ODBFD}
There are three major types of boundary conditions encountered in
boundary-value problems: 
1) Dirichlet conditions, where the value of the unknown
function is given on the boundary, 2) Neumann conditions, where the normal
derivative of the function on the boundary is specified, and 3) Robin or
mixed conditions, where some combination of the function and its
normal derivative on the boundary are given. 

Our general one dimensional boundary condition will be the Robin condition
\begin{eqnarray}
\alpha u + \beta u_x = g
\label{eqn:1dgb}
\end{eqnarray}
applied at $x=a$.
At first we shall take $x=a=0$, to explain some simple
concepts of finite differencing around boundaries.
Next, we apply the boundary condition at some irrational 
$x$, so that no lattice point coincides 
with the boundary.  We do this in preparation for extensions into multiple
dimensions. Figure~\ref{fig:3.5}  shows the discretized system for 
the $a=0$ case.

\begin{figure}
\caption{The 1D discretized domain where $a=0$.}
\label{fig:3.5}
\begin{center}
\input{f35.tex}
\end{center}
%\vskip 1in
\end{figure}


 There are two
main ways of deriving approximations to the boundary conditions.  
The first method applies discrete forms of both
the interior equation and the boundary equation on the boundary by 
introducing an extra grid point which lies outside the actual continuous 
domain.  The second method keeps the boundary equations separate from 
the interior equation.  Thus, the only difference between these
two methods is in the grid structure used.

Applying the first method to equation~(\ref{eqn:1dgb}),
we see that we can use a centered finite difference 
scheme for the boundary equation to get
\begin{eqnarray}
 \alpha u\left[j \right] + \frac{ \beta \lb  u\left[ j+1 \right] - u\left[ j-1\right] \rb }{2h}  = g\left[ j \right] + O \lb h^2 \rb 
\label{eqn:fdcb}
\end{eqnarray}
We see that this equation couples the terms at $j-1$ and at $j+1$, although
the point at $j-1$ does not exist in the domain. 
An extra point at this location is then introduced. 
By introducing
another point, we are introducing another unknown, for which we need another
equation.  There is no problem with this since the usual method
for solving this problem  is to apply the 
interior equation~(\ref{eqn:1dfdc}) on the 
boundary.  Using these two equations, we can solve for the 
boundary value, $u[j=1]$
as follows
\begin{eqnarray}
\frac{ \lb  u[j+1] + u[j-1] - 2u[j] \rb }{h^2} = f[j]  + O \lb h^2 \rb  \nonumber \\
u[j-1] = h^2 \lb f[j] \rb + 2u[j] - u[j+1]   + O \lb h^2 \rb  \nonumber \\ 
\beta \frac{2u[j+1]-2u[j]-h^2 f[j]}{2h}+\alpha u[j] = g[j]  + O \lb h^2 \rb \nonumber \\
u[j]=\frac{h}{-\beta+\alpha h} \lb  \frac{h}{2} \beta f[j] + g[j] - \beta h^{-1} u[j+1] \rb +O \lb h^2 \rb 
\label{eqn:1dfdbi}
\end{eqnarray}
Figure~\ref{fig:3.2} shows a picture of this situation.

\begin{figure}
\caption{ The discretized domain, with the addition of an extra point.}
\label{fig:3.2}
\begin{flushleft}
\input{f32.tex}
\end{flushleft}
%\vskip 1in
\end{figure}




The equation for $u[j]$ is also  not always diagonally dominant.
In this case we obtain the condition for diagonal dominance 
$$  h \geq  \frac{ 2 \vert \beta \vert }{\vert \alpha \vert } $$ 
Since  $h$ is usually very small, this condition will not be met in general.
We also see that we will not be able to apply 
centered differencing all the time in multiple dimensions, since there are
occasions where we must introduce two or more points, and we only have
one extra equation.  We might think that we can generate extra equations
by saying that the function is smooth across the boundary, {\sl i.e}, 
\begin{eqnarray}
u[j] = \HALF \lb  u[j-1] + u[j+1] \rb 
\end{eqnarray}
But we will now try to evaluate a first derivative
using this averaging condition 
at the location of  $u_2$ shown in  Figure~\ref{fig:fdav}.
We need to consider this case when we look at problems such as the one in
Section~\ref{EXTRAP}, where we are using
Adaptive Mesh Refinement (AMR) techniques.  
The first derivative is evaluated using
\begin{eqnarray}
u \lb x+h \rb  = u + h u_x + \frac{h^2}{2} u_{xx} + \frac{h^3}{6}u_{xxx} + O \lb h^4 \rb  \nonumber \\ 
u \lb x-h \rb  = u - h u_x + \frac{h^2}{2} u_{xx} - \frac{ h^3}{6}u_{xxx} + O \lb h^4 \rb  \nonumber \\ 
\frac{ u \lb x+h \rb  - u \lb x-h \rb }{2h} = u_x + \frac{h^2}{6}e_3 + O \lb h^4\rb  \nonumber \\
\frac{ u \lb x+h \rb  + u \lb x-h \rb }{2}  = u + \frac{h^2}{2} e_2 + O \lb h^4 \rb 
\end{eqnarray} 
thus, we use
\begin{eqnarray}
u_x &=& \frac{ u_s - u_1}{2 h} - \frac{ h^2}{3} e_3 \nonumber \\
u_s &=& \frac{ u_3 + u_4}{2} - \frac{H^2}{2} e_2
\end{eqnarray}
where $H=2h$,which shows that the equation that would be used for the stencil,
\begin{eqnarray}
u_x &=& \frac{ \frac{u_3 + u_4}{2} - u_1}{2h} - \frac{H}{4} e_2 - \frac{h^2}{6} e_3 \nonumber \\
u_x &=& \frac{ \frac{u_3 + u_4}{2} - u_1}{2h} + O \lb  H \rb  
\end{eqnarray}
is first order.

\begin{figure}
\caption {Trying to get $O \lb h^2 \rb $ results from averaging.}
\label{fig:fdav}
\begin{center}
\input{fdav.tex}
\end{center}
\end{figure}


The second method is to apply  boundary equations to the boundary
points, a scheme that we use when we try to solve the system using
multigrid techniques, since we treat interior equations
separate from boundary equations.  This does not mean that we can not use 
a multigrid technique to solve the system in the first method, but rather
we will only use the second method when we use multigrid techniques.
Thus, we use the equation 
\begin {eqnarray}
\frac{4u[j+1] - u[j+2] - 3u[j]}{2 h} &=& u_x \nonumber \\ 
\alpha u[j] + \beta \frac{4u[j+1] - u[j+2] - 3u[j]}{2 h} &=& g[j] \nonumber \\ 
\end{eqnarray}
for the boundary value.  
Once again we run into problems.
Notice that this stencil will not be diagonally dominant in general, 
and that we are including more points in the stencil. Through 
experience, we have learned that trying
to come up with diagonally-dominant second order stencils around the boundary,
especially in higher dimensions, is a ``no win'' situation.
\footnote{ We do not imply that one can not
come up with a scheme that will give them second order convergence.  What we
are saying is that one {\em could} get into trouble solving these equations.} 

In Figure~\ref{fig:3.4} the boundary lies between two grid
points, a situation we refer to as ``straddling'' the boundary.
In order to derive a second order stencil at
this point, notice that we have no use
for the interior equation, {\sl i.e. }  all we must do is define a set of 
Taylor expansions around the boundary point.  We use 
\begin{eqnarray}
u_b \equiv u \lb a-h+\xi \rb  &=& u \lb a \rb  + \lb \xi-h \rb  u_x + \HALF \lb \xi-h \rb ^2 u_{xx} + O \lb h^3 \rb \nonumber \\
u_1 \equiv u \lb a+\xi \rb    &=& u \lb a \rb  + \xi u_x +  \HALF \xi^2 u_{xx} + O \lb h^3 \rb \nonumber \\ 
u_2 \equiv u \lb a+h+\xi \rb  &=& u \lb a \rb  + \lb h+\xi \rb  u_x + \HALF \lb h+\xi \rb ^2 u_{xx} + O \lb h^3 \rb  
\end{eqnarray}
to obtain
\begin{eqnarray}
u_x =  \frac{ h-2 \xi}{2 h^2} u_2 + \frac{2 \xi}{h^2} u_1 + \frac{-h-2 \xi}{2h^2} u_b 
\end{eqnarray}
which is valid to second order, and we use
\begin{eqnarray}
u_b \equiv u \lb a+\xi-h \rb  &=& u \lb a \rb +  \lb \xi-h \rb  u_x  \nonumber \\
u_1 \equiv u \lb a+\xi \rb    &=& u \lb a \rb  + \xi u_x 
\end{eqnarray}
to obtain
\begin{eqnarray}
u \lb a \rb = \frac{ \xi}{h} u_b + \frac{ h - \xi}{h} u_1 . 
\end{eqnarray}
Thus, our boundary condition becomes
\begin{eqnarray}
g&=& \alpha \lb \frac{ \xi}{h} u_b + \frac{ h - \xi}{h} u_1 \rb + \beta \lb 
 \frac{ h-2 \xi}{2 h^2} u_2 + \frac{2 \xi}{h^2} u_1 + \frac{-h-2 \xi}{2h^2} u_b
\rb \nonumber \\
&=& \frac{ 2 \alpha \xi h - \beta \lb  h + 2 \xi \rb  }{2 h^2} u_b +
 \frac{ \alpha \lb h-\xi \rb h + 2 \xi \beta}{h^2} u_1 +
 \frac{ \beta \lb  h - 2 \xi \rb  }{2 h^2} u_2 .  
\end{eqnarray}

Thus we see that
there is considerable complexity involved with deriving second order
stencils for
boundary points of this type, and the extensions into multiple dimensions
clearly suggest we abandon these techniques.

Our alternative approach is to discretize the boundaries only up
to $O \lb h \rb $ and then use deferred correction, discussed in chapter 4 of
this text, to get a solution which will be second order accurate on the boundaries.  
We can easily get a first order version of our boundary equation using forward 
differencing as
\begin{eqnarray}
u_x &=& \frac{ \lb  u_1 - u_b \rb }{h} \nonumber \\ 
g&=& \lb  \alpha - \frac{\beta}{h} \rb  u_b + \frac{\beta}{h} u_1
\end{eqnarray}
We see that as $h \rightarrow 0$ this stencil becomes diagonally dominant.  
\begin{figure}
\caption{ The discretized domain, where we ``straddle'' the boundary.}
\label{fig:3.4}
\centerline{\psfig{figure=f34.ps}}
\end{figure}
\subsection[Two dimensional boundary finite differencing]{Two dimensional boundary finite differencing}
\label{2D-boundary}
Our approach to finite differencing in one dimension is general enough
that we can apply these principles to multiple dimensions very 
easily. In Figure~\ref{fig5.1} we show the difference between
two types of boundaries. Boundary type one is defined such that
there are no grid points defined in two directions.  Once such point
in the figure is the corner point of the points surrounded by diamonds.
Boundary type
two has one point undefined in all four directions, which is shown
by the center point surrounded by circles. The boundary
condition that we will apply is again a general mixed boundary condition
\begin{eqnarray}
\alpha u_x + \beta u_y + \gamma u = g
\end{eqnarray}
Now we derive a stencil for the equation represented by the point centered  
by the circles . 
We can finite difference $ u_x $ to second order by applying
centered differencing in the $x$ direction,
yet we can not apply centered differencing in the $y$ direction.
\footnote{
We reproduced this discussion from  chapter 5, to aid in the current discussion.
}
We use the interior condition to solve for the  point in the $y$ direction,
and then end up 
with a second order stencil involving just four points. 
We have problems on boundaries
of type 1, since there are two points undefined.  For these two
points we need two extra equations. One equation will come from
the interior equation.  The other equation could come from an averaging
condition,  
$$\HALF u[j+1] + \HALF  u_i[j-1] - u[j] = 0 , $$
 to obtain another equation but this
equation will result in an overall stencil which will be only first
order accurate as we have shown previously.  
A better approach is to apply center differencing 
in only one of the directions, and
apply second order forward differencing in the other direction.
We do this by first applying center differencing in the $x$ direction
for the diamond points in Figure~\ref{fig5.1} by introducing an extra
point, and equation,  in the $x$ direction.  We then apply forward differencing
to second order in the $y$ direction.
To extend this principle in three dimensions,
we might have to apply  center difference in one direction
and forward and backward differencing
in the other directions.  This leads to 9 point stencils in three
dimensions.

Our approach in two dimensions has assumed that the discretized 
boundary points conformed to the physical boundaries.  We need to 
develop a formalism when this is not the case.  In the paper by
Cook\cite{CookKlasky} {\em et al.},
we saw that the Cartesian algorithm had a serious flaw in this regard.
It assumed that the physical boundary conformed to the discretized
boundary points.  
We feel that the derivations of the correct equations are much to complex
to pursue.
Thus, we feel the best approach is to apply first order finite differencing
on the boundaries, and second order finite differencing on the interior, and
then use deferred correction on the boundaries to get higher order results
\cite{ChoptuikPR}.

\section [Basic iterative solvers] {Basic iterative solvers}
\label{Basic-Iterative-Solvers}
In this section we will discuss how to solve large linear algebraic 
equations which result from finite differencing PDE's.
It is our feeling that direct solvers are inferior
to iterative solvers for solving most, if not all,  physical processes,
resulting from elliptic PDE's in
multiple dimensions.\footnote{Of course, for one dimensional problems, direct
solvers are at least as efficient
as the best iterative solvers, if not more efficient.}
This is due to to the fact that factoring a matrix, $A$,  arising from a
finite difference scheme involves the phenomenon of fill-in. The upper
and lower triangular factors will in general have non-zero elements which are
zero in the corresponding positions of the original matrix.
A lot of work has been devoted to designing algorithms which reduce the
fill-in since the operations needed to perform the factorization, as well
as the memory storage required, depend on the number of non-zeros in the
upper and lower triangular matrices\cite{George1973}\cite{George1981}.

We will typically use direct methods {\em only} when the iterative
methods will not converge. ( Sometimes in a multigrid
algorithm\footnote{Multigrid is discussed in Chapter~\ref{MLAT}.}
the equations will not converge.  We must therefore use direct 
techniques to solve the system, which for multigrid techniques, will only
be used only very small systems ($n$ is small).)
 
Since we did not have to use direct methods for the problems in this dissertation,
we will only discuss iterative methods in this section.
There are many textbooks on iterative methods and we do not attempt to provide
a complete coverage of the topic. ( See, for example Varga\cite{Varga} and
Young\cite{Young}) .\footnote{We will follow Choptuik's discussion of
iterative methods\cite{Choptuik_masters}.}
We wish only to highlight some areas that
we feel will be useful for the reader, and will help in formulating the
multigrid approach. 

\subsection[Linear equations]{Linear equations}
\label{Linear-Equations}
Let
\begin{eqnarray}
\label{STS}
A u = f
\end{eqnarray}
denote a system of $n$ linear equations such as those represented by 
equation~(\ref{eqn:2dexample}) so that  $A$ is 
a  $n \times n$ (generally sparse) matrix.\footnote{ A sparse matrix
is defined as a matrix which has more zeros 
than non-zeros in the array elements.} 
We will typically compare the various iterative methods used in this
dissertation by examing the number of operations, $N=n^2$ , required
to solve the system of equations.\footnote{
An operation will typically be a multiplication, division, or addition
of two floating point numbers.}
 
In an iterative method for solving~(\ref{STS}), a series of iterates
$u^{\lb n \rb}$ is generated, such that
\begin{eqnarray}
\lim_{n \rightarrow \infty} u^{\lb n \rb} = u
\end{eqnarray}
where we start with some initial estimate, $ u^{\lb 0 \rb}$ of the solution.
Iterative methods, in principle, require an infinite number of 
operations to determine $u$.  In practice, the solution is generally 
terminated when $u^{\lb n \rb}$ is ``close'' to $u$.

A common method used to  monitor the convergence of the solution is to
compute 
at each iteration, the residual vector $r^{ \lb n \rb }$ defined by
\begin{eqnarray}
\label{reqn}
r^{ \lb n \rb } \equiv A u^{\lb n \rb} - f .
\end{eqnarray}
Now if the iteration converges, then
\begin{eqnarray}
\lim_{n \rightarrow \infty} r^{\lb n \rb }= 0 .
\end{eqnarray}
We then define the stopping criterion when
\begin{eqnarray}
\Vert r^{ \lb n \rb } \Vert \leq \epsilon
\end{eqnarray}
where  $\Vert \cdot \Vert$ denotes some discrete norm and $\epsilon$ is
a convergence criterion, which is usually given before the iteration process
begins. 

The error vector $e^{ \lb n \rb }$ of the n$^{th}$ iteration is defined by
\begin{eqnarray}
e^{ \lb n \rb } \equiv u^{ \lb n \rb } - u
\end{eqnarray}
Now notice that by the uniqueness of the solution $u$, $ r = 0$ if
and only if $ e = 0 $.  But it may not be true that, when the norm of $r$ is
small, the norm of $e$ will be too.  This is then a measure of the 
conditioning of the system. 
\footnote{
The condition number, cond$ \lb A \rb $, of the
matrix, provides a measure of how ``close'' the matrix is to being
numerical singular.
\begin{eqnarray}
{\rm cond}  \lb A \rb  \equiv \Vert A \Vert~~\Vert A^{-1} \Vert \quad 1 \leq {\rm cond} \lb A \rb  \leq \infty 
\end{eqnarray}
where $\Vert \cdot \Vert$ denotes any vector norm.
When cond$ \lb A \rb $ is very large, $A$ is aid to be ill-conditioned.
}
From~(\ref{STS}) and (\ref{reqn}) we observe
 the following relation between the error and 
the residual:
\begin{eqnarray}
  A e = r
\end{eqnarray}
which is known as the residual equation.

Iterative methods are characterized by the manner which the new iterate 
is calculated from previous iterates. 
A general class of iterative methods may be defined by\cite{Young}
\begin{eqnarray}
u^{ \lb n+1\rb } = G^{\lb n \rb } \lb u^{ \lb n\rb},u^{(n-1)},\cdots,u^{ \lb 0 \rb } \rb  + c^{ \lb n \rb}, 
\end{eqnarray}
where $G^{ \lb n \rb }$ is an operator which can change from iteration to iteration
as could the vector $ c^{ \lb n \rb }$.  
We will only deal with methods where $G^{ \lb n \rb }$ is linear, constant 
and only operates on the current solution estimate, and where
the vector $c^{ \lb n \rb }$ is also constant.
In this case we rewrite the previous equation as 
\begin{eqnarray}
u^{ \lb n+1 \rb } = Gu^{ \lb n \rb } + c
\end{eqnarray}
where $G$ is known as the amplification matrix.
We can now see that
\begin{eqnarray}
e^{ \lb n \rb } &=& G^{ \lb n \rb } e^{ \lb 0 \rb }  \nonumber \\
        &=& G^{ \lb n \rb } \lb u^{\lb 0 \rb } - u \rb
\end{eqnarray}
where $G^{ \lb n \rb }$ is the n$^{th}$ power of the amplification matrix.
Thus, the iterative procedure will converge if
\begin{eqnarray}
\lim_{n \rightarrow \infty} \Vert e^{ \lb n \rb} \Vert &=& \lim_{n \rightarrow \infty} \Vert G^{ \lb n \rb } u^{\lb 0 \rb } \Vert \nonumber \\
&=& 0
\end{eqnarray}

To determine whether or not the iterative method will converge,
we examine the spectral radius, $\rho \lb G \rb $, of $G$, defined by
\begin{eqnarray}
\rho \lb G \rb  \equiv \max_{i} \vert \lambda_i \lb G \rb \vert
\end{eqnarray}
where $\lambda_j \lb G \rb $ are the eigenvalues of $G$. In order for the method to 
converge, we must have $\vert \lambda_i \vert < 1$ for all $i$.
An important
aspect of the spectral radius is that it will tell you how fast the system will
converge.  
In general
\begin{eqnarray}
\lim_{n \rightarrow \infty} \frac{\Vert e^{ \lb k+1  \rb } \Vert }{ e^{ \lb k \rb } }= \rho \lb G \rb  .
\end{eqnarray}
We can now define an asymptotic rate of convergence, $\rho_{\rm R}$ as
\begin{eqnarray}
\rho_{\rm R} = \log_{10} \lb \rho \lb G \rb^{-1} \rb
\end{eqnarray}
where the reciprocal of $\rho_{\rm R}$ is the number of iterations which must be
performed in order to reduce the error by a factor of ten.

Since for any but the very simplest iterative schemes, the explicit form
of the amplification matrix becomes very complicated, we will describe the
iterative methods in a manner which is closer to the way they are implemented.

We will now discuss two general iterative techniques which will prove
useful in studying the multigrid technique in Chapter~\ref{MLAT}.
Both of these methods are used to solve equation~(\ref{STS}),
but we will in general look at the solution of equation~(\ref{eqn:1dfde}).

\subsection[Jacobi iteration]{Jacobi iteration}
\label{Jacobi}
The first method that we look at is called the Jacobi iteration, which
results from visiting each grid point in succession, changing the value
of each unknown so that, using the required neighboring values from the
previous iteration, the local difference equations are satisfied.
Thus, the Jacobi iteration for the $j^{th}$ equation of~(\ref{eqn:1dfde}) 
is defined by
\begin{eqnarray}
u[j]^{ \lb n+1 \rb } = \HALF  \lb  u[j-1]^{ \lb n \rb } + u[j+1]^{ \lb n \rb } - h^2 f[j]  \rb,
\quad\quad\quad 1 \le j \le N -1  .
\label{eqn:jacobinw}
\end{eqnarray}
There is a simple modification which can be made to the 
Jacobi iteration. 
As before, we compute the new Jacobi 
iterate using equation~(\ref{eqn:jacobinw}),( which we will refer to as $u[j]^{ \lb * \rb }$ ),
where however $u[j]^{ \lb * \rb }$ is now only an intermediate value.  The
new approximation is given by the weighted average 
\begin{eqnarray}
u[j]^{ \lb n+1 \rb } = \lb 1 - \omega \rb  u[j]^{ \lb n \rb } + \omega  u[j]^{ \lb * \rb }  ,
\quad\quad\quad  1\le j\le N -1 
\label{dampedjacobi}
\end{eqnarray}
where $\omega$ is a real, freely specified weighting factor.
This last equation, which defines the weighted Jacobi method
can be rewritten in terms of the residual vector, $r^{ \lb n \rb }$
\begin{eqnarray}
u[j]^{ \lb n+1 \rb } =  u[j]^{ \lb n \rb } - \omega D^{-1} r^{\lb n \rb }
\end{eqnarray}
Here $D$ is the main diagonal of $L$, so $D^{-1} =  I {h^2}/2 $,
where $I$ is the $ n \times n$ identity matrix.
The eigenvalues of the weighted Jacobi method, are well 
documented  \cite{Briggs}\cite{ChoptuikGRG} and are given by  
\begin{eqnarray}
\lambda_j \lb G_\omega \rb  = 1 - 2 \omega \sin^2 \lb \frac{j\pi}{2N} \rb , 
\quad\quad\quad  1\le j\le N-1 
\end{eqnarray}
The modes in the lower half of the spectrum, with wavenumbers in the range
$1 \leq k \leq N/2  $, are low-frequency or smooth modes.  The
modes in the upper half of the spectrum, will be called high-frequency or
oscillatory modes.

If we now replace $N$ by $h^{-1}$ ( since $Nh=1$)
in the above equation, and expand the
$\sin$ term to $O \lb h^2 \rb $
we determine  that the eigenvalue associated with the smoothest mode, 
( {\sl i.e.}
when $j=1$ ) , is 
$$ \lambda_{1} = 1 - 2 \omega  \sin^2  \lb  \frac{\pi h}{2} \rb  
= 1 - \frac{\omega \pi^2h^2}{2} + O \lb h^4 \rb  = 1 + O \lb h^2 \rb $$ 
Clearly, for small $h$ this eigenvalue is
approximately 1,  and therefore, the convergence of the 
iteration will be very slow.
On the other hand, for the high-frequency mode corresponding
to $j = N - 1$, we have
$$ \lambda_{N-1} = 1 - 2 \omega  \sin^2 \lb  \frac{\pi \lb N-1 \rb }{2 N} \rb 
 \approx 1 - \frac{\omega \pi^2}{2}$$
which is clearly much less than 1.\footnote{
Unless $\omega$ was extremely small. Since if $\omega$ is small 
then clearly convergence must be small at all wavelengths.}
Thus, high frequency components
are damped much faster than the low frequency components, 
and this is a property shared by many iterative schemes.
In the next chapter we will study these eigenvalues further, and in
Chapter~\ref{TEST1},
 for pedagogical purposes, we shall briefly discuss the
application of the Jacobi method to a model problem.

Besides the fact that the Jacobi method is an extremely poor solver for 
elliptic equation, we see that it also requires storage of the current 
iteration variables, as well as storage for the  previous iteration.  We
see that this drawback can be overcome by the Gauss-Seidel Method: 
if the Jacobi method converges, then, in general, $u^{ \lb n+1 \rb }$ will be
a better estimate of $u$ than $u^{ \lb n \rb }$.  This suggests
that an improvement
on the Jacobi iteration might result by using newly calculated
quantities whenever possible in the course of an iteration.  

\subsection[Gauss-Seidel and SOR iteration]{Gauss-Seidel and SOR iteration}
\label{Gauss-Seidel}
Perhaps a more familiar iteration method is the Gauss-Seidel method.  This 
method may be viewed as a simple modification of the Jacobi method 
whereby most-recently-computed components, $u[j]^{ \lb n+1 \rb }$, are used whenever
possible. This is an intuitive modification, since
if the Jacobi method converges, then $u[j]^{ \lb n+1 \rb }$ will be a 
better estimate of $u[j]$ than $u[j]^{ \lb n \rb }$.  
As just mentioned, this also reduces
memory requirements since during the Jacobi iteration
we must provide storage for all of the $u[j]^{ \lb n \rb }$ and $u[j]^{ \lb n+1 \rb }$
(two vectors of length $N$) whereas for the Gauss-Seidel
we ``overwrite'' $u[j]^{ \lb n \rb }$ with $u[j]^{ \lb n+1 \rb }$.
Up to now we have assumed that the components of $u$ are updated in
ascending order, commonly known as lexicographic order.
For the weighted Jacobi method, the order does not matter
since components are never over-written.  However, for the Gauss-Seidel
method, the order of updating is significant.  Instead of sweeping through the
components in ascending order, we could sweep through the unknowns using
the reverse order
or we could even alternate between the two, which is known as symmetric
Gauss-Seidel.  Another very important method results from 
first updating all the even components, and then updating all the odd
components. This ordering, Red-Black, gets it's name from two dimensional
applications.
One  significance of the ordering is for their implementation
on a parallel or vector computer.   The Red-Black ordering allows the 
method to be highly vectorizable, which
is not true about lexicographical ordering.
There are other ramifications of using
Red-Black order, particularly for multi-grid.

For our model problem, equation~(\ref{eqn:1dfde}),
the Gauss-Seidel iteration can be expressed as
\begin{eqnarray}
u[j]^{ \lb n+1 \rb } = \HALF \lb  u^{ \lb n+1 \rb }[j-1] + u^{ \lb n \rb }[j+1] - h^{2} f[j] \rb , \quad 1 \le j \le N -1 
\label{eqn:1dgs}
\end{eqnarray}

Let us now look at the eigenvalue structure of the amplification matrix
for the Gauss-Seidel method. Let us assume that the system we are going
to look at is defined by the finite difference equations given in
equation~(\ref{eqn:1dfdc}) for the interior points, and that there are a total
of five points in the domain, three interior points, and two boundary points.
Let us also assume that we apply boundary conditions:
\begin{eqnarray}
\alpha u_x + u = g \vert_{x = 0} \nonumber \\
u \lb x_N \rb  = u[N]
\end{eqnarray}
The equation at $x=0$ is then finite differenced to
\begin{eqnarray}
\epsilon u[1] +  \lb  1 - \epsilon \rb u[0] = g
\end{eqnarray}
where $\epsilon \equiv \alpha/h$.  Once again we write our system of
equations as
\begin{eqnarray}
 A u = f \nonumber
\end{eqnarray}
where now $ A $ is given by
\begin{eqnarray}
A=\left( \matrix{ 1-\epsilon&\epsilon& 0  &  0  \cr
                -1         &     2  & -1 &  0  \cr
                 0         &    -1  &  2 & -1  \cr
                 0         &     0  & -1 &  2  \cr}\right).
\end{eqnarray}
We now break ${ A}$ into upper-- and lower--triangular matrices
${ U}$ and ${ L}$:
\begin{eqnarray}
{U}=\left(\matrix{ 0         &\epsilon& 0  &  0  \cr
                 0         &     0  & -1 &  0  \cr
                 0         &     0  &  0 & -1  \cr
                 0         &     0  &  0 &  0  \cr}\right). \nonumber 
\end{eqnarray}
\begin{eqnarray}
{L}=\left(\matrix{ 1-\epsilon&     0  & 0  &  0  \cr
                -1         &     2  &  0 &  0  \cr
                 0         &    -1  &  2 &  0  \cr
                 0         &     0  & -1 &  2  \cr}\right). \nonumber 
\end{eqnarray}
so that $ { A} = { L} + { U} $.  
A particular Gauss-Seidel iteration for our equations is the given by:
\begin{eqnarray}
{L} u^{n+1} + { U} u^{ \lb n \rb } = f
\end{eqnarray}
or 
\begin{eqnarray}
 u^{ \lb n+1 \rb }  =  { L^{-1}} \lb  f - { U}  u^{ \lb n \rb } \rb  
\end{eqnarray}
The best way to look at the convergence 
properties of iterative solvers is to look at the amplification matrix
defined from the residual equation.  So, 
\begin{eqnarray}
 r^{ \lb n+1 \rb } &=&  \lb  { L} + {U} \rb   u^{ \lb n+1 \rb } - f \nonumber \\
&=& \lb  { L} + { U} \rb { L^{-1}} \lb  f - { U}  u^{ \lb n \rb } \rb  - f \nonumber \\
&=& f - { U}  u^{ \lb n \rb } + { U} { L^{-1}} f -  { U} { L^{-1}} { U}  u^{ \lb n \rb } - f \nonumber \\
&=& {U} { L^{-1}} \lb  f -  { U}  u^{ \lb n \rb } -  { L}  u^{ \lb n \rb } \rb \nonumber \\ 
&=& { U} { L^{-1}} \lb  f - \lb  { L} + { U} \rb  u^{\lb n \rb } \rb  \nonumber \\
&=& - { U} { L^{-1}}  r^{ \lb n \rb }
\end{eqnarray}
Thus,
\begin{eqnarray}
 r^{ \lb n+1 \rb } = { G}  \, r^{ \lb n \rb }
\end{eqnarray}
where
${ G} \equiv - { U} { L^{-1}}$ is the amplification matrix ( but different from
$G$ defined previously.
In particular, for our model problem we have
\begin{eqnarray}
{ G}=\left(\matrix{
   -\HALF \frac{\epsilon}{\epsilon-1}&\frac{\epsilon}{2} & 0 &  0  \cr
      \frac{1}{4}\frac{1}{\epsilon-1}&\frac{-1}{4}  &  \HALF &  0  \cr
      \frac{1}{8}\frac{1}{\epsilon-1}&\frac{-1}{8}  &  \frac{-1}{4} & -\HALF \cr
       0         &     0  &  0 &  0  \cr}\right). 
\end{eqnarray}
Now, the eigenvalues are
\begin{eqnarray}
0 \quad, 0 \quad , \HALF \frac{8 \epsilon - 4 + 4 \sqrt{2 \epsilon^2 - 2 \epsilon + 1}}{8 \epsilon - 8} , \HALF \frac{8 \epsilon - 4 - 4 \sqrt{2 \epsilon^2 - 2 \epsilon + 1}}{8 \epsilon - 8} 
\end{eqnarray}
We see that when once $\epsilon$ becomes
a little greater than ( 1 /2 ), the spectral radius, $\rho \lb G \rb $, is greater
than 1
which means that the system will not converge .  
We also see that as $\epsilon$ becomes larger than zero, the 
eigenvalues will move closer to one.  This signifies that the 
Gauss-Seidel iteration will take a much longer time than if 
$\epsilon = 0$.
 
Because the above methods solve for one new function value at a time, they
are often referred to as point-relaxation methods.  Another class of 
relaxation methods involves the simultaneous update of a group of unknowns.
For example, if we were working in two dimensions and divided up the $y$
axis into $M$ lines,  one could then solve the system of equations~(\ref{eqn:1dgs}) 
simultaneously for all the points that are on the same line.
We can then extend the red-black idea to lines, resulting in so-called
``zebra'' solvers.  

Researchers\cite{Young} who used the Gauss-Seidel
method for solving systems of 
difference equations discovered that convergence could be accelerated by 
modifying the iteration so that
\begin{eqnarray}
\label{SOReqn}
u[j]^{ \lb n+1 \rb } = \omega \   { u[j]^{\star} } +  \lb 1 - \omega \rb  u[j]^{ \lb n \rb }
\end{eqnarray}
where $u[j]^{\star} $ is determined by the right hand side of~(\ref{eqn:1dgs}),
and $\omega$ is called the relaxation parameter.  If $ 0<  \omega < 2$, then
the above defines the well-known successive over-relaxation (SOR) iteration
which incorporates the Gauss-Seidel iteration as a special case when
$ \omega = 1$.  Typically,  for large elliptic systems
the S.O.R. method requires fewer operations
than the previous methods \cite{Young}.

In general, it is
quite difficult to get an optimal value of $\omega$, so one must do some
numerical experimentation or use some sort of adaptive procedure which attempts
to estimate the optimal $\omega$ in the course of the solution process. 

\subsection[Interpolation, extrapolation and determination of derivatives to high order]{Interpolation, extrapolation and determination of derivatives to high order}
\label{IntExtrapHO}

We will see in the next chapter, that in order to use deferred correction, we
will need to determine approximate values for a function and its derivatives
at spatial locations not coincident grid points.  
We  use polynomial interpolation for their evaluation.
We determine the function values to 
be interpolated, along with their derivatives via straightforward
Taylor series expansion.  This method is not unique in any sense.
 
Since we deal with lattices, and the finite difference
equations were derived from truncated Taylor series expansions, it becomes
natural to think of the interpolation as just using another Taylor expansion
to determine the value of the function.  Let's suppose our computational domain
is again shown in Figure~\ref{fig:3.4}, and we wish to determine the
first derivative to fourth order, and the function value at this boundary
point to fourth or higher order.\footnote{We use this derivation in 
Section~\ref{Fc1dnd}.}
 We may at first write down the Taylor 
expansion for the point $u_b$ which would make the first derivative fourth
order accurate, { \sl i.e.}, we write
\begin{eqnarray}
 u_b &=& u \lb a -  \lb h-\xi \rb \rb  \nonumber \\
 &=& u +  \lb \xi-h \rb  u_x + \HALF  \lb \xi-h \rb^2 u_{xx} + \frac{1}{6} \lb \xi-h \rb ^3 u_{xxx} \nonumber \\
&+& \frac{1}{24}  \lb \xi-h \rb^4 u_{xxxx} + O \lb h^5 \rb ,
\end{eqnarray} 
which shows that the first derivative is determined up to fourth order,
\begin{eqnarray}
u_x &=& \frac{1}{\xi-h} \Lc u_b - u - \HALF  \lb \xi-h \rb ^2 u_{xx} \nonumber \\
&-& \frac{1}{6}  \lb \xi-h \rb^3 u_{xxx} - \frac{1}{24} \lb \xi-h \rb^4 u_{xxxx}\Rc  + O \lb h^4 \rb 
\end{eqnarray}
There are 5 points which we need in order to determine the first derivative to
fourth order.  Our basic algorithm to find the first derivative up to 
fourth order, and the function interpolated value, is broken up into 2 parts.
Our algorithm finds the matrix values used in the
Taylor expansions and then performs a LUD decomposition\footnote{ LUD
decomposition is described in Numerical
 Recipes\cite{Numerical-Recipes}.}.  This routine
is called only in the beginning of the programs since it is a $O \lb N^3 \rb $ operation  \cite{Numerical-Recipes}.  The next part of the algorithm
performs the backwards substitution
when the function and/or the derivative is needed to be determined. This
is an order $O \lb N^2 \rb $ operation.  

For multiple dimensions we use the same algorithm although the number of
terms in the matrix is greatly increased.  For example, the expansion used in 
three dimensions is
\begin{eqnarray}
\lefteqn{f \lb  x + \alpha,y+\beta,z+\gamma \rb  = f +\alpha f_x + \beta f_y
+\gamma f_z\nonumber} \\
& & + \HALF  \lb  \alpha^2 f_{xx} + \beta^2 f_{yy} +\gamma^2 f_{zz}  \rb  
+ \alpha \beta f_{xy} + \alpha \gamma f_{xz} +\beta \gamma f_{yz} \nonumber \\
& & +  \frac{1}{6}  \lb  \alpha^3 f_{xxx} + \beta^3 f_{yyy} +\gamma^3 f_{zzzz} \rb 
+ \HALF \Lc \alpha^2 \beta f_{xxy} +\alpha^2 \gamma f_{xxz} + \alpha \gamma^2 f_{xzz} \nonumber \\ 
& & +\alpha \beta^2 f_{xyy} + \beta^2 \gamma f_{yyz} +\beta \gamma^2 f_{yzz} \Rc
+ \alpha \beta \gamma f_{xyz} +\frac{1}{24} \Lc  \alpha^4 f_{xxxx} +\beta^4 f_{yyyy} \nonumber \\
& & + \gamma^4 f_{zzzz} \Rc +\frac{1}{6} \Lc  \alpha^3 \beta f_{xxxy} + \alpha^3 \gamma f_{xxxz} 
+\alpha \beta^3 f_{xyyy} + \beta^3 \gamma f_{yyyz} 
+\alpha \gamma^3 f_{xzzz} \nonumber \\
& & + \beta \gamma^3 f_{yzzz} \Rc  +\frac{1}{4} \Lc  \alpha^2 \beta^2 f_{xxyy} + \alpha^2 \gamma^2 f_{xxzz} \nonumber \\
& & + \beta^2 \gamma^2 f_{yyzz} \Rc  + \HALF \Lc  \alpha^2 \beta \gamma f_{xxyz}
+\alpha \beta^2 \gamma f_{xyyz} + \alpha \beta \gamma^2 f_{xyzz} \Rc  
\end{eqnarray}
which uses 35 points in the stencil!

Now extrapolation involves the same principles as interpolation.
We only extrapolate for points which are $O \lb h \rb $ from the
actual computational domain.

We have seen most of the basic components of the numerical methods that we
use in this dissertation.  In the next chapter, we will use some of these
components to describe the MLAT  method as well with deferred correction
and Richardson extrapolation.

%**************************************************************************
\cleardoublepage
%**************************************************************************
\chapter[Multi level adaptive techniques]{Multi level adaptive techniques} 
\label{MLAT}
The main purpose of this chapter is to provide a brief introduction to multigrid
methods and the essential ingredients used in their development. This chapter
will also introduce the standard multigrid notation, which will be widely used
in later chapters.  We also introduce the techniques of
Richardson extrapolation, deferred correction and AMR since we feel these techniques 
work extremely well in the context of a multigrid algorithm. 
We in no sense give a complete overview of multigrid,
for we feel there are many excellent papers on this subject.  Good sources
of reference include Brandt's excellent 1977 paper\cite{Brandt1977},
Brandt's Guide to multigrid development\cite{Brandt1982}, along with
Briggs' multigrid tutorial\cite{Briggs} and 
Choptuik and Unruh's paper in General Relativity
and Gravitation\cite{ChoptuikGRG}.

\section[Philosophy]{Philosophy}
\label{Philosophy}
The basic idea of multigrid  is to work
with a sequence of grids, where each coarser grid helps accelerate the
convergence of the finest grid. This is only half the picture for Multi
Level Adaptive Techniques, MLAT: the other half is that we
use the solution of a coarse grid problem as an initial guess of the fine
grid problem.
Multigrid algorithms use a series of discretization levels $l = 0 , \ldots , \LMAX$
where $l=0$ is the coarsest level,
and $\LMAX$ is the finest and $h_l = 2 h_{l+1}$.

This is only half of the picture for Multi Level Adaptive Techniques, where the
other half is that we use finer discretizations only where
they are needed.        

Our basic philosophy is to follow
Brandt's golden rule\cite{Brandt1982}
\begin{quotation}
  \bf{
  The amount of computational work should be proportional to the 
  amount of real physical changes in the computed systems.
  }
\end{quotation} 
Thus, algorithms that require more than $O \lb N \rb  $ operations 
to solve  a discrete system of $O \lb N \rb $ equations 
are working too hard to extract 
the physics of the problem, and therefore should be discouraged. 
We use multigrid for three reasons.  The first reason is that it does
obey Brandt's golden rule, since it is a $O \lb N \rb $ solver.  The second reason
we use multigrid is that it provides us with a natural way of incorporating
adaptive meshes along with many other advanced techniques,
such as deferred correction and Richardson 
extrapolation.  The final reason is that multigrid methods
provide natural stopping criterion used for  
determining when a problem should be considered solved.
The other ``classical'' methods such as S.O.R. are
neither $O \lb N \rb $ solvers, nor do they allow adaptive meshes to be easily 
incorporated. These methods do not even provide any natural stopping
criteria; the stopping criteria are preset in the algorithm to some value
which does not change.

Our
other stipulation is that we want high order accuracy at the lowest possible
cost.  We will see later that Richardson extrapolation helps accomplish this
task rather nicely.  But in order to use Richardson extrapolation, the
solution must behave nicely, {\sl i.e.}, the function must be smooth 
everywhere, including the boundaries.  
This will be true in the physics
of black holes, since we do not anticipate the 
development of discontinuities (shocks) in our solutions.  In fact, 
Cook\cite{CookKlasky} has already been able to extrapolate the solution of the 
initial value problem. 

Before we begin to describe each part of the multigrid algorithm, we present
a basic sketch  of the multigrid algorithm.
  We start with a fine grid and a coarse grid.
The residuals on the fine grid are then smoothed until all of the high
frequency components are removed.  Their residuals are then transferred
to the coarse grid.  The coarse grid equations are then modified by 
these residuals. The coarse grid equations are then solved, and 
subsequently transferred to the fine grid. The fine grid then modifies
its solution by the correction which was found from the coarse grid 
equation.  Multigrid then recursively applies these ideas to a series
of grids, where the coarse grid equations are smoothed on the intermediate
grids, and solved only on the coarsest grid.   Thus, there are four 
major components of a multigrid routine.  These components are
smoothing, transfers from a fine grid to a coarse grid, transfers
from a coarse grid to a fine grid, and the solution of the coarsest grid .


\section[Smoothing]{Smoothing}
\label{Smoothing}
Perhaps the most important part of any multigrid algorithm is the smoothing
of the residuals.  Multigrid routines transfer the residuals from a 
fine grid to a coarse grid, which has a grid spacing equal to twice that
of the fine grid.  High frequency components in the residuals on the
fine grid can not be accurately represented on the coarse grid. Thus, 
the residuals must be smooth in order to approximate them on the coarse grid.
If a multigrid algorithm is working properly with a reasonably efficient
smoother then over 70 \% of the computational time will be  spent on
smoothing\cite{Brandt1982}.
This means that not only do we want a good smoother, but we also want a fast
smoother.  
For example, if lexicographic Gauss-Seidel was used for smoothing, we would
see that this smoother would operate very slowly on a vector or parallel
computer, whereas if  a well coded Red-Black Gauss-Seidel smoother was used
for the smoothing, the speed of this routine would greatly increase.

All of the smoothers
used in this dissertation utilize Red-Black Gauss-Seidel, but we feel that
it is helpful to describe Jacobi smoothing too.  We note
that as various researchers have shown 
\cite{Choptuik_masters}\cite{Brandt1977}\cite{Briggs}
, Jacobi is not is good as a smoother as Gauss-Seidel.

\subsection[Damped Jacobi smoothing]{Damped Jacobi smoothing}
\label{DJS}
The Jacobi method allows us to use analytic methods
to examine its smoothing properties.  We examine the smoothing behavior of 
\begin{eqnarray}
\label{sjc}
\frac{\partial^2 u \lb x \rb }{\partial x^2} = f \lb x \rb  \quad x \in [0,1] ,
\end{eqnarray}
where $u \lb x \rb =\sin \lb x \rb $, and $f \lb x \rb =- \sin \lb x \rb $.
In chapter 3 we described how the eigenvalues 
behave for high and low frequency.  The most interesting 
property of this method is  its smoothing.  The high
frequency components of the eigenvalues are quickly damped; meaning a highly
oscillatory function will be smoothed out in roughly a few iterations.
Figure~\ref{fig:4.1} shows the smoothing behavior of the damped Jacobi
algorithm.  Here we took $\omega = 2/3$, where $\omega$ was
defined by equation~(\ref{dampedjacobi}).
The initial guess of $u$ was taken to be
\begin{eqnarray}
u[j] = -1^j \quad j = 1 \cdots n
\end{eqnarray}
which clearly has high frequency components.  
To show the smoothing properties of the Jacobi iteration, 
we plot residuals for the $0^{th}$ and $8^{th}$
iteration in Figure~\ref{fig:4.1}.
After 8 iterations we
see that the high frequency components were effectively eliminated. 
Although Jacobi is a good smoother, previous work by various authors
\cite{ChoptuikGRG}\cite{Briggs}
shows
that Red-Black Gauss-Seidel is a superior smoother so
we shall look at this technique next.
\begin{figure}
   \caption{A graphical example of Jacobi smoothing.}
   \centerline{\psfig{figure=jacobi.ps}}
   \label{fig:4.1}
\end{figure}


\subsection[Red-Black Gauss-Seidel smoothing]{Red-Black Gauss-Seidel smoothing}
\label{RBGS}
We use Red-Black Gauss-Seidel($\omega =1$) smoothing
since we find it to be the best
smoother for our purposes, and since it is well documented\cite{Briggs}
\cite{ChoptuikGRG} that this is an excellent smoother.  The only thing
which we will point out in this section is the reason to use Red
Black Gauss-Seidel, rather than S.O.R.,  for smoothing. 

The S.O.R. iteration converges faster than the Gauss-Seidel
iteration, so we would like to see how the ``$\omega$'' parameter
in S.O.R. affects the smoothing rate.  Again we analyze the 
Jacobi example, equation~(\ref{DJS}). 
Our 
stopping criterion for this experiment is when
the norm of the residual is reduced by one order of magnitude from its
initial value. In this experiment, we let $N=65$, which means that the
optimal value for $\omega$ should be
\begin{eqnarray}
\omega_{\rm optimal} &=& \frac{2}{ 1 + \sin{ \frac{\pi}{2 N}}} \nonumber \\ 
                 &\approx&  1.95
\end{eqnarray}
Figure~\ref{fig:4.2} clearly shows that this value of $\omega$ takes far
more iterations than when $\omega=1$.  Thus, we shall always let $\omega=1$
for smoothing the interior points.  
When we must solve a problem on a coarse
grid, we use $\omega_{\rm optimal}$ as our over-relaxation
parameter. 
\begin{figure}
   \caption{ An example of  S.O.R. smoothing.}
   \label{fig:4.2}
   \centerline{\psfig{figure=ovi.ps}}
\end{figure}


\subsection[Smoothing boundaries]{Smoothing boundaries}
\label{SBS}
Since the boundary region is of lower dimension than the interior
we can generally allow more work per grid point here without 
seriously degrading the overall performance of the algorithm.
In multigrid programs, it is usually good practice to treat 
boundary equations separately from interior equations\cite{Brandt1982}.
Thus the usual method for handling
the boundary is to smooth the boundary equations independently of the 
interior equations.

For one dimensional smoothing Brandt\cite{Brandt1982} says that the boundary
conditions need not be relaxed at all since the errors there are not functions
that can be smoothed in any way.   
In general we agree with this statement when it is 
applied to simple problems.  In some of our test problems in one 
dimension, we allowed partial relaxation on the boundary point. Thus, for
the boundary problem
\begin{eqnarray}
B u = g \nonumber 
\end{eqnarray}
we smooth this as
\begin{eqnarray}
\label{bsmooth}
u^{ \lb n+1 \rb } := u^{ \lb n \rb } + \alpha  \lb  B u^{ \lb n \rb } - g - u^{ \lb n \rb }  \rb  
\end{eqnarray}
where $\alpha$ is the smoothing parameter.  Now Brandt's statement would
put $\alpha=0$, yet we have verified\footnote{See Section~\ref{Fc1dnd} } that 
there are instances where $\alpha$ should be equal to one.  One such instance
is when we have a  grid structure that violates the Berger and Oliger
\cite{BergerOliger}
principle that any grid at level $l+1$ (fine level)
should be {\em properly contained} by a parental grid at level $l$.
This is shown in figure(~\ref{fig:6.5.2}), where the finest grid contains
points which are outside of the domain of the coarser grids. We term
these points as being ``not properly contained''.
In general, we find that for uniform grids 
the fastest convergence rates occur when $\alpha \approx 0$. 
Usually (and in accord with Brandt's general observations),  we
believe that  $\alpha$ should be chosen to result in the smoothest
interior residuals.

\begin{figure}
\caption{The adaptive grids}
\label{fig:6.5.2}
\centerline{\psfig{figure=f652.ps}}
\end{figure}

 
In multi-dimensional boundary smoothing we must obey the principle
that we only smooth the residuals along the boundary.  
The residuals to the boundary equation must be smoothed independently of the
values on the interior points.
We must again demand that 
the smoothing on the boundaries not disrupt the smoothness of the residuals
associated with the interior equations.
Brandt makes several suggestions to accomplish this.
One suggestion is to apply the smoothing operator
\begin{eqnarray}
\frac{\partial^2}{\partial s^2} B u = \frac{\partial^2}{\partial s^2} g
\end{eqnarray}
instead of $ B u = g$ on the boundary, where $s$ 
is the boundary arclength.
Brandt also suggests that when the boundary smoothing factor is not as
good as the interior one, a few boundary sweeps can  be performed for each
interior sweep. 

For geometries such as in Figure~\ref{fig4.3}, we employ Brandt's suggestion
of using a couple of relaxation sweeps per interior sweep and also 
a suggestion of Brandt's\cite{Brandt1977}
average the residuals
along the boundary, {\sl i.e.} 
\begin{eqnarray}
r[l] = \HALF  \lb  r[l-1] + r[l+1]  \rb .
\end{eqnarray}
Here we treat the residual in this two dimensional problem as a one
dimensional object.  We equate the point $[l]$ on the boundary with
the point at $[j,k]$ in the problem.
If we wanted to smooth the boundary at the point 
$[l]=[j,k]$ ,
using the residuals at $[l-1] = [j,k-1]$ and $[l+1] = [j-1,k+1]$,
(as shown in Figure~\ref{fig4.3},
for the 
then boundary equation,
\begin{eqnarray}
\alpha u + \beta u_\rho = g  \nonumber
\end{eqnarray} 
where
\begin{eqnarray}
\frac{\partial u}{\partial \rho} = \frac{x}{\rho} \frac{\partial u}{\partial x} + \frac{y}{\rho} \frac{\partial u}{\partial y} 
\end{eqnarray}
with $\rho=\sqrt{x^2 + y^2}$, we have
\begin{eqnarray}
\alpha u[j,k] &+& \beta \frac{x[j]}{\rho} \frac{ u[j+1,k]- u[j,k]}{h} 
+ \beta \frac{y[k]}{\rho} \frac{u[j,k+1]-  u[j,k]}{h}  - g[j,k]\nonumber \\
&=& \HALF  \lb  r[j,k-1] + r[j-1,k+1]  \rb  
\end{eqnarray}
\begin{figure}
   \caption{A 2D domain, where the points ``inside'' the inner boundary are
not in the computational domain.} 
   \centerline{\psfig{figure=fig4.3.ps}}
   \label{fig4.3}
\end{figure}
\section[Prolongation and restriction operators for interior equations]{Prolongation and restriction operators for interior equations}
\label{PandR}
There are two basic types of
transfer operators needed, restriction and prolongation
which are denoted by $\REST$ and $\PRO$ respectively.  
The purpose of the $\REST$ is to take grid functions from levels $l \to l-1$,
and the purpose of  $\PRO$ is to take grid functions from levels $l \to l+1$.

Restriction operators use weighted averages from the fine grid functions
to determine the coarse grid functions.  Prolongation operators generally use
polynomial interpolation to determine the fine grid function.

A simple one dimensional domain is shown in Figure~\ref{fig:4.4} 
for two levels, with $H=2h$ and $2J-1=j$. 
The restriction operator is defined in stencil notation as
\begin{eqnarray}
\label{1drest}
u^H[J] = \REST u^h[j] =  \lb  \QUARTER \, \HALF \, \QUARTER \rb  
 \left( \matrix{u^h_{j-1}\cr u^h_j\cr u^h_{j+1}}\right) ,\quad J=2,N-1 ,  
\end{eqnarray} 
which is a weighted average.
Another common restriction operator is the injection operator defined as
\begin{eqnarray}
u^H[J] = \REST u^h[j] = u^h[j]
\end{eqnarray}
We have empirically found that for all of the
problems that we have dealt with, that
the use of injections for restrictions tends to make the multigrid routines
converge more slowly. However,  for one dimensional problems, we use injections
for the restriction operator of the boundary values. 

Prolongation in one dimension is typically accomplished via polynomial
interpolation. For example, linear ( accurate to $O \lb h^2 \rb $ ) 
prolongation/interpolation is defined by:
\begin{eqnarray}
\label{1dpro}
u^h[j] &=& \PRO u^H[J]  \nonumber \\
&=& \lb  \HALF~0~\HALF \rb  \left(\matrix{u^H[J-1]\cr u^H[J]\cr u^H[J+1]}\right) ,\quad j \not= 2J-1 \nonumber \\
&=& \lb  0~1~0  \rb  \left(\matrix{u^H[J-1]\cr u^H[J] \cr u^H[J+1]}\right) ,\quad j = 2J-1 
\end{eqnarray}

Now two dimensional restriction is more
complicated since at various times we use
full weighting, half weighting 
or injections defined as follows (where $j=2J-1$ and $k=2K-1$):

{\em \flushleft {Full Weighted Restriction}}
\begin{eqnarray}
u^H[J,K] = \REST u^h[j,k] &=& \frac{1}{16}  \Lc  u^h[j-1,k+1] + u^h[j+1,k+1] \nonumber \\ 
&+& u^h[j-1,k-1] +  u^h[j+1,k-1]  \Rc  \nonumber \\
&+& \frac{1}{8} \Lc u^h[j-1,k] + u^h[j+1,k] \nonumber \\
&+& u^h[j,k-1] + u^h[j,k+1] \Rc \nonumber \\
&+& \QUARTER u^h[i,j] 
\end{eqnarray}
{\em \flushleft {Half Weighted Restriction}}
\begin{eqnarray}
u^H[J,K]&=&\REST u^h[j,k] \nonumber \\
&=& \frac{1}{8} \lb  u^h[j-1,k] + u^h[j+1,k] + u^h[j,k-1] + u^h[j,k+1] \rb  \nonumber \\
&+& \HALF   u^h[i,j] 
\end{eqnarray}
{\em \flushleft {Injection}} 
\begin{eqnarray}
u^H[J,K]=\REST u^h[j,k]=  u^h[j,k]
\end{eqnarray}

Our most commonly used form of the prolongation operator, $\PRO$, 
in two dimensions is bi-linear interpolation, 
defined by : 
\begin {eqnarray}
{u^h[j,k]   } &=& u^H[J,K] \nonumber \\
{u^h[j+1,k]  } &=& \HALF \lb u^H[J,K] + u^H[J+1,K] \rb \nonumber \\ 
{u^h[j,k+1]  }&=& \HALF \lb u^H[J,K] + u^H[J,K+1] \rb \nonumber \\ 
{u^h[j+1,k+1]}&=& \QUARTER \lb u^H[J,K] + u^H[J+1,K] \rb \nonumber \\
&+&  \QUARTER \lb u^H[J,K+1] + u^H[J+1,K+1]\rb 
\end{eqnarray}

\begin{figure} [h]
\caption{ Multiple levels used in multigrid algorithms}
\label{fig:4.4}
\begin{center}
\input{f44.tex}
\end{center}
\end{figure}
\section[Boundary transfers]{Boundary transfers}
\label{BT}
The hardest part of a ``non-trivial'' multigrid program is 
transferring the function values defined by the boundary equations.
Sometimes we must use separate operators for
transferring the grid function $\tilde u^h$ and the residuals, $\tilde r^h$. 
The boundary transfers are unique to each individual problem
so we will come back to this issue in our treatment of example problems 
in Sections~\ref{EOB}-~\ref{2DHMP}.

\section[Linear Correction Scheme (LCS) for two levels]{Linear Correction Scheme (LCS) for two levels}
\label{LCS}
The Linear Correction Scheme (LCS) 
can only be used for linear partial differential 
equations\cite{Brandt1977}\cite{ChoptuikGRG}\cite{Brandt1982}.
Later we will look at the 
Full Approximation Storage scheme (FAS)\cite{Brandt1982}\cite{Brandt1977}
\cite{ChoptuikGRG}, 
which is applicable to non-linear PDE's.  
Here we are trying to solve the linear set
of equations
\begin{eqnarray}
L[ u \lb x \rb ]  = f \lb x \rb  \quad x \in \Omega \nonumber \\
B[u \lb x \rb ] = g \lb x \rb  \quad x \in \partial \Omega  
\end{eqnarray}
where $L$ and $B$ are some linear differential operators,
$x$ is some $d$-dimensional set of coordinates,
$\Omega$ is some subset of $R^{d}$ and $\partial \Omega$ is the
$d-1$-dimensional boundary.
We finite difference these equations as, 
\begin{eqnarray}
L^h u^h = f^h \nonumber \\
B^h u^h = g^h . 
\label{eqn:4fde}
\end{eqnarray}
From here on, we will exclude explicit treatment of the boundary
equations from our discussion since the techniques involved are 
essentially the same as those applied to the interior equations.

As in Chapter~\ref{NumericalTechniques}, we define a 
residual, $r^{h}$ associated 
with the current approximation, ${\tilde u}^h$:
\begin{eqnarray}
r^h \equiv L^h \tilde u^h - f^h
\label{eqn:re}
\end{eqnarray}
The next assumption in the derivation of the
Coarse Grid Correction (CGC) algorithm is that $r^h$ 
is smooth.  
We presume this will have been accomplished via application
of a smoothing iteration as previously discussed.

Since $L^h$ is linear and $r^h$ is smooth we can look for a correction $v^h$
such that
\begin{eqnarray}
u^h = \tilde u^h + v^h .
\label{eqn:4.2}
\end{eqnarray}
Thus we have have 
\begin{eqnarray}
L^h  \lb  {\tilde u}^h + v^h  \rb  = f^h ,
\end{eqnarray}
and since $L^h$ is linear,
\begin{eqnarray}
L^h v^h = L^h u^h - L^h \tilde u^h \nonumber
\end{eqnarray}
Now, substituting the definition of the residual, equation~(\ref{eqn:re}), into
this equation we have 
\begin{eqnarray}
L^h v^h = - r^h .
\end{eqnarray} 
 
Since we assume that $r^h$ is smooth we can sensibly pose a version of this 
last equation on a grid which has a coarser scale of discretization.
In particular,  we can use a grid with mesh spacing $H=2h$. Thus the 
coarse grid equation we wish to solve is:
\begin{eqnarray}
L^H v^H = \REST  \lb  - r^h \rb  
\label{eqn:cge}
\end{eqnarray}
where $\REST$ is the fine to coarse grid transfer operator
(restriction operator). 
In anticipation for non-linear operators, we see that we can rewrite this
equation in three equivalent forms, namely
\begin{eqnarray}
L^H v^H &=& \REST  \lb  - r^h \rb \nonumber \\
L^H \lb u^H - \REST \tilde u^h \rb &=& \REST  \lb  - r^h \rb \nonumber \\
L^H u^H - L^H \REST \tilde u^h &=& \REST  \lb  - r^h \rb \nonumber
\end{eqnarray}

Equation~(\ref{eqn:4.2}) defines the relationship between $\tilde u^h$ and
$v^h$. Thus, after solving
the coarse grid equation~(\ref{eqn:cge}), 
we update $\tilde u^h$ via
\begin{eqnarray}
\tilde u^h := \tilde u^h + \PRO v^H
\label{eqn:csup}
\end{eqnarray} 
where $\PRO$ is a coarse to fine grid transfer, (prolongation
operator). 

The correction algorithm is shown in Figure~\ref{alg4.1} for a
two level scheme.  
Here {\tt pre} is the number of times the algorithm will smooth the
residuals on a grid before a coarse grid correction takes place, and
{\tt pst} is the number of times the algorithm will smooth the
residuals after a coarse grid correction.  We usually set both of these
to two for two dimensional runs, one for one dimensional runs, 
and for three dimensional runs, we usually set these to three. 
The total number of coarse grid corrections is stored in the variable, 
$\sigma$. 
As Brandt suggests in his Guide to Multigrid Development\cite{Brandt1982},
it is best to start with a two level algorithm when designing a multigrid
code. One can typically see problems with the code in the two level scheme
much more easily than with multiple levels.   

Since 
the majority of the time in a multigrid code is typically spent 
doing relaxation sweeps, we
can analyze multigrid codes in terms of work units.  One work unit, $W$,
is defined
to be the work required to perform
one full relaxation sweep across the finest grid. The actual work then
is directly proportional to the work unit multiplied by the number of
points of the finest level.  
Using this definition, we recall that S.O.R. codes
typically require $O \lb N \rb $ work units to solve the ``model'' problem. 
Multigrid algorithms generally compute a 
solution with $O \lb 1 \rb $ work units.  That is, 
the work per grid point tends to be constant which is the best we
can hope for.

We define the convergence rate as 
\begin{eqnarray}
\rho \equiv W^{-1} \log_{10} \frac{ \Vert r^{\rm initial} \Vert}
{ \Vert r^{\rm final}\Vert }
\end{eqnarray}
We see $\rho^{-1}$ is the number of sweeps needed to reduce the residuals 
by one order of magnitude.
\begin{figure}
\caption{The algorithm for the two level LCS.}
\label{alg4.1}
{\small
\begin{tabbing}
\T {\tt PROCEDURE TWO\_LEVEL\_CS\_SCHEME }  \\
\T\T    {\tt Initialize\_grid\_variables } \\
\T\T    {\tt DO  p = 1 $\cdots$ \PRE} \\
\T\T\T  {\tt   RELAX  \quad {\sl Smooth the residual}}\\
\T\T\T   {\sl $r=\LONE \lb  r^h  \rb $ }\\
\T\T    {\tt END DO  \quad {\sl for p} }  \\
\T\T    {\tt WHILE r $\ge \epsilon$ } \\
\T\T\T       {\tt $r^H := \REST r^h$} \\
\T\T\T       {\tt SOLVE( $ L^H v^H = \REST \lb  - r^h \rb  $ ) \quad {\sl solve the coarse grid equation} } \\
\T\T\T       {\tt $v^h := \PRO v^H$ \quad {\sl Prolongate the correction} } \\
\T\T\T       {\tt $ \tilde u^h := \tilde u^h + v^h $ \quad {\sl update
$u^h$ }}\\
\T\T\T       {\tt  DO  q = 1 $\cdots$ \PST} \\
\T\T\T\T          {\tt RELAX {\sl Smooth the residual} }\\
\T\T\T       {\tt END DO  \quad {\sl for q} }  \\
\T\T    {\tt END WHILE \quad {\sl for r }} \\
\T {\tt END PROCEDURE } .
\end{tabbing}
}
\end{figure}
\section[Linear correction scheme for multiple levels] {Linear correction scheme for multiple levels}
\label{LCSM}

The primary difference between using  multiple levels and using just 2 levels
is that we apply the linear correction scheme recursively, completely
solving only
on the coarsest level.
Now instead of calling the
right-hand side of the residual equation  $-r^H$, we will simply call it
$f^H$ since it is just another right-hand side. 
Before we can give a general scheme, we must point out that there are
various ways to cycle through the grids.  The simplest cycle is the
V-cycle shown by Figure~\ref{fig:4.5} and defined by
Figure~\ref{alg4.2},
where~$\LMAX$~~is the maximum level and~$\LCOARSE$~~is the coarsest level. 

Now one could imagine that instead of correcting $u^h$ from the time we
solve on the coarsest grid down to the finest level, we could 
perform what is known as a $W$-cycle
as shown in Figure~\ref{fig:4.6}.
We will not discuss the more general $\mu$ 
cycle described in Briggs\cite{Briggs}.  In general our solvers
have the capability of using $\mu$ cycles but we usually let $\mu=1$ or 2,
which corresponds to the V and W cycles. 

Recall in section~\ref{Philosophy} that
one of the original ideas behind multigrid was that if we wanted to solve
the problem $L^hu^h=f^h$, we could solve the problem $L^Hu^H=f^H$, and then
interpolate $u^H$ to $u^h$ to use as an initial guess for the solution of
$L^hu^h=f^h$.  We use the high order polynomial
interpolation operator\cite{Brandt1982} 
\begin{eqnarray}
\tilde u^h : = \II^h_H u^H
\end{eqnarray}
to provide an initial estimate for the function on the next grid. In 
practice, $\II^h_H$ usually performs polynomial interpolation, but
certain guidelines are set\cite{Brandt1982}.
Thus, we could solve the coarsest problem, use the solution
of this as the initial guess for the next level, solve this level via 
multigrid, etc.  This then leads to the full multigrid cycle shown in
Figure~\ref{alg4.3}, where we restrict attention to a $V$-cycle algorithm, 
although it should be understood
that the general $\mu$ cycle could easily be incorporated.
The $V$-cycle algorithm is the same as before.
\begin{figure} 
\caption{The algorithm for the multiple level, V-cycle,  LCS scheme.}
\label{alg4.2}
{\small
%
\begin{tabbing}
\T {\tt PROCEDURE\_MULTIPLE\_LEVEL\_CS\_SCHEME(~$\LMAX$, \NCYC, \PRE, \PST~) } \\\T\T {\sl Initialize Variables} \\
\T\T {\sl Initialize Memory} \\
\T\T {\tt \DO  \CYCLE = 1 , \NCYC } \\
\T\T\T {\tt VCYCLE( \CYCLE, $\LMAX$ , \PRE, \PST ) } \\
\T\T {\tt \ENDDO } \\
\T {\tt END PROCEDURE}
\end{tabbing}

%
\begin{tabbing}
\T {\tt PROCEDURE VCYCLE(~\CYCLE, $\LMAX$, \PRE, \PST~) } \\
\T\T { \sl Cycle up to the coarsest level } \\
\T\T { \tt \DO  $\LEVEL$ = $\LMAX$ , $\LCOARSE$+1 } \\
\T\T\T {\tt $\IF \lb \LEVEL \not= \LMAX \rb \OR  \lb \CYCLE = 1 \rb \THEN $} \\
\T\T\T\T {\tt \DO  p = 1 , pre } \\
\T\T\T\T\T       {\tt  RELAX  \quad {\sl Smooth the residual}}\\
\T\T\T\T {\tt \ENDDO} \\
\T\T\T {\tt \ENDIF } \\
\T\T\T\T{ \tt $ f^H = \REST r^h$ } \\
\T\T { \tt \ENDDO } \\
\T\T {\sl Now solve the system on the coarsest level } \\
\T\T{ \tt SOLVE($L^H u^H = f^H$) } \\
\T\T {\sl Now come back down to the finest level, performing the needed corrections} \\
\T\T {\tt  \DO  $\LEVEL = \LCOARSE , \LMAX - 1$} \\
\T\T\T { \sl Determine the correction } \\
\T\T\T { \tt $ u^h :=  u^h + \PRO u^H $} \\
\T\T\T { \sl Now smooth out $u^h$ } \\
\T\T\T {\tt \DO  q = 1 , pst } \\
\T\T\T\T       {\tt  RELAX \quad {\sl Smooth the residual} }\\
\T\T\T {\tt \ENDDO} \\
\T\T{ \tt \ENDDO} \\
\T{ \tt END PROCEDURE }
\end{tabbing}
}
\end{figure}

%
\begin{figure} [p]
\caption{A general FMG algorithm.}
\label{alg4.3}

{\small
\begin{tabbing}
\T {\tt PROCEDURE Full\_Multigrid\_CS\_SCHEME(~$\LMAX$, \NCYC, \PRE, \PST~) } \\
\T\T {\sl Initialize Variables} \\
\T\T {\sl Initialize Memory} \\
\T\T{ \tt SOLVE($L^H u^H = f^H$) \quad {\sl Solve the coarsest level problem}} \\
\T\T {\tt \DO $\LEVEL = 1 , \LMAX$ } \\
\T\T\T    {\tt \DO  \CYCLE = 1 , \NCYC } \\
\T\T\T{ \tt $u^h := \II^h_H u^H $) } \\
\T\T\T       {\tt VCycle( \CYCLE, $\LEVEL$ , \PRE, \PST ) } \\
\T\T\T    {\tt \ENDDO \quad {\sl for \CYCLE} } \\
\T\T {\tt \ENDDO \quad {\sl for $\LEVEL$} }\\ 
\T {\tt END PROCEDURE}
\end{tabbing}
}
\end{figure} 
\begin{figure} [h]
\caption{A schematic of the V-cycle used in MG algorithms.} 
\label{fig:4.5}
%\vskip 1in
\begin{center}
\input{f45.tex}
\end{center}
%\vskip 1in
\end{figure}
\begin{figure}
\caption{A schematic of the W-cycle used in MG algorithms.} 
\label{fig:4.6}
%\vskip 1in
\begin{center}
\input{f46.tex}
\end{center}
%\vskip 1in
\end{figure}
\section[The Full Approximation Storage Scheme (FAS)]{The Full Approximation Storage Scheme (FAS)}
\label{FAS}
We again start from our general boundary value problem
\begin{eqnarray}
L u = f 
\end{eqnarray} 
where $L$ may now be a non-linear elliptic operator.  This is again 
differenced to
\begin{eqnarray}
L^h u^h = f^h \nonumber. 
\end{eqnarray}
Now the local truncation error, $\tau^h$ is defined by:
\begin{eqnarray}
\tau^h \equiv L^h u - f^h . 
\label{eqn:deftau}
\end{eqnarray}
where $u$ is the continuum solution.
Note that if we could somehow compute 
$\tau^h$ then we see that we could solve
\begin{eqnarray}
L^h u^{*h} = f^h + \tau^h
\label{tauadd}
\end{eqnarray}
and the solution,  $u^{*h}$,  of this equation would be precisely $u$.
Now if an approximation of $\tau^h$ could
be determined then we could get a better solution to the difference equations. 
Later, we will see how this viewpoint will aid us 
in interpreting the FAS scheme. 

We now derive the FAS equations. Recall that we are solving 
\begin{eqnarray}
L^h u^h = f^h \nonumber.
\end{eqnarray}
with $L^h$ assumed to be non-linear.  We again define a residual,
$r^h$:
\begin{eqnarray}
r^h \equiv L^h \tilde u^h - f^h. 
\end{eqnarray} 

Now we can still think about the problem as trying to compute a
smooth correction $v^h$ such that 
\begin{eqnarray}
u^h = \tilde u^h + v^h 
\label{eqncfas}
\end{eqnarray} 
but we will need to get a modified form for the coarse grid equation.
If we let $u^h$ in the above correction be just a new value of 
$\tilde u^h$ then this equation becomes
\begin{eqnarray}
\tilde u^h := \tilde u^h + v^h \nonumber 
\end{eqnarray}
which is actually
\begin{eqnarray}
\tilde u^h := \tilde u^h + \PRO v^H
\end{eqnarray}
since the correction will be determined from the coarse grid.

We then consider (as mentioned previously)
\begin{eqnarray}
L^h \lb \tilde u^h + v^h \rb - L^h \tilde u^h &=& L^h u^h - L^h \tilde u^h 
\nonumber \\
f - L^h \tilde u^h = -v^h
\end{eqnarray}
Provided $\tilde u^h$ is smooth, we can then formulate a coarse grid version
of this relation:
\begin{eqnarray}
L^H u^H - L^H \REST \tilde u^h = - \REST r^h
\end{eqnarray}
or
\begin{eqnarray}
L^H u^H = L^H \REST \tilde u^h - \REST r^h .
\end{eqnarray}

This is the FAS coarse grid correction equation.
Once an appropriately accurate solution $\tilde u^H$ has been 
computed to the above equation we update $\tilde u^h$ as follows
\begin{eqnarray}
\tilde u^h := \tilde u^h + \PRO \lb u^H - \REST u^h \rb. 
\label{fasupdate}
\end{eqnarray}
Brandt points out\cite{Brandt1982} 
that the more obvious update, $u^h := \PRO \tilde u^H$,
is inferior since it would introduce the interpolation errors of
$\tilde u^H$ instead of the interpolation errors of only the 
correction $v^H$. (In other words, equation~(\ref{fasupdate}) preserves 
smoothness information encoded in $u^H$ prior to the CGC, whereas 
the other update throws such smoothness information away)

To see one of the major advantages of using multigrid rather
than other iterative techniques such as those discussed in Chapter~\ref{NumericalTechniques}
, and also to get a different perspective on the FAS equations,
we shall take another look at equation~(\ref{eqn:cge}).
We recall that the residual vector is defined as
\begin{eqnarray}
r^h = L^h \tilde u^h - f^h \nonumber. 
\end{eqnarray}
Thus, if we rewrite equation~(\ref{eqn:cge})
using this definition of the residual
vector we get
\begin{eqnarray}
L^Hu^H &=& L^H \REST \tilde u^h-\REST \lb L^h \tilde u^h - f^h \rb \nonumber \\ 
&=& \tau^H_h + f^H 
\label{dualview}
\end{eqnarray}
where 
\begin{eqnarray}
\label{taudef}
\tau^H_h \equiv L^H \REST \tilde u^h - \REST L^h \tilde u^h .
\end{eqnarray}
Recall that when we discussed the FAS scheme, we
introduced the notion of correcting the equation with the local truncation
error, and discussed how this would make the difference solution a 
better approximation of the continuum solution.
Similarly, we can interpret $\tau^H_h$ as an estimate of the local
truncation error of the level-$H$ equations relative the level-$h$
ones. This leads to what Brandt has termed
the dual point of view since we can now view the fine
grid as a device for calculating a correction $\tau^H_h$ to the coarse
grid equations. Previously we only viewed the coarse grid as a device 
for accelerating convergence on the fine grid.  We now give the algorithm
for the full multigrid code using the FAS scheme in Figure~\ref{alg4.4}. 

The $\tau$ that is generated in the FAS scheme is an estimate 
of the  relative local 
truncation error, $\tau^{H}_{h}$. We see this by looking at the local truncation
error, $\tau^H$ \cite{Brandt1982} defined by
\begin{eqnarray} 
\tau^H \equiv L^H \lb \tilde I^H u \rb - I^H \lb  L u \rb  
\end{eqnarray}
where $I^H$ and $\tilde I^H$ are two continuum to $H$ transfer operators. 
We now see a direct analogy with equation~(\ref{taudef}).  As $\tilde u^h 
\rightarrow  u$ then $\tau^H_h \rightarrow \tau^H$.  Because of this analogy
$\tau^H_h$ is also referred to as the relative local truncation error.
In traditional multigrid applications
local truncation error estimates are often used to provide natural 
stopping 
criterion for the overall iterative process, 
{\sl i.e.} once the residual becomes appreciably less than 
$\tau^H_h$ we can deem the problem solved.
We will see later that $\tau^H_h$ can also be used in grid adaptation
criteria.
\begin{figure}
\caption{The full multigrid  FAS algorithm.}
\label{alg4.4}
{\small
\begin{tabbing}
\T {\tt PROCEDURE FullMultigrid\_FAS(~$\LMAX$, \NCYC, \PRE, \PST~) } \\
\T\T {\sl Initialize Variables} \\
\T\T {\sl Initialize Memory} \\
\T\T{ \tt SOLVE($L^H u^H = f^H$) \quad {\sl Solve the coarsest level problem}} \\\T\T {\tt \DO $\LEVEL = 1 , \LMAX$ } \\
\T\T\T    {\tt \DO  \CYCLE = 1 , \NCYC } \\
\T\T\T{ \tt $u^h:= \II^h_H u^H $ } \\
\T\T\T       {\tt VCycle\_FAS( \CYCLE, $\LEVEL$ , \PRE, \PST ) } \\
\T\T\T    {\tt \ENDDO \quad {\sl for \CYCLE} } \\
\T\T {\tt \ENDDO \quad {\sl for $\LEVEL$} }\\
\T {\tt END PROCEDURE}
\end{tabbing}
\begin{tabbing}
\T {\tt PROCEDURE VCYCLE\_FAS(~\CYCLE, $\LMAX$, \PRE, \PST~) } \\
\T\T { \sl Cycle up to the coarsest level } \\
\T\T { \tt \DO  $\LEVEL = \LMAX , \LCOARSE+1$ } \\
\T\T\T\T {\tt \DO  p = 1 , pre } \\
\T\T\T\T\T       {\tt  RELAX  \quad {\sl Smooth the residuals}}\\
\T\T\T\T {\tt \ENDDO} \\
\T\T\T {\tt \ENDIF } \\
\T\T\T\T{ \tt $ \tau^H_h = L^H \REST u^h - \REST L^h u^h$ {\sl determine the truncation error estimate }} \\
\T\T\T\T{ \tt $ f^H = \REST f^h + \tau^H_h $ \quad {\sl Correct the rhs}} \\
\T\T { \tt \ENDDO } \\
\T\T { } \\
\T\T {\sl Now solve the system on the coarsest level } \\
\T\T{ \tt SOLVE($L^H u^H = f^H$) } \\
\T\T {\sl Now come back down to the finest level, performing the needed corrections} \\
\T\T {\tt  \DO  $\LEVEL = \LCOARSE , \LMAX - 1$} \\
\T\T\T { \sl Determine the correction } \\
\T\T\T { \tt $ u^h :=  u^h + \PRO \lb u^H  - \REST u^h \rb $} \\
\T\T\T { \sl Now smooth out $u^h$ } \\
\T\T\T {\tt \DO  q = 1 , pst } \\
\T\T\T\T       {\tt RELAX \quad {\sl Smooth the residual} }\\
\T\T\T {\tt \ENDDO} \\
\T\T{ \tt \ENDDO} \\
\T{ \tt END PROCEDURE }
\end{tabbing}
}
\end{figure}

\section [Richardson extrapolation]{ Richardson extrapolation}
\label{RE}
Richardson\cite{Richardson} asserted a long time ago that if a grid function
$\tilde u$ satisfies an $O \lb h^2 \rb $ centered difference approximation to some
PDE, then, in the limit $h \rightarrow 0$, we can expect the 
continuum solution, $u$, to have an
expansion of the form
\begin{eqnarray}
\label{rich1}
u = \tilde u + h^2 e_2 + h^4 e_4 + h^6 e_6 + \cdots , 
\end{eqnarray}
where $e_2,e_4,\cdots$ are error functions which are independent of the mesh
spacing $h$. An extremely good explanation of Richardson extrapolation 
can be found in Choptuik\cite{Choptuik1991} .
Our application of Richardson extrapolation is quite simple.
\footnote{\"Ruede \cite{Ruede} has come up with much more general versions,
however we will not encounter these complications.} 
Our basic approach is to solve 
our discrete  system of equations at two resolutions, $2h$ and
$h$, and then assume
\begin{eqnarray}
u^h &=& u + h^2 e_2 + O \lb h^4 \rb  \nonumber \\
u^{2h} &=& u + \lb 2h \rb ^2 e_2 + O \lb h^4 \rb  \nonumber
\end{eqnarray}
to obtain the fourth-order accurate approximation
\begin{eqnarray}
\frac{4}{3} \, u^{h} - \frac{1}{3} \, u^{2h} = u + O \lb h^4 \rb 
\label{richex}
\end{eqnarray}
Thus, once the second order solutions have been determined we can 
cheaply compute a fourth-order accurate solution.

As should be expected,
our experience shows us that Richardson extrapolation only works well when
the errors, $ u - u^h$ are small.  A problem with our 
straightforward application of Richardson's ideas is that it depends 
rather crucially on the uniform application of centered differences.
For non centered difference stencils, such as
those we typically use on the boundaries, 
the error can not be assumed to admit only
even terms.  Thus, extra care must be taken when treating boundaries
in order to ensure that our grid functions will have expansions
(shown in Chapter~\ref{TEST1}) .

One could also theorize that by using three levels, we could obtain
$O \lb h^6 \rb $ accuracy, but this of course assumes that the leading order error term
is now up to $O \lb h^4 \rb $.
In our applications we generally find that 
the leading order error term is only smooth up to $O \lb h^2 \rb $ 
which makes it difficult to obtain accuracy greater than $O \lb h^4 \rb $.  

In multigrid solvers, we pointed out that one can use the local relative  
truncation error estimate to obtain stopping criteria.  
In order to use Richardson extrapolation we must drive the residuals low
enough to ensure that we are computing smooth error terms properly.

Richardson extrapolation can not be used for general solutions to PDE's since
in general these solutions may not be smooth.  Since we expect
our equation (the Hamiltonian constraint for black hole spacetimes)
to admit only smooth solutions, we can
expect to be able to use this powerful technique \cite{Cook1989}\cite{ChoptuikGRG}\cite{CookKlasky}\cite{ChoptuikGoldwirth} . 

\section[Deferred correction]{ Deferred correction}
\label{DC}
We have seen the complications of finite differencing boundary conditions
when we adopt coordinates which are not boundary conforming.
We then pointed out that a way around
this problem is to use deferred correction.  This idea was originally
suggested by L. Fox and then Brandt\cite{Brandt1982}.  

We can understand the basic idea behind deferred correction by recalling 
the discussion of Section~\ref{FAS},
where we observed that we could improve the accuracy of a 
finite difference solution by adding the 
truncation error to the right-hand-side of the difference 
equation. 
In the FAS scheme, we saw that we could use the relative truncation error
estimate to modify the right hand side of the
coarse grid equations to get a better estimate
of the solution on a finer grid. The methodology here is similar. 
We will modify the right hand side of the difference equations on the 
finest grid to get a higher order approximation of the original system
of equations which the   difference equations were approximating.

Through experience (ours and others)
we know that a good general strategy when finite-differencing
is to first use low order techniques since they
are much easier to develop, they are typically more efficient\cite{Brandt1982} 
and
they can often be used as components in a subsequently
developed higher-order program. 

Consider again the general problem
$$ L u =f $$
We let
\begin{eqnarray}
L_p u = f \quad 
\end{eqnarray}
be an $O \lb h^p \rb$ approximation of the continuum problem, so that
$$ L_p u = f + O \lb h^p \rb  $$
and let 
\begin{eqnarray}
L_q u = f \quad
\end{eqnarray}
be a distinct and lower order finite-difference approximation, so
that 
$$ L_q u = f + O \lb h^q \rb  \quad\quad  q < p .$$

Given these two distinct difference systems, the idea of deferred
correction is to use an iterative process defined by:
\begin{eqnarray}
\label{deffcorr}
L_q u^{ \lb n+1 \rb }  = f + L_q u^{ \lb n \rb } - L_p  u^{ \lb n \rb }.
\end{eqnarray}
Now it is clear that if this iteration converges, 
{\sl i.e.} if 
\begin{eqnarray}
u^{ \lb n+1 \rb } \rightarrow u^{ \lb n \rb } , \nonumber
\end{eqnarray}
then $L_q u^{ \lb n+1 \rb }$ cancels out $L_q  u^{ \lb n \rb }$ in
equation~(\ref{deffcorr}). Thus, equation~(\ref{deffcorr}) becomes
\begin{eqnarray}
L_p u^{ \lb n \rb } = f
\end{eqnarray}
and we see that the grid function does indeed satisfy the higher 
order equation.

Brandt\cite{Brandt1982} points out two interesting comments
concerning deferred correction.
The first comment is that the total work will be proportional to the 
higher order operator and not the lower order operator. Thus, the hope
of having a faster solver by using lower order techniques is essentially 
gone, unless very few points in the domain use deferred correction.
We only use deferred correction for the boundary points, which would
signify that the overall work will still be proportional to the lower
order scheme.
Since we wish to use Richardson extrapolation, we must drive the
residuals down very low, which basically means that our overall rate of
convergence will be consistent with the higher order operator.
The second comment is that the higher
order stencil need not be stable.  This is due to the fact that the
convergence is fast only in smooth components, for which the lower order
operator is a good approximation to the higher order operator.  The
convergence is slow only for high-frequency components. 
Since the instability is only a property of high-frequency components
it will usually come on slowly, which means that we may have already 
driven the residuals down low enough to determine a solution. 

Thus, our scheme is set to handle general boundaries.
There is no problem discretizing the interior equations to second order,
\begin{eqnarray}
L_2^h \tilde u^h = f^h .
\end{eqnarray}
The boundary equations are much more problematic since the coordinate system
is not boundary conforming, so we will use first order differencing for the
boundaries, namely,
\begin{eqnarray}
B_1^h \tilde u^h = g^h.
\end{eqnarray}
We then use deferred correction only on the finest grids\footnote{When one
uses a FMG cycle, then we use deferred correction on all of the finest grid used
in each cycle.}right before the coarse grid correction.  Thus, we iteratively
solve the system
\begin{eqnarray}
L_2^h \tilde u^h &=& f^h \nonumber \\ 
B_1^h \tilde u^h &:=& g^h + \lb B_1^h \tilde u^h - B_4^h \tilde u^h \rb  . 
\end{eqnarray}

We use fourth order deferred correction since our hope is to use Richardson
extrapolation to fourth order. To understand why we need to use an equation
which is greater than second order, we look at an example. 
The one dimensional version of the inner boundary condition~(\ref{INNERBC}), is 
\begin{eqnarray}
\frac{\partial u}{\partial r} = - \frac{u}{2 a}
\end{eqnarray}
and we can finite difference this to second order, using
\begin{eqnarray}
& u \lb a+\xi \rb  = u + \xi u_r + \frac{\xi^2}{2} u_{rr} + \frac{\xi^3}{6} e_2 + \frac{\xi^4}{24} e_3 \nonumber \\
& u \lb a+h+\xi \rb  = u +  \lb \xi+h \rb  u_r + \frac{ \lb \xi+h \rb ^2}{2} u_{rr} + \frac{ \lb \xi+h \rb^3}{6} e_2 + \frac{ \lb \xi+h \rb^4}{24} e_3 \nonumber \\
& u \lb a+2h+\xi \rb  = u +  \lb \xi+2h \rb  u_r + \frac{ \lb \xi+2h \rb^2}{2} u_{rr} + \frac{ \lb \xi+2h \rb^3}{6} e_2 + \frac{ \lb \xi+2h \rb^4}{24} e_3 \nonumber
\end{eqnarray}
where $\xi$ is shown in Figure~\ref{fig:3.4}. When we solve these equations
for $u_r$ we obtain
\begin{eqnarray}
u_r &=& \alpha u \lb a+\xi \rb  + \beta u \lb a+h+\xi \rb  + \gamma u \lb a+2h+\xi \rb  \nonumber \\
&+& e_2 h^2 + e_3 h^3 
\end{eqnarray}
where $\alpha$,$\beta$, and $\gamma$ are constants, and $e_2$ and $e_3$ are
the coefficients  of the error terms.  We see that the error contains terms
in $h^3$.
In order to eliminate the error term in front of $h^3$ we must use at
least third
order expansions.  Empirically we have found that by using only third order
differencing, the error term is not smooth, and thus we can not extrapolate.
Therefore, we use fourth order differencing to eliminate the third order
error term, and to have a smooth fourth order error term. 

\section[Adaptive Mesh Refinements (AMR)]{ Adaptive Mesh Refinements (AMR) }
\label{AMR}
Now that we have discussed methods to boost the accuracy of the solution,
we are ready to discuss AMR.  Non-uniform resolution is needed in
most practical problems.  For example, increasingly finer grids are 
needed near singularities, and near non-smooth boundaries. We use increasingly 
coarser grids since the initial value problem is defined on an unbounded domain.
We found that some useful discussions on AMR are found in  
Choptuik \cite{Choptuik_masters},Berger \& Oliger\cite{BergerOliger}
and Brandt\cite{Brandt1977}.
We use the AMR techniques which follow directly from Choptuik's work
which followed from Brandt's\cite{Brandt1977} work, and from
Berger \& Oliger's work. 

We recall from Section~\ref{Philosophy} that the 
algorithms use a series of discretization levels $l = 0 , \ldots , \LMAX$
where $l=0$ is the coarsest level,
and $\LMAX$ is the finest and $h_l = 2 h_{l+1}$
Now the basic approach to AMR is the following.


 Using an FAS scheme, we compute 
$\tau^H_h$ on all the points on the coarse grid which have corresponding
fine grid points. We then specify a maximum $\tau$, $\TAUMAX$.  We refine 
all the points that have $\tau^H_h > \TAUMAX$.
Thus, we instantly come up with a scheme for adaptive gridding.  

\section[Overview of the Berger \& Oliger approach to mesh refinement]{ Overview of the Berger \& Oliger approach to mesh refinement}
\label{AMRO}
There are four major stages in the Berger \& Oliger 
regridding algorithm:
\begin{tabbing}
\T { (1) flag points needing refinement,}\\
\T { (2) cluster the flagged points,}\\
\T { (3) generate a grid for each cluster,}\\
\T { (4) evaluate the quality of the regridding and possibly repeat the steps.}\\
\end{tabbing}
We can incorporate the entire regridding
process in the first cycle of a FAS scheme.  This is the case since all we 
need is an {\em estimate\/} for the relative truncation error: the 
values of $\tau^{H}_{h}$ generated just before the first coarse grid
correction is initiated are generally acceptable.

\subsection[Flag points needing refinement]{Flag points needing refinement}
\label{FLAG}
An attractive feature of a  FAS scheme is that it naturally generates
a relative truncation error estimate. 
Given a maximum allowable absolute value, $\TAUMAX$, for $\tau^{H}_{h}$
we define 
a characteristic function,~\CHAR~, of 1's and 0's where 
\begin{eqnarray}
\CHAR = 0 , \quad \tau^H_h \leq \TAUMAX \nonumber \\
\CHAR = 1 , \quad \tau^H_h >  \TAUMAX . \nonumber \\
\end{eqnarray}
This characteristic function is generated whenever we need to regrid a level.

Note that the concept of ``grid'' is now distinct from that of
``level''.
Previously we could assume that each level contained one grid, but now there
is a possibility of multiple grids on any given level (except perhaps 
for the coarsest). For example, Figure~\ref{meshes} shows a one dimensional
grid with two refinements.  
\begin{figure}
\caption{A schematic view of two levels, where the finer level contains two grids.}
\label{meshes}
\input{2g.tex}
%\vskip 1in
\end{figure}
\subsection[Cluster the flagged points]{Cluster the flagged points}
\label{CLUSTER}
The most difficult part of any regridding algorithm is the clustering 
algorithm.
On one hand, if the clustering algorithm 
does a bad job, meaning that it clusters together more non flagged points than
flagged points, then there will be a lot of work wasted at the regions
that do not have to be refined.  
On the other hand, if the clustering algorithm does an extremely good job
in clustering the points, but takes an enormous amount of computational
time, then this too becomes wasteful.
We derived three tables~(\ref{table4.1},\ref{table4.2},\ref{table4.3}) to show 
the efficiency of the refinement and as an aid in designing a
clustering algorithm.

The \% usefulness is the ratio of the total number of points minus
the boundary points divided by the total number of points.  
In the Berger and Oliger approach, values at boundary points of 
refined grids are typically defined via interpolation in
parental meshes and hence can 
not contribute to an increase  in accuracy.
Choptuik
points out that when the \% usefulness falls below 50\% then the 
efficacy of the refinement is questionable.
Thus, for the 3 dimensional case, we will need $n\approx17$
before we should regrid. 
Note, however,  that we are not demanding that we 
must always use cubes
in three dimensions, {\sl i.e.} we can use grids which contain 
$n_x \times n_y \times n_z$ points.
Our first demand is that these dimensions be at least 9 points,
($n_x >9, n_y >9, n_z >9)$.

Multigrid algorithms work with an odd number of points since each level
discretization is based on a factor of 2 of the other levels, {\sl i.e.}
if a fine grid had an even number of points, $n$, then the number of points
on the coarse grid would be
\begin{eqnarray}
N = 2 n - 1 \nonumber,
\end{eqnarray}
where $N$ is the number of points on  the fine grid, hence $N$ could not be
an integer. 
The clustering algorithm demands that each dimension must contain
an odd number of points. If we have flagged only an even number of points
we then add an additional point. 

Since in one dimension a grid is just an interval, clustering is trivial.
An appropriate algorithm is given in Figure~\ref{alg4.5}. 
We see that this algorithm can have clusters/grids which overlap each other.
When this occurs, the clusters should be merged otherwise boundary conditions
will not be uniquely defined and/or there will be unnecessary inter-grid
communications on the same level.

Berger \&
Oliger\cite{BergerOliger} point out that a good clustering algorithm should
serve two purposes.  The first is to separate spatially distinct 
phenomena so that different features will be in separate grids.  The 
second purpose is to subdivide the points on the grid,
 when the efficiency becomes low.
This efficiency is of course different from the efficiency we talked about
previously.  We calculate this efficiency as the ratio of the total number
of points in the cluster with~\CHAR~equal to one by the total number of
points in the cluster.  This estimates the fraction of the area of the 
rectangle that needed to be refined.  

For now on we shall call this the 
rectangle efficiency. Unlike Berger \& Oliger we abandon rotated rectangular
domains.

Figure~\ref{fig:4.7} shows an example
of the grid refinement process.  Here the filled in points represent those
points which have \CHAR =1.  
The first step is to draw a rectangle
around the flagged points.  This is shown in Figure~\ref{fig:4.7b}.  
In step two
the efficiency of these two grids is calculated to be 52\% and 43\%.  Step
three then sees which grids have an efficiency less then {\tt eff\_small}
and determines that grid two must be subdivided. 


After the~\CHAR~is calculated
in this region, the new rectangles are then drawn. Figure~\ref{fig:4.7c}
displays the new rectangles.  We see that some originally flagged points
are then not inside the new rectangles.  
The final step is to draw rectangles around these missing points, which
is shown in Figure~\ref{fig:4.7d}.

The clustering algorithms are shown in Figure~\ref{alg4.6}.

\begin{table}
\begin{caption}
      { 1D uniform point refinement efficiency} \vskip 5pt
      \label{table4.1}
\end{caption}
\centering
\begin{tabular}{cccc}   \hline\hline
$n$ & $n_{total}$ & $n_{boundary}$ & \% useful \\ \hline\
 2  &   2         &     2          &  0.0 \\
 3  &   3         &     2          & 33.3  \\
 5  &   5         &     2          & 60.0 \\
 9  &   9         &     2          & 77.8 \\
 17 &  17         &     2          & 88.2 \\
 33 &  33         &     2          & 93.9 \\
 65 &  65         &     2          & 97.0 \\
129 &  129        &     2          & 98.4 \\ \hline \hline
\end{tabular}
\end{table}

\begin{table} 
\begin{caption}
{2D uniform square refinement efficiency} \vskip 5pt
\label{table4.2}
\end{caption}
\centering
\begin{tabular}{cccc}   \hline\hline
$n$ & $n_{total}$ & $n_{boundary}$ & \% useful \\ \hline\
 2  &   4         &     4          &  0.0 \\
 3  &   9         &     8          & 11.1  \\
 5  &  25         &    16          & 36.0 \\
 9  &  81         &    32          & 60.5  \\
 17 & 289         &    64          & 77.9 \\
 33 &1089         &   128          & 88.2 \\
 65 &4225         &   256          & 93.9 \\
129 &16641        &   512          & 96.9 \\ \hline \\
\end{tabular}
\end{table}

\begin{table}
\begin{caption}
{ 3D uniform cubical refinement efficiency} \vskip 5pt
\label{table4.3}
\end{caption}
\centering
\begin{tabular}{cccc}   \hline\hline
$n$ & $n_{total}$ & $n_{boundary}$ & \% useful \\ \hline\
 2  &   8         &     8          &  0.0  \\
 3  &  27         &    26          & 3.7   \\
 5  &  125        &    98          & 21.6 \\
 9  &  729        &   386          & 47.1   \\
 17 & 4913        &  1538          & 68.7  \\
 33 &35937        &  6146          & 82.9  \\
 65 &274625       &  24578         & 91.1  \\
129 &2146689      &  98306         & 95.4  \\ \hline \hline
\end{tabular}
\end{table}
\begin{figure}
\caption{ A basic, 1D clustering routine}
\label{alg4.5}
{\small
\begin{tabbing}
\T {\tt PROCEDURE Cluster\_1D(~\CHAR,\GMIN,\GMAX~) } \\
\T\T   {\tt \CLUSTER = 0 ,\quad {\sl So far, zero clusters have been defined}}\\\T\T   {\tt \DO j = 1 , n \quad { Loop on all the points on the domain j=1 $\cdots$ n}}\\
\T\T\T    {\tt \IF (~\CHAR(j)=1 and \CHAR(j-1)=0) \THEN}\\
\T\T\T\T     {\tt \CLUSTER :=\CLUSTER + 1 \quad {\sl We found a new cluster}}\\
\T\T\T\T     {\tt \GMIN ( \CLUSTER ) = j }\\
\T\T\T    {\tt \ENDIF }\\
\T\T\T    {\tt \IF \CHAR(j)=1 and \CHAR(j+1)=0 \THEN}\\
\T\T\T\T     {\tt \GMAX(\CLUSTER) = j \quad {\sl This is the end of the cluster}}\\
\T\T\T    {\tt \ENDIF}\\
\T\T   {\tt \ENDDO} \\
\T\T   {\sl Now we check to see if there if an odd number of points defined on each grid}\\                                                 
\T\T   {\tt \DO j = 1 , \CLUSTER } \\
\T\T\T    {\tt \IF~mod ( 1 + \GMAX(j) - \GMIN(j) ) ,2 ) =0 \THEN }\\
\T\T\T    {\sl If the grid contains an odd number of points then}\\
\T\T\T\T  { \GMAX(\CLUSTER) := \GMAX(\CLUSTER) + 1} \\
\T\T\T\T  {\sl Add extra point in arbitrary direction}\\
\T\T\T    {\ENDIF} \\
\T\T   {\tt \ENDDO} \\
\T {\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
\begin{figure} [p]
\caption{ A basic multidimensional clustering routine}
\label{alg4.6}
{\small
\begin{tabbing}
\T {\tt PROCEDURE Cluster\_nd(~\CHAR,\GMIN,\GMAX,$\TAUMAX$,$\tau^H_h$,$\delta$,\GRIDS~) }\\
\T\T  {\tt DRAW\_RECTANGLES(~\CHAR,\GMIN,\GMAX,\GRIDS~) }\\
\T\T  {\tt \DO i = 1, \GRIDS \quad {\sl Loop on all the grids now}}\\
\T\T\T   {\tt $\epsilon=$ CALCULATE\_GRID\_EFFICIENCY(~\CHAR,\GMIN(i),\GMAX(i)~)}\\
\T\T\T   {\tt \IF~($\epsilon~<~\epsilon_{min}~$) \THEN \quad{\sl $\epsilon_{min}$ is in general 50\%}}\\
\T\T\T\T {\tt $\TAUMAX$ := $\TAUMAX - \delta$ }\\
\T\T\T\T {\tt Get\_Char(~\CHAR , $\tau^H_h$ , $\TAUMAX$~) }\\
\T\T\T\T {\tt Cluster\_nd(~\CHAR,\GMIN,\GMAX,$\TAUMAX$,$\tau^H_h$,$\delta$~) }\\
%\T\T\T\T {\sl Recursively call the cluster routine}\\
\T\T\T   {\tt \ENDIF} \\
\T\T   {\tt \ENDDO} \\
\T {\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
\clearpage
\begin{figure}
\caption{The flagged points in an AMR routine.} 
\label{fig:4.7}
%\vskip 1in
\begin{center}
\input{f47.tex}
\end{center}
%\vskip 1in
\end{figure}
\begin{figure}
\caption{The rectangles generated from the flagged points in an AMR routine.}
\label{fig:4.7b}
%\vskip 1in
\begin{center}
\input{f47b.tex}
\end{center}
%\vskip 1in
\end{figure}
\begin{figure}
\caption{ The revised rectangles generated from the flagged points in an AMR routine.} 
\label{fig:4.7c}
%\vskip 1in
\begin{center}
\input{f47c.tex}
\end{center}
%\vskip 1in
\end{figure}
\begin{figure}
   \caption{The final revision of the rectangles that were generated from the flagged points in an AMR routine.}   
   \label {fig:4.7d}
   \centerline{\psfig{figure=f47d.ps}}
\end{figure}
\clearpage
\subsection[Grid generation]{Grid generation}
\label{GG}
The grid generation algorithm takes~\GMIN, an array which contains the
smallest value of $x$,$y$ and $z$,  
~\GMAX~, the largest value of $x$,$y$ and $z$, and 
~\GRIDS~, the number of independent cluster regions,  and then
determines make sure that each dimension of the rectangular region
contains an odd
number of points and that each dimension is also greater than or equal to
the minimum allowable number.  If any of these criteria are not satisfied
~\GMIN~and~\GMAX~must be modified as to satisfy them.

The grid generation routine defines all the grid functions on the new
grid, sets up the links to the tree structures\cite{Choptuikad} and
then initializes the functions on this grid.
\subsection[Memory management]{Memory management}
\label{MM}
A crucial task in designing a MLAT algorithm is 
designing the data structures.  
Here we utilize Choptuik's\cite{Choptuikad}
tree manipulations and data structures. 

All the memory for the grid functions is allocating in a 
single, one-dimensional
array~\Q.
We typically manipulate grid  functions  on two grids simultaneously:
for example we need a coarse
and a fine grid in order to define a truncation error estimate. Thus, we
include separate pointers for coarse and fine grid functions.  
We use pointers which are shown in Figure~\ref{fig:4.8}.
{\tt qptr\_type1(\GRID)} is a vector which
contains an integer value pointing to the beginning of the 
the storage for grid~\GRID~of 
size  {\tt type1}. We now introduce the possibility of
various grid types which we label as {\tt qptr\_type1, qptr\_type2 $\ldots$}.
Thus, {\tt qptr\_type2(\GRID)}
would then contain the integer value of where the storage of grid~\GRID~
begins in \Q.  In general we can have an arbitrary number of types.  Each
type has an associated number of values for each~\GRID.  
The number of values associated with each~\GRID~is
then determined
by the length of each array of the type multiplied by the number of functions
which are of this length, {\tt nfcn\_type1}.   The functions are
given unique names which are then stored in a common block . These 
common blocks are then~{\tt EQUIVALENCE}d to another pair of pointers which
are of length {\tt nfcn\_typen}, where {\tt typen} refers to the set of
all types.  This pair is set to distinguish between the coarse and fine
points.  The storage scheme is shown in Figure~\ref{fig:4.8}.
  Storage can then
be allocated and deallocated dynamically since the only change in memory
is in the values of the~\Q~pointers. 

Whenever we need to address grid functions for a particular set of grids, 
we first call a routine which loads up the coarse and fine grid functions
for the particular two grids we wish to address.  We then reference these
arrays such as {\tt q(uc) } which would then point to the place in memory
where the $u$ function is defined for the coarse grid. 
\begin{figure} 
   \caption{   Memory management.}
   \label{fig:4.8}
   \centerline{\psfig{figure=4.8.ps}}
\end{figure}

 
\subsection[Tree structures]{Tree structures}
\label{TreeStructures}
Tree structures are the natural data structure for AMR using the
Berger and Oliger\cite{BergerOliger} approach.
We use Choptuik's {\tt Fortran 77}
implementation of the tree structure\cite{Choptuikad}.
This approach uses the linked lists\cite{Knuth} 
 \LHEAD, \GPP, \GPNGH, \GPSIB, \GPCH. A sample linked-list structure is
shown in 
Figure~\ref{fig:4.9}.  \LHEAD~is a list of grids
which are the last grids of each level. 
Thus,~\LHEAD($\LCOARSE$) is the head
grid of the coarsest level and~\LHEAD($\LMAX$) is the head grid of the 
finest level. \GPP(\GRID)~is the parent of~\GRID, whereas 
\GPCH(\GRID) is the first child of \GRID.  Likewise~\GPSIB(\GRID) is the 
sibling of~\GRID~and~\GPNGH(\GRID) is the neighbor of~\GRID.  
The difference between a sibling and a neighbor, is that siblings have
the same parent, and neighbors do not necessary have the same parent.

\begin{table} 
\begin{caption}
       {Grid Links for tree structure} 
\label{table4.5}
\end{caption}
\centering
\begin{tabular}{ccccc}   \hline\hline
\GRID & \GPP  & \GPCH   & \GPSIB   & \GPNGH  \\ \hline \\
 1    & \UNDEF& 3       & \UNDEF   & \UNDEF  \\
 2    &  1    & 5       & \UNDEF   & \UNDEF  \\
 3    &  1    & 6       & 2        & 2       \\
 4    &  2    & \UNDEF  & \UNDEF   & \UNDEF  \\
 5    &  2    & \UNDEF  & 4        &   4     \\
 6    &  3    & 7       & \UNDEF   & 5       \\
 7    &  6    & \UNDEF  & \UNDEF   & \UNDEF  \\ \hline 
\end{tabular}
\end{table}
To better
understand this we will give an example.  Figure~\ref{fig:4.9} shows
a one dimensional grid with various refinement regions.  Here
there are 4 levels.  The tree structure is also shown in Figure~\ref{fig:4.9}.
Here ~\UNDEF~is a grid which has not been defined.
Now to traverse all the grids at a given level, all we would have to
do is determine the head of the level, via~\GRID~=~\LHEAD($\LEVEL$), and then
each grid on the level can  be scanned by~\GRID~=~\GPNGH(\GRID). 
One can then chain through the list using the algorithms shown in 
Figure~\ref{chain}. 

We have now defined all of the major components in our MLAT codes.
We discussed the  multigrid Linear Correction Scheme and FAS
scheme,  the AMR schemes, deferred correction, and Richardson extrapolation.
We will examine these schemes in Chapter~\ref{TEST1} to demonstrate 
how we will be able to develop an extrapolatable MLAT code to model the
initial value problem in Cartesian coordinates.
\begin{figure}
	\caption{   Adaptive grids shown with tree pointers. }
	\label{fig:4.9}
	\centerline{\psfig{figure=4.9.ps}} 
\end{figure}

\begin{figure}
\caption{ Algorithms to chain through the tree structure.}
\label{chain}
{\small
\begin{tabbing}
\T {\tt PROCEDURE CHAIN\_ALL\_LEVELS( ) }\\
\T\T{\sl This routine will chain through all the defined grids, starting}\\
\T\T{\sl with the coarsest level. This routine will print out the grid number.}\\
\T\T{\tt $\LEVEL= \LCOARSE$ }\\
\T\T{\tt grid = \LHEAD($\LEVEL$) }\\
\T\T{\tt START:}\\
\T\T\T{\tt \IF ( grid = UNDEF ) GOTO END1 }\\
\T\T\T{\sl This is the last list defined at the level}\\
\T\T\T{\tt PRINT grid }\\
\T\T\T{\tt grid = GPNGH(grid)}\\
\T\T\T{\tt GOTO START }\\
\T\T{\tt END1 }\\
\T\T{\tt grid = \LHEAD(GL($\LEVEL+1$) }\\
\T\T{\sl The grid number is now the starting grid of the next finer level}\\
\T\T{\tt IF ( grid = UNDEF ) GOTO END2 }\\
\T\T{\tt GOTO START }\\
\T\T{\tt END2 }\\
\T{\tt END PROCEDURE}
\end{tabbing}
\begin{tabbing}
\T {\tt PROCEDURE PRINT\_SIBLINGS(grid) }\\
\T\T{\sl Given a grid, this routine will print out its siblings }\\
\T\T\T{\tt PRINT "THE SIBLINGS OF THIS GRID ARE:" }\\
\T\T{\tt START} \\
\T\T\T{\tt grid = GPSIB(grid) }\\
\T\T\T{\tt IF ( grid = UNDEF ) GOTO END }\\
\T\T\T{\tt PRINT grid }\\
\T\T\T{\tt GOTO START}\\
\T\T{\tt END}\\
\T{\tt END PROCEDURE}\\
\end{tabbing}
}
\end{figure}

%**************************************************************************
\cleardoublepage
%**************************************************************************
\chapter[{\tt genpsi}: A three dimensional code for the solution of the Hamiltonian Constraint]{{\tt genpsi}: A three dimensional code for the solution of the Hamiltonian Constraint}
\label{GENPSI}
Most of the contents of this chapter have been published in 
the paper, ``Three-dimensional initial data for the collision of two-black
holes''\cite{CookKlasky}.  The only change that we make in this dissertation
is to point out at least one correction to the original code.   
In the original version, there were a number of mistakes in the stencils
which were defined for the sweep in the $z$ direction. To alleviate
this problem, we removed the sweep in the $z$ direction.
In this code, we made no use of the more powerful techniques 
discussed in the last chapter.  
Our original motivation for developing
a code which used the techniques of the previous chapter 
derived from flaws of the code described in this chapter.  This code 
also served as a test-bed, where we were able to determine if a
Cartesian code could generate accurate initial data.

\section[The basic approach of {\tt genpsi}]{The basic approach of {\tt genpsi}}
\label{bap}
This approach to the numerical solution of the 
Hamiltonian constraint, equation~(\ref{HAM}), 
for a pair of black holes employs a
finite-difference method based on the usual Cartesian coordinates $(x,y,z)$. 
The algebraic equations which result from
finite-differencing in these coordinates are solved by a variant of
line-SOR (Successive OverRelaxation) \cite{Varga}.

There are two clear, major disadvantages 
with the Cartesian approach we outline in this section.  The first
is that the coordinates do {\em not\/} conform to the inner
boundaries (``holes'') of the problem domain.  This means that the
formulation of accurate differenced versions of the boundary
conditions is  considerably more involved here than in the other
two approaches described in this paper.  Secondly, because we use
a {\em uniform\/} Cartesian grid ({\em constant\/} mesh increment,
$h$, in each of the coordinate directions), the combination of 1)
the need to resolve steep gradients near the holes and 2) limitations
on our computational resources,  places a severe
restriction on  the radius at which the outer edge of the
computational domain is located.  In practice this means that we
must impose the asymptotic condition~(\ref{OUTBC}) in a regime where
the neglected terms in the multipole expansion are still significant.
These shortcomings became apparent in the numerical results discussed
in the Results section of \cite{CookKlasky}. 

In Cartesian coordinates, equations~(\ref{HAM}), (\ref{INNERBC})
and (\ref{OUTBC}),  are
%
\begin{eqnarray}
%
   \frac{\partial^2 \psi} {\partial x^2}    +
   \frac{\partial^2 \psi} {\partial y^2}    +
   \frac{\partial^2 \psi} {\partial z^2}   &=&
   -\frac{1}{8}\psi^{-7}\bar{A}^2,                    \label{CEQ1} \\
%
   n^x_\alpha \frac{\partial \psi} {\partial x}    +
   n^y_\alpha \frac{\partial \psi} {\partial y}    +
   n^z_\alpha \frac{\partial \psi} {\partial z}    &=&
   -\frac{\psi}{2r_\alpha}\biggr|_{B_\alpha},        \label{CEQ2}  \\
%
   x \frac{\partial \psi} {\partial x} +
   y \frac{\partial \psi} {\partial y} +
   z \frac{\partial \psi} {\partial z}   &=&           
   \frac{1 - \psi}{r}.                               \label{CEQ3} 
\end{eqnarray}
%
where
%
\begin{eqnarray}
%
   \bar{A}^2 &\equiv& \bar{A}_{ij}\bar{A}^{ij},      \label{CEQ3a} \\
   r  &=& \sqrt{x^2 + y^2 + z^2},                     \label{CEQ4} \\
   r_\alpha &=& \sqrt{\left(x - x_\alpha\right)^2 +
                    \left(y - y_\alpha\right)^2 +
                    \left(z - z_\alpha\right)^2},  \quad\quad
                    \alpha = 1\,,\,2,
                                                       \label{CEQ5}
\end{eqnarray}
%
${\vec n}_\alpha = \left( n^x_\alpha, n^y_\alpha, n^z_\alpha \right)$
are the unit normals to the holes, and the ``centers'' of the holes
are located at ${\vec C}_\alpha = (x_\alpha,y_\alpha,z_\alpha)$.  
Equation~(\ref{CEQ2}) holds at the hole surfaces and equation~(\ref{CEQ3}) is 
imposed at the outer boundary. The non-linear Hamiltonian
constraint is solved iteratively using a linearization which, 
given an approximate solution $\psi_0$, determines the new iterate,
$\psi$:
%
\begin{equation}
%
   \frac{\partial^2 \psi} {\partial x^2}    +
   \frac{\partial^2 \psi} {\partial y^2}    +
   \frac{\partial^2 \psi} {\partial z^2}    -
   \frac{7}{8} \bar{A}^2 \psi_0^{-8} \, \, \psi =
   - \bar{A}^2 \psi_0^{-7}.
                                                        \label{CEQ6}
%
\end{equation}
 
Figure~\ref{fig5.1} schematically illustrates a typical
computational domain which might be used for the case of a
computation involving a single hole in two dimensions.
In addition to the inner boundary points, the computational domain also
contains {\em interior} points (those marked with a $+$ in the
figure) and outer boundary points (filled boxes).  We further
categorize any point on a boundary as a {\em single-edge},
{\em double-edge}, or {\em triple-edge} boundary point according
to whether the point has one, two, or three nearest-neighbors,
respectively, which lie {\em outside} of the discrete domain.  For
example, in Figure~\ref{fig5.1}, 
the four corner points are double-edge boundary
points, and the remaining outer boundary points are single-edge.
Similarly, there are 6 double-edge {\em inner} boundary points in
the figure, including the point enclosed by the doubled-diamond.
As we shall now discuss, this substantial variety in the types of
points in the computational domain results in  a proliferation of
specific difference equations which must be generated in order to
produce a reasonably accurate solution.       

\section[Finite differencing]{Finite differencing}
Our finite-difference analogues of the system (\ref{CEQ6}),
(\ref{CEQ2}) and (\ref{CEQ3}) are generated using standard $O(h^2)$
centered, forward, and backward approximations to first and second
derivatives.  However, as discussed below, 
we have {\em not} implemented a scheme with true $O(h^2)$ truncation
error; rather we anticipate only $O(h)$ convergence in the limit
$h \to 0$ and possibly indeterminate convergence behavior at
practical resolutions. 

Adopting the usual finite-difference notation $f(ih,jh,kh) \equiv
f[i,j,k]$, we employ the following formulae for the $x$ derivatives:
%
\begin{eqnarray}
   \lefteqn{
   \frac{\partial \psi}{\partial x}\left(ih,jh,kh\right)   \equiv 
   \frac{\partial \psi}{\partial x}[i,j,k]}     \nonumber  \\
                                                           &=&
   \frac{\psi[i+1,j,k] - \psi[i-1,j,k]}{2 h}  + O(h^2)
                                                     \label{CEQ8} \\
                                                           &=&
   \frac{-\psi[i+2,j,k] + 4\psi[i+1,j,k] - 3\psi[i,j,k]}{2h}
                                     + O(h^2)        \label{CEQ9} \\
                                                           &=&
   \frac{3\psi[i,j,k] - 4\psi[i-1,j,k] + 3\psi[i-2,j,k]}{2h}
                                     + O(h^2),      \label{CEQ10}
\end{eqnarray}
\begin{eqnarray}
   \lefteqn{\frac{\partial^2 \psi}{\partial x^2}\left(ih,jh,kh\right)
         \equiv
   \frac{\partial^2 \psi}{\partial x^2}[i,j,k] }      \nonumber     \\
                                                          & & =
   \frac{\psi[i+1,j,k] - 2\psi[i,j,k] + \psi[i-1,j,k]}{h^2} + O \lb h^2 \rb 
                                   \label{CEQ11} \\
                                                             & &  =
   h^{-2} \Lc -\psi[i+3,j,k] + 4\psi[i+2,j,k] - 5\psi[i+1,j,k] +
             2\psi[i,j,k] \Rc \nonumber \\ & & + O(h^2)       \label{CEQ12} \\
                                                             & &  =
   h^{-2} \Lc 2\psi[i,j,k]  - 5\psi[i-1,j,k] + 4\psi[i-2,j,k] -
           \psi[i-3,j,k] \Rc \nonumber \\  & &+ O \lb h^2 \rb ,  \label{CEQ13} 
\end{eqnarray}
and the obvious counterparts for the $y$ and $z$ derivatives.  
In order to gain some sense of how this process is
carried out for the 3D, two black-hole case, it is instructive to
consider the derivation of 2D difference equations associated with
the three stencils depicted in Figure~\ref{fig5.1}.

We first consider the stencil represented by boxes in Figure~\ref{fig5.1}
Using (\ref{CEQ11}) and the analogous formula for the $y$ derivative
in (\ref{CEQ6}) and ignoring any $z$-dependence, we obtain the 
difference expression:
\begin{eqnarray}
 \lefteqn{ \frac{\psi[i+1,j] + \psi[i-1,j] + \psi[i,j+1] + \psi[i,j-1] -
     4\psi[i,j]}{h^2} } \nonumber \\
  & & - \frac{7}{8}
       \left[ \bar{A}^2 \psi_0^{-8} \right][i,j] \psi[i,j]
 = -\left[ \bar{A}^2 \, \psi_0^{-7} \right][i,j],
\label{CEQ14}
\end{eqnarray}
%
which may also be applied at any other grid point marked with a $+$.

Now consider the stencil composed of circles which is  centered at
the double-circled point. In this case, we use centered-differenced 
versions of both the interior equation (\ref{CEQ6}) and the inner
boundary condition (\ref{CEQ2}). Thus, in addition to (\ref{CEQ14})
we have
%
\begin{eqnarray}
   &n^x[i,j]& \left[ \frac{\psi[i+1,j] - \psi[i-1,j]}{2h} \right] \\
 + &n^y[i,j]& \left[ \frac{\psi[i,j+1] - \psi[i,j-1]}{2h} \right] = - \frac{\psi[i,j]}{2 r[i,j]}.
\label{CEQ15}
\end{eqnarray}
%
Note that although we have used  ``second-order'' differences to
generate this last expression, it is, for a general inner boundary
point, only a {\em first-order} accurate version of the inner
boundary condition since the  boundary point will, as shown in the
figure, generally lie a distance $O(h)$ from the $r = r_\alpha$
surface. Second-order accurate formulae {\em could} be generated
using Taylor series expansion and the governing differential
equations, but we have not done so.  Now, (\ref{CEQ14}) and
(\ref{CEQ15}) both involve the value $\psi[i,j+1]$, which is
defined on a lattice point lying outside the computational domain.
Therefore, we solve (\ref{CEQ15}) for $\psi[i,j+1]$, and substitute
the result in (\ref{CEQ14}), yielding an expression involving only
the points of the stencil:
%
\begin{eqnarray}
 \lefteqn{h^{-2} \Biggl( \Biggr.
 \left[ 1 - \frac{n^x}{n^y} \right][i,j] \psi[i+1,j] 
     + 
 \left[ 1 + \frac{n^x}{n^y} \right][i,j] \psi[i-1,j] } \nonumber \\
& & + 2 \psi[i,j-1] -  
 \left[ 4 + \frac{h}{r n^y} \right][i,j] \psi[i,j]
        \Biggl. \Biggr)
 - \frac{7}{8} \left[ \bar{A}^2 \psi_0^{-8} \right][i,j] \psi[i,j] \nonumber \\
& &
 = -\left[ \bar{A}^2 \, \psi_0^{-7} \right][i,j].  \nonumber
\label{CEQ16} 
\end{eqnarray}

The stencil marked by diamonds in Figure~\ref{fig5.1} is centered on a
double-edge boundary point.  In this case, application of centered
difference formulae to the interior and boundary equations results
in references to {\em two} points  which lie outside of the
computational domain. In order to derive a {\em single} equation
for the center point we employ forward differencing in the $y$
direction, and centered differencing in the $x$ direction to get
%
\begin{eqnarray}
   \lefteqn{\frac{\psi[i+1,j] + \psi[i-1,j] - \psi[i,j+3] + 4\psi[i,j+2] 
         - 5\psi[i,j+1]}{h^2}}  \nonumber \\
 & &- \frac{7}{8} \left( \bar{A}^2 \psi_0^{-8} \right)[i,j] \psi[i,j]
 = -\left[ \bar{A}^2 \, \psi_0^{-7} \right][i,j]
\label{CEQ17}
\end{eqnarray} 
%
and
%
\begin{eqnarray}
   &n^x[i,j]& \left[ \frac{\psi[i+1,j] - \psi[i-1,j]}{2h} \right] + \nonumber \\
   &n^y[i,j]& \left[ \frac{-\psi[i,j+2] + 4 \psi[i,j+1] -
     3\psi[i,j]}{2h} \right]
   = - \frac{\psi[i,j]}{2 r[i,j]}.
\label{CEQ17a}
\end{eqnarray}
%
As before, solution of the discrete boundary condition for the value  
$\psi[i+1,j]$, followed by substitution of  the result into the 
differenced interior equation, yields a single equation involving 
only the stencil-unknowns:
%
\begin{eqnarray}
 \lefteqn{ h^{-2} \Biggl(2 \psi[i-1,j] - 
 \psi[i,j+3] + \left[ 4 - \frac{n^y}{n^x} \right][i,j]
 \psi[i,j+2] } \nonumber \\
%
  & & +  \left[4 \frac{n^y}{n^x} - 5 \right][i,j]
 \psi[i,j+1] - \left[3 \frac{n^y}{n^x} - \frac{h}{r n^x}
 \right][i,j] \psi[i,j] \Biggr) \nonumber \\
 & & -  \frac{7}{8} \left[ \bar{A}^2 \psi_0^{-8} \right][i,j]
 \psi[i,j] = -\left[ \bar{A}^2 \, \psi_0^{-7} \right][i,j].
\label{CEQ18}
\end{eqnarray}
%

As a last example of the derivation of our difference equations in 
Cartesian coordinates, we consider yet again the case of a stencil
centered on a boundary point of a hole, but this time for the 3D
case.  Let the center point have coordinates $(ih,jh,kh)$ and assume 
that of the point's 6 nearest-neighbors, the three with coordinates 
$\lb \lb i-1 \rb h,jh,kh \rb $, $ \lb ih,
 \lb j-1 \rb h,kh \rb $ and $\lb ih,jh,(k-1)h \rb $ lie outside 
the numerical domain. Then, by definition, $ \lb ih,jh,kh \rb $ is a
triple-edge boundary point.  In such a case, we use forward
differences in two of the coordinate directions, and centered
differences in the other.  Now, as we will discuss shortly, the
complete set of difference equations is solved using a
line-relaxation method in which {\em blocks} of unknowns, such as
$\psi[i,j,k], \quad i = - n / 2 \cdots n / 2$ with $j$ and $k$
fixed, are updated (``relaxed'')  simultaneously.  We will refer to
the coordinate direction along which a block of unknowns extends as
the {\em scanning} direction.  Then, at a triple-edge boundary point,
we always forward or backward difference in the scanning direction.
To determine the type of differencing to be applied along the other
two directions, we examine the components of the normal--the
direction having the {\em smallest} component is the direction in
which we use centered differences.  In the current example, assume
we are scanning in the $x$ direction and that
$|n^z[i,j,k]| < |n^y[i,j,k]|$, then we use forward differences
in the $x$ and $y$ directions and centered differences in the $z$
direction to get the following discrete forms of the Hamiltonian
constraint and inner boundary condition: 
%
\begin{eqnarray}
   \lefteqn{h^{-2}
   \Bigl[ -\psi[i+3,j,k] + 4 \psi[i+2,j,k] - 5 \psi[i+1,j,k] } \nonumber \\
& &  - \psi[i,j+3,k]   + 4 \psi[i,j+2,k] - 5 \psi[i,j+1,k] \nonumber \\
& &  + \psi[i,j,k+1] + \psi[i,j,k-1] + 2 \psi[i,j,k]  \Bigr] \nonumber \\ 
& &  -\frac{7}{8} \left[ \bar{A}^2 \psi_0^{-8} \right][i,j,k] \psi[i,j,k]
= -\left[ \bar{A}^2  \psi_0^{-7} \right][i,j,k],
\label{CEQ19}
\end  {eqnarray}
%
\begin{eqnarray}
   &n^x[i,j,k]& \left[ 
     \frac{-\psi[i+2,j,k] + 4\psi[i+1,j,k] - 3\psi[i,j,k]}{2h}
               \right]  +   \nonumber \\
   &n^y[i,j,k]& \left[ 
     \frac{-\psi[i,j+2,k] + 4\psi[i,j+1,k] - 3\psi[i,j,k]}{2h}
               \right]  +  \nonumber \\
   &n^z[i,j,k]& \left[ \frac{\psi[i,j,k+1] - \psi[i,j,k-1]}{2h}
               \right] = - \frac{\psi[i,j,k]}{2 r[i,j,k]}.
\label{CEQ20}
\end  {eqnarray}
%
Solving (\ref{CEQ20}) for $\psi[i,j,k-1]$ and substituting in
(\ref{CEQ19}) we get
%
\begin{eqnarray}
 \lefteqn{ h^{-2} \Biggl( - \psi[i+3,j,k] +
 \left[ 4 - \frac{n^x}{n^z} \right][i,j,k]
 \psi[i+2,j,k] } \nonumber \\ 
& & + \left[ 4 \frac{n^x}{n^z}  - 5 \right][i,j,k] \psi[i+1,j,k] - \psi[i,j+3,k] \nonumber \\
& &  + \left[ 4 - \frac{n^y}{n^z} \right][i,j,k] \psi[i,j+2,k] + 
   \left[ 4 \frac{n^y}{n^z} - 5 \right][i,j,k]  \psi[i,j+1,k] \nonumber \\
& & + 2 \psi[i,j,k+1] + \left[ 2 + \frac{h}{r n^z} -
  3 \frac{n^x}{n^z} + 3 \frac{n^y}{n^z} \right][i,j,k] \psi[i,j,k] \Biggr) \nonumber \\ 
& & - \frac{7}{8} \left[ \bar{A}^2 \psi_0^{-8} \right][i,j,k] \psi[i,j,k]
 = -\left[ \bar{A}^2  \psi_0^{-7} \right][i,j,k].
  \label{CEQ21}
\end  {eqnarray}
%
Clearly, there are seven other distinct stencils for inner
triple-edge boundaries in three-dimensions, all of which can be
readily obtained from (\ref{CEQ21}) by suitable permutations of the
$i$, $j$, and $k$ indices.  

At this point, the procedure we use to generate our difference 
equations should be reasonably clear.  Altogether, including the
various single-,  double-, and triple-edge boundary cases,  we use
77 distinct stencils in the code.  

\section[Solving the difference equations]{Solving the difference equations}
\label{SFDE}
The finite-difference discretization of (\ref{CEQ6}), (\ref{CEQ2}),
and (\ref{CEQ3}) we have outlined above produces a large, sparse set
of linear equations which, as mentioned previously, is solved using
an iterative, line-relaxation technique. The ``kernel'' of the
algorithm--a single line-relaxation sweep--can be most clearly
defined and understood if we momentarily ignore boundary conditions
and focus on the solution of the differenced form of (\ref{CEQ6}):
%
\begin{eqnarray}
 \lefteqn{h^{-2} \Bigl( \psi[i+1,j,k] + \psi[i-1,j,k] + \psi[i,j+1,k] }\nonumber \\
& & + \psi[i,j-1,k] + \psi[i,j,k+1] + \psi[i,j,k-1] - 6\psi[i,j,k]  \Bigr) \nonumber \\
& & - \frac{7}{8} \left[ \bar{A}^2 \psi_0^{-8} \right][i,j,k]
    \psi[i,j,k] = -\left[ \bar{A}^2 \, \psi_0^{-7} \right][i,j,k].
\label{CEQ22}
\end  {eqnarray}
%
Now, let $\psi^{(m)}[i,j,k]$ denote the values of the stored
grid-function after the $m$-th iteration of the solution process.
Then, the equations
%
\begin{eqnarray}
  \lefteqn{ h^{-2} \Bigl( 
   \psi^{(m+1)}[i+1,j,k] - 2 \psi^{(m+1)}[i,j,k] +
     \psi^{(m+1)}[i-1,j,k]  \Bigr) }  \nonumber \\
& & - \frac{7}{8} \left[ \bar{A}^2 \psi^{-8} \right][i,j,k]^{ \lb m \rb } \psi^{(m+1)}[i,j,k] \nonumber \\ 
& & = -h^{-2} \Bigl( \psi^{(m)}[i,j+1,k] + \psi^{(m)}[i,j-1,k] + \psi^{(m)}[i,j,k+1] \nonumber \\
& &  + \psi^{(m)}[i,j,k-1] - 4 \psi^{(m)}[i,j,k] \Bigr) -
  \left[ \bar{A}^2 \psi^{-7} \right]^{(m)}[i,j,k] \nonumber
\label{CEQ23}
\end  {eqnarray}
%
define a {\em line-Gauss-Seidel} (LGS) iteration for the system
(\ref{CEQ22}).  For fixed $j$ and $k$, (\ref{CEQ23}) is a linear
tridiagonal system for the $n + 1$ unknowns $\psi^{(m+1)}[i,j,k],
i = -n/2 \cdots n/2$.  A complete {\em relaxation sweep} consists
of the solution of $(n + 1)^2$ such tridiagonal systems, one for
each  pairing of $j$ and $k$--after such a sweep, each unknown has
been updated exactly one time.  We refer to the iteration defined
by (\ref{CEQ23}) as $x$-LGS since the lines of unknowns which are 
simultaneously updated extend along the $x$ direction.  Clearly,
we can also define $y$-LGS and $z$-LGS iterations.  

Gauss-Seidel relaxation generally has a notoriously slow convergence
rate, particularly in the limit $h \to 0$.  In order to speed
convergence, it is usually  helpful to employ the technique of
{\em overrelaxation}.  For example, associated with the $x$-LGS
iteration (\ref{CEQ23}) is the $x$-LSOR (Line Successive
OverRelaxation) iteration:
%
\begin{eqnarray}
   \psi^{(m+1)}[i,j,k] = \omega \tilde{\psi}^{(m+1)}[i,j,k] +
         \left( 1 - \omega \right) \psi^{(m)}[i,j,k],
\label{CEQ24}
\end  {eqnarray}
% 
where $\tilde{\psi}^{(m+1)}[i,j,k]$ satisfies the Gauss-Seidel
equations (\ref{CEQ23}), and $\omega$ is the overrelaxation
parameter which generally  must satisfy $1 \le \omega < 2$. Although
our algorithm incorporates this strategy, with an $h$-dependent,
empirically determined     $\omega$, we also use another, somewhat
{\em ad hoc}, technique which basically amounts to an additional
overrelaxation applied on a point-wise basis.  Again, assuming that
we are scanning in the $x$ direction, rather than solving
(\ref{CEQ23}), we solve
%
\begin{eqnarray}
  \lefteqn{h^{-2} \Bigl( 
   \psi^{(m+1)}[i+1,j,k] - 4 \psi^{(m+1)}[i,j,k] +
      \psi^{(m+1)}[i-1,j,k]  \Bigr) }  \nonumber \\
& & - \frac{7}{8} \left[ \bar{A}^2 \psi^{-8} \right][i,j,k]^{(m)}
  \psi^{(m+1)}[i,j,k] \nonumber \\
& &   = -h^{-2} \Bigl(
   \psi^{(m)}[i,j+1,k] + \psi^{(m)}[i,j-1,k] +
   \psi^{(m)}[i,j,k+1] \nonumber \\
& & + \psi^{(m)}[i,j,k-1] - 2 \psi^{(m)}[i,j,k] \Bigr) \nonumber \\
& & - \left[ \bar{A}^2 \psi^{-7} \right]^{(m)}[i,j,k]. \nonumber
\label{CEQ25} \\
\end  {eqnarray}
%
Together, equations (\ref{CEQ23}) and (\ref{CEQ25}) define the core
of what we call an $x$-LSOR sweep.  Where necessary, boundary 
equations are simultaneously solved with the interior equations (such 
as  (\ref{CEQ23})), but boundary values are never overrelaxed.

Briefly then, our complete iterative procedure for solving the 
Hamiltonian constraint proceeds as follows.  We perform $x$-LSOR,
and $y$-LSOR relaxation sweeps
\footnote{We do not sweep in the $z$ direction at the time of this dissertation
since a bug appears to be in the code for some of the stencils in the
$z$ direction.} 
in succession until
%
\begin{equation}
   \Bigl\Vert \psi^{(m+1)}[i,j,k] - \psi^{(m)}[i,j,k] \Bigr\Vert_1
     < \epsilon,
\label{CEQ27}
\end  {equation}
%
for some convergence parameter, $\epsilon$, typically 
$2 \times 10^{-6}$.  
Each $d$-LSOR sweep ($d = x, y$ or $z$) 
requires the solution of $(n+1)^2$ linear systems in $n+1$ unknowns.
Each linear system is either 1) {\em tridiagonal}--a situation
which occurs whenever the discrete equations involve only centered
differences in the $d$-direction or 2) {\em 7-diagonal}, if the
equations involve forward or backward differences in the
$d$-direction. The tridiagonal systems are solved using a
tridiagonal solver which has been optimized for the particular
machine architectures (Cray Y/MP, Cray 2) on which the code is
run, while the 7-diagonal systems are solved using a bi-conjugate
gradient method.
\footnote{ For non Cray's we use LINPACK routines for the solution of the
tridiagonal systems.  The Bi-conjugate gradient method was supplied to us
by John Towns\cite{Towns} at NCSA.}
  In both cases, the linear system can be solved
using $O(n)$ operations, so a complete  $d$-LSOR sweep requires
$O(n^3)$ computational work. Empirically, we usually obtain
convergence with $O(n)$ sweeps; this represents the optimal
asymptotic performance which can be expected for an LSOR method.
Thus, our algorithm requires $O(N^{4/3})$ operations to compute a
solution on a mesh containing $N \approx n^3$ unknowns. We note that
for large $N$ this implies significantly poorer performance than
should be possible with a multigrid technique.

\section[Results] {Results and comparison of {\tt genpsi} to Cook's \v{C}ade\v{z} multigrid code }
\label{sec:RESULTS}

\subsection{Methodology}
\label{sec:METHOD}
%
In this section, we assess and compare the relative performance of
{\tt genpsi} to Cook's multigrid algorithm described above by considering the solution of
the Hamiltonian constraint for several initial configurations
describing two black holes\cite{CookKlasky}. 
This comparison is taken taken out of the article co-written by this author
\cite{CookKlasky}.

 The basic methodology we adopt in our
analysis is the straightforward technique of {\sl convergence
testing}---for any given physical problem and specific solution
technique we generate numerical results at several different
{\sl resolutions\/} (different basic scales of discretization, $h$,
for the finite-difference methods.
From these {\sl convergence series\/} we can then
estimate, in the ideal case, 1) the actual level of error, at a
given resolution, in any given solution and 2) the rate of
convergence of the numerical solution to the continuum solution,
again at some specific resolution.  This approach was adopted in
a previous comparison~(Choptuik {\em et al.})\cite{ChoptuikGoldwirth}
of different numerical techniques which had been designed for the
solution of a particular problem in numerical relativity.  The
point of this approach is that
quantities such as the level of error and convergence rate
should be {\sl intrinsically} (i.e.\ without reference to an analytic
solution or a previously computed numerical solution) assessable.
However, the error analysis of the basic numerical methods employed
in \cite{ChoptuikGoldwirth} was expedited by the availability of high-accuracy
numerical results generated from the application of
Richardson-extrapolation techniques to the ``raw'' output of one of 
the methods.  In the current case as well, the convergence behavior 
of one of the methods---the \v{C}ade\v{z} scheme---is such that the 
output from the algorithm is amenable to Richardson extrapolation.
Both theoretical and empirical evidence support our confidence that
these extrapolated values are sufficiently accurate to be considered
exact for the purpose of assessing the errors and convergence rates
of the ``raw'' output of the three different methods.  
%
\subsection{Model Parameters}
\label{sec:MODEL}

We have considered 5 different models in our comparison of the
methods.  As illustrated in Table~\ref{TABPAR}, each model
is characterized by a considerable number of parameters.  Recall
from Chapter~\ref{The-Initial-Value-Problem-for-2-black-holes}
that $\alpha$ is the
dimensionless ratio of the radii of the two holes, while $\beta$
is the spatial separation of the holes in units of the radius of
the first hole, $a_1$.  The three-vectors, ${\vec P}_1$,
${\vec P}_2$, ${\vec S}_1$ and ${\vec S}_2$ can be associated,
roughly speaking, with the linear momenta and spins of the two
holes---the identification becomes precise only in the limit of
large separation of the holes.  The parameter $r_{\rm outer}$
differs from the other six in that it has no physical
significance---rather, it is the approximate outer radius of the
computational domain (the radius at which the Robin boundary 
condition (\ref{OUTBC}) is imposed) used in the corresponding
\v{C}ade\v{z} resolution which, in turn, were used to generate
the reference results.  Note that in terms of the 6 {\sl physical\/}
parameters there are only three distinct models---A2B8TS (TS since
the initial data for this case generates a time-symmetric spacetime),
A1B8 and A2B8.  Models A1B8NR (NR for NeaR) and A2B8NR differ from
their non-NR counterparts only in the setting of $r_{\rm outer}$,
which, for the NR computations, was chosen to roughly coincide with
the outer ``radius'' of the computational domain used in the
Cartesian calculations. For all of the Cartesian computations, this 
radius was about $14 \,a_1$.  By generating reference values with a
reduced $r_{\rm outer}$, we are able to assess the effect of the
smaller computational domain (relative to the other two algorithms)
employed in the Cartesian solutions. The point is that imposing the
boundary condition (\ref{OUTBC}) at a smaller outer radius,
$r'_{\rm outer} < r_{\rm outer}$, does not produce the same solution
as that obtained by truncating at $r'_{\rm outer}$ a solution with
the boundary condition set at $r_{\rm outer}$.

We ascribe no particular physical significance to the three basic 
models we consider; the various parameter combinations enumerated
in Table~\ref{TABPAR} were chosen to produce relatively interesting  
and illuminating data sets from the numerical viewpoint, which were
also germane to the issue of generating initial data for
``realistic'' black hole encounters.  Thus,  based on experience
gleaned from axisymmetric computations~\cite{Cook1991,CookAbrahams},
we chose $\beta=8$ for the separation parameter in order to  produce
configurations containing two separate holes (no single, outer
apparent horizon or event horizon which envelops both throats), yet
where interaction effects are still significant.  We include a
time-symmetric model providing us with an analytic solution
\cite{MISNER}, and a useful calibration of our error-assessment.
For the models with non-vanishing ${\vec P}_\alpha$, each hole has
momentum corresponding to relativistic motion.  In addition, the
total linear momentum of the ``configuration'' vanishes,
(${\vec P}_1 + {\vec P}_2 = 0$), so as not to degrade the Robin
boundary condition~(\ref{OUTBC}).  The spin vectors,
${\vec S}_\alpha$, endow the holes in the A1B8/A1B8NR and
A2B8/A2B8NR models with what we consider ``large'' and ``moderate''
amounts of spin, respectively (the A1B8 holes are almost certainly
nearly maximal).  The cases with non-vanishing ${\vec P}_\alpha$
are ``3-dimensional'' but, without spin, contain an orbital-plane
symmetry.  The spin vectors were chosen to explicitly break this
remaining symmetry and ensure that the models were truly ``generic''.
Finally, for all models, the coordinate centers of the black holes
were located on the $z$-axis: specifically, for the A1B8
computations, ${\vec C}_1/a_1 = (0,0,4)$ and
${\vec C}_2/a_1 = (0,0,-4)$ while for the A2B8 series, 
${\vec C}_1/a_1 = (0,0,4.046875)$ and
${\vec C}_2/a_1 = (0,0,-3.953125)$.
%
\subsection{Resolution Parameters}
\label{sec:RESOLUTION}
%
For each method, and for each relevant model listed in
Table~\ref{TABPAR}, we performed computations at three distinct
resolutions---we generically refer to these computations as low,
medium, and high resolution runs.  For the Cartesian code, these
parameters correspond to $h=64,96,128$, and for the \v{C}ade\v{z} code,
we refer the reader to Cook {\em et al.}\cite{CookKlasky} to better
understand these parameters. 
For the \v{C}ade\v{z} scheme, the design of the 
computational domain, coupled with the fact that meaningful results 
are attainable on relatively coarse meshes, makes a convergence test
using a $4:2:1$ ratio of the low : medium : high resolution scales 
natural and computationally tractable---thus, in going from a
low-to-medium or medium-to-high calculation, all of the 
\v{C}ade\v{z} mesh parameters are simply doubled.  

As discussed in the previous section, a Cartesian computation is
characterized by a single discretization scale, $h$, or
equivalently, by the number of mesh-points, $n$, on an edge of the
computational cube, which, as the resolution is varied, has a fixed
physical length.  Here, computer resources limit our computations to
a maximum $n \approx 128$ (we prefer $n = 16 k$, for some integer
$k$ from hardware considerations), but solutions generated with
$n \approx 32$ are {\sl not\/} meaningful, so we have produced
convergence series using a $2 : 4/3 : 1$  relation of the
low : medium : high resolution scales.  
%
\subsection{Details of the comparison}
\label{sec:DETAILS}
%
In our comparison,
 errors (deviations) are computed at some set of $N_{\rm ref}$
{\sl reference points\/}, labeled, for example, by their Cartesian
coordinates, $(x_i,y_i,z_i),\,\, i = 1 \ldots N_{\rm ref}$.  In both
subsections, for those models where an analytic solution is not
known (that is, for all models except A2B8TS), we define ``error''
as deviation from a reference solution generated from
Richardson-extrapolation of medium- and high-resolution
\v{C}ade\v{z} results to the appropriate set of reference points.
We remark that, in general, these points did not coincide with
points actually used in the various ``bare'' \v{C}ade\v{z},
and Cartesian, computations.  Thus,  some post-processing of
{\em all\/} the basic results was generally necessary before the 
point-wise subtractions required to produce error estimates could 
be performed.  We are confident, however, that we have, for the
most part, succeeded in keeping the error due to post-processing
small in comparison to the fundamental truncation errors of the
various schemes, so that the reported levels of error are genuinely
indicative of the level of error in the basic solutions.

The 
reference points in this comparison, were simply the points used in the various
low-resolution \v{C}ade\v{z} computations.  In this case,
extrapolated values were generated using a two-step procedure: 1)
the medium- and high-resolution values were interpolated to the
reference points, (interpolation was necessary due to the
``zone-centered'' nature of the \v{C}ade\v{z} differencing scheme),
then 2) an appropriate linear combination of these interpolated
values was formed to yield Richardson-extrapolated values at the
reference points. 

Some care is required in producing such extrapolated results.  All
of the extrapolations are based on the premise that the solution,
$\psi^{\hbox{\scriptsize\v{C}ade\v{z}}}$, produced by the
\v{C}ade\v{z} scheme, has the asymptotic ($h \to 0$) expansion
%
\begin{equation}
\psi^{\rm {\hbox{\scriptsize\v{C}ade\v{z}}}} = 
     \psi + h^2 \, e^{\hbox{\scriptsize\v{C}ade\v{z}}}_2 + 
            h^4 e^{\hbox{\scriptsize\v{C}ade\v{z}}}_4 + \,
                   \cdots\ ,
\label{REQ1}
\end  {equation}
%
where $h$ is the basic scale of discretization and 
$e^{\hbox{\scriptsize\v{C}ade\v{z}}}_2$, 
$e^{\hbox{\scriptsize\v{C}ade\v{z}}}_4\,\,,\ldots$ are
$h$-independent functions.  In the limit $h \to 0$, we expect
output from the \v{C}ade\v{z} algorithm to adhere more and more
accurately to (\ref{REQ1}) {\em on the \v{C}ade\v{z} grid points}.
In order to produce two-level extrapolated results at a
{\em different\/} set of points, we must ensure that we interpolate
the ``bare'' results to sufficiently high order that we preserve the
first two terms of (\ref{REQ1}).  For example, in the two-step
procedure described above, {\em linear\/} ($O(h^2)$) interpolation
of the medium- and high-resolution results to the low-resolution
grid points would be insufficient since that procedure would
introduce new $O(h^2)$ terms which, except for special mesh
geometries, would not be (significantly) ``cancelled'' by Richardson
extrapolation.  In order to interpolate both $\psi$ and
$h^2 \, e^{\hbox{\scriptsize\v{C}ade\v{z}}}_2$ correctly, we need
to use at least {\em quadratic} ($O(h^3)$) interpolation.  In the
generation of {\em all} of our Richardson-extrapolated reference
results  we have been conservative in our interpolation and
(polynomial-)extrapolation operations, invariably using a higher
order of interpolation than is strictly necessary.

As mentioned above, the various ``bare'' results which were produced
by running each code/model pair at three different resolutions also
had to be postprocessed in order to produce values at the specific
sets of reference points just described.  The \v{C}ade\v{z} values
were (again conservatively) cubically ($O(h^4))$ interpolated to the
reference locations, while linear interpolation was employed for the
Cartesian quantities (fundamental considerations and direct numerical
experiments indicate that the $O(h^2)$ errors incurred by the linear
interpolation are negligible in comparison to the truncation error
of the scheme).  We also note that we made no attempt to compute
errors in the Cartesian results at points which lie outside the
(rather small) Cartesian computational domain. 

In Section~\ref{sec:GLOBAL}, we quantify the basic level of error in any
of the numerical computations, $\psi^{\rm model}$ in terms of the
following discrete $\ell_1$ and $\ell_\infty$ norms of the relative
deviation from the reference solution, $\psi^{\rm ref}$:
%
\begin{eqnarray}
%
      \Vert e \Vert_1   &\equiv& \frac{1}{N_{\rm ref}'}
   \sum_{i=1}^{N_{\rm ref}'}
       \frac{\vert \psi^{\rm model}_i - \psi^{\rm ref}_i \vert}
            {\psi^{\rm ref}_i}
\label{REQ2} \\
   \Vert e \Vert_\infty &\equiv& \max_{i=1}^{N_{\rm ref}'}
       \frac{\vert \psi^{\rm model}_i - \psi^{\rm ref}_i \vert}
            {\psi^{\rm ref}_i}
\label{REQ3}
%
\end{eqnarray}
%
where the index $i$ in these expressions ranges over the
$N_{\rm ref}'$ of the $N_{\rm ref}$ values which lie within the
computational domain of the particular calculation under
consideration.  For the finite difference solutions, we also
estimate a convergence rate by computing the ratio 
%
\begin{equation}
\frac{\ln \Biggl( \Vert e^{h_1} \Vert_1 / \Vert e^{h_2} \Vert_1
    \Biggr) } {\ln ( h_1 / h_2 ) }
\label{REQ4}
\end{equation}
%
where $h_1$ and $h_2$ are the low and medium, or medium and high 
resolution discretization scales. Clearly, in the limit
$h_1, h_2 \to 0$, this ratio should approach $p$ for an $O(h^p)$
difference scheme.
%
\subsection[Results of the comparison]{Results of the comparison}
\subsubsection[Global error analysis]{Global error analysis}
\label{sec:GLOBAL}
%
The results of the comparison are summarized in 
Table~\ref{TABRELERR}; here we make a few additional comments about
overall features of the comparison as well as the general performance
of the two methods.  In the first place, and perhaps most
importantly, we observe that the tabulated results show a satisfying
level of agreement among the output of the schemes.
For both methods, we generally have average agreement of the
high resolution results to within 1\% or so, and for most of the
calculations, there is a general trend of decreasing deviation with
increasing resolution.

In addition to this overall agreement, the superior accuracy of the
\v{C}ade\v{z} results in comparison to the results from the other
two methods is also striking.  Particularly noteworthy is the clear
$O(h^2)$ convergence manifested by all of the \v{C}ade\v{z}
computations; this convergence behavior is significantly better than
that of the Cartesian algorithms and, as a result, the
high-resolution \v{C}ade\v{z} results are generally well over an
order of magnitude (and in some instances nearly two orders) more
accurate than the best Cartesian results.  Furthermore, as
previously discussed, because of this rather precise $O(h^2)$
convergence, the \v{C}ade\v{z} results can be substantially improved
using Richardson extrapolation. For example, Table~\ref{TABRELERR}
shows that for the time-symmetric computation (A2B8TS), two-level
extrapolation provides nearly a 500-fold improvement on the accuracy
of the high-resolution results (the improvement in the $\ell_\infty$
norm is not so dramatic, but we have not studied this issue in any 
detail).  Based on the similarity of the observed levels of deviation
in the \v{C}ade\v{z} results from model to model, we conclude (self
consistently!) that the other extrapolated solutions (reference
solutions) have similar accuracy.

In contrast to the \v{C}ade\v{z} results, the general convergence
properties of the Cartesian data sets are more difficult to assess
and quantify.  As anticipated in the above section, we believe
that the somewhat erratic convergence behavior of the method seen
in Table~\ref{TABRELERR} is largely attributable to: 1) The nature
of our approximation of the inner boundary conditions (which are
generally $O(h)$ accurate while the discretization of the interior
equations is $O(h^2)$), and 2) the small diameter of the Cartesian
computational domain.  The A1B8NR and A2B8NR models were introduced 
specifically to estimate the relative effect of this second aspect
of the Cartesian computations on the overall level of error.  As
can be seen from Table~\ref{TABRELERR}, errors in the Cartesian
results in comparison to the NR reference solutions {\em are\/}
significantly less than the deviations from the solution of the
corresponding base model. In addition, the Cartesian convergence
rates of the NR data sets are clearly superior for both the A1B8
and A2B8 models.  For a model like A1B8 the error induced by
imposing the outer boundary condition at such a small radius is a
significant (if not dominant) fraction of the total error, even for
the low-resolution computation.

\begin{table}
%\mediumtext
%\widetext
\caption{Parameters for various two-hole calculations used in the
comparison.}
%
\begin{tabular}{lccccccc}
%
Model & $\alpha$ & $\beta$ & ${\vec P}_1/a_1$ & ${\vec S}_1/a_1^2$ &
${\vec P}_2/a_1$ & ${\vec S}_2/a_1^2$ & $r_{\rm outer}/a_1$ \\
\tableline
A2B8TS & 2 & 8
       & $(0,0,0)$ & $(0,0,0)$ & $(0,0,0)$ & $(0,0,0)$ & 730
\\
A1B8   & 1 & 8
       & $(14,0,0)$ & $(-280,280,0)$ & $(-14,0,0)$ & $(0,280,280)$
       & 350
 \\
A1B8NR & 1 & 8
       & $(14,0,0)$ & $(-280,280,0)$ & $(-14,0,0)$ & $(0,280,280)$
       & 17
  \\
A2B8   & 2 & 8
       & $(15,0,0)$ & $(-20,20,0)$ & $(-15,0,0)$ & $(0,20,20)$ & 730
 \\
A2B8NR & 2 & 8
       & $(15,0,0)$ & $(-20,20,0)$ & $(-15,0,0)$ & $(0,20,20)$ & 18
\\ \hline \hline
\end{tabular}
\label{TABPAR}
\end{table}

\begin{table}
{\small
%\mediumtext
%\widetext
\caption{ 
Norms of point-wise relative deviations in $\psi$ using extrapolated
\v{C}ade\v{z} values as reference except for A2B8TS where the
reference solution is analytic.
}
%
\begin{tabular}{lccccc}
&&\multicolumn{2}{c}{\v{C}ade\v{z}} &
  \multicolumn{2}{c}{Cartesian} \\ 
Model & Res.
      & $\Vert e \Vert_1~\hbox{(conv. rate)}$
      & $\Vert e \Vert_\infty$
      & $\Vert e \Vert_1~\hbox{(conv. rate)}$
      & $\Vert e \Vert_\infty$ \\
\tableline
A2B8TS & low
&  $2.41 \times 10^{-3}~\hphantom{(2.00)}$
                          & $1.06 \times 10^{-2}$   % \v{C}ade\v{z}
&  $3.9 \times 10^{-2}~\hphantom{(-1.0)}$
                          & $1.9 \times 10^{-1}$    % Cart.
\\
       & med.
& $5.84\times 10^{-4}~(2.04)$  & $2.67\times 10^{-3}$ % \v{C}ade\v{z}
& $1.5\times 10^{-2}~(\hphantom{-}2.4)$ & $1.0\times 10^{-1}$ % Cart.
\\
       & high
& $1.45\times 10^{-4}~(2.01)$  & $6.29\times 10^{-4}$ % \v{C}ade\v{z}
& $5.1\times 10^{-3}~(\hphantom{-}3.7)$ & $2.5\times 10^{-2}$ % Cart.
\\
       & extrap.
& $3.12 \times 10^{-6}~\hphantom{(2.00)}$
                         & $1.33 \times 10^{-4}$     % \v{C}ade\v{z}
& ---                    & ---                       % Cart.
\\
\\
A1B8   & low
& $6.80 \times 10^{-4}~\hphantom{(2.00)}$
                         & $5.19 \times 10^{-3}$     % \v{C}ade\v{z}
& $1.3 \times 10^{-2}~\hphantom{(-1.0)}$
                         & $4.5 \times 10^{-2}$      % Cart.
\\
       & med.
& $1.65\times 10^{-4}~(2.04)$ & $1.42\times 10^{-3}$  % \v{C}ade\v{z}
& $1.3\times 10^{-2}~(\hphantom{-}0.0)$ & $4.4\times 10^{-2}$ % Cart.
\\
       & high
& $4.13\times 10^{-5}~(2.00)$ & $3.54\times 10^{-4}$ % \v{C}ade\v{z}
& $1.3 \times 10^{-2}~(-0.2)$   & $4.4 \times 10^{-2}$      % Cart.
\\
\\
A1B8NR & low
& $1.43 \times 10^{-3}~\hphantom{(2.00)}$
                         & $5.17 \times 10^{-3}$     % \v{C}ade\v{z}
& $2.3 \times 10^{-3}~\hphantom{(-1.0)}$
                         & $1.2 \times 10^{-2}$      % Cart.
\\
       & med.
& $3.48\times 10^{-4}~(2.04)$ & $1.42\times 10^{-3}$ % \v{C}ade\v{z}
& $2.1\times 10^{-3}~(\hphantom{-}0.3)$ & $1.1\times 10^{-2}$ % Cart.
\\
       & high
& $8.71\times 10^{-5}~(2.00)$ & $3.54\times 10^{-4}$ % \v{C}ade\v{z}
& $2.0\times 10^{-3}~(\hphantom{-}0.1)$ & $1.1\times 10^{-2}$ % Cart.
\\
\\
A2B8   & low
& $7.13 \times 10^{-4}~\hphantom{(2.00)}$
                         & $4.88 \times 10^{-3}$     % \v{C}ade\v{z}
& $1.2 \times 10^{-2}~\hphantom{(-1.0)}$
                         & $7.5 \times 10^{-2}$      % Cart.
\\
       & med.
& $1.69\times 10^{-4}~(2.08)$ & $1.57\times 10^{-3}$ % \v{C}ade\v{z}
& $9.8\times 10^{-3}~(\hphantom{-}0.5)$ & $9.0\times 10^{-2}$ % Cart.
\\
       & high
& $4.23\times 10^{-5}~(2.00)$ & $3.92\times 10^{-4}$ % \v{C}ade\v{z}
& $6.3\times 10^{-3}~(\hphantom{-}1.5)$ & $2.0\times 10^{-2}$ % Cart.
\\
\\
A2B8NR & low
& $1.74 \times 10^{-3}~\hphantom{(2.00)}$
                         & $4.93 \times 10^{-3}$     % \v{C}ade\v{z}
& $8.9 \times 10^{-3}~\hphantom{(-1.0)}$
                         & $7.4 \times 10^{-2}$      % Cart.
\\
       & med.
& $4.12\times 10^{-4}~(2.07)$ & $1.58\times 10^{-3}$ % \v{C}ade\v{z}
& $6.1\times 10^{-3}~(\hphantom{-}0.9)$ & $8.8\times 10^{-2}$ % Cart.
\\
       & high
& $1.03\times 10^{-4}~(2.00)$ & $3.96\times 10^{-4}$ % \v{C}ade\v{z}
& $2.7\times 10^{-3}~(\hphantom{-}2.8)$ & $1.4\times 10^{-2}$ % Cart.
\\ \hline \hline
\end{tabular}
\label{TABRELERR}
}
\end{table}




%
% F I G U R E   C A P T I O N S . . .
%
\begin{figure}
	\centerline{\psfig{figure=5.1.ps}}
\vskip 1.50in
\caption{
Schematic representation of the computational domain for a
hypothetical, 2D, single-hole Cartesian calculation.}
	\label{fig5.1}
\end{figure}

%**************************************************************************
\cleardoublepage
%**************************************************************************
\chapter[Test problems] {Test problems}
\label{TEST1}
In this chapter we implement most of the tools that we will need in designing
a 3D extrapolatable MLAT code for the initial value problem of 2 black holes. 
A complete code
has not yet been implemented.  The original tools we implemented in this
chapter are in sections~(\ref{EOB}),~(\ref{EXTRAP}),~(\ref{Fc1dnd} ), 
~(\ref{1dc}), and~(\ref{2DHMP}).
We go through a series of test
problems each usually implementing  one new technique which is different
from an (all-Dirichlet) PDE, which we refer to as the ``model problem''. 

The first problem, found in Section~\ref{3DMODEL} compares a basic 3D multigrid code with a SOR code, a Gauss-Seidel
code, and a Jacobi code.
We will clearly see that the multigrid algorithms are the most
efficient algorithms for 
solving elliptic systems\cite{ChoptuikGRG}\cite{CookKlasky}   .
We also boost the accuracy of the solution using Richardson extrapolation,
and show how this can easily be introduced in the multigrid
 algorithm\cite{ChoptuikGRG}\cite{CookKlasky}.

The second problem, found in Section~\ref{Adaptive},  tests the adaptive routines which will be used in our
3D multigrid code for 2 black holes.  Here we assume an analytic  solution:
$$ \psi \approx 1 + \frac{a_1}{r_1} + \frac{a_2}{r_2}$$
which is a  good
approximation for $\psi$ for two black holes.  This code will estimate
the truncation errors on a lattice and then refine the regions where
it determines that the truncation errors are large .
This code will then generate grid structures of the type which 
eventually will be used in a complete
MLAT algorithm for the initial value problem. 

The third problem, found in Section~\ref{EOB},  
is concerned with the outer boundary condition, equation~(\ref{OUTBC}),
 and we design a 1D multigrid code using this boundary condition.
Here we use a first order stencil, and cycle using deferred correction.  
We see here that the outer boundary is easy to implement. 
We also demonstrate that in order to 
Richardson extrapolate, we must use deferred correction to an order greater
than 3. 

The fourth problem, found in Section~\ref{EXTRAP},  
examines the issue of Richardson extrapolation in a 
MLAT code.  Here we find empirically a method which generates 
extrapolatable solutions in MLAT codes. 
Our solution to this problem involves smoothing the truncation 
error estimates around
grid interfaces. Here we consider both one-dimensional and 
two-dimensional problems and design multigrid codes for both.
We see that that the results from both codes can be Richardson-extrapolated.

The fifth problem, found in Section~\ref{Fc1dnd},
considers the difficulties encountered in  designing an efficient multigrid
code in one dimension, when the grids are non-contained.  Here we must 
determine the correct transfers for the boundary equations, and for the
interior equations, whose points are close to the boundaries. 
We consider this issue since a three-dimensional multigrid code
for the treatment of a problem on an unbounded physical domain
will not have a uniform computational domain, {\sl i.e.} the coarsest grid will 
certainly not cover the entire domain, nor will the finest. 

The sixth problem, found in Section~\ref{1dc},
 combines features from the previous three problems   
in the construction of 
a general 1 dimensional multigrid code with inner and outer boundary
conditions.
Since derivatives can not be approximated well on very coarse grid,
we would like to use a Dirichlet condition for the inner boundary on
the coarser grids, and then use a mixture of a Dirichlet condition and
the Robin condition on intermediate grids.
Thus, we use  a blended boundary condition implemented on the
inner boundary, to help improve the convergence rate. 
Finally, on the finest levels, we will apply the true Robin condition. 

For the last problem, found in Section~\ref{2DHMP},
we implement a two dimensional multigrid code 
on a domain like the one shown in Figure~\ref{fig:lattice},
where the points inside the hole are not in the computational domain.
We use special smoothing around
the boundary of the hole, along with deferred correction. 

By using more the more
powerful techniques developed in this chapter we should be able to make
a new version of~{\tt genpsi}~which not only outperforms the old version
in speed, but also in accuracy.  We should also be able to use these 
algorithms in designing other codes which will be used to solve other
elliptic equations in numerical relativity.  
Here we have a cleaner mathematical formulation of our problem
than might usually be the case and our boundary geometries, though
non-trivial,  are nowhere near as intricate as those often encountered
in engineering applications (airfoils etc.).  We note another reason 
people have not used extrapolation etc. is that it is more work
and you do not get better results until you already have solutions which are
generally accurate enough in any case.
In our case the advantage of extrapolating low-order results lies in the need
for extremely high accuracy for wave prediction,  which justifies  the
effort.

\section[Four iterative algorithms to solve a model problem in three dimensions]{Four iterative algorithms to solve a model problem in three dimensions}
\label{3DMODEL}
% This program can be found on the cray or the sgi
% cray directory is~scott/3dmg
In this section, we wish to solve a model elliptic problem: 
\begin{eqnarray}
\label{3dmodel}
\frac{\partial^2 u \lb x,y,z \rb }{\partial x^2} + \frac{\partial^2 u \lb x,y,z \rb }{\partial y^2} + \frac{\partial^2 u \lb x,y,z \rb }{\partial z^2} 
= f \lb x, y, z \rb
\end{eqnarray}
with Dirichlet boundary conditions, where $x \in  \lb 0\cdots1 \rb  $,
$y \in  \lb 0\cdots1 \rb  $ and $z \in  \lb 0 \cdots 1 \rb  $.

  This is finite differenced  on a uniform mesh (constant mesh spacing
$h$ in all three directions) to $O \lb h^2 \rb $ as usual:
\begin{eqnarray}
\label{3dmodelfd}
h^{-2} \lb u[j+1,k,l] + u[j-1,k,l]+u[j,k+1,l]+u[j,k-1,l] \rb \nonumber \\
 +  h^{-2} \lb u[j,k,l+1] +u[j,k,l-1] - 6 u[j,k,l] \rb = f[j,k,l] .
\end{eqnarray} 
We then define $f[j,k,l]$  so that the solution is 
\begin{eqnarray}
u[j,k,l] = \sin\lb 2 \pi x[j] \rb \times \sin \lb 2 \pi y[k] \rb , 
 \times sin \lb 2 \pi z[l] \rb \nonumber
\end{eqnarray}
{\sl i.e.}; 
\begin{eqnarray}
f[j,k,l] = - 6 \pi^2 \lb \sin\lb 2 \pi x[j] \rb \times \sin \lb 2 \pi y[k] \rb
\times sin \lb 2 \pi z[l] \rb \rb . 
\end{eqnarray}
which defines the boundary Dirichlet values.

In this section we compare the CPU time, which was measured on a CRAY YMP,
the work unit,the final $\LTWO$ norm of the residuals, the
convergence rate, and the error for four iterative algorithms. 

\subsection[The algorithms]{The algorithms}
\label{algorithms}
The Jacobi algorithm we use is a point-wise algorithm shown in Figure~\ref{alg6.1.1}.
The Gauss-Seidel and SOR codes have similar algorithms, but the ${\tt uold}$'s
in the Jacobi algorithm are replaced by ${\tt unew}$'s and an $\omega$ factor
is placed inside the algorithm, setting $\omega = 1$ for the Gauss-Seidel code.
The algorithms are shown in Figure~\ref{alg6.1.2}, where
we use 
$\omega_{\rm optimum}$
which was defined in chapter 3.

The full multigrid algorithm uses the same algorithm defined in Figure~\ref{alg4.4}, which we also include in  Figure~\ref{algmgnow} for convenience. 
The smoother is defined by the~{\tt RELAX}~routine. 

A general cubic interpolation routine\cite{ChoptuikPR}
is used to transfer the solution of a coarse grid to a fine grid, 
on all grids which have over 5 points per side. We find that cubic interpolation
does help to reduce the residuals by an order of magnitude over
linear interpolation.
In our test we saw that v cycles were the fastest type of cycle.  
We also found empirically that multigrid performance was best
when \PRE\  and \PST\, the number of relaxation sweeps performed before 
and after a coarse grid
correction respectively, were both set to 3.
We also used linear interpolation and half-weighted restriction 
(which we found superior to full-weighted restriction).

\begin{figure} 
\caption{ The Jacobi algorithm.}
\label{alg6.1.1}
{\small

\begin{tabbing}
\T {\tt PROCEDURE JACOBI( $\LEVEL$, res2) } \\
\T {\sl Solve the model problem }\\ 
\T\T  {\tt Initialize\_grid\_variables($\LEVEL$) with nx,ny,nz  points } \\ 
\T\T  {\tt n = 0 \quad {\sl No iterations have taken place}} \\
\T\T  {\tt START} \\
\T\T\T   {\tt n = n + 1 }\\
\T\T\T   {\sl Relax the system via equation~(\ref{dampedjacobi})}  \\
\T\T\T   {\tt  uold = unew } \\
\T\T\T   {\tt \IF $ \lb > res2 \rb$ \GOTO START } \\
\T\T  {\sl Compute the error} \\ 
\T {\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
%
\begin{figure} 
\caption{ The SOR/Gauss-Seidel algorithm}
\label{alg6.1.2}
{\small
\begin{tabbing}
\T {\tt PROCEDURE SOR/GAUSS-SEIDEL ( $\LEVEL$, res2) } \\
\T {\sl Solve the model problem }\\
\T\T  {\tt Initialize\_grid\_variables($\LEVEL$) with nx,ny,nz  points } \\
\T\T  {\tt n = 0 \quad {\sl No iterations have taken place}} \\
\T\T  {\tt START} \\
\T\T\T   {\tt n = n + 1 }\\
\T\T\T   {\sl Relax the system via equation~(\ref{SOReqn}) }  \\
\T\T\T   {\tt \IF $ \lb > res2 \rb$ \GOTO START } \\
\T\T  {\sl Compute the error} \\
\T {\tt END PROCEDURE}
\end{tabbing}
}
%
\end{figure}
\begin{figure} 
\caption{ The FAS FMG algorithm. }
\label{algmgnow}
{\small
\begin{tabbing}
\T {\tt PROCEDURE FullMultigrid\_FAS(~$\LMAX$, \NCYC, \PRE, \PST~) } \\
\T\T {\sl Initialize Variables} \\
\T\T {\sl Initialize Memory} \\
\T\T{ \tt SOLVE($L^H u^H = f^H$) \quad {\sl Solve the coarsest level problem}} \\\T\T {\tt \DO $\LEVEL$ = 1 , $\LMAX$ } \\
\T\T\T    {\tt \DO  \CYCLE = 1 , \NCYC } \\
\T\T\T{ \tt $u^h:= \II^h_H u^H $ } \\
\T\T\T       {\tt VCycle\_FAS( \CYCLE, $\LEVEL$ , \PRE, \PST ) } \\
\T\T\T    {\tt \ENDDO \quad {\sl for \CYCLE} } \\
\T\T {\tt \ENDDO \quad {\sl for $\LEVEL$} }\\
\T {\tt END PROCEDURE}
\end{tabbing}
%
\begin{tabbing}
\T {\tt PROCEDURE VCYCLE\_FAS(~\CYCLE, $\LMAX$, \PRE, \PST~) } \\
\T\T { \sl Cycle up to the coarsest level } \\
\T\T { \tt \DO  $ \LEVEL = \LMAX , \LCOARSE+1$ } \\
\T\T\T {\tt \DO  p = 1 , pre } \\
\T\T\T\T       {\tt  { RELAX($u^h= f^h$)}  \quad {\sl Smooth the residuals}}\\
\T\T\T {\tt \ENDDO} \\
\T\T\T{ \tt $ \tau^H_h = L^H \REST u^h - \REST L^h u^h$ 
      {\sl determine the truncation error estimate }} \\
\T\T\T{ \tt $ f^H = \REST f^h + \tau^H_h $ \quad {\sl Correct the rhs}} \\
\T\T { \tt \ENDDO } \\
\T\T { } \\
\T\T {\sl Now solve the system on the coarsest level } \\
\T\T{ \tt SOLVE($L^H u^H = f^H$) } \\
\T\T {\sl Now come back down to the finest level, performing the needed corrections} \\
\T\T {\tt  \DO  $\LEVEL = \LCOARSE , \LMAX - 1$} \\
\T\T\T { \sl Determine the correction } \\
\T\T\T { \tt $ u^h := u^h + \PRO \lb u^H  - \REST u^h \rb $} \\
\T\T\T { \sl Now smooth out $u^h$ } \\
\T\T\T {\tt \DO  q = 1 , pst } \\
\T\T\T\T       {\tt {RELAX($u^h= f^h$)} \quad {\sl Smooth the residual} }\\
\T\T\T {\tt \ENDDO} \\
\T\T{ \tt \ENDDO} \\
\T{ \tt END PROCEDURE }
\end{tabbing}
}
\end{figure}

%\clearpage
\subsection[Results]{Results}
\label{RESULTS1}
In this section we present the performance of the above algorithms 
on a model problem.
We run
each of these codes for levels 2 through 7, where the number of
points on a cube edge, $n$ is defined by 
\begin{eqnarray}
n=2^{\LEVEL}+1.
\end{eqnarray}
The {\tt TIME} is the total computational time, measured in seconds,  
$W$ is the work
units (recall one work-unit is the computational work needed 
to relax on the finest grid) divided by 25.8, which normalizes
the FMG FAS work to unity,
and $\rho$ is the convergence rate, defined in Section~\ref{LCS}, as 
\begin{eqnarray}
\rho \equiv W^{-1} \log_{10} \frac{ \Vert r^{\rm initial} \Vert}
{ \Vert r^{\rm final}\Vert }
\end{eqnarray}
We also represent the $\LTWO$ norm of the relative error as $e$.

We see that
the multigrid code typically takes about 4 relaxation sweeps on the finest
grid in order for the residuals to be reduced by one order of magnitude. 
There are two other plots of a type 
which we will often show in later chapters.  The
first is a plot of the  $\LTWO$ norm of the residuals as a function
of $W$ (the work unit) number.  
Figure~\ref{fig:convrate6.1} shows $\log_{10}$ of the $\LTWO$
norm of the residuals versus the work for the SOR code, the Gauss-Seidel code,
and the multigrid code. 
This data was generated from the level 6 run. The
other plot, Figure~\ref{fig:errrate6.1.2} shows the reduction of 
the error, $e$,  versus the work unit, $W$.  
This figure clearly shows that in the
SOR algorithm, over 200 unnecessary sweeps were done, since we can easily
see that after about 250 work units, the error is not reduced any more.  
The multigrid code which we used did not use an adaptively determined 
stopping criterion of the type discussed in Chapter 4 and 
we see that we could have easily reduced the
work units on the multigrid code too. We also see that the Gauss-Seidel
code is extremely inefficient for solving elliptic equations\cite{ChoptuikGRG} 
\cite{Briggs}. We once again repeat that there is nothing new in these
results, we include them here primarily as motivation for using multigrid.
In the tables that we use from this point forward, we frequently represent
numbers as $a(b)$ which is equivalent to $a \times 10^{b}$. 

\begin{table} [p]
\caption{3D FMG FAS Multigrid algorithm results}
\centering
{\small
\begin{tabular}{cccccc} \hline \hline
$\LEVEL$ & TIME    & $W$   & Final $r_2$ & $\rho$    & $e$     \\ \hline \\ 
        2    & 0.01	  & 0.8   & 1.2(-13)    &-7.5(-1)& 5.9(-2)   \\
        3    & 0.02    & 1.0   & 8.5(-9)    &-0.36   & 1.6(-2)  \\
        4    & 0.08    & 1.1   & 3.4(-7)    &-0.26   & 4.2(-3)  \\
        5    & 0.33    & 1.0   & 2.8(-7)    &-0.25   & 1.1(-3)  \\
        6    & 1.63    & 1.0   & 8.6(-8)    &-0.25   & 2.8(-4)  \\
        7    & 9.43    & 1.0   & 2.3(-8)    &-0.25   & 7.0(-5)\\ \hline \hline
\end{tabular}
}
\end{table}
\begin{table} [p]
\caption{ 3D SOR algorithm results} 
\centering
{\small
\begin{tabular}{cccccc} \hline \hline
$\LEVEL$ & TIME    & $W$   & Final $r_2$ & $\rho$    & $e$       \\ \hline \\
        2    & 0.02    & 1.5   & 1.0(-12)    &-3.5(0)& 5.9(-2)   \\
        3    & 0.04    & 2.2   & 5.8(-9)    &-1.7(-1)& 1.6(-2)   \\
        4    & 0.18    & 3.9   & 2.8(-7)    &-8.4(-2)& 4.2(-3)   \\
        5    & 1.43    & 7.7   & 2.1(-7)    &-4.3(-2)& 1.1(-3)   \\
        6    &15.51    &16.7   & 3.2(-8)    &-2.2(-2)& 2.8(-4)   \\
        7    &194.00   &34.6   & 1.6(-8)    &-1.1(-2)& 7.0(-5)\\ \hline \hline
\end{tabular}
}
\end{table}
\begin{table} [p]
\caption{ 3D Gauss-Seidel algorithm results} 
\centering
{\small
\begin{tabular}{cccccc} \hline \hline
$\LEVEL$ & TIME    & $W$   & Final $r_2$ & $\rho$ & $e$       \\ \hline \\
        2    & 0.01    & 0.1   & 1.0(-13)   &-7.2(+1)& 5.9(-2)   \\
        3    & 0.03    & 1.6   & 4.3(-9)    &-2.9(-1)& 1.6(-2)   \\
        4    & 0.21    & 4.8   & 3.1(-7)    &-6.7(-2)& 4.2(-3)   \\
        5    & 3.50    &19.5   & 2.8(-7)    &-1.7(-2)& 1.1(-3)   \\
        6    &75.80    &83.1   & 8.6(-8)    &-4.1(-3)& 2.8(-4)   \\
        7    &1866.88  &333.1  & 2.3(-8)    &-9.8(-4)& 7.0(-5)\\ \hline \hline
\end{tabular}
}
\end{table}
\begin{table} [p]
\caption{ 3D Jacobi algorithm results} 
\centering
{\small
\begin{tabular}{cccccc} \hline \hline
$\LEVEL$ & TIME    & $W$   & Final $r_2$ & $\rho$  & $e$       \\ \hline \\
        2    & 0.01    & 0.1   & 1.0(-12)     &-7.2(+1)& 5.9(-2)   \\
        3    & 0.05    & 2.5   & 8.2(-09)     &-1.5(-1)& 1.6(-2)   \\
        4    & 0.45    & 9.1   & 3.2(-07)     &-3.4(-2)& 4.2(-3)   \\
        5    & 6.70    &37.6   & 2.8(-07)     &-8.4(-3)& 1.1(-3)   \\
        6    &137.10   &150.2  & 8.6(-08)     &-2.1(-3)& 2.8(-4)   \\
        7    &3376.21  &602.4  & 2.3(-08)     &-5.2(-4)& 7.0(-5)\\ \hline \hline
\end{tabular}
}
\end{table}

\begin{figure}
	\caption{ A plot of the $\LTWO$ norm of the residual versus the work unit for a six level run} 
	\label{fig:convrate6.1}
	\centerline{\psfig{figure=resids_red.ps }}
\end{figure}
%
\begin{figure}
	\caption{ A plot of the absolute error versus the work unit for a six level run.} 
	\label{fig:errrate6.1.2}
	\centerline{\psfig{figure=model_error.ps }}
\end{figure}
%
\clearpage
\section[Adaptive tests]{Adaptive tests}
\label{Adaptive}
% This program can be found on the cray or the sgi
% cray directory is 
% sgi directory are~/grid_proj/1d
% cray needed for 2 and 3 dimensional runs .....
%  in /charon/u0/ph/az/scott2/grid_proj/2D/V3
%~/grid_proj/2d
%~/grid_proj/3d
The purpose of this section is to see how well grid adaptation of the 
type discussed in Section~\ref{AMR} 
will work with the type of function which tends to 
approximate $\psi$. 
A good approximation to $\psi$ for two black holes with zero extrinsic 
curvature is
\begin{eqnarray}
\psi_{model} = 1 + \frac{a_1}{r_1} + \frac{a_2}{r_2}.
\label{model1}
\end{eqnarray} 
Bowen \& York\cite{BowenYork} also suggest a model $\psi$ for one hole as
\begin{eqnarray}
\psi_{model} =  \lb  1 + \frac{\alpha}{r} + \frac{\beta}{r^2} + \frac{\gamma}{r^3} + \frac{\delta}{r^4} \rb^{\frac{1}{4}} 
\label{modelBY}
\end{eqnarray}
where $\alpha,\beta,\gamma$ and $\delta$ are constants.  We use 
a model $\psi$ with a similar form:
\begin{eqnarray}
\psi = \alpha + \frac{\beta}{r_1} + \frac{\gamma}{r_2} +
\frac{\delta }{r_1^2} + \frac{\epsilon}{r_2^2} + \frac{\eta}{r_1 r_2} \nonumber.
\label{modelus}
\end{eqnarray}
where $r_1 = r - c_1 , r_2 = r - c_2$, and $\alpha$, $\beta$, $\gamma$, 
$\delta$, $\epsilon$, and $eta$ are constants.

We use this  $\psi$ to determine $f$ from 
\begin{eqnarray}
f = \nabla^2 \psi. 
\end{eqnarray}
We then compute the local truncation error,$\tau^h$,via equation~(\ref{eqn:deftau}),
\begin{eqnarray}
\tau^h \equiv L^h \psi - f^h \nonumber . 
\end{eqnarray}
Finally we compare $\tau^h$ with~$\TAUMAX$~to see where the grid needs to be
refined, and we then refine the grid at this level, thereby generating 
one or more new grids.  
We will fully document the algorithms in the sections below, beginning
with the one dimensional case.

\subsection[Adaptive Mesh Refinement (AMR) in 1D]{Adaptive Mesh Refinement (AMR) in 1D}
\label{ONEDAG}
The 1D code is described fully by the algorithm in figures~(\ref{alg6.2.1})
,~(\ref{alg6.2.2}), and~(\ref{alg6.2.3}) .
Here {\tt sg2} is an input parameter which,
if equal to one,  specifies that each grid must have its total
number of points equal to $2^n+1$, where $n$ is an integer.

We now test the routines using the fixed input parameters:
$\XMIN = -100$, $\XMAX$= 100, $\TAUMAX$= 0.01 and
  $\LMAX=20$ .
We show the bounding limits of each grid, (Figure~\ref{fig:6.2.3}), 
 by generating a rectangle,
which has a height equal to half of a level.  The bottom of the rectangles
are at the level of the grid.
The input parameters of these runs are
shown in Table~\ref{6.2.input}.

The output of this code generates a graph and listing.  The output of
the first run is shown in Table~\ref{table:6.2}, where we include
output only for the first 10 levels.
The corresponding graph is shown in Figure~\ref{fig:6.2.1}

A careful look at this output shows that the 
grid refinements are ``zooming'' into
the singular points.  
In fact, on the finest level, we are
using over 5000  points. The other noticeable thing about this run is that,
except at the coarsest level, 
each grid covers a smaller region than its parent.
Run 2  differs from run 1 only in that we
demand that the number of points 
in a grid must be $2^n+1$ for some $n$.
We see
from the results
 in Table~\ref{fig:run2} that there are many levels where {\tt GXMIN } and 
{\tt GXMAX} do not change from their parents.  Thus, there is much waste
in this refinement, and in general we {\em should not} be concerned with having
children maintain ${\hbox {\tt NX}} = 2^n +1$.

This one dimensional test is not a ``true'' test of the problem which
we will be trying to model in higher dimensions.  Since the computational
domain will end at approximately the radius of each hole,  
the grids will never approach the singularity.
Thus, our multidimensional test cases will have
the option of whether or not to stop the domains at or near 
the edge of the hole boundaries.
 
The third run was made such that we would be able to compare the grid
refinements of a run where the higher order terms in $\psi$ were small
compared to the first two runs.
The results  for this test are shown in 
Table~\ref{run3} and Figure~\ref{fig:6.2.3}.
It is extremely difficult to tell the 
difference between the graphs of these two runs,
thus, we should also look at tables~(\ref{table:6.2}) and~(\ref{run3}).
We see that at the 10$^{th}$ level, there is only about half 
the number of points being used on this run.  

We have also built
the foundation for the multidimensional codes.  Building
one dimensional codes before the multidimensional cases appears to be an
excellent practice, since the one dimensional cases can be implemented,
tested and evaluated much more rapidly than their multidimensional counterparts.

\subsection[AMR in 2D]{AMR in 2D}
\label{TWOD-adaptive-grids}
The 2D code is described fully  by the algorithm shown
in figures~(\ref{alg6.2.4}),~(\ref{alg6.2.5}),~(\ref{alg6.2.6}),
~(\ref{alg6.2.7}),~(\ref{alg6.2.8}) and~(\ref{alg6.2.9}).

We now test the routines using the fixed input parameters:\\
$\XMIN, \YMIN = -100$,  $\XMAX,\YMAX  = 100 $,~$\TAUMAX$ = 0.0005
and $\LMAX=14$~and~{\tt sg2 = 0}. The input parameters of
this run are shown in  Table~\ref{run2d1}.

The output of the first run is shown in Table~\ref{stupidtable} 
although we truncated the output to show only the first seven levels.  
To make the
graphs easier to view, we first outline a bounding box for each grid.  
We then shade each grid according to its level, the finest level of each
run is black, whereas the coarsest level is white.
We also include figures which zoom in on certain regions for each graph. 
The graphs of this run are shown in figures~(\ref{fig:6.2.5}), 
(\ref{fig:6.2.6}), and (\ref{fig:6.2.7}).
As we expect, the 
finest grids form a circle around the radius of the smallest hole, since
the truncation error estimates get greater as we approach the singularity. 
In this run, we allowed 14 maximum levels, but the run stopped at 10 levels
since $\tau[j,k]<\TAUMAX $ at level 11.  We also see from the graphs of
these runs, that our clustering algorithm does not work extremely well.
Berger and Rigoutsos\cite{BergerRigoutsos} have a much better algorithm
which we plan to use in the future. 
The truncation error must be isotropic since both of the ``unknowns'' ($u$)
and differential operator are.  Our algorithm  encounters difficulties
when trying to resolve the regions around  the 
holes since  not all of the grids overlap.

The only difference between the first two runs, is that the second run {\em does
not} set $\tau[j,k]=0$ inside the holes.  Thus, we should expect the grids
to zoom into the singularity.  Since we do not allow any grid to have more than
$512 \times 512$ points, the run stopped at the 10$^{th}$ level although the
truncation errors were not below~$\TAUMAX$.
Once again we show three graphs
of the  bounding boxes of the grids for this run.  These graphs are shown in 
figures~(\ref{fig:6.2.8}),~(\ref{fig:6.2.9}), and~(\ref{fig:6.2.10}). 

In the third run, we let the centers of the two holes be very far from 
one another. We also let the radii of both holes be equal to $1 / 2$. 
This run required 13 levels of refinement to get
the truncation error values below~$\TAUMAX$.  
The graphs are shown in figures~(\ref{fig:6.2.11}), (\ref{fig:6.2.12}) and 
 (\ref{fig:6.2.13}).
We see that as soon as we got to the fourth refinement level, the grids were
split into 2 regions. We see that the grids are symmetric from one hole to the
other as would be expected.  The third image for this run zooms into one of the
holes to see the actual refinement grids used around the hole. 
Once again we
see that the clustering routine has done a poor job of refining the region
around the finest level.
Before we can incorporate our clustering routine  into our 3D
multigrid code, we must improve its performance.  

We can expect that these routines
can be used as regridding modules in our 3D MLAT code.
Of course that 
MLAT code will also use a relative truncation error estimate 
instead of the true truncation error.
We did not worry about generating a table  of the efficiencies
since our algorithm does not work extremely well.  As we stated before, the
finest grids around a hole do not always overlap, which is a extreme 
deficiency in the algorithm.

\subsection[AMR in 3D]{AMR in 3D}
\label{3D-adaptive-grids}
The 3D routines are almost identical to the 2D routines.  The only  
real difference between the two versions is in the clustering routines.
In particular, in the procedure {\tt PROCEDURE CLUSTER\_1} we now add
two more ways to look, {\tt UP} and {\tt DOWN} which makes the routine
search in a 7 point stencil now.  
Since it is extremely difficult to display the grid structure, we do not,
particularly since the results look very similar to the two-dimensional
case.
\clearpage
\begin{figure} 
\caption{ The AMR algorithm }
\label{alg6.2.1}
{\small
\begin{tabbing}
\T {\tt PROCEDURE ADAPT\_GRIDS\_1D( $\alpha, \beta, \gamma, \delta, \epsilon, \eta$, $c_1$, $c_2$,min, max} \\
\T\T\T\T\T\T\T\T\T\T\T\T {\tt  $\TAUMAX$,sg2,$\LMAX$  ) } \\
\T\T{\sl Program determines $\tau^h$ from  $\nabla^2 u^h = f^h$ } \\
\T\T{\sl where $u^h =  \alpha + \beta r_1^{-1} + \gamma r_2^{-1} +
\delta r_1{-2} + \epsilon r_2^{-2} + \eta \lb r_1 r_2 \rb^{-1} $} \\
\T\T{\tt $h = 1 / 2 \lb max-min \rb $ \quad {\sl coarsest grid has 3 points }}\\
\T\T{\tt DEFINE\_BASE\_GRID( 1 , $h$, sg2, min, max, gxmin , gxmax , nx ) } \\
\T\T{\tt DEFINE\_GRID\_FUNCTIONS( lhead(0) , nx, gxmin, gxmax ,$h$,}\\
\T\T\T\T\T\T\T\T\T\T\T\T{\tt $\alpha,\beta,\gamma,\delta,\epsilon,\eta,x,u,f,\tau$) }\\
\T\T{\tt $\LEVEL = 0$ } \\
\T\T{\tt refine = \TRUE } \\
\T\T{\tt grid = lhead($\LEVEL$)) } \\
\T\T{\sl Start to loop on all the grids at this level, by first finding }\\
\T\T{\sl the head of the level, and then finding all of the neighbors}\\
\T\T{\tt START }\\
\T\T\T{\tt \IF~refine = \FALSE~\GOTO END }\\
\T\T\T{\tt bins = CLUSTER\_GRID( grid, nx, sg2, $\tau$ , $\TAUMAX$, imin, icount )}\\
\T\T\T{\sl The routine {\tt CLUSTER\_GRID} , makes {\tt bins} clusters of points with {\tt imin(bins))} } \\
\T\T\T{\sl used to store the starting values and {\tt icount(bins)} storing}\\
\T\T\T{\sl  the number of points in the bin}\\
\T\T\T{\tt \IF ( bins > 0) GENERATE\_NEW\_GRIDS( grid, bins, imin, icount,sg2,}\\
\T\T\T\T\T\T\T\T\T\T\T\T\T\T\T\T\T{\tt gxmin, gxmax,nx )}\\
\T\T\T{\sl The routine {\tt GENERATE\_NEW\_GRIDS} determines the number of points on}\\
\T\T\T{\sl  the grid and the extent of the grid. The routine also sets up}\\
\T\T\T{\sl all the new linked lists }\\
\T\T\T{\tt  DEFINE\_GRID\_FUNCTIONS( grid , nx, gxmin, gxmax ,$h$,}\\
\T\T\T\T\T\T\T\T\T\T\T\T\T{\tt $\alpha,\beta,\gamma,\delta,\epsilon,\eta,x,u,f,
\tau$) }\\
\T\T\T{\sl Now {\tt DEFINE\_GRID\_FUNCTIONS} will set up all the grid }\\
\T\T\T{\sl functions on all children of grid {\tt grid} }\\
\T\T\T{\tt \IF (bins > 0) refine = \TRUE }\\
\T\T\T{\tt grid = gpngh(grid) } \\
\T\T\T{\sl Set {\tt grid} equal to its neighbor grid } \\
\T\T\T{\tt \GOTO START } \\
\T\T  {\tt END}\\
\T\T  {\tt PRINT GRIDS }\\
\T {\tt END PROCEDURE } .
\end{tabbing}
}
\end{figure}
%
\begin{figure}
\caption{The AMR  algorithm to define the base grid}
\label{alg6.2.2}
{\small
\begin{tabbing}
\T{\tt PROCEDURE DEFINE\_BASE\_GRID( grid,$h$,sg2,min,max,gxmin,gxmax,nx)}\\
\T{\sl This procedure will set up gxmin ,gxmax and nx for the grid} \\
\T\T {\tt \IF ( sg2 = 0) \THEN }\\
\T\T\T{\tt gxmin(grid) = min }\\
\T\T\T{\tt gxmax(grid) = max }\\
\T\T\T{\tt nx = 1 + $h^{-1} \lb {\tt gxmax(grid)} - {\tt gxmin(grid)} \rb $ } \\
\T\T {\tt \ELSE } \\
\T\T\T{\sl We will only use $2^n + 1$ points on this gridi}\\
\T\T\T{\tt nx = $1 + 2^{ \log_2( h^{-1} \lb max - min \rb )}$}\\
\T\T\T{\tt gxmin(grid) = min}\\
\T\T\T{\tt gxmax(grid) = gxmin(grid) + h * (nx - 1 )}\\
\T\T {\tt \ENDIF} \\
\T {\tt END PROCEDURE } .
\end{tabbing}
%
\begin{tabbing}
\T{\tt PROCEDURE DEFINE\_GRID\_FUNCTIONS( grid , nx, gxmin, gxmax ,$h,\alpha,\beta$,}\\
\T\T\T\T\T\T\T\T\T\T\T\T\T\T\T{\tt$\gamma,\delta,\epsilon,\eta,x,u,f,\tau$)}\\
\T{\sl This routine will determine $x , u, f, $ and $\tau$ for the grid}\\
\T\T{\tt GETX(nx,gxmin(grid),$h$, $x$)} \\
\T\T{\tt GETU(nx,$x,\alpha,\beta,\gamma,\delta,\epsilon,\eta,u$)} \\
\T\T{\tt GETF(nx,$x,\alpha,\beta,\gamma,\delta,\epsilon,\eta,f$)} \\
\T\T{\tt GET\_TAU(nx, $h, u, f,\tau$)}\\
\T{\tt END PROCEDURE}
\end{tabbing}
%
\begin{tabbing}
\T{\tt PROCEDURE  GENERATE\_NEW\_GRIDS( grid, bins, imin, icount,sg2,}\\
\T\T\T\T\T\T\T\T\T\T\T\T\T\T{\tt gxmin, gxmax,nx )}\\
\T{\sl This procedure will free all the memory to be used with this grid}\\
\T{\sl along with setting up all the links for~\LHEAD~,~\GPP~,~\GPNGH~,~\GPSIB~,and~\GPCH.}\\
\T\T{\tt \DO i = 1 , bins } \\
\T\T\T{\tt g=llfree(llnext) \quad {\sl g is the next grid number that has not been used}}\\
\T\T\T{\tt gl(g) = gl(grid) + 1}\\
\T\T\T{\tt min = $x( {\tt imin(i)} )$ } \\
\T\T\T{\tt max = $x( {\tt imin(i) + icount(i)} - 1 )$ } \\
\T\T\T{\tt DEFINE\_BASE\_GRID( grid,$h$,sg2,min,max,gxmin,gxmax,nx)} \\
\T\T\T{\tt lhead(g) = g }\\
\T\T\T{\tt gpp(g) = grid } \\
\T\T\T{\tt gpch(g) = UNDEF} \\
\T\T\T{\tt gpsib(g) = find\_sib(g)}\\
\T\T\T{\tt gpngh(g) = find\_ngh(g)}\\
\T\T{\tt \ENDDO}\\
\T{\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
%
\begin{figure}
\caption{ The 1D clustering AMR algorithm.}
\label{alg6.2.3}
{\small
\begin{tabbing}
\T{\tt PROCEDURE CLUSTER\_GRID(grid, nx, sg2, $\tau$ , $\TAUMAX$, imin, icount )}\\
\T{\sl This functions returns the number of unique group of points}\\
\T\T{\tt $\tau(1) = \tau(2)$ \quad {\sl  $\tau$ is not defined on end points}}\\\T\T{\tt $\tau(nx) = \tau(nx-1)$ }\\
\T\T{\tt  goodbins = 0 }\\
\T\T{\tt  flag = \FALSE }\\
\T\T{\sl Now loop over all points and separate flagged points into clusters}\\
\T\T{\tt \DO i = 1 , n }\\
\T\T\T  {\tt \IF (flag~\AND~\ABS($\tau(i)) \geq$ $\TAUMAX$ ) \THEN }\\
\T\T\T\T  {\tt goodbins = goodbins + 1}\\
\T\T\T\T  {\tt minbin(goodbins) = i }\\
\T\T\T\T  {\tt flag = \FALSE }\\
\T\T\T  {\tt \ELSE \IF ( \NOT~flag~\AND~\ABS($\tau(i)$) < $\TAUMAX$) \THEN }\\
\T\T\T\T  {\tt flag = \TRUE}\\
\T\T\T\T  {\tt maxbin(goodbins) = lastx}\\
\T\T\T  {\tt \ELSE}\\
\T\T\T\T  {\tt lastx = i}\\
\T\T\T\T  {\tt \IF ( \NOT~flag  \AND~goodbins > 0) \THEN}\\
\T\T\T\T\T  {\tt maxbin(goodbins) = lastx }\\
\T\T\T\T  {\tt \ENDIF}\\
\T\T\T  {\tt \ENDIF}\\
\T\T{\tt \ENDDO}\\
\T\T{\sl Now all the points are flagged and separated into unique bins }\\
\T\T{\sl Now we must make sure that each bin contains an odd number of points}\\\T\T{\tt \DO i = 1 , goodbins }\\
\T\T\T{\tt \IF (  \MOD( (maxbin(i) - minbin(i)),2 ) \NOT= 0 ) \THEN }\\
\T\T\T\T{\tt  minbin(i) = minbin(i) + 1 }\\
\T\T\T\T{\sl  We just add an extra point to the front of the bin}\\
\T\T\T{\tt \ENDIF }\\
\T\T{\tt \ENDDO}
\end{tabbing}
}
\end{figure}

\begin{figure}
\begin{center}
Figure~\ref{alg6.2.3} continued
\end{center}
{\small
\begin{tabbing}
\T\T{\sl Now merge together any bins that overlap }\\
\T\T{\tt total\_bins =  MERGE\_BINS(goodbins,minbin,maxbin,$\XMIN$,$\XMAX$)}\\
\T\T{\sl This routine will return the total number of unique bins = MERGE\_BINS}\\
\T\T{\sl This routine also returns the starting points}\\
\T\T{\sl and ending points of the bins in $\XMIN$ and $\XMAX$}\\
\T\T{\tt \IF ( sg2 = \TRUE ) \THEN }\\
%
\T\T\T{\tt START1 }\\
\T\T\T{\tt \DO i = 1 , total\_bins }\\
\T\T\T\T{\tt points = $\XMAX$(i) - $\XMIN$(i) + 1 }\\
\T\T\T\T{\sl If points is not a power of two then add points to $\XMIN$ and $\XMAX$}\\\T\T\T{\ENDDO}\\
\T\T\T{\tt new\_bins =  MERGE\_BINS(goodbins,minbin,maxbin,$\XMIN$,$\XMAX$) }\\
%
\T\T\T{\tt \DO i = 1 , new\_bins }\\
\T\T\T\T{\tt points = $\XMAX$(i)- $\XMIN$(i) + 1 }\\
\T\T\T\T{\sl If points is not a power of two \THEN~\GOTO~START} \\
\T\T\T{\tt \ENDDO}\\
\T\T{\tt total\_bins = new\_bins}\\
\T\T{\tt \ENDIF}\\
\T\T{\sl Now just put the total number of bins in {\tt CLUSTER\_GRID} }\\
\T\T{\sl and the total number of points in $\XMAX$(i) }\\
\T\T{\tt CLUSTER\_GRID = total\_bins }\\
\T\T{\tt \DO i = 1 , CLUSTER\_GRID }\\
\T\T\T{\tt $\XMAX$(i) = $\XMAX$(i) - $\XMIN$(i) +1 }\\
\T\T{\tt \ENDDO}\\
\T{\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}

\begin{figure}
\caption{ A 2D AMR algorithm}
\label{alg6.2.4}
{\small
\begin{tabbing}
\T {\tt PROCEDURE ADAPT\_GRIDS\_2D( $\alpha, \beta, \gamma $, $c_1$, $c_2$,minx, maxx,miny,maxy,} \\
\T\T\T\T\T\T\T\T\T\T\T\T {\tt radius1,radius2,$\TAUMAX$,sg2,}\\
\T\T\T\T\T\T\T\T\T\T\T\T {\tt $\LMAX$,option)}\\
\T\T{\tt DEFINE\_BASE\_GRID2D( ) }\\
\T\T\T\T\T\T\T\T\T\T{\tt  gxmin , gxmax , gymin, gymax , nx ,ny) } \\
\T\T{\tt DEFINE\_GRID\_FUNCTIONS2D( )} \\
\T\T{\tt $\LEVEL$ = 0 } \\
\T\T{\tt refine = \TRUE } \\
\T\T{\tt grid = lhead($\LEVEL$) } \\
\T\T{\tt START }\\
\T\T\T{\tt \IF~refine = \FALSE~\GOTO END }\\
\T\T\T{\tt bins = CLUSTER\_GRID2D( grid, nx, ny, sg2, $\tau$ , $\TAUMAX$,}\\
\T\T\T\T\T\T\T\T\T\T\T{ imin, icount,jmin,jcount )}\\
\T\T\T{\sl The routine {\tt CLUSTER\_GRID} , makes {\tt bins} clusters of points with}\\
\T\T\T{\sl {\tt imin(bins)} and {\tt jmin(bins)} used to store the starting values and  } \\
\T\T\T{\sl {\tt icount(bins),jcount(bins) } storing the number of points in the
bin}\\
\T\T\T{\tt \IF ( bins > 0) \THEN} \\
\T\T\T\T{\tt GENERATE\_NEW\_GRIDS2D( )}\\
\T\T\T{\sl The routine {\tt GENERATE\_NEW\_GRIDS2D} determines the number of points }\\
\T\T\T{\sl  on the grid and the extent of the grid. The routine also sets up}\\
\T\T\T{\sl all the new linked lists }\\
\T\T\T{\tt  \IF (bins>0) \THEN} \\
\T\T\T\T{\tt DEFINE\_GRID\_FUNCTIONS2D( )}\\ 
\T\T\T\T{\sl Now {\tt DEFINE\_GRID\_FUNCTIONS2D} will set up all the grid }\\
\T\T\T\T{\sl functions on all children of grid {\tt grid} }\\
\T\T\T\T{\tt efficiency = CALC\_EFF( )}\\
\T\T\T\T{\sl {\tt  CALC\_EFF} computes the efficiency on the grid as described in the text}\\
\T\T\T{\tt \ENDIF}\\
\T\T\T{\tt \IF (bins > 0) refine = \TRUE }\\
\T\T\T{\tt grid = gpngh(grid) } \\
\T\T\T{\sl Set {\tt grid} equal to its neighbor grid } \\
\T\T\T{\tt \GOTO START } \\
\T\T  {\tt END}\\
\T\T  {\tt PRINT GRIDS }\\
\T {\tt END PROCEDURE } .
\end{tabbing}
}
\end{figure}
%
\begin{figure} 
\caption{ The 2D AMR algorithm used to define the base grid}
\label{alg6.2.5}
{\small
\begin{tabbing}
\T{\tt PROCEDURE DEFINE\_BASE\_GRID2D( grid,$h$,sg2,$\XMIN$,$\XMAX$,$\YMIN$,$\YMAX$ } \\
\T\T\T\T\T\T\T\T\T\T\T\T\T{\tt gxmin,gxmax,gymin,gymax,nx,ny)}\\
\T{\sl This procedure will set up gxmin ,gxmax,gymin,gymax,nx and ny for the grid} \\
\T\T {\tt \IF ( sg2 = 0) \THEN }\\
\T\T\T{\tt gxmin(grid) = $\XMIN$ }\\
\T\T\T{\tt gxmax(grid) = $\XMAX$ }\\
\T\T\T{\tt gymin(grid) = $\YMIN$ }\\
\T\T\T{\tt gymax(grid) = $\YMAX$ }\\
\T\T\T{\sl set {\tt nx} }\\
\T\T\T{\sl set {\tt ny} }\\
\T\T {\tt \ELSE } \\
\T\T\T{\sl We will only use $2^n + 1$ points on this grid}\\
\T\T\T{\tt nx = $1 + 2^{ \log_2( h^{-1} \lb \XMAX - \XMIN \rb  )}$}\\
\T\T\T{\tt ny = $1 + 2^{ \log_2( h^{-1} \lb \YMAX - \YMIN \rb  )}$}\\
\T\T\T{\tt gxmin(grid) = gxmin(grid)}\\
\T\T\T{\tt gxmax(grid) = gxmin(grid) + h * (nx - 1 )}\\
\T\T\T{\tt gymin(grid) = gymin(grid)}\\
\T\T\T{\tt gymax(grid) = gymin(grid) + h * (ny - 1 )}\\
\T\T {\tt \ENDIF} \\
\T {\tt END PROCEDURE } .
\end{tabbing}
%
\begin{tabbing}
\T{\tt PROCEDURE DEFINE\_GRID\_FUNCTIONS2D( )}\\
\T{\sl This routine will determine $x , y, u, f, $ and $\tau$ for the grid}\\
\T{\sl option will tell whether or not $\tau$ will be defined inside {\tt radius1} and {\tt radius2} }\\
\T\T{\tt GETX(nx,gxmin(grid),$h$, $x$)} \\
\T\T{\tt GETX(ny,gymin(grid),$h$, $y$)} \\
\T\T{\tt GETU(nx,ny,$x,y,\alpha,\beta,\gamma,c_1,c_2$,radius1,radius2,$u$)} \\
\T\T{\tt GETF(nx,ny,$x,y,\alpha,\beta,\gamma,c_1,c_2$,radius1,radius2,$f$)} \\
\T\T{\tt GET\_TAU(nx, ny, $h, u, f$,option, radius1, radius2, $c_1,c_2,\tau$)}\\
\T\T{\sl when {\tt option} = 1 then $\tau(i,j)=0$ inside the two holes }\\
\T{\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
%
\begin{figure}
\caption{The 2D AMR algorithm used to generate new grids.}
\label{alg6.2.6}
{\small
\begin{tabbing}
\T{\tt PROCEDURE GENERATE\_NEW\_GRIDS2D( grid, bins, imin, icount,}\\
\T\T\T\T\T\T\T\T\t\T\T\T\T\T\T{\tt jmin, jcount, sg2,gxmin,gxmax,}\\
\T\T\T\T\T\T\T\T\T\T\T\T\T\T{\tt gymin, gymax, nx , ny)}\\
\T{\sl This procedure will free all the memory to be used with this grid}\\
\T{\sl along with setting up all the links for~\LHEAD~,~\GPP~,~\GPNGH~,~\GPSIB~,and~\GPCH.}\\
\T\T{\tt \DO i = 1 , bins } \\
\T\T\T{\tt g=llfree(llnext) \quad {\sl g is the next grid number that has not been used}}\\
\T\T\T{\tt gl(g) = gl(grid) + 1}\\
\T\T\T{\tt minx = $x( {\tt imin(i)} )$ } \\
\T\T\T{\tt maxx = $x( {\tt imin(i) + icount(i)} - 1 )$ } \\
\T\T\T{\tt miny = $y( {\tt jmin(i)} )$ } \\
\T\T\T{\tt maxy = $y( {\tt jmin(i) + jcount(i)} - 1 )$ } \\
\T\T\T{\tt DEFINE\_BASE\_GRID( grid,$h$,sg2,minx,maxx,miny,maxy,}\\
\T\T\T\T\T\T\T\T\T\T\T{\tt gxmin,gxmax,gymin,gymax,nx,ny)} \\
\T\T\T{\tt lhead(g) = g }\\
\T\T\T{\tt gpp(g) = grid } \\
\T\T\T{\tt gpch(g) = UNDEF} \\
\T\T\T{\tt gpsib(g) = find\_sib(g)}\\
\T\T\T{\tt gpngh(g) = find\_ngh(g)}\\
\T\T{\tt \ENDDO}\\
\T{\tt END PROCEDURE}
\end{tabbing}
%
\begin{tabbing}
\T{\tt PROCEDURE CLUSTER\_GRID2D( grid, nx, ny, sg2, $\tau$ , $\TAUMAX$,}\\
\T\T\T\T\T\T\T\T\T\T\T{ imin, icount,jmin,jcount )}\\
%
\T\T{\sl STEP1: First set $\tau(i,j)$ on the end points to the value one point over}\\
\T\T{\sl STEP2: COMPUTE  \CHAR(i,j) }\\
\T\T{\tt \DO j = 1 , ny }\\
\T\T\T{\tt \DO i = 1 , nx }\\
\T\T\T\T{\tt \CHAR(i,j) = \FALSE }\\
\T\T\T\T{\tt \IF ( \ABS( $\tau$(i,j) )$\geq $ $\TAUMAX$ ) \CHAR(i,j) = \TRUE }\\
\T\T\T{\tt \ENDDO}\\
\T\T{\tt \ENDDO}\\
\T\T{\sl STEP3: NOW form the bins }\\
\T\T{\tt CLUSTER\_GRID2D = FORM\_BIN( nx , ny, \CHAR , temp, sg2, imin,}\\
\T\T\T\T\T\T\T\T\T\T\T\T\T{\tt  icount,jmin,jcount}\\
\T{\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
%
\begin{figure} 
\caption{ The 2D AMR algorithm to cluster the points.}
\label{alg6.2.7}
{\small
\begin{tabbing}
\T{\tt PROCEDURE  FORM\_BIN( nx , ny, \CHAR , temp, sg2, imin, icount,jmin,jcount)}\\
\T\T{\sl set the temp array equal to 0 on all elements }\\
\T\T{\tt temp(i,j) = 0 }\\
\T\T{\tt bins = CLUSTER\_1( nx,ny,\CHAR, temp )}\\
\T\T{\tt FORM\_RECT( nx,ny,bins, temp, imin, jmin, icount, jcount) }\\
\T\T{\tt \IF (sg2=1) RESIZE\_RECT( nx,ny,bins ,imin,jmin,icount,jcount)}\\
\T\T{\tt FORM\_BIN = bins }\\
\T{\tt END PROCEDURE}
\end{tabbing}
%
\begin{tabbing}
\T{\tt PROCEDURE CLUSTER\_1( nx,ny,\CHAR, temp )}\\
\T\T{\sl uses a recursive function to cluster all points that are}\\
\T\T{\sl connected together by their nearest neighbors}\\
\T\T{\tt bin = 0 }\\
\T\T{\tt RIGHT = 0 }\\
\T\T{\tt LEFT = 1 }\\
\T\T{\tt UP   = 2 }\\
\T\T{\tt DOWN = 3 }\\
\T\T{\tt \DO j =  , ny }\\
\T\T\T{\tt \DO i =  , nx }\\
%
\T\T\T\T{\tt \IF ( CHAR(i,j)~\AND~(temp(i,j)=0) ) \THEN}\\
\T\T\T\T\T{\tt bin = bin + 1}\\
\T\T\T\T\T{\tt temp(i,j) = bin}\\
%
\T\T\T\T\T{\tt \IF ( \CHAR(i+1,j)~\AND~temp(i+1,j)=0) \THEN}\\
\T\T\T\T\T\T{\tt id = FILL( RIGHT , bin, i, j, \CHAR, temp, nx , ny)}\\
\T\T\T\T\T{\tt \ENDIF}\\
%
\T\T\T\T\T{\tt \IF ( \CHAR(i-1,j)~\AND~temp(i-1,j)=0) \THEN}\\\T\T\T\T\T\T{\tt id = FILL( LEFT , bin, i, j, \CHAR, temp, nx , ny)}\\
\T\T\T\T\T{\tt \ENDIF}\\
%
\T\T\T\T\T{\tt \IF ( \CHAR(i,j+1)~\AND~temp(i,j+1)=0) \THEN}\\\T\T\T\T\T\T{\tt id = FILL( UP , bin, i, j, \CHAR, temp, nx , ny)}\\
\T\T\T\T\T{\tt \ENDIF}\\
%
\T\T\T\T\T{\tt \IF ( \CHAR(i,j-1)~\AND~temp(i,j-1)=0) \THEN}\\\T\T\T\T\T\T{\tt id = FILL( DOWN , bin, i, j, \CHAR, temp, nx , ny)}\\
\T\T\T\T\T{\tt \ENDIF}\\
%
\T\T\T\T{\tt \ENDIF}\\
\T\T\T{\tt \ENDDO}\\
\T\T{\tt \ENDDO}\\
\T{\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
%
\begin{figure}
\caption{ The 2D AMR recursive routine to determine which points to cluster together.}
\label{alg6.2.8}
{\small
\begin{tabbing}
\T{\tt RECURSIVE  PROCEDURE FILL ( direction, bin, i\_in, j\_in, \CHAR, temp,nx,ny)}\\
\T\T{\sl This routine is capable of calling itself, and will look in all directions to}\\
\T\T{\sl find where~\CHAR~is \TRUE }\\
\T\T{\tt RIGHT = 0 }\\
\T\T{\tt LEFT = 1 }\\
\T\T{\tt UP   = 2 }\\
\T\T{\tt DOWN = 3 }\\
\T\T{\tt i = i\_in}\\
\T\T{\tt j = j\_in}\\
\T\T{\tt \IF (direction = RIGHT) i = i + 1 }\\
\T\T{\tt \IF (direction = LEFT) i = i - 1 }\\
\T\T{\tt \IF (direction = UP) j = j + 1 }\\
\T\T{\tt \IF (direction = DOWN) j = j - 1 }\\
\T\T{\tt fill = 0 }\\
\T\T{\tt \IF (~\NOT~CHARM~\OR~temp(i,j) $\not= 0$ ) \THEN}\\
\T\T\T{\tt END PROCEDURE} \\
\T\T{\tt \ELSE }\\
\T\T\T{\tt temp(i,j) = bin } \\
%
\T\T\T{\tt \IF ( \CHAR(i+1,j)~\AND~temp(i+1,j)=0) \THEN}\\
\T\T\T\T{\tt id = FILL( RIGHT , bin, i, j, \CHAR, temp, nx , ny)}\\
\T\T\T{\tt \ENDIF}\\
%
\T\T\T{\tt \IF ( \CHAR(i-1,j)~\AND~temp(i-1,j)=0) \THEN}\\
\T\T\T\T{\tt id = FILL( LEFT , bin, i, j, \CHAR, temp, nx , ny)}\\
\T\T\T{\tt \ENDIF}\\
%
\T\T\T{\tt \IF ( \CHAR(i,j+1)~\AND~temp(i,j+1)=0) \THEN}\\
\T\T\T\T{\tt id = FILL( UP , bin, i, j, \CHAR, temp, nx , ny)}\\
\T\T\T{\tt \ENDIF}\\
%
\T\T\T{\tt \IF ( \CHAR(i,j-1)~\AND~temp(i,j-1)=0) \THEN}\\
\T\T\T\T{\tt id = FILL( DOWN , bin, i, j, \CHAR, temp, nx , ny)}\\
\T\T\T{\tt \ENDIF}\\
%
\T\T{\tt \ENDIF}\\
\T{\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
%
\begin{figure}
\caption{ The 2D AMR algorithm used to form rectangles around the flagged points} 
\label{alg6.2.9}
{\small
\begin{tabbing}
\T{\tt PROCEDURE FORM\_RECT( nx,ny,temp,bins, imin, jmin, icount, jcount) }\\
\T{\sl Given the array, {\tt temp} , form rectangles }\\
\T\T{\sl set {\tt imin} array = nx, {\tt jmin} array = ny,}\\
\T\T{\sl {\tt icount} array =-1, {\tt jcount} array = -1 }\\
\T\T{\tt \DO j = 1 , ny }\\
\T\T\T{\tt  \DO i = 1 , nx }\\
\T\T\T\T{\tt \IF ( temp(i,j) $\not=$ 0 ) \THEN }\\
\T\T\T\T\T{\tt \IF ( i $\leq$ imin(temp(i,j)) \THEN}\\
\T\T\T\T\T\T{\tt imin(temp(i,j) = i }\\
\T\T\T\T\T{\tt \ENDIF}\\
\T\T\T\T\T{\tt \IF ( j $\leq$ jmin(temp(i,j)) \THEN}\\
\T\T\T\T\T\T{\tt jmin(temp(i,j) = j }\\
\T\T\T\T\T{\tt \ENDIF}\\
\T\T\T\T\T{\tt \IF ( i $\geq$ icount(temp(i,j)) \THEN}\\
\T\T\T\T\T\T{\tt icount(temp(i,j) = i }\\
\T\T\T\T\T{\tt \ENDIF}\\
\T\T\T\T\T{\tt \IF ( j $\geq$ jcount(temp(i,j)) \THEN}\\
\T\T\T\T\T\T{\tt jcount(temp(i,j) = j }\\
\T\T\T\T\T{\tt \ENDIF}\\
\T\T\T\T{\tt \ENDIF}\\
\T\T\T{\tt  \ENDDO}\\
\T\T{\tt \ENDDO}\\
\T\T{\tt \DO i = 1 , bins}\\
\T\T\T{\tt icount(i) = icount(i) - imin(i) + 1}\\
\T\T\T{\tt jcount(i) = jcount(i) - jmin(i) + 1}\\
\T\T{\tt \ENDDO}\\
\T\T{\tt \DO i = 1 , bins}\\
\T\T\T{\tt \IF ( \MOD(icount(i),2) = 0 ) icount(i) = icount(i) + 1}\\
\T\T\T{\tt \IF ( \MOD(jcount(i),2) = 0 ) jcount(i) = jcount(i) + 1}\\
\T\T{\tt \ENDDO}\\
\T{\tt END PROCEDURE}
\end{tabbing}
%
\begin{tabbing}
\T{\tt PROCEDURE RESIZE\_RECT(( nx,ny,bins ,imin,jmin,icount,jcount)}\\
\T{\sl Makes sure that the rectangles have $2^n + 1$ points per side}\\
\T\T{\tt \DO i = 1 , bins}\\
\T\T\T{\sl Add points to icount(i) , and change imin(i)}\\
\T\T\T{\sl Add points to jcount(i) , and change jmin(i)}\\
\T\T{\tt \ENDDO} \\
\T{\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}

\begin{table} [p]
\begin{caption}
   {1D AMR test parameters } \vskip 5pt
\label{6.2.input}
\end{caption}
\centering
{\small
\begin{tabular}{cccccccccc} \hline\hline
run number&{\tt sg2} &  $\alpha$  &  $\beta$  &  $\gamma$ &  $\delta$ &  $\epsilon$  &  $\eta$  &  $c_1$  &   $c_2$   \\ \hline
1 &0 & 1.0 & 1.5 & 1.0 & 10.0 & 10.0 & 0.0 & -10.0 & 10.0 \\
2 &1 & 1.0 & 1.5 & 1.0 & 10.0 & 10.0 & 0.0 & -10.0 & 10.0 \\
3 &0 & 1.0 & 1.0 & 1.0 &  0.0 &  0.0 & 0.0 & -10.0 & 10.0 \\ \hline \hline 
\end{tabular}
}
\end{table}

\begin{table} [p]
\begin{caption}
   {1D AMR test, output for run1} \vskip 5pt
   \label {table:6.2}
\end{caption}
\centering
{\small
\begin{tabular}{cccc} \hline\hline
$\LEVEL$& {\tt GXMIN }& {\tt GXMAX} & {\tt NX }\\  \hline
   0& -1.00000e+02&  1.00000e+02&    3\\
   1& -1.00000e+02&  1.00000e+02&    5\\
   2& -5.00000e+01&  5.00000e+01&    5\\
   3& -2.50000e+01&  2.50000e+01&    5\\
   4& -2.50000e+01&  2.50000e+01&    9\\
   5& -2.50000e+01&  2.50000e+01&   17\\
   6& -1.56250e+01&  1.56250e+01&   21\\
   7&  3.12500e+00&  1.56250e+01&   17\\
   7& -1.56250e+01& -3.12500e+00&   17\\
   8& -1.40625e+01& -6.25000e+00&   21\\
   8&  6.25000e+00&  1.40625e+01&   21\\
   9&  6.25000e+00&  1.32813e+01&   37\\
   9& -1.32813e+01& -6.25000e+00&   37\\
  10& -1.28906e+01& -7.42188e+00&   57\\
  10&  7.22656e+00&  1.26953e+01&   57\\ \hline \hline
\end{tabular}
}
\end{table}

\begin{figure} 
   \caption{  The output of the first run in testing the 1D AMR routine} 
   \label {fig:6.2.1}
   \centerline{\psfig{figure=run1.ps}}
\end{figure}

\begin{table} [p]
   {1D AMR test, output for run2} \vskip 5pt
\begin{caption}
   {1D AMR test, output for run2} \vskip 5pt
   \label {fig:run2}
\end{caption}
\centering
{\small
\begin{tabular}{cccc} \hline\hline
$\LEVEL$& {\tt GXMIN }& {\tt GXMAX} & {\tt NX }\\  \hline
   0&  -1.00000e+02&  1.00000e+02&    3\\
   1&  -1.00000e+02&  1.00000e+02&    5\\
   2&  -1.00000e+02&  1.00000e+02&    9\\
   3&  -5.00000e+01&  5.00000e+01&    9\\
   4&  -5.00000e+01&  5.00000e+01&   17\\
   5&  -2.50000e+01&  2.50000e+01&   17\\
   6&  -2.50000e+01&  2.50000e+01&   33\\
   7&   3.12500e+00&  1.56250e+01&   17\\
   7&  -1.56250e+01& -3.12500e+00&   17\\
   8&  -1.56250e+01& -3.12500e+00&   33\\
   8&   3.12500e+00&  1.56250e+01&   33\\
   9&   3.12500e+00&  1.56250e+01&   65\\
   9&  -1.56250e+01& -3.12500e+00&   65\\
  10&  -1.32813e+01& -7.03125e+00&   65\\
  10&   7.03125e+00&  1.32813e+01&   65\\ \hline \hline
\end{tabular}
}
\end{table}
\begin{figure} 
   \caption{  The output of the second run in testing the 1D AMR routine} 
   \label {fig:6.2.2}
   \centerline{\psfig{figure=run2.ps}}
\end{figure}

\begin{table} [p]
   {1D AMR test, output for run3} \vskip 5pt
   \label{run3}
\centering
{ \small
\begin{tabular}{cccc} \hline\hline
$\LEVEL$& {\tt GXMIN }& {\tt GXMAX} & {\tt NX }\\  \hline
   0&  -1.00000e+02& 1.00000e+02&    3\\
   1&  -1.00000e+02& 1.00000e+02&    5\\
   2&  -5.00000e+01& 5.00000e+01&    5\\
   3&  -2.50000e+01& 2.50000e+01&    5\\
   4&  -2.50000e+01& 2.50000e+01&    9\\
   5&  -1.25000e+01& 1.25000e+01&    9\\
   6&   6.25000e+00& 1.25000e+01&    5\\
   6&  -1.25000e+01&-6.25000e+00&    5\\
   7&  -1.25000e+01&-6.25000e+00&    9\\
   7&   6.25000e+00& 1.25000e+01&    9\\
   8&   7.81250e+00& 1.25000e+01&   13\\
   8&  -1.25000e+01&-7.81250e+00&   13\\
   9&  -1.17188e+01&-7.81250e+00&   21\\
   9&   7.81250e+00& 1.17188e+01&   21\\
  10&   8.59375e+00& 1.13281e+01&   29\\
  10&  -1.13281e+01&-8.59375e+00&   29\\ \hline \hline
\end{tabular}
}
\end{table}

\begin{figure}
   \caption{  The output of the third run in testing the 1D AMR routine} 
   \label {fig:6.2.3}
   \centerline{\psfig{figure=run3.ps}}
\end{figure}

\clearpage

\begin{table}
\begin{caption}
   { 2D AMR test parameters } \vskip 5pt
   \label{run2d1}
\end{caption}
\centering
{\small
\begin{tabular}{ccccccccc} \hline\hline
run number&{\tt option} & $\alpha$  &  $\beta$ &  $\gamma$ &  $c_1$  &  $c_2$  &  {\tt radius1} &   {\tt radius2}   \\ \hline
1 &1 & 1.0 & 3.0 & 1.0 & (0.0,-5.0) & (0.0,5.0) & 3.0 & 1.0 \\
2 &0 & 1.0 & 3.0 & 1.0 & (0.0,-5.0) & (0.0,5.0) & 3.0 & 1.0 \\
3 &0 & 1.0 & 2.0 & 2.0 & (0.0,-10.0) & (0.0,10.0) & 0.5 & 0.5 \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table} [p]
\begin{caption}
   {2D AMR test, output for run1} \vskip 5pt
   \label{stupidtable}
\end{caption}
\centering
{\small
\begin{tabular}{cccccccc} \hline\hline
$\LEVEL$& {\tt GXMIN }& {\tt GXMAX} & {\tt GYMIN} & {\tt GYMAX}& {\tt NX }& {\tt NY} & {\tt tau\_avg}\\  \hline
   0&-1.000e+02& 1.000e+02&-1.000e+02& 1.000e+02&  17&  17& 2.648e-04\\
   1&-3.750e+01& 3.750e+01&-5.000e+01& 5.000e+01&  13&  17& 4.371e-03\\
   2&-2.500e+01& 2.500e+01&-3.125e+01& 3.125e+01&  17&  21& 4.575e-03\\
   3&-1.563e+01& 1.563e+01&-2.188e+01& 2.188e+01&  21&  29& 5.482e-03\\
   4&-1.094e+01& 1.094e+01&-1.563e+01& 1.563e+01&  29&  41& 4.442e-03\\
   5&-7.813e+00& 7.813e+00&-1.250e+01& 1.094e+01&  41&  61& 1.686e-03\\
   6&-4.297e+00& 4.297e+00& 0.000e+00& 9.375e+00&  45&  49& 1.558e-03\\
   6&-1.953e+00& 1.953e+00&-2.734e+00& 1.172e+00&  21&  21& 1.931e-04\\
   6& 7.813e-01& 3.906e+00&-4.297e+00&-1.172e+00&  17&  17& 1.782e-04\\
   6&-3.906e+00&-7.813e-01&-4.297e+00&-1.172e+00&  17&  17& 1.782e-04\\
   6& 2.344e+00& 5.469e+00&-7.031e+00&-3.125e+00&  17&  21& 2.023e-04\\
   6&-5.469e+00&-2.344e+00&-7.031e+00&-3.125e+00&  17&  21& 2.023e-04\\
   6&-3.906e+00& 3.906e+00&-1.055e+01&-5.859e+00&  41&  25& 1.445e-04\\
   7& 1.563e+00& 2.734e+00&-7.813e+00&-6.641e+00&  13&  13& 1.083e-04\\
   7&-2.734e+00&-1.563e+00&-7.813e+00&-6.641e+00&  13&  13& 1.083e-04\\
   7&-1.172e+00& 1.172e+00&-8.984e+00&-7.422e+00&  25&  17& 1.309e-04\\
   7&-3.906e+00&-2.344e+00&-6.250e+00&-3.516e+00&  17&  29& 1.180e-04\\
   7& 2.539e+00& 4.102e+00&-6.250e+00&-3.516e+00&  17&  29& 1.082e-04\\
   7&-1.367e+00&-7.813e-01&-2.539e+00&-1.758e+00&   7&   9& 8.211e-05\\
   7&-2.344e+00&-1.172e+00&-2.930e+00&-2.148e+00&  13&   9& 9.926e-05\\
   7&-2.734e+00&-1.563e+00&-3.516e+00&-2.344e+00&  13&  13& 1.157e-04\\
   7&-3.320e+00&-2.539e+00&-4.297e+00&-3.125e+00&   9&  13& 5.541e-05\\
   7& 7.813e-01& 1.953e+00&-2.539e+00&-1.758e+00&  13&   9& 5.348e-05\\
   7& 1.367e+00& 2.539e+00&-2.930e+00&-2.148e+00&  13&   9& 1.020e-04\\
   7& 1.758e+00& 2.930e+00&-3.516e+00&-2.344e+00&  13&  13& 1.016e-04\\
   7& 2.539e+00& 3.320e+00&-4.297e+00&-3.125e+00&   9&  13& 5.541e-05\\
   7&-1.172e+00& 1.172e+00&-2.344e+00&-7.813e-01&  25&  17& 1.174e-04\\
   7& 5.859e-01& 1.367e+00&-2.539e+00&-1.758e+00&   9&   9& 1.041e-04\\
   7&-1.367e+00&-5.859e-01&-2.539e+00&-1.758e+00&   9&   9& 1.041e-04\\
   7& 1.367e+00& 1.953e+00&-2.734e+00&-1.563e+00&   7&  13& 4.155e-05\\
   7&-1.953e+00&-7.813e-01&-2.734e+00&-1.563e+00&  13&  13& 5.322e-05\\
   7&-3.125e+00& 3.125e+00& 1.758e+00& 8.398e+00&  65&  69& 7.428e-04\\ \hline \hline
\end{tabular}
}
\end{table}

\begin{figure}
   \caption{  The output of the first run in testing the 2D AMR routine} 
   \label {fig:6.2.5}
 	\vskip  0.5in
   \centerline{\psfig{figure=run2d1z1.ps}}
\end{figure}
%
\begin{figure}
   \caption{  A close-up view  of the first run in testing the 2D AMR routine} 
   \label {fig:6.2.6}
	\vskip 0.5in
   \centerline{\psfig{figure=run2d1z2.ps}}
\end{figure}

%
\begin{figure}
   \caption{  A close-up view  of the hole for run 1, used in testing the 2D AMR routine} 
   \label {fig:6.2.7}
	\vskip  0.5in
   \centerline{\psfig{figure=run2d1z3.ps}}
\end{figure}
%
\begin{figure}
   \caption{  The output of the second run in testing the 2D AMR routine} 
   \label {fig:6.2.8}
	\vskip 0.5in
   \centerline{\psfig{figure=run2d2z1.ps}}
\end{figure}

\begin{figure} 
   \caption{  A close-up view  of the second run in testing the 2D AMR routine} 
   \label {fig:6.2.9}
	\vskip 0.5in
   \centerline{\psfig{figure=run2d2z2.ps}}
\end{figure}

\begin{figure}
   \caption{  A close-up view  of the hole for run 2 used in testing the 2D AMR routine} 
   \label {fig:6.2.10}
	\vskip 0.5in
   \centerline{\psfig{figure=run2d2z3.ps}}
\end{figure}
%\clearpage
%
\begin{figure}
   \caption{  The output of the third  run in testing the 2D AMR routine} 
   \label {fig:6.2.11}
	\vskip 0.5in
   \centerline{\psfig{figure=run2d3z1.ps}}
\end{figure}
%
\begin{figure}
   \caption{  A close-up view  of the third run in testing the 2D AMR routine} 
   \label {fig:6.2.12}
	\vskip 0.5in
   \centerline{\psfig{figure=run2d3z2.ps}}
\end{figure}
\begin{figure}
   \caption{  A close-up view  of the hole for run 3 used in testing the 2D AMR routine} 
   \label {fig:6.2.13}
	\vskip 0.5in
   \centerline{\psfig{figure=run2d3z3.ps}}
\end{figure}
%
\clearpage
\section [Examination of the outer boundary in 1D] {Examination of the outer boundary in 1D} 
\label{EOB}
% CODE LIVES AT:
% /charon/u0/ph/az/scott2/newmgml1/try2/deff/adapt/fmg
% and at the program subdirectory of this thesis
In this section we examine the application of a 
Robin outer boundary condition in one dimension.
The ideas that we will tie into this section are boundary smoothing,
boundary transfers, deferred correction and Richardson extrapolation.  
The goals of this section are simple.  We wish to develop techniques
to incorporate
the outer boundary condition,
\begin{eqnarray}
u \rightarrow 1 \ \ \ \ \ \ 
{\rm as } \qquad r \rightarrow \infty \nonumber
\end{eqnarray}
with multigrid techniques.  
However we do not provide a mechanism to treat an unbounded domain 
with this code; instead, we will always impose the outer boundary 
condition at some fixed location, $x_{\rm max}$.
We mentioned earlier that the boundaries
were to be handled separately from the interior points, and in this section
we describe the algorithms to handle this boundary condition along with
our implementation of deferred correction .
 
Our model problem is now
\begin{eqnarray}
\frac{\partial^2 u \lb x \rb }{\partial x^2} &=& f \lb x \rb  \quad x = 1 \cdots \XMAX \\
\label{outbc6.3}
\frac{\partial u}{\partial x}&=&\frac{1 - u}{x} \quad x=\XMAX  \\
u \lb  1 \rb  &=&  u \lb  x = 1  \rb \nonumber,
\end{eqnarray}
where $\XMAX = 3$ . Again, we specify the solution
\begin{eqnarray}
  u \lb x \rb  = 1 + \frac{1}{x}  \nonumber,
\end{eqnarray}
which requires
\begin{eqnarray}
f \lb x \rb  = \frac{2}{x^3} \nonumber .
\end{eqnarray}
These equations are differenced as
\begin{eqnarray}
\frac{u[j+1] -2 u[j] + u[j-1]}{h^2} = f[j] \quad j = 2 \cdots n-1,
\end{eqnarray}
and 
\begin{eqnarray}
\label{labxm}
\frac{u^*[j] - u[j-1]}{h} - \frac{ 1 - u^*[j]}{\XMAX} = g \quad j = n
\end{eqnarray}
where $\XMAX$ is the position of the outer boundary,
$u^{*}[j]$ is an intermediate value of $u[j]$, 
and $g$ is the right
hand side of the outer boundary equation, which is zero.
These equations are
represented as
\begin{eqnarray}
L^h u^h[j] &=& f^h[j] \quad j = 2 \cdots n-1 \nonumber \\
Z^h_1 u^h[j] &=& g^h[j] \quad j = n.
\end{eqnarray}
We only discretize the boundary equation to first order 
since we will make use of 
deferred correction to recover an expandable second-order solution.
Now, the boundary operators we use do not contain the constant terms
such as
\begin{eqnarray}
\frac{1}{{\XMAX}}
\end{eqnarray}
in equation~(\ref{labxm}).
The fourth order boundary operator which we will use for deferred
correction is
\begin{eqnarray}
Z^h_4 u^h[n] &=& \frac{\frac{25}{12} u[n]  - 4 u[n-1] + 3 u[n-2] - \frac{4}{3}
u[n-3] + \frac{1}{4} u[n-4]}{h }\nonumber \\
 &+& \frac{u[n]}{x[n]},
\end{eqnarray}
and the second order boundary operator is defined by
\begin{eqnarray}
Z^h_2 u^h[n] = \frac{3 u[n] - 4 u[n-1] + u[n-2] }{2 h} + \frac{u[n]}{x[n]}.
\end{eqnarray}
We use this second-order operator for test purposes only, in order to verify
that the solution of the difference equations will not be extrapolatable 
when this operator is used.
Finally, the first order operator is:
\begin{eqnarray}
Z^h_1 u^h[n] = \frac{ u[n] - u[n-1] }{h} + \frac{u[n]}{x[n]}.
\end{eqnarray}
We now treat this  boundary equation separately from the interior equations.
Since we
have a uniform domain, the boundary  equation will be only partially relaxed
using
\begin{eqnarray}
u[j] := u[j] + \alpha  u^*[j] \quad j = n ,
\label{outbcpr}
\end{eqnarray}
where $\alpha \geq 0 $ is the relaxation factor. 
The interior
transfers use the full weighted restriction operator defined by equation~(\ref{1drest}), 
and our prolongation operator is given
by equation~(\ref{1dpro}). The transfers for the boundary points will
all be injections, {\sl i.e.}, the restrictions are defined by
\begin{eqnarray}
u^H[N] = \REST u^h[n] = u^h[n]
\end{eqnarray}
where $n = 2 N - 1$ and the prolongations are defined by
\begin{eqnarray}
u^h[n] = \PRO u^H[N] = u^H[N]
\end{eqnarray}

The relative truncation error  estimate for the boundary point is 
determined from 
\begin{eqnarray}
\tau^H_h[N] = Z^H_1 \REST u^h[n] - \REST Z^h_1  u^h[n] ,
\end{eqnarray}
where
\begin{eqnarray}
Z^h_1  u^h[n] = \frac{ u[j]- u[j-1]}{h} + \frac{u[j]}{x[j]} \quad j=n .
\end{eqnarray}

We will use deferred correction only on the finest level of the V-cycle.  
Thus, when we use a FMG routine, the deferred
correction routine gets invoked directly after the finest level of each
problem
is to be smoothed.
The order used in the deferred correction algorithm is a input parameter
which allows us to examine the minimum order needed in ordr to get
extrapolatable results.
Since we saw in section(~\ref{DC}) that boundary equations like
this will not produce extrapolatable results when only differenced to 
second order,  we should expect to see this non-extrapolatable behavior.

\subsection[1D MG FAS algorithm using outer boundary condition]{1D MG FAS algorithm using outer boundary condition}
\label{AlgorithmOB}
We will only describe the algorithm for the $V$-cycle (Figure~\ref{alg6.3.1})
since 
for our problem a $V$-cycle always converges more rapidly than any 
other 
$\mu$ cycle. 
As we just stated, 
we see that the deferred correction is only invoked on the finest level, just
before a coarse grid correction occurs.
\begin{figure} [h]
\caption{ The V-cycle FAS algorithm with incorporation of deferred correction for the outer boundary}
\label{alg6.3.1}
{\small
\begin{tabbing}
\T {\tt PROCEDURE VCYCLE\_FAS(~ncycle, $\LMAX$, \PRE, \PST~,~order) } \\
\T\T {\tt \DO \CYCLE = 1 ,ncycle   }  \\
\T\T\T { \sl Cycle up to the coarsest level } \\
\T\T\T { \tt \DO  $\LEVEL = \LMAX , \LCOARSE+1$ } \\
\T\T\T\T {\tt \IF ($\LEVEL \not= \LMAX$ \OR~\CYCLE = 1 ) \THEN } \\
\T\T\T\T\T {\tt \DO  p = 1 , pre } \\
\T\T\T\T\T\T {\tt  RELAX\_INTERIOR($u^h[j]= f^h[j]$) \quad $j=2\cdots n-1$}\\
\T\T\T\T\T\T       {\tt RELAX\_BOUNDARY($u^h[n]= g^h[n]$,$\alpha$) \quad j=n}\\
\T\T\T\T\T {\tt \ENDDO }\\
\T\T\T\T {\tt \ENDIF}\\
\T\T\T\T {\tt \IF~( $\LEVEL=\LMAX$ ) \THEN}\\
\T\T\T\T\T {\sl Now apply deferred correction}\\
\T\T\T\T\T {\tt \IF ( ORDER = 2) \THEN } \\
\T\T\T\T\T\T {\tt $g^h[n] := Z^h_2( u[n]) - Z^h_1( u[n]) $}\\
\T\T\T\T\T\T {\sl Since $g^h=0$ on the finest level, we determine $g^h$}\\
\T\T\T\T\T\T {\sl only from the difference of the operators}\\
\T\T\T\T\T {\tt \ELSE~\IF ( ORDER = 4) \THEN}\\
\T\T\T\T\T\T {\tt $g^h[n] \rightarrow Z^h_4( u[n]) - Z^h_1( u[n])$ }\\
\T\T\T\T\T {\tt \ENDIF}\\
\T\T\T\T {\tt \ENDIF}\\
\T\T\T\T{ \tt $ \tau^H_h[J] = L^H \REST u^h[j] - \REST L^h u^h[J]$, \quad $J=2 \cdots n-1$}\\
\T\T\T\T{ \tt $ \tau^H_h[N] = Z^H_1 \REST u^h[n] - \REST Z^h_1 u^h[n]$}\\
\T\T\T\T{ \tt $ f^H[J] = \REST f^h[j] + \tau^H_h[J] $ \quad {\sl Correct the rhs}} \\
\T\T\T\T{ \tt $ g^H[N] = \REST g^h[n] + \tau^H_h[n] $ \quad {\sl Correct the rhs of the outer boundary}} \\
\T\T\T { \tt \ENDDO } \\
\T\T\T{ \tt SOLVE($L^H u^H = f^H$, and $Z^H_1 u^H = g^H$) } \\
\T\T\T {\tt  \DO  $\LEVEL = \LCOARSE , \LMAX - 1$} \\
\T\T\T\T { \tt $ u^h[j] :=  u^h[j] + \PRO \lb u^H[J]  - \REST u^h[j] \rb $ , \quad $j = 2 \cdots n-1$} \\
\T\T\T\T { \tt $ u^h[n] :=  u^h[j] + \PRO \lb u^H[N]  - \REST u^h[n] \rb $ , \quad j = n} \\
\T\T\T\T { \sl Now smooth out $u^h$ } \\
\T\T\T\T {\tt \DO  q = 1 , pst } \\
\T\T\T\T\T\T       {\tt  RELAX\_INTERIOR($u^h[j], f^h[j]$)  \quad $j=2\cdots n-1$}\\
\T\T\T\T\T\T       {\tt  RELAX\_BOUNDARY($u^h[n], g^h[n]$,$\alpha$) \quad j=n}\\
\T\T\T\T {\tt \ENDDO} \\
\T\T\T{ \tt \ENDDO} \\
\T\T {\tt \ENDDO} \\
\T{ \tt END PROCEDURE }
\end{tabbing}
}
\end{figure}
\clearpage

\subsection[Results]{Results}
\label{6.3.results}
The first table, Table~\ref{table6.3.1}, presents the results of
an experimental study
to determine
which $\alpha$ 
gives the fastest convergence.  This table shows the convergence rate versus
$\alpha$ for an 8 level system.  We have verified that the convergence rates,
$\rho$, are the same for different level systems.  We let {\tt order} = 1 for
these results so that deferred correction is disabled here.
We also iterate until the
residuals have been driven down to machine accuracy.\footnote{ We define 
$\epsilon$ (machine accuracy) such that $\epsilon$ is the smallest floating
point number such that $1.0 + \epsilon=1.0$ .}
We clearly see that the best $\alpha$ is a small, but non-zero value.

In Table~\ref{table6.3.2},  
we show the $\LONE$ norm of the error, $e$, of the difference solution
relative to the exact solution~(\ref{erroreqn})
again computed with 
{\tt order} =1. We expect first order convergence since the 
boundary condition is only treated to first order
and this is what we observe.
Here we set 
$\alpha= {\rm 1.0e-10}$ 
since we have seen that this will give the 
fastest convergence.  Since we do not get second order results, there is no 
need to check for extrapolatable results. The order that we are getting is
determined from 
\begin{eqnarray}
O = \log_2 \lb \frac{ e_{l+1}}{e_{l}}\rb  \nonumber
\end{eqnarray}
Thus, the order for this output is determined from
\begin{eqnarray}
O = \log_2 \lb \frac{ {\rm 2.18e-05}}{\rm 4.38e-05} \rb \approx 1.0 \nonumber
\end{eqnarray}

Now it will be informative to see if we could use {\tt order}= 2, and get
extrapolatable results.  We see that in Table~\ref{table6.3.3}, 
the errors clearly go down by a factor
of four.  We also see that the convergence rate slows down quite a bit.  
As we mentioned previously, in the asymptotic limit, the convergence rate
will be that of the higher order operator, even though the algorithm relaxes
the boundary point only to first order.
Figure~\ref{fig:6.3.1} shows a logarithmic
plot of the errors.  We only plot 17 points on each level, and the larger
symbols correspond to the coarser levels.  The dotted lines in the figure
are evenly spaced lines which are factors of $\log_{10} \lb 2 \rb $ apart 
from each other.  Thus,
fourth order errors should be signaled by points which are separated 
by 4 lines.
Clearly, 
the results show that the errors are not fourth order, but rather third order.
Heuristically, we can argue that this occurs 
because the outer boundary was only corrected to second order, so
that $u$ apparently has an expansion:
\begin{eqnarray}
u^h = u + h^2 e_2 + h^3 e_3 + O \lb h^4 \rb .
\end{eqnarray}
Thus, if we try to use Richardson extrapolation, we  will not produce 
$O \lb h^4 \rb $ results.
Now we should be able to produce an extrapolatable solution using 
deferred correction of the boundary equation.  If we look at the
problem where we are using some non-conforming mesh structure but 
with a priori knowledge of the exact value of $u$ at whatever lattice
point the boundary condition is applied,
then clearly we expect the solution to be extrapolatable.  Now it 
is also true in the limit that the  order of the boundary approximation, $q$,
goes to infinity we must also recover this case (since we would not be
truncating the Taylor series expansion).  Now if we reduce
$q$ from infinity, then for some $q$, $q'$ we will lose the ability to
extrapolate, 
and then $q' + 1$ is the minimum order we need. 

We now  look into the case when
{\tt order } = 4, which is shown in Table~\ref{table6.3.4}. 
We see  that the convergence rate once again comes down slightly,
where we compute the convergence rate from the residuals of the interior
equations.
We also
see that the errors, although second order, are slightly larger than 
they were
when we relaxed the boundary to second order,
but Figure~\ref{fig:6.3.2} clearly shows that the
errors of each level are 4 lines apart, {\sl i.e.} the 
solution is  fourth order. 
Thus, we see that we are getting extrapolatable results.

We have seen in this section that by using deferred correction, we can 
easily take a first order code, and get fourth order results via deferred
correction and Richardson extrapolation.
\begin{table}
\begin{caption}
   {Results from the 1D FAS FMG algorithm with outer boundary condition.}
   \label{table6.3.1}
\end{caption}
\begin{center}
   {\em  examining $\alpha$}
\end{center}
\centering
{\small
\begin{tabular}{cc} \hline \hline
$\alpha$ & $\rho \lb \alpha \rb $  \\ \hline
0.0(+0)  &-1.5(-1) \\
1.0(-12)  &-4.9(-1) \\
1.0(-10)  &-1.9(+0) \\
1.0(-8)  &-1.6(+0) \\
1.0(-6)  &-1.3(+0) \\
1.0(-4)  &-9.5(-1) \\
1.0(-2)  &-4.5(-1) \\
0.5(+0)  &-4.5(-2) \\
1.0(+0)  &-3.6(-2) \\ \hline \hline
\end{tabular}
}
\end{table}


\begin{table} 
\begin{caption}
  {Results from the 1D FMG FAS algorithm with the outer boundary condition imposed; where {\tt order} = 1}
  \label{table6.3.2}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$\LEVEL$ & $\rho \lb l \rb $ & $e \lb l \rb $ \\ \hline
1  &  -1.1(+0)& 3.0(-2) \\
2  &  -1.4(+0)& 1.1(-2) \\
3  &  -1.5(+0)& 4.3(-3) \\
4  &  -1.8(+0)& 1.8(-3) \\
5  &  -1.9(+0)& 7.9(-4) \\
6  &  -1.9(+0)& 3.7(-4) \\
7  &  -1.9(+0)& 1.8(-4) \\
8  &  -1.9(+0)& 8.8(-5) \\
9  &  -2.0(+0)& 4.4(-5) \\
10 &  -2.0(+0)& 2.2(-5) \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  { 1D FMG FAS algorithm with outer boundary condition, where {\tt order} = 2 and $\alpha$ = {\rm 1.0e-09} }
  \label{table6.3.3}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$\LEVEL$ & $\rho \lb l \rb $ & $e \lb l \rb$ \\ \hline
1  &  -8.2(-1)  &  1.1(-2) \\
2  &  -1.1(+0)  &  4.0(-3) \\
3  &  -1.2(+0)  &  1.1(-3) \\
4  &  -1.3(+0)  &  3.0(-4) \\
5  &  -1.4(+0)  &  7.6(-5) \\
6  &  -1.4(+0)  &  1.9(-5) \\
7  &  -1.5(+0)  &  4.8(-6) \\
8  &  -1.5(+0)  &  1.2(-6) \\
9  &  -1.5(+0)  &  3.0(-7) \\
10 &  -1.5(+0)  &  7.5(-8) \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  { 1D FMG FAS algorithm with outer boundary condition, where {\tt order} = 4 and $\alpha$ = {\rm 1.0e-09} }
  \label{table6.3.4}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$\LEVEL$ & $\rho \lb l \rb $ & $e \lb l \rb $ \\ \hline
1  &  -8.1(-1)  &  7.4(-3) \\
2  &  -1.0(+0)  &  5.0(-3) \\
3  &  -1.2(+0)  &  1.4(-3) \\
4  &  -1.3(+0)  &  3.6(-4) \\
5  &  -1.4(+0)  &  9.1(-5) \\
6  &  -1.4(+0)  &  2.3(-5) \\
7  &  -1.4(+0)  &  5.7(-6) \\
8  &  -1.5(+0)  &  1.4(-6) \\
9  &  -1.5(+0)  &  3.6(-7) \\
10 &  -1.5(+0)  &  9.0(-8) \\ \hline \hline
\end{tabular}
}
\end{table}
\clearpage
\begin{figure} [p]
   \caption{ Errors in the extrapolated results with {\tt order = 2}}
   \label {fig:6.3.1}
   \centerline{\psfig{figure=1dob2ox.ps}}
\end{figure}
%
\begin{figure} [p]
   \caption{ Errors in the extrapolatated results with {\tt order = 4}}
   \label {fig:6.3.2}
   \centerline{\psfig{figure=1dob4ox.ps}}
\end{figure}
\clearpage
\section[Extrapolation with MLAT ]{ Extrapolation with MLAT }
\label{EXTRAP}
In this section we develop techniques which allow us to 
generate extrapolatable solutions from finite difference MLAT codes.
One of the major reasons to use an adaptive grid is to
generate an ``unbounded'' domain, (see for example Section~\ref{AMR}).
Since some of the grids in an adaptive grid/mesh structure 
do not cover the entire domain,
we will see that ``standard'' MLAT algorithms do not produce 
extrapolatable results,
and in fact, the solutions will generally only be first order
even for second order
differencing.  The methods used to obtain extrapolatable results are 
certainly not well documented.  
This does not mean that one can not find extrapolatable solutions, it is
just that people have not developed the methods. 

We will start by defining a 1D model problem and then describe several
attempts to obtain extrapolatable solutions. 
For must of the attempts, we only look at the case where there is one 
interface region.  We believe that if we are able to generate an extrapolatable
solution which has one interface region, then we should be able to use
multiple interface regions.
Next we compare these
attempts and see which one yields an extrapolatable solution. 
Finally, we will use the techniques to generate an extrapolatable solution
for a simple 2D problem. 

\subsection[1D model problem]{1D model problem}
\label{1DMP}
The problem which we examine in this section is 
\begin{eqnarray}
%
\frac{\partial^2 u \lb x \rb}{\partial x^2}       &=&  f \lb x \rb
     \qquad  a <   x <   \XMAX                                \nonumber \\
u \lb a \rb                                       &=& u \lb x=a \rb       \nonumber \\
u \lb \XMAX \rb                                   &=& u \lb x=\XMAX \rb
%
\end  {eqnarray}
%

We finite-difference the interior equation to $O \lb h^2 \rb $ to obtain
\begin{eqnarray}
\label{eqnstosolve}
\frac{u[j+1] -2 u[j] + u[j-1] }{h^2} &=& f[j] , \qquad j = 2,\cdots,N-1 \nonumber \\
u[1] &=& u \lb x=a \rb  \nonumber \\
u[N] &=& u \lb x=\XMAX \rb 
\end{eqnarray}

Once again we use 
\begin{eqnarray}
f \lb x \rb  = \frac{2a}{x^3}.
\end{eqnarray}
so that the exact solution is 
\begin{eqnarray}
u \lb x \rb  = 1 + \frac{a}{x}  .
\end{eqnarray}

\subsection[The 1D MLAT code]{The 1D MLAT code}
\label{1DMLATCODE}
This code uses a FAS scheme which can be operated 
in a fully adaptive mode.  For this code we will define $l_c$ as the 
number of grids which have $x [n] =\XMAX$ 
However, since we are
trying to test whether we can obtain an extrapolatable solution, we have
the user supply the grid structure before the code starts execution
rather than let a structure be determined via an adaptive process.
Specifically, we input a slight generalization of the 
the grid structure previously determined in 
Section~\ref{ONEDAG}.  We do this because we are only trying to test whether
the solutions to the equations differenced on an adaptive grid structure
are extrapolatable.
We have levels $l=0 \cdots \LMAX$, and when $l=l'$ a transition in 
behavior occurs.  In this case
the fine grid does not extend to as large a value as does the coarse grid:
\begin{eqnarray}
x^{h_{l'}}[n] \not= x^{H_l}[N].
\end{eqnarray}
where $N$ is the upper limit of the coarse grid and $n$ is the 
upper limit of the fine grid.
In this example we use
\begin{eqnarray}
x^{h_{l'}}[n] = \HALF x^{H_l}[N].
\end{eqnarray}
If we generalize this to a number of levels, the number of points in each grid
is the same.
Figure~\ref{fig:6.4.1} shows an example of this grid structure, where
the transition occurs at $l=\LMAX -1$.
In the algorithm we will use for this grid structure, we will 
take $~\PRE~=2$ and $~\PST=1$.  We will also allow for the case when
the boundary equation at $x=\XMAX$ will be either a Dirichlet condition,
or the Robin condition defined by equation~(\ref{outbc6.3}). 

\begin{figure}
\caption{1 interface region depicted in a 3 level scheme.}
\label{fig:6.4.1}
\begin{flushleft}
\input{f641.tex}
\end{flushleft}
\end{figure}

The major difference between this algorithm and the ones described in the
previous sections is that $\tau^H_h[J]$ is not defined at every 
point.  We see in Figure~\ref{fig:6.4.1} that we have 3 levels.  The 
grid at the finest level does   not cover the entire domain, thus, we
choose the convention that
\begin{eqnarray}
\tau^H_h[J] \equiv 0  ,
\end{eqnarray}
where the points on the finest grid are not defined.  
This brings about a major problem, $\tau^H_h[J]$ is
not continuous, and thus, not smooth. An example of this is shown in 
Figure~\ref{graph:6.4.2} where the interface point is at $J=17$.
We have tried an enormous amount of
unsuccessful methods, and will only describe a few of them,
with the last description being of the successful method.

In this subsection we describe the ``usual'' algorithm\cite{ChoptuikGRG} used
when working with adaptive grids such as the one in Figure~\ref{fig:6.4.2}.
This algorithm is based on the assumption
that each parent has only one child; this is the case for the
test problems in this chapter.
The interface boundaries are treated as Dirichlet conditions here, thus
$\tau^H_h[J]=0$ at the interface.
\footnote{ Since Dirichlet conditions are exact 
conditions ( {\sl i.e.} not differenced conditions ) their relative 
truncation error estimate is zero)} 
\begin{figure}
\caption{The adaptive grid structure.}
\label{fig:6.4.2}
\begin{flushleft}
\input{f642.tex}
\end{flushleft}
\end{figure}

Figure~\ref{fig:6.4.2} shows an example of the computational domain
used by the algorithm.  
The algorithm starts by perform~\PRE~smoothing
sweeps on grid (a). The value of $u[j]$ at $j=n$ is a Dirichlet condition, and
thus, we do not change the value when we smooth.
To determine this value at $j=n$ we
use an interpolation from the points on grid (b).
The interpolation routine that we use is 
injection from the corresponding coarse grid values from grid (b).

We first test the algorithm to ensure the convergence rate, $\rho$,
remains constant as we increase the number of levels. Here 
we use a grid system
with 5 levels, with each of the three finest grids
spanning half of the domain of 
their parents. We let $\XMAX =4$, $a=1.0$ and let 
{\tt outer\_boundary = \FALSE} for this system.
 The work unit is defined to increase by one every time we relax
over $s$ points, where $s$ is the total number of points on the
final finest  grid.
We see that in Figure~\ref{fig:6.4.1}, that $s=9 + 4 =13$, since there are 13
points on the final finest grid.
Table~\ref{table6.4.1} shows that the convergence rate remains approximately
constant as the levels get finer.
The convergence rate shows that for about every 2 work units, the residuals
are reduced by 6 orders of magnitude.  Figure~\ref{graph:6.4.1} shows
a graph of the error on the overall grid, $e$  versus $x$. In this graph
we see the errors from the adaptive mesh, as well as the errors from a
non-adaptive mesh.  We see that when we compare the adaptive run versus the
non-adaptive run, the total number of points was tremendously decreased, while
the error remained virtually unchanged.
\begin{figure}
   \caption{   The errors using the standard 1D MLAT algorithm, with
and without adaptive grids.}
   \label {graph:6.4.1}
   \centerline{\psfig{figure=graph6.4.1.ps}}
\end{figure}
 
The goal of adaptive mesh refinement is to minimize the total
computational work which generally means minimizing the number
of points used on the finest grid while ensuring that the 
overall level of error is comparable to that generated by 
a run where the finest level of discretization is used 
everywhere.
Table~\ref{table6.4.2} shows the
$\LONE$ norm of the errors on a non-adaptive grid structure 
as a function of the finest level of discretization
used. In this case the coarsest grid contains 3 points.
$Q \lb l,l+1 \rb $ is the reduction in error from level $l$ to
level $l+1$.  We see that after 4 levels the reduction factor is $4.0$ 
indicating second-order convergence.
Table~\ref{table6.4.3}
also shows the reduction of error from one level to the next, this 
time for an adaptive run.  Here
we see that the $\LONE$ norm of the errors are very close in comparison
to the non-adaptive run.  
Our problem though, is that these results are not second order accurate. 
They are {\em  first order}, 
which makes them impossible to extrapolate. We also know that as we
increase the number of levels, then these results will deviate much
further from each other, since one result is first order, and the other
is second order.

The adaptive code is not second order because it is not
handling the boundaries at the interfaces correctly.  We will see later,
that if we do handle the boundaries correctly, then we will obtain a
second order extrapolatable solution. 

Finally we estimate the work units used by the algorithm. 
Here we will only estimate
this for V-cycles. For the grid structures that we use, we define 
\begin{eqnarray}
\nu = {\rm Total number of grids where} x [n] = \XMAX.
\end{eqnarray}
The total amount of work for the refinements we use in this section is 
\begin{eqnarray}
\label{eqn:eqnworkmlat}
w_A &=& \sigma \lb  \PP~\nu \frac{\NF}{n} + \frac{ \frac{1}{2}  \lb \NF+1 \rb } {n} + \frac{ \frac{1}{4}  \lb \NF+1 \rb  } {n} + \frac{ \frac{1}{8} \lb \NF+1 \rb  } {n} + \cdots  \rb  \nonumber \\
&\approx& \sigma \PP  \lb \nu+1 \rb  \frac{\NF}{n}
\end{eqnarray}
where \PP~
is the total number of smoothing sweeps per grid,  for
each cycle, \NF~is the number of grid points on the finest grid 
, $\sigma$ is the total number of V-cycles
and $n$ is the total number of grid points for the fine grid equations. 
In general $n =  \lb \NF-1 \rb /2  \lb \nu-1 \rb $. 

%\clearpage

\begin{figure} [p]
\caption{The V-cycle for the FAS MLAT algorithm }
\label{alg6.4.2}
{\small
\begin{tabbing}
\T {\tt PROCEDURE VCYCLE\_FAS\_adaptive(~ncycle, $\LMAX$, \PRE,}\\ 
\T\T\T\T\T\T\T\T{\tt  \PST~,~order,outer\_boundary) } \\ %(
\T\T {\tt \DO \CYCLE = 1 ,ncycle   }  \\ %(
\T\T\T { \sl Cycle up to the coarsest level } \\
\T\T\T { \tt \DO  $\LEVEL= \LMAX , \LCOARSE+1$ } \\ %(
\T\T\T\T {\tt \IF ($\LEVEL \not= \LMAX$~\OR~\CYCLE = 1 ) \THEN } \\ %(
\T\T\T\T\T {\tt FIND\_INTERFACE(j\_max) }\\
\T\T\T\T\T {\sl {\tt j\_max = FIND\_INTERFACE} will find the interface point}\\
\T\T\T\T\T {\sl on the coarse grid}\\
\T\T\T\T\T {\tt \DO  p = 1 , pre } \\ %(
\T\T\T\T\T\T {\tt  RELAX\_INTERIOR($u^h(j)= f^h(j)$) \quad $j=2\cdots n-1$}\\
\T\T\T\T\T\T{\sl Smooth the residuals}\\
\T\T\T\T\T\T{\tt \IF ( outer\_boundary = \TRUE~\AND~\GMAX(\LHEAD($\LEVEL$))=$\XMAX$)  \THEN }\\ %(
\T\T\T\T\T\T\T   {\tt RELAX\_BOUNDARY($u^h(n)= g^h(n)$,$\alpha$) \quad j=n}\\
\T\T\T\T\T\T{\tt \ENDIF} \\ %)
\T\T\T\T\T\T {\sl Smooth the boundary}\\
\T\T\T\T\T {\tt END DO}\\ %)
\T\T\T\T {\tt \ENDIF } \\ %)
\T\T\T\T {\tt \IF~( GMAX(\LHEAD($\LEVEL$))= $\XMAX$~\AND}\\ 
\T\T\T\T\T\T\T{\GMAX(\GPCH(\LHEAD($\LEVEL$))) $\not= \XMAX$ ) \THEN}\\ %(
\T\T\T\T\T {\sl Now apply deferred correction to the outer boundary}\\
\T\T\T\T {\tt \ENDIF}\\ %)
\T\T\T\T{ \tt $ \tau^H_h(J) = L^H \REST u^h(j) - \REST L^h u^h(j)$, \quad $J=2 \cdots$ J\_max-1}\\
\T\T\T\T{\sl determine the truncation error estimate}\\
\T\T\T\T{\sl for the interior points }\\
\T\T\T\T{\tt $ \tau^H_h(j) = 0$ ,\quad $j=$j\_max$\cdots n$}\\
\T\T\T\T{\sl set  $ \tau^H_h(j)$ to zero where it is not defined } \\
\T\T\T\T{\tt \IF ( outer\_boundary =~\TRUE~\AND~}\\ %(
\T\T\T\T\T\T\T\T{ \GMAX(\LHEAD($\LEVEL$))=$\XMAX$)  \THEN }\\
\T\T\T\T\T{\sl determine the truncation error estimate for the outer boundary point }\\
\T\T\T\T{\tt \ENDIF} \\ %)
\T\T\T\T{ \tt $ f^H(j) = \REST f^h(j) + \tau^H_h(j) $ \quad {\sl Correct the rhs}} \\
\T\T\T\T{\sl NOTE: when $j \geq$ j\_max then determine $f^H(j)$ from the analytical rhs}\\
\T\T\T { \tt \ENDDO } %)
\end{tabbing}
}
\end{figure}
\begin{figure} [p] 
\begin{center}
  Figure~\ref{alg6.4.2} continued
\end{center}
{\small
\begin{tabbing}
\T\T\T {\sl Now solve the system on the coarsest level } \\
\T\T\T{ \tt \IF ( outer\_boundary = \TRUE) \THEN }\\ %(
\T\T\T\T{ \tt SOLVE($L^H u^H = f^H$, and $Z^H_1 u^H = g^H$) } \\
\T\T\T{\tt \ELSE }\\
\T\T\T\T{\tt SOLVE($L^H u^H = f^H$) }\\
\T\T\T{\tt \ENDIF} \\ %)
\T\T\T {\sl Now come back down to the finest level} \\
\T\T\T {\tt  \DO  $\LEVEL = \LCOARSE , \LMAX - 1$} \\ %(
\T\T\T\T { \sl Determine the correction } \\
\T\T\T\T { \tt $ u^h(j) := u^h(j) + \PRO \lb u^H(J)  - \REST u^h(j) \rb $ , \quad $j = 2 \cdots$ j\_max-1} \\
\T\T\T\T{\tt \IF ( outer\_boundary = \TRUE~\AND}\\ 
\T\T\T\T\T\T\T\T\T {\tt \GMAX(\LHEAD($\LEVEL$))=$\XMAX$)  \THEN }\\ %(
\T\T\T\T\T { \tt $ u^h(n) := u^h(n) + \PRO \lb u^H(N)  - \REST u^h(n)
\rb $ , \quad j = n} \\
\T\T\T\T {\tt \ENDIF }\\ %)
\T\T\T\T { \sl Now smooth out $u^h$ } \\
\T\T\T\T {\tt \DO  q = 1 , pst } \\ %(
\T\T\T\T\T  {\tt  RELAX\_INTERIOR($u^h(j), f^h(j)$)  \quad $j=2\cdots n-1$}\\
\T\T\T\T\T{\sl Smooth the residuals}\\
\T\T\T\T\T  {\tt \IF ( outer\_boundary= \TRUE \AND~\GMAX(\LHEAD($\LEVEL$))=$\XMAX$) \THEN }\\  %(
\T\T\T\T\T\T  {\tt  RELAX\_BOUNDARY($u^h(n), g^h(n)$,$\alpha$) \quad j=n}\\
\T\T\T\T\T\T {\sl Smooth the boundary}\\
\T\T\T\T\T  {\tt \ENDIF} \\ %)
\T\T\T\T{ \tt \ENDDO} \\ %)
\T\T\T{ \tt \ENDDO} \\ %)
\T\T{ \tt \ENDDO} \\ %)
\T{ \tt END PROCEDURE } %)
\end{tabbing}
}
\end{figure}
\clearpage
\subsection[The 1D hierarchal MLAT code]{The 1D hierarchal MLAT code}
\label{1DH-CODE}
We will now look into another method since a ``typical'' MLAT algorithm
does not give second order results when we let the grids adapt.
One method which does work is given in pseudo-code form in
figures~(\ref{alg6.4.3}) and~(\ref{alg6.4.4}).  
We see that in this code the algorithm cycles independently on each grid.
The only inter-grid communication occurs 
at internal grid interface points.
We transfer values at these interface point via injection from 
parental grids.  Thereafter, the algorithm performs $V$-cycles using 
Dirichlet conditions everywhere. To summarize, this algorithm will use
the FMG scheme in which each fine grid problem will have a Dirichlet 
condition imposed at the interface point.  Thus, when the algorithm
performs the V-cycles, there are no interfaces.

We see that this algorithm should take more work units than the MLAT
algorithm in the last section.
In fact the total work for $\sigma$ v-cycles is
\begin{eqnarray}
\label{eqn:eqnworkhmlat}
w_B &=& \PP \sigma \nu  \lb \frac{\NF}{n} + \frac{ \frac{1}{2}  \lb \NF+1 \rb } {n} + \frac{ \frac{1}{4} (\NF+1) } {n} + \frac{ \frac{1}{8} \lb \NF+1 \rb  } {n} + \cdots  \rb   \nonumber \\
&\approx& 2 \, \PP \, \sigma \, \nu \frac{\NF}{n}
\end{eqnarray}
Thus comparing equations~(\ref{eqn:eqnworkmlat}) and~(\ref{eqn:eqnworkhmlat}),
we see that this algorithm takes about twice as much work as the 
standard MLAT method. 
However, we will now verify that this hierarchical technique is second order. 

Table~\ref{table6.4.4} shows the $\LONE$ norm of the errors for the 
hierarchal MG code.   Here we see that the results from
this routine are extremely inaccurate compared to those from
the standard MLAT code.
Using 13 levels, the error is only reduced to that of a 4 level
run of the last algorithm.
In order for the error of this routine to be smaller than the MLAT code,
we would need to have 25 levels of refinement, which is not a realistic
number of levels.
We will now look back at the MLAT algorithm, and attempt to modify
it to obtain extrapolatable results.
%\clearpage
\begin{figure}
\caption{ The hierarchal FMG FAS routine.} 
\label{alg6.4.3}
{\small
\begin{tabbing}
\T {\tt PROCEDURE FMG\_Hierarchal(\CYCLE, $\LMAX$, \PRE, \PST~,~order~)}\\
\T\T {\sl Initialize Variables} \\
\T\T {\sl Initialize Memory} \\
\T\T {\tt \DO $\LEVEL = 0 , \LMAX$ } \\
\T\T\T{\tt \IF ($\LEVEL \not= 0 $)~\THEN~INTERPOLATE($u^H$) } \\
\T\T\T{\sl This interpolation will inject the interface point into the parent grid}\\
\T\T\T{\tt VCycle\_H( ) }\\
\T\T{\sl save the solution at the interface point} \\
\T\T{\tt COPY (interface(\LHEAD($\LEVEL$)) = $u^H(\JMAX)$) )}\\
\T\T {\tt \ENDDO \quad {\sl for $\LEVEL$} }\\
\T {\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
\begin{figure}
\caption{ The hierarchal FMG FAS V-cycle routine. }
\label{alg6.4.4}
{\small
\begin{tabbing}
\T {\tt PROCEDURE VCYCLE\_H(~ncycle, $\LMAX$, \PRE, \PST~,~order~)}\\ %(
\T\T{\sl All grids will span the domain of the grid at $\LMAX$.}\\
\T\T{\sl Temporary storage will be issued for all lower level grids.}\\
\T\T {\sl Initialize Variables} \\
\T\T {\sl Initialize Memory} \\
\T\T {\sl The coarsest level will always have 3 points }\\
\T\T{\tt \DO \CYCLE = 1 ,ncycle   }  \\ %(
\T\T\T { \sl Cycle up to the coarsest level } \\
\T\T\T { \tt \DO  $\LEVEL = \LMAX , \LCOARSE+1$ } \\ %(
\T\T\T\T {\tt \IF ($\LEVEL \not= \LMAX$~\OR~\CYCLE = 1) \THEN } \\ %(
\T\T\T\T\T {\tt \DO  p = 1 , pre } \\ %(
\T\T\T\T\T\T{\sl Smooth the residuals}\\
\T\T\T\T\T\T\T {\sl Smooth the boundary}\\
\T\T\T\T\T\T\T {\tt \ENDDO} \\ %)
\T\T\T\T{\tt \ENDIF} \\ %)
\T\T\T\T {\tt \IF~( GMAX(\LHEAD($\LEVEL$))= $\XMAX$~\AND}\\
\T\T\T\T\T\T{\tt  \GMAX(\GPCH(\LHEAD($\LEVEL$))) $\not= \XMAX$ ) \THEN}\\ %(
\T\T\T\T\T\T\T {\sl Now apply deferred correction}\\
\T\T\T\T\T\T {\tt \ENDIF}\\ %)
\T\T\T\T\T{ \tt $ \tau^H_h(J) = L^H \REST u^h(j) - \REST L^h u^h(j)$, \quad $j=2 \cdots$ n-1}\\
\T\T\T\T\T{\sl determine the truncation error estimate for
the interior points }\\
\T\T\T\T\T{\tt \IF ( outer\_boundary =~\TRUE~\AND}\\
\T\T\T\T\T\T\T\T\T\T{\tt  \GMAX(\LHEAD($\LEVEL$))=$\XMAX$)  \THEN }\\ %(
\T\T\T\T\T\T{\sl determine the truncation error estimate for the outer boundary point }\\
\T\T\T\T\T{\sl Correct the rhs of the outer boundar} \\
\T\T\T\T{\tt \ENDIF} \\ %)
\T\T\T\T{ \tt $ f^H(J) = \REST f^h(j) + \tau^H_h(J) $ \quad {\sl Correct the rhs}} \\
\T\T\T { \tt \ENDDO } %)
\end{tabbing}
}
\end{figure}
\begin{figure}
\begin{center}
  Figure(~\ref{alg6.4.4}) continued
\end{center}
{\small
\begin{tabbing}
\T\T\T {\sl Now solve the system on the coarsest level } \\
\T\T\T{ \tt \IF ( outer\_boundary = \TRUE) \THEN }\\ %(
\T\T\T\T{ \tt SOLVE($L^H u^H = f^H$, and $B^H_1 u^H = g^H$) } \\
\T\T\T{\tt \ELSE }\\
\T\T\T\T{\tt SOLVE($L^H u^H = f^H$) }\\
\T\T\T{\tt \ENDIF} \\ %)
\T\T\T {\sl Now come back down to the finest level, performing the needed corrections} \\
\T\T\T {\tt  \DO  $\LEVEL = \LCOARSE , \LMAX - 1$} \\ %(
\T\T\T\T { \sl Determine the correction } \\
\T\T\T\T { \tt $ u^h(j) := u^h(j) + \PRO \lb u^H(J)  - \REST u^h(j) \rb $ , \quad $j = 2 \cdots$ n-1} \\
\T\T\T\T {\tt \IF ( outer\_boundary = \TRUE) \THEN }\\ %(
\T\T\T\T\T { \tt $ u^h(n) :=  u^h(n) + \PRO \lb u^H(N)  - \REST u^h(n)
\rb $ , \quad j = n} \\
\T\T\T\T {\tt \ENDIF }\\ %)
\T\T\T\T { \sl Now smooth out $u^h$ } \\
\T\T\T\T {\tt \DO  q = 1 , pst } \\ %(
\T\T\T\T\T{\sl Smooth the residuals}\\
\T\T\T\T\T {\sl Smooth the boundary}\\
\T\T\T\T {\tt \ENDDO} \\ %)
\T\T\T{ \tt \ENDDO} \\ %)
\T\T{ \tt \ENDDO} \\ %)
\T\T{\sl Release all the temporary storage }\\
\T{ \tt END PROCEDURE } %)
\end{tabbing}
}
\end{figure}

\clearpage
\subsection[Making an adaptive MLAT code extrapolatable]{Making an adaptive MLAT code extrapolatable}
\label{tests}
To simplify matters, we will again work with a single-interface system in the 
following.
To test the extrapolations we 
let the coarse grids, $L=0,\cdots,L-1$ span the whole domain,
and then let the fine grid, $l$ span half of the domain.
We position the grid interface near
$x=a$ since the truncation error estimates will be large  there.
The goal is to get an error with the single-interface, adaptive run
which is very close to the error achieved by the non-adaptive run,
Table~\ref{table6.4.2}.

As mentioned previously, we can resolve our interface problems using a single interface
then presumably the techniques will immediately extend to the 
case of multiple interfaces. 
We also emphasize that we want techniques
that can be extended to 
multiple dimensions with little or no modifications.  
We will discuss three attempts in this section---only the third 
is successful.

The first  attempt
tries to use another boundary condition
at the interface point of the finest system.  
Previously we were using
a Dirichlet condition on the interface point, and the hope was that by 
using a Neumann condition, the solutions would become extrapolatable.   
In hindsight, we see that this could never work since it does not address
the issue of the non-smoothness of  $\tau^H_h$. 

The first attempt is based on a requirement of continuity of 
$\partial u / \partial x$ across the interface:
\begin{eqnarray}
\frac{\partial u^h \lb x \rb  }{\partial x} = \frac{\partial u^H \lb x \rb }{\partial x} \quad x = \frac{\XMAX}{2}
\end{eqnarray}
which is finite differenced to fourth order as
\begin{eqnarray}
\label{eqn:extraptry1}
\lefteqn{\lb 12 h\rb^{-1} 
  \Lc 25 u^h[j] - 48 u^h[j-1] + 36 u^h[j-2] }\nonumber \\
& & -16 u^h[j-3] + 3u^h[j-4] \Rc =  \nonumber \\
& &  - 12 \lb H \rb^{-1} \Lc 25 u^H[J] - 48 u^H[J+1] + 36 u^H[J+2]  \nonumber \\
& &  - 16 u^H[J+3] + 3u^H[J+4] \Rc,
\end{eqnarray}
where again $j = 2J-1$.
This equation is only used when a coarse grid correction from the finest grid
takes place.  Since this is a one dimensional problem, and we do not care
about the convergence rate at this time, we do not relax the boundary
point on the finest level.  Table~\ref{table6.4.5} shows that the solution
is once again only first order. We see that there is no difference  between
this solution and the original MLAT code. 
We also tried matching the second derivative at the interace, and once again
found that these runs did not produce extrapolatable results.   

The next attempt that we tried \cite{RUEDEPR}, was to use the coarse grid 
points around the interface point to introduce an (additional point) at
$j=n+1$.
Figure~\ref{ghost} shows the grid structure for this attempt.
We see that the point at $j=n$ on the finest grid can now be used as an
interior point.  Thus, all smoothing and transfers at this point are 
implemented as such.
The only issue that remains is how to fix the function value at the point
$j=n+1$. 
From the results of Chapter 3, we know that if we use linear interpolation:
\begin{eqnarray}
u^h[n+1] = \HALF \lb u^H [\JMAX] + u^H [ \JMAX + 1]  \rb + O \lb H^2 \rb 
\end{eqnarray}
where
\begin{eqnarray}
x[\JMAX] = x[n],
\end{eqnarray}
will will not get second order results.
Thus, with the benefit of hindsight, we interpolate to fourth order as follows:
\begin{eqnarray}
u^h[n+1] &=& \frac{1}{16} \lb - u^H[\JMAX+2] - u^H[\JMAX-1] \rb \nonumber \\
&+& \frac{9}{16} \lb u^H[\JMAX] + u^H[\JMAX+1] \rb 
\end{eqnarray}

Thus our full set of equations is:
\begin{eqnarray}
h^{-2} \lb u^h[j+1] + u^h[j-1] - 2 u^h[j] \rb &=& f[j] , \qquad j = 2, \cdots,n-1 \nonumber \\
h^{-2} \lb u^h[j+1] + u^h[j-1] - 2 u^h[j] \rb &=& h^2 f[j] , \qquad j=n \nonumber \\
u^h[1] &=& u \lb x = a \rb \nonumber
\end{eqnarray}
and
\begin{eqnarray}
u^h[n+1] &=& -\frac{1}{16} \lb u^H[\JMAX+2] + u^H[\JMAX-1] \rb \nonumber \\
 &+& \frac{9}{16} \lb u^H[\JMAX] + u^H[\JMAX+1] \rb \nonumber
\end{eqnarray}
on the fine grid, and 
\begin{eqnarray}
\lefteqn{ H^{-2} \lb u^H[J+1] + u^H[J-1] - 2 u^H[J] \rb =} \nonumber \\
& & \REST f[J] + \tau^H_h[J] , \qquad J = 2,\cdots,N-1 \nonumber \\
& & u^H[1] = u \lb a \rb \nonumber \\
& & u^H[N] = u \lb \XMAX \rb \nonumber 
\end{eqnarray}
\begin{eqnarray}
\tau^H_h[J] = L^H \REST u^h[j] - \REST L^h u^h[j] , \quad J = 2,\cdots,\JMAX
\end{eqnarray}
on the coarse grid, where 
$$ L u[j] = \frac{u[j+1] + u[j-1] - 2 u[j]}{h^2} $$
and
$$\REST u^h[j] =  \HALF u[j] + \QUARTER \lb u[j-1] + u[j+1] \rb \quad j=2,\cdots,N $$

\begin{figure}
\begin{caption} {The 1D grid structure with a single interface.}
\label{ghost}
\end{caption}
\begin{center}
\input ghost.tex
\end{center}
\end{figure}

At this point, we will now define a new symbol that will be used in the
tables.  We will now signify the extrapolation between levels $a$ and $b$ as
x$ab$. 
Table~\ref{table6.4.6} shows very strange behavior for the errors.  We see
that there is a region where the results 
appear to be extrapolatable.  
After the sixth level we do not show the extrapolation
results, since $Q \lb l,l+1 \rb $ deviates from 4. 

We now look at $\tau^H_h[j]$ before we show the final algorithm. Figure~\ref{graph:6.4.2}
shows $\tau^H_h[j]$ on the points around the interface.
We clearly see that the truncation error is non-smooth particularly at 
$J=\JMAX-1$. Thus, by trying to come up
with a boundary condition for the point at $J=\JMAX$, we are not able to
help smooth $\tau^H_h[\JMAX-1]$. 

\begin{figure}
   \caption{A zoom up on the relative truncation error}
   \label {graph:6.4.2}
   \centerline{\psfig{figure=tau.ps}}
\end{figure}


Our final algorithm takes the original MLAT algorithm and modifies it only
in the manner that the truncation error estimate is calculated.  Specifically,
after computing $\tau^H_h$ in the usual fashion, we set
\begin{eqnarray}
\label{tausmooth}
\tau^H_h[\JMAX-1] = \HALF \lb \tau^H_h[\JMAX-2] + \tau^H_h[\JMAX] \rb.
\end{eqnarray}
By modifying the algorithm in this way we will not be able to look at 
the residuals and determine when the system has converged.  We are now
solving a different set of equations than that of equation~(\ref{eqnstosolve}).
We have not yet come up with a specific scheme to determine convergence 
although Choptuik\cite{ChoptuikPR} points out that we could stop by testing for
convergence, {\sl i.e.} by looking for consistency in the extrapolation.

The output of these runs is shown in Table~\ref{table6.4.7}, with
$a=0.1$ 
so that, around the interface region, 
$\tau^H_h$ will be larger than the previous tests.
 We clearly see that the results are extrapolatable !

We now examine the case where we have multiple interfaces.
For this run we let $a=0.1,\XMAX = 512$ and have 10 interfaces.  We then
vary the number of coarse grids, $\nu$ . Table~\ref{table6.4.8} shows
clearly that the solution is extrapolatable for the multi-interface case.

% 1d problem is solved in directory~scott2/newmgml1/try2/deff/adapt/fmg/Robin
% 2d problem is solved at /charon/u0/ph/az/scott2/mgml2/try2 
\subsection[Two dimensional model problem]{ Two dimensional model problem }
\label{2dMP}
We now turn to a two dimensional problem, to see if we can smooth $\tau^H_h$
around the interface to get an extrapolatable answer.  We will use the 
extremely simple grid structure, shown in Figure~\ref{2dgrids}.
We see that the grid interface is located along a constant-$x$ line.
This is a good test since the grid refinements that will
be required of our fully adaptive MLAT code will be rectangles, such that
each side of the rectangle will interface with the coarser grid along 
a line of coarse grid points.

Our 2 dimensional model problem is 
\begin{eqnarray}
%
\frac{\partial^2 u \lb x,y \rb}{\partial x^2}+\frac{\partial^2 u \lb x,y \rb}{\partial y^2}
&=&  f \lb x,y \rb \quad  a <   x <   \XMAX \quad -1 < y < 1 \nonumber \\
\end  {eqnarray}
where  we use Dirichlet conditions around all of the boundaries and
\begin{eqnarray}
u \lb x,y \rb &=& 1 + \frac{ a}{ \sqrt{ x^2 + y^2 }}  \nonumber \\
f \lb x,y \rb &=& \frac{a}{\lb x^2 + y^2 \rb^{\frac{3}{2}}} .
\end{eqnarray}

In Figure~\ref{2dgrids} we define two separate regions, a smoothing
region and a buffer region.   In the buffer zone
we set
\begin{eqnarray}
\tau^H_h \lb x,y \rb = \QUARTER \tau^{2h}_H.
\end{eqnarray}
Since $\tau^{2H}_H$ is smooth, and we are using a second order difference 
scheme, one quarter of this value
is approximately $\tau^H_h$.
Secondly, since interpolation from one grid to another
introduces high frequency components, we then smooth $\tau^H_h$ with the 
smoothing operator
\begin{eqnarray}
\tau^H_h[j,k] := \QUARTER \tau^H_h[j,k] &+& \frac{1}{8} \Lc \tau^H_h[j+1,k]
+ \tau^H_h[j-1,k]\nonumber \\
&+&\tau^H_h[j,k+1 ]+\tau^H_h[j,k-1] \Rc \nonumber \\
&+& \frac{1}{16}  \Lc \tau^H_h[j+1,k+1]+\tau^H_h[j-1,k+1] \nonumber \\
&+&\tau^H_h[j+1,k-1]+\tau^H_h[j-1,k-1] \Rc 
\end{eqnarray}

Table~\ref{table6.4.9} shows that the solutions to this technique are
extrapolatable.  For this run we used
$a=0.125$, $x=a,\cdots,2+a$,$y=-1,\cdots,1$, with a buffer region of 4 zones,
and a smoothing region of 8 zones.  

We have now found a technique to generate extrapolatable solutions using 
an adaptive MLAT algorithm.  This technique is by no means unique, although
it works very well.  We feel that it is likely that any technique that smooths 
$\tau^H_h$ along the interfaces will produce extrapolatable solutions.
In the next section, we look into the issue of where the fine grids are
not properly contained in parental grids. 
%\clearpage 
\begin{table}
\begin{caption}
  { Convergence Rate in MLAT Dirichlet code using a 5 grid system.} 
  \label{table6.4.1}
\end{caption}
\centering
{\small
\begin{tabular}{cc} \hline \hline
$l$ & $\rho(l)$ \\ \hline
2 & -1.6(+0) \\
3 & -2.0(+0) \\
4 & -2.4(+0) \\
5 & -2.7(+0) \\
6 & -2.8(+0) \\
7 & -3.0(+0) \\
8 & -3.0(+0) \\
9 & -3.1(+0) \\
10& -3.1(+0) \\ \hline \hline 
\end{tabular}
}
\end{table}

\begin{table} 
\begin{caption}
  { Convergence study of MLAT code using a 2 grid system, $\XMAX=4$ } 
  \label{table6.4.2}
\end{caption}
\begin{center}
 {\bf All grids span the entire domain}
\end{center}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$    & $e \lb l \rb $  & $Q \lb l,l+1 \rb $\\ \hline
1  &   2.2(-2) &    2.7 \\
2  &   6.5(-3) &    3.4 \\
3  &   1.7(-3) &    3.8 \\
4  &   4.3(-4) &    3.9 \\
5  &   1.1(-4) &    4.0 \\
6  &   2.7(-5) &    4.0 \\
7  &   6.8(-6) &    4.0 \\
8  &   1.7(-6) &    4.0 \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  {Convergence study of MLAT code using a 2 grid system, $\XMAX=4$}
  \label{table6.4.3}
\end{caption}
\begin{center}
 {\bf Adaptive run with Dirichlet boundary conditions imposed on all boundaries}
\end{center}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$    & $e \lb l \rb $  & $Q \lb l,l+1 \rb $\\ \hline
1  &   2.7(-2) &    2.8 \\
2  &   7.9(-3) &    3.4 \\
3  &   2.2(-3) &    3.7 \\
4  &   5.9(-4) &    3.7 \\
5  &   1.7(-4) &    3.5 \\
6  &   5.4(-5) &    3.2 \\
7  &   1.9(-5) &    2.8 \\
8  &   7.6(-6) &    2.5 \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  { Convergence study of hierachical MG code using a 2 grid system, $\XMAX =4$}
  \label{table6.4.4}
\end{caption}
\begin{center}
 { Dirichlet boundary conditions imposed on all boundaries}\end{center}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$    & $e \lb l \rb $  & $Q \lb l,l+1 \rb $\\ \hline
6      & 3.5(-1) &    1.3     \\
7      & 2.7(-1) &    1.6     \\
8      & 1.7(-1) &    2.0     \\
9      & 8.4(-2)  &    2.8     \\
10     & 3.0(-2)  &    3.5     \\
11     & 9.0(-3)  &    3.8    \\
12     & 2.3(-3)  &    4.0     \\
13     & 5.8(-4)  &    4.0     \\ \hline \hline
\end{tabular}
}
\end{table}


\begin{table} [p]
\begin{caption}
  { Convergence study of MLAT code using a 2 grid system, $\XMAX=4$ }
  \label{table6.4.5}
\end{caption}
\begin{center}
 {\bf Matching First Derivative at interface} 
\end{center}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$    & $e \lb l \rb $  & $Q \lb l,l+1 \rb $\\ \hline
1  &   2.7(-2) &    2.9 \\
2  &   8.0(-3) &    3.4 \\
3  &   2.2(-3) &    3.7 \\
4  &   5.9(-4) &    3.7 \\
5  &   1.7(-4) &    3.5 \\
6  &   5.4(-5) &    3.2 \\
7  &   1.9(-5) &    2.8 \\
8  &   7.6(-6) &    2.5 \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{caption}
  {Convergence study of MLAT code using a 2 grid system, $\XMAX=4$, with the addition of an extra grid point.}
  \label{table6.4.6}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$    & $e \lb l \rb $  & $Q \lb l,l+1 \rb $\\ \hline
1  &   2.3(-2) &    2.1 \\
2  &   7.4(-3) &    3.4 \\
3  &   1.9(-3) &    3.8 \\
4  &   4.8(-4) &    4.0 \\
5  &   1.1(-4) &    4.3 \\
6  &   2.3(-5) &    4.6 \\
7  &   4.0(-6) &    5.9 \\
8  &   1.1(-6) &    3.8 \\
x12&   1.4(-2) &        \\
x23&   1.9(-3) &    7.4 \\
x34&   1.6(-4) &   11.9 \\
x45&   1.1(-5) &   14.5 \\
x56&   6.8(-7) &   16.1 \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  {Convergence study of MLAT code using a 2 grid system, $\XMAX=4$ }
  \label{table6.4.7}
\end{caption}
\begin{center}
 {\bf Smoothing $\tau^H_h$  at the interface } 
\end{center}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$    & $e \lb l \rb $  & $Q \lb  l,l+1 \rb $\\ \hline
1      &  1.6(-1) &  2.1\\
2      &  7.8(-2) &  2.9\\
3      &  2.7(-2) &  3.5\\
4      &  7.7(-3) &  3.9\\
5      &  2.0(-3) &  4.0\\
6      &  5.0(-4) &  3.9 \\
7      &  1.3(-4) &  4.0\\
8      &  3.2(-5) &  4.0\\
x12    &  4.9(-2) &  4.9\\
x23    &  1.0(-2) &  8.0\\
x34    &  1.2(-3) & 12.0\\
x56    &  7.2(-6) & 15.7\\
x67    &  4.6(-7) & 16.0\\
x78    &  2.9(-8) & 16.0\\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  {Convergence study of MLAT code using a 10 grid system, $\XMAX=512$}
  \label{table6.4.8}
\end{caption}
\begin{center}
 {\bf Smoothing $\tau^H_h$  at the interface }
\end{center}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$\nu$ & $e \lb \nu \rb $  & $Q \lb \nu,\nu+1 \rb $\\ \hline
1 & 7.8(-2) & 1.7  \\
2 & 4.5(-2) & 3.5  \\
3 & 1.3(-2) & 3.9  \\
4 & 3.4(-3) & 4.0  \\
5 & 8.5(-4) & 4.0  \\
x12 & 3.6(-2) & 17.1  \\
x23 & 2.1(-3) & 13.4 \\
x34 & 1.7(-4) & 15.5 \\ 
x45 & 1.1(-5) & 16.7 \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  {Convergence study of 2D MLAT code using a 2 grid system, $\XMAX=512$}
  \label{table6.4.9}
\end{caption}
\begin{center}
 {\bf Smoothing and modifying $\tau^H_h$  at the interface }
\end{center}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$   & $e \lb l \rb $  & $Q \lb l,l+1 \rb$\\ \hline
2      & 1.3(-2) & 2.5  \\
3      & 5.2(-3) & 9.6  \\
4      & 5.4(-4) & 2.8  \\
5      & 1.9(-4) & 3.7  \\
6      & 5.2(-5) & 4.0  \\
7      & 1.3(-5) & 4.0  \\
8      & 3.3(-6) & 4.0  \\
x23    & 4.6(-3) & 9.2  \\
x34    & 5.0(-4) & 6.0  \\
x45    & 8.3(-5) &22.4  \\
x56    & 3.7(-6) &16.0  \\
x67    & 2.3(-7) &16.0  \\
x78    & 1.4(-8) &16.0   \\ \hline \hline
\end{tabular}
}
\end{table}

%
\begin{figure}
   \caption{  2D model problem grid structure with  1 interface} 
   \label {2dgrids}
   \centerline{\psfig{figure=2dgrids.ps}}
\end{figure}
\clearpage
\section[Fast convergence for 1D problem with non-contained grids]{Fast convergence for 1D problem with non-contained grids}
\label{Fc1dnd}
%code lives in .....
% /charon/u0/ph/az/scott2/newmgml1/try2/deff/adapt/fmg
In this section we will develop transfers designed to yield 
fast convergence when we use non-contained grids. Our adaptive 
structures typically look like the one shown in
Figure~\ref{fig:6.5.1}, which is a  2d example. Now $r=0$, (the center point
of the figure),
will generally 
not be part of the computational domain at any level of 
discretization.  This leads to the property that points 
on fine grids in the vicinity of $x[j]=a$ will not be properly
contained by a coarser grid.  We refer to this property as 
non-containment or incomplete nesting.  
For a 1-dimensional problem a typical grid structure looks
like that shown in Figure~\ref{fig:6.5.2}.  There the X's are locations
which lie outside of the computational domain and the filled points 
are points where a Robin boundary condition will be used.

\begin{figure} [h]
\caption{ The discretized domain, where the center point is not in the domain}
\label{fig:6.5.1}
\centerline{\psfig{figure=f651.ps}}
\end{figure}

Our model problem for this section is
\begin{eqnarray}
\label{1dheq}
\frac{\partial^2 u \lb x \rb }{\partial x^2} &=& f \lb x \rb  \quad a < x < {\XMAX} \nonumber \\ 
\frac{\partial u}{\partial x} - \frac{u}{2a} &=& g , \quad x= a \nonumber \\
u \lb \XMAX \rb &=& u \lb x = \XMAX \rb .
\end{eqnarray} 
These equations are finite differenced to
\begin{eqnarray}
\frac{u[j+1] -2 u[j]  + u[j-1]}{h^2} =  f[j] \quad j = \JMIN \cdots n-1 ,
\end{eqnarray}
and
\begin{eqnarray}
\label{fdibc}
\frac{u[j+1] - u[j]}{h} = \frac{u[j]}{2a} + g \quad j = \JMIN
\end{eqnarray}
where $\JMIN$~is the point where the boundary condition will be imposed.
We will use 
\begin{eqnarray}
u \lb x \rb  &=& 1 + \frac{a}{x} \nonumber \\
f \lb x \rb  &=& \frac{2a}{x^3} \nonumber \\
g &=& - \frac{2}{a}
\end{eqnarray}

We use fourth-order deferred correction at the boundary, where the 
first-order and fourth-order boundary operators are:
\begin{eqnarray}
B^h_1 u^h [ j ] = \frac{1}{h} \lb u[j+1] - u[j] - \frac{u[j]}{2a} \rb \quad j = \JMIN
\end{eqnarray}
and
\begin{eqnarray}
B^h_4 u^h [j] = u_\chi - \frac{u_\sigma}{2a}
\end{eqnarray}
where
\begin{eqnarray}
u_\sigma = \frac{1}{24}  \lC  &-& 32 s h^3 u[\JMIN+3] + 4 s^4 u[\JMIN+3] -
4 s^4 u[\JMIN+1] \nonumber \\
&+& s^4 u[\JMIN] + 6 s^4 u[\JMIN+2] + s^4 u[\JMIN+4] \nonumber \\
   &-& 28 s^3 h u[\JMIN+3] - 36 s^3 h u[\JMIN+1] + 48 s^3 h u[\JMIN+2] \nonumber\\
   &+&  6 s^3 h u[\JMIN+4] - 56 s^2 h^2 u[\JMIN+3] - 104 s^2 h^2 u[\JMIN+1] \nonumber \\
&+& 35 s^2 h^2 u[\JMIN]
 + 114 s^2 h^2 u[\JMIN+2] + 11 s^2 h^2 u[\JMIN+4] \nonumber \\
&+& 10 s^3 h u[\JMIN] + 6 s h^3 u[\JMIN+4] \nonumber \\ 
&+& 24 h^4 u[\JMIN] + 72 s u[\JMIN+2] \nonumber \\
&-& 96 s h^3 u[\JMIN+1] + 50 s u[\JMIN] h^3 \RC  h^{-4}
\end{eqnarray}
and
\begin{eqnarray}
u_\chi = - \TWELTH h^{-4}  \lC  &-& 42 s^2 h u[\JMIN+3]  -54 s^2 h u[\JMIN+1] + 72 s^2 h u[\JMIN+2] \nonumber \\
&+& 9 s^2 h u[\JMIN+4] - 56 s h^2 u[\JMIN+3] - 104 s h^2 u[\JMIN+1] \nonumber \\
&+& 35 s h^2 u[\JMIN] + 114 s h^2 u[\JMIN+2] + 11 s h^2 u[\JMIN+4] \nonumber \\
&+& 36 h^3 u[\JMIN+2] + 25 h^3 u[\JMIN] - 8 s^3 u[\JMIN+2] \nonumber \\
&-& 8 s^3 u[\JMIN+1] + 2 s^3 u[\JMIN] + 12 s^3 u[\JMIN+2] \nonumber \\
&+& 2 s^3 u[\JMIN+4] - 16 h^3 u[\JMIN+3] - 48 h^3 u[\JMIN+1] \nonumber \\
&+& 3 h^3 u[\JMIN+4] + 15 s^2 h u[\JMIN]  \rC 
\end{eqnarray}
with
\begin{eqnarray}
s = x \lb  \JMIN \rb  - a .
\end{eqnarray}

We use a technique similar to the one described by Figure~\ref{alg6.3.1}
to apply deferred correction (using the above operators) at the boundary 
point $ j = \JMIN $.
The complete algorithm is shown in Figure~\ref{alg6.5.1} and we note
that we are {\em not\/} using a FMG scheme. 
We again relax the boundary as
\begin{eqnarray}
u[j] := u[j] + \alpha \lb u^*[j] - u[j] \rb 
\end{eqnarray}
but now we use
\begin{eqnarray}
\alpha &=& \alpha_1 \qquad {\rm for~non~contained~grids} \nonumber \\
       &=& \alpha_2 \qquad {\rm for~contained~grids} \nonumber .
\end{eqnarray} 
Thus, distinct boundary relaxation 
factors, $\alpha_1$ and $\alpha_2$ are again used for cases where the 
boundary grid point is not contained or is contained, respectively,
by the parent grid.
\clearpage

\begin{figure} [p]
\caption{ The V-cycle routine used with interfaces}
\label{alg6.5.1}
{\small
\begin{tabbing}
\T {\tt PROCEDURE VCYCLE\_FAS(~ncycle, $\LMAX$, \PRE, \PST~,~order) } \\
\T\T {\tt \DO \CYCLE = 1 ,ncycle   }  \\
\T\T\T { \tt \DO  $\LEVEL = \LMAX , \LCOARSE+1$ } \\
\T\T\T\T {\tt FIND\_INNER\_BOUNDARY( $\JMIN$ ) }\\
\T\T\T\T {\tt \IF ($\LEVEL \not= \LMAX$ \OR~\CYCLE = 1 \THEN } \\
\T\T\T\T\T {\tt \DO  p = 1 , pre } \\
\T\T\T\T\T\T {\tt  RELAX\_INTERIOR, $j=\JMIN + 1 \cdots n-1$}\\
\T\T\T\T\T\T{\tt $\alpha =$ PICK\_ALPHA( $\alpha_1$, $\alpha_2$ ) }\\
\T\T\T\T\T\T       {\tt RELAX\_BOUNDARY, $j=\JMIN$}\\
\T\T\T\T\T {\tt \ENDDO} \\
\T\T\T\T {\tt \ENDIF } \\
%
\T\T\T\T {\tt \IF~( $\LEVEL= \LMAX$ ) \THEN}\\
\T\T\T\T\T {\sl Apply deferred correction}\\
\T\T\T\T {\tt \ENDIF}\\
%
\T\T\T\T{ \tt $ \tau^H_h[J] = L^H \REST u^h[j] - \REST L^h u^h[j[$, \quad $j=\JMIN + 1  \cdots n-1$}\\
\T\T\T\T{ \tt $ \tau^H_h[\JMINC] = B^H_1 \REST u^h[\JMIN] - \REST B^h_1 u^h[\JMIN]$}\\
\T\T\T\T{ \tt $ f^H[J] = \REST f^h[j] + \tau^H_h[J] $ \quad {\sl Correct the rhs}} \\
\T\T\T\T{ \tt $ g^H[\JMINC] = \REST g^h[\JMIN] + \tau^H_h[\JMINC] $}\\
\T\T\T { \tt \ENDDO } \\
\T\T\T{ \tt SOLVE($L^H u^H = f^H$, and $B^H_1 u^H = g^H$) } \\
\T\T\T {\tt  \DO  $\LEVEL = \LCOARSE , \LMAX - 1$} \\
\T\T\T\T { \tt $ u^h[j] := u^h[j] + \PRO \lb u^H[j]  - \REST u^h[J] \rb $ , \quad $j = \JMIN + 1 \cdots n-1$} \\
\T\T\T\T { \tt $ u^h[\JMIN] := u^h[\JMINC] + \PRO \lb u^H[\JMINC]  - \REST u^h[\JMIN] \rb $ , \quad $j = \JMIN$} \\
\T\T\T\T {\tt \DO  q = 1 , pst } \\
\T\T\T\T\T\T       {\tt  RELAX\_INTERIOR}\\
\T\T\T\T\T\T{\tt $\alpha =$ PICK\_ALPHA( $\alpha_1$,$ \alpha_2$ ) }\\
\T\T\T\T\T\T       {\tt  RELAX\_BOUNDARY,  $j=\JMIN$ }\\
\T\T\T\T {\tt \ENDDO} \\
\T\T\T{ \tt \ENDDO} \\
\T\T {\tt \ENDDO} \\
\T{ \tt END PROCEDURE }
\end{tabbing}
}
\end{figure}

\clearpage
\subsection[Test runs] {Test runs}
\label{Tests6.5}
In our test runs, we always use 2 pre-smoothing sweeps on 
the finest level and 1 pre- and 1 post-smoothing sweep in all other
cases. We also fix $\alpha_1 = 1$ and $\alpha_2 = 0$ for most of the runs,
and stop the $V$-cycles only when the $\LONE$ norm of the interior residuals
has reached the level of machine precision.

Our chief concern is to ensure that we get extrapolatable results
and we begin with a case where all the grids are properly contained
(completely nested).
We first compare the convergence behavior of deferred-corrected and 
non-corrected results.
Tables~(\ref{table6.5.1}),~(\ref{table6.5.2}) clearly show that we need
to use deferred correction in order to get extrapolatable results.

We now consider the case when none of the grids are properly
contained. 
For this case we use $a=0.12506103515625$ and a coarsest-level grid
spacing 
$h_{\rm coarse} = 0.25 $.  Table~\ref{table6.5.3} shows that
we again get extrapolatable results.

Since we can get extrapolatable results, we are now in a position to 
investigate
the convergence rate of this algorithm.  
For these tests we change the value of $a$ which has the effect of 
changing the number of properly-contained grids.
We again use fourth-order deferred correction of the boundary condition
and set $\XMAX=2$ and $h_{\rm coarse} =1/2$ for all tests.
Our goal is to make
sure that the convergence rate remains approximately constant no matter
how many grids are not properly contained.   
Also, in these tests, we experiment with the restriction and prolongation
operators for the function values in the vicinity of the boundary.

We begin by running a benchmark where all the grids are properly 
contained. Thus we set $a = h_{\rm coarse}$ so that 
$x^h \lb \JMIN \rb =x^{2h} \lb \JMIN \rb =
x^{4h} \lb \JMIN \rb =\cdots$. 
Table~\ref{table6.5.4} shows the convergence rate, $\rho$,
for levels 2 through 8.
We see that the convergence rate remains constant after about the
fifth level, at which point the problem is being solved in about 
one cycle. 

For the next four tests, we will use the following transfers,
\begin{eqnarray}
u^H[\JMINC] = \REST u^h[\JMIN] = u^h[\JMIN] \nonumber \\
u^h[\JMIN] = \PRO u^H[\JMINC] = u^H[\JMINC]
\end{eqnarray}
where $\JMIN$ and $\JMINC$ are the grid locations where we apply 
the boundary conditions on the fine and coarse grids respectively.
All the interior values on the grids are transferred with
the usual restrictions and prolongations:
\begin{eqnarray}
u^H[J] = \REST  u^h[j] &=& \HALF u^h[j] + \QUARTER \lb u^h[j-1] + u^h[j+1] \rb \nonumber \\
u^h[j] = \PRO u^H[J] &=& u^H[J] \quad \quad \quad \quad \quad \quad \quad \quad \quad \qquad 2J -1 = j \nonumber \\
                     &=& \HALF \lb u^H[J-1] + u^H[J+1] \rb \qquad 2J-1 \not= j
\end{eqnarray}

For the first 3 of the 4 tests we will also 
use $\alpha_1=1.0$ and $\alpha_2=0.0$.
In the first test only one grid  is not contained 
(see Figure~\ref{fig:6.5.3}).
The convergence test for these runs
is shown in Table~\ref{table6.5.5}, where $a=h_{\rm coarse}/2$.
We see that
the convergence rate drops dramatically from the test case. 
We also see that the convergence rate gets better as $l$ is increased
since the number of grids that are 
properly contained increases.
For the next test, we set $a=h_{\rm coarse}/16$ 
which means that the four coarsest grids 
are not contained.
The results of this run are shown in Table~\ref{table6.5.6} 
where again we see another dramatic decrease
in the convergence rate. 
Finally, we set $a=h_{\rm coarse}/2048$ so that all grids 
are not-contained. 
As expected the results shown in Table~\ref{table6.5.7} show another 
dramatic decrease in the convergence rate.  

\begin{figure} 
\caption{A schematic view of the not properly contained grid. }
\label{fig:6.5.3}
\centerline{\psfig{figure=f653.ps}}
\end{figure}


Our goal is
to build a fast solver, which means that we would like the convergence rate,
$\rho$, to be at least $-0.1$.\footnote{We arbitrarily define this rate, which 
is much slower than all model multigrid algorithms.}
We must therefore use improved transfers around the
boundaries.  Through experimentation we have found that the point 
where transfers need to be modified is not at the boundary
point but at the interior point immediately adjacent to the boundary
point.
Figure~\ref{fig:6.5.4} shows a detailed
view of the grid structure near the boundary.  We originally used the 
following transfer for the values near the boundary:
\begin{eqnarray}
u^H[\JMINC+1] &=& \REST u^h[\JMIN+3] = \HALF  u^h[\JMIN+3] \nonumber \\
&+& \QUARTER  \lb u^h[\JMIN+2]+u^h[\JMIN+4] \rb \nonumber \\
u^h[\JMIN+3] &=& \PRO u^H[\JMINC+1] = u^H[\JMINC+1] \nonumber \\
u^h[\JMIN+2] &=& \PRO u^H[\JMINC+1] = \UNDEF \nonumber \\
u^h[\JMIN+1] &=& \PRO u^H[\JMINC+1] = \UNDEF  .
\end{eqnarray}
This left two function values undefined at the end of the transfer.
We then tried to provide values at these points by means of linear interpolation
of $u^h[\JMIN]$ and $u^h[\JMIN+3]$, but this procedure did not improve the
convergence rate.  

\begin{figure}
\caption{ A close-up view of the non contained grids}
\label{fig:6.5.4}
%\vskip 1in
\begin{center}
\input{f654.tex}
\end{center}
%\vskip 1in
\end{figure}

We started by experimenting with the transfers
\begin{eqnarray}
u^H[\JMINC+1] = \Xi[0] u^h[\JMIN] + \sum_{i=1}^{10} \Xi[i] u^h[\JMIN+i]
\end{eqnarray}
where, $0 \leq \Xi \left[ i \right] \leq 1$, are the  transfer coefficients.
Through further experimentation we found
the performance was best when we defined the value $u^H[\JMINC+1]$ by:
\begin{eqnarray}
\label{good1dbrest}
u^H[\JMINC+1] &=& \REST u^h[\JMIN+3] = 0.01 u^h[\JMIN+5] + 0.49 u^h[\JMIN+4] +  \nonumber \\
                      &+& 0.0 u^h[\JMIN+3] + 0.01 u^h[\JMIN+1] + 0.49 u^h[\JMIN+2] .
\end{eqnarray}

These results suggest that residual at $\JMINC+1$ is independent of the
residual at $\JMIN+3$ although $x[\JMINC+1]=x[\JMIN+3]$.  
The prolongation operators which we use are
\begin{eqnarray}
\label{good1dbpro}
u^h[\JMIN+2] = \PRO u^H[\JMINC+1] = - u^h[\JMIN+4]+ 2 u^h[\JMIN+3] \nonumber \\
u^h[\JMIN+1]= \PRO u^H[\JMINC+1] = \HALF \lb u^h[ \JMIN] + u^h[\JMIN+2] \rb. 
\end{eqnarray}
Note  that the prolongation uses extrapolation to determine the
value at $\JMIN+2$.  These operators are used for all functions 
which are transferred from one discretization level to another.

The convergence rate obtained when we 
use these operators is shown in Table~\ref{table6.5.8} and 
we see that it is much faster than the original algorithm for 
the case when
all grids are not properly contained.  However, the improved convergence
rate for the non-contained case is still much slower than
that for the case when all grids are properly nested.
We have, however, been able to reduce the residuals by
one order of magnitude for every four work units, 
which we believe is an excellent convergence rate in comparison with
the other traditional iterative solvers.  

The last test we try varies $\alpha_1$ to see if we can improve the
convergence rate. 
(Recall that $\alpha_1$ is the boundary smoothing factor for 
a grid which is not properly contained by its parent).
Table~\ref{table6.5.9}  shows the convergence rate
as a function of $\alpha_1$ for the case $l=8$.
Clearly, the convergence rate is quite insensitive to the value 
of $\alpha_1$ as long as $\alpha_1 < 2$.

\begin{table}
\begin{caption}
  { 1D FMG FAS algorithm with inner boundary condition imposed.}
  \label{table6.5.1}
\end{caption}
\begin{center}
  { Deferred correction not used}
\end{center}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$& $e \lb l \rb $& $Q \lb l,l+1 \rb $\\ \hline
2  & 4.7(-2) & 2.0 \\
3  & 2.4(-2) & 2.0 \\
4  & 1.2(-2) & 2.0 \\
5  & 6.1(-3) & 2.0 \\
6  & 3.0(-3) & 2.0 \\
7  & 1.5(-3) & 2.0 \\
8  & 7.6(-4) & 2.0 \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  { 1D FMG FAS algorithm with inner boundary condition imposed, with deferred correction to fourth order}
  \label{table6.5.2}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$& $e \lb l \rb $& $Q \lb l,l+1 \rb $\\ \hline
2  & 4.1(-3) & 4.5 \\
3  & 9.2(-4) & 4.2 \\
4  & 2.2(-4) & 4.1 \\
5  & 5.3(-5) & 4.0 \\
6  & 1.3(-5) & 4.0 \\
7  & 3.3(-6) & 4.0 \\
8  & 8.1(-7) & 4.0 \\
x23& 2.1(-4) & 8.1 \\
x34& 2.6(-5) &11.3 \\
x45& 2.3(-6) &13.5 \\
x56& 1.7(-7) &14.6 \\
x67& 1.2(-8) &15.4 \\
x78& 7.8(-10)&16.0 \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  { 1D FMG FAS algorithm with inner boundary condition, deferred correction to fourth order, and non-contained grids.}
  \label{table6.5.3}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$& $e \lb l \rb $& $Q \lb  l,l+1 \rb $\\ \hline
2  & 6.4(-2) & 4.6 \\
3  & 1.4(-2) & 6.1 \\
4  & 2.3(-3) & 5.2 \\
5  & 4.1(-4) & 4.7 \\
6  & 8.7(-5) & 4.4 \\
7  & 2.0(-5) & 4.0 \\
8  & 5.0(-6) & 4.0 \\
9  & 1.2(-6) & 4.0 \\
x23& 4.0(-3) & 2.2 \\
x34& 1.8(-3) & 6.2 \\
x45& 2.9(-4) &10.0 \\
x56& 2.9(-5) &12.6 \\
x67& 2.3(-6) &14.7 \\
x78& 1.6(-7) &16.0 \\
x89& 9.7(-9) &16.0 \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  { The convergence rate of the 1D FMG FAS algorithm with inner boundary condition, deferred correction to fourth order, and no non-contained grids.}
  \label{table6.5.4}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$& $\rho \lb l \rb $\\ \hline
2  &-1.4(+0) \\ 
3  &-1.4(+0) \\
4  &-1.7(+0) \\
5  &-1.8(+0) \\
6  &-1.9(+0) \\
7  &-1.9(+0) \\
8  &-2.0(+0) \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  { The convergence rate of the 1D FMG FAS algorithm with inner boundary condition, deferred correction to fourth order, and one non-contained grid.}
  \label{table6.5.5}
\end{caption}
\centering
{\small                                                 
\begin{tabular}{ccc} \hline \hline
$l$& $\rho \lb l \rb $\\ \hline
2 &-7.7(-2) \\
3 &-1.2(-1) \\
4 &-1.5(-1) \\
5 &-1.7(-1) \\
6 &-1.8(-1) \\
7 &-1.9(-1) \\
8 &-1.9(-1) \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table} 
\begin{caption}
  { The convergence rate of the 1D FMG FAS algorithm with inner boundary condition, deferred correction to fourth order, and four non-contained grids.}
  \label{table6.5.6}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$& $\rho \lb l \rb $\\ \hline
2  &-2.7(-2) \\
3  &-5.0(-2) \\
4  &-6.4(-2) \\
5  &-6.0(-2) \\
6  &-6.0(-2) \\
7  &-6.6(-2) \\
8  &-7.0(-2) \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  { The convergence rate of the 1D FMG FAS algorithm with inner boundary condition, deferred correction to fourth order, and all grids not-properly contained.} 
  \label{table6.5.7}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$& $\rho \lb l \rb $\\ \hline
2  &-3.3(-2) \\
3  &-4.8(-2) \\
4  &-5.3(-2) \\
5  &-4.8(-2) \\
6  &-4.8(-2) \\
7  &-4.2(-2) \\
8  &-4.0(-2) \\
9  &-3.8(-2) \\ \hline \hline
\end{tabular}
}
\end{table}


\begin{table}
\begin{caption}
  {1D FMG FAS algorithm with experimental transfers, using deferred correction to fourth order and all grids not-properly contained.}
  \label{table6.5.8}
\end{caption}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$l$& $\rho \lb l \rb $\\ \hline
2 &-7.7(-2) \\
3 &-1.2(-1) \\
4 &-1.7(-1) \\
5 &-2.1(-1) \\
6 &-2.3(-1) \\
7 &-2.4(-1) \\
8 &-2.5(-1) \\
9 &-2.5(-1) \\
10&-2.5(-1) \\ \hline \hline 
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  { Survey of the effect of $\alpha_1$ on the convergence rate for non-contained grids} 
  \label{table6.5.9}
\end{caption}
\begin{center}
  { Deferred correction used to fourth order, $l=8$, all grids unaligned}
\end{center}
\centering
{\small
\begin{tabular}{ccc} \hline \hline
$\alpha_1\lb l \rb $& $\rho \lb l \rb $\\ \hline
0.0(-0) & -2.38(-1) \\
1.0(-3) & -2.38(-1) \\
1.0(-2) & -2.39(-1) \\
5.0(-2) & -2.44(-1) \\
1.0(-1) & -2.53(-1) \\
2.0(-1) & -2.46(-1) \\
1.0(+0) & -2.47(-1) \\
2.0(+0) & -2.49(-1) \\
3.0(+0) & -7.43(-2) \\ \hline \hline

\end{tabular}
}
\end{table}
\clearpage
\section[1D extrapolatable adaptive MLAT with blended boundary condition and outer boundary condition]{ 1D extrapolatable adaptive MLAT with blended boundary condition and outer boundary condition}
\label{1dc}

%code lives in .....
% /charon/u0/ph/az/scott2/newmgml1/try2/deff/adapt

Before we combine all of the elements of the last three sections to 
form a single algorithm, we wish to explore one more aspect of
equation~(\ref{fdibc}). Since this equation models the boundary condition
we use at the interior (hole) boundaries in 2 and 3 dimensions,
we would like to understand how to effectively treat it in the
contexts of 
mesh refinement and multigrid.

Choptuik\cite{ChoptuikPR} pointed out that since this equation will be used on 
a extremely large range of refinement levels, 
the performance of the solver could suffer
since the very coarse grids will not provide reasonable approximations
of the function derivative near the boundary.
Our solution to this problem is to use a ``blended'' boundary condition.
Recall that the condition we pose at the boundary is:
\begin{eqnarray}
\frac{\partial u}{\partial x} - \frac{u}{2a} &=& g, \quad \quad  x= a ,\nonumber \\
\end{eqnarray}
which we now represent as
\begin{eqnarray}
\label{blend1}
B_\beta u \lb x \rb = g_1 \quad \quad x = a
\end{eqnarray}
where
\begin{eqnarray}
 g_1 = -\frac{2}{a}.
\end{eqnarray}
We only want to apply this Robin boundary condition on the finer levels.
On the coarser levels, where we will not be able to get
a good approximation for the derivative, we will apply a Dirichlet boundary
condition
\begin{eqnarray}
\label{bland1}
B_\gamma u \lb x \rb = g_2 \quad x = a, 
\end{eqnarray}
where 
\begin{eqnarray}
\label{blend2}
B_\gamma u \lb x \rb &=& u \lb x \rb \quad x = a\nonumber \\
g_2 &=& \REST u^h \lb x \rb .
\end{eqnarray} 
This last condition just sets the coarse grid value, $u^H \lb a \rb $
to the corresponding
fine grid value, $u^h \lb a \rb $.
The blended boundary condition is then given by: 
\begin{eqnarray}
\label{bbd}
\lb \beta B_\beta + \lb 1 - \beta \rb B_\gamma \rb u = \beta g_1 + \lb 1 - \beta \rb  g_2
\end{eqnarray}
where $\beta$ is a function of the discretization level $l$ such 
that $\beta \lb l_{\rm max} \rb  = 1$
 (so that we recover the true Robin condition
on the finest level) and $\beta \lb 0 \rb  = 0$ (so that the coarsest 
problem has Dirichlet conditions). 
For brevity we can then rewrite equation~(\ref{bbd}), as
\begin{eqnarray}
B  u = g
\end{eqnarray}
where 
\begin{eqnarray}
B = \beta B_\beta + \lb 1 - \beta \rb B_{1 - \beta}
\end{eqnarray}
and
\begin{eqnarray}
g = \beta g_1 + \lb 1 - \beta \rb g_2.
\end{eqnarray}

The smoothing operator on the boundary is now defined as
\begin{eqnarray}
u[\JMIN]= \frac{-2a \beta u[\JMIN+1 ]+ 2 a h \beta g_1 +2 a h \lb 1 - \beta \rb g_2}
{2 a h \lb 1 - \beta \rb - 2 a \beta - h \beta} .
\end{eqnarray}
We use injections for our boundary transfers but the functions 
$g_1$ and $g_2$ are treated separately in these transfers.
Specifically, we use:
\begin{eqnarray}
g_1^H &=& g_1^h + \tau^H_{h~~\beta} \nonumber \\
g_2^H &=& g_2^h + \tau^H_{h~~\lb 1 - \beta \rb }  \nonumber \\
\end{eqnarray}
where $\tau^H_{h~~\beta}$ and $\tau^H_{h~~\lb 1 - \beta \rb} $ are given by
\begin{eqnarray}
\tau^H_{h~~\lb 1 - \beta \rb} &=& 0 \nonumber \\
\tau^H_{h~~\beta}  &=& B^H_\beta \REST u^h - \REST B^h_\beta u^h  .
\end{eqnarray}

We will now study the effects of varying $\beta \lb l \rb $.  For these experiments
we fix $a=h_{\rm coarse}/16$, $h_{\rm coarse} = 1/2$ 
and $\XMAX=2$.
Table~\ref{table6.6.1} shows the effect of varying $\beta \lb l \rb $ on a 
10 level system. To determine the best $\beta$'s we ran a binary search
through the values of $\beta \lb l \rb $ which ranged from zero to one in 0.1
increments.  The bold face numbers were the best parameters that we
were able to find.

We can not claim that our best $\beta \lb l \rb $ yields the best possible 
convergence using the blended approach since, obviously, we have 
not tried every conceivable combination.
What we do see in this table, though, is that the
convergence rate can be improved from $-0.29$  to -$0.36$ which means
that we can improve the convergence rate by approximately one sweep
per order of magnitude of residual reduction. This amounts to
about a 25\% reduction in computational cost. 

When we run tests with $\XMAX \gg h_{\rm coarse}$,
we do not seem to be able to get results which are much better
than those obtained without the use of a blended boundary 
condition. However, when we apply this technique to our 2- and 
3-dimensional problems, we hope
that the blended boundary technique will allow us to
use non-diagonally dominant stencils on the finest
grids, while solving coarse-grid systems which have 
all-Dirichlet conditions.


We have now introduced all the techniques we need 
to get a fast, extrapolatable
solver using the Robin conditions on all boundaries.
A 1-D algorithm which incorporates these features is shown in
Figure~\ref{alg6.6.1}.  This algorithm works when only one
grid is defined per level. 

Again, our model problem is:
\begin{eqnarray} 
\frac{\partial^2 u \lb x \rb }{\partial x^2} &=& f \lb x \rb  \quad a < x < {\XMAX} \nonumber \\
\frac{\partial u}{\partial x} - \frac{u}{2a} &=& g , \quad x = a  \nonumber \\
\frac{\partial u}{\partial x} &=& \frac{1 - u}{x} \quad x = \XMAX   \\
\end{eqnarray}
our finite difference approximation is 
\begin{eqnarray}
\lefteqn{h^{-2} \lb u[j+1] - 2 u[j] + u[j-1] \rb  = f[j] \quad j = \JMIN + 1 \cdots n-1}  \nonumber \\
& &u^{**}[\JMIN ] = \frac{-2a \beta u\lb \JMIN+1 \rb + 2 a h \beta g_1 +2 a h \lb 1 - \beta \rb g_2} {2 a h \lb 1 - \beta \rb - 2 a \beta - h \beta} \nonumber \\
& &u[j] := u[j] + \alpha \lb  u[j]^{**} - u[j] \rb \quad j = \JMIN \nonumber \\
& &u[j]^{*} = \frac{ 1 }{1 + \frac{h}{\XMAX}} \lb \frac{h}{\XMAX + u[j-1] + h g } \rb \quad j = n \nonumber \\
& &u[j] := u[j] + \alpha  \lb u[j]^* - u[j] \rb \quad j = n,
\end{eqnarray}
and we use the model functions
\begin{eqnarray}
u \lb x \rb = 1 + \frac{a}{x} \nonumber \\
f \lb x \rb = \frac{2 a }{x^3} \nonumber \\
g \lb x=a \rb = - \frac{2}{a}
\end{eqnarray}
to examine the convergence behavior of our algorithm 
%file at /d/hoffmann/usr2/people/scott/thesis/6.6/graphs/test2

Figure~\ref{fig:6.6.1} shows a graph of the log of the absolute
 errors,
$\vert e \vert $,
for the raw solution and the extrapolated solution. 
(Again, the lines here 
are separated by a spacing of $\log_{10} \lb 2 \rb $).
We clearly see in this 
graph that the open symbols are displaced by 2 lines, while the 
filled symbols are displaced by 4 lines.  This demonstrates that the 
basic solution
is second order, while the extrapolated solution is fourth order.  For this
run we only used one refinement, and placed the inner and outer boundaries
at $a \approx \QUARTER$ and $\XMAX = 2.0$, respectively.  The 
placement of the inner
boundary is such that no grid point at any level will ever be coincident
with it.
To make the graph more readable, we plot every thirty-second point at each
level. 

As previously claimed, 
our algorithm works with one refinement, it should work with more.
Figure~\ref{fig:6.6.2} shows the results from a run where
$a \approx \QUARTER$ and $\XMAX = 128.0$. Here we used a 5-point coarsest grid.
Since we use so many interfaces, it is better to show the results on a log-log 
scale. 

In summary, our 1-d algorithm
produces extrapolatable
solutions of 1-d analogues of the equations that we will 
solve for the initial value problem for two black holes.  We did not study
convergence rates in this section since we still do not fully understand
the stopping criteria when we smooth the relative truncation error estimate
around the interfaces.  
We have clearly presented a path by which we can build multi-dimensional 
versions of the one dimensional algorithm. However,
some additional work will be needed to determine appropriate 
multi-dimensional transfers for our irregular interior boundaries.

\clearpage
\begin{figure} [p]
\caption{The 1D FAS V-cycle routine which contains the inner and outer boundary conditions }
\label{alg6.6.1}
{\small
\begin{tabbing}
\T {\tt PROCEDURE VCYCLE\_FAS\_1D\_EXTRAP(~\NCYC, $\LMAX$, \PRE, \PST,~order) } \\ %(
\T\T {\tt \DO \CYCLE = 1 ,ncycle   }  \\ %(
\T\T\T { \sl Cycle up to the coarsest level } \\
\T\T\T { \tt \DO  $\LEVEL = \LMAX , \LCOARSE+1$ } \\ %(
\T\T\T\T {\tt FIND\_INNER\_BOUNDARY( $\JMIN$ ) }\\
\T\T\T\T {\tt \IF ($\LEVEL \not=\LMAX$ \OR  \CYCLE = 1 ) \THEN } \\ %(
\T\T\T\T\T {\tt FIND\_INTERFACE(j\_max) }\\
\T\T\T\T\T {\sl {\tt j\_max = FIND\_INTERFACE} will find the interface point}\\
\T\T\T\T\T {\tt \DO  p = 1 , pre } \\ %(
\T\T\T\T\T\T {\tt  RELAX\_INTERIOR($u^h[j]= f^h[j]$) \quad $j=\JMIN \cdots n-1$}\\
\T\T\T\T\T\T{\tt \IF ( \GMAX(\LHEAD($\LEVEL$))=$\XMAX$)  \THEN }\\ %(
\T\T\T\T\T\T\T   {\tt RELAX\_OUTER\_BOUNDARY($u^h[n]= g^h[n]$,$\alpha_0$) \quad
j=n}\\
\T\T\T\T\T\T{\tt \ENDIF }\\ %) 
\T\T\T\T\T\T{\tt $\alpha =$ PICK\_ALPHA( $alpha_1$, $alpha_2$ ) }\\
\T\T\T\T\T\T{\tt RELAX\_INNER\_BOUNDARY($u^h[\JMIN]= g^h[\JMIN]$,$\alpha$,}\\
\T\T\T\T\T\T\T\T\T\T\T\T\T\T{$\beta(\LHEAD($\LEVEL$)))$, \quad $j=\JMIN$}\\
\T\T\T\T\T {\tt \ENDDO} \\ %)
\T\T\T\T {\tt \ENDIF } \\ %)
\T\T\T\T {\tt \IF~( GMAX(\LHEAD($\LEVEL$))= $\XMAX$~\AND}\\
\T\T\T\T\T\T{\GMAX(\GPCH(\LHEAD($\LEVEL$))) $\not= \XMAX$ ) \THEN}\\ %(
\T\T\T\T\T {\sl Now apply deferred correction}\\
\T\T\T\T {\tt \ENDIF} \\ %)
\T\T\T\T {\tt \IF~( $\LEVEL = \LMAX$ ) \THEN}\\ %(
\T\T\T\T\T {\sl Now apply deferred correction}\\
\T\T\T\T\T {\tt $g^h[\JMIN] := g + B^h_4( u[\JMIN]) - B^h_1( u[\JMIN])$ }\\
\T\T\T\T {\tt \ENDIF}\\ %)
\end{tabbing}
}
\end{figure}

\begin{figure} [p]
\begin{center}
  Figure~\ref{alg6.6.1} continued
\end{center}
{\small
\begin{tabbing}
\T\T\T\T{ \tt $ \tau^H_h[J] = L^H \REST u^h[j] - \REST L^h u^h[j]$, \quad $J=\JMINC  \cdots$ J\_max-1}\\
\T\T\T\T{\tt $ \tau^H_h(j) = 0$ ,\quad $j=$j\_max$\cdots n$}\\
\T\T\T\T{\sl set  $ \tau^H_h[j]$ to zero where it is not defined } \\
\T\T\T\T{\tt \IF ( \GMAX(\LHEAD($\LEVEL$))=$\XMAX$)  \THEN }\\ %(
\T\T\T\T\T{\tt $ \tau^H_h[n] = Z^H_1 \REST u^h[n] - \REST B^h_1 u^h[n]$}\\
\T\T\T\T\T{\tt $ g^H[N] = \REST g^h(n) + \tau^H_h(N)$ }\\
\T\T\T\T{\tt \ENDIF} \\ %)
\T\T\T\T{ \tt $ \tau^H_h[\JMINC] = B^H_1 \REST u^h[\JMIN] - \REST B^h_1 u^h[\JMIN]$}\\
\T\T\T\T{ \tt $ g^H[\JMINC] = \REST g^h[\JMIN] + \tau^H_h[\JMIN] $}\\ 
\T\T\T\T{ \tt $ f^H[J] = \REST f^h[j] + \tau^H_h[j] $ }\\
\T\T\T\T{\sl When $j \geq$ j\_max then determine $f^H[J]$ from the analytical rhs}\\
\T\T\T { \tt \ENDDO } \\ %)
\T\T\T{ \tt SOLVE($L^H u^H = f^H$, and $Z^H_1 u^H = g^H$), and $B^H_1 u^H = g^H$ } \\
\T\T\T {\tt  \DO  $\LEVEL = \LCOARSE , \LMAX - 1$} \\ %(
\T\T\T\T { \tt $ u^h[j] := u^h[j] + \PRO \lb u^H[j]  - \REST u^h[j] \rb $ , \quad $j = \JMIN \cdots$ j\_max-1} \\
\T\T\T\T{\tt \IF ( GMAX(\LHEAD($\LEVEL$))=$\XMAX$)  \THEN }\\ %(
\T\T\T\T\T {\tt $ u^h[n] := u^h[n] + \PRO \lb u^H[n]  - \REST u^h[n] \rb $ , \quad j = n} \\
\T\T\T\T{\tt \ENDIF} \\ %)
\T\T\T\T {\tt $ u^h[\JMIN] :=  u^h[\JMINC] + \PRO \lb u^H[\JMINC]  - \REST u^h[\JMIN] \rb  , \quad j = \JMIN$} \\
\T\T\T\T {\tt \DO  q = 1 , pst } \\ %(
\T\T\T\T\T\T  {\tt  RELAX\_INTERIOR($u^h[j], f^h[j]$)  \quad $j=2\cdots n-1$}\\
\T\T\T\T\T\T{\tt \IF ( \GMAX(\LHEAD($\LEVEL$))=$\XMAX$)  \THEN }\\ %(
\T\T\T\T\T\T\T  {\tt  RELAX\_OUTER\_BOUNDARY($u^h[n], g^h[n]$,$\alpha_0$) \quad
j=n}\\
\T\T\T\T\T\T  {\tt \ENDIF} \\ %)
\T\T\T\T\T\T{\tt $\alpha =$ PICK\_ALPHA( $\alpha_1$, $\alpha_2$ ) }\\
\T\T\T\T\T\T{\tt RELAX\_INNER\_BOUNDARY($u^h[\JMIN]= g^h[\JMIN]$,$\alpha$,}\\
\T\T\T\T\T\T\T\T\T\T\T\T\T\T{$\beta(\LHEAD(\LEVEL))$), \quad $j=\JMIN$}\\
\T\T\T\T {\tt \ENDDO} \\ %)
\T\T\T{ \tt \ENDDO} \\ %)
\T\T{ \tt \ENDDO} \\ %)
\T{ \tt END PROCEDURE } %)
\end{tabbing}
}
\end{figure}

\clearpage
\begin{table} [p]
\begin{caption}
  {1D FMG FAS algorithm with blended boundary condition, and experimental transfers}
  \label{table6.6.1}
\end{caption}
\begin{center}
  { Deferred correction used to fourth order, all grids unaligned, $l=10$, $\XMAX=2$}
\end{center}
\centering
{ \small
\begin{tabular}{ccccccccccc} \hline \hline
$\beta \lb 0 \rb$ &$ beta \lb 1 \rb $&$\beta \lb 2 \rb $&$\beta \lb 3 \rb $&$\beta \lb 4 \rb $&$\beta \lb 5 \rb $&
$\beta \lb 6 \rb $&$\beta \lb 7 \rb $&$\beta \lb 8 \rb$&$\beta \lb 9 \rb $&$\rho$ \\  \hline
1.0 &1.0 &1.0 &1.0 &1.0 &1.0 &1.0 &1.0 &1.0 &1.0 &-2.88(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.5 &0.4 &0.3 &0.2 &0.0 &-3.43(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.0 &0.4 &0.3 &0.3 &0.0 &-3.10(-3) \\
1.0 &0.9 &0.8 &0.7 &0.6 &1.0 &0.4 &0.3 &0.3 &0.0 &-3.19(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.4 &0.4 &0.3 &0.3 &0.0 &-3.46(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &0.4 &0.3 &0.3 &0.0 &-3.57(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &0.0 &0.3 &0.3 &0.0 &-1.56(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &1.0 &0.3 &0.3 &0.0 &-3.41(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &0.4 &0.0 &0.3 &0.0 &-2.11(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &0.4 &1.0 &0.3 &0.0 &-3.58(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &0.4 &1.0 &0.3 &0.0 &-3.58(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &0.4 &1.0 &0.0 &0.0 &-2.65(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &0.4 &1.0 &1.0 &0.0 &-3.54(-1) \\
{\bf 1.0} &{\bf 0.9} &{\bf 0.8}&{\bf 0.7}&{\bf 0.6}&{\bf 0.3}&{\bf 0.4}&{\bf 1.0}&{\bf 0.6}&{\bf 0.0}&{\bf -3.62(-1)} \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &0.4 &1.0 &0.6 &0.5 &-2.78(-1) \\
1.0 &0.9 &0.8 &0.7 &0.6 &0.3 &0.4 &1.0 &0.6 &1.0 &-2.78(-1) \\ \hline \hline
\end{tabular}
}
\end{table}


\begin{table} [p]
\begin{caption}
  {1D FMG FAS algorithm with inner and outer boundary condition and blended boundary}
  \label{table6.6.2}
\end{caption}
\begin{center}
  { $a = \frac{1}{e}$, $\XMAX = 2.0$} 
\end{center}
\centering
{ \small
\begin{tabular}{ccc} \hline \hline
$l$   & $E_1 \lb l \rb $  & $Q \lb l,l+1 \rb $\\ \hline
2      & 1.3(-2) & 2.5  \\
3      & 5.2(-3) & 9.6  \\
4      & 5.4(-4) & 2.8  \\
5      & 1.9(-4) & 3.7  \\
6      & 5.2(-5) & 4.0  \\
7      & 1.3(-5) & 4.0  \\
8      & 3.3(-6) & 4.0  \\
x34    & 8.8(-4) & 9.2  \\
x45    & 2.0(-4) &22.4  \\
x56    & 2.4(-5) &16.0  \\
x67    & 1.5(-6) &16.0  \\
x78    & 9.4(-8) &16.0   \\ 
x89    & 5.9(-9) &16.0   \\ 
x910    & 3.7(-10) &16.0   \\ 
x1011    & 2.3(-11) &16.0   \\ 
x1112    & 1.4(-12) &16.0   \\  \hline \hline
\end{tabular}
}
\end{table}
\clearpage
\begin{figure} [p]
   \caption{  The errors for extrapolated and non extrapolated results using  2 adaptive refinement levels.}
   \label {fig:6.6.1}
   \centerline{\psfig{figure=fig6.6.1.ps}}
\end{figure}

\begin{figure} [p]
   \caption{ The errors for extrapolated and non extrapolated results using 8 adaptive refinement levels.}
   \label {fig:6.6.2}
   \centerline{\psfig{figure=fig6log.6.2.ps}}
\end{figure}
\clearpage

\section[Two dimensional model problem with non-aligned grids]{Two dimensional model problem with non-aligned grids} 
\label{2DHMP}
In this section 
we design a multigrid code which solves the
equations
\begin{eqnarray}
\label{2deqns}
\frac{\partial^2 u \lb x,y \rb }{\partial x^2} + \frac{\partial^2 u \lb x,y \rb }{\partial y^2}  &=& f \lb x,y \rb 
 \qquad x_{\rm min} \leq x \leq x_{\rm max} ,  y_{\rm min} \leq y \leq y_{\rm max} \nonumber \\
\frac{\partial u \lb x,y \rb }{\partial r} &=& - \frac{u \lb x,y \rb }{2~a} \quad r = a \nonumber \\
u \lb x= \XMAX , y \rb &=& u \lb \XMAX,y \rb  \nonumber \\
u \lb x , y= \YMAX \rb &=& u \lb x, y= \YMAX \rb 
\end{eqnarray}
where $r=\sqrt{ \lb x-c_x \rb ^2 +  \lb y-c_y \rb^2}$, and 
the center of the hole is at $\lb c_x,c_y \rb$.
We use a uniform Cartesian grid, and then exclude a roughly circular region 
from the computational domain as shown in Figure~\ref{fig:lattice}.

In order to fully describe our algorithm we first describe each
major component separately. After we have presented all of the major
routines we will then display the entire algorithm in figures~(\ref{alg6.7.4})
and~(\ref{alg6.7.5}).

\subsection[Generation of the characteristic function]{ Generation of the characteristic function}
\label{CHAR}
We define a characteristic function,~$\CHAR \lb j,k \rb $~, where 
\begin{table}[h]
\begin{tabular}{ll}
$\CHAR^* \lb j,k \rb   = 1$  &$r \geq a$ \\ 
$\CHAR^* \lb j,k \rb   = 0$  &$r < a  $\\ 
$\CHAR \lb j,k \rb   =  2$ & if $\CHAR^* \lb j,k \rb  =1$ and \\
           & $ \Lc \CHAR^* \lb j+1,k \rb =0$ or $\CHAR^* \lb j-1,k \rb =0$ or \\
           &$\CHAR^* \lb j,k+1 \rb =0$ or $\CHAR^* \lb  j,k-1 \rb =0 \Rc $  \\
           & else $\CHAR = \CHAR^*$
\end{tabular}
\end{table}

Thus, in Figure~\ref{fig:lattice},
the $\cdot$, $\bullet$, and $\circ$ symbols
label points where $\CHAR \lb j,k \rb $ is $0$, $1$, or $2$ respectively.
We use this characteristic function to encode
which equations, if any, will be applied at the grid point with
indices $ \lb j,k \rb $.

%\clearpage
\begin{figure}
   \caption{ The 2D computational domain.}
\begin{flushleft}
In this figure, interior points are labeled with the $\bullet$ symbol, points
where the Robin boundary condition will be applied are indicated by
the $\bigcirc$ symbol, and points not in the computational domain are referenced
by the $\cdot$ symbol
\end{flushleft}
   \label {fig:lattice}
   \centerline{\psfig{figure=lattice.ps}}
\end{figure}
%\clearpage

\subsection[Smoothing]{Smoothing}
\label{Ismoothing}
We use red-black Gauss-Seidel relaxation to smooth 
the residuals of the interior equations shown in the algorithm given in 
Figure~\ref{alg6.7.1}. 

The boundary smoothing is much more complicated than the interior smoothing. 
We only relax the boundary to first order, but care must be taken to determine
which stencils are used on the boundaries.  We pre-compute the stencils and
their coefficients  to ensure boundary smoothing remains inexpensive compared
to interior smoothing.
We now describe the boundary smoothing in several stages.
\footnote{At this point, we must define what we mean by the term ``boundary
point''.  We define a boundary point as a point on the lattice in
which we will impose the boundary condition.   This point is in general
{\em not } on the physical boundary, but rather $O \lb h \rb $ away from the boundary.} 

Once we have determined $\CHAR \lb j,k \rb $  we can precompute
the coefficients for the various boundary stencils.  
We finite-difference the boundary
equation to first order using
\begin{eqnarray}
\frac{n_x~\SFJ}{h} \lb  u [ j + \SFJ, k ]  -  u [j , k]\rb +
\frac{n_y~\SFK}{h} \lb  u [j, k + \SFK ]  -  u [ j , k ] \rb
\end{eqnarray}
where $\SFJ$~and~$\SFK$~are either 1 or -1 depending upon if forward or backward
differencing was used and
\begin{eqnarray}
 n_x &\equiv& \frac{x-c_x}{r} \nonumber \\ 
 n_y &\equiv& \frac{y-c_y}{r} . 
\end{eqnarray}
We then store the coefficients of the stencil
in arrays $\CJ$~and~$\CK$, defined by
\begin{eqnarray}
\CJ &=& \frac{n_x~\SFJ}{h} \nonumber \\
\CK &=& \frac{n_y~\SFK}{h} .
\end{eqnarray}
The other variables which we will store are:  $\PIL$, the number of
points on the boundary, $\XB \lb \PIL \rb $, the indices $j$ where $\CHAR \lb j,k \rb =2$, and
$\YB \lb \PIL \rb $, the indices $k$ where $\CHAR \lb j,k \rb =2$. 

There are 4 first order stencils, shown in Figure~\ref{fig:6.7.2}, along
with a five point stencil with the points being labeled as a,b,c and d. 
Since there is at least one point in the five point stencil not in the
computational domain for the points surrounding the boundary,
we will use the algorithm shown in Figure~\ref{alg6.7.2} 
to determine which points will be used for the first order stencil. 

\begin{figure} 
\caption{ A view of the four first order stencils and a five point stencil.}
\label{fig:6.7.2}
%\vskip 1in
\begin{center}
\input{f672.tex}
\end{center}
%\vskip 1in
\end{figure}


After we determine the lists containing the $x$ and $y$ indices of the 
boundary points ($\XB$ and $\YB$), we define three additional arrays,
\LISTX($\PIL$)~,~\LISTY($\PIL$)~and
~$\THETA \lb \PIL \rb $~, which define the location of the 
physical boundary which is nearest to the various 
boundary grid points. Specifically:
\begin{eqnarray}
\THETA \lb \PIL \rb  &=& \arctan \lb \frac{  y \lb \YB \lb \PIL \rb - c_y \rb }
                            {x \lb \XB \lb \PIL \rb - c_x \rb } \rb \nonumber \\
\LISTX \lb \PIL \rb  &=& c_x + a~\cos \lb \THETA \lb \PIL \rb  \rb  \nonumber \\
\LISTY \lb \PIL \rb  &=& c_y + a~\sin \lb \THETA  \lb \PIL \rb  \rb  .
\end{eqnarray}

After these arrays are defined, they are then sorted in order of ascending 
$\THETA \lb \PIL \rb $ and then we compute $x$ and $y$ components of the 
normals to the boundary using:
\begin{eqnarray}
n_x \lb \PIL \rb &=& \frac{\LISTX \lb \PIL \rb - c_x }{a} \nonumber \\
n_y \lb \PIL \rb &=& \frac{\LISTY \lb \PIL \rb - c_y }{a} \nonumber.
\end{eqnarray}
At this point, $\CJ$~and$~\CK$, the  coefficients of the stencils where the
boundary equation will be applied, can be determined.

The smoothing is now simply defined by the algorithm in Figure~\ref{alg6.7.3}.
We see here that we also store an array for the values of  $u$ along 
the boundary.
This is done purely for ease of programming.

\clearpage
\begin{figure}
\caption{ The interior smoothing algorithm used in 2D}
\label{alg6.7.1}
{\small
\begin{tabbing}
\T {\tt PROCEDURE RELAX\_INTERIOR( $u$ , $f$ , $h$ ,~\CHAR~) } \\ 
\T\T{\sl This routine will smooth the interior points via Red-Black Gauss-Seidel}\\
\T\T{\tt points = 0 \quad {\sl Keep track of the number of points smoothed on this grid}}\\
\T\T{\tt $jacel = - 4 h^{-2} $ \quad {\sl Pre-compute  the Jacobian of the system}}\\
\T\T{\tt koff = 1  \quad {\sl Variable used for Red-Black Smoothing} }\\
\T\T{\tt \DO~checker\_board = 1 , 2 \quad {\sl Loop over the Red and Black points}}\\
\T\T\T{\tt joff = koff \quad {\sl Variable used for Red-Black Smoothing} }\\
\T\T\T{\tt \DO~k = 2,ny - 1 \quad{\sl Loop over all the ponts on the k axis}}\\
\T\T\T\T{\tt \DO~j = ioff+1 , nx -1 , 2 } \\
\T\T\T\T\T{\tt $rresl = h^{-2} \Lc  u [j+1,k]+ u[j-1,k]+
                              u[j,k+1] + u[j , k-1] -$}\\
\T\T\T\T\T\T\T\T{\tt $ 4~u[j,k] - f[j,k] \Rc  $}\\
\T\T\T\T\T{\tt $u [j,k]:= u[j,k] - \CHAR(j,k) \lb rresl jacel^{-1} \rb $}  \\
\T\T\T\T\T{\sl Only change the points where~$\CHAR(j,k)=1$}\\ 
\T\T\T\T\T{\tt $ r[j,k] = \CHAR(j,k) \lb rresl \rb$ }\\
\T\T\T\T\T{\sl Define the running residual at this point}\\
\T\T\T\T{\tt \ENDDO}\\
\T\T\T\T{\tt joff = 3 - joff }\\ 
\T\T\T{\tt \ENDDO} \\
\T\T\T{\tt koff = 3 - koff }\\
\T\T{\tt \ENDDO} \\
\T{ \tt END PROCEDURE }
\end{tabbing}
}
\end{figure}

\begin{figure}
\caption{ The algorithm which determines the stencil to use.}
\label{alg6.7.2}
{\footnotesize
\begin{tabbing}
\T {\tt PROCEDURE DETERMINE\_STENCIL( $\PIL$, $\SFJ$, $\SFK$ , $j$,  $k$, \CHAR ,}\\
\T\T\T\T\T\T\T\T\T\T\T\T{ $x$, $y$, $c_x$, $c_y$ ) }\\
\T\T{\tt $a = \CHAR(j-1,k)$ , $b = \CHAR(j+1,k)$ } \\
\T\T{\tt $c = \CHAR(j,k-1)$ , $d = \CHAR(j-1,k+1)$} \\
\T\T{\tt $\IF \lb \lb  a = 0 \rb AND \lb c = 0 \rb \rb $ \THEN}\\
\T\T\T{\tt  $\SFJ( \PIL ) = 1$ , $\SFK( \PIL ) = 1$}\\ 
\T\T{\tt $\ELSE~\IF \lb \lb  a = 0 \rb AND \lb d = 0 \rb \rb $ \THEN}\\
\T\T\T{\tt  $\SFJ( \PIL ) = 1$ , $\SFK( \PIL ) = -1$}\\ 
\T\T{\tt $\ELSE~\IF \lb \lb  b = 0 \rb AND \lb c = 0 \rb \rb $ \THEN}\\
\T\T\T{\tt  $\SFJ( \PIL ) = -1$,  $\SFK( \PIL ) =  1$ }\\ 
\T\T{\tt $\ELSE~\IF \lb \lb  b = 0 \rb AND \lb d = 0 \rb \rb $ \THEN}\\
\T\T\T{\tt  $\SFJ( \PIL ) = -1$, $\SFK( \PIL ) = -1$ }\\ 
\T\T{\tt $\ELSE~\IF  \lb  a = 0 \rb $\THEN }\\
\T\T\T{\tt $r1 = \lb x \lb j \rb  - c_x \rb^2 + \lb  y \lb k + 1  \rb  - c_y \rb ^2 $, $r2= \lb x \lb j \rb  - c_x \rb^2 + \lb  y \lb k - 1 \rb  - c_y \rb ^2 $}\\ 
\T\T\T{\tt $\IF \lb  r1 \geq r2 \rb \THEN $}\\
\T\T\T\T{\tt  $\SFJ( \PIL ) = 1$ ,  $\SFK( \PIL ) = 1$ }\\ 
\T\T\T{\tt \ELSE } \\
\T\T\T\T{\tt  $\SFJ( \PIL ) = 1$ ,  $\SFK( \PIL ) = -1$ }\\
\T\T\T{\tt \ENDIF} \\
\T\T{\tt $\ELSE~\IF  \lb  b = 0 \rb \THEN $}\\
\T\T\T{\tt $r1 = \lb x \lb j \rb  - c_x \rb^2 + \lb  y \lb k + 1  \rb  - c_y \rb ^2 $, $r2= \lb x \lb j \rb  - c_x \rb^2 + \lb  y \lb k - 1 \rb  - c_y \rb ^2 $}\\ 
\T\T\T{\tt $\IF \lb  r1 \geq r2 \rb \THEN $}\\
\T\T\T\T{\tt  $\SFJ( \PIL ) =-1$ , $\SFK( \PIL ) = 1$}\\ 
\T\T\T{\tt \ELSE } \\
\T\T\T\T{\tt  $\SFJ( \PIL ) =-1$ , $\SFK( \PIL ) = -1$}\\
\T\T\T{\tt \ENDIF} \\
\T\T{\tt $\ELSE~\IF  \lb  c = 0 \rb \THEN $}\\
\T\T\T{\tt $r1 = \lb x \lb j+1 \rb  - c_x \rb^2 + \lb  y \lb k \rb  - c_y \rb ^2 $, $r2= \lb x \lb j - 1  \rb  - c_x \rb^2 + \lb  y \lb k  \rb  - c_y \rb ^2 $}\\
\T\T\T{\tt $\IF \lb  r1 \geq r2 \rb \THEN $}\\
\T\T\T\T{\tt  $\SFJ( \PIL ) = 1$ , $\SFK( \PIL ) = 1$}\\
\T\T\T{\tt \ELSE } \\
\T\T\T\T{\tt  $\SFJ( \PIL ) =-1$ , $\SFK( \PIL ) =  1$}\\
\T\T\T{\tt \ENDIF} \\
\T\T{\tt \ELSE} \\
\T\T\T{\tt $r1 = \lb x  \lb j + 1 \rb  - c_x \rb^2 + \lb  y \lb k \rb  - c_y \rb^2 $, $r2= \lb x \lb j - 1 \rb  - c_x \rb^2 + \lb  y \lb k  \rb  - c_y \rb ^2 $}\\
\T\T\T{\tt $\IF \lb  r1 \geq r2 \rb \THEN $}\\
\T\T\T\T{\tt  $\SFJ( \PIL ) =  1$ , $\SFK( \PIL ) = -1$}\\
\T\T\T{\tt \ELSE } \\
\T\T\T\T{\tt  $\SFJ( \PIL ) = -1$ , $\SFK( \PIL ) = -1$}\\
\T\T\T{\tt \ENDIF} \\
\T\T{\tt \ENDIF}\\
\T{ \tt END PROCEDURE }
\end{tabbing}
}
\end{figure}

\begin{figure}
\caption{ The algorithm to smooth the boundary equations}
\label{alg6.7.3}
{\small
\begin{tabbing}
\T {\tt PROCEDURE RELAX\_BOUNDARY( $u$ ,$g$, $\PIL$ ,~$\XB$~,~$\YB$~,~$\CJ,~\CK$~,}\\
\T\T\T\T\T\T\T\T\T\T\T{$\SFJ$~,~$SFK$ )}\\
\T\T{\tt $\DO i = 1,\PIL $}\\
\T\T\T{\tt $j = \XB \lb i \rb $}\\
\T\T\T{\tt $k = \YB \lb i \rb $}\\
\T\T\T{\tt $ub [i ]= g [ j,k ] - \CJ~u [ j + \SFJ \lb i \rb ,k ] +
        \CK~u [ j , k + \SFK \lb i \rb  ]$}\\
\T\T\T{\tt $ u[j , k] = ub [ i ] $}\\
\T\T{\ENDDO}\\
\T{ \tt END PROCEDURE }
\end{tabbing}
}
\end{figure}
\clearpage

\subsection[Transfer operators]{Transfer operators}
\label{2DTransfers}
We use the following interior restriction and prolongation
operators:
\begin{eqnarray}
u^H[J,K]&=&\REST u^h[j,k] \nonumber \\
&=& \frac{1}{8} \lb u^h[j-1,k]+u^h[j+1,k]+u^h[j,k-1]+u^h[j,k+1] \rb \nonumber \\
&+& \HALF   u^h[j,k] \nonumber
\end{eqnarray}
and
\begin {eqnarray}
u^h[j,k]    &= &u^H_{J,K} \nonumber \\
u^h[j+1,k]  &=& \HALF \lb  u^H[J,K) + u^H[J+1,K] \rb \nonumber \\
u^h[j,k+1] &=& \HALF \lb u^H[J,K) + u^H[J,K+1] \rb \nonumber \\
u^h[j+1,k+1] &=& \QUARTER \Lc u^H[J,K] + u^H[J+1,K] \nonumber \\
             &+& u^H[J,K+1] + u^H[J+1,K+1] \Rc  \nonumber .
\end{eqnarray}

Conceptually the boundary transfers are much more difficult, since 
there is generally no regular relationship between the (deemed) boundary
points on successive levels of discretization.
Figure~\ref{fig:geometry} shows the computational geometry of a two level
structure.
The finer mesh is displayed with squares whereas the coarser mesh is
displayed with circles.  We apply boundary conditions at the open 
circles and squares.

There is a problem in using straightforward multigrid ideas on such domains
since there is no natural two-to-one relationship between the coarse
and fine points. However, if we view the boundary points as actually 
coinciding with the physical boundary, we can think of the boundary 
transfers in terms of prolongations and restrictions along the 
$\theta$ direction.  The transfers become easy to formulate 
in terms of appropriate interpolations (generally linear) in the 
$\theta$ direction. 
For example, the  restriction operator is:
\begin{eqnarray}
\REST u_b^h(l) = u_b^H \lb  L \rb &=& u_b^h \lb l_2 \rb \frac{\THETA^h \lb l_1 \rb
                                 - \THETA^H \lb L \rb }
                                {\THETA^h \lb l_1 \rb  - \THETA^h \lb l_2 \rb }\nonumber \\
                &+& u_b^h \lb l_1 \rb \frac{\THETA^h \lb l_2 \rb
                                 - \THETA^H \lb L \rb }
                                {\THETA^h \lb l_1 \rb  - \THETA^h \lb l_2 \rb }
\end{eqnarray}
where $l_1$ and $l_2$ are the indices of the two fine-grid points which
are closest to the coarse grid point with index $L$. (Note that here 
the superscripts on the $\THETA$ array indicate with which grid the array 
is associated.)

Prolongation is defined in an analogous fashion: the roles of the 
fine and coarse grids are simply reversed:
\begin{eqnarray}
\PRO u^H_b(L) = u_b^h \lb  l \rb &=& u_b^H \lb L_2 \rb \frac{\THETA^H \lb L_1 \rb
                                 - \THETA^h \lb l \rb }
                                {\THETA^H \lb L_1 \rb  - \THETA^H \lb L_2 \rb } \nonumber \\
                &+& u_b^H \lb L_1 \rb \frac{\THETA^H \lb L_2 \rb
                                 - \THETA^h \lb l \rb }
                                {\THETA^H \lb L_1 \rb  - \THETA^H \lb L_2 \rb }
\end{eqnarray}
Here, $L_1$ and $L_2$ are the indices of the two coarse-grid points 
which lie nearest to the fine grid point with index $l$.
We do not claim that these operators define the best transfers for our 
model problem but we have found them to be adequate for our purposes.

Again, to minimize computational time we 
precompute the coefficients  needed for the transfer operators. 
 
\clearpage
\begin{figure} [p]
   \caption{ A close up view of the geometry of two levels.}
\begin{flushleft}
 The finer level is shown with squares, and the coarser 
level is referenced with 
circles.  The points which are not filled in are the ones where the
boundary equation will be applied.  Notice that the 2 grids do not
align with each other.
\end{flushleft}
   \label {fig:geometry}
   \centerline{\psfig{figure=geometry.ps}}
\end{figure}
\clearpage


\subsection[Deferred correction for 2D code]{Deferred correction for 2D code}
\label{DC2D}
As usual we will generally use fourth-order deferred correction.
To compute an appropriate
fourth order stencil, we use the routines described in section(~\ref{IntExtrapHO}). 

We have found that by using deferred correction to fourth order, we
sometimes slow the convergence rate down by almost 50\%.  
We must spend more time to fix this potential problem.

\subsection[The algorithm]{The algorithm}
\label{2dalg}
Figures~(\ref{alg6.7.4})  and (\ref{alg6.7.5}) define the 
complete algorithm whose components
have been described above.
These routines use stacks to implement general $\mu$ cycles.
To learn about stacks, we recommend the literature by Knuth\cite{Knuth}.
The routine {\tt pushlevel}, pushes pending 
commands, such as {\tt relax}, plus level information
onto a single stack which is used on all levels.
{\tt querylevel}
checks the top of the stack to see which command should be executed, 
and at
which level. Once a command has been completed, {\tt poplevel() } is
invoked to delete the corresponding entry from the top of the stack.

The {\tt upstroke} command determines $\tau^H_h$ and then adds it to
$f^H$ and $g^H$. Similarly the {\tt downstroke} command determines
a prolonged
correction after a coarse grid correction and adds it to $u^h$.  The
deferred correction scheme is implemented in the {\tt upstroke} routine
and makes use of the {\tt EVAL\_MATRIX} routine 
to compute the high order interpolant 
described in chapter 3. The variable {\tt nwcyc} is a parameter
which encodes which type of $\mu$-cycle is to be used.
For example, $V$- and $W$-cycles are performed for the 
cases ${\tt nwcyc}=1$ and ${\tt nwcyc}=2$, respectively.
Another aspect of this algorithm which distinguishes it from
our previous multigrid 
algorithms  is that we differentiate between the number of times
we will smooth on the finest levels, (\PREF\ and  \PSTF),  and on all
other levels, ( \PRE\ and  \PST). 
Finally, {\tt bsweeps} defines the number of times we relax the 
boundary per interior sweep.
 

\clearpage
\begin{figure} [p]
\caption{ The 2D MG algorithm }
\label{alg6.7.4}
{\small
\begin{tabbing}
\T {\tt PROCEDURE MG2D\_HOLE(~$\LMAX$~,~\NCYC~,~nwcyc,~\ORDER~,~\PREF,~\PSTF~,}\\
\T\T\T\T\T\T\T\T\T {\tt \PRE~,~\PST~,~\BSWEEPS~)} \\
\T\T{\sl Set up memory initially on all levels }\\
\T\T{\tt \DO lev = $\LCOARSE$, $\LMAX$ \quad {\sl Loop over all the levels}}\\
\T\T\T{\tt GET\_CHAR( nx(lev) , ny(lev) , \CHAR ,$\PIL$) }\\ 
\T\T\T{\sl  Loop over all the points  where \CHAR=2 and get the stencil coefficients.}\\
\T\T\T{\tt $\PIL(lev)$ = 0 , \quad {\sl Set the number of points on the boundary=0}}\\
\T\T\T{\tt \DO k = 1 , ny(lev) }\\
\T\T\T\T{\tt \DO j = 1 , nx(lev) }\\
\T\T\T\T\T{\tt \IF ( \CHAR(j,k) = 2 ) \THEN}\\
\T\T\T\T\T\T{\tt $\PIL$(lev) = $\PIL$(lev) + 1}\\
\T\T\T\T\T\T{\tt DETERMINE\_STENCIL( )}\\
\T\T\T\T\T\T{\tt $\XB(\PIL(lev)) = j$ }\\
\T\T\T\T\T\T{\tt $\YB(\PIL(lev)) = k$ }\\
\T\T\T\T\T\T{\tt GET\_LISTS( ) }\\ 
\T\T\T\T\T\T{\tt GET\_NORMALS( )}\\ 
\T\T\T\T\T\T{\tt GET\_BOUNDARY\_COEFF( )}\\
\T\T\T\T\T{\tt \ENDIF} \\
\T\T\T\T{\tt \ENDDO} \\
\T\T\T{\tt \ENDDO}\\
\T\T\T{\sl Sort the precomputed lists in ascending order in $\THETA$ }\\
\T\T\T{\sl Now compute the deferred correction LUD matrix}\\
\T\T\T{\tt DEF\_MATRIX( )}\\
\T\T{\tt \ENDDO} \\
\T\T{\sl Now compute boundary transfer coefficient}\\ 
\T\T{\tt \DO lev = $\LCOARSE$, $\LMAX$ \quad {\sl Loop over all the levels}}\\
\T\T\T{\tt GET\_RESTRICTION( $\THETA(lev-1)$,$\THETA(lev)$, $\THETAONER$ , $\THETATWOR$)} \\
\T\T\T{\tt GET\_PROLONGATION( $\THETA(lev+1)$,$\THETA(lev)$, $\THETAONEP$ ,$\THETATWOP$)} \\
\T\T{\tt \ENDDO}\\
\T\T{\tt Now start to do a FMG cycle }\\
\T\T {\sl Now solve the system on the coarsest level } \\
\T\T{ \tt SOLVE($L^H u^H = f^H$, and $B^H_1 u^H = g^H$ } \\
\T\T{\tt \tt \DO lev = $\LCOARSE+1$, $\LMAX$ } \\
\T\T{\sl Use linear prolongation to prolong $u^H$ to $u^h$ }\\
\T\T{\tt PROLONG( $u^h := \II^h_H (u^H) $ )}\\
\T\T\T{\tt CYCLE( )}\\
\T\T{\tt \tt \ENDDO }\\
\T {\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
\clearpage
\begin{figure} [p]
\caption{ The $\mu$ cycle algorithm, with the implementation of stacks} 
\label{alg6.7.5}
{\small                                                     
\begin{tabbing}
\T {\tt PROCEDURE CYCLE( )}\\
\T {\tt this routine uses stacks which determine the commands to issue}\\
\T\T {\tt $\LEVEL$~:=~$\LMAX$}                                         \\
\T\T {\tt pushlevel($\LEVEL$,ncyc,pre,pst,$\LMAX$)}                     \\
\T\T {\tt START:~~continue                 }                     \\
\T\T\T {\tt s~:=~querylevel($\LEVEL$,swptype)    }                     \\
\T\T\T {\tt if ( s= 0)      goto DONE       }                     \\
\T\T\T {\tt case ( swptype=pre)             }                     \\
\T\T\T\T {\tt r~:=~relax($\LEVEL$)               }                     \\
\T\T\T\T {\tt poplevel()                    }                     \\
\T\T\T {\tt case ( swptype=pst)             }                     \\
\T\T\T\T {\tt r~:=~relax($\LEVEL$)               }                     \\
\T\T\T\T {\tt poplevel()                    }                     \\
\T\T\T {\tt case ( swptype=solve)           }                     \\
\T\T\T\T {\tt call solve($\LEVEL$)               }                     \\
\T\T\T\T {\tt poplevel()                    }                     \\
\T\T\T {\tt case ( swptype=upstroke)        }                     \\
\T\T\T\T {\tt call upstroke($\LEVEL$)            }                     \\
\T\T\T\T {\tt poplevel()                    }                     \\
\T\T\T\T {\tt $\LEVEL$ = $\LEVEL$ - 1                 }                     \\
\T\T\T\T {\tt pushlevel($\LEVEL$,nwcyc,pre,pst,$\LMAX$)  }              \\
\T\T\T {\tt case ( swptype=downstroke)      }                     \\
\T\T\T\T {\tt call downstroke($\LEVEL$)          }                     \\
\T\T\T\T {\tt poplevel()                    }                     \\
\T\T\T\T {\tt $\LEVEL$ = $\LEVEL$ + 1                 }                     \\
\T\T\T {\tt goto START                      }                     \\
\T\T {\tt DONE: continue                    }                     \\
\T {\tt END PROCEDURE}
\end{tabbing}
}
\end{figure}
\clearpage

\subsection[Results]{ Results}
\label{RESULTS2D}
We first present convergence rates for a variety of tests which clearly
show that we can effectively use the multigrid algorithm with non-trivial
({\sl i.e.} non-conforming) boundaries. We then perform additional tests to
demonstrate convergence and the use of deferred correction.

Our first test applies the multigrid algorithm described above to a 
5-level approximation of equation~(\ref{2deqns}), 
with $c_x = c_y = 0$, $a=1$.
The finest level has roughly $257 \times 257$ points and we use
a variety of $\mu$ cycles. Table~\ref{table6.7.1} 
summarizes the results of this first set of experiments
in which we examine the convergence rate as a function of
{\tt nwcyc}, \PREF, \PSTF, \PRE, \PST,and \BSWEEPS.
For each run we were able to get the $\LONE$ norm of the residuals
below 1.0e-06. 
The best convergence rate, which is highlighted with boldface in the table, is
approximately -2.0e-01, which means that for every 5 relaxation sweeps
the $\LONE$ norm of the residuals are reduced by one order of magnitude.
This is slightly slower than typical model problems which have 
been discussed in the literature\cite{Brandt1982}.\footnote{Such applications 
generally have convergence rates around \hbox{{\rm -3.3e-01}}.}

We then solve a 6-level system and perform the same parameter-space 
survey. Table~\ref{table6.7.2} shows the convergence rate, $\rho$, for 
this series of tests.
We observe only a
slight decrease in the convergence rate from the 5-level runs.
We also see that the optimal parameter settings are the same in the 
two cases.

Fixing the input parameters to their empirically determined values,
we now investigate if the convergence rates remain approximately 
constant as we vary $\LMAX$. Table~\ref{table6.7.3} shows that 
the convergence rate {\em does\/} remain approximately 
constant. This clearly shows that the code converges in $O\lb 1 \rb $ 
cycles (or, equivalently, $O \lb 1 \rb $ work units).

We now examine the impact of fourth-order deferred correction on the 
convergence rate (Table~\ref{table6.7.4}). We see that for the 
5-level runs summarized in the table, the best input parameters 
are just slightly different from the uncorrected case.  Relative
to the uncorrected runs, the convergence rate goes down by a factor
of $2 \sim 3$, but remains relatively constant.  These runs 
show that the residual norm is reduced by one order of magnitude 
for every 12 or so sweeps.  This may be seem like poor performance 
by traditional multigrid standards, and there is clearly room 
for improvement. However, as we now discuss,
the performance of the code with respect to the 
reduction of the {\em error} in the difference solution is actually
quite good.

In Figure~\ref{fig:mattgeom} we schematically depict a 2 level system where we
also show some boundary reference points.  In order to fully test to
see if the results are extrapolatable, we interpolate
the solutions to fourth order,
onto  reference  points, which are uniformly displaced around the
boundary, as shown in the figure. 

Figure~\ref{fig:6.7.log1} shows the errors on several levels computed 
from runs with and without deferred correction.
The coarse-grid and fine-grid results are shown with large  and small
symbols respectively.
Squares are used for the uncorrected run and open circles for the 
corrected run.  The solid circles show errors in the Richardson
extrapolated results produced by application of equation~(\ref{richex}),
\begin{eqnarray}
\frac{4}{3} \, u^{h} - \frac{1}{3} \, u^{2h} = u + O \lb h^4 \rb ,
\end{eqnarray}
to the two levels of corrected quantities. 
The graph clearly hows that deferred correction
(1) reduces the overall error in the ``raw'' solution, and (2) produces 
values which are extrapolatable. In particular, these results 
show that with about twice the amount of work the error in
the fine grid values (after extrapolation) is reduced by almost 
three orders of magnitude!

Thus, although more study is needed in order to improve the overall
convergence rate, 
we have clearly demonstrated that we can obtain highly accurate results
on non-trivial domains (and using non-conforming
coordinates), using multigrid as our elliptic solver.

%\clearpage
\begin{table}
\begin{caption}
  { Results from the 2D FMG FAS algorithm with $a=1$, when we vary the input parameters} 
  \label{table6.7.1}
\end{caption}
\begin{center}
  { Deferred correction not used, $\XMAX=\YMAX=2.4$, 5 level system}
\end{center}
\centering
{ \small
\begin{tabular}{ccccccc} \hline \hline
{\tt nwcyc}  & \PREF & \PSTF & \PRE  & \PST  & \BSWEEPS & $\rho$       \\ \hline
1       &   1   &   1   &   1   &   1   &    1     & -2.0(-1)  \\
{\bf 1} &{\bf 2}&{\bf 1}&{\bf 1}&{\bf 1}&{\bf 1}&{\bf -2.0(-1)}\\
1       &   3   &   1   &   1   &   1   &    1     & -2.0(-1)  \\ 
1       &   4   &   1   &   1   &   1   &    1     & -1.9(-1)  \\ 
1       &   1   &   2   &   1   &   1   &    1     & -1.6(-1)  \\
1       &   1   &   3   &   1   &   1   &    1     & -1.3(-1)  \\
1       &   1   &   4   &   1   &   1   &    1     & -1.0(-1)  \\
1       &   1   &   1   &   2   &   1   &    1     & -1.8(-1)  \\
1       &   1   &   1   &   3   &   1   &    1     & -1.5(-1)  \\
1       &   1   &   1   &   4   &   1   &    1     & -1.4(-1)  \\
1       &   1   &   1   &   1   &   2   &    1     & -1.7(-1)  \\
1       &   1   &   1   &   1   &   3   &    1     & -1.5(-1)  \\
1       &   1   &   1   &   1   &   4   &    1     & -1.3(-1)  \\
1       &   2   &   1   &   1   &   1   &    2     & -2.0(-1)  \\
2       &   2   &   1   &   1   &   1   &    2     & -1.7(-1)  \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
 {Results from the 2D FMG FAS algorithm with $a=1$, and no deferred correctiond}
  \label{table6.7.2}
\end{caption}
\begin{center}
  { $\XMAX=\YMAX=2.4$, 6 level system}
\end{center}
\centering
{ \small
\begin{tabular}{ccccccc} \hline \hline
{\tt nwcyc}  & \PREF & \PSTF & \PRE  & \PST  & \BSWEEPS & $\rho$       \\ \hline
1       &   1   &   1   &   1   &   1   &    1     & -1.6(-1)  \\
{\bf 1} &{\bf 2}&{\bf 1}&{\bf 1}&{\bf 1}&{\bf 1}&{\bf -1.8(-1)}\\
1       &   3   &   1   &   1   &   1   &    1     & -1.7(-1)  \\ 
1       &   4   &   1   &   1   &   1   &    1     & -1.6(-1)  \\ 
1       &   1   &   2   &   1   &   1   &    1     & -1.4(-1)  \\
1       &   1   &   3   &   1   &   1   &    1     & -1.1(-1)  \\
1       &   1   &   4   &   1   &   1   &    1     & -8.9(-2)  \\
1       &   1   &   1   &   2   &   1   &    1     & -1.4(-1)  \\
1       &   1   &   1   &   3   &   1   &    1     & -1.3(-1)  \\
1       &   1   &   1   &   4   &   1   &    1     & -1.1(-1)  \\
1       &   1   &   1   &   1   &   2   &    1     & -1.4(-1)  \\
1       &   1   &   1   &   1   &   3   &    1     & -1.3(-1)  \\
1       &   1   &   1   &   1   &   4   &    1     & -1.1(-1)  \\
1       &   2   &   1   &   1   &   1   &    2     & -1.7(-1)  \\
2       &   2   &   1   &   1   &   1   &    2     & -1.4(-1)  \\ \hline \hline
\end{tabular}
}
\end{table}
 
\begin{table}
\begin{caption}
  {Results from the 2D FMG FAS algorithm with $a=1$}
  \label{table6.7.3}
\end{caption}
\begin{center}
  { Deferred correction not used, $\XMAX=\YMAX=2.4$}
\end{center}
\centering
{ \small
\begin{tabular}{cc} \hline \hline
$\LMAX$ & $\rho$ \\ \hline
2     & -2.9(-1) \\
3     & -2.9(-1) \\
4     & -2.0(-1) \\
5     & -2.0(-1) \\
6     & -1.8(-1) \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\begin{caption}
  {Results from the  2D FMG FAS algorithm with $a=1$}
  \label{table6.7.4}
\end{caption}
\begin{center}
  { Deferred correction not used, $\XMAX=\YMAX=2.4$, 5 level system}
\end{center}
\centering
{ \small
\begin{tabular}{ccccccc} \hline \hline
{\tt nwcyc}  & \PREF & \PSTF & \PRE  & \PST  & \BSWEEPS & $\rho$       \\ \hline
1       &   1   &   1   &   1   &   1   &    1     & -5.9(-2)  \\
1       &   2   &   1   &   1   &   1   &    1     & -4.9(-2)  \\
1       &   3   &   1   &   1   &   1   &    1     & -4.8(-2)  \\
1       &   4   &   1   &   1   &   1   &    1     & -4.8(-2)  \\
1       &   1   &   2   &   1   &   1   &    1     & -7.2(-2)  \\
1       &   1   &   3   &   1   &   1   &    1     & -5.2(-2)  \\
1       &   1   &   4   &   1   &   1   &    1     & -4.1(-2)  \\
1       &   1   &   1   &   2   &   1   &    1     & -5.4(-2)  \\
1       &   1   &   1   &   3   &   1   &    1     & -4.7(-2)  \\
1       &   1   &   1   &   4   &   1   &    1     & -4.1(-2)  \\
1       &   1   &   1   &   1   &   2   &    1     & -5.3(-2)  \\
1       &   1   &   1   &   1   &   3   &    1     & -4.7(-2)  \\
1       &   1   &   1   &   1   &   4   &    1     & -4.2(-2)  \\
1       &   1   &   1   &   1   &   1   &    2     & -6.5(-2)  \\ 
1       &   1   &   1   &   1   &   1   &    3     & -6.5(-2)  \\
{\bf 1} &{\bf 1}&{\bf 2}&{\bf 1}&{\bf 1}&{\bf 2}   &{\bf  -7.2(-2)}\\ \hline \hline

\end{tabular}
}
\end{table}
\begin{table}
\begin{caption}
  {Results from the 2D FMG FAS algorithm with $a=1$ using deferred correction to fourth order}
  \label{table6.7.5}
\end{caption}
\begin{center}
  {$\XMAX=\YMAX=2.4$}
\end{center}
\centering
{ \small
\begin{tabular}{cc} \hline \hline
$\LMAX$ & $\rho$ \\ \hline
3     & -1.0(-1) \\
4     & -9.1(-2) \\
5     & -7.2(-2) \\
6     & -8.2(-2) \\ \hline \hline
\end{tabular}
}
\end{table}


\clearpage

\begin{figure} [p]
   \caption{ 2D domain showing 2 levels, and the reference points.}
   \label {fig:mattgeom}
   \centerline{\psfig{figure=matt_geom.ps}}
\end{figure}


\begin{figure} [p]
   \caption{The absolute value of the errors on the interpolated points. } 
   \label {fig:6.7.log1}
   \centerline{\psfig{figure=6.7.err.ps}}
\end{figure}

%\clearpage

%**************************************************************************
\cleardoublepage
%**************************************************************************
\chapter[Conclusion]{Conclusion}
In this chapter we summarize the results and conclusions of this
dissertation. We also briefly outline possible future research
based on the work  we have presented here.

Our goal was to design a computer code which
would be fast and accurate for solving the Initial Value Problem (IVP)
in three dimensions using Cartesian coordinates.  In 
Chapter~\ref{The-Initial-Value-Problem-for-2-black-holes}
we saw how the Einstein equations can be considered as 
evolution  equations and initial value constraint equations.  Later we saw
the initial value constraint equations were elliptic equations with Robin
boundary conditions.  Now
the goal of this dissertation was to design an algorithm
to solve this elliptic PDE, to fourth order accuracy,
using the MLAT techniques, and Richardson extrapolation.   

We have yet to implement a code which
uses all of the tools we presented here to solve the IVP.  We did, however,
generate reasonably accurate data sets
 using {\tt genpsi}, shown in Chapter~\ref{GENPSI},
 which was originally developed
as a test-bed for the design of a multigrid code which would solve
the same equations. We showed in Chapter~\ref{GENPSI} that although we
were only able to get first order accurate solutions, our solutions were
still accurate enough to represent the initial data. 
We also presented results from another test code, which was able to produce 
fourth order extrapolatable results for a model problem.
Thus, the  two goals we set for ourselves
was first to design a code that would be extrapolatable such that the solution
would be accurate to fourth order, and second, to design a code that would
take $O(1)$ work units. 
Since we have non-boundary conforming meshes,  both of these goals were
difficult to achieve.

The first problem that we encountered was in implementing both the inner
and outer boundary conditions.  Here we found that in order to investigate
the problem in detail, it was advantageous to consider one
dimensional model problems, which will
hopefully generalize for the multidimensional cases.  The next problem
we encountered was in implementing a Berger and Oliger\cite{BergerOliger}
adaptive scheme.
We used Choptuik's memory storage scheme and tree links to design
the data structures that we will use in our final code.  We also saw
the problem of using AMR and attempting to extrapolate.  We saw that 
straightforward applications of
the basic MLAT algorithm\cite{Brandt1982} the solution will only be first order accurate. 
Therefore,
we empirically found a scheme which produced extrapolatable results. This
scheme smoothed the relative truncation error estimate across the interfaces.
We found that by using this scheme we could always achieve fourth order results
from Richardson extrapolating the solutions.  Another problem we
saw was that grids became uncontained from their parents, since the finer
grids would be closer to the actual boundaries.  Since the points inside
of the holes are not defined in the computational domain, we saw that
the finer grids approached the boundaries closer than the coarse grids. We 
empirically determined transfer operators which allowed the convergence
rate to remain constant.  We also applied the blended boundary 
condition, which may prove to be useful for multi-dimensional codes.

Our last problem in designing such a code was to implement
the multigrid algorithm for non-aligned grids.  We saw earlier
that, by determining the proper boundary smoothing operators and transfers,
we were able to develop a multigrid code which could be extrapolatable
via deferred correction.  We saw that deferred correction is an
extremely powerful tool, which we plan to use in the future for all of
our elliptic multigrid algorithms .


The work for the future is to incorporate the ideas in this dissertation
into a general 3D multigrid code.  At this point  we would be able to 
determine the solution of the IVP up to the same order of accuracy
as the boundary fitted  \v{C}ade\v{z} coordinate multigrid code developed
by Cook.  Our plans are then to apply our knowledge in handling the 
boundaries to the evolution code.  We also plan on implementing general
3D multigrid codes which could be used to determine the initial conditions
for multiple black holes. Since other elliptic equations arise in the
evolution equations, we are also planning to develop MLAT solvers for these
equations

\appendix
%**************************************************************************
\cleardoublepage
%**************************************************************************
\chapter[1D parallel multigrid implementation]{1D parallel multigrid implementation}
Here we explore the parallelization of a one dimensional multi-grid
algorithm on an Intel IPSC hypercube with 32 processors\cite{McBryan}.
We find that our algorithm is scalable\footnote{
A scalable algorithm is one which  time $\sim$ $p^{-1}$, where $p$ is the
number of processors.},
and is implemented much like
that of the serial algorithm, shown in chapter(~\ref{MLAT}). 
Our technique is to use all the available
processors on levels which have over 129 points. 
 When the total number of points in the domain is less than this
number, we switch to letting the entire problem be solved on
all processors identically. We find that if we do not use this technique, the
algorithm becomes non-scalable, and in fact, the time required to solve the
system begins to increase as the number of processors is increased.  We feel
that the techniques utilized in our algorithm can be directly applied to the
higher dimensional cases.  This code was written by this author and
Reid Guenther\cite{Guenther} for a class by R. Van de Geign.  

Since multigrid is the best method for solving elliptic systems, it is quite
clear that one needs to establish a
parallel algorithm for this method, since we will
in general be handling very large systems of equations.
In this appendix we
only look at one dimensional methods, since we feel that the knowledge gained
here will go into the much larger effort of designing a three dimensional
method.

Much work has been done already, but mostly in higher dimensions.  For example
, one of the NAS benchmarks\footnote{ A common benchmark program used today
to rate the performance of computers} is for a two dimensional multigrid code.
It is
quite clear that from all of the NAS benchmarks, that multigrid is
the fastest method
to solve elliptic equations, (even though this method will never
achieve the FLOPS of some of the other methods).

\section{Target architectures}
\label{TA}
We implement this algorithm
on a hypercube consisting of $2^D \lb D = 0 \cdots 5 \rb $.
independent processors, each with its own local memory.  There is no
shared memory available- the processors cooperate by message passing.
Messages are passed over the interconnection network which is a hypercube
in a space of dimension $D$.  Processors are located at the vertices of the
$D$-dimensional hypercube and adjacent vertices of the cube are connected
by a communication channel along the corresponding edge\cite{McBryan}.

Our parallel implementation of the one dimensional multigrid method assumes the
use of a one dimensional mesh with $2^D$ nodes, where each node is a 
separate processor.  We also assume that there are
bidirectional links between nodes and worm-hole (cut-through) routing.
Furthermore, since we are performing message passing only between nearest
neighbors on the hypercube, we assume it is possible
to model the time required for sending a message of length
$ n $ bytes between any
two nodes by
\[
\alpha + n \beta
\]
where $\alpha$ equals the latency of the network, and
$ \beta $ is the time per item,
in the absence of network conflicts\cite{VanPR}.
Communication is single ported, meaning a processor can
only send to, or receive from, one other node at a given time.
When two messages traverse the same physical link, we assume
they time-share the bandwidth of that link.

\subsection[Description of the basic parallel algorithm]{Description of the basic parallel algorithm}
\label{DOTBPA}
There are only two basic changes to the serial code shown in 
Figure~\ref{alg4.4}.
 One is that the physical
1D mesh is broken up onto the computational ring of nodes with adjacent
parts of the mesh lying on adjacent nodes. 
Now, for the problem we are solving, a
given physical point will need information from
its left and right neighbors.  Thus
the left and right most mesh points on a node will need information from their
physical neighbor on the adjacent node.  So we use shadow points to
communicate between nodes:

In Figure~\ref{shadow}, we show part of the physical mesh mapped onto
two adjacent
physical computational nodes.  Point $x$ is a ``shadow point'' for
node $m$ while
point $x-1$ is a shadow point for node $m+1$.
Node $m$ will use the information
inherent at point $x$ to update information at point $x-1$
but not update point $x$,
while the opposite is true on node $m+1$.  So when the information at $x-1$ and
$x$ are updated by their respective nodes, this data is communicated to the
adjacent
node and stored at the shadow points on each node.  So given that we have
$2^l+1$ mesh points on $2^D$ nodes, we divide the mesh in this manner in the
figure below,
with the left and right most mesh point on a node being a shadow point for that
node except for mesh points $1$ and $2^l + 1$ which are physical boundary
points.

\begin{figure}[h]
\begin{tabular}{ll}
      node 0 gets mesh points     &    $2^{D-l}$ +1 \\
      node 1 gets mesh points     &    $2^{D-l}$ -- $2^{D-l+1}$ +1 \\
      .                           &    . \\
      .                           &    . \\
      .                           &    . \\
      node $2^{D-1}$ gets mesh points & $2^{l-1}$ -- $2^{l}$ +1 \\
\end{tabular}
\end{figure}


\begin{figure}
   \caption{  A schematic of two nodes, sharing the ``shadow'' points}
   \label {shadow}
   \centerline{\psfig{figure=node.ps}}
\end{figure}


 The second difference between the serial and parallel codes involves
communication versus computation time.  In the V-cycles of the parallel
multigrid code computations are being performed at different levels $l$ which
involve $O \lb 2^{l-D} \rb $ computations while communication between nodes remains
constant at each level in the V-cycle.  Thus, there will be a level below
 which the
communication time will be longer than the computation time.  Around this level,
we have the parallel code finish the lower part of the V-cycle in serial
fashion.  This is probably best understood by going through the pseudo-code
shown in figures~(\ref{algpar}, \ref{algpar2}).

We see in the algorithms that in going up 
to the coarsest level in the V-cycle routine,
there is a level $\LMID$ at which all nodes begin solving the problem
in serial fashion.  Thus no communication is needed between nodes for these
levels.
Then cycling from the coarse grid up to the
 finest grid,  the routine goes back to
parallel.  Since $\LMID$ is an adjustable parameter
we can experiment to see which is 
the best level to implement the transition from a parallel to a serial code
and vice versa. 

The other difference in this code and the serial code is the updating of the
shadow points. As one sees from the pseudo-code this is done
only in the smoothing 
and restriction routines.  Thus the differences between our parallel 1-D
multigrid code and the serial code are cosmetically simple but produce some very
encouraging results which will be discussed in Section~\ref{ER}.

\subsection{Discussion of improvements that yield high performance}
\label{DIYHPP}
Since our parallel code utilizes the same multigrid routines
as the serial code except for the
updating of shadow points in the smooth and restriction routines,
it is highly vectorized.   The updating of shadow points uses the
basic {\tt csend} and {\tt crecv} routines on the iPSC/860 which we
assume are efficient routines.(
We also implemented level 4 optimization on the iPSC
and received a 30\% speed up.)

One problem with our code is the global collect we use to transfer the
problem from parallel mode to serial mode. On
the hypercube,  the ring is embedded using a Gray code while the global collect
routine is for a hypercube.  So two more {\tt csend} and {\tt crecv}
calls are needed to have a
global collect for a ring.  We used the iCC\cite{VandeGeign} call
for the global collect, but
a collect optimized  for a ring embedded on the hypercube should be
much faster.  This is not a 
serious problem as the collect occurs only once in the cycle.

\subsection{Estimated run time and scalability}
\label{ERTS}
The time for the serial multigrid code to perform a V-cycle on the problem:
\begin{eqnarray}
\label{PB}
\frac{\partial^2 u \lb x \rb  }{\partial x^2} = f \lb x \rb , \ \ \ 0<x<1
\end{eqnarray}
with Dirichlet boundary conditions on a mesh with $2^{\LMAX}+1$ points is about:
\begin{eqnarray}
\label{TS}
T_s =  \lb C_{DN}+C_{UP} \rb \gamma \sum_{n=1}^{\LMAX} 2^n\simeq \lb C_{DN} + C_{UP} \rb 
\gamma 2^{\LMAX+1}
\end{eqnarray}
where $\gamma$ is the time for an add or multiply, $C_{DN}$ is the number of
calculations in the down part of a V-cycle at each level and $C_{UP}$ is
defined similarly.  This number is calculated simply by examining the
code for how many
adds and multiplies must be performed. The time for the parallel code to perform
one cycle of the same problem on $2^D$ nodes is:
\begin{eqnarray}
\label{TP}
T_p =  \lb {\tt pre}+3 \rb \lb \LMAX-\LMID \rb M_D \lb \alpha+8\beta \rb  \cr
+\sum_{n=\LMID+1}^{\LMAX} C_{DN} 2^{n-D}\gamma + \sum_{n=1}^{\LMID}C_{DN}
2^n\gamma \cr
+ \lb {\tt pst} +1 \rb  \lb  \LMAX-\LMID+1 \rb M_D \lb  \alpha+8\beta \rb \cr
+\sum_{m=\LMID}^{\LMAX}C_{UP}2^{n-D}\gamma+\sum_{n=1}^{\LMID-1}C_{UP}2^n\gamma
\end{eqnarray}
where $\LMAX$, $\gamma$, $C_{up}$ and $C_{DN}$ are
the same as above, $\alpha$ and
$\beta$ are defined in Section~\ref{TA},
 $\LMID$ is the level at which the problem
switches from parallel to serial mode, $M_D$ is the number of message passing startups a node must perform in the red-black smoothing routine and is
2 for $D=1$, because each node only has one shadow point, and 4 for
$D>1$, $pre$ is the number of pre-sweeps of the smoother and $pst$ is the
number of post-sweeps of the smoother.  Equation~(\ref{TP}) is more complicated
than~(\ref{TS}) because it involves message passing and a transition between
running in parallel and serially.  The first line of the equation gives the
time for the message passing in cycling down the V.  The second line is the time split between running in parallel from level $\LMAX$ to $\LMID$ and 
serially down to $\LMID$.  The third and fourth lines are similar to the first
two but involve going up the V-cycle.

The best way to compare how well a parallel code performs compared to a serial
code is to calculate the efficiency,  which is just the time
it takes serial code
to run divided by the time it takes the parallel code to run divided by the
number of nodes on which the parallel code runs.  Thus, due to the overhead 
of message passing, the efficiency will lie between
0 and 1. 
For $\PRE=\PST=2$, 
$${{\alpha+8\beta}\over{\gamma}}\simeq 1000$$,
 $M_D=4$, $C_{DN} = 55$ and $C_{UP}=37$, the
efficiency of the code is:
\begin{eqnarray}
\label{EF}
E &\equiv&{ {T_s}\over{2^DT_p} } \nonumber \\ &\simeq&
\frac{1}{ 1 +{{140}\over{184}}\left(229 \lb \LMAX-\LMID \rb  +
2^{\LMID}\right)2^{D-\LMAX}}
\end{eqnarray}
This calculation appears to be very encouraging since as $\LMAX$ increases, the
efficiency goes to 1.  The term in parenthesis shows that $\LMID$ should remain
constant as $\LMAX$ grows to maintain efficiency since $2^{\LMID}$ grows much
faster than $\lb  \LMAX-\LMID \rb $ when increasing $\LMID$ and $\LMAX$ by the same
increment.  Another good feature is that to maintain efficiency when increasing
the number of nodes the problem size should grow proportionally.  Thus the
code should be scalable.

\section{Experimental results}
\label{ER}
Given the time constraints on this project, only a rudimentary analysis of the
code has been performed.
Our first result was a comparison of run time versus $\LMID$ for a given problem
($\LMAX=14$,~$\PRE=\PST=2$ on 8 nodes).
As one sees in Table~\ref{tab1},
the times have a minimum for
$\LMID=7$.  This is to be expected since a conflict occurs between
when communication time overtakes computation time and how much
extra computation must be done in serial fashion. So one would expect to find a
level $\LMID$  at which the run time is minimized.

Table~\ref{tab2} gives an indication of the scalability
and efficiency of this code for (
$\LMID=7$) at various maximum levels and cube dimensions.
Our results of the previous section
predicted that $\LMAX$ should scale proportionally
 to $D$ to maintain scalability.
As one sees by looking diagonally
down the chart, the problem does
not scale very well when $\LMAX$ is small, but as $\LMAX$ increases,
the experimental results comply with the calculated results given in the above
section.  One thing to note is the jump in times as one moves from $D=1$ to
$D=2$ and increment $\LMAX$ by 1 for the lower $\LMAX$s.
There is a consistent decrease that goes down
by less than a factor of 2.  This is because the number of communications is
doubling when one moves form 2 nodes to 4 due to each node having
 only one shadow
point for 2 nodes while the interior nodes have 2 shadow points for 4 nodes and
more.
Table~\ref{tab2} also gives an indication of the efficiency of this code.
When $\LMAX$ is small, the efficiency is not very good but as $\LMAX$ increases,
one sees that $T_p\simeq 2^{D}T_s$ as predicted above.

\section{Conclusion}
Our results are very encouraging.  We have a parallel one dimensional multigrid
code that is scalable for large problems. Thus
we will try to implement the knowledge gained here into a multi-dimensional
parallel multi-grid code that will be used directly in our research. This
should not be as straight forward as writing the one dimensional code since
the message passing to shadow points will no longer be a
constant.  We expect that we will have to have multiple levels in our cycling
at which we reduce the number of nodes running different parts of the problem
to keep the amount of message passing below the amount
of computation on a given level.

\begin{figure}
\caption{The parallel V-cycle algorithm}
\label{algpar}
{\small
\begin{tabbing}
\T {\tt PROCEDURE VCycle( \CYCLE, $\LMAX$, $\LMID$, \PRE, \PST ) } \\
\T\T { \sl Cycle up to the coarsest level } \\
\T\T { \tt \DO $l$ = $\LMAX$ , $\LCOARSE+1$ } \\
\T\T\T {\tt $\IF \lb l = \LMID \rb \THEN $} \\
\T\T\T\T { \sl Begin serial processing on all nodes} \\
\T\T\T {\tt $\IF \lb l \not= \LMAX \rb \OR  \lb \CYCLE = 1 \rb \THEN $} \\
\T\T\T\T {\tt DO p = 1 , pre } \\
\T\T\T\T\T{ \tt SMOOTH($l$) } \\
\T\T\T\T {\tt \ENDDO} \\
\T\T\T {\tt \ENDIF } \\
\T\T\T { \sl Now get a truncation error estimate, and update $f^H$ } \\
\T\T { \tt \ENDDO } \\
\T\T {\sl Now solve the system on the coarsest level } \\
\T\T{ \tt SOLVE($\LCOARSE$) } \\
\T\T {\tt  DO  $l$ = $\LCOARSE$ , $\LMAX - 1$} \\
\T\T\T {\tt $\IF \lb l = \LMID \rb \THEN $} \\
\T\T\T\T { \sl Begin parallel processing} \\
\T\T\T { \sl Determine the correction } \\
\T\T\T { \tt $ u^h := u^h + \PRO\lb u^H - \REST u^h \rb $ } \\
\T\T\T { \sl Now smooth out $u^h$ } \\
\T\T\T {\tt \DO~q = 1 , pst } \\
\T\T\T\T{ \tt SMOOTH($l$) } \\
\T\T\T {\tt \ENDDO} \\
\T\T{ \tt \ENDDO} \\
\T{ \tt END PROCEDURE } \\
\end{tabbing}
}
\end{figure}

\begin{figure}
\caption{The parallel smoothing algorithm}
\label{algpar2}
{\small
\begin{tabbing}
\T {\tt PROCEDURE SMOOTH($\LEVEL$) } \\
\T\T{\sl First smooth the even points} \\
\T\T{\tt \DO j = 2 , n-1 , 2 } \\
\T\T\T{\tt $ u[j] := 1 / 2  \lb u[j+1] + u[j-1] - h^2 f[j] \rb$ } \\
\T\T\T{\sl update shadow points} \\
\T\T{\tt \ENDDO } \\
\T\T{\sl Now smooth the odd points} \\
\T\T{\tt \DO j = 3 , n-1 , 2 } \\
\T\T\T{\tt $ u[j] := 1 / 2 \lb u[j+1] + u[i-1] - h^2 f[j] \rb $ } \\
\T\T\T{\sl update shadow points} \\
\T\T{\tt \ENDDO } \\
\T{ \tt END PROCEDURE } \\
\end{tabbing}
}
\end{figure}


\begin{table}
\caption{No optimization, cube dimension =3}
\label{tab1}
\centerline{Variation of {\tt $\LMID$} for {\tt $\LMAX=14$} }
\centering
{\small
\begin{tabular}{cc}   \hline\hline
$\LMID$& time (s) \\ \hline
  4   &  9.2(-2) \\
  5   &  8.9(-2) \\
  6   &  8.6(-2) \\
  7   &  8.4(-2) \\
  8   &  8.5(-2) \\
  9   &  8.8(-2) \\
 10   &  9.7(-2) \\
 11   &  1.20(-1) \\
 12   &  1.7(-1) \\ \hline \hline
\end{tabular}
}
\end{table}

\begin{table}
\caption{ No optimization, $\LMID= 7$}
\label{tab2}
\begin{center}
Scalability of 1D Multigrid Code
normalized for smallest time = 1.0, Normalization factor = $\hbox{{\rm 7.626e-03}}^{-1}$
\end{center}
\centering
{\small
\begin{tabular}{ccccccc}   \hline\hline
$l$& {0 } & {1}  & {2}  & {3} & {4} & {5} \\ \hline
 8   &  1   & 1.68 & 2.06 & 2.23& 2.03&     \\
 9   &  1.93 & 2.49  & 2.84  & 2.85 & 2.53  &     \\
10    &  3.87 & 3.77  & 3.78  & 3.63 & 3.24 &      \\
11    &  7.75 & 6.12  & 5.27  & 4.54 & 3.95 &      \\
12   & 15.52 &10.35  & 7.74  & 6.09 & 5.04  & 4.60 \\
13   & 30.97 &18.42  &11.95  & 8.38 & 6.51  & 5.83 \\
14   & 61.95 &34.34  &20.23  &12.85 & 8.92  & 7.06 \\
15   &123.83 &65.64  &36.21  &21.05 &13.22  & 9.17 \\
16   &247.44 &128.02 &67.53  &37.00 &21.39  & 13.81 \\
17   &494.88* &252.29 &129.96 &68.32 &37.20 & 21.94 \\
18   &989.76*&       &253.86 &130.74&68.25  & 37.63 \\
19   &1979.52*&       &       &254.92&131.05& 68.35 \\
20   &3959.04*&       &       &      &252.56&131.85 \\
21   &7918.08*&       &       &      &      &253.08 \\ \hline \hline
\end{tabular}
}
\end{table}

\cleardoublepage

\begin{thebibliography}{99}
\bibitem{ADM} R. Arnowitt, S. Deser, and C. W. Misner, in {\em Gravitation- An Introduction to Current Research } edited by L. Witten (Wiley, New York, 1962).
\bibitem{BergerOliger} M.J. Berger, and J. Oliger, J. Comput. Phys. {\bf 53} 484 (1984).
\bibitem{BergerRigoutsos} M.J. Berger, and I. Rigoutsos, IEEE Trans. on systems, man, and cybernetics {\bf 21} 1278 (1991).
\bibitem{Bowen1979b} J. M. Bowen, General Relativity and Gravitation {\bf 11} 227 (1979).
\bibitem{Bowen1979} J.M. Bowen, Ph.D. dissertation, University of North Carolina at Chapel Hill, (1979).
\bibitem{Bowen1982} J. M. Bowen, General Relativity and Gravitation {\bf 14} 1183 (1982).
\bibitem{BowenYork} J. M. Bowen, and J. W. York, Jr., Phys. Rev. D {\bf 21} 2047 (1980).
\bibitem{Brandt1977}A. Brandt, Math. Comput. {\bf 31},333 (1977).
\bibitem{Brandt1982} A. Brandt, in {\em Lecture Notes in Mathematics: Multi Grid Methods}, Vol. 960, W. Hackbusch and U. Trottenberg, eds. (Springer Verlag, New York). 
\bibitem{Briggs} W. Briggs, in {\em A Multigrid Tutorial}, ( Society for Industrial and Applied Mathematics) Philadelphia, 1987.
\bibitem{Choptuik1991} M.W. Choptuik, Phys. Rev. D. {\bf 44} 3124 (1991).
\bibitem{ChoptuikGRG} M. W. Choptuik, and W. G. Unruh, General Relativity and Gravitation {\bf 18} 813 (1986).  %
\bibitem{ChoptuikGoldwirth} M. W. Choptuik, D. S. Goldwirth, and T. Piran, Classical and Quantum Gravity {\bf 9} 721 (1992).
\bibitem{ChoptuikPR} M.W. Choptuik, Personal communication.
\bibitem{Choptuik_masters} M.W. Choptuik, M. Sc. Thesis, University of British Columbia, (1982).
\bibitem{Choptuikad} M. W. Choptuik, in {\em {\tt ad} An Implementation of the Berger-Oliger Mesh Refinement Algorithm for the Wave Equation in Spherical Symmetry} (1994).
\bibitem{Choquet} B. Choquet and J. W. York, Jr., in {Einstein Centenary Volume I} edited by A. Held (Plenum, New York, 1980).
\bibitem{Cook1989} G. B. Cook, in {\em Frontiers in Numerical Relativity} edited by C. R. Evans, L.S. Finn and D. W. Hobill ( Cambridge University Press, England, 1989).
\bibitem{Cook1991} G. B. Cook, Phys. Rev. D {\bf 44} 2983 (1991).

\bibitem{CookKlasky} G.B. Cook, M.W. Choptuik, M. R. Dubal, S.A. Klasky, R. A. Matzner,and S.R. Oliveria, Phys. Rev. D {\bf 47}, 1471 (1993).
\bibitem{Cook_York1990} G.B. Cook and J. W. York Jr., Phys. Rev. D {\bf 41} 1077 (1990).
\bibitem{Cookphd} G. B. Cook, Ph.D. dissertation, North Carolina at Chapel Hill, (1990).
\bibitem{CookAbrahams} G. B. Cook and A. M. Abrahams, Phys. Rev. D. {\bf 46}
,702 (1992).
\bibitem{Einstein_Rosen} A. Einstein and N. Rosen, Phys. Rev.{\bf 78} 73 (1935).
\bibitem{Eppley1975} K. R. Eppley, Ph.D. dissertation, Princeton University, (1975).
\bibitem{Evans} C. R. Evans, L. S. Finn, and D. W. Hobill, in {\em Frontiers in
Numerical Relativity} ( Cambridge University Press, England, 1989).
\bibitem{George1973} J.A. George, SIAM Journal of Numerical Analysis {\bf 10} 345 (1973).
\bibitem{George1981} J.A. George and J. W. Liu, {\em Computer Solution of
Large Sparse Positive Definite Systems.} ( Prentice-Hall, N.J., 1981). 
\bibitem{Guenther} R. L Guenther and S. A. Klasky, {\em A Parallel Implementation of Multi-Grid in one dimension} ( Site report, 1994). 
\bibitem{Hahn_Lindquist} S. Hahn, and R. Lindquist, Ann. Phys., {\bf 29} 304 (1964).
\bibitem{Huq} M. Huq Personal communication.
\bibitem{Knuth} D.E. Knuth, {\em The art of computer programming} (Addison Wesley, Mass., 1968).
\bibitem{Kulkarni1983} A.D. Kulkarnia, L.C. Shepley, and J. W. York, Jr., Phys.
Lett. A {\bf 96} 228 (1983).
\bibitem{Kulkarni} A.D. Kulkarni,  Ph.D. dissertation, University of Texas at Austin,
(1984).
\bibitem{Lichnerowicz} A. Lichnerowicz, J. Math. {\bf 23} 37 (1944).
\bibitem{MTW} C.W. Misner, K. S. Thorne, and J.A. Wheeler, {\em Gravitation} ( W. H. Freeman, San Francisco,  1973).
\bibitem{Matzner} R. A. Matzner,  Personal Code .
\bibitem{McBryan} O. A. McBryan and E. F. Van de Velde, in {\em  Lecture Notes in Mathematics: Multi Grid Methods II}, Vol 1228, W. Hackbusch and U. Trottenberg, eds. (Springer Verlag, New York,1985).
\bibitem{MISNER} C. W. Misner, Ann. Phys. (N.Y.) {\bf 24}, 102 (1963).
\bibitem{MittchelGriffiths} A. R. Mitchell, and D.F. Griffiths, in {\em The finite difference method in partial differential equations} (Wiley, Chichester, 1980).
\bibitem{Numerical-Recipes} W. H. Press, b. P. Flannery, S. A. Teukolsky, and W. T. Vetterling, {\em Numerical Recipes: The Art of Scientific Computing} ( Cambridge University Press, Cambridge, England, 1986).
\bibitem{RUEDEPR} U. \"Ruede, Personal communication.
\bibitem{Rauber1986} J. D. Rauber in {\em Dynamical Spacetimes and Numerical Relativity} edited by J.M. Centrella ( Cambridge University Press, England, 1986).
\bibitem{Richardson} L. F. Richardson, Philos. Trans. R. Soc. {\bf 210} 307 (1910).
\bibitem{Ruede} S. McCormick and U. R\"{u}de, International Journal of High Speed Computing {\bf 2} 311 (1990).
\bibitem{Smarr1975} L. L. Smarr, Ph.D. dissertation, University of Texas at Austin, (1975).
\bibitem{Thornburg1987} J. Thornburg, Classical and Quantum Gravity, {\bf 4} 1119 (1987).
\bibitem{Thorne} K. S. Thorne, in {\em Second Texas Symposium on 3D Numerical Relativity} edited by R. A. Matzner 1991.
\bibitem{Towns} J. Towns,  Personal communication.
\bibitem{Varga} R.S. Varga, {\em Matrix Iterative Analysis} (Prentice-Hall, Englewood Cliffs, NJ, 1962).
\bibitem{VandeGeign} M. Barnett, L. Shuler, R. Van de Gein, S. Gupta, D. G. Payne, J. Watts, in {\em Interprocessor Collective Communication Library } 1994. 
\bibitem{VanPR} R. Van de Gein, Personal communication. 
\bibitem{Wald} R. M. Wald, {\em General Relativity} ( University of Chicago Press, Chicago Ill,1984).
\bibitem{Weinberg} S. Weinberg, {\em Gravitation, and Cosmology: Principles and
Applications of the General Theory of Relativity} ( Wiley and Sons, New York, 1972).
\bibitem{York1984} J. W. York, Jr., Physica A {\bf 124}, 629 (1984).
\bibitem{YorkPiran} J. W. York, Jr., and T. Piran, in {\em The Initial Value Problem and Beyond} ( University of Texas Press, Austin, TX., 1982).
\bibitem{York} J. W. York, Jr. in {\em Sources of Gravitational Radiation} edited by L.L. Smarr (Cambridge University Press, Cambridge, England, 1979).
\bibitem{Young} D.M. Young, {\em Iterative solution of large linear systems} ( Academic Press, New York, (1971).
\end{thebibliography}

\vita
Scott Alan Klasky was born in Philadelphia, Pennsylvania on the 15th of
June, 1966, the son of Charles and Mary Klasky. The author completed his
high school work at Lower Moreland High School, PA.~in
1984. He entered Drexel University in 1984 and
received his B.S. in physics in 1989. During this time, the author worked
as a research assistant at Princeton Plasma Physics Laboratory.
In September of 1989 he entered
the Graduate School of The University of Texas at Austin. From 1989 to
1994 he was a member of the Center for Relativity at The University of
 Texas at Austin. The author is
getting married to Jennifer Patton on August 20, 1994. Directly after the
honeymoon, in August 1994, the author will be employed as
a Postdoctoral Fellow at The University of Texas at Austin. 

Permanent address: 10926 Jollyville Rd. \#1124 Austin, Texas 78759.

This dissertation was typed in \LaTeX by the author.

\end{document}
