Frontal solution program for unsymmetric matrices · The program is written in FORTRAN and a...

21
INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING, VOL. 10, 379-399 (1976) FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES P. HOOD Department of Applied Mathematics, University of Reading, Englan& SUMMARY A frontal solution program is presented which may be used for the solution of unsymmetric matrix equations arising in certain applications of the finite element method to boundary value problems. Based on the Gaussian elimination algorithm, it has advantages over band matrix methods in that core requirements and computation times may be considerably reduced; furthermore numbering of the finite element mesh may be completed in an arbitrary manner. The program is written in FORTRAN and a glossary of terms is provided INTRODUCTION The frontal solution technique first devised by B. M. Irons,' and based on the Gaussian elimina- tion method, has proved a very effective means for solving the positive definite matrix equations arising in the finite element method. However in certain the finite element matrices are unsymmetric, and for these cases a slightly different technique has to be adopted, since there is no guarantee that diagonal pivoting will be stable. Consequently some form of column and row search is necessary to establish the pivotal element for the elimination process. Nevertheless a frontal concept may still be used, and the program described here has many features in common with the symmetric program. In formulating the program philosophy, three factors were considered : (i) the amount of computer store available; (ii) the number of non-zero entries in the matrix equations encountered; (iii) the pivotal choice. It appeared desirable, in choosing the specifications for the present program, that it should be designed so as to be accommodated on medium sized computers, and also be capable of handling large finite element analyses where the number of non-zero entries might well be of the order lo6 (e.g. a 3-dimensional problem typically has 5,000 variables and a front-width of 200). are clearly unable to comply with such design limitations, since at least one integer and one real storage location have to be allocated to each non-zero entry of the matrix. Consequently while ideally it is desirable in the interests of accuracy and stability that all the non-zero entries of the matrix be held in core, available for the pivotal search, the vast core requirements associated with such a process effectively prohibit this possi- bility. An alternative strategy is to accept some form of restriction on the pivotal choice; the compromise solution adopted here is to retain only part of the matrix in core at any given time, and to choose the largest pivot from this particular area. Existing sparse matrix t Research Fellow. Formerly Civil Engineering Department, University College of Wales, Swansea, Wales. Received 25 February 1974 0 1976 by John Wiley & Sons, Ltd. 379

Transcript of Frontal solution program for unsymmetric matrices · The program is written in FORTRAN and a...

INTERNATIONAL JOURNAL FOR NUMERICAL METHODS IN ENGINEERING, VOL. 10, 379-399 (1976)

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES

P. HOOD Department of Applied Mathematics, University of Reading, Englan&

SUMMARY

A frontal solution program is presented which may be used for the solution of unsymmetric matrix equations arising in certain applications of the finite element method to boundary value problems. Based on the Gaussian elimination algorithm, it has advantages over band matrix methods in that core requirements and computation times may be considerably reduced; furthermore numbering of the finite element mesh may be completed in an arbitrary manner. The program is written in FORTRAN and a glossary of terms is provided

INTRODUCTION

The frontal solution technique first devised by B. M. Irons,' and based on the Gaussian elimina- tion method, has proved a very effective means for solving the positive definite matrix equations arising in the finite element method. However in certain the finite element matrices are unsymmetric, and for these cases a slightly different technique has to be adopted, since there is no guarantee that diagonal pivoting will be stable. Consequently some form of column and row search is necessary to establish the pivotal element for the elimination process. Nevertheless a frontal concept may still be used, and the program described here has many features in common with the symmetric program.

In formulating the program philosophy, three factors were considered : (i) the amount of computer store available; (ii) the number of non-zero entries in the matrix equations encountered; (iii) the pivotal choice.

It appeared desirable, in choosing the specifications for the present program, that it should be designed so as to be accommodated on medium sized computers, and also be capable of handling large finite element analyses where the number of non-zero entries might well be of the order lo6 (e.g. a 3-dimensional problem typically has 5,000 variables and a front-width of 200).

are clearly unable to comply with such design limitations, since at least one integer and one real storage location have to be allocated to each non-zero entry of the matrix. Consequently while ideally it is desirable in the interests of accuracy and stability that all the non-zero entries of the matrix be held in core, available for the pivotal search, the vast core requirements associated with such a process effectively prohibit this possi- bility. An alternative strategy is to accept some form of restriction on the pivotal choice; the compromise solution adopted here is to retain only part of the matrix in core at any given time, and to choose the largest pivot from this particular area.

Existing sparse matrix

t Research Fellow. Formerly Civil Engineering Department, University College of Wales, Swansea, Wales.

Received 25 February 1974 0 1976 by John Wiley & Sons, Ltd.

379

380 P. HOOD

With this strategy it is possible to use either a ‘band’ or a ‘frontal’ method. However, in spite of their slightly greater complexity, frontal routines are to be preferred, since they are in general faster and require less core than band routines. In addition it is not necessary to apply a stringent node numbering scheme. For these reasons the frontal technique was chosen, and this paper describes the program which has evolved as a consequence.

THE FRONT PHILOSOPHY

The essential concepts behind the frontal solution method were previously presented in the original paper by Irons.’ Nevertheless, since there are important differences between the sym- metric and the present unsymmetric routine, it is necessary to repeat some of the discussion. The method will be viewed from the position of an analyst schooled in band matrix terminology, in order to illustrate more clearly the processes associated with the frontal routine.

First of all, a very brief sketch of the operations performed in the present program may be helpful. The frontal routine starts by assembling each of the element stiffness matrices in turn into core, until the core area allocated to the solution routine by the programmer is filled. Then, from within this assembled part of the complete matrix, a pivotal search is made to determine the largest entry from amongst those rows and columns which are fully summed, i.e. rows and columns to which no further contributions will arise in subsequent assembly of element stiffness matrices. The pivotal row is then used to eliminate all of the coefficients in the pivotal column, after which it is placed on backing store disc. When sufficient coefficients have been eliminated, it is possible to assemble the next element stiffness matrix, after which further elimination may take place. When finally all the coefficients have been eliminated the solution is obtained by a back-substitution routine.

To demonstrate some of these procedures, the three-element five-node mesh shown in Figure 1 will be considered, and in discussing the solution routine it will be supposed that all the equations are stored in the order of ascending node number. The totality of finite element equations will be written :

where [A] is a linear matrix of coefficients of the vector {x}, and {b} is the right-hand side vector. After assembly of the first element equations the state of this matrix equation is as follows:

“{x) = {b} (1)

Figure 1. Three element mesh

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES 38 1

where superscript I denotes the element number from which the matrix entry was derived. Now because the accounting process of band routines typically notes only the lowest and highest node numbers associated with each element, then elimination of x, can occur only when the contributions to the coefficients of x3 are completed. This point is not reached until assembly of the next element equations takes place. However with the frontal algorithm the precise state of each equation is noted, and because at this stage contributions to x, are completed (row and column 1 are fully summed), then a, , may be used as a pivot to eliminate x, . Equations (2) and (3) which are not yet fully summed may not be eliminated until further assembly of element equations (see Figure 2).

- FULLY SUMMED x INCOMPLETE

Figure 2. Typical arrangement of matrix entries

This illustrates the first difference between the frontal and band routines. For frontal routines each equation can be eliminated at an earlier stage than in band routines-as soon as it is complete-due to the superior accounting process. Consequently core requirements are in general less for frontal routines.

Another effect of the frontal accounting process is that it allows both column and row pivoting without excessive non-zero entry growth. This may be illustrated by carrying out the elimination of x, , which leads to the following:

Subtraction of the Gaussian products does not increase the storage required, since no terms are involved other than those found in equation (2). In this illustration of course there would be no non-zero entry growth even with a band routine; however if for example nodes 1, 2, 3 had happened to be numbered 5,6,2, then there would have been considerable growth with a band matrix algorithm. In frontal routines the equations are stored in the order in which they are formed, and thus in this case it would merely record that the first equation was in fact from node 5, the second from node 6, the third from node 2. As a result of this the final distinctions which may be drawn between frontal and band routines are that, because frontal routines store equations in the order dictated by element rather than nodal numbering, non-zero entry growth is not a problem, and furthermore nodal numbering of the finite element mesh may be done in an arbitrary manner since no significance is attached to the node numbers.

With regard to a typical finite element mesh, with element numbering as shown in Figure 3, it is clear that the only equations which must remain in core at any stage correspond to those equations in each assembled element which are not yet fully summed These in fact lie on the front (which is indicated in the diagram) and are awaiting full assembly, but their Gaussian products may be subtracted meanwhile. As the elimination progresses this front proceeds through the

382 P. HOOD

ACTIVE VARIABLES f

ELIMINATED VARIABLES-

= FRONT - --- NEXT ELEMENT TO BE ASSEMBLED

Figure 3. Progress of FRONT through a finite element mesh

mesh. Equations behind the front have either been eliminated or are awaiting selection as a pivotal equation, while those forward of the front are not considered at all until the front reaches them.

In order to minimize core requirements the element numbering is chosen in such a way as to keep the 'front width' as small as possible. In addition further core is required for the assembly of the next element's equations. Any core allocated in excess of these requirements will permit more fully summed equations (behind the front) to be retained in core and consequently allow greater pivotal choice.

Suppose now that the equations from the next element are assembled, so that the matrix equa- tion becomes :

a22-- a i l 4 2 +a:', a i 3 - - a: 1': 3 +a!, ai4

ai2 -- 4 1 4 2 +a!, a:3-- a!31a:3 +a:', aY4

I

a: 1 a: 1

a: 1 a: 1

x2

x3

x4 . .

From this it may be observed that although equations (2) and (3) were altered before they were fully summed, the terms subtracted involved only those components involving node 1 which were complete. So in common with symmetric frontal programs, Gaussian products may be subtracted from each row before it is fully summed.

PIVOTAL CHOICE

In the example above, the solution procedure fails if the pivot a: is zero. Since ,this is an un- acceptable feature, it is necessary to examine how such an occurrence may be avoided in practice.

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES 383

The number of fully summed rows and columns held in core governs the amount of pivotal choice, and hence the risk of a poor pivot. Thus sufficient core has to be allocated to the solution routine to allow a reasonable choice of pivots.

The pivotal choice discussed here is a version of total pivoting which involves only a limited part of the matrix. In normal practice total pivoting is avoided in favour of other scheme^.^'^ The disadvantages of total pivoting are that pivotal-search time is higher, and non-zero-entry growth is often larger (with the associated increase in computation time and round-off error) than that involved in partial pivoting. With the frontal routine, however, the core requirements are quite independent of the mode of pivoting and in a method where pivotal choice is likely to be somewhat restricted due to core limitations, it would be positively undesirable to further reduce the choice by adopting, for example, a partial pivoting scheme.

PROGRAM DETAILS

The program consists of three subroutines named FRONT, RESOL and BACSUB cf. Appendix I1 pp. 393, 398, 399. In FRONT the Gaussian elimination procedure eventually produces from the matrix [A] (cf. equation (1)) the lower and upper triangular matrices [L] and [U] respectively, with

[vl {XI = [LI- {b) (4) The solution is then obtained in BACSUB from equation (4) by a back-substitution process.

For more than one right-hand vector {b}, with identical matrix [A], it is desirable to have a re-solution facility, and this has been provided in subroutine RESOL. This routine modifies the new right-hand vector in the same way as would FRONT, without the expense of reprocessing the [A]-matrix.

In considering the details of the program structure, the three-element mesh of Figure 1 will again be used. However it will now be assumed that there are three degrees-of-freedom at each of the five nodes, and not a single one as assumed earlier. The first operation on entry to sub- routine FRONT is a ‘prefront’ process, in which the last element containing each node is noted. This then indicates in the assembly/elimination process when the contributions to a row are completed.

Each node of the mesh possesses a unique node number. These numbers are stored in an element nodal number array NOP (cf. Appendix I for a glossary of variables), which is a two-dimensional array. The first argument is the element number, and the second argument locates the node numbers occurring in the element. The technique used here, to indicate when equations are fully summed, is to code the entry of the NOP array with a negative sign in the last element in which the node appears. The NOP array before and after this prefront process is shown in Figures 4(a) and 4(b). It may be observed that the node numbers are stored in an anticlockwise direction in this illustration; the convention is arbitrary but it must be applied consistently.

After ‘prefront’ the call in ‘ASSEMBLY’ to subroutine ABFIND initiates the formation of the first element stiffness matrix, which is carried through in common area as the ESTIFM array (to be discussed later). This subroutine has to be supplied by the programmer since the precise composition of the stiffness matrix depends on the problem to be solved. Also in ABFIND the element right-hand side vector is formed and placed in appropriate locations in the R1 array (cf. Appendix I).

The nodal number array NK is then constructed for the first element, a unique entry in NK being allocated to each degree-of-freedom of the element. This is achieved by checking the array MDF to determine how many degrees-of-freedom are associated with the node, and the

3 84

3

P. HOOD

5 4

1 1 1 3 1 2 1

-1 3 2

I -3 I -5 I -4 I Figure qb). NOP array after PREFRONT

array NOPP, in which the coded number of the first degree-of-freedom of the node is found. The relevant values of these arrays are shown in Figure 5, and it may be noticed that the signs of the NK entries correspond to those of the NOP array, again in order to trace when the equa- tions are fully summed.

It is now possible to discuss the order of entries in the ESTIFM array for the particular example. The first element stiffness matrix [A'] is stored in the array ESTIFM as follows :

[A'] =

'11 '12 '13 '17 '18 '19 '14 '15 '16

'21 '22 '23 '27 '28 '29 '24 ' 2 5 '26

'31 '32 '33 '37 '38 '39 '34 '35 '36

'71 '72 '13 '11 '18 '19 '74 ' 1 5 '76

'81 '82 '83 ' 8 1 ' 8 8 '89 '84 ' 8 5 '86

'91 '92 .'93 '97 '98 '99 '94 '95 '96

'41 '42 '43 '47 '48 '49 '44 '45 '46

'51 ' 5 2 '53 aS7 ' 5 8 '59 '54 ' 5 5 '56

'61 '62 '63 '61 '68 '69 '64 '65 '66

(5 )

As may be seen storage is in the order indicated by the NK array, i.e. the equation order is the same as the variable numbering.

The next task is to construct the heading vectors KHED and LHED. These label the rows and columns of the EQ matrix (into which AA is assembled) with the values of the NK vector. This then records the rows and columns of EQ in which each coefficient aij of [A] is located;

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES

1

385

L 7 10 13 NOPP ARRAY

-1 -2 -3 7 8 9 L 5 6 NKARRAY

Figure 5

furthermore, if the heading vector entry is coded with a negative sign it shows that the corres- ponding row or column is fully summed (cE Figure 6).

In parallel with this process the element destination vectors KDEST, LDEST, are produced. These indicate the rows and columns in the EQ matrix which the element stiffness matrix is to enter. On assembly of the first element, the heading and destination vectors are of the form shown in Figure 6. After assembly of the next element, the values of the vectors are as shown in Figure 7.

It has been assumed that no elimination has been necessary so far ; consequently the values of KHED and LHED, KDEST and LDEST are identical. However, after each element matrix has been assembled, the number of rows KROW of EQ is checked (see Figure lo), to see that the permitted size NCRIT is not exceeded; if KROW is in fact greater than NCRIT, further assembly is temporarily suspended, and elimination proceeds until KROW falls below NCRIT.

(VARIABLES)

( ROWS I COLS. OF EQ )

Figure 6

NODE 2 3 4

0 11:: 11-1 1-21-31 7 I 8 19 1-41-51-6 1101 11 1121

NODE I 3 2 4 ----

Figure 7

386 P. HOOD

BC 0

The elimination procedure commences (at label 60) with the search for the rows and columns whose heading vectors are coded with a negative sign; these are entered into arrays KPIV and LPIV. In the example these would involve the equations arising from nodes 1 or 2. From the fully summed rows, the equations which correspond to assigned boundary values are now modified. The value of NCOD for the summed equations is checked, and if it has value 1 then the equation is to be replaced by a boundary condition. This fact is registered by the array JMOD which contains the row number. All entries of such equations are deleted, the values of the diagonals are set to unity, and the boundary condition values (contained in array BC) in- serted into the right-hand side. Some readers may consider it better practice to insert a large number on the diagonal, say lo7, and modify the right-hand side similarly. In this way these boundary equations would be eliminated rapidly by the solution procedure. This is offered as a possibility but has not yet been attempted by the author. Boundary values of derivatives are treated in the finite element process simply as additional terms in the {b} vector, and no special modification is required.

As an example it is supposed that node 1 degree-of-freedom 3 is the only boundary condition and has a prescribed value 4.0, then the NCOD and BC arrays have values as shown in Figure 8. After determining which of the equations are boundary equations, NCOD is given a value 2 (before label 68 in Appendix 11), to ensure that the equation is not modified again. As may be observed, the entries of NCOD and BC are largely zero. Such a storage method ensures a rapid re-solution/back-substitution time, but an alternative coding may be considered appropriate for particular situations.

0 4 . 0 0 0 0 0 0 0 0 0 0 0 0 0

NODE 1 2 3 4 5 -- -- Figure 8

It is now possible to proceed with the pivotal search. The largest entry in the summed rows and columns is sought, and is found in the position (KPIVRO, LPIVCO). If there are no rows and columns fully summed at this stage an error message will be printed to indicate that the dimension of EQ is too small, and that NMAX and NCRIT should be increased accordingly (see labels 71-72). The pivotal row is normalized by division with the pivot, and entered into an array QQ; elimination is then carried out in four parts (see Figure 9). For those elements in sector A the Gaussian algorithm is executed :

bw1VR0 b1 + b1- X %,LPIVCO ~KPIVRO,LPIVCO

where a1.J is the I, J-th term of EQ and b, is the I-th right-hand vector. For entries in sector B the elements are returned one space to the left after modification. Similarly entries in C are re-positioned one space vertically, and elements of D one space to the left as well as vertically. This has the effect of deleting the pivotal row and column from EQ, as they are no longer required,

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES 387

I I YES

although the normalized pivotal row QQ, and the terms aI,Lp,vco (stored in the array PVKOL) are written on to the disc for the purpose of re-solution and back-substitution.

EQ MATRIX

LPIVCO

Figure 9

KPIVRO

The heading vectors are then adjusted to account for the compression of the matrix, and the elimination process continued until the number of rows falls below NCRIT. A decision is then taken on the question of further assembly or back-substitution (see Figure 10). Notice that this sequence is slightly different from that on first entry into subroutine FRONT, where the assembly process is repeated until either NCRIT is exceeded or there are no more elements remaining to be assembled (since only then can elimination commence). Otherwise pivotal choice would be unnecessarily restricted at the start.

After elimination is complete, subroutine BACSUB is called. This starts by inserting the values of the assigned boundary conditions into the vector SK, in which the final values of the variables

t I I I IS KROW. LT: NCRIT ? I

[BACK S U ~ T U T E ]

t FINISH

Figure 10

388 P. HOOD

are to be output. The disc containing the pivotal rows is read for each row in turn, and back- substitution of the triangular matrix formed in the elimination process then takes place.

For more than one right-hand side the entry point to the program for second and subsequent right-hand sides is via subroutine RESOL. The first operation in RESOL is the call to ABFIND where the new element right-hand sides are formed. After this the right-hand sides corresponding to boundary condition equations are replaced by the boundary values. Finally the disc is read to obtain the pivotal column at each point, and then the right-hand sides have their Gaussian products subtracted. Back-substitution in the normal way then gives the values of the variables {XI .

COMPARISONS WITH A BAND SOLUTION ROUTINE

In this section the results of computations using both a frontal and a band solution routine are compared in respect of core requirements and computer time on an ICL 1906A machine with a 38 bit mantissa (238 = 10"). These relate to the unsymmetric matrix equations arising in the finite element formulation of Navier-Stokes equations.'.' The particular band routine which was used for these examples was based on the Gaussian elimination method, with the largest entry in the leading column chosen as pivot. In the accounting process, to check when the equations were fully summed, only the lowest and highest equation number from each element was noted.

The first comparison illustrated is for a small problem with 153 equations and band width of 65. It may be noted that the computational time and core requirements of the frontal routine are strongly controlled by the amount of pivotal choice permitted (the value of NCRIT), and the mode of pivoting.

In this particular set of equations the largest element in each column nearly always lies on the diagonal, and it was possible to take advantage of this by restricting the pivotal search to the diagonal rather than using a 'total' search. The computer time saved by this means was quite significant.

To gauge the accuracy of the solution for these different values of NCRIT the residual correc- tions were examined.' Supposing that the solution given by the program is {x*}, the residual is calculated from (1) as

where r must be calculated in extended precision (relative to the working precision), although it will then be rounded and stored in the working precision. Then by re-solution the correction-

{Ax} = [UI-'[L]-'(r}

is computed. The maximum value of R = IAx,/xfl indicates the accuracy of the solution and the condition of the matrix [A]. However, since the matrix [A] is never actually formed in the frontal program, the quantity R had to be determined in a separate subroutine. The values of R for this problem are shown in Table I, and as may be observed the value is fairly insensitive to the amount of pivotal choice. The accuracy falls off when the number of pivotal rows and columns is small (-2) or large (- 27). The optimum value appears to occur at around NCRIT = 35 allowing 7 pivotal rows and columns. It may also be noted from the magnitude of R that the particular set of equations was very ill-conditioned; a well-conditioned problem produces a value R of the order of lo-' with single precision arithmetic (i.e. 38 bit word) used throughout (except of course in the accumulation of scalar products for the residual). Example 2 shows such a problem and again it is seen how insensitive the solution accuracy is to pivotal choice.

;a 3 iz 0

Tabl

e I. C

ompa

rison

bet

wee

n so

lutio

n ro

utin

es

Fron

tal s

olut

ion

Ban

d so

lutio

n

Cas

e N

umbe

r of

Type

of

Fron

t N

CR

IT

Com

pute

r eq

uatio

ns

pivo

ting

wid

th

valu

e tim

e (se

c)

Cor

e (w

ords

) R

-val

ue

Ban

d C

ompu

ter

Cor

e w

idth

tim

e (s

ec)

(wor

ds)

1 15

3 D

iago

nal

28

30

9 D

iago

nal

35

11

Dia

gona

l 55

14

To

tal

55

22

Tota

l 70

28

To

tal

100

36

1,70

0 2,

200

4,50

0 4,

500

6,90

0 12

,500

0.19

5 65

13

5,

400

0-06

5 0.

305

0.30

5 0.

247

0.22

5

2 96

D

iago

nal

23

30

5 1,

700

0.10

4 x

10-9

D

iago

nal

55

9 4,

500

0.12

0 x

10-9

P 8 C z 8 C z rA Li ii

3 87

6 D

iago

nal

58

70

156

6,90

0 16

3 34

4 23

,000

0

To

tal

70

181

6,90

0 z 5 E !2 CA

390 P. HOOD

In the third example, a problem with 876 variables, the frontal solution exhibits a considerable saving in computation time and core size over the band routine. Both routines have a comparable amount of pivotal choice in this case. Furthermore since the processor time also includes the formation of element stiffness it is apparent that the frontal routine is about two times faster than the band routine for this example. Incidentally, both this and the previous example used rectangular meshes numbered in the optimum manner for the band-solution routines.

In general it has been observed that for small problems there is little to choose in speed between the frontal and band routines, because of the extra coding required by the frontal routine. However for the solution of matrix equations in medium or large analyses, the frontal routine gives a significantly faster solution, and allows a considerable reduction in core require- ments for the same amount of pivotal choice. When considering three-dimensional problems or ring structures the core savings of the frontal routine are of course much greater than for these few simple examples, where the band routine in fact compares quite favourably with a frontal routine.

OPERATIONAL CONSIDERATIONS

The program listing is shown in Appendix I1 dimensioned for a typical problem with 120 elements. The particular dimensions chosen, and organization of storage area, will depend on the class of problems to be solved and the type of computer used. The version of the program presented here uses a ‘total’ pivoting scheme, but if it is known that, for the particular matrix equations encountered, the pivot always lies on the diagonal, the solution routine can be tailored accord- ingly, to yield smaller computation times. However it was considered preferable to include the more general version using ‘total’ rather than ‘diagonal’ pivoting, since it is relatively easy to degrade the present routine to diagonal pivoting, whereas the reverse process is far from simple.

In the type of problems the author has solved, it has been found sufficient for the pivotal choice to allow only about ten pivotal columns and rows; this is achieved by choosing NCRIT larger than the frontwidth of the problem by this amount. In this way excessive time is not wasted in searching for the pivot. For other matrices it is quite possible of course that this ‘rule of thumb’ will not apply.

For particular problems there may be only a single degree-of-freedom at each node, and for these cases the variable MWGA should be given a non-zero value; solution then takes place without reference to the arrays MDF and NOPP. Another special facility might be the require- ment for different types of element in the mesh. For this to be possible it is necessary to change variables NBN and NCN into arrays of dimension equal to the humber of elements. The number of nodes per element should be located in the NBN array, and the number of degrees-of-freedom per element in the NCN array.

ACKNOWLEDGEMENTS

The author is greatly indebted to Professor B. M. Irons whose informative discussion on the subject was highly valued, and to Dr. D. W. Martin of the National Physical Laboratory for his most useful contributions made in reviewing the script. Research was supported by a Science Research Council grant which is gratefully acknowledged.

REFERENCES

1. B. M. Irons, ‘A frontal solution program for finite element ana!ysis’, Znr. J. num. Merh. Engng, 2, 5-32 (1970). 2. C. Taylor and P. Hood, ‘A numerical solution of the Navier Stokes equations using the finite element technique’,

Computers and Fluia3, 1, 73-100 (1973).

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES 39 1

3. M. D. Olson, ‘A variational finite element method for two-dimensional steady viscous flows’, Proc. of McGiN-EIC

4. 0. C. Zienkiewicz, ‘Constrained variational principles and penalty function methods in finite element analyses’,

5. J. E. Key, ‘Computer program for the solution of large, sparse, unsymmetric systems of linear equations’, Int. J . num.

6. A. R. Curtis and J. K. Reid, ‘The solution of large sparse unsymmetric systems of linear equations’, J. Inst. Math.

Con$ Finite Element Meth. Civ. Engng, Montreal (1972).

Proc. Conf. Num. Solution of Diyerentiul Eqs, Dundee (1974). Springer Verlag, Berlin (1974).

Meth. Engng, 6,497-509 (1973).

Applic, 8, 344-353 (1971).

London, 1966, pp. 11-26.

University of Alabama in Huntsville Press, Huntsville, 1974.

7. D. W. Martin, ‘Linear algebraic equations’, in Numerical Analysis-An Introduction (Ed. J. Walsh), Academic Press,

8. P. Hood and C. Taylor, ‘Navier Stokes using mixed interpolation’, in Finite Element Methods in Flow Problems,

APPENDIX I

Glossary of program variables

Throughout this glossary an asterisk denotes that the variable or array must be given values before entry into the frontal program. The dimensions for each array are given below it in parentheses.

AA array (NCN, NCN) ABFIND subroutine

BC* array (NP)

EQ array (NMAX, NMAX) ESTIFM array (NCN, NCN) JMOD array (NMAX) KDEST array

KHED array (NMAX) KPIVRO variable KPIV array (NMAX) KROW variable LCOL variable

(NCN)

LDEST array

LHED array (NMAX) LPIV array (NMAX) LPIVCO variable

(NCN)

The element stiffness array ESTIFM is equivalenced to this array.

A subroutine which must be provided by the user to form each element stiffness matrix and right-hand side. For each nodal degree-of-freedom this is assigned zero value, unless a boundary condition is applied, in which case it is given the value of the boundary condition. Submatrix of [A] in equation (1) into which all element stiffness matrices are introduced. The element stiffness matrix formed in the call to ABFIND. The order of entries is illustrated in equation (5). Contains the row number in matrix EQ, of the boundary condition equations. The element destination vector, to indicate the rows in matrix EQ where the element stiffness matrix entries are to be assembled. The heading vector for the rows of EQ to indicate which equation is associated with each row of EQ. The pivotal row number. In this array the fully summed rows are recorded.

I

The number of rows of the matrix EQ which are occupied. The number of columns of the matrix EQ which are occupied, for Gaussian elimination it equals KROW. The element destination vector, to indicate the columns in matrix EQ where the element stiffness matrix entries are to‘be assembled. The heading vector for the columns of EQ to indicate which equation is associated with each column of EQ. In this array the fully summed columns are recorded.

The pivotal column number.

392 P. HOOD

MDF* array

MWGA* variable (NH)

NBN* variable NCN* variable NCOD* array (NP)

NCRIT variable

ND 1 * variable

NE* variable NELL variable NERROR variable NH* variable NK array

NLP* variable NMAX variable

(NCN)

NOP* array (NE, NBN)

NOPP* array

NP* variable NTRA* variable

(NH)

PIVOT variable PVKOL array (NMAX)

(NMAX) R1 array

QQ array

(NP)

SK array (NMAX* NMAX)

For each node in the mesh this gives the number of degrees-of- freedom at each node (cf. Figure 5). A non-zero value indicates a single nodal degree-of-freedom ; zero indicates multiple degrees-of-freedom. The number of nodes in each element, in the example it was value 3. The total number of degrees-of-freedom in each element. The entries of this array are coded zero for a nodal degree-of- freedom with no applied boundary condition, and unity for an applied boundary condition. The critical number of rows of EQ. If this value is exceeded assembly is suspended. It must be chosen to be smaller than NMAX by the number of degrees-of-freedom in an element. The minimum value is the number of degrees-of-freedom in the largest frontwidth. The maximum value is governed by machine core size ultimately, or by the accuracy required. The larger NCRIT is chosen the greater pivotal choice there is and consequently slower execution time. The channel number of the disc or tape on which the pivotal row is written. The number of elements in the mesh. Element number of the stiffness matrix currently being assembled. An error code, the meaning of which is printed out on its occurrence. The total number of nodes in the mesh. Contains the equation number assigned to each degree-of-freedom of the element currently being assembled. The channel number of the line printer. This must be chosen to be greater than the largest frontwidth + the next element equations to be assembled. This also gives the dimen- sions of the array EQ. The nodal numbering array. The first argument is the element number, and the second argument locates the node numbers occur- ring in the element. This array gives the coded value of the first degree-of-freedom at each node. The total number of equations to be solved. This is coded unity before entry into front, and zero on subsequent entry, in order to avoid the prefront process after the first cycle. The entry used as the pivot in elimination. Contains the pivotal column.

Contains the pivotal row normalized by division by the pivot.

The right-hand side vector assembled for each element in the call to ABFIND. The entries for each equation should be inserted into the correct location of R1. This must be in the order of degrees-of- freedom and in ascending node number, arranged in sequence from node 1 degree-of-freedom 1, node 1 degree-of-freedom 2,. . . , node NH final degree-of-freedom. The results are output in this array.

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES 393

Note that GISH and INTEG arrays appearing in COMMON area FRON3 are dummy variables and are not actually used by the frontal program.

0 1 2 3 4 c 5 c 6 C 7 c 8 9

1 0 I 1 1 2 1 3 1 4 1 5 16 17 1 8 19 20 2 1 22 2 3 2 4 2 5 c 26 27 C 28 c 2Y c 30 31 3 2 C C 3 3 34 c 55 c 56 C 37 38 39 40 4 1 4 2 4 3 44 45 46 47 48 49 SO S l c c 5 2 5 3 5 4

APPENDIX I1

SUBROUTINE FRONT

5 5 1 2 5 6 C C 5 7 C C S8 c 5 9 c 60 c 61 1 4

NLAST.0 DO 1 2 I m l r N H 00 8 N m I r N E DO 4 L.1 rNBN IF(NOP(N,L) .NE, I )GO T O 4 N LAST1 .N IF(NLAST.NE.NLAST~)GO TO 3 NERROR.? URITE(NLPt416)WeRRORIN STOP CONTINUE t4LAST.N

CONT I NU€ U R I T E ( N L P t 4 0 4 ) I . N L A S T CONTINUE

NLASTaO CONTINUE. WRITE(NLP,408) W A I T E ( N L P t 4 1 2 ) ( N , ( N ~ P ( N r L ) r L . l r N B N ) , N B ~ , N E ~

L ~ = L

N O P ( N L A S T , L I ) . - N O P ( N L A S T , L ~ )

ASSEMBLY

CONTINUE

394 P. HOOD

62 63 6 4 65 66 67

6 V 70 71 72 73 74 75 76 77 78 79

81 R Z

68

ao

as a4 as a7 R6

88 89 90 C

LCOLmO Y R OW = 0 DO 16 1.1 r N l l A X DO 16 J.1rNElAX E Q ( J , I ) m O .

16 C O N T I N U E 18 N E L L n N E L L + l

C A L L A B F I N D N = N E L L KC.0 IF( i1UGA.EQ.O)GO 10 21 DO 20 l ~ l r N 0 N N K ( I ) ’ N O P ( N r I )

20 C O N T I N U E GO TO 23

2 1 C O N T I N I J E DO 22 J ~ l r NN.NOP(N,J M m I A B S ( N N ) KnNOPP(b l ) I D f m M D f ( M ) DO 22 L a l t K C r K C * t I I I I K + L a I I f (NN. LT. 0 NK(KC).I. I

22 C O N T I N U E 23 C O N T I N U E

B N

D F

11.m11

91 C SET UP H E A D I N O VECTORS 92 C 93 DO 52 L K m l t N C N 94 N O D E u N K t L K ) 95 I F ( L C O L % E O . O ) O O TO 28 96 DO 24 L a l t L C O L

98 99 26 C O N T I N U E

07 LLaL I F ( I A I ) I ( W O D E ) .EQ, I A B S ( L H l ? D ( L ) ) )GO TO 32

100 28 L C O L ~ L C O L * l 101 L D E S T ( L K ) a L C O L 102 L I O D ( L C 0 L ) I N O D C 103 a0 TO 36 104 32 LDCST(LK).LL 1 Q5 L H E D ( L L ) B N O D E 106 36 IF(KROY.EP,O)OO TO 44 107 DO 42 K a l t K R O W 108 K K q K 109 I F ( I A B I ( N O D C ) . ~ Q , I A I ) S ( K H ~ D ( K ) ) ) G O TO 48 110 42 C O N T I N U E 111 41 KROW.KROW+I 112 KDCST(LK) *KROW 113 K H C D ( K R 0 U ) I N O D E 114 GO TO 52 115 48 K D E S T ( L K ) * K K 116 KHED(KK)aNODE 117 52 C O N T I N U E 11 8 CC WRITE ( N !,PI 420) KROWt L C o L 119 CC W R I T E ( N L P t 4 2 4 ) 120 CC W R t t E ( N L P r 4 2 8 ) (KHCD(K) I L H E D ( K ) rK.1 .NHAX) 121 c c W R I T E ( N L P , 4 3 2 ) 122 c c U R I T E ( N L P t 4 2 8 ) ( K D E S T ( K ) , L D l ? S T ( K ) , K a l t N C N ) 123 IP (KRO~.L l? .NMAX.AND.LCOL.LEI .NMAX)GO To 54 124 NERROR.2 125 W R - I T E ( N L P I ~ ~ T ) N R R R O R 126 STOP 127 5 4 C O N T I N U E 128 DO 56 L m l I N C N 129 1 so DO 56 K m l t N C N

L L* L D E S T ( L )

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES 395

I 5 1 KK.KDeST(K)

133 56 C O N T I N U E 134 CC W R I T E ( N L P t 4 5 6 ) N e L L

132 E Q C K K t LL ) .eQ(KK;LL ) *AA(K ,~ )

135 CC U R I t E ~ N L P t ~ 4 O ~ ~ ~ E Q ~ I r J ~ t J ~ l ~ N M A X ~ t I ~ l ~ N M A ~ ~ 136 IF(KROY.LT.NCR1T.AND.NeLL~LT.NE)GO TO 18 137 C 138 C F I N D OUT W H I C H I i A T R I X ELEMCNTS A R E F U L L Y BUMMED 139 C I 4 0 60 LC.0 141 Do 64 L r l t L C O L 142 I F ( L W E D ( L ) i G E . O ) G O TO 64 143 LCRLC+I I 4 4 145 64 C O N T I N U E 146 I R.0 147 KR.0 I d 8 DO 68 K m l t K R O W 149 K T = K H E D ( K )

151 K R - K R + ~ 152 KPIV(KR).K 153 K R O = I A I S ( K T ) 154 I F ( N C O D ( K R O ) , N E i . I ) G 0 T O 68 155 IR . IR+ l 156 J M O D ( l R ) = K 157 NCOD(KRO).2 158 R 1 ( K R O ) ~ B C ( K R O ) 159 68 C O N T I N U E 160 c 161 c M O D I F Y E Q U A T I O N S W I T H A P P L I E D B n U N D A R v C O N D I T I O N S 162 c 163 CC W R I T E ( N L P ~ 4 4 8 ) l C , K R 164 CC U R I T E ( N L P t 4 2 8 ) ( ' L P I V ( K ) r K P I V ( K ) f K = l , N M A X ) I 6 5 x F ( I R . E P . O ) B O Tn 71

L P I V ( L C ) L

150 I F ( K T . Q E . O ) G O TO 68

166 CC 167 168 169 CC 170 171 172 173 174 1 7 5 69 176 70 177 71

179 180 181 182 72 183 CC

i 7a

U R I T E i N L P t 4 5 6 ) D o 70 1 R R m 1 , I R K'JMOD (I R R ) U R I T E ( N L P t 4 2 8 ) K KH. IABS(KHED(K) ) Do 69 L.1,LCOL EQ(K ,L )=o . LH=IABS(LHED(L))

I F ( L H . E Q . K H ) E Q ( K , L ) ' C O N T I N U E C O N T I N U E CONT I N U € IF(KR.GT.O,AND.LC.GT NERROR.3 W R I T E ( N L P 1 4 1 8 ) N e R R O R STOP C O N T I N U E W R I T E ( N L P t 4 6 0 )

1

0 ) G O TO 72

186 C 187 C I 8 8 189 100 191 102 103 104 105 106 107 198 74 109 76

SEARCH FOR ABSOLUTE P I V n l

P I V O V O . Do 76 L.1 t L C L P I V C q L P I V ( L ) DO 74 K.1 t KR K P I V R m K P I V ( K ) P I V A . E Q ( K P I V R t L P I V C ) IF(ABS(PIVA).LT.pIVnT)GO TO 74 PIVOT.P IVA L P I V C O m L P I V C K P I V R O - K P I V R C O N T I N U E C O N T I N U E

396 P. HOOD

200 c 201 c N O R M A L I S E P I V O T A L ROU 202 c

209 80 C O N T I N U E 21 0 R H S k R l ( K R O ) / P I V O T 21 1 R 1 ( K R 0 ) n R H S 21 2 P V K O L ( K ~ I V R D ) R P I V O T 21 3 21 4 2.1 5 21 6 21 1 21 0 219 2 2 0 221 222 223 2 2 4 22s 2 2 6 221 2 2 0 229 2 3 0 231 2 3 2 2 3 3 2 3 4 2 3 3 2 3 6 231

2 3 9 2 4 0

238

CC U R I T E ( N L P t 4 6 8 ) CC W R I T E ( N L P I ~ & ~ ) ( ~ P ( L ) , L ~ ~ , ~ C O L ) C

I C E L I M I N A T E THEN D E L E T E P I V O T A L ROW AND COLUMN ' C I I F ( K P I V R O . E P . 1 ) 0 0 To 104

I D o 100 K m ' l t K P I V R

F A C V E Q ( K t L P 1 V C O b

K P I V R n K P I V R O - 1

K R W r I A B S ( K H C D ( K ) )

CC U R I T E ( N L P I ~ ~ O ) F A C p V K O L ( K ) = F A C

DO 84 L n 1 , L P I V C

I C ( L P I V C O . E ~ . ~ . I ~ R . F A C ~ E Q . O ~ ) ~ O TO 88 , L P 1VC.LPI v c o 4

I EQ(K,L )nEQ(KIL )=FAC*Qe(L) ' 84 C O N T I N U E 1 88 IP(LP1VCO.EQ.LCOL)GO TO 96

L P I V C ~ L P I V C 0 + 1 ! DO 92 L R L P I V C I L C O L

I 100 C O N T I N U E ' 104 I F ( K P I V R O . E Q r K R O W ) G O TO 128 I K P I V R n K P I V R O + I I DO 124 K - K P I V R t K R O W t

241 242 CC 243 244 215 246 247 248 108 249 I 1 2 2 5'0 251

FA

PY IF L F Da E Q

I f LP Da

w n

ca

L 1 C I v 1 k 1 1 v I

IEQ(KIL 'E(NLPI ) L ( K ) = F .P IVCO. I C n L P I V 08 L.1 :-l I L)n ' I N U E .P IVCO. r c n L P r v 16 L=L

P 4 A E C

1

E c P

I

I l V C O i I R O ) F A C IC i Q . 1 ) a o TO 112 Ion1

!Q ( K I L) -FAC*QQ

i 4 , L C o L ) G Q TO 10+1 11 vc I L C O L

L P I V C L)

20

252 253 116 C O N T I N U E 254 120 R 1 ( K R W ) n R l ( K R W ) n r A C * R H s 255 124 C O N T I N U E 256 128 C O N T I N U E 257 C 258 C W R I T E P I V O T A L E a U A T I O N ON D I S C 259 C 260 W R I T E ( N D 1 ) 261 1 K R O I L C O L ~ L P I V C o I ( L H E D ( L ) r Q P ( L ) , L n l , L C O L ) 262 2 1 K R O U ~ P I V O T ~ K P I V R O t ~ P V K O L ~ ~ ) , K H ~ ~ ~ K ) , U n l , K R O U ~ 263 DO 129 K m l t KROU 264 E Q ( K t L C 0 L ) n O . 265 129 C O N T I N U E 266 DO 130 L.1 t L C O L

268 130 C O N T I N U E 267 EQ(KROWtL).O.

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES

269 CC W R I T E ( N L P , 4 3 6 ) N C U

271 CC W R I T E ( N L P I ~ ~ O )

273 C 274 C REARRANGE H E A D I N G VECTORS 275 C

270 CC

272 CC

W R I T E ( N L P r 4 4 0 ) ( ( E Q ( F, J ) I J.1 ,NMAx) I 1.1 I N H A X )

W R I T E ( N L P I 4 6 4 ) ( I I R l ( I ) I 1.1 r N P )

i 7 b 277 278 2 79 289 132 281 136 282 283 284 285 I 4 0 2 R b 144 287 CC 288 c c 289 CC

LC0L.LCOL-1 I F ( L P I V C O . E Q . L C O L + I ) G O TO 136

L H E D ( L ) . L H E P ( L + l ) C O N T I N U E KROU=KROW-I I F ( K P I V R O . E Q . K R O W + l ) G U TO I 4 4

K H E D ( K ) m K H E P ( K + I ) C O N T I N U E C O N T I N U E W R I T E ( N L P I ~ ~ O ) K R O W I L C O L W R I T E ( N L P t 4 2 4 )

DO 132 L.LPIVCO,LCOL

DO 140 K.KP!VRO,KROlJ

W R I T E ( N L P t 4 2 8 ) ( K H E D ( K ) , L H e D ( K ) , K = l r N n A X ) 200 c 201 c R E T E R M I N E WHETHER TO ASSEMBLE,ELIMINATE,OR'BACKSUBSTITUTe 202 c 203 20 4 20 5 2a6 20 7 208 209 300 341 302 303 3n 4

307 308 3n9

3 4 5 306.

31 0 31 1 31 2 3? 3 31 4 31 5 31 6 31 7 31 8 319 320 321 322 323 324 325 326 327 328 329 330 331 5.12 333 334 s35 336 337

C A L L B A C S U B 400 F O R M A T ( 5 H NODEr6,W N L A S T ) 4 0 4 F O R M A T ( l X I 2 I S ) 408 F O R M A T ( / / 1 6 H N O D A L N U M B E R I N G / ) 412 F O R M A T ( 9 1 5 ) 476 F O R N A T ( j 8 H H E R R O R ~ t I S f f I S r

1 6 2 ~ TNl. E L E M E N T H A S HORE T H A N ONE NODE W I T H T H E 1 / 6 2 H S A n E N O D A L NUHBER I/)

1 6 2 H THE. D I F F E R E N C E NMAX-NCRIT IS NOT S U F F I C I E N T L Y LARGE 1 / 6 2 H TO P E R I I I T T H E A S S E M B L Y OF THE N E X T E L E E D E N T - - ~ l / 6 2 H E I T H E R I N C R E A S E NMAX OR L O W R N C R I T I/)

4.17 F O R M A T ( / O H NCRROR.rIS//

418 C O R M A T ( / B H NERRf1R.r IS// 1 6 2 H T H E R E ARE NO MORE ROWS F U L L Y S U H M E D r T H l S MAY 1 1 6 2 H ( 1 ) l N C n R R E C T C O D l N G 01 NOP OR NK A R R A Y S 1 / 6 2 H ( 2 ) I N C n R R E t T V A L U E OF N c R I T . I N C R E A S E N C R l T 1 / 6 2 H WHOLE FRONT TO B E A S S E M B L E D 11)

420 F O R M A T ( / 6 H K R O U m i I S r 6 H L C O L . r I 5 / ) 424 F O R M A T ( / S H KHED,'SH l H E D / ) 428 F O R M A T ( 2 1 6 ) 432 FORMAT( /bH K D E S T I ~ H L D E S T I ) 430 F O R M A T ( / 2 2 H EQ t l A T R I X E L E M E N T N O m 1 1 3 / ) 4 4 0 F O R M A T ( 2 0 F 5 . 2 ) 448 F O R M A T ( / 4 H L C g r 1 3 r / 4 H K R m 1 1 3 / 6 H LP!V,6H 4 5 2 F O R M A T ( l 3 H P I V O T A L R O W * r 1 4 1 1 6 H P I V O T A L CO

456 F O R H A T ( / S H J M O D / ) 1)

K P I V UHN?

B E DUE

0 PERM

T O - r m

I

397

398 P. HOOD

336 460 339 464 340 468 341 476 342 480 343 344 345 c 346 C 567 c - .. - 348 349 c 350 C 351 C 352 C 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 C 371 C 372 C 373 c 374 37s 376 377 c c 378 c c 379 c c 380 381 C C 382 383 384 385 SR6 - .. 387 588 389 390 C C 191 c c 392 C C 39 3 39 4 SP 5 396 39 7 398 399 400 C C 401 C C

SUBROUTINE R E S O L

RESOLUTION

DO 2 NELLr l tNE CALL A B F I N D

CALL NI lLTIHE(IT1ME) WRITE(NLPt476)ITIME WRITE(NLPt472)

2 CONTINUE

Do 4 1- WRITE" I C (NCOD RI(1)aB

4 CONTINU DO 12 N

I P 1

1 a

402 12 CON TI NU^ 403 CALL BACSUB 404 400 FORMAT(/IBH R I G H T HAND V E C T O R / ) 405 404 FORMAT(IStE20.10) 406 407 1,8H K P I V R O ~ I I S ) 408 412 FORMAT(SE20.10)

408 FORMAT(14H D I S C CONTENTS/6H KROWmrISr7H PIVOTnrE20.10

FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES 399

409 416 F O R M A T ( l O I 5 ) 41 0 464 F O R M A T ( I S I E ~ O . I 0 ) 411 472 FORMAT(2OH BOUNDARY C O N D I T I O N S ) 412 476 F O R M A T ( / 2 8 H R I G H T HAND S I D E COMPLETE A T 0 1 5 r 6 H S E C S . / / ) 4 7 3 RETURN 41 4 END 4’15 c 416 C . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 417 C 41 8 S U B R O U T I N E B A C S i r B 419 C 420 C 421 C B A C K - S U B S T I T U T I O N FOR F U L L P ~ V O T I N G 422 C 423 COMMON/FRONI /

425 COMMON/FRONZ/ 424 1 NP,NHINE,NBN,NCN,NDIrnUCAINCLL,NTRA,NLP

426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 C 442 C 443 c 444 445 4 A 6 447 448 449 450 451 452 CC 453 cc 454 c c 455 c c 456 457 458 459 4 6 0 441 462 463 464 465 466 467 468 449 470

1 - N co

1 s D I

1 L 2,E 3 , J

EQ I ( 2, ( 3 , ( 4, ( 5, ( 6 r (

BACK S U B S T I T U T I n N

DO 4 I - l r N P 4 S K ( I ) n B C ( I )

DO 32 I V m l r N P B A C K S P A C E N D l R E A D ( N D 1 ) I ~ , K R O U ~ P I V O T ~ K P I V R O ~ ~ P V K O L ~ K ~ , K H E D ~ U ~ , K ~ ~ ~ K R O U ~

KRO, L C O L t LP I V C O t ( L H E D ( L ) I QQ ( L) , La1 I L C O L )

B A C K S P A C E N D I U R I T E ( N L P t 4 0 4 ) U R I ’ f C ( N L P ~ 4 0 8 ) UROILCOLILP IVCO U R I T E ( N L P I ~ O ~ ) k L H E D ( L ) r L u l ,LCOL) U R I T E ( N L P t 4 1 2 ) C Q Q ( L ) r L * l r L C O L ) I F ( N C O D ( K R O ) . B T f ~ O ) G O TO 24 GASH-0, Q Q ( L P I V C 0 ) n O . DO 16 LW1,LCOL

16 C O N T I N U E S K ( K R O > R R ~ ( K R O ) * Q A S H 00 TO 32

24 C O N T I N U E NCOD (KRO) -1

32 C O N T I N U E UR I TL ( N L P I 41 6) DO 36 L R l r N H J ~ N O P P ( L ) ~ I D F r M D F t L )

G A S H . G A S H n Q Q ( L ) w S K ( I A I S ( L H E D ~ L ) ) )

471 W R I T E ( N L P , 4 2 0 ) L , ( S K ( J + I ) , I n l , g D F ) 472 36 C O N T I N U E 473 404 F O R M A T ( 1 4 H T A P 6 CONTENTS) 474 408 F O R M A T ( I O I 5 ) 475 412 F O R M A T ( 5 E 2 0 . 1 0 ) 476 416 F O R M A T ( / 8 H R E S U L T S / )

478 RETURN 479 END

477 420 F O R B A T ( 1 5 r 6 E 1 8 a 10)