You are on page 1of 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 effectivemeans 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).
Existing sparse matrix 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.

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 :
“{x) = {b} (1)
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:

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 :
I
a22-- a i l 4 2 +a:', a i 3 - -a: :1' 3 +a!, ai4 x2
a: 1 a: 1

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

.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 P. HOOD

1 1 1 3 1 2 1

3 5 4

-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 :
1' '
1
2 '13 '17 '
1
8 '19 '14 '15 '16

'21 '22 '23 '27 '28 '29 '24 '25 '26

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

'71 '72 '13 '11 '18 '19 '74 '15 '76

[A'] = '81 '82 '83 '81 '88 '89 '84 '85 '86 (5)
'91 '92 .'93 '97 '98 '99 '94 '95 '96

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

'51 '52 '53 aS7 '58 '59 '54 '55 '56

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

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 385

1 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:: I
11-1 1-21-31 7 8 19 1-41-51-6 110111 1121

NODE I 3 2 4
Figure 7
386 P. HOOD

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-substitutiontime, but an alternative coding may be considered appropriate
for particular situations.

NODE

BC
--
0
1

0 4 . 0 0
2

0 0 0
3

0 0
--
0
4

0 0 0
5

0 0

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.Jis 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

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

KPIVRO

LPIVCO

Figure 9

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

II YES

[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.
;0a
Table I. Comparison between solution routines 3
iz
Frontal solution Band solution P
C
Case Number of Type of Front NCRIT Computer Core R-value Band Computer Core 8z
equations pivoting width value time (sec) (words) width time (sec) (words)

1 153 Diagonal 28 30 9 1,700 0.195 65 13 5,400


Diagonal 35 11 2,200 0-065
Diagonal 55 14 4,500 0.305
Total 55 22 4,500 0.305
Total 70 28 6,900 0.247 8C
Total 100 36 12,500 0.225 z
rA

2 96 Diagonal 23 30 5 1,700 0.104 x 10-9


Diagonal 55 9 4,500 0.120 x 10-9 Li

3 876 Diagonal 58 70 156 6,900 163 344 23,000


i
0
Total 70 181 6,900 z
5E
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 120elements.
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
Con$ Finite Element Meth. Civ. Engng, Montreal (1972).
4. 0. C. Zienkiewicz, ‘Constrained variational principles and penalty function methods in finite element analyses’,
Proc. Conf. Num. Solution of Diyerentiul Eqs, Dundee (1974). Springer Verlag, Berlin (1974).
5. J. E. Key, ‘Computerprogram for the solution of large, sparse, unsymmetric systems of linear equations’, Int. J. num.
Meth. Engng, 6,497-509 (1973).
6. A. R. Curtis and J. K. Reid, ‘The solution of large sparse unsymmetric systems of linear equations’, J. Inst. Math.
Applic, 8, 344-353 (1971).
7. D. W. Martin, ‘Linear algebraic equations’, in Numerical Analysis-An Introduction (Ed. J. Walsh), Academic Press,
London, 1966, pp. 11-26.
8. P. Hood and C. Taylor, ‘Navier Stokes using mixed interpolation’, in Finite Element Methods in Flow Problems,
University of Alabama in Huntsville Press, Huntsville, 1974.

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 The element stiffness array ESTIFM is equivalenced to this array.
(NCN, NCN)
ABFIND subroutine A subroutine which must be provided by the user to form each
element stiffness matrix and right-hand side.
BC* array For each nodal degree-of-freedom this is assigned zero value, unless
(NP) a boundary condition is applied, in which case it is given the value
of the boundary condition.
EQ array Submatrix of [A] in equation (1) into which all element stiffness
(NMAX, NMAX) matrices are introduced.
ESTIFM array The element stiffness matrix formed in the call to ABFIND. The
(NCN, NCN) order of entries is illustrated in equation (5). I

JMOD array Contains the row number in matrix EQ, of the boundary condition
(NMAX) equations.
KDEST array The element destination vector, to indicate the rows in matrix EQ
(NCN) where the element stiffness matrix entries are to be assembled.
KHED array The heading vector for the rows of EQ to indicate which equation is
(NMAX) associated with each row of EQ.
KPIVRO variable The pivotal row number.
KPIV array In this array the fully summed rows are recorded.
(NMAX)
KROW variable The number of rows of the matrix EQ which are occupied.
LCOL variable The number of columns of the matrix EQ which are occupied, for
Gaussian elimination it equals KROW.
LDEST array The element destination vector, to indicate the columns in matrix
(NCN) EQ where the element stiffness matrix entries are to‘be assembled.
LHED array The heading vector for the columns of EQ to indicate which equation
(NMAX) is associated with each column of EQ.
LPIV array In this array the fully summed columns are recorded.
(NMAX)
LPIVCO variable The pivotal column number.
392 P. HOOD

MDF* array For each node in the mesh this gives the number of degrees-of-
(NH) freedom at each node (cf. Figure 5).
MWGA* variable A non-zero value indicates a single nodal degree-of-freedom ;
zero indicates multiple degrees-of-freedom.
NBN* variable The number of nodes in each element, in the example it was value 3.
NCN* variable The total number of degrees-of-freedom in each element.
NCOD* array The entries of this array are coded zero for a nodal degree-of-
(NP) freedom with no applied boundary condition, and unity for an
applied boundary condition.
NCRIT variable 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.
ND 1* variable The channel number of the disc or tape on which the pivotal row is
written.
NE* variable The number of elements in the mesh.
NELL variable Element number of the stiffness matrix currently being assembled.
NERROR variable An error code, the meaning of which is printed out on its occurrence.
NH* variable The total number of nodes in the mesh.
NK array Contains the equation number assigned to each degree-of-freedom
(NCN) of the element currently being assembled.
NLP* variable The channel number of the line printer.
NMAX variable 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.
NOP* array The nodal numbering array. The first argument is the element
(NE, NBN) number, and the second argument locates the node numbers occur-
ring in the element.
NOPP* array This array gives the coded value of the first degree-of-freedom at
(NH) each node.
NP* variable The total number of equations to be solved.
NTRA* variable This is coded unity before entry into front, and zero on subsequent
entry, in order to avoid the prefront process after the first cycle.
PIVOT variable The entry used as the pivot in elimination.
PVKOL array Contains the pivotal column.
(NMAX)
QQ array Contains the pivotal row normalized by division by the pivot.
(NMAX)
R1 array The right-hand side vector assembled for each element in the call
(NP) 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.
SK array The results are output in this array.
(NMAX* NMAX)
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.

APPENDIX I1
0
1
2
3 SUBROUTINE FRONT
4 c
5 c
6 C
7 c
8
9
10
I1
12
13
14
15
16
17
18
19
20
21
22
23
24
25 c
26
27 C
28 c
2Y c
30
31
32 CC
33
34 c
55 c
56 C
37 NLAST.0
38 DO 1 2 I m l r N H
39 00 8 N m I r N E
40 DO 4 L1. rNBN
41 IF(NOP(N,L).NE,I)GO TO 4
42 N LAST1 .N
43 IF(NLAST.NE.NLAST~)GO TO 3
44 NERROR.?
45 URITE(NLPt416)WeRRORIN
46 STOP
47 CONTINUE
48 t4LAST.N
49 L ~ = L
SO CONT INU€
Sl cc URITE(NLPt404)I.NLAST
52 CONTINUE
53 NOP(NLAST,LI).-NOP(NLAST,L~)
54 NLASTaO
55 1 2 CONTINUE.
56 CC WRITE(NLP,408)
57 CC WAITE(NLPt412)(N,(N~P(NrL)rL.lrNBN),NB~,NE~
S8 c
59 c ASSEMBLY
60 c
61 1 4 CONTINUE
394 P. HOOD

62 LCOLmO
63 Y R OW = 0
64 DO 16 1.1 r N l l A X
65 DO 16 J.1rNElAX
66 EQ(J,I)mO.
67 16 CONTINUE
68 18 NELLnNELL+l
6V CALL ABFIND
70 N=NELL
71 KC.0
72 IF(i1UGA.EQ.O)GO 10 21
73 DO 20 l ~ l r N 0 N
74 NK(I)’NOP(NrI)
75 20 CONTINUE
76 G O T O 23
77 21 CONTINIJE
78 DO 22 J ~ l rB N
79 NN.NOP(N,J
ao MmIABS(NN)
81 KnNOPP(bl)
RZ IDfmMDf(M)
as DO 22 L a l t D F
a4 KCrKC*t
as I IIIK+LaI
R6 I f (NN. LT. 0 11.m11
a7 NK(KC).I. I
88 22 CONTINUE
89 23 CONTINUE
90 C
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 NODEuNKtLK)
95 I F ( L C O L % E O . O ) O O TO 28
96 DO 2 4 L a l t L C O L
07 LLaL
98 I F ( I A I ) I ( W O D E ) .EQ, I A B S ( L H l ? D ( L ) ) )GO TO 32
99 26 CONTINUE
100 28 LCOL~LCOL*l
101 LDEST(LK)aLCOL
102 LIOD(LC0L)INODC
103 a0 TO 36
104 32 LDCST(LK).LL
1Q5 LHED(LL)BNODE
106 36 IF(KROY.EP,O)OO TO 44
107 DO 42 K a l t K R O W
108 KKqK
109 IF(IABI(NODC).~Q,IAI)S(KH~D(K)))GO TO 48
110 42 CONTINUE
111 41 KROW.KROW+I
112 KDCST(LK)*KROW
113 KHCD(KR0U)INODE
114 GO TO 52
115 48 KDEST(LK)*KK
116 KHED(KK)aNODE
117 52 CONTINUE
118 CC WRITE ( N !,PI420)KROWt L C o L
119 CC WRITE(NLPt424)
120 CC W R t t E ( N L P r 4 2 8 ) (KHCD(K) IL H E D ( K ) rK.1 .NHAX)
121 cc WRITE(NLP,432)
122 cc U R I T E ( N L P t 4 2 8 ) (KDEST(K),LDl?ST(K),KaltNCN)
123 IP(KRO~.Ll?.NMAX.AND.LCOL.LEI.NMAX)GO To 54
124 NERROR.2
125 WR-ITE(NLPI~~T)NRRROR
126 STOP
127 54 CONTINUE
128 DO 56 L m l I N C N
129 L L* L D E S T ( L )
1so DO 56 K m l t N C N
FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES 395

I51 KK.KDeST(K)
132 E Q C K K t L L ) . e Q ( K K ; L L ) * AA( K,~)
133 56 C O N T I N U E
134 CC WRITE(NLPt456)NeLL
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 O U T W H I C H I i A T R I X ELEM C N T S A R E F U L L Y BUMMED
139 C
I40 60 LC.0
141 Do 64 L r l t L C O L
142 IF(LWED(L)iGE.O)GO TO 64
143 LCRLC+I
I44 LP I V (LC) L
145 64 C O N T I N U E
146 IR.0
147 KR.0
Id8 DO 68 K m l t K R O W
149 KT=KHED(K)
150 IF(KT.QE.O)GO TO 68
151 KR-KR+~
152 KPIV(KR).K
153 KRO=IAIS(KT)
154 IF(NCOD(KRO),NEi.I)G0 T O 68
155 IR.IR+l
156 JMOD(lR)=K
157 NCOD(KRO).2
158 R1(KRO)~BC(KRO)
159 68 C O N T I N U E
160 c
161 c MODIFY EQUATIONS WITH A P P L I E D BnUNDARv CONDITIONS
162 c
163 CC WRITE(NLP~448)lC,KR
164 CC URITE(NLPt428)('LPIV(K)rKPIV(K)fK=l,NMAX)
I65 xF(IR.EP.O)BO Tn 71
166 CC URITEiNLPt456)
167 D o 70 1 R R m 1 , I R
168 K'JMOD (I RR)
169 CC URITE(NLPt428)K
170 KH.IABS(KHED(K))
171 Do 69 L.1,LCOL
172 EQ(K,L)=o.
173 LH=IABS(LHED(L))
174 IF(LH.EQ.KH)EQ(K,L)' 1

175 69 C O N T I N U E
176 70 C O N T I N U E
177 71 CONT IN U €
i7a IF(KR.GT.O,AND.LC.GT 0 ) G O TO 72
179 NERROR.3
180 WRITE(NLP1418)NeRROR
181 STOP
182 72 C O N T I N U E
183 CC WRITE(NLPt460)

186 C S E A R C H FOR A B S O L U T E P I V n l
187 C
I88 PIVOVO.
189 Do 76 L.1 t L C
100 LPIVCqLPIV(L)
191 DO 74 K1. t KR
102 KPIVRmKPIV(K)
103 PIVA.EQ(KPIVRtLPIVC)
104 IF(ABS(PIVA).LT.pIVnT)GO T O 74
105 PIVOT.PIVA
106 LPIVCOmLPIVC
107 KPIVRO-KPIVR
198 74 C O N T I N U E
109 76 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 RHSkRl (KRO)/PIVOT
21 1 R1 (KR0)nRHS
21 2 PVKOL(K~IVRD)RPIVOT
21 3 CC URITE(NLPt468)
21 4 CC WRITE(NLPI~&~)(~P(L),L~~,~COL)
2.1 5 C
21 6I 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
21 1' C
21 0I IF(KPIVRO.EP.1)00 To 104
219 KPIVRnKPIVRO-1
2 2 0I D o 100 K m ' l t K P I V R
221 KRWrIABS(KHCD(K))
222 FACVEQ(KtLP1VCOb
223 CC URITE(NLPI~~O)FAC
224 pVKOL(K)=FAC
22s ~ O 88
I C ( L P I V C O . E ~ . ~ . I ~ R . F A C ~ E Q . O ~ ) TO
2 2 6, L P 1VC.LPI v c o 4
221 DO 84 L n 1 , L P I V C
2 2 0I EQ(K,L)nEQ(KIL)=FAC*Qe(L)
229' 84 C O N T I N U E
2 3 01 88 IP(LP1VCO.EQ.LCOL)GO TO 96
231 LPIVC~LPIVC0+1
2 3 2! DO 92 L R L P I V C I L C O L
233
234
233
2 3 6I 100 C O N T I N U E
231' 104 IF(KPIVRO.EQrKROW)GO TO 128
238II KPIVRnKPIVRO+I
239 DO 124 K - K P I V R t K R O W
2 4 0t
241 FA LIEQ(KIL PI l V C O i
242 CC wn 1'E(NLPI 4I R O ) F A C
243 PY C) L ( K ) = F AIC
244 IF I.PIVCO. Ei Q . 1 ) a o TO 112
215 L F vI C n L P I V CIon1
246 Da 108 L1. IL P I V C
247 E Q k:-l I L)n 1!Q( K IL ) -FAC*QQ L)
248 108 ca 1' I N U E
249 I 1 2 I f 1.PIVCO. Ei 4 , L C o L ) G Q TO 20
2 5'0 LP vr c n L P r v c10+1
251 Da I16 L=L P11vc I L C O L
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 WRITE(ND1)
261 1 KROILCOL~LPIVCoI(LHED(L)rQP(L),Lnl,LCOL)
262 21KROU~PIVOT~KPIVROt~PVKOL~~),KH~~~K),Unl,KROU~
263 DO 129 K m l t KROU
264 EQ(KtLC0L)nO.
265 129 C O N T I N U E
266 DO 130 L1. t L C O L
267 EQ(KROWtL).O.
268 130 C O N T I N U E
FRONTAL SOLUTION PROGRAM FOR UNSYMMETRIC MATRICES 397

269 CC WRITE(NLP,436)NCU
270 CC W R I T E ( N L P r 4 4 0 ) ( ( E Q ( F, J ) IJ.1 ,NMAx) I 11
. INHAX)
271 CC WRITE(NLPI~~O)
272 CC W R I T E ( N L P I 4 6 4 ) ( I I R l ( I ) I11
. r NP)
273 C
274 C REARRANGE H E A D I N G VECTORS
275 C
i7b LC0L.LCOL-1
277 IF(LPIVCO.EQ.LCOL+I)GO TO 136
278 DO 1 3 2 L.LPIVCO,LCOL
2 79 LHED(L).LHEP(L+l)
289 132 CONTINUE
281 136 KROU=KROW-I
282 IF(KPIVRO.EQ.KROW+l)GU TO I 4 4
283 DO 140 K.KP!VRO,KROlJ
284 KHED(K)mKHEP(K+I)
285 I40 CONTINUE
2Rb 144 CONTINUE
287 CC WRITE(NLPI~~O)KROWILCOL
288 cc WRITE(NLPt424)
289 CC WRITE(NLPt428) (KHED(K),LHeD(K),K=lrNnAX)
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
345
306.
307
308 C A L L BACSUB
3n9 4 0 0 F O R M A T ( 5 H NODEr6,W N L A S T )
31 0 404 F O R M A T ( l X I 2 I S )
31 1 408 F O R M A T ( / / 1 6 H N O D A L N U M B E R I N G / )
31 2 412 F O R M A T ( 9 1 5 )
3? 3 476 F O R N A T ( j 8 H H E R R O R ~ t I S f f I S r
31 4 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
31 5 1 / 6 2 H S A n E N O D A L NUHBER
31 6 I/)
31 7 4.17 F O R M A T ( / O H NCRROR.rIS//
31 8 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
319 1 / 6 2 H TO P E R I I I T T H E A S S E M B L Y OF T H E N E X T E L E E D E N T - - ~
320 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
321 I/)
322 418 C O R M A T ( / B H NERRf1R.r IS//
323 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 B E DUE T O - r m
324 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
325 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 0 PERM I
326 1/62H WHOLE FRONT TO B E A S S E M B L E D
327 11)
328 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 / )
329 424 F O R M A T ( / S H KHED,'SH l H E D / )
330 428 F O R M A T ( 2 1 6 )
331 432 FORMAT(/bH K D E S T I ~ H L D E S T I )
5.12 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 / )
333 440 FORMAT(20F5.2)
334 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 KPIV
s35 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 UHN?
336 1)
337 456 F O R H A T ( / S H J M O D / )
398 P. HOOD

336 460
339 464
340 468
341 476
342 480
343
344
345 c
346 C
- ..
567 c-
348 SUBROUTINE R E S O L
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 RESOLUTION
373 c
374 DO 2 N E L L r l t N E
37s CALL A B F I N D
376 2 CONTINUE
377 cc CALL N I l L T I H E ( I T 1 M E )
378 c c WRITE(NLPt476)ITIME
379 cc WRITE(NLPt472)
380 Do 4 1-
381 C C WRITE"
382 I C (NCOD
383 RI(1)aB
384 4 CONTINU
385 DO 12 N
- ..
SR6
387
588 I
389 P
390 C C 1
191 cc
392 C C
39 3
39 4
SP 5 1
396 a
39 7
398
399
400 C C
401 C C
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 408 FORMAT(14H D I S C CONTENTS/6H KROWmrISr7H PIVOTnrE20.10
407 1,8H K P I V R O ~ I I S )
408 412 FORMAT(SE20.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 . / / )
47 3 RETURN
41 4 END
4’15 c
416 C .................................................................
417 C
41 8 SUBROUTINE BACSirB
419 C
420 C
421 C BACK-SUBSTITUTION FOR F U L L P ~ V O T I N G
422 C
423 COMMON/FRONI/
424 1 NP,NHINE,NBN,NCN,NDIrnUCAINCLL,NTRA,NLP
425 COMMON/FRONZ/
426 1- N
427 co
428 1 s
429 DI
430 1 L
431 2,E
432 3, J
433 EQ
434 I (
435 2, (
436 3, (
437 4, (
438 5, (
439 6r(
440
441 C
442 C BACK S U B S T I T U T I n N
443 c
444 DO 4 I - l r N P
445 4 SK(I)nBC(I)
4A6 DO 32 I V m l r N P
447 BACKSPACE N D l
448 READ(ND1)
449 I 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 )
450 ~,KROU~PIVOT~KPIVRO~~PVKOL~K~,KHED~U~,K~~~KROU~
451 BACKSPACE N D I
452 CC URITE(NLPt404)
453 cc U R I ’ f C ( N L P ~ 4 0 8 ) UROILCOLILPIVCO
454 cc U R I T E ( N L P I ~ O ~ ) k L H E D ( L ) r L u l ,LCOL)
455 cc U R I T E ( N L P t 4 1 2 ) CQQ(L)rL*l r LCOL)
456 I F ( N C O D ( K R O ) . B T f ~ O ) G O TO 24
457 GASH-0,
458 QQ(LPIVC0)nO.
459 DO 16 LW1,LCOL
460 GASH.GASHnQQ(L)wSK(IAIS(LHED~L)))
441 16 CONTINUE
462 SK(KRO>RR~(KRO)*QASH
463 0 0 TO 32
464 24 CONTINUE
465 NCOD (KRO) -1
466 32 CONTINUE
467 UR ITL ( N L P I 41 6)
468 DO 36 L R l r N H
449 J~NOPP(L)~
470 IDFrMDFtL)
471 WRITE(NLP,420) L,(SK(J+I),Inl,gDF)
472 36 CONTINUE
473 404 F O R M A T ( 1 4 H T A P 6 CONTENTS)
474 408 FORMAT(IOI5)
475 412 FORMAT(5E20.10)
476 416 FORMAT(/8H RESULTS/)
477 420 FORBAT(15r6E18a 10)
478 RETURN
479 END

You might also like