Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

10
INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING, VOL. 12, 1151-1 160 1978) IMPROVED FINITE DIFFERENCE FORMULAS FOR BOUNDARY VALUE PROBLEMS T. H. GAWAIN* AND R. E. BALL? Department of Aeronautics Naval Postgraduate School, Monterey California U.S.A. SUMMARY This paper deals with the numerical solution of linear differential equations of fourth order by finite differences. It points out significant but usually overlooked) errors which result from the conventional method o f imposing the boundary conditions in such problems. Revised finite difference formulas are derived which apply near th e boundaries and which eliminate the above errors. Three commonly encountered boundary conditions are considered. These correspond, in the terminology o f beam analysis, to a clamped end, to a simply supported end and to a free end. The improvement in accuracy that can be achieved with the revised formulas is illustrated by two representative examples. The revised formulas are shown to reduce the overall error of the numerical solution by a factor o f about five in a typical case. INTRODUCTION This paper deals with the app roximate numerical solution o f ordinary differential equations o f fourth order by the method o f finite differences. This well-known procedure is described in many standard texts of which Reference 1 s a representative example. T he reader is assumed to be generally familiar with th e technique. The aim o f this paper is to show briefly that the customary method o applying the boundary conditions in such problems involves a significant but usually overlooked error, and to provide revised boundary formulas which eliminate this error. A considerably more detailed analysis of this same basic material may be found in Reference 2. In this discussion 4 x) denotes the initially unknown function which is governed-by a known linear differential equation o f fourth order. Symbol D denotes the differential operator dldx. We seek a numerical solution which satisfies the specified boundary conditions at x = 0 and at x = Three common boundary conditions are considered and are labelled below according to the terminology used in beam analysis, namely, 4=0 (1) Clamped end D4=0 (1) 2) Simply supported end 4= 3) Freeend ~~9 = o 0029-5981/78/07 12 1 15 1 01.00 @ 1978 by John Wiley Sons, Ltd. 0’4 =O D2q5 = 0 (3) Received 1 February 1977 Revised 28 June 1977 1151

Transcript of Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 1/10

INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING, VOL.12, 1151-1 160 1978)

IMPROVED FINITE DIFFERENCE FORMULAS FORBOUNDARY VALUE PROBLEMS

T. H. GAWAIN* AN D R. E. BALL?

Department of Aeronautics Naval Postgraduate School,Monterey California U.S.A.

SUMMARY

This paper deals with the numerical solution of linear differential equations of fourth order by finitedifferences. It points out significant but usually overlooke d) erro rs which result from th e conventionalmethod of imposing the boundary conditions in such problems. Revised finite difference formulas arederived which apply near th e boundaries and which eliminate the ab ove erro rs.

Three commonly encountered boundary conditions are considered. These correspond, in theterminologyof beam analysis, to a clamped end, to a simply supported end a nd to a fre e end.

The improvement in accuracy that can be achieved with the revised formulas is illustrated by tworepresentative examples. Th e revised formulas are shown to reduce the overall err orof the numericalsolution by a factorof about five in a typical case.

I N T R O D U C T I O N

This paper deals with the app roximate numerical solutionof ordinary differential equ ationsoffourth order by th e methodof finite differences. This well-known procedure is described inmany standard texts of which Reference1 s a representative example. T he rea der is assumedto be generally familiar with th e technique.

The aim of this pap er is to show briefly that the customary m ethod of applying the bound ary

conditions in such problems involves a significant but usually overlook ed e rro r, andto providerevised boundary formulas which eliminate this error.A considerably more detailed analysisof this sam e basic material m ay be fou nd in R eferenc e2.

In this discussion4 x) den otes th e initially unknown function which is governed-by a know nlinear differential equationof fourth order. SymbolD deno tes the differential operator d ldx .

We seek a numerical solution which satisfies the specified boundary conditions atx = 0 andat x = Th ree common bounda ry conditions are considered and ar e labelled below accordingto the terminology used in bea m analysis, namely,

4 = 0(1) Clamped end

D 4 = 0 (1)2) Simply supported end

4 =

3) F r e e e n d

~~9= o

0029-5981/78/07 12 115 1 01.00@ 1978 by Joh n Wiley Sons, Ltd.

0’4 = O

D2q5= 0(3)

Received1 February 1977Revised28 June 1977

1151

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 2/10

1152 T. H. GAWAIN AND R. E. BALL

Table I. Conventional finite difference formulas

Simplysupported end

Free endAt station i = 1

1

h

D2d1 = 0

D34, = 0

D441 [241-442+243]-2D441+. ,h 4

D41 = - [-+1+&+0]-~hZD3c$1+.

(1.9)

(1.10)

(1.1 1

1.12)

(1.13)

(1.14)

(1.15)

1.16)

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 3/10

BOUNDARY VALUEPROBLEMS 1153

0-17)

(I.18)

1.19)

1.20)

In the finite difference analysis, the function 4 is represented by its discrete values pii = 1,2 ,3 , . . , N) at uniformly spaced stations x i over the interval 0 s x s . Constant h

denotes the spacing between any two successive stations. In this paper we let index i = 1denote the first station at which q5 is unknown and let index = N denote the last station atwhich 4 is unknown. Thus for a beam free at the left end, q 1 enotes the unknown deflectionat XI = 0. For a beam clamped or simply supported at the left end, however, cpl denotes theunknown deflection at the first station inboard of the end that is, at x l = . Analogousconsiderations apply to the quantity (PN at or adjacent to the right end. This conventionsimplifies the indexing of the final finite difference equations so that they always run from i = 1to = N, inclusive.

To determine the unknowns , 42,43.. . . +N, we rewrite the governing differential equa-tion in finite difference form for the ith station, then require that the resulting equation besatisfied for each of the stations i = 1,2 ,3 , , . , N. This produces N simultaneous equations in

N unknowns which suffices to establish the required solution. The actual manipulations arehandled most expediently in matrix format.

Except for the stations at or immediately adjacent to the boundaries, the various derivativesin the governing equation are usually approximated by the four conventional central differenceformulas summarized in Equations (I .l HI .4) of Table I. The term outside the brackets in eachequation represents the truncation error of the corresponding finite difference approximation.Notice that all four of the conventional central difference formulas shown in Table I havetruncation error of order h 2 .

When reduced to matrix format, the governing differential equation has a band width equalto the widest band of any derivative which appears in it. For a given order of truncation error,the derivative of highest order requires the greatest band width. Thus for a truncation error of

order h 2 , he final calculation matrix has a band width of five.The first four formulas in Table I may be applied routinely at interior stations, but specialproblems arise near the boundaries. It suffices here to illustrate the problem for the left end.Consider the case where the left end is either clamped or simply supported. Then at stationi = 1 immediately inboard of the end in question, the conventional central difference expres-sions for D and D2& involve the three quantities q50, , and . The corresponding centraldifference expressions for D3 and D441 nvolve the five quantities &I,&,, , 4 2 and 43.The quantities 41,& and 43 entail no problems. The quantity q50 vanishes for either a clampedend or a simply supported end and therefore involves no difficulties. The problem that nowarises, however, is that the quantity l lies outside the normal domain of integration 0 1,

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 4/10

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 5/10

BOUNDARY VALUE PROBLEMS 1155

represented by a truncated power series. The form of the series must be such as to satisfy theboundary conditions of interest as previously summarized in equations l ) , 2) or (3). Thenumber of terms which must be retained in the series depends on the order of the derivative tobe estimated and on the desired truncation error of the estimate. The truncated series

expression is applied to a number of contiguous stations near the end of the beam. This yields aset of simultaneous equations which can be solved for the initially unknown coefficients of theseries in terms of the quantities r l, 42, . . Once these coefficients are obtained in thisway, the desired derivative of q5 at the specified station may be readily determined from thebasic series expression. The result is the finite difference formula of interest.

By introducing an extra term into the series and retracing the original solution, the trun-cation error can readily be found.

The above process has been carried out for all of the conventional finite difference formulasof Table I which involve excessive truncation errors. The revisions are always such as to renderall truncation errors consistently of order h 2 .The results of this revision are summarized inTable 11. Notice that every formula in Table I whose error term is initially of order h 2reappears in Table I1 without change. Only the faulty formulas have been revised.

An interesting detail appears in equation (8) of Table 11. The truncation error term is seen toinvolve h2 but the numerical coefficient happens to vanish in this case. Hence the truetruncation error degenerates to order h3 in this particular instance, which is exceptional.It might be supposed that this circumstance would permit a reduction of band width herebut such is not the case for if the band width be reduced by one, the resulting truncationerror is found to be of order h not of order h 2 . Hence Equation (8) must be retained aswritten.

It has been convenient to present the boundary formulas in Tables I and I1 specifically forthe left end of the span. The corresponding formulas for the right end can readily be inferredfrom the foregoing results from considerations of symmetry. First we replace 41,42, 4 3 , andcP by the corresponding quantities 4 ~ ,5N-l, c $ ~ - ~nd 4 N - 3 respectively. In this connection

it is also convenient to reverse the order of corresponding terms from left to right so that theterms still appear in order of increasing index. Secondly, we must reverse all signs for thederivatives of odd order.

An important feature of Table I1 is that the boundary formulas for D4 4 at i = 1 nvolve notonly , dZ nd rP but also d4. This last term falls just outside the pentadiagonal format thatapplies at the other stations. The corresponding formula for D44 at i = N likewise falls justoutside the pentadiagonal limit. Fortunately, it is a simple matter to transform the finalcalculation matrix to a purely pentadiagonal form. This involves a straightforward auxiliarycalculation at i = 1 and another at i = N. These auxiliary calculations do not adversely affectthe truncation error of the final system of equations. Full details are given in Reference 2.

EXAMPLE: UNIFORMLY LOADE D BEAM WITH CLAMPED ENDS

Two examples have been worked out to illustrate the improvement in accuracy that occurswhen the revised difference formulas of Table I1 are used in place of the conventional formulasof Table I. In this section we consider a beam of uniform stiffness with clamped ends under auniform distributed load. In the next section we consider a beam of variable stiffness withsimply supported ends under a uniform distributed load.

For the uniform beam, the non-dimensional governing equation reduces to

D44 = 1

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 6/10

1156 T. H . GAWAIN AND R. E. BALL

Table 11. Finite difference formulasof consistent second order truncation error

Clamped end

1' - h

1

D 4 L-[O+$&+0]-$h2D3&+. .

D 2 4 ~ = i ; i [ - 2 ~ 1 + ~ Z + O ] - ~ h 2 D 4 ~ l + .

1' - h

1h4

D34 i? [ -34,+O+$43]-&h2D540+. .

D4& +--[16& -94,+f~ , -&~] (O)h2D6 0+. .

Free endAt station i = 1

(11.1)

(11.2)

(11.3)

(11.4)

(11.5)

(11.6)

(I1.7)*

(II.8)*

(11.9)

(11.10)

(11.11)*

(II.12)*

(11.13)

(11.14)

(11.15)

(11.16)*

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 7/10

BOUNDARY VALUE PROBLEMS 1157

At station i = 2

, 0+543+0] -2h2D3 +. 01.17)D4 ‘-I--

’ - h

11.19)*D34 - h 3 [[12 1 -? + ~ C J , 01 + ,h2D541 . .

II.20)*D44 ---[-B, +?24 -604 + - 629 2 6

Z - h 4 17 17 2 1 7 3 : % d ] - ~ h D A . . .

The asterisks denote those formulasof Table I1 which differ from the corresponding formulasof Table I.

and the boundary conditions for clamped ends are

4 =

D 4 = 0a tx=O and x = l

The exact analytical solution of these equations is simply4 = 1 2

e 2 4 ~1-x)’

(7)

Numerical solutions of this problem have been calculated firstly on the basis of the con-ventional finite difference formulas of Table I and secondly on the basis of the revised finitedifference formulas of Table 11. Results were calculated for three values of the importantdimensionless mesh size parameter h/Z, namely, values of 1/10, 1/20 and 1/40. The cal-

culations were performed in double precision on an IBM 360/67 computer. Further details ofthese calculations may be found in Reference 2.As convenient measures of the overall relative error of the final numerical solution, the

following two parameters are used, namely,

and

In beam problems expresses the maximum relative error in the calculated deflection whileS expresses the maximum relative error in the calculated curvature, and hence in the asso-ciated bending stresses.

Curves of E and S versus h / l are shown in Figure. 1.The results confirm that error parameter E is greater for the conventional difference

formulas of Table I than for the revised formulas of Table 11. Indeed, in this particularexample, E happens to vanish identically for the revised formulas Of course, such a completeelimination of all truncation error is exceptional. It can only happen for those special cases,like the present example, in which the true deflection curve happens to be a quartic. The curveis a quartic for any uniform beam under uniform load, irrespective of the boundary conditions.

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 8/10

1158 T. H. AWAIN AND R. E. BALL

1 ’

6

Uv

n

-2g 10

lxuwW

k-U

IW(L

1

lo3

0

RELATIVE ERROR E

RELATIVE ERROR 8per Tables I

f

h / l -+

11 0.1

Figure 1 . Errors of numerical solution for beamof uniform stiffness with clamped end s

By an interesting coincidence, the formulas of Tables I and I1 happen to give identical curvesof error parameter S versus h / l in this particular example. Inspection of the detailed solutionsreveals that the truncation errors represented by these two solutions happen in this particularcase to be equal in magnitude but opposite in sign

EXAMPLE: BEAM OF VARIABLE STIFFNESS WITH SIMPLY SUPPORTED ENDS

In this section we consider a uniformly loaded beam of variable stiffness, simply supportedat both ends. Specifically, we choose a beam governed by the non-dimensional equation

D2(x3D2q5) x3D495 +6x2D3d +6xD24 = 1 (11)

over the range

1 s x s 2

The boundary conditions for simply supported ends are

a t x = 1 and x = 2D2q5 = 0

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 9/10

BOUNDARY VALUE PROBLEMS 1159

The exact solution for 4 is

The finite difference equations for this problem were set up according to the conventionaland revised formulas of Tables I and 11, respectively. Each of these cases was solved numeric-ally for various values of the dimensionless mesh size parameter h / l . Each result was comparedwith the corresponding exact analytical solution of equation 4) for the same value of h / l . Therelative error E , as defined by Equation (9), was calculated for each solution. The second errorfunction 6, s defined in equation (lo), was not calculated for the present example. Furtherdetails of these calculations are given in Reference 2.

The calculated values of were plotted against h / l . The results are summarized in Figure 2.An interesting comparison of the results from the methods considered in this paper can be

made with the results of a study using the ‘half-station’ method, as presented in Reference 3.

iz

UI

fxw ‘I

W

I-

J

W

10-La

- 4

10

( 1 0.02 0.03 0.05 0.10h/L

Figure 2. Errors of various approximations for beam of variable stiffness with simply supported ends

8/10/2019 Improved Finite Difference Formulas for Boundary Value Problems by T.H. Gawain and R.E. Ball (1978)

http://slidepdf.com/reader/full/improved-finite-difference-formulas-for-boundary-value-problems-by-th-gawain 10/10

1 160 T. H. GAWAIN AND R. E. BALL

In the half-station method the finite difference approximations are made before expanding thederivatives in D2(x 3D24) s opposed to the conventional or whole-station method, whereinthe finite difference approximation is made after D’(x2D24) is totally expanded. It issignificant that the conventional finite difference approximation for the simply supported

boundary condition at each end of the beam was used in Reference 3. The relative errorE ,

asdefined by equation (9), produced by the half-station method for this example was found to be

e = (0.4 X 10-2/0*4196 lo-’) (h/1)’ (15)

where the value 0.4 x lop2 s obtained from Figure 3 of Reference 3 and 0.4196 X lo-’ is thedisplacement of the beam at the centreline. This expression for E was verified by a numericalsolution of the half-station equations for several values of h / l . The error given by equation15) is plotted in Figure 2 as the line marked H.

Figure 2 permits some interesting and useful conclusions to be drawn. Like the previousexample, it again confirms that the conventional finite difference formulas of Table I give byfar the highest error. The revised formulas of Table I1 are seen to reduce the above error by afactor of approximately five. Notice that the half-station method of Reference 3 involves anerror whose magnitude is intermediate between those associated with the formulas of Tables Iand 11.

SUMMARY OF RESULTS AND CONCLUSION

It has been shown that the conventional finite difference formulas for approximating thederivatives of a function near a boundary have truncation errors of various orders, and thatsome of these errors can become relatively large. Revised formulas are derived havingtruncation errors all of which are consistently of second order. Two typical examples arepresented which show that the revised formulas reduce the solution error by a significant factor(of the order of five or better) with negligible increase in the overall computational burden.

One of these cases is also solved by the so-called ‘half-station’ method, and the resulting erroris found to be intermediate between those obtained by use of the conventional and reviseddifference formulas.

It is concluded that the revised formulas presented in this paper are optimal for the solutionof differential equations by finite differences.

REFERENCES

1. S. H . Crandall,Engineering Analysis: A Survey of NumericalProcedures,McGraw-Hill, N ewYork, 1956.2. T. H. Gawain and R. E. Ball, ‘Improved finite difference formulasfor boundary value problems’,Tech. Report

3. N. J. Cyprus and R. E. Fulton , ‘Finite difference accuracy in structural analysis’,J. Struct. Diu ASCE 92,459471NPS67Gn77051A. Naval Postgraduate School, Monterey C A(1977).

(1966).