19
119 THE METHOD OF LINES - THEORY, SOFTWARE AND SOME APPLICATIONS In a recent review of softwaJCe for the nm!lerical solution of partico.l differential PDEs}, Machura & sweet [11] assert that the method of line:o (MOL) is the most: popular technique for sol1:ring sys-l::C!!IS of tilli'!e- dependent PDEs, The li!:OL is a direct and practical co1tsequence of extensive research on the nUJr!erical solution of ordinacy diffential equations, A number of robust and user-friendly software interfaces are now available to implement the method, and this note describes the application of one such interface ( PDEONE, SinCO'IJ'eC & Madsen, [ 15] ) to t:h:ree comsult:ing problems" The results confirm that -the MOL is a valuable consequence of pas'c mathematical development, l, INTRODUCTION The numerical solution of partial differential equations (PDEs) is a :!:n:ead-and-bu-tter issue in applied mathematics and mo!:it branches of the phy- sical and engineering sciences. Many of the PDEs require a nlli'!lerical solution are (possibly systems of) parabolic !?DEs for 'W'hich 'che method of lines ( is ideally sui ted. T'"ne is based on semi -discretization: the conversion of PDE:s into a set of ordinary differential equations (ODEs). 'l'b.ere are many t<i'ays available for and the utility of all the methods derives from highly developed and robust software for the numerical soltrtion of ODEs, Thus the JiliOL a widely used and obviously practical

THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

119

THE METHOD OF LINES - THEORY, SOFTWARE AND SOME APPLICATIONS

In a recent review of softwaJCe for the nm!lerical solution of partico.l

differential cquatio~s PDEs}, Machura & sweet [11] assert that the method

of line:o (MOL) is the most: popular technique for sol1:ring sys-l::C!!IS of tilli'!e­

dependent PDEs, The li!:OL is a direct and practical co1tsequence of extensive

research on the nUJr!erical solution of ordinacy diffential equations, A

number of robust and user-friendly software interfaces are now available to

implement the method, and this note describes the application of one such

interface ( PDEONE, SinCO'IJ'eC & Madsen, [ 15] ) to t:h:ree comsult:ing problems"

The results confirm that -the MOL is a valuable consequence of pas'c

mathematical development,

l, INTRODUCTION

The numerical solution of partial differential equations (PDEs) is a

:!:n:ead-and-bu-tter issue in applied mathematics and mo!:it branches of the phy­

sical and engineering sciences. Many of the PDEs ~1hich require a nlli'!lerical

solution are (possibly systems of) parabolic !?DEs for 'W'hich 'che method of

lines ( :!o~OL) is ideally sui ted. T'"ne !~OL is based on semi -discretization:

the conversion of PDE:s into a set of ordinary differential equations

(ODEs). 'l'b.ere are many t<i'ays available for thi~:~, and the utility of all the

methods derives from highly developed and robust software for the numerical

soltrtion of ODEs, Thus the JiliOL ~ a widely used and obviously practical

Page 2: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

120

re9earrc~h leadel ·to an &.rifpx:oach w11icl1. :illl quite diff•eEent~ to m.t."!l.exical sc:iT,•aiiilJelil

ba.sed on ·cJt:adtticonal finlte d:i.ll'fe]:·r.:nM::es. More recem't:ly, nuzw.ertc:I'J.l analysts

l, t:

Page 3: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

121

under boundary conditions

at :11': = 0, 1

and the initial condition

(2,lc) u( x, o)

ih, i h

in ( 2, la) are replaced by second oJCder central diffenn·,ce approximatiol'la,

tl!'le t }1 satisfy th-9 sy~tem of ODEs

(2,2a) d'iJ'

i

dt f

·t) and

'I ·-2v +v ! i-1 i i+l.j

' ~ h~

on•a·-sided difference approximations for

v 1 rv2 1 l .

,2c) 0) = g(

u ' =~

Page 4: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

122

N+1 (2. 3) u(x,t) I: C.(t)b.(X)

i=O 1 1

N+:!. where the {bi(x)}i=~ fo~ a suitable basis (e.g, Fourier series, orthogonal

N+l . pol.ynom:ia.l.s or lB-splines ) • ODES for the { C i ("!:)} i=O ou:e then obt:!!!.J.ned by

ari·thll!etizing the spatial variation using some form of the IIM!rthod of

o:f lines :i.s g::i.ven by Machura & £:Meet ( [ 11] , section 12 ) . The present worlt

is concerned with one of the earliest and possibly the best knO'irm of these

- l?DEONE ( Sincovec & lii:adaen [ 1.5] ) • l?DEONE follows the basic structure for

sUbject to boundary conditions

(2.4b)

and in:i.tial conditioLF!

(:L4c)

at

·t ) t 0 , k = 1,:2, , , • ,!llPDE),

T ul!!PDE] '

complete algori•l:hm for PDEONE consisting of only 153 lines of code is

freely a•.raila.ble [ 15] . The user merely has to writ;e a oriver prograll!ll and

Page 5: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

123

three subroutines defining the boundary conditions ( 2. 4b), the diffusion

coefficients !?k and the function ! in ( 2. 4a). PDEONE then performs the

discretization - on a variable mesh if desired - and GEARB solves the

resulting ODE initial value problem with automatic timestep control to

achieve a specified accuracy. Both PDEONE and GEARB are written in FORTRAN

and the computations described subsequently in this note were performed in

single precision on a~ 11/750.

3. TRANSMISSION LINE PROBLEM

The first problem discussed is the quasi-linear parabolic PDE

(3.1a) ae 1 a ae

'Y(fJ)c(f})at- rar<k(fJ)rar> + Q(r,fJ)

for the temperature 9(r,t) in a solid metal conductor carrying an electric

current. Here the temperature dependent coefficients are given by

(3.lb) 'Y(9)- 'Y0(1 + 09)

c( e > = c 0 c 1 + pe >

-1 -1 (thermal conductivity, w m K ),

-3 (density, kg m ),

-1 (specific heat, J kg K),

and the problem is to be solved subject to the initial and boundary condi-

tions

(3.1c) 9(r,O) - 0,

(3.1d)

The heating function Q(r,9) is defined by {Dwight, (7], p.159)

(3.1e)

where

(3.1f)

Q(r,9) -I J(r,e>l 2p(fJ)

Im ber mr + i bei mr J( r' e ) = 27Ta bei. ma - i ber. ma

Page 6: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

124

and I is the total current (A), a is the outer radius ( m),

V2 -1 m = {27TfP.P.c/P(6)} (m ), f is the frequency (Hz), p(6)- p0(1 + a6) is

the temperature dependent resistivity (Om), p. is the relative permeability

of the conductor (dimensionless), p.0 is the permeability of free space (0

-1 sec m ), and {ber, bei} are the Kelvin functions (Abramowitz & stegun,

[1], section 9.9).

The problem ( 3 .1) required a numerical solution for a number of dif-·

ferent conductors for various values of the parameters h and q in the boun-

dary condition (3.1d). (This boundary condition is an empirical model of

heat dissipation by convection under various ambient wind conditions as in

Morgan, [14]). A separation of variables solution of problem (3.1) is pos-

sible if the temperature dependence is neglected in the coefficients (3.l.b)

and the heating ( 3 .1c) and if the index q in ( 3 .1d) is unity. This ana-

lytic solution served as one check on the program. A further check on the

complete program with all temperature dependent terms retained was that the

heat input should balance the surface dissipation in the ultimate steady

state. In all applications, this balance was accurate to within 0.2%.

once the heating function Q( 6, t) was understood and coded, it took

less than a day to design and implement a numerical solution of problem

( 3 . 1 ) using PDEONE • AS expected, the execution speed of the program

depended on the method chosen in the ODE integrator GEARB : with the best

setting for the method flag ( MF), the MOL solution computed the initial

temperature rise 40 times faster than a forward time centre space ( FTCS)

solution of comparable accuracy; whilst the worst setting for MF gave an

execution speed about 4 times slower than the FTCS solution.

The execution speeds are summarized in Table 1, and typical values of

Page 7: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

125

the surface temperature are plotted in Figure 1 for various values of the

index q in the boundary condition (3.1d). It should be noted that the exe­

cution speed of the MOL solution for a given accuracy depends on the

automatic timestep control available in GEARB, and the timesteps become

bigger once the initial heating is over. This feature is not available in

the PTCS solution.

Table 1. comparison of c.p:u. time for the numerical solution of problem

(3.1) for the first 60 seconds heating in an aluminium conductor. Proper­

ties and constants as in the legend for Figure 1; € is the error control

setting on GEARB, MP denotes the method flag in GEARB.

method c.p.u. time (s) time step comments

PTCS 126.5 0.01 timestep for stability

MP=10 510.2 0.006-0.032 10 -1

less accurate than PTCS

MP~12 12.0 0.287-3.20 l.0-6 superior accuracy to PTCS

MP=l.2 3.0 3.98-16.9 10 -4

superior accuracy to FTCS

MP=13 53.4 O.l.l.4-1.01 10 -5

comparable accuracy to PTCS

MP-20 502.0 0,005-0.034 l.0-1 less accurate than PTCS

MP=22 3.5 3.99-9.83 10 -4

superior accuracy to PTCS

MP=23 24.4 0.037-4.32 l.0-5 comparable accuracy to FTCS

Page 8: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

126

10 20 30 40 so time (minutes)

(),

(C) q- 1.10, (d) q = 1.15, (B) q = 1.20 (f) q = 1.25.

Page 9: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

127

qu~si-linear parabolic PDEs

(4.lb)

a;cl

2 - ax' 2\lJ:r

a2c 2

~~hich describe the concentration o:f ·two specie<~ of :i.on:lll in a col.!..mm of

rn the

·the amotmt of tt;e ions adsorbed onto soil particles as a function of con~

centratiml. A description of the process is given by ~&arbeneau [6] and

Barnes & Aylmore ( z] reduce 'che general problCIIII to the fonn ~;~iven by

( <¥t.la,b).

In the presen'c application, the adsorption isothe:rnw are taken to be

(4. 2a)

(l;. 2b)

the boundaLJf conditions are set to be

( 4. 2c)

( 6.' 2d)

O,t) ~ 0,75,

C (X ,t:) ~ 0 2 w

X

be solved subject to the inH:ial conditiorns

(4.2e) 0.25, 0.25.

Equa:tions (ilk. ~a. b) i'Moed to be cast in the form of ( 2.. 4a) prior to using

l?DEONE, and this is achieved by forming suitable linear co!!:!.bina.tions of

('l.l.a,b). Thus, the PDE:s to be solved are found to be

Page 10: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

wi"l:h

(b,., 3e)

ac ].

ae: " 0

,,,, ""

128

:LO,, 0,

Page 11: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

129

l:hc botlndary am:! inj_·i:ial condH:ions.

= l. :&L a.re shown in l"igm:e 2.

lOG [

1.00

0.75 "' 0. 75

&.,.~·

0.50

0.25

o.sc

J~·l'"'''"''"'""'·""" ,.,.

/1 '\j( l{ //\,

/ _,r · . .,\""'--(} 1<'-"_..,J' '~~_..,

~u":p<f/1" 'tt-

' ,_~ ... """'""""" ... ~""""'-' ~~"'' 0.25

1·~--~~,_1-~.~~.Ji-~~~~j 10 zo :;o 40 so 60

tir.l0

l.OO

/' ""'"""""''""" ... "'"--"''"""'

I .. ~-"'"'« ,f

.,.l~ "<;..,.

I \/ I 1\

/ ,~i \ ~· / o~"cP"_..,=--=' \

![ l"' \.~ 0.25 t-~-~~-_.1"· -~--·

it

l .. ~c..~~·'···-'-~'·----db~-~-ll--"---·..i"--·"··--.1 10 20 30 40 50 60

tim~

I !-~-"?'""'"'"""'~~-~~,..}.fi,""~"-.. ,~-~n .... ~.~

lfl 7.0 30 4ll so 5() tim~

Page 12: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

130

Figure 2. Breakthrough curves for c1 , c 2 and c 0 = c 1 + c 2 at x = L for the

solutions of problem ( 4.1) subject to conditions ( 4. 2a-e),

9 = 0,25, o2 .. 1.0, L • 150, X • 240: co

-6 € = 10

Top left, NPTS•61, c.p.u. time 179 sec; top right, NPTS=61, first deriva-

tive in PDEONE calculated using upwind differences, c.p.u. time 206 sec;

bottom left, NPTS=121, c.p.u. time 565 sec; bottom right, NPTS=241, c.p.u.

time 1623 sec.

Table 2. Comparison of c.p.u. time taken for the first 5 seconds of a test

numerical solution of problem (4.1) using 16 points and with xco = L = 7.5,

-3 € (error tolerance in GEARB) is 10 , 9 , - o. 25, o2 = 1, MF denotes the.

method flag in GEARB.

non--stiff options stiff options

MF c.p.u. time (sec) time step MF c.p.u. time (sec) ti.J!lestep

10 112.6 0,006-0.009 20 117.9 0,006-0,055

12 15.8 o.no-0.323 22 21.5 0,101-0,368

13 76,9 0,005-0.129 23 124.7 0.012-0.041

5 • COMPU'rATIONAL SHEAR DISPERSION

The final problem investigated is the parabolic PDE in time and two

space dimensions

(S.la)

subject to the boundary conditions

(S.lb)

(S.lc)

ac = o at y.±Jh. ay c, ac ... o as I ~ .. co

ax

Page 13: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

131

and the initial condition

(S.ld) C(x,y,O) = O(x).

These non-dimensional equations describe the dispersion of a passive con-

taminant instantaneously injected into laminar flow between two flat plates

at y=±.V2. The co-ordinate x is measured in a frame moving at tho discharge

speed of the flow, and P is the Peclet number of the flow. This problem is

a well known one in fluid mechanics and further references and the large

time asymptotic behaviour have been given by Smith [16].

Problem ( 5 .1) cannot be solved by PDEONE as it stands. Rather the

Fourier transform

-.V2 C( ). , y, t) • ( 27r)

co

J eHXc(x,y,t)dx -co

is taken, and the symmetry of the solution about y-o is used to derive cou-

pled PDEs for the real and imaginary parts of c-cR+ic1 in O<y<.V2, that is,

(5. 2a)

(5.2b)

subject to

(5.2c)

(5.2d)

acR -- = at

ac1 ---at

A

ac ay = o at y-o, .V2,

A -.V2 C( ). , y, o) = ( 27r) for all ).,

This problem (5.2) was solved numerically NLAM times for ). values between o

and ).max inclusive, and the solution C(x,y,t) was obtained by a numerical

inversion of the Fourier transform. It was an easy matter to implement the

numerical procedures and results for low values of tho Peclet number were

Page 14: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

132

for ll1'=1000 an<fl :::!3: '7arious t:iAtes afte:c injecticm of CO!J:I:aE!Iill'l1llXi:,

90

70

50

30

LO

Figu:1:e 3,

P=JLOOO.

r ! t ~ i r I r 1-

~ I L I

Page 15: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

133

of the co-,r,lputa:!.:ion aritd "the quality of the resul"l::s,

cal solution agreed well 'c>iith an asy!!lptotic ~>olu'i::ion pus],

Gibbs ripples.

S. DISCUSSION

Sincovec ,s; I<Jiadsen [ JL5] begin their gem~:!:etl comraeJrrt:iJ em PDEON:E with "t~e

suppor·t:s t:hese claims~

L'! not readioly (if a·i: .s.l1) &cvailab1e".

Page 16: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

134

Sincovec, [13]) for problems with two space dimensions, PDECOL (Madsen &

Sincovec, [ 1.2] ) l>fhere the spatial ap_proxim<!.tion ia by :!!!-splines, and FORSIM

V'I (carver et aL , [ 5] ) with opt~"ons for Ii!ore sophist:icate\lil ( e, g. upwitl!.d)

rUfferencing,

problems from l?DEONE and a aetai.1ed comparison of thei:~: relative efficiency

has not been attempted.

For compurting efficiency, it is essential to «l:m:ploi:t the struct;ure of

!ch•Z! systelil~ of .ODEs by using a.n ODE int:egprcrtor design<E.;d for banded syiBltems ,

For robustness, it is also esse!'1:tial tha:t ·tl~e ODE i!]·!:egr.;:~:l!:or hi.!.i!l a st:ii.:t::r:

opt:ion ~ even ·thou~h the fasrbest e..:e.::u~.:io11 speeds fear the p:~:oblsrolls d\EH:J>::r:ii..beGSl

above '\'l'ere olrtaine!'l using non-stiff ille·thods). on the eff:.i.c:i.ency of PDEOI!IE,

Sincovec Iii Madsen remar!c ·that "General purpose sof·tware such as PDEONE is

t;ypically ai111e6l at redu.cing th6 'human time • !!pent rather th~m computer

time,

t:o::ans111d.seion line pr•:~lblem, as with m;;:my problelili!l, it was impn\ctical to

develorp an i~upl.ici t 111ethod of :!!olvrti~:>n toJlr<.ich '•Jouli& permit lo!llger times·t.eps,

For such cases, it i!:! hardly ~;;--.:n:tl!'I1n?h:i.le ·t:r.<)'ing bo de'felop a be't;"b:!r illei;hod

of solution than Pl:JIEO!.'l'E/G~. Finally, ·J:he hybrid approe.!.Ch to '!:~he shear

clisper:sir.m exru!!ple discusaced in Sec·tion '5 shows 1!J;!Ol.il1 the flexibilit;y of

the \li.IOL !l.nd fr.he possib:i.lity of usiv.g :i:t ili.IBI a building lblock in solving com·

plicated p:rccblems.

The a.u·thor wcml.d like ·to thalllk Dr J .H. Knight for hill! ger;erous assj.s­

tance '>Ji th many aspects of this work,

Page 17: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

135

[l.] ~1!. 1\bramow:itz aiC~d I.A. stegun, Handbook of IIMlthematical functions,

Dover, New York, 2965.

[ 2] c, J. :sar1~es and LoA. G. Ayll.Jl:tore, A theoretical treatment of the

effects of ionic and non~ionic competitive adsorption during solute

tranl!lpor'c in soils, Aust. J". Soil. Res. to appear.

[3] ~L Biertelrnlan and r. Babuska, '!'he finite elell!llent Method :for parabolic

equaticms:, 1. A po::rteriori error e::rti!llatior<. tiiumer. Math. 40 i l91'12a l

f4) M. Bieterman and I. Babuska, The finite element method for parabolic

equations, :n. 6". posteriori error es·timat.ion and adaptive approach,

Numer. E•!ath o 40 0.982b l :373-406.

[ 5) r"l, carver et al. , The FOl".SIM VI simulation package for t:he <!J.Itomated

solution of arbitrarily defined parcial differential and/or ordinary

differential equation systems.

Laboratories. ont:ario. canada. 1.971:1.

method of characterist:ics for the case

~r:i:thout dispersion, Water :Resources Res. J.7 ( 1.98:1.) '705-7131.

[7] H.B. DY1ight, Electrical coils and conductors, McGraw-Hill, Ne~ York.

).9~5.

[a J G. Fairwea:ther and A. v. Saylor, on ·the application o:f extrapola:l:::ion,

deferred cor1rection and defect correction to discrete-'time Galerld.n

Page 18: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

136

[9] D. Gottlieb and S.A. Orszag, Numerical analysis of spectral methods,

SIAM, Phi1ae1phia, ~977.

[~OJ A.C. Hindmarsh, GEARB : solution of ordinary differential equations

having banded Jacobian, Rep. UCID-30059, Lawrence Livermore Lab.,

Livermore, Calif., ~977.

[~~] M. Machura and R.A. sweet, A survey of software for partial differen­

tial equations, ACM Trans. Math. Software 6 (~980) 46~-488.

[~2] N.K. Madsen and R.F. Sincovec, PDECOL, general software for partial

differential equations, ACM Trans Math Software 5 (~979) 326-35~.

[~3] D.K. Melgaard and R.F. Sincovec, General software for two-dimensional

nonlinear partial differential equations, ACM Trans Math Software 7

(~98~) ~06-~25.

[~4] V.T. Morgan, Rating of bare overhead conductors for continuous

currents, Proc. IEE ~~4 (~967) ~473-~482.

[~5] R.F. Sincovec and N.K. Madsen, Software for nonlinear partial dif­

ferential equations, ACM Trans Math. Software 3 (~975) 232 ·260; PDE­

ONE, solutions of systems of partial differential equations, ACM

Trans Math. Software 3 (~975) 26~-263.

(~6) R. Smith, A delay-diffusion description for contaminant dispersion,

J, Fluid Mech. ~05 (~98~) 469-486.

[~7] v. Thomee and L. B. Wahlbin, Maximum-norm stability and error esti­

mates in Galerkin methods for parabolic equations in one space vari­

able, Numer. Math. 41 (~983) 345-37~.

Page 19: THE METHOD OF LINES - THEORY, SOFTWARE AND SOME …

137

[ l.S J M. Th. van Genuchten and W. J. Al.ves, Analytical solutions of the

one-dimensional convective-dispersive solute transport equation,

Tech. Bull. 1.661., u.s. Dept. Agric. Res. service, 1.981..

Division of Mathematics and Statistics C.S.I.R.O. PO Box 218 LINDFIELD NSW 2070