A New Finite-difference Scheme for Singular Differential Equations

A new nite-dierence scheme for singular
dierential equations in cylindrical or spherical
coordinates
by Ron Buckmire Mathematics Department
Occidental College
Los Angeles, CA 90041-3338, U.S.A.
December 18, 1995
It is well known that the standard nite-dierence scheme for approximating the radial
derivative in polar coordinates (r-derivative) in Laplace's Equation has diculty capturing
the singular (logarithmic) behavior of the solution near the origin. By choosing a nonstandard nite dierence scheme (\logarithmic dierencing") the singular behavior can
be captured with a signicantly smaller local truncation error. In the almost-trivial
1-dimensional case, the singular behavior is captured exactly. A number of numerical
examples are given which illustrate the utility of the new scheme.
1 Introduction
This paper discusses a method for computing numerical solutions to partial dierential equations and ordinary dierential equations written in spherical or cylindrical
coordinates. It involves a new way to discretize the operator R rp drd , where p = 1
is the cylindrical coordinates case and p = 2 is the spherical coordinates case.
The scheme introduced in this paper was rst presented in Buckmire's 1994 thesis
[1], in which particular slender bodies of revolution were found to possess shockfree ows. The problem is formulated using transonic small disturbance theory
found in [2], [3] and [4], among other sources. Cole & Schwendeman announced
the rst computation of a fore-aft symmetric shock-free transonic slender body
in [6]. Computationally, the problem involves numerically solving a boundary
value problem with an elliptic-hyperbolic partial dierential equation (the KarmanGuderley equation) in cylindrical coordinates, with a singular inner Neumann
boundary condition at r = 0 and a non-singular outer Dirichlet boundary condition
The author can be reached by electronic mail at [email protected].
1
2
far away from r = 0: Namely,
(K , ( + 1)x )xx + rr + 1r~r = 0:
~~
(x; r~) ! S (x) log r~ + G(x);
(x; r~) bounded,
D
(1)
~
as r~ ! 0; jxj 1
for r~ = 0; jxj > 1:
(2)
x
;
as
(
x2 + r~2 )1=2 ! 1:
(3)
2 3=2
4 (x + K r~ )
In (1), (2) and (3) the variable r~ is a scaled cylinrdical coordinate, K is the
transonic similarity parameter, D is the dipole strength and (x; r~) is a velocity
disturbance potential. Both S (x) and G(x) are bounded functions. The main point
of sketching the boundary value problem here is to emphasize that the function G(x)
(x; r~) !
2
which occurs in (2) needs to be computed very accurately, because the pressure
coecient on the body depends directly on G0(x): Computing it is complicated by
the fact that (x; r~) and S (x) log r~ are becoming singular as r~ ! 0, which is where
the boundary condition must be evaluated. Thus a numerical scheme was needed to
compute the solution accurately as r~ ! 0: This was the motivation for the scheme
introduced in this paper.
In 1971, Murman and Cole [5] introduced a numerical scheme which was the rst
of its kind to be able to handle mixed-type elliptic-hyperbolic partial dierential
equations like the Karman-Guderley equation. The method is now known as
\Murman-Cole switching" and is a particular scheme to discretize the x-derivatives
in the partial dierential equation. It is tting that the new scheme which deals with
the discretization of the r-derivatives in the same PDE is presented at a gathering
honoring the contributions of Julian Cole.
2 Discretizing the operator R rp drd
This section shall explain the discretization of R, limited to the p = 1 case; the p = 2
discretization is derived in a similar manner. Consider the quantity B (r) which is
dened as
rp du
B (r) = Ru =
;
dr
where u = u(r) is an unknown function (the solution) the operator R acts on.
The rst step in the discretization of the operator is to choose a grid frj gNj on
the interval 0 r 1 where
=0
0
r0 < r1 < r2 < : : : < rj < : : : < rN = 1:
(4)
On the grid dened in (4) one has discrete forms of the quantities of interest, such
d
as u(rj ) = uj and Bj = = rp dr
where rj = = rj rj+1 :
+1 2
r=rj+1=2
+1 2
+
2
There are two choices of discretizing B (r), the standard forward-dierence
approximation method and the new scheme, which shall be compared with each
3
other.
uj +1 , uj
rj +1 , rj
uj +1 , uj
uj +1 , uj
Bj(2)
=
+1=2 =
log(rj+1) , log(rj ) log(rj+1=rj )
Bj(1)
= rj+12=
+1=2
(5)
(6)
The standard scheme in (5) shall be referred to as Scheme and the new scheme
in (6) shall be referred to as Scheme . Scheme can be obtained by assuming
that B (r) should be constant on each subinterval (rj ; rj ) of the grid. If one relates
B (r) back to the physical uid mechanics problem we want to solve, it corresponds
to a mass ux. The relationship between Bj = and uj and uj solves the simple
boundary value problem
ru0 = Bj = = constant
(7)
u(rj ) = uj
(8)
u(rj ) = uj :
(9)
The solution to this is u(r) = Bj = log r + C , which, when one applies the boundary
conditions (8) and (9) leads to the formula
(1)
(2)
(2)
+1
+1
+1 2
+1 2
+1
+1
+1 2
Bj +1=2 =
uj +1 , uj
log(rj+1=rj ) :
3 Applying the method
The question to be asked now is, how well does the new scheme given in (6) work?
This question will be answered by giving an example of the new scheme being
applied to a simple dierential equation. The Karman-Guderley equation (1) and the
associated boundary conditions of (2) and (3) can be related to the simpler boundary
value problem given below
1 d r du + qu = 0;
q constant
(10)
!
r dr
dr
du r = S;
(11)
dr r=0
u(1) = G:
(12)
If one linearizes and substitutes (x; r) = u(r)eikx into (1) one will obtain the above
boundary value problem. This simple boundary value problem is used as the test
problem to benchmark the new nite-dierence scheme instead of the transonic smalldistrurbance equation (1) one is really interested in solving, because the simpler
problem has a known exact solution involving logarithms and Bessel functions,
depending on the value of q = k . The exact solution can be written as
p
p J (r q )
p
q > 0;
u(r) = SY (r q) + (G , S Y ( q )) p
(13)
2
2
J ( q)
q = 0;
u(r) = S log r + G
(14)
p
, SK (rp,q) + (G + S K (p,q)) I (rp ,q) : (15)
q < 0;
u(r) =
2
2
I ( ,q)
2
0
0
0
0
0
0
0
0
4
First consider the q = 0 model problem. The dierential equation in this case is
simply
1 d r du = B 0(r) = 0:
r dr dr
!
This has the simple solution B (r) = constant. Using the boundary condition at
r = 0; B (0) = S ) B (r) = S: Thus the discrete version of the model equation which
is being solved is
Bj = = S:
(16)
Using scheme (the standard forward-dierence approximation)
+1 2
(1)
Bj +1=2 = rj +1=2
uj +1 , uj
=S
rj +1 , rj
rj
) uj = uj , 2S rrj ,
+r
with uN = G:
+1
+1
j +1
j
This is a simple marching scheme which allows one to compute all the uj ,
j = 0; : : : ; N starting from uN = G and \marching" down to u0 .
Using scheme (the new scheme) the discrete equation to be solved is
(2)
uj +1 , uj
log(rj+1=rj ) = S
) uj = uj+1 , S log( rjr+1 );
with uN = G
j
Bj +1=2 =
Scheme also leads to a marching scheme which solves the model equation exactly
by denition. This happens because the scheme was derived assuming that B (r)
would be constant on each subinterval. For this model equation B (r) = S , so it
is the same constant, namely S on each subinterval. So scheme is exact for this
model equation where q = 0. A similar idea of deriving a nite-dierence scheme by
using a discretization which solves a simple version of the dierential equation one is
actually interested in solving is given in Scharfetter & Gummel [8].
Compare the two schemes by looking at the dierence between the numerical
solution each generates, at each grid point.
ej = uj , uj
(17)
(2)
(2)
(1)
(2)
where uj is the solution to the equation obtained using scheme and uj is the
solution to the equation obtained using scheme :
(1)
(1)
(2)
(2)
ej = u(1)
j +1 , 2S
rj +1 , rj
rj +1 + rj
, uj + S log( rrj )
j
= ej , 2Sj + S log 11 +
, j
+1
+1
(2)
!
j
(18)
rj
where j = rrj ,
+ rj . The symbol j is a characteristic of the grid disretization
j
somewhat akin to grid separation.
+1
+1
5
If j 1, then using a simple Taylor series expansion
ej , ej
2 + 2 + : : :
=
(19)
S
3j 5j
Thus the local discretization error made by the typical dierence scheme is O(j ),
which implies that the global error is O(j ). However, suppose that j is not small
for all j . Remember that j depends on the choice of frj gNj . It is a characteristic
of the grid discretization. For example, suppose that the choice is to use a uniform
grid. In that case,
1
r = jh;
h = ; j = 0; : : : ; N:
+1
3
5
3
2
=0
j
N
rj
h
1 : Clearly, 1 1 : So
In this case j = rrj ,
=
=
+ rj jh + (j + 1)h 2j + 1
2N + 1 j 3
j
the parameter j varies depending on what grid point it is evaluated at, but at j = 1,
is a constant which does not depend on N or h which means that as h ! 0 (or
N ! 1) the local discretization error, which is O(j ) does not get smaller and go to
zero, but in fact the error at j = 1 is O(1)!
A uniform grid is a bad choice to pick when discretizing the domain if one is
d
operator and the domain includes the
solving a dierential equation with a rp dr
singular point r = 0, i.e. singular dierential equations. A better grid choice is to
ensure that the grid has the property that j is small for all j . The easiest way to
do that is to pick one value of for all j. The value can be chosen by looking at
the denition of j and re-arranging it to give a marching scheme which chooses the
appropriate grid discretization frj gNj .
+1
+1
1
3
=0
r ,r
j = j +1 j
rj +1 + rj
) rj = 11 ,+ j rj ;
j
!
+1
with rN = 1
For example, if one lets j = 1=N ,
1 , 1=N r = N , 1 r
rj =
1 + 1=N j
N +1 j
N ,1
which implies that rj = N ,j rN ; where = 11 ,
+ = N + 1 < 1: This grid choice
corresponds to an approximately exponentially stretched grid, with many points
clustered near r = 0. This analysis supports the grid choice used by Krupp &
Murman [7] to solve the Karman-Guderley equation back in 1972.
The standard forward-dierence scheme can be used to solve singular dierential
equations, but the grid must be chosen intelligently. Using the new scheme there is
exibility about what kind of grid to use.
!
+1
+1
6
Error using standard scheme (1)
0.3
’fort.300’
’fort.301’
’fort.302’
’fort.303’
’fort.304’
0.25
0.2
0.15
0.1
0.05
0
-0.05
1e-09
1e-08
1e-07
1e-06
Fig. 1.
1e-05
0.0001
0.001
0.01
0.1
1
Error Due to scheme(1)
Error using new scheme (2)
0.03
’fort.400’
’fort.401’
’fort.402’
’fort.403’
’fort.404’
0.02
0.01
0
-0.01
-0.02
-0.03
1e-09
1e-08
1e-07
1e-06
Fig. 2.
1e-05
0.0001
0.001
Error Due to scheme(2)
0.01
0.1
1
7
4 Numerical Results
Consider how the competing schemes fare when used to solve the q 6= 0 model
problems. Exact solutions are known, so one can compare the absolute error scheme
makes in solving the problem to the absolute error scheme makes to solve the
identical problem. The numerical results are given in Figures 1 and 2. In all cases,
the new scheme is more accurate than the standard scheme. Even when scheme
is used on a uniform grid but scheme is used on an exponentially-stretched grid
the new scheme fares better. Both schemes get worse errors as the point at which
the inner boundary condition is evaluated approaches zero. For the numerical results
given in Figures 1 and 2, a grid was chosen consisting of N = 50 points and then
a series of computations performed solving the model problem (15) using a value of
q = 1. By choosing steadily decreasing values for the degree to which the grid was
exponentially stretched was increased, culminating in the nal run with r = 10, :
(1)
(2)
(2)
(1)
0
9
5 Conclusions
A new nite-dierence scheme has been introduced to deal with dierential equations
in cylindrical or spherical co-ordinates. It appears to tackle singular problems more
accurately and eciently than other standard schemes. The author urges others to
use this new scheme and look forward to hearing how it fares when used to solve
other dierential equations numerically. Future research will involve using the ideas
in this paper to attempt to derive other similar nite-dierence schemes.
References
[1] Buckmire R., The Design of Shock-free Transonic Slender Bodies of Revolution, Ph.D.
thesis, Rensselaer Polytechnic Institute, Troy, NY (1994)
[2] Cole J.D., and L.P. Cook, Transonic Aerodynamics, North Holland, (1986).
[3] Cole J.D., and N. Malmuth, Shock Wave Location on a Slender Transonic Body of
Revolution, Mechanics Research Communications, 16(6), (1989), pp. 353-357.
[4] Cole J.D., and A.F. Messiter, Expansion Procedures and Similarity Laws for Transonic
Flow, Z.A.M.P., 8, (1957), pp. 1-25.
[5] Cole J.D., and E.M. Murman, Calculation of Plane Steady Transonic Flows, AIAA
Journal, Volume 9 Number 1, (January 1971), pp. 114-121.
[6] Cole J.D., and D.W. Schwendeman, Hodograph Design of Shock-free Transonic Slender
Bodies, 3rd International Conference on Hyperbolic Problems, Editors Bjorn Engqvist
and Bertil Gustafsson, Uppsala, Sweden, (June 11-15 1990).
[7] Krupp J.A., and E.M. Murman, Computation of Transonic Flows past Lifting Airfoils
and Slender Bodies, AIAA Journal, Volume 10 Number 7, (July 1972), pp. 880-886.
[8] Scharfetter, D.L. and H.K. Gummel, Large-Signal Analysis of a Silicon Read Diode
Oscillator, IEEE Transactions on Electron Devices, Vol. ED-16, Number 1, (January
1969) pp. 64-84.