Solution of Finite Element Equations
Solution of Finite Element Equations
Solution of Finite Element Equations
Krenk, Steen
Publication date:
1991
Document Version
Publisher's PDF, also known as Version of record
General rights
Copyright and moral rights for the publications made accessible in the public portal are retained by the authors and/or other copyright owners
and it is a condition of accessing publications that users recognise and abide by the legal requirements associated with these rights.
- Users may download and print one copy of any publication from the public portal for the purpose of private study or research.
- You may not further distribute the material or use it for any profit-making activity or commercial gain
- You may freely distribute the URL identifying the publication in the public portal -
Take down policy
If you believe that this document breaches copyright please contact us at vbn@aub.aau.dk providing details, and we will remove access to
the work immediately and investigate your claim.
X X
X X X
X X
X
S. KRENK
SOLUTION OF FINITE ELEMENT EQUATIONS
OCTOBER 1881 ISSN 0902-7513 R91 37
SOLUTION OF FINITE ELEMENT EQUATIONS
Steen Krenk
October 1990
1. AN INTRODUCTORY EXAMPLE
Finite element equation systems are built from the contributions of in-
dividual elements. Usually the global equations are set up without any
regard of the boundary conditions first, and the boundary conditions are
then introduced as a modification of the full global matrix. The proce-
dure is illustrated by the example shown in Fig. 1. A rectangular domain
is modelled by four linear triangles. The side 1-2 has a linear heat source
distribution and the side 5-6 is kept at constant temperature T = 0.
With constant conductivity k and thickness t of all elements the expanded
element conductivity matrices are, Krenk (1989),
2
3 1
ql
® ®
T=O h
0 CD
6 4 2
h h
1 -1 0 0 0 0
-1 2 0 -1 0 0
0 0 0 0 0 0
lKn = kt
0 1 0 0
2 0 -1
0 0 0 0 0 0
0 0 0 0 0 0
1 0 -1 0 0 0
0 0 0 0 0 0
[Jqe] = kt -1 0 2 -1 0 0
2 0 0 - 1 1 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
0 0 0 0 0 0
[Kje] = kt 0 0 2 - 1 -1 0
2 0 0 -1 1 0 0
0 0 -1 0 1 0
0 0 0 0 0 0
3
0 0 0 0 0 0
0 0 0 0 0 0
(K:eJ = kt 0 0 0 0 0 0
2 0 0 0 1 0 -1
0 0 0 0 1 -1
0 0 0 -1 -1 2
2 -1 -1 0 0 0
-1 2 0 -1 0 0
4
(K] = L (K;eJ = ~t -1
0
0
-1
4
-2
-2
4
-1
0
0
-1
j=l
0 0 -1 0 2 -1
0 0 0 -1 -1 2
2 - 1 -1 0 0 0 Tt 2 0
- 1 2 0 -1 0 0 T2 1 0
kt -1 0 4 -2 -1 0 T3 qlh 0 0
- = - +
2 0 -1 -2 4 0 -1 T4 6 0 0
0 0 -1 0 2 -1 Ts 0 Qs
0 0 0 -1 -1 2 Ts 0 Q6
4
2 -1 -1 0 0 0 XI 2
-1 2 0 -1 0 0 X2 1
-1 0 4 -2 -1 0 XJ 0
=
0 - 1 -2 4 0 -1 x4 0
0 0 -1 0 2 -1 xs rs
0 0 0 -1 -1 2 X6 T6
2. GAUSS ELIMINATION
Ax=b (1)
(3)
5
(4)
- 1 - 1 0
2 0 -1
0 4 -2
- 1 -2 4
First the elements below the diagonal in the first column are zeroed by
subtracting the first row multiplied by a suitable factor.
2 - 1 - 1 0
0 3/2 -1/2 -1
[0 -1/2 7/2 -2
0 -1 -2 4
Now zeros are introduced in the elements below the diagonal in the second
column by use of the second row.
6
-1 0
-1/2 -1
10/3 -7/3
-7/3 10/3
2 -1 - 1 0
0 3/2 - 1/2 -1
[0 0 10/3 -7/3
0 0 0 17/10
from which
10 5 25
X<t = 17 2 = 17
3 (5 7 25) 26
XJ = 10 3 + 3 17 = 17
Similarly the second and the first equation give
7
and
Xl = ~ (2 + 26 + 48) = 54
2 17 17 17
When the unknown vector x has been determined the last two equa-
tions, that were originally disregarded, can be used to determine the two
unknown source intensities (Q 5 , Q6 ). The last equations are
26
rs = - 1xa + 2xs - 1xs
17
=-
25
rs = -1x4 -1xs +2xs = --
17
* * *
The Gauss elimination procedure used in Example 1 is easily developed
in the form of a general algorithm. It consists of two parts: forward
reduction and back substitution. The forward reduction consists of n- 1
steps i = 1, 2, ... , n -1. In step i zeros are introduced below the diagonal
of column i. This requires updating of the lower part of the matrix A
and the b . The Gauss forward reduction is expressed in pseudo code in
the following algorithm.
for i := 1 to n - 1 (step i)
f or k := i + 1 to n (mw k)
for j := i +1 to n (column j)
* * *
8
Ux=z (5)
U =
UlJ
U!n
U2n 1 (6)
[
tt~,
The vector z T = ( z 1 , . .. , zn) is obtained in the process by modification
of the original vector b .
The back substitution part of Gauss elimination is the stepwise solution
of the equation system (5), starting from the last equation. The pseudo
code for back substitution is given below.
* * *
Note that the upper triangular matrix U is stored in the upper triangular
part of A . Upon exit the solution x is contained in the vector b.
The Gauss elimination solution procedure is simple and direct. However,
one disadvantage of the algorithms shown above is that the right hand
side b is modified during both parts of the solution procedure. In practice
9
3. LU- FACTORlSATION
(7)
J
The factorisation amounts to determination of two triangular matrices L
and U such that
A=LU (8)
With this factorisation the equation system (1) takes the form
LUx=h (9)
10
(11)
The submatrix Ai with one more row and column can then be factored
as
A; = L;U; (13)
and
U;=
ui-1 u;] (15)
[
oT d;
(16)
(17)
d; + Ifu;
Comparison with (16) gives the following equation for the new i'th row
If of L;, the new i'th column u; of U;, and the new diagonal element
d; .
(19)
d; +If Uj = Cj (20)
The equations (18) and (19) for u; and I; are in lower triangular form,
and can therefore be solved directly.
The three relations (18) - (20) comprise step i of the factorisation algo-
rithm. In step i the factored part is increased in size from (i - 1) x (i -1)
to i x i by adding a new row and column. Note that the new row and
column do not change the parts, L;_ 1 and U;_ 1 , that have already been
factored. Thus only row i and column i are "active" in step i. This is
12
1
Fig. 2. Progress of front in step i of LU-factorisation.
Algorithm: LU-factorisation.
for i := 2 to n (step i)
for j := 1 to i- 1 (eqn. j)
fo1· k := 1 to j - 1
* * *
13
Lz=b (21)
Ux=z (22)
Algortithm: L U solution.
for j := 1 to i - 1
b; := b; - a;j * bj
b; := b;ja;;
* * *
The first part of the LU solution algorithm places z in the storage posi-
tions of b, and t he second part replaces z with x . It is notable that the
LU factorisation algorithm replaces the matrix A with the two triangular
factors L and U "in place", i.e. without need for any additional storage.
Similarly the LU solution algorithm replaces b by x "in place".
14
Example 2. LU factorisation .
~11
- 1 - 1
2 0
0 4 -2
-1 -2 4
1 -1 1
/2 1 = - a21 = - =
u11 2 2
1
3
2
1 - 1 1
l3 1 =- a31 = - = --
u ll 2 2
15
The final step proceeds similarly to produce the fully factored matrix
[~~ ;;]
-1 -1
3 1
21 -2
10
-3 3
2 ..,. .1_ 17
-3 10 10
* * *
In finite element computations the time spent in solving the equations
is often an important part of the total computation time. It is therefore
of interest to know the number of operations used in the solution. The
division may be considered equivalent to a multiplication. Addition and
subtraction are so fast that they can be neglected without appreciable er-
ror. The number of operations in step i of the LU-factorisation algorithm
IS
i-1 i- 1
N; = 2~)j-1)+2{i-1) =
j=l
2I>
j=1
= i( i - 1) {23)
16
(24)
For fairly sized finite element applications N is a very large number - 104
degrees of freedom gives N"' 3 · 10 11 . It is therefore important to exploit
the special properties of the equation system, such as synunetry and band
structure, to decrease computer time as well as storage requirements.
4. LDLT FACTORJSATION.
dll
D=
l
The symmetric matrix A can then be factored in the form
(25)
A = LU = LDLT (26)
(27)
(28)
(30)
and
{32)
(L;-lDi-I)li = a; {33)
(34)
18
These relations are similar to {18) - {20) for the unsymmetric case, but
now there are only i instead of 2i - 1 unknown parameters to be deter-
mined.
In the solution of {33) it is convenient first to determine the vector
U; = D;l; {35)
Then l; is determined from {35), and finally d; follows from {34). This
procedure is very close to that used in LU factorisation. Indeed u; is the
i'th column of the upper triangular matrix U. The difference is that in
this case u; is overwritten by I;, when using (35). This way of computing
l; saves about half the number of operations and half the storage.
for i := 2 to n (step i)
fo1· j := 2 to i- 1 (eqn. j)
fm· k := 1 to j - 1
(uji from (36))
for j := 1 to i- 1
(lij = Uj;jdjj)
a;;:=a;;-aii*U (d;; from (34))
* * *
19
In the LDLT algorithm only the upper half of A is used, and upon
exit this upper half has been replaced by LT and D . The algorithm
works essentially "in place" with only a single t emporary storage location
needed. The operation count is
1 3
N,...., -n (37)
6
Lz = b (38)
Dy = z (39)
(40)
for i := 2 to n
for j := 1 to i - 1
b; := b; - aj; * bj (z from (38))
for i := 1 to n
b; := b;fa;; (y from (39))
for. i := n- 1 down to 1
for j := i + 1 to n
b; := b; - a;j * bj (x from (40))
* * *
20
!f j
-2 -2
3
[2 2 -3
10
1
3 10
17
10
* * *
4
1 5
@)
®
2 6
3
®
®
8 7
X X
X
A;=
X X X
X X
X
The matrix has band structure, but the "profile" indicated in the figure
appears to be more characteristic. The profile describes the height of
each column above the diagonal. Note that zero entries may be included
within the profile.
* * *
This section gives a description of LDLT factorisation of a symmetric
matrix stored colurnnwise inside the matrix profile. The method is easily
extended to LU factorisation of non-symmetric matrices, but in the case
of non-symmetric matrices pivoting may be necessary, and that would
complicate the method.
22
L;_ 1 is a lower triangular matrix, and it then follows that of the first
i 0 elements of a; are zero, then the first io elements of u; must also be
zero. It follows from (35) that 1; also starts with i 0 zero elements. As a
consequence of this the factored form of A given by D and LT fits within
the profile of the original matrix A.
In profile storage of a matrix A the entries between the profile and the
diagonal - including the diagonal - are stored columnwise in a one-
dimensional array A;. The order of storage of the matrix of Example
4 is
1 2 6
3 4 7
5 8 12 18
9 10 13 19
A;= (42)
11 14 20
15 16 21
17 22
23
Two modifications of the LDLT algorithm are needed, when profile stor-
age is used:
- a correspondance between the double subscript of the algorithm and
the single storage subscript must be established, and
- checks must be incorporated to prevent the algorithm from addres-
sing locations outside the profile.
Let i 0 denote the number of zero elements above the profile in column
No. i. The number of elements inside the profile is m;- mi-1· The total
number of elements in column No. i is i, and thus
io = 6- (15- 11) = 2
(46)
f01· i := 2 to n
f or j := io +2 to i- 1
]o := mj-1 - Js (zeros in j)
ji :=is+ j
U := A(ji)
A(ji) := A(ji)/A(mj)
* * *
The profile solution procedure makes use of the same indexing scheme.
25
for i := 2 to n
is := m; - i (sum index i)
for j := io +1 to i - 1
b; := b; - A(is + j) * bj
for i := 1 to n
b; := b;fA(m;)
for i := n- 1 down to 1
for j := i +1 to n
io := mi-1 - js (zeroinj)
b; := b;- A(js + i) * bj
* * *
In order to use the profile storage and solution scheme in a finite element
calculation the index array m; must first be calculated by the program.
This calculation is performed in two steps: first all elements are scanned
and the array m; is used to accumulate the column heights, and finally the
index values are calculated from the column heights. The accumulation
of column heights is conveniently implemented as a dummy run of the
assembly routine.
26
m;:= 1
for i := 2 to n
for i := 1 to Ne
(all combinations)
for j := i + 1 to Ne}
h := In;- nj I +1 (new height)
if n; < ni then
else
if mn, < h then mn, := h
* * *
27
m;= (l,l,l,l,l,l,l,l)
n; = (1, 2, 4)
When all elements have been called the array m; contains the column
heights,
m;= (1,2,2,4,2,4,2,6)
This index array was already obtained directly from the matrix entries
in (42).
* * *
When the size of the inner loops of the factorisation algorithm are
limited by the bandwidth or the profile the typical number of compu-
tations in one step is approximately ~ B 2 as indicated in Fig. 4.
28
t
I
i-[~ ]rn
Fig. 4. Active area~ ~B 2 in step i.
6. PRESCRIBED VALUES.
This will leave rows and columns corresponding to the prescribed degrees
of freedom untouched and available for later analysis.
Alternatively the prescribed values x; = xi may be left as unknowns, and
the equations matrix modified to enforce the relation x; = x;. This is
done by adding a;x; = a;x; to equation i, where a;; is large compared
with the original diagonal element a;;.
au a1; a1n bt
a;1
anl
a;;
ani
+a; a;n
ann
[] = b; + atui
bn
(47)
REFERENCES.