ONE-DIMENSIONAL ADAPTIVE
GRIDGENERATION
AHMEDM. M. KHODIERandADELY. HASSAN
Department
of
MathematicsFaculty
of
Education AinShamsUniversityRoxy,
Cairo,Egyp
(Received November I, 1995 and in revised form May 8, 1996)
ABSTRACT. Inthiswork,wegiveanadaptive grid generation method whichallowsasingle pointtobe
added in the regions oflarge variation. Thismethoduses aquadrature ruleas aweightfunction. Our Weightfimction measuresthe variationofthesolution function on each subintervalofthe solution domain. The method is appliedtoobtainthenumerical solutionsofsome differentialequations. Acomparison of
the numerical solution obtainedbythis method andother methodsisgiven.
KEY WORDS ANDPHRASES Finitedifferences, errorestimation, weightfunction, adaptivegrid generation.
1991AMS SUBJECT CLASSIFICATIONCODES 65L50.
1. INTRODUCTION
It is well known thatthechoiceofthe mesh pointsplaysanimportantrole in theaccuracy ofthe numerical solutionofdifferentialequations. For example,when thesolutionhas largevariations likelarge gradients, peaks, or boundary layers in some partsofthesolutiondomain,weneedmoregrid pointsin
such regions thaninregions where thesolutionchangessmoothly. This type
omesh
generationisknown asadaptivegridgeneration.During the lasttwodecades,asignificantinterest ingeneratingandapplying adaptive gridstothe numerical solutions of differentialequationsissurfaced(seeforexampleDennyand Landis ];Eiseman
[2];LentiniandPereyra [3];Matsuno andDwyer [4];andThompson[5]). The common property ofmost
adaptive grid methods is that they dividethesolution domain into subintervalssuchthat somepositive weight function has roughly equal valueover eachsubinterval. Mostadaptive grid generationmethods
differ from each otherin the choiceoftheweightfimctionand agreeincalculating thevalueofthegiven weightfunction at asingle point. Mostforms ofthe weightfunctionsusedin literaturedependonthe first
derivative,orthe second derivative,orthetnmcationerror ofthe solution.
Equidistdbution schemes in literature usually use a cm4tinear coordinate transformation to
w
x
+x
0w
where w is the given weight function. In the nxt section,weshow that theuseof such techniques
introduces a numericaldiffusionto the solutionofthe problem underconsideration.
Inthis paper, we give anadaptive grid generation method basedonusingaquadraturerule as a
weight function If the variation ofthe solution islargeon asubinterval, then thequadraturewillbe
large. The advantage ofour weight function is that it is calculated on a subintervalofthe solution
domain, not atasingle point ofthatdomain.Toavoidthenumericaldiffusionintroduced inmostadaptive
methods, we use finite differences on irregular gridtosolvethegivenproblemsinthephysicaldomain withoutthe useof anytransformations.
2. FINITE DIFFERENCES AND TRUNCATION ERRORS
Adaptive methodsin literatureusuallyuse acurvilinearcoordinatetransformationtotransformthe
physical domain into a computational domain where the mesh points are equally spaced. A one
dimensionaltransformationcanbewritten as
x(=
p(-
0_<<N (2.1)where N is thenumber ofsubintervals inthesolutiondomain, i.e., h l/N, his thestepsize intheuniform
mesh. The first andsecondderivativesofthesolution inphysicaldomaintake theform
and
u
u,,
(2.2)xg
ugg
ugxg
(2.3)
xx
x
x
in the computational domain. Hoffman[6] comparedthetnmcation errorsofthefirst derivativesof the solution function in the physical and computational domains. Thompsonetal.
[7]
provedthat if u isx
approximated in thephysicaldomainby usingacentral difference for
u
and theexactvalueofx,
then the truncationerror inequation(2.2)isgivenbyT -1
oo -1 oo
g(D-
XDx)2n
+1u
Y
+ u (2.4)(2n+1)!
2n+1
(2n+1)x
Xn_l
Xn=l
Thedominantpart ofT is x
h2p
u
h2pu
h2pUxxx
(2.5)T1
=-6---
x--
xx-g
The first term of T containsanumericalviscosity
UxWhich
usuallycausestroubles and may distroy thesolution. Thistermcanbe eliminatedifwe use central differenceapproximation for
x.
Inthiscase,we haveU
U(’+I
U(’-I
+T.
(2.6)u
The dominantpart of is x
l(X
i+lxi)3
-(xi_
_xi)3
T
2=--(xi+l-2x
i+x
)uxx 6 o
+l-Xi_l
u (2.7)In the physical domain,thefirstderivative u x
asfollows(seefig.2.1)
can beapproximated by using the centraldifference
u(x )-u(x
u +1 -1 T
x
hl
+h2
xwhere thedominant partofthe mmcation error isgiven by
x
(2.8)
-(h12-h
+h22)u
(2.9)T3
-(h2
hl)Uxx
lh2
xxxThe dominant part of the tnmcation error inequation
(2.9)
isthesame asthat giveninequation(2.7). Hence, the central difference approximation of the first derivative u has thesame truncation errorinx
both physical and computationaldomain.
Now,
we compare the truncation errorsfor thecentral differenceapproximation ofthe second derivative u in thephysical andcomputational domains. Inthe physical domain,wehave2[hlU(X
+h2
)+h2u(xi_l
)]uxx +1
-(hl
)u(xi
+T (2.10)hlh2
(h +h2
x(2.11)
The main partofthe mmcationerror
T
isT
4
=-(h
2-hl)Uxx
x-’2
(h12-
hlh2
+h)Uxxxx
Inthecomputational domain,wehave
u
u(i+l)-2u(i)+u(_
1)
(u(i+l)-U(i_l)XX
+l-2Xi
+xt_
1)
Xi+l-Xl-1
2x/+l-Xi-2 2
wherethedominant partof thetruncation error
T
isgiven by(h2
-h)
2 (h 2-h)
2
T5
(h+h2)2
Uxx
--(h2
-hl)[1
)2 ]Uxxx
(2.13)(h +h
2
The first term in equation (2.13) istroublesomesinceitdependsonthe derivative u which isbeing
approximated. Tiffstermvanishesonlywhenh h
2 Thisleadstouniformmesh inthe physicaldomain which isnotour interest in thiswork.
Hence,
the use of central differencesfor thederivatives ofthetransformationwhich eliminate theterm u in the tnmcation error ofthe first derivative now introduces an errorthat dependon u This
x xx
error introduces a numerical diffusion.
From the above discussion, it isclearthat thetruncation errorsofthe firstderivative u and the x
second derivative u (asshown in equations(2.7)and(2.13))contain a numerical diffusionterm inthe computational domain while in the physical domain, there is a numerical diffusion term onlyin the
truncation error of the first derivative (see equation (2.9)). De Rivas [8] suggested thefollowing approximation
x
hlh2
(h+h2)
whichhas themainpan
ofthetruncation errorT
6
hlh2Uxx
xTherefore, it is preferabletsolveaproblemin thephysical dthantsolveitinthe cmpttil
domain. A compariso f the maximum error between theexactsotutiand theuerical soluti btained inphysicalandcompmatialdmains isgiven in
exale
4.1.Manteffel and
WNte [9]
showed that the differenceschemeobtainedbyusing equations(2.10)ad (2.14) yields a second order accate solutio
deite
thefct that thetrcatierrorisflwerrder.
3. CONSTRUCTION OF ADAPTIVE MESH
In this section, we describe ourprocedureforconstructing the adaptivemesh. Toillustratethis, letusconsiderthe differential equation
au +bu
+cu=g
0<x_<l(3.1)
xx x
where a,b,c, g are,ingeneral,functionsofx and the boundary values
u(0)
andu(1)aregiven.Let u(x)
eC4[0,1]
be anapproximatesolutionof equation(3.1)obtainedbysomeinterpolation of the discrete numerical solution obtained oncrudeuniformmesh.For
example,the functionu(x)canbe approximatedby using splineorany piecewise polynomialapproximations. Inthiswork,weusequadratic spline polynomial to approximate thesolution. Then by consideringthemidpointXm=(Xi
+xi
+1)
2. the errorof Sknpson’s rule appliedtothesubinterval[xi,
x+ isgiven by -1
%vhere
x.<
i
<x.+l
If we consider the two pointsxg=(3x
i+x
i+l)/4
andx
r=(x
+3xi+
1)/4,
thentheerrorbecomesEZ,
(u)I"
u(x)dx+f.,,.
....
u(x)dx---(x,+,l
x,)[u(x,)+4u(xt)+2u(x,,)+4u(x,.)+u(x,/i)..1 where x <
’i
<x-(c,)]
(3.3)92160
(xi+
xi)5[Uxxxx
()
+Uxxxx
m and xm<
’i’2
<xi+
1. Bysubtracting equation(3.2)from equation(3.3),we get-(x,/
x,
lu(x,
)-4u(xe)
+ 6u(xm)- 4u(xr +
u(x,
+1)
_-19216__
xi
+
xi)5[
Uxxxx
(;)
+uxxxx(;)-32u
xxxx(;i)[
(3.4)Hence
El,U)
< 174i080
(xi
+
xi
)5
u
()
of Equation(3.4)
rret
e
e=or ofSn
e
one
btewal[xi,x
+
1].
ffe fo daeu
has age
vue
on abtaL
wehaveage
v
ofeortion
(3.4). hs
ca,we add
e
dpot x toe
m
pots
dreat
e
proceded megoppg
cdteism
fisfied.R
w o
ate
nmedcalretsdd
one
propeRies ofed.
ffeme
ratio isge, e
convergofe kae lufion mod y belog. h work,weratio
Mn
to be 4 SMn
4.s
worL
e
procedeofcong
adapem
wastoop
wh
e n
ofadapteme
pots
ise
e ase
o m.
procedec beehed
e
foflogalgoALGOM
approte
fion u of equation (3.1) obtmed on ao
me
pots
{x },i=0,1,2 N.
e ape me
{z
be COheredase
foRog,s
1.Stm
e
o me
pots
z x i=0,1,2,...,N.2.
Co,me
e
e=orE. eqfion(3.4)oneachbtewal[zzi
3.Dee
btal of eor, ym4.Update
e me
pots
{zi}
tocludee
dpotof[Zm_
1,Zm].
5.geat
gs
2-4tfle
oppg
cdt tfied.4. NUMERICAL RESULTS
d2u
EXAMPLE 4.1. --+4u 20x +4x 0_<x <
dx
In
thisexample,wecomparethe numerical resultsobtained inthe physical and computationaldomain.Theboundary conditions are obtained fi’om the exactsolutionu(x)=x
5.
The resultsaregivenintable4.1.Also, a comparison of thenumericalresultsobtainedbyourmethod andsomeother methodsisgivenin table 4.2. Theadaptive meshisshowninfig.4.1.
d2u
du0 0_<x_<l
EXAMPLE
4.2.dx qdx
with the boundary conditions u(0) 0 and u(1)=1. Thisexampleis consideredbyLickand Gaskins [10]. It has a boundary layer ofthickness 1/qnear the fight boundary. Numerical results for q=20are
givenintable 4.3, and the adaptive meshisshowninfigure4.2.
rx
d2u
duEXAMPLE
4.3. +-- 0 0 _< x _< r- dx dxwhere the boundary conditions are u(0) 0 andu(1) 1. Thefirstandhigherorder derivatives ofthe
solution function havesinguhdfiesat x=0forr>1. The numericalreadtsobtainedfor 1.25 aregiven
intable4.4,andthe adaptive mesh distributionisshowninfigure4.3.
d2u
duEXAMPLE 4.4 --+re+m=0 0<x<l t>l/4
dx dx
withboundary conditionsu(0) 0andu(1)
sm(x/-
1). Numericalresults givenintable4.5 aredueto t=l 0. Theadaptive meshisshowninfigure4.4.
REMARK. In all tables, adaptive
,
adaptive2,
andadaptiverepresentthenumericalresultsonadaptive grid obtained by using the first derivative, second derivative,and ourquadraturerule(equation
(3.4))as aweightfunction.
Transformation
x()
(e
1)/(e-1)x()=’
No.of Subintervals Abs.Max.Errorin Phys.Domain
32 23x10-5
64 59x10
-
50x 10-532 18x
10-6
30x 10-564 4x10-6 75x10-6
Table 4.1. NumericalResults of Example4.1 in Physical and Computational domain
Mesh
Type AbsoluteMaximumErrorAbs.Max.Errorin
Comp.
Domain 20x10-480 Subintervals 160 Subintervals 320Subintervals
uniform 48x10-6
25x10-6
14x10-6
adaptive 29x10-6
16x
10-6
7x10adaptive 13x10 8x
10-6
3x10-6adaptive 67 10-7 39x10-7 12x10
MeshType
Table 4.2. Numerical Results ofExample4.1 AbsoluteMaximumError
80 Subintervals 160 Subintervals 320 Subintervals
umform 20x10
-
49 x10-515x10
-adaptive 14x10 42x10-5
13x10-5
adaptive 72x10-5 30x10-5
48x10
-adaptive 10x10-5 29x10-.6
MeshType
bsolute
MaximunnError80 Subintervals 160 Subintervals 320Subintervals uniform 30)<10.4
18 10-4
x10
adaptive 26
10.4
13 10 97 0-adaptive 21
10.4
98 0-
73 0-adaptive 14 x
10.4
53x10-
24x10-MeshType
uniform
adaptive’
adaptive
adaptive
Table4.4. Numerical Results ofExample4.3
Ab"s’o’iute Mai’mm
Error80 Subintervals 160 Subintervals
17x10-J 72x10
40x
10.4
18x I0-23x
10.4
6 x10-4
6 x
10.4
20x10-Table4.5.NumericalResultsof Example4.4
320 Subintervals llx
10-4
71xI0
-16xI0 -6xlO-Fig.4.1.Adaptive Mesh for Example4.1 with80Subintervals
Fig.4.3. Adaptive Mesln for
Examifle
4.3with80Subinten,ais
Fig.4.2.Adaptive Mesh forExample4.2 with 80 Subintervals
Fig.4.4. Adaptive Mesh frExample4.4
5. CONCLUSIONS
In this work,wehaveanalyzedthe numerical solution of differentialequationsin thephysicaland
computational domains. The difference approximations ofthe first derivatives have thesametruncation errors in both domains whilethe difference approximations ofthe secondderivatives introduceartificial
viscosity in the computational domain. Theartificialviscosity can beavoidedby solving thedifferential
equationsinthe physicaldomain.
The adaptive grid generation methods generates a well suited mesh for the problemsunder
consideration speciallyifthe solution oftheseproblems hasalargevariation in some partsofthesolution domain. Also the use of adaptive methods doesnotrequireany priori knowledge aboutthe solution or eventhe locationsof kslargevariations.
The numerical results presented in thispapershow that theerror obtainedby usingouradaptive
method isof almost 50% ofthe error obtainedby usingothermethods.
[]]
[2]
[31
[4]
[1
[6]
[7]
[8]
[9]
[10]
REFERENCES
DENNY, V. E. and LANDIS, It.
B., "A
NewMethod for Solving TwoPointBoundaryValue Problems Using Optimal Node Distnoution",
J.ofComp.Phys.9(1972), 120-137.EISEMAN, P. K "Adaptive Grid Generation",
Computer
MethodsinAppliedMechanicsandEng.
64(1987),321-376.LENTINI, M. and
PEREYRA,
V."An
AdaptiveFiniteDifference Solver forNonlinearTwo Point Boundary Value Problems with Mild BoundaryLayers",
SiamJ.Numer.Anal. 14,No. (1977),91-111.MATSUNO, K. and
DWYER,
H.A.,
"Adaptive Methods for Elliptic Grid Generation",J.ofComp.
Phys.77(1988),40-52.THOMPSON, J.
F.,
"A Surveyof Dynamically Adaptive Gridinthe NumericalSolutionofPartialDifferential Equations",Appl. Numer.Math. (1985),3-27.
HOFFMAN, J.
D.,
"Rehtionship between the Truncation ErrorsofCenteredFinite Difference Approximationon Uniform andNommiformMeshes", J.ofComp.
’Phys.
46(1982), 469-474.THOMPSON, J. F.
WARSI,
Z.U.A.,
andMASTIN,
C.W.,
"Order of Difference ExpressiononCurvilinearCoordinateSystems",Advancesin GridGeneration,ASME (1983), 17-28.
DE RWAS, E. K. "On the Use ofNonuniform Grids inFinite DifferenceEquations",J.of
Comp.
Phys. 10(1972),202-210.MANTEUFFEL, T.A.and
WHITE,
A.B.,"TheNumerical Solutionof Second-Order Boundary ValueProblemsonNonuniformMeshes", Math. of Computation, 47,No. 176(1986),511-535.LICK,
W. andGASKINS,
T."A
Consistent andAccurateProcedure for ObtainingDifference