You are on page 1of 3

Bar element: Computation of the global stiffness matrix

A) Geometry
The following terms are defined:
nd : Problem dimension (i.e. 2D, nd = 2 )
nel : Total number of bars
n : Total number of nodes (joints)
ngl : Total degrees of freedom ( ngl = n nd )

nnod : Number of nodes in a bar ( nnod = 2 )


x : Array containing nodal coordinates:
x , , xn
x 1

y1 , , yn
T : Array containing the connectivity table
5

A
A
A
T =

(1)
B (e ) B ( nel )
B
(1)

(e)

( nel )

1 2 4 2 3

Texample =
4 4 5 5 5

B) Computation of element stiffness matrices


for e 1: nel
% compute element matrix

x1e x(1, T(1, e)),

y1e x(2, T(1, e))

x2e x(1, T(2, e)),

y2e x(2, T(2, e))

( y2e y1e )
( x2e x1e )
e

,
c
,
le
le
c2
cs c 2 cs

s 2 cs s 2
Ae E e cs
e
K e
l c 2 cs c 2
cs

2
cs
s2
cs s
se

% store element matrix


for r 1: nnod nd
for s 1: nnod nd

Kel (r , s, e) = K e (r , s)
end
end
end

l e ( x2e x1e ) 2 ( y2e y1e ) 2

C) Global matrix, KG
0 0
KG

0 0 n ,n
gl gl
nel

Assembling of the stiffness matrix:

KG A K e
e 1

% for each bar


for e 1: nel
for a 1: nnod
for i 1: nd
r = nd (a -1) + i
% local degree of freedom
A T( a , e )
% global node
p = nd ( A -1) + i
% global degree of freedom
for b 1: nnod
for j 1: nd
s = nd (b -1) + j % local degree of freedom
B T(b, e)
% global node
q = nd ( B -1) + j % global degree of freedom
KG ( p, q) KG ( p, q) Kel (r , s, e)
end
end
end
end
end
D) Global system of equations
K RR
K
LR

K RL u R
R
F ext

K LL u L
0

where u R and u L are the imposed and free displacement vectors, respectively.
Reduced global system
K LL u L FLext K LR u R
R K RR u R K RLu L

Displacement solution is stored in:


u
u R
u L
% REMARK: in the case of the example
% Let vL [7 8 9 10]
% Let vR [1 2 3 4 5 6]

9,10

7,8

1, 2

3, 4

5, 6

K LL KG (vL , vL )

% then

K LR KG (vL , vR )
K RL KG (vR , vL )
K RR KG (vR , vR )

E) Strains and Stresses


(1) , , ( nel )

(1) , , ( nel )
Strains and stresses can be computed by means of the following procedure:
for e 1: nel
% calculate s e and c e
x1e x(1, T(1, e)), y1e x(2, T(1, e))
x2e x(1, T(2, e)),

y2e x(2, T(2, e))

( y2e y1e )
( x2e x1e )
e
c
l e ( x2e x1e ) 2 ( y2e y1e ) 2
,

,
e
e
l
l
% obtain element displacements
for a 1: nnod
A T( a , e )
% global node
for i 1: nd
r = nd (a -1) + i
% local degree of freedom
p = nd ( A -1) + i
% global degree of freedom
se

d e (r ) u( p)
% element displacements at global coordinates
end
end
% calculate local element displacements
c s
Re

s c
de R e d e
u1xe
e
e d

u
2x
% calculate strain and stress
u e u e
( e ) 2 x e 1x
l
( e ) E ( e )
end

% element displacements at local coordinates


% element displacements

% element strain
% element stress

You might also like