Rochester Institute of Technology
RIT Scholar Works
Theses
Thesis/Dissertation Collections
2005
An Evaluation Of A Multigrid Algorithm Error
Spike Correction Method
Erika L. McMichael
Follow this and additional works at:
http://scholarworks.rit.edu/theses
This Thesis is brought to you for free and open access by the Thesis/Dissertation Collections at RIT Scholar Works. It has been accepted for inclusion
in Theses by an authorized administrator of RIT Scholar Works. For more information, please contact
Recommended Citation
An Evaluation Of A Multigrid Algorithm Error
Spike Correction Method
by
Erika L. McMichael
A
Thesis Submitted
in
Partial Fulfillment
of the
Requirements for the Degree
of
Master
of Science
in Mechanical Engineering
Approved
By:
Dr.
Amitabha
Ghosh
Department
of Mechanical
Engineering
Dr.
Ali
Ogut
Department
of Mechanical
Engineering
Dr. P. Venkataraman
Department of
Mechanical
Engineering
Dr
.
Edward
C.
Hensel
Mechanical
Engineering Department Head
Department
of
Mechanical Engineering
Rochester Institute
of
Technology
Thesis Release Permission Form
Rochester Institute of Technology
Kate Gleason College of Engineering
Title: An Evaluation Of A Multigrid Algorithm Error Spike Correction
Method
I, Erika L. McMichael, hereby grant permission to the Wallace Memorial Library to
reproduce my thesis in whole or in part. Any reproduction will not be for commercial
use or profit.
Erika
L.
McMichael
Erika L. McMichael
Copyright
2005
by
Erika L. McMichael
Acknowledgments
I
wishto
thank
my advisor,
Dr.
Ghosh,
for his
guidance and supportin
completing
Abstract
This
study
is
an evaluation of a method ofimproving
the
multigrid processby
correcting
error spikes which are generated whenmoving
from
a coarserto
finer level.
The
correction method wastested
on nine one-dimensional problems governedby
second orderdifferential
equations.Tests
were performed with anaccomodative,
full
approximationscheme,
full
multi-grid algorithm.Results indicate
that
appropriateimplementation
ofthe
correction canincrease
solution
accuracy.Accuracy
wasincreased
in
75%
of casesin
which a single correction was appliedto
a pointin the
central portion ofthe
grid.Single
corrections performedon points with error greater
than the
average error were effective86%
ofthe
time.
Contents
Acknowledgments
iv
Abstract
v1
Introduction
1
2
Computational Fluid Dynamics
3
3
Multigrid
6
3.1
Basic Multigrid Process
7
3.2
Multigrid
Algorithms
7
4
Multigrid Program
9
4.1
Basic
Elements
9
4.2
User Inputs
10
4.3
Structure
10
4.4
Convergence
Testing
11
4.5
Program
Outputs
12
4.6
Program
Efficiency
12
5
Correction
Method
14
5.1
Description
ofCorrection
14
5.2
Correction
Processing
Time
16
6
Problems
17
7
Methods
19
8
Results
andDiscussion
21
8.1
Error Spike Direction
21
8.3
Point in Multigrid Cycle
25
8.4
Grid Location
27
8.5
Residual Magnitude
28
8.6
Problems
28
8.7
Multiple
Corrections
32
9
Conclusions
33
Bibliography
35
A Multigrid Program
-Fortran 90
Code
36
A.l
Multigrid
-main.for
36
A. 2
Correction
44
A.3
Gauss Seidel
-gs.for
45
A. 4
Prolongation
andRestriction
Operators
- prores.for47
B
Efficiency
Test
Programs
-Fortran 90 Code
49
B.l
Gauss Seidel
Efficiency
Test Program
49
B.2
Correction
Efficiency
Test Program
52
C
Accomodative Algorithm Runs
56
D Multiple
Correction Results
61
List
of
Figures
2.1
Example
grid5
3.1
Error
vs.Grid Point: After initial
guess,
After 1 GS
iteration,
After
4
GS iterations
6
5.1
Problem
5,
Iteration
14.
Residual
vs.Grid Point
(left)
andError
vs.Grid Point
(right)
15
5.2
Problem
5,
Iteration
14.
Error
vs.Grid Point
after replacement ofpoint
5
15
5.3
Error
vs.Grid Point
oneGS
iteration
later
without(left)
and with(right)
correction15
7.1
Generic
multigrid structure20
8.1
Error
vs.Grid
Point,
"Correct" spike(left)
and "Incorrect" spike(right)
22
8.2
Error
vs.Grid
Point, "Partially
Correct" spike22
8.3
Error
plot(top)
and residual plot(bottom)
for Problem
1,
Trial 1
(level
3)
24
8.4
Generic
multigridstructure,
gridlevel
vs. pointin
cycle25
8.5
Change in
error vs. pointin
multigrid cycle26
8.6
Change in final
error vs. correctionlocation
andlevel
27
8.7
Change
in
final
error vs. residual/residual norm29
8.8
Change
in
final
error vs. correctionlocation
and problem30
List
of
Tables
4.1
Size
of computationaldomain
per gridlevel
10
4.2
Number
ofiterations
requiredfor
convergence13
5.1
Work
requiredfor
a correction comparedto
aGauss Seidel iteration.
16
6.1
Problems
17
8.1
Percentage
oftrials
error wasdecreased
orincreased
per error spikedirection
23
8.2
Average
percentage changein
error per error spikedirection
23
8.3
Average
changein
error per gridlevel
24
8.4
Average
percentage changein
error perlocation
in
multigrid cycle. .26
8.5
Number
oftrials
in
whichfinal
error wasincreased
ordecreased
vs.Chapter
1
Introduction
Multigrid is
aniterative
method whichutilizes gridsofmultiple sizesto
reduce error onmultiplewavelengths.
Many
classicaliterative
methods(Gauss
Seidel,
etc.)
efficiently
reduce
the
error ofhigh
frequency
components,
"smoothing"the
error.Multigrid
uses a relaxation schemeto
smooththe
error on severalgridlevels
ofvarying
coarseness.In
this way,
multigrid cangreatly
reducethe time
requiredto
obtain asolution.Brandt
introduced
multigrid methodsin
his 1977
paper[1].
Since
that time
severalbooks
have been
written onthe
topic,
including
[6], [5], [3],
and[4].
In
this study the
multigrid process was examinedgraphically through
plots ofthe
residuals and error after each
iteration in
the
multigrid cycle.From
the
examinationof
these
plotsit became
apparentthat
spikesin
the
residual plots correspondedto
spikes
in the
error plots.It
was also notedthat
error spikes were prevalent whenmoving to
finer
gridlevels.
A
correction methoddesigned
to
mitigatethese
errorspikes
is
described in
this
thesis.
Testing
showedthat the
removal of a single errorspike could
increase the accuracy
ofthe
solution whileonly
minimally
increasing
the
amount ofcomputational work.
To
evaluatethe
effectivenessofthe
correctionmethod,
a multigrid program was written
and nine one-dimensionalproblems weretested.
The
multigrid program utilizedan
accomodative,
full
approximationscheme,
full
multi-grid algorithm(FAS
FMG).
Brandt
provides adetailed description
of an accomodativeFAS FMG
algorithmin
[2].
One-dimensional
problems were usedfor
simplicity.For
consistency, the
problems
evaluated were allsecond orderdifferential
equations.The differential
equationsolutions
include
five
polynomials, three trigonometric
functions,
and one exponentialfunction. The
effects ofseveralindependent
variables(such
as gridlevel,
location
ongrid,
etc.)
on solutionaccuracy
and number ofiterations
requiredfor
convergencewere recordedand are presented
here.
A brief
introduction to
computationalfluid dynamics
(CFD)
is
givenin
Chapter
2
of
this
thesis.
The basic
multigrid processis
outlinedin
Chapter
3,
andthe
multi-grid program used
in
this study
is
described in Chapter 4. Chapter 5 describes
the
implementation. The
problems usedin the study
are presentedin
Chapter
6.
Testing
Chapter
2
Computational Fluid
Dynamics
Many
fluid flow
problems cannotbe
solved analytically.These
problems canbe
solvednumerically using
computationfluid dynamics. Computational fluid dynamics
(CFD)
is
the term
givento
avariety
of numerical mathematicaltechniques
usedto
solvethe
equationsthat
governfluid flows
and aerodynamics.CFD
wasdeveloped in
the
1970s
after
the
introduction
ofhigh
speedcomputers.Because
CFD
solvers use numerical methodsto
obtain asolution, the
regionbeing
analyzed mustbe divided
into
a gridwithdiscrete
grid points.A
numerical solutionis
obtained at each ofthe
grid points.To
useCFD
to
solve aproblem, the
governing
equations mustbe discretized
sothat
the
values ofthe
variables are considered atthe
grid point only.If
there
are n grid points onthe grid,
n algebraic equations aredeveloped
by
discretizing
the governing
differential
equations.Several discretiza
tion
schemes exist.In
this
thesis,
differential
equations werediscretized
using
centraldifferencing
derived
from
the
Taylor
series expansion(5.1),
(5.
2).
Other
types
ofdis
cretizationinclude
forward
andbackward
differencing
as well asforward, backward,
or centraldifferencing
using
alarger
number of grid points(for
examplethree
andfour
pointformulae).
When
a problemis discretized it
changesfrom
adifferential
equationto
a set of algebraic equations.If
the
problemis
nonlinearit
mustbe linearized before it
canbe
solved
using the
methodsdescribed in
this
thesis.
For
simplicity, only
linear
problems arediscussed
in this
thesis.
If
the
set of equationsis
linear it
canbe
representedin
matrixform
as:Au
=f
(2.1)
where,
A is
the
known
coefficientmatrix,
uis
the
vector of ndependent
variables,
and/
is
the
vector ofknown
values.Equation
(2.1)
canbe
solvedusing
direct
oriterative
methods.Direct
methods use afinite
number of operationsto
obtain a solution anditerative
methods use a variable numberofiterations
depending
onthe
accuracy desired.
The
number ofiterations is
controlledby
the stopping criteria,
usually
an average ofthe
residuals(the
difference between
/
andAu
at each point).Seidel iteration is
givenin
equation(4.1).
Boundary
conditions are specified conditions onthe
edgesofthe
domain
which aidin
the
solution of partialdifferential
equations.Common
boundary
conditiontypes
areDirichlet, Neumann,
andCauchy
boundary
conditions.Dirichlet
boundary
conditionsspecify the
values ofthe
function
onthe
boundary.
Neumann
boundary
conditionsspecify the
derivative
ofthe
function
onthe
boundary.
Cauchy boundary
conditionsspecify
a weighted average ofDirichlet
andNeumann
boundary
conditions.When
Neumann
boundary
conditions are specifiedthe
boundary
conditions are part ofthe
computational
domain
(the
computationaldomain is
the
area ofthe
grid wherethe
values of
the
dependent
variable areunknown)
.Boundary
grid points withDirichlet
boundary
conditions are notincluded in
the
computationaldomain.
The
following
exampleillustrates
the
process ofdiscretizing
the
partialdifferential
equation
(2.3)
andexpressing
it in
the
matrixform
Au
=f
(2.6).
The
example appliesthe steady
stateheat
conduction equation(Laplace
equation)
(2.2)
to
a platewith an unknown
temperature
distribution,
known
edgetemperatures,
and noheat
generation.
In
(2.2)
uis
the temperature
(the
dependent variable)
andthe
dimensions
of
the
plate areLx
L. The
temperature
is
constantalong
each edge ofthe
plate.The
temperatures
onthe
edges ofthe
plate arethe
boundary
conditions and aredesignated
Bi, B2, B3,
B4. For
example,
u =B\
at x =0
and u =B2
aty
=L. The
examplehas Dirichlet
boundary
conditions(known
boundary
values)
.The
2-dimensional
platebeing
analyzedis
showndivided into
a gridin
Figure
2.1.
The
distance between
grid pointsin the
x andy
directions
aredenoted
by
Ax
andAy
respectively.In
this
caseAx
=Ay
= ~.There
arefour
pointsin the
computationaldomain
(n
=4)
which arelabeled
u\, u2, u3,
and u^.The
grid coordinates aredenoted
by
{i,j).
d2u
d2u
^
+
^=0<2-2>
Ax2 Ay2
ui+1J
+
Uj_ij
-Auid
+
UiJ+1
+
Ujj-i
=0
(2.4)
Grid
point(f
,^):
u3
+
Bx
-Am
+
B2
+
u2
=0
Grid
point(f
,f
):
u4
+
Bj
-Au2
4-m
+
BA
=0
Grid
point{f,
f):
B3
+
Ul
-Au3
+
B2
+ uA
=0
{Lb)
Grid
point(^,
f
):
B3
+
u2
iY
B,
B,
Ui
u3
u2
u4
B,
[image:15.533.115.319.77.287.2]B.
Figure 2.1: Example
grid.-4
1
1
0
i
B\B2
1
-40
1
u2
SiJ94
1
0
-41
U3
B3
B2
0
1
1
-4Ui
B3
?4
Chapter
3
Multigrid
Multigrid
methods areiterative
methods usedto
solve partialdifferential
equations.Mulitgrid
methods use multiple grids ofvarying
coarsenessto
speedup
convergence.The
two
main components of multigrid methods are errorsmoothing
and coarse gridcorrection.
Each
grid usedin solving the
problemis identified
by
a gridlevel
(for
examplethe
coarsestgrid
is
referredto
aslevel
1).
On
eachgridlevel
the
erroris
"smoothed"
with
the
one or moreiterations
of a relaxation scheme(e.g.
Gauss-Seidel)
.The
relaxationmethods are efficient at
reducing the
error(4.9)
ofhigh
frequency
components.Figure
3.1
showsthe
effects of one andfour Gauss-Seidel iterations
on a onedimensional
problem.
The high
frequency
errors arequickly
resolvedgiving the
plot a smoothappearance.
Figure
3.1:
Error
vs.Grid Point: After initial
guess,
After
1
GS
iteration,
After
4
GS
iterations.
Once
the
error onthe
fine
gridis
smoothedit is
transferred to
a coarser grid.The
error
is
smoothed onthe
coarse grids andthe
coarse grid approximations are usedto
correctthe
finest
grid approximation.Applying
the
relaxation schemeto
grids of [image:16.533.63.471.418.527.2]3.1
Basic Multigrid
Process
This
sectiondescribes
the
multigrid processin very
generalterms.
A detailed
descrip
tion
ofthe
algorithm usedin this study
is
givenin the
next chapter.The discretized
equation
to
be
solvedis
(2.1).
On
the
kth gridlevel
the
discretized
equationis
represented as:
Akuk = fk
(3.1)
Restriction
and prolongation operators are usedto
movebetween
gridlevels.
Re
striction operators are used
to transfer to
coarserlevels
and eitherdirectly
inject
oraverage
fine
grid valuesto
obtain a coarse grid value.Prolongation
operators useinterpolation
to transfer to
finer
grids.The
restriction and prolongation operatorsare
denoted
by
R
andP
respectively.Ruk+1 =
uk
(3.2)
Puk= uk+1
(3.3)
The
first
step
in
the
multigrid processis
presmoothing, the
application of v\iterations
of an appropriate relaxation scheme.
This is
denoted by:
S(uk,Ak,fk,Vl)
(3.4)
The
processthen
movesto
alower
(coarser)
gridlevel.
On
the
lower
gridlevel,
fkis
modified and a relaxation scheme
is implemented
to
approximateuk(3.1).
This
coarsegrid approximation
is
usedto
correctthe
finer
grid approximation.The
value of fkand
the meaning
ofukdepend
onthe
multigrid scheme(see
Coarse Grid
Processing,
below).
The
final
step
ofthe
processis postsmoothing,
relaxation onthe
fine
gridlevel. These
steps canbe
performed multipletimes
onany
number of gridlevels.
3.2
Multigrid
Algorithms
Starting
Point
Full Multi-Grid
(FMG)
algorithmsbegin
onthe
coarsestlevel
and move up.The
coarsest
level
solutionmay
be
obtainedby
relaxation or adirect
method.[2]
Cycling
algorithmsbegin
with an approximation onthe
finest
grid.The
approximation
canbe
trivial,
such as u =Program Progression
An
algorithmis
described
as accomodative orfixed.
Accomodative
algorithms useinternal
checksto
determine
when a switch willbe
madeto
afiner
or coarserlevel.
The
checks areusually
based
on relative magnitudes ofresiduals.Fixed
algorithmshave
nointernal
checks and operatebased
on a predeterminedflow.
Fixed
algorithmsmay
execute morequickly than
accomodative algorithmsbecause
they
do
not requirethe
calculation ofresiduals after eachiteration.
Coarse Grid
Processing
A
multigrid algorithm can usethe
Correction Scheme
orthe
Full
Approximation
Scheme described
in this
section.In
the
Correction Scheme
the
long
wavelengtherrorof
the
fine
grid approximation{uk+1)
is
approximated onthe
coarse gridby
uk.On
the
coarsegrid, the
righthand
side ofequation(3.1)
is
givenby
(3.6),
the
restrictionof
the
fine
grid residual error (rfc+1(3.5)).
To
correctthe
fine
grid approximation{uk+1),
ukis
prolongated and addedto
uk+1(3.7).
[2]
rk+1
= fk+l
-Ak+1uk+1
(3.5)
fk= Rrk+i
(3>6)
E2
=<u
+
Puk(3.7)
In
the
Full
Approximation Scheme
(FAS)
the
coarse grid approximation(uk)
approximates
the
solutionto the
differential
equation onlevel k.
When
transferring
to
acoarser
level
k,
aninitial
value ofukis
the
restriction ofuk+1(3.8).
This
initial
valueis
usedin
the
calculation offk(3.9).
The
fine
gridis
corrected with(3.
10).
[2]
uk
= Ruk+1
(3.8)
fk
= Akuk
+
Rrk+i^
=
uk+}
+
P{uk-Ruktl})
(3.10)
ufe+i
new
The
algorithm usedis
fully
described
by
oneitem
from
each ofthe
abovethree
sections.
The
program usedin
this study
is
anaccomodative,
full
approximationChapter
4
Multigrid Program
A
multigrid programwrittenfor
this study
is described in
this
section.This
programprovided a means of
testing
the
correction method.The
program uses an accomodative
full
approximation schemefull
multi-grid(FAS
FMG)
algorithm.It is
capable ofsolving
onedimensional
problems withDirichlet
boundary
conditions.The
programsource code
is in
Appendix A.
4.1
Basic Elements
Smoothing
Method
The Gauss-Seidel iteration is
usedfor
errorsmoothing
on all gridlevels. For
the
caseof
M
equationsthe
n+
1th round ofGauss-Seidel
iterations
canbe
written as:<+1
=
T
t-1 M
j=l j'=i+l
for
i
=1
to
M
(4.1)
Gauss-Seidel
iterations
are performedby
the
subroutinegs.for,
seeAppendix A.
3.
Prolongation/Restriction
Operators
The
restriction and prolongation operators usedin
gridtransfer
aredefined
by
the
following
equations:Ruj
=-~u2j-i
+
7-U2J
+
~7u2j+iRestriction
(4.2)
Pu2j
=Uj
Pu2j+\
=~{uj
+
Uj+i)
Prolongation
(4.3)
Zi
These
aretaken
from
[6].
Prolongation
and restriction matrices are createdin
the
Coefficient
Matrix
The finest level
coefficient matrixA from
(2.1)
is
providedby
the
user.To
performsmoothing
operations on all gridlevels,
anA
matrixmustbe
obtainedfor
eachlevel.
Here
the
Galerkin
coarse grid approximationis
used:Ak
=
RAk+ip
(44)
4.2
User
Inputs
Seven items
mustbe
suppliedby
the
userfor
the
programto
operate:1.
nm
The
number of grid pointsin
the
computationaldomain
onthe
finest
level
2.
The
exact value ofthe
center point ofthe
computationaldomain
3.
domain
The length
ofthe
grid{xmax
xmin)
A. Dirichlet
boundary
conditions5.
em
Finest level
convergence criteria6.
A
The
coefficientmatrixin
(2.1)
7.
/
The
vectorofknown
valuesin
(2.1)
4.3
Structure
The
numberof gridlevels
m usedin
computationis
calculatedfrom
n, the
sizeofthe
computational
domain
(number
of gridpoints)
onthe
finest level. For
the
programto
function
n mustbe
ableto satisfy
(4.5)
where mis
aninteger.
The
size ofthe
computational
domain
onlevels 1-6 is
shownin Table 4.1.
Level
1
is
the
coarsestlevel.
n =2m
-1
(4.5)
Level
12
3
4
5
6
[image:20.533.189.345.547.620.2]n
1
3
7
15
31
63
The
programbegins
computation onthe
coarsestlevel 1
and worksup to the
finest
level
m.Level 1
consists ofonly three
grid points.The
exact values ofthese three
points are supplied.
The
two
end points arethe
Dirichlet
boundary
conditions.The
center point
is
providedby
the
user.It is
assumedthat
this
point canbe
obtainedthrough
iterative
ordirect
methods.Because
the
valuesofuonlevel 1
[u1)
areknown
this
level is
not revisited.The
prolongation ofu1gives an
initial
estimatefor
u2.One Gauss-Seidel
(GS)
iter
ation
is
then
performed on u2.Convergence
onthe
currentlevel is
then
checked asdescribed
in
section4.4.
If
convergencehas been
obtained onlevel
2 the
programmoves
up to
level 3
(3.10).
If
not,
anotherGS
iteration
is
performed on u2.After
atransfer
is
madeto any
level,
oneGauss-Seidel
iteration
is
performed andboth
convergence and convergence rate are checked asdescribed
in
section4.4.
If
the
convergence onthe
currentlevel has been
obtainedthe
program movesto
afiner
level
(3.10).
Otherwise
if the
relaxation convergence rateis
acceptable,
anotherGS
iteration is
performed onthe
currentlevel. If
the
relaxation convergence rateis
slowthe
program movesto
a coarserlevel
using
(3.8)
-(3.9).
This
procedureis
repeated untilthe
convergence criteria are met onthe
finest
gridlevel.
4.4
Convergence
Testing
After
eachGS
iteration,
the
norm ofthe
residualsek
(4.6)
is
computed and convergence and convergence rate are
tested.
The
convergence criteriafor
the
currentoperation
level is denoted
by
ek.Convergence has been
obtained onthe
currentlevel
if
ek <
ek.Finest level
convergenceem
is
providedby
the
user.Initial
valuesofek
for
all otherlevels
are obtainedfrom
(4.7)
unlessthis
calculatedek
is
smallerthan eTO,
in
which caseek
is
set equalto
em.rv^"fc ,-211/2
ek
=[2^x
'
J
(4.6)
nk
fc
domain
nk
+
1
(4.7)
Equation
4.7
setsek
equalto
the
distance between
grid points squared.Each
time
atransfer
is
madeto
a coarserlevel
ek
is
updated:ek
=0.2efc+1
(4.8)
If
ek
>
fc,
convergence rateis tested.
The
convergence rateis
satisfactory if ek
<
rjek,
wheren=
0.5
andek
holds
previous valuesof ek.If
the
convergencerateis
satisfactory
ek
is
set equalto
ek
{ek
=ek) before
anotherGS
iteration
is
performed.When
a
transfer
is
madeto
a coarserlevel,
ek
is
set equalto the
norm ofthe
residualsimmediately
afterthe transfer
is
made(before
any
GS iterations
are performed).The
value ofek
is
not changedimmediately
after afine
gridtransfer
because
testing
showed
that this
decreased
program efficiency.If
ek > r]ek
the
convergence rateis
slow.This indicates
that the
erroris
smooth andshould
be
approximated on a coarser grid.4.5
Program
Outputs
After
eachGauss Seidel
iteration,
the
errorand residuals ofeachgrid point arewrittento
afile.
The
error referredto
in
this thesis
is
obtainedby
subtracting the
currentvalues
from
the
exact solution(4.9).
Residuals
are calculatedfrom (4.10).
error =
uexact
-u
(4.9)
residuals=
Au
f
(4-10)
4.6
Program
Efficiency
This
program can solve equations much moreefficiently than
a solver which usesstandard
Gauss Seidel iterative
methods.Table
4.2
showsthe
number ofiterations
required
by
the
program outlined above and aGauss Seidel
programto
reachthe
indicated
convergence.The
number ofiterations
requiredfor
the
multigrid programare weighted
to
accountfor
iterations
ondifferent
gridlevels. The
numberindicated
is the
equivalent number offinest level
iterations.
A
singleiteration
onlevel k
requiresthe
same amount of work as 2~(m~fc)iterations
onlevel
m(the
finest
level,
here level
6).
The Gauss Seidel
programis
executed on gridlevel 6
andbegins
with aninitial
guess of u =
0.
Convergence is
reached whenthe
residual norm(4.6)
is
less
than
orProblem
Gauss Seidel
Multigrid
Convergence
Iterations
Iterations
Criteria
1
2522
16.06
1.0E-06
2
1519
12.38
1.0E-06
3
5925
16.94
1.0E-07
4
1756
12.81
1.0E-06
5
2456
20.44
5.0E-08
6
4351
15.69
5.0E-07
7
2748
15.56
7.0E-06
8
2666
14.94
5.0E-07
[image:23.533.142.400.283.440.2]9
1509
13.00
1.0E-06
Chapter
5
Correction Method
5.1
Description
of
Correction
The
proposed correctionimproves efficiency
by
adjusting the
values of grid pointswhere
large
residual spikes occur.The
adjustments are madeimmediately
after prolongation
ofthe
approximate solution whenmoving to
afiner level.
After
the
newfine level
solutionis
obtainedthe
residuals arecalculated.The
value ofthe
point atthe
location
ofthe
absolute maximumresidualis
changed.The
new valueis
obtainedfrom
the
discretized
equation(5.1),
whereUj
is
the
pointthat
is
corrected.:1
Ui =
i-\ M
fi-^2
aiiui
~S
aiiui
j=l J=i+1
for
i
=\
to
M
(5.1)
Only
the
spike which correspondsto the
maximum residualis
corrected.This
caneffectively increase accuracy
and requires aminimalamount of additionalwork.This
type
of correctionworkswell whenmoving to
afine level because
the
erroris
typically
not smooth after prolongation.
This
methodis
effectivein
reducing
errorbecause
residual spikes correspondto
errorspikes.
Figure 5.1
showsthe
plots ofcorresponding
residual and error curves(Problem
5,
Iteration
14).
The
largest
residualis
at pointfive,
Figure
5.2
showsthe
error plot afterthis
pointhas been
replaced.The
new value of point5 is
more accuratethan the
original.After
oneGS iteration
the
effect ofthe
correctionis
still apparent(Figure
5.3).
When
implemented
at appropriatetimes this
correction method can reducethe
error of
the
solution and reducethe
number ofiterations
requiredto
achieve residualconvergence.
The
code usedfor
the
correctionis in
Appendix A. 2.
This
code wasFigure
5.1:
Problem
5,
Iteration
14.
Residual
vs.Grid Point
(left)
andError
vs.Grid Point
(right).
Figure
5.2:
Problem
5,
Iteration
14.
Error
vs.Grid Point
after replacement of point [image:25.533.99.435.88.233.2]5.
Figure 5.3: Error
vs.Grid Point
oneGS iteration later
without(left)
and with(right)
[image:25.533.182.353.288.428.2] [image:25.533.94.434.481.627.2]5.2
Correction
Processing
Time
The
amount oftime
requiredto
perform a single correction was comparedto the
amount of
time
requiredto
perform a singleGauss Seidel
iteration.
If
residuals arecalculated
for
allgridpoints,
one correctiontakes approximately the
same amountoftime to
implement
as oneGauss Seidel iteration
onthe
samelevel. Table 5.1
showsthe
amount of work requiredfor
acorrectionas afraction
of aGauss Seidel
iteration.
One
correction requiresthe
calculation ofresiduals,
a comparison ofthe
residuals(to
determine
the
maximumresidual),
andthe
calculation ofthe
new value ofthe
corrected point.
Two
programs were writtento
comparethe processing time
of aGauss Seidel
iteration to
acorrection,
seeAppendix B. Each
program was runfour
times,
eachtime
with adifferent
number of grid pointvalues.The level
number whichthese
correspondedto
is
shownin
Table
5.1.
The
running time
requiredfor
each program was recorded andis
presentedin
Table
5.1. In
the
table,
'GS
Time'is
the running time
ofthe
Gauss Seidel
program.The
correction program
determines
the
max residual(includes
the
calculation ofresidualsand a comparison of
the
residuals).This
running time
is 'Max Residual
Time'in
Table
5.1.
'Residual/GS'is
the
ratio of'Max Residual
Time'to
'GS Time'.
'New
Value
Calculation' accountsfor
the
calculation ofthe
new value ofthe
correctedpoint.
The
amount of work requiredfor
the
calculation ofthe
new valueis
equalto
a
fraction
of aGauss Seidel
iteration,
l/nk
{nk
is
the
number of grid points onlevel
k). 'Total
Correction/GS'is the
sum ofResidual/GS
andNew Value
Calculation,
it
is
the
amount of work requiredfor
a correction expressed as afraction
of aGauss
Seidel
iteration.
Level
GS Time
(s)
Max Residual Time
(s)
Residual/GS
Calculation
ofNew Value
Total
Correction/GS
6
10.77
18.99
35.03
67.21
8.54
16.01
32.02
60.76
0.79
0.84
0.91
0.90
0.143
0.067
0.032
0.016
0.935
0.910
0.946
0.920
Table
5.1:
Work
requiredfor
a correction comparedto
aGauss Seidel
iteration.
Table
5.1
indicates
that
a single correction requiresapproximately the
same amountof work as one
Gauss
Seidel iteration
onthe
samelevel. This
meansthat
acorrectionperformed on
level 3
willincrease
the total
amount of work requiredto
solve aproblemby
only
0.125
equivalentlevel 6 GS iterations.
Between
12
and21
equivalentlevel
6
GS iterations
were requiredfor
the
solution of each problem(Table
4.2).
Thus,
a [image:26.533.125.410.440.526.2]Chapter
6
Problems
The
correction wastested
onthe
nine problems shownin
Table
6.1
below.
All
aresecond order
differential
equations withDirichlet
boundary
conditions.Problem
Equation
Classification
1
+
3m'+
6m
= 6x5+
27x4+
14x3- 15x2--66x
+
35
hyperbolic
2
u"- Au'
+
2u
= 2x5 - 16x4- 22,-r3+
86x2-36x
-2
hyperbolic
3
u"+
2m'+
3m
=2
sin x+ 2
cosx elliptic4
m"3m
+
m = 8sin3x
9
cos3x
hyperbolic
5
u"+
5'-u =
+ 23x +
45
hyperbolic
6
2m"
-2u'
+
3m
= 3x3 - 3x2+
2x
+
38
elliptic7
5m"+
4m'+
5m
= sin x+
30
cos x-60x
sinx
+
24x
cos x elliptic8
u"+
hu'+ 2u
= 2Aex - 8exhyperbolic
9
m"+
2m'-3m
=+
50x3+
15x2 -64x
+
23
hyperbolic
Problem
Solution
Domain
Lower BC
Upper BC
1
u =x5+
2x4+
5x3 - 2x2+
x+ A
0-1.0
4.0
11.0
2
u = x5+
2x4-5x3
+
x2+
x0-1.0
0.0
0.0
3
u =sin xO-tt/2
0.0
1.0
4
u =sin3x
O-tt/2
0.0
1.0
5
m = 3x2+
7x
-A
0-1.0
-4.06.0
6
u = x3+
x2-2x +
10
0-1.0
10.0
10.0
7
m =3x2cos XO-tt/2
0.0
0.0
8
u =3ex+
Ae~x0-1.0
7.0
9.6
9
u =Ax4 - 6x3 - x2+
8x
-3
0-1.0
-3.02.0
Table
6.1:
Problems
The
problems werediscretized
using three
point centraldifferencing (6.1),
(6.2).
The
domain
ofeachproblem was splitinto 64
elements of equal sizeh,
yielding
acompu [image:27.533.48.489.280.586.2]computations
(refer
to
(4.5)).
du
dx
=
^Ui+l
~ui-i)
dAu
dx2
=
Ja^Ui-x ~2ui
+
ui+i)
(6.1)
Chapter
7
Methods
To
test the
effectiveness ofthe correction,
each problemwas run severaltimes.
These
runs are referred
to
astrials.
The
effects ofthe
correction on solutionaccuracy
andthe
numberofiterations
requiredfor
convergencewere measured.The
correction wasimplemented
up to three times
pertrial.
As
statedin
Chapter
5,
corrections were madeimmediately
after prolongation whenmoving to
afiner
gridlevel.
In
addition corrections wereonly
made after aGauss
Seidel
iteration
had been
performed on eachlevel.
The
correctionis
not effectivewhen applied
to the initial
iterations
in
a problembecause
the
error at each grid pointis
high. It is
most effective whenthere
is
alarge
amount oflocalized
error.A
trial
was performedfor
each correction possiblebased
onthe
above criteria(indi
cated
in
yellowin Figure 7.1).
Some
additionaltest
runs with multiple corrections per run were also performed.The
accomodative algorithmdid
not controlthe
flow
ofthe
correctiontrials.
Instead
the
structureofthe
multigrid runswithoutcorrections(labeled
trial
0)
was preservedin
each ofthe
correctiontrials.
The
structureofthe
runs canhave
a significantimpact
on
the solution,
andany
variance can makeit
difficult
to
evaluatethe
effects ofthe
correction.
While
the
flow,
orpattern,
ofthe
runs waspreserved, the
number ofiterations
on eachlevel
was variedin
accordancewith changesin
the
residual norm.A
generic structureis
shownin Figure 7.1.
It
representsthe
basic flow
that the
accomodative algorithm used
in
this study
produced.The
structure of each ofthe
trials
performedin this study
was a variation ofthat
shownin
Figure
7.1,
with avarying
numberofiterations
performed on each ofthe
pointsin
the
figure. Points
atwhichacorrectioncould
be
applied are colored yellow.Plots
ofiteration
vs. gridlevel
for
eachmultigrid run without corrections(trial
0 for
eachproblem)
are presentedin
Appendix C. From
the
plot ofProblem
1,
Trial 0 it
canbe
seenthat the trial
began
on
level
1,
then
movedup
with oneGauss Seidel iteration
performed onlevels
2,3,
and
4
andtwo
GS iterations
performed onlevel 5
andlevel
6,
and so on.Figure 7.1:
Generic
multigrid structure.required and
the accuracy
ofthe
solution.In
Chapter 8
percent changein
errorand percent change
in
iterations
are referredto.
These
arethe
changein
number ofiterations
andthe
changein
error with respectto the trial
without corrections(trial
0).
%AError
=\error\
-\errortriai0\
\errortrial0\
*100
(7.1)
^Alterations
=iterations
iterationstriaio
iterationstriaio
*100
(7.2)
Increased
solutionaccuracy
is indicated
by
a negative changein
error.Similarly,
anegativechange
in iterations indicates
adecrease
in the
number ofiterations
requiredChapter
8
Results
and
Discussion
Several
variablesinfluenced
the
effectiveness ofthe
correction.These included
the
nature of
the
correctederrorspike, the
gridlevel
that the
correctionwasimplemented
on, the time
it
wasimplemented,
andthe
grid pointthat
was corrected.Error
wasdecreased in 68%
oftrials
withone correction.The
majority
ofthe
results summarizedbelow
areoftrials
with one correctiononly.The
results of multiple correctiontrials
arediscussed
only
in
section8.7.
Specific
results of eachtrial
are presentedin
Appendix
E.
8.1
Error
Spike
Direction
The direction
ofthe
errorspikethat
was correctedhad
a significant effect on whetherthe
correctionincreased
ordecreased
the
errorofthe
final
solution.If
the
errorofthe
corrected point was greater
than
the
error ofthe two
points adjacentto
it,
correcting
it
generally
decreased
the
error ofthe
solution(Figure
8.1).
In
this
document,
this
is
referredto
as a"correct
direction"
spike
because
in the
graphicalview, the
errorspike appears
to
be
"pointing"in
the
desirable direction.
In
some casesthe
error ofthe
corrected point was negative andthe
error ofthe two surrounding
points waspositive,
or vise versa.This
situationis
labeled
"partially
correct"
and
is
shownin
Figure 8.2. Corrections
onpartially
correct spikes were not as effective asthose
madeon correct spikes.
In
the
caseof an"incorrect"
direction
spike, the
error ofthe
corrected pointis
smallerthan
the
errorofthe
adjacentpoints.Correcting
anincorrect
direction
spikedoes
not always yield positive resultsbecause
the
correctionincreases
the
error ofthe
correctedpoint.
Figures 8.1
and8.2
show examples of error spikesin
the
"correct", "partially
correct" , and
"incorrect"
directions,
asdefined in
this
paper.Overall 58%
of allspikeswere
in
the
correctdirection,
28%
in the
incorrect
direction,
and14%
of spikes werepartially in the
correctdirection.
error
for
trials
with a single correction.Corrections
appliedto
spikesin the
correctdirection
produced adecrease in
solution error86%
ofthe time.
In
the trials
in
whichcorrections of correct
direction
spikesincreased
the
solutionerror,
it
wasincreased
an average of
only
0.8%.
Corrections
made on spikesin
the
incorrect
andpartially
correct
directions
caused anincrease in
solution errorthe majority
ofthe
time.
Figure
8.1:
Error
vs.Grid
Point,
"Correct" spike(left)
and "Incorrect" spike(right).
Figure
8.2:
Error
vs.Grid
Point, "Partially
Correct" spike.It is difficult
to
determine if
an error spikeis in
the correct,
partially
correct,
orincorrect
direction
whenthe
exact solutionis
notknown.
The
difficulty
lies
in
de
termining
whetherthe
error ofthe
points adjacentto the
spikehave
a positive ornegativemargin.
The direction
ofthe
spike(pointing
up
ordown in
the
plot)
canbe
determined from
the
residuals.If
the
diagonal
ofthe
A
matrixis
a negativevalue,
the
residual spike and error spike will pointin
the
samedirection
(residual
and errorcalculated
from
(4.10)
and(4.9)).
If
the
diagonal
ofthe
A
matrixis
apositivevalue,
[image:32.533.95.441.176.311.2] [image:32.533.189.345.375.509.2]Error
Direction
Decreased
Increased
Correct
Incorrect
Partially
Correct
86%
40%
44%
14%
60%
56%
[image:33.533.161.370.211.298.2]Overall
68%
32%
Table 8.1: Percentage
oftrials
error wasdecreased
orincreased
per error spikedirec
tion.
Error
Direction
Decreased
Increased
Correct
Incorrect
Partially
Correct
5.1
2.4
16.7
0.8
1.9
17.1
Total
6.4
7.3
Table 8.2:
Average
percentage changein
error per error spikedirection.
Unfortunately,
a method ofdetermining
whetherthe surrounding
errorhas
anegativeor positive margin
has
notbeen devised. Without
this
information,
knowledge
ofthe
direction
ofthe
spikeis
not useful.8.2
Grid
Level
Corrections
on coarser gridlevels
provedto
be
more effectivethan
corrections onfiner
gridlevels.
Coarse level
corrections correct error on alarger
scalethan
finer
level
corrections andtherefore
have
a greaterinfluence
onthe accuracy
ofthe
final
solution.This
is illustrated in
Table 8.3
andFigure
8.6.
Table 8.3
showsthe
averageof
the
absolute value ofthe
percentage changein
final
errorfor
trials
with a singlecorrection on
the
specified gridlevel.
Figure 8.6
showsthe
changein
error producedby
eachtrial
with a single correction andindicates
which corrections yielded adecreased
numberoftotal
iterations. Each
data
pointis
the
result of onetrial.
The level
that
each correction wasimplemented
Figure
8.3:
Error
plot(top)
and residual plot(bottom)
for Problem
1,
Trial
1
(level
3).
Level
3
4
5
6
Average
|
%
A Error
[image:34.533.164.370.154.322.2]15.9
7.5
1.4
2.8
[image:34.533.190.345.507.578.2]8.3
Point in Multigrid Cycle
The
pointin
the
multigrid cyclethat
acorrectionis
made can also effectthe accuracy
of
the
solution.Corrections
made earlierin
the
cyclehave
a greaterimpact
on solutionaccuracy than those
madelater in
the
cycle.For
example,
if
a problem requires36
iterations
for
convergence,
a correction made onthe
15th
iteration
willgenerally
have
a greater effecton
accuracy than
a correction madeonthe
34th
iteration.
Corrections
made near
the
endofthe
cycle produced smaller errors when errorincreased.
Table
8.4
andFigure 8.5
illustrate this.
In
the table
andfigure
the
location
ofthe
corrected
iteration in
the
multigrid cycleis
given as apercentageofthe total
numberof
iterations.
Figure 8.5
showsthe
results of all ofthe
single correctiontrials
(in
the
same
way that
Figure 8.6 does).
One data
point showsthe
changein
error producedby
eachtrial.
In Table
8.4 the
location
ofthe
correctionin the
cycleis
reportedin three
segments.The
first
segment(20-60%)
representsthe
first
set of corrections made onany
gridlevel
asillustrated
in
Figure
8.4.
The
final
set of correctionsis
madein
the
last
segment
(75-100%)
(Fig.
8.4).
If
three
sets of corrections werepossible, the
secondset was made
in
the
middle segment(60-75%)
(Fig.
8.4).
Problem 5
wasthe only
problem
in
which corrections were madein
the
60-75%
range ofthe
cycle(Fig.
8.5).
7
6
5 "3
S
4I
'
3
13
7\-ML
M-L
\
//A
,ll\
TLL
\Li/
V
//
\
fit
F
AV^
'~\A
v\
^jjb^j; lslset 21!et Finalset corrections
i 1
corrections
i 1
corrections
1
20 40 60 80
Location in MultigridCycle
(%)
100 120
? Correction Locations
[image:35.533.151.387.379.544.2]Location
ofCorrection In Multigrid Cycle
20-60%
60-75%
75-100%
Level
Dec. Error
Inc.
Error
Dec.
Error
Inc.
Error
Dec.
Error
Inc. Error
3
4
5
6
-15.4
43.5
-13.98.6
-1.2
1.1
-5.80.8
-0.3 -0.3
-5.6
-19.7
-11.4
11.9
-3.0
9.5
-1.30.6
-0.1
0.3
[image:36.533.62.474.110.229.2]All
-9.0813.51
-6.45 -3.955.57
Table 8.4:
Average
percentage changein
error perlocation
in
multigrid cycle.60
40
20
uj
0
<
-20
-40
-60
?
?
Level 3
Level 4
Level
5
x
Level
6
?
?
JO
2 0.00
4d!o*
X60.00
?
?
80.01*
10C
X
?
?
00
Location in Multigrid
Cycle
(%)
[image:36.533.111.431.325.606.2]8.4
Grid Location
Corrections
on pointslocated
in the
center ofthe
grid were more effectivethan
corrections on points near
the
gridboundaries.
In
the
following
discussion
grid pointlocations
are expressed as a percentage ofthe
computationaldomain
ofthe
problem.It
shouldbe
notedthat
Dirichlet
boundary
conditions were usedin
all ofthe
trials.
Corrections
on pointslocated
in the
centerofthe
gridhad
agreaterimpact
on solutionaccuracy than those
performed within adistance
of10%
(of
the
gridlength)
ofthe
boundaries. Figure 8.6
showsthe
percentage changein
solution errorvs.the
location
of corrected point as a percentage of
the
length
ofthe
grid.The
percentage changein
errorfor
all single correctiontrials
is
plottedin
Figure
8.6.
Each
ofthe
plotted pointsis
the
result of onetrial.
On finer
grids errors nearthe
edge ofthe
grid arereduced
by
the
boundary
conditions,
and corrections nearthe
grid edges are not aseffective.
Corrections implemented
in the
center ofthe
grid alsodecreased
errormorefrequently
than
corrections nearthe
boundary
conditions(Table
8.5).
60.00
40.00
20.00
w
0.00
-20.00
-40.00
-60.00
-6h
20
fljFafr
t
nri-*40"
*&
60?
80
*S*i
life
? Level 3
Level 4
A Level 5
xLevel 6
o Iterations Decreased
Grid
Location (%span)
[image:37.533.110.434.316.611.2]Error
ofFinal Solution
Distance from
Boundary
(%
gridlength)
Decreased
Increased
0-10%
10-25%
25-50%
8
12
30
5
9
[image:38.533.97.435.82.152.2]10
Table 8.5: Number
oftrials in
whichfinal
error wasincreased
ordecreased
vs. correction
location.
8.5
Residual Magnitude
There
was no correlationbetween
the
size ofthe
residual spike andthe
percentagechange
in
final
error.Figure 8.7
showsthe
changein
the
error ofthe
solution as afunction
ofthe
residual/norm(norm
refersto the
residualnorm)
ofthe
corrected point.8.6
Problems
The
effect of single corrections onthe
error of each problemis
shownin Figure
8.8.
This
plotis
nearly
identical
to
Figure
8.6.
As in Figure
8.6,
eachdata
pointis
the
result of one
trial
andthe
results of alltrials
with one correction are plotted.In
Figure 8.8
the
problemthat
was solvedin
eachtrial
is
indicated.
The
effect ofthe
corrections on solution
accuracy
variedbetween
problems.Most
ofthe
differences
canlargely
be
attributedto the
factors discussed
above(spike
direction, location,
and gridlevel).
Corrections
were most effectivein
problem5.
The
number of single correctiontrials
in
which corrections were made oncorrect,
incorrect,
andpartially
correctdirection
spikesis
shownin Figure
8.9.
In
problem6,
100%
ofthe
spikescorresponding to the
maximum residual werein
the
correctdirection. Problem 8
had
the
largest
number of spikesin the
incorrect direction. The
number of
trials
performed variesbetween
problemsbecause
ofthe
variationin
the
structureof
the
runs(see
Appendix C). A larger
number oftrials
were performed onproblem
5 because it has
moreiterations
than any
other problem and movesbetween
the
gridlevels
an additionaltime.
Only
seventrials
were performed on problem2
because
iterations
were performed onlevel 2
attwo
pointsin
the
cycleinstead
of60
50
40
w 30
20
10
?
?
?
Level 3
Level 4
A
Level 5
x
Level 6
"?
X
?
?
%
X
V
AA*
AX
A X
X
X%|
->^* *10 15
|
Residual/Norm|
[image:39.533.112.425.193.525.2]20 25
60.00
40.00
20.00
-20.00
-40.00
-60.00
x*
40
rj X
n*
? 60 *x 80 100
A
Problem
Al
2
?
3
?
4
5
a6 x7 x8
o9
Grid Location (% span)
[image:40.533.116.434.214.511.2]10
n
O
.a
E
-s
SpikeDirection
1-PartiallyCorrect
1- Incorrect
1- Correct
7 8 9
[image:41.533.65.469.224.496.2]8.7
Multiple Corrections
The
results presentedin
the
previous sections arethe
results oftrials
with a singlecorrection.
Twenty-six
trials
with multiple corrections wereperformed, 21
withtwo
corrections,
and5
withthree
corrections.Appendix D
showsthe
resultsofthese trials.
The
percent changein
error(7.1)
andthe
percent changein
numberofiterations
(7.2)
are reported.In
some casesthe
number ofiterations
did
not change andtherefore
the
percent changein
number ofiterations
does
not showup in the
plot.The
graphs showthe
effects ofthe
multiple correctiontrials
andthe corresponding
single correction
trials
(performed
atthe
same pointsin
the
cycle).The iteration
that
a correction wasimplemented
afteris indicated in
parentheses nextto the trial
number.
The iterations indicated in
the
single correctiontrials
are not alwaysthe
same as
the
iterations indicated
in the
multiple correctiontrial.
This is because
some multiple correctiontrials
resultedin
adecreased
number ofiterations
and a moveto
ahigher level
at an earlieriteration.
The
details
ofthe trials
canbe found
in
Appendix
E.
In 12
trials the
changein
error producedby
the
multiple correctiontrial
was within6%
ofthe
sum ofthe
error changes producedby
the corresponding
single correctiontrials.
Six
trials
produced animprovement
in
solutionaccuracy
overthe
combinationof
the
single corrections.In 23
ofthe
26
trials the the
changein
number ofiterations
producedby
the
multiple correctiontrial
was equalto the
sum ofthe
changesin
Chapter
9
Conclusions
This
study
is
aninitial
evaluation performedto
assessthe viability
ofthe
correctionmethod.
The
resultsindicate
that
it
has
the capacity to improve
solutionaccuracy
andpotentially
increase
solverefficiency
for
a problem solvedwith multigrid methods.The
correction can also cause a
decrease
in
solutionaccuracy if
it
applied at animproper
time.
The
mostimportant
factor in
determining
whether acorrection will produce positiveresults
is
the
direction
ofthe
corrected error spike.Almost
all ofthe
correctionsperformed
on"correct
direction" error spikesincreased
solution accuracy.Unfortunately
it is
difficult
to
determine
whether or notthe
spikeis in
the
"correct"direction. This
would
be
possibleif
a method wasdevised
to
determine
whetherthe
errorhad
apositiveor negative margin.
There
was also a correlationbetween
the
location
ofthe
correction onthe
grid andcorrection effectiveness.
Error
wasdecreased
in
75%
of single correctiontrials in
which
the
corrected point wasin the
central portion ofthe
grid.In
most casesimplementation
ofthe
correctiondid
not affectthe
number ofiterations
required
for
convergence.In
these
casesthe
amount of computational work wasincreased
by