You are on page 1of 15

Lecture notes on finite element method

S. N. Khaderi
August 10, 2015

Contents
1 Direct stiffness method
1.1 Basics . . . . . . . . . . . . . . . . . . . . . . .
1.2 Bar elements . . . . . . . . . . . . . . . . . . .
1.2.1 Assembly of elements . . . . . . . . . .
1.2.2 Properties of stiffness matrix (version 1)
1.3 Beam elements . . . . . . . . . . . . . . . . . .
1.4 Pinned-truss structures . . . . . . . . . . . . .

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

.
.
.
.
.
.

5
. 5
. 6
. 7
. 8
. 10
. 11

CONTENTS

Chapter 1

Direct stiffness method


1.1

Basics
F =m
Z

dv
dt

Z
dv
dv dx
dx = m dx
dt
dx dt
Z
Z
F dx = mvdv

F dx =

F dx =

F dx +

F dx

1
1
mv22 mv12
2
2

F dx =

1
1
mv 2 mv 2
2 2 2 1

F dx =

1
1
mv 2 mv 2
2 2 2 1

U (x2 ) (U (x1 )) =

1
1
mv 2 mv 2
2 2 2 1

E=

1
1
mv 2 + U (x1 ) = mv22 + U (x2 )
2 1
2
Z
U = F dx

For a small interval x


U=

F dx

U = F x
F = U
For static equilibrium
U = 0,
ie. U is stationary. For springs
U=

1 2
kx
2

For a gravity
U = mgx
5

CHAPTER 1. DIRECT STIFFNESS METHOD

For a constant force


U = F x
For a spring and external force system, we have
U=

1 2
kx F x.
2

Note, although 21 kx2 is the energy stored in the spring, F x is not the work done by the external force. For static
equilibrium we have
U = 0; F = kx
Exercises:
For a spring-force system, plot the potential energy as a function of x for various values of F .
Consider a bar of length L with a tapering cross-section A(x) = 1 + x/L. The left end is fixed and to right end a
force of unit magnitude is applied. Find the exact solution for this problem. Solve this problem using one, two and
three finite elements, assuming that the area is constant within each element, and compare with analytical solution.

1.2

Bar elements

Examples of one dimensional problems are axial loading of a stepped bar, loading of a chimney due to self weight.
We divide the entire bar in to tiny chunks, represented by lines. These are called elements. Adjacent elements are
connected together by points. These points are called nodes. Each node in a 1D-setting can move only along, x
direction. We say that each node in 1D has one degree of freedom.
Consider a bar as decsribed above. Let us divide it into a number of elements. Let at the nodes some forces act
along x direction. Consider a bar made of just one element. Its potential energy can be written as
=

1
k(u2 u1 )2 F1 u1 F2 u2 .
2

For statics, potential energy is minimum ie,

= 0,
= 0,
u1
u2
which gives
k(u2 u1 ) F1

0,

k(u2 u1 ) F2

0.

Writing in matrix form




k
k

k
k




u1
=
u2
KU =

F1
F2

F.

Now, we can apply displacemnt at one end, apply force at the other end, and solve for the displacement at the forced
end.
Now consider two finite elements represnting the same bar. The potential energy is
1
1
k(u2 u1 )2 + k(u3 u2 )2 F1 u1 F2 u2 F3 u3 .
2
2
Again, for statics, potential energy is minimum ie,
=

= 0,
= 0,
= 0,
u1
u2
u3

1.2. BAR ELEMENTS


which gives
k(u2 u1 ) F1
k(u2 u1 ) k(u3 u2 ) F2

=
=

0,
0,

k(u3 u2) F3

0.

0
u1
k u2 =
k
u3
KU =

Writing in matrix form,

k
k
0

k
k+k
k

F1
F2 ,
F3
F.

We cannot be repeating the same procedure when there are many, say a million, elements. We want a set of
systematic rules to construct the system of equations if we know the system of equations for one such elements.
The process of constructing the system of equations, for the entire structure by putting together information from
many elements that comprise it, is called finite element assembly. The rules to be followed are compatability and
external nodal force balance.

1.2.1

Assembly of elements

Consider again the two bar structure. There are three nodes (1,2,3). These nodal dof correspond to the actual
structure, let us call them structural degrees of freedom. Also sometimes called as global degrees of freedom.
Each of the element is connected to two nodes. We can say that each element is connected locally to two nodes (1,2).
Since these nodal dof correspond to each element, let us call them elemental/local degrees of freedom. We now
have the following different quantities corresponding to the local dof,
(1)
u1 : displacement of node 1 of element 1
(1)
u2 : displacement of node 2 of element 1
(2)
u1 : displacement of node 1 of element 2
(2)
u2 : displacement of node 2 of element 2
(1)
F1 : force acting at node 1 of element 1
(1)
F2 : force acting at node 2 of element 1
(2)
F1 : force acting at node 1 of element 2
(2)
F2 : force acting at node 2 of element 2
Likewise, we have te following quantities corresponding to global dof
u1 : displacement of node 1
u2 : displacement of node 2
u3 : displacement of node 3
F1 : force acting at node 1
F2 : force acting at node 2
F3 : force acting at node 3
What we know from compatability of displacements is
(1)

u1

= u1 ,

u2

= u2 = u1 ,

u3

= u2 ,

F1

F1 ,

F2

F2

F3

F2 .

(1)

(2)

(2)

and from the force balance we have


(1)

(1)
(2)

(2)

+ F1 ,

CHAPTER 1. DIRECT STIFFNESS METHOD

The system of equations at an elemental level, for element 1 is


k(1) u(1)

= f (1) ,

(1)

(1)

= F1 ,

(1)

(1)

= F2 ,

k(u2 u1 )
k(u2 u1 )

(1)

(1)

and for element 2 is


k(2) u(2)
(2)
k(u2
(2)
k(u2

(2)
u1 )
(2)
u1 )

= f (2) ,
(2)

= F1 ,
(2)

= F2 .

Now we can write


(1)

(1)

k(u2 u1 ) = k(u2 u1 )
(1)
k(u2

(1)
u1 )

(2)
k(u2

This leads to same matrix form as before

k
k
k k + k
0
k

(2)
u1 )

= k(u2 u1 ) k(u3 u2 )
k(u3 u2 )

0
u1
k u2
k
u3
KU

= F1 ,
= F2 ,
= F3 .

F1
= F2 ,
F3
= F.

Here, K is called the global stiffness matrix and f is called the global force vector and U is called the global
displacement vector. The assembly process has to be carried over both the stiffness matrix and force vector. To
assemble the global stiffness matrix K, create a null matrix of size ndof x ndof , and then add to it the stiffness
coeffients of each element k(i) , at appropriate locations. The global force vector F is simply constructed from the
contributions at the respective nodes.

1.2.2

Properties of stiffness matrix (version 1)

The stiffness matrix is sparse. This is also true for finite elements in two and three dimensions.
The stiffness matrix is positive semi-definite. This can be easily seen as follows. Premultiply the above equation
( ) by U , U T K U = U T F . Note that the right hand side is always non-negative, implying that the matrix K
is positive semidefinite. Right hand side is always non-negative because for elastic (stable) systems the work
done by the forces can be non-negative.
The stiffness matrix is symmetric. This happens because of the quadratic form of the potential energy of the
springs, with respect to the relative displacement. This not the conventional way of explaining the symmetry
of the stiffness matrix. Usually it is explained through the reciprocal theorem. Here, however, we will not
invoke this.
Let a set of forces F1 be applied on a structure to cause a displacement U1 . The potential energy stored is

1 =

1
1
F1 U1 = UT1 KU1 .
2
2

Now, on top of F1 , let us apply F2 . The potential energy due to F2 alone is


2 =

1
1
F2 U2 + F1 U2 = UT2 KU2 + UT1 KU2 .
2
2

1.2. BAR ELEMENTS


The total potential energy is
1
1 T
U1 KU1 + UT2 KU2 + UT1 KU2 .
2
2
If we repeat the procedure and apply F2 first and then apply F1 , the total potential can be written as
= 1 + 2 =

= 1 + 2 =

1 T
1
U KU1 + UT2 KU2 + UT2 KU1 .
2 1
2

Since the history of loading does not matter in linear elasticity, we have = . Consequently
UT2 KU1 UT1 KU2
T
UT2 KU1 KT U1 U2
UT2 KU1 UT2 KT U1


UT2 K KT U1

0,

0,

=
=

0,
0,

K =

KT .

Identify the statement of reciprocal theorem.


The stiffness matrix is a positive semidefinite matrix. It should have certain set of eigenvalues (non-negative)
and eigenvectors. These should relate to the underlying deformation behaviour of the bar. The eigenvectors
for the stiffness matrix represent the independent modes in which the bar can deform. The corresponding
eigenvalue represents what is the associated stiffness.
For example, for a single element we have




 
k k
0 0
u1
= 0.

k
k
u2
0 1

i.e.,
det



k
k

k
k

The characteristic equation is


k


k

0
0

0
1




k
k

(k )2 k 2
k 2 + 2 2k k 2

= 0,
= 0.

= 0,
= 0,

( 2k) = 0.
The eigenvalues are = 0, 2k. The corresponding eigenvectors can be found as follows,



k
k
u1
= 0,
k k
u2
When = 0


k
k

k
k



u1
u2

= 0.

The eigenvector corresponding to = 0 is (1 1) . This means that in this deformation mode, both the nodes
will translate by the same amount. The associated stiffness with this deformation mode is null. When = 2k,



k k
u1
= 0.
u2
k k
T

The eigenvector corresponding to = 0 is (1 1) . This means that in this deformation mode, both the nodes
will translate by the same amount, but in opposite direction. The associated stiffness with this deformation
mode is 2k.

10

CHAPTER 1. DIRECT STIFFNESS METHOD


Even without solving the above example, we can envisage that there can be a mode in which the structure
just translates, as a rigid body, under the action of applied force. This is possible when it is not constrained
from motion. When a body is not constrained from motion, even a small force can cause large displacements in
statics. In otherwords, the associated stiffness that can resist translation in the absence of a constraint would
be zero. Hence one of the eigenvalues for K will be zero for 1D problem.
Entending this idea, we can find the number of zero eigenvalues for K in two- and three-dimensional problem;
they will be three and six, respectively.

1.3

Beam elements

The equations for 1d bar element are



These can be written as
u1

a
d
a
d

b
c




u1
u2

b
c

+ u2


=

F1
F2


F1
F2

.


To find the matrix coefficients (a, d), we can prescribe u1 = 1, u2 = 0, and find the reaction forces (F1 , F2 ). To find

the matrix coefficients (b, c), we can prescribe u1 = 0, u2 = 1, and find the reaction forces (F1 , F2 ). This procedure
can be used for all kinds of finite elements. For structural elements, we can easily evaluate the reaction forces from
our knowledge of mechanics of solids. For continuum elements, however, the calculation of reaction forces is not
straight forward. We will now use this procedure to find the stiffness coefficients for beam elements.
First we have to understand how many degrees of freedom are allowed at a node of a beam element. The
independent kinematic variables are the displacement and rotations. Now one may ask, is not one derivative of the
other. That is very true only if we already know the deflection of the beam as a function of its length. However, if
we are looking at a point on the beam, the deflection can ve independent of the slope. For example, at a point, the
deflection can be zero, but the slope need not be so. Hence, there are two independent degrees of freedom at a node
of a beam. Consequently, there should be two corresponding forces at a node. These are the transverse forces and
external moments (not bending moments, what is the difference?)

11

1.4. PINNED-TRUSS STRUCTURES

Consider a beam structure. Let us divide/discretize it into a number of beam elements. It has two nodes at the
end: a beam element has four degrees of variables. These are (v1 , 1 ) at node 1 and (v2 , 2 ) at node 2. The system
of equations would look like

v1
K11 K12 K13 K14
F1

K21 K22 K23 K24 1 M1

K31 K32 K33 K34 v2 = F2 .

2
K41 K42 K43 K44
M2
To evaluate these we write the above system of

K12
K11
K22
K21

v1
K31 + 1 K32
K42
K41

equation as

K13
K23

+ v2
K33

K43


K14

F1
K24 M1

+ 2
K34 = F2

M2
K44

To find the first coefficient vector, we prescribe v1 = 1, and all other degrees of freedom to be zero. Now the coefficient
vector is the same as the reaction forces at the corresponding degrees of freedom. This procedure is appropriately
repeated until all the coefficients are found. The resulting system of equations is

v1
12
6L 12 6L
F1

2
EI
1
6L 2L2
M1

6L 4L
=
,
v2
F2

L3 12 6L 12 6L

2
2
2
6L 2L
6L 4L
M2
ku = f .
These are the system of equations for one beam element. i.e., the above k is the local stiffness matrix and f is the
local force vector. Since a beam structure will be made from number of elements, finite element assembly has to be
performed so that we can construct the global stiffness matrix K and force vector f from the local stiffness matrices
k(i) and force vectors f (i) , respectively.

1.4

Pinned-truss structures

Elements of a truss structures are connected through pins and are supported by hinges. They can sustain only axial
forces, but not transverse forces. So is our 1d bar element. ie. if we take a bar element and apply a transverse force,
it will not be resisted, and will start accelerating. Hence elements of a truss structure are nothing but rotated bar
elements. So, let us talk about rotations.

Consider an bar element that makes an angle with the horizontal. In the local coordinate system, denoted using
primes, the displacements are (u , v ) at a node. The system of matrices can be written as

Fx1
u1
1 0 1 0

Fy1
0 0 0 0 v1

(1.4.1)
k1

1 0 1 0 u2 = Fx2

v2
Fy2
0 0 0 0
K u

= F

(1.4.2)

12

CHAPTER 1. DIRECT STIFFNESS METHOD

If at a node, the displacements in the global coordinates are denoted by (u, v), the displacements in the global and
local coordinate systems are related by the transformation matrix as


u1
v1

C
S

S
C



u1
v1

(1.4.3)

(y2 y1 )
. Hence,
where C = cos and = sin , and = atan (x
2 x1 )

u1
v1

u2
v2

C
S
=
0
0

u1
0
v1
0

S u2
v2
C

0
0
C
S

S
C
0
0

= Tu
u,

(1.4.4)
(1.4.5)

where T is called the transformation matrix. Likewise can also write for forces
F = T F .
Now equation ( ) can be written as
K u
K T u
T K T u
Ku

= F
= TF
= F
= F,

(1.4.6)
(1.4.7)
(1.4.8)
(1.4.9)

where K and F are the quantities whose reference basis is the global coordinates. The above system of equations
are for one finite truss element only. So we ahave to do the finite element assembly to obtain the matrices for whole
truss structure. Let us do the assembly for an example problem below.
1

1
2

y
x
2
3

3
Consider a three element truss structure as shown. Let the element numberring and node numbering be as shown.
First we have to assign which is the local x direction for the members. Let us denote it by the arrows. From this
choice we have the following connectivity table for the elements.
Element
1
2
3

Node 1
1
2
1

Node 2
2
3
1

Let EA/L = 1 for elements 1 and 2, and EA/L = 2 for elements 3. The system of matrices for these three elements

13

1.4. PINNED-TRUSS STRUCTURES


can be written in global coordinate system as

1 0 1 0
0 0
0 0

1 0
1 0
0 0
0 0

0
0 0
0
0
1
0
1

0
0 0
0
0 1 0
1

1 1 1
1
1
1
1
1

1
1
1 1
1 1 1
1
On assembly, the stiffness components corresponding to

2 1 1
0 1
1
1
0
0
1

1
0
1
0
0

0
0
0
1
0

1
1
0
0
1
1 1
0 1 1

U1
V1

U2 =
V2

U2
V2

U3 =
V3

U1
V1

U3 =
V3

the each dof

1
U1
V1
1

0
U2

1
V2
1 U3
V3
2

0,

(1.4.10)

0,

(1.4.11)

0,

(1.4.12)

will add-up, resulting in

1
Fx

Fy1

= Fx2 .

Fy

Fx
Fy3

(1.4.13)

Now we can apply our usual boundary conditions to solve our quantity of interest. Since the problem is twodimensional rather than one-dimensional as before, there will be three modes of deformation for which the eigenvalue
will be zero, which are ?. Hence, to render a solvable system we have to suppress these rigid body modes. A matlab
code that illustrates how to solve this truss problem is given below.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% % coordinates
x = [ 0,0;
1,0;
1,-1];
% % % connectivity
icon = [1 2;
2 3;
1 3];
% % % EA/L for the three elements
EAOL = [1 1 1];
nelm = 3;
% number of elements
nnod = 3 ; % number of nodes
neqs = 6 ;
% number of equations to be solved *
ndofplmn = 4 ;
% number of dof per element
% Initialize the global stiffness matrix and force vector
Kg = zeros(neqs);
Fg = zeros(neqs,1);
% initialize the arrays for boundary condition
ibc = zeros(neqs,1);

14

CHAPTER 1. DIRECT STIFFNESS METHOD

bc = zeros(neqs,1);
ibc(1) =1; % Apply displacement BC or not
ibc(2) =1; % Apply displacement BC or not
ibc(6) =1; % Apply displacement BC or not
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for lmn=1:nelm
% local to global association
node1 = icon(lmn,1);
node2=icon(lmn,2);
%
calculate angle
xl = [x(node1,1) x(node2,1)];
yl = [x(node1,2) x(node2,2)];
theta = atan2(yl(2) - yl(1), xl(2) - xl(1));
%
calculate transformation matrix
Tmat = [ cos(theta)
sin(theta)
0
-sin(theta)
cos(theta)
0
0
0
cos(theta)
0
0
-sin(theta)

%
%

0;...
0;...
sin(theta);
cos(theta)];

elemental stiffness matrix in local coordinate system


Kl = EAOL(lmn)*[1 0 -1 0; 0 0 0 0; -1 0 1 0; 0 0 0 0];
elemental stiffness matrix in global coordinate system
Kl = Tmat' * Kl * Tmat;

matrix that facilitates assembly


iv=[
2*(node1-1)+1, 2*(node1-1)+2, ...
2*(node2-1)+1, 2*(node2-1)+2 ...
];
for i=1:ndofplmn
Fg(iv(i)) = Fg(iv(i)) ; %% no body force vector assembly
for j=1:ndofplmn
Kg(iv(i), iv(j)) = Kg(iv(i), iv(j)) + Kl(i,j);
%% Assembling stiffness matrix
end
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% now add the external forces to the Fg if any
Fg(3:4) = 1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
for i = 1:neqs

1.4. PINNED-TRUSS STRUCTURES

15

if ibc(i) ==1
% if there is a displacement boundary condition
for j=1:neqs
% applied modify the force vector accordingly
Fg(j) = Fg(j) - Kg(j,i)*bc(i);
end
% modify the entries on which the displacement is applied
% so that it becomes redundant
Kg(:,i) = 0;
Kg(i,:) = 0;
Kg(i,i) = 1;
Fg(i) = bc(i);
end
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
U = inv(Kg)*Fg

You might also like