0% found this document useful (0 votes)
17 views

Exercise_Chapter-3_Frame-Analysis-by-FEM-MatLab-coding

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

Exercise_Chapter-3_Frame-Analysis-by-FEM-MatLab-coding

Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Chapter 3 Exercise

1.Analysis using finite element method


 Unit conversion:
L1=10 ( ft )=120(¿)

L2=9 ( ft )=108(¿)

 Drawing the free-body diagram, we have


 The distributed force in element (1) can be drawn again as follow:

The vertical downward force at 2 nodes are -4000 lb and the momnents at node 1
and 2 are -80000 (lb-in) and 80000 (lb-in), respectively
Choosing point O as the origin, the coordinate of each node are
Node x (in) y (in)
1 0 108
2 120 108
3 120 0
The connectivity table
Element 1 2
1 1 2
2 3 2

For element (1)


o l (1) =√(120−0)2 +(108−108)2=120 (¿)
120−0 108−108
o l= =1; m= =0
120 120

The local stiffness matrix is


'( 1) 6
k =20∗10
[ ]
7.65 −7.65
0 0 0 0
120 120
12∗204 6∗204 −12∗204 6∗204
0 0
1203 1202 1203 1202
6∗204 4∗204 −6∗204 2∗204
0 2
0 2
120 120 120 120
−7.65 7.65
0 0 0 0
120 120
−12∗204 −6∗204 12∗204 −6∗204
0 0
1203 1202 1203 1202
6∗204 2∗204 −6∗204 4∗204
0 0
120
2
120 120
2
120

So, the global stiffness matrix of element (1) is

[ ]
(1) T '( 1)
k =L k L

51 −51
0 0 0 0
800 800
17 17 −17 17

[ ]
T 0 0
1 0 0 0 0 0 12000 200 12000 200
0 1 0 0 0 0 17 34 −17 17
0 0
6 0 0 1 0 0 0 200 5 200 5
¿ 20∗10
0 0 0 1 0 0 −51 51
0 0 0 0
0 0 0 0 1 0 800 800
0 0 0 0 0 1 −17 −17 17 −17
0 0
12000 200 12000 200
17 17 −17 34
0 0
200 5 200 5

[ ]
1 0 0 0 0 0
0 1 0 0 0 0
0 0 1 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
[ ]
51 −51
0 0 0 0
800 800
17 17 −17 17
0 0
12000 200 12000 200
17 34 −17 17
0 0
(1) 6 200 5 200 5
k =20∗10
−51 51
0 0 0 0
800 800
−17 −17 17 −17
0 0
12000 200 12000 200
17 17 −17 34
0 0
200 5 200 5

For element (2)


o l (2) =√(120−120)2 +(108−0)2=108 (¿)
120−120 108−0
o l= =0 ; m= =1
108 108

[ ]
'( 2) 6
k =20∗10

7.65 −7.65
0 0 0 0
108 108
12∗204 6∗204 −12∗204 6∗204
0 0
1083 1082 1083 1082
6∗204 4∗204 −6∗204 2∗204
0 2
0 2
108 108 108 108
−7.65 7.65
0 0 0 0
108 108
−12∗204 −6∗204 12∗204 −6∗204
0 0
1083 1082 1083 1082
6∗204 2∗204 −6∗204 4∗204
0 0
108
2
108 108
2
108

Converting to global coordinates: k (2)=LT k '( 2) L


[ ]
17 −17
0 0 0 0
240 240
17 17 −17 17

[ ] [ ]
T 0 0
0 1 0 0 0 0 8748 162 8748 162 0 1 0 0 0 0
−1 0 0 0 0 0 17 68 −17 34 −1 0 0 0 0 0
0 0
6 0 0 1 0 0 0 162 9 162 9 0 0 1 0 0 0
¿ 20∗10
0 0 0 0 1 0 −17 17 0 0 0 0 1 0
0 0 0 0
0 0 0 −1 0 0 240 240 0 0 0 −1 0 0
0 0 0 0 0 1 −17 −17 17 −17 0 0 0 0 0 1
0 0
8748 162 8748 162
17 34 −17 68
0 0
162 9 162 9

[ ]
17 −17 −17 −17
0 0
8748 162 8748 162
17 −17
0 0 0 0
240 240
−17 68 17 34
0 0
(2) 162 6 9 162 9
k =20∗10
−17 17 17 17
0 0
8748 162 8748 162
−17 17
0 0 0 0
240 240
−17 34 17 68
0 0
162 9 162 9
[ ]
The global stiffness matrix:

51 −51
0 0 0 0 0 0 0
800 800
17 17 −17 17
0 0 0 0 0
12000 200 12000 200
17 34 −17 17
0 0 0 0 0
200 5 200 5
−51 51 17 17 −17 17
0 0 + 0 0+ 0
800 800 8748 162 8748 162
K=20∗10 6 −17 −17 17 17 −17 −17
0 0 + +0 0 0
12000 200 12000 240 200 240
17 17 17 −17 34 68 −17 34
0 0+ +0 + 0
200 5 162 200 5 9 162 9
−17 −17 17 −17
0 0 0 0 0
8748 162 8748 162
−17 +17
0 0 0 0 0 0 0
240 240
+17 34 −17 68
0 0 0 0 0
162 9 162 9
[ ]
51 −51
0 0 0 0 0 0 0
800 800
17 17 −17 17
0 0 0 0 0
12000 200 12000 200
17 34 −17 17
0 0 0 0 0
200 5 200 5
−51 51 17 17 −17 17
0 0 + 0 0
800 800 8748 162 8748 162
¿ 20∗106 −17 −17 289 −17 −17
0 0 0 0
12000 200 4000 200 240
17 17 17 −17 646 −17 34
0 0
200 5 162 200 45 162 9
−17 −17 17 −17
0 0 0 0 0
8748 162 8748 162
−17 17
0 0 0 0 0 0 0
240 240
17 34 −17 68
0 0 0 0 0
162 9 162 9

[]
The global load vector:
Rx 1
R y 1−4000
M 1−80000
0
{F }= −4000
80000
R x3
Ry 3
M3

The global displacement vector is


{ }{ }
Q1 0
Q2 0
Q3 0
Q4 Q 4
{ Q }= Q5 = Q5
Q6 Q6
Q7 0
Q8 0
Q9 0

[ ]
We have, F=KQ

51 −51
0 0 0 0 0 0 0
800 800
17 17 −17 17
0 0 0 0 0

{ }[ ]
12000 200 12000 200
17 34 −17 17
0 0 0 0 0 0 Rx 1
200 5 200 5
−51 51 17 17 −17 17 0 R y1−4000
0 0 + 0 0 0 M 1−80000
800 800 8748 162 8748 162
Q4 0
−17 −17 289 −17 −17
20∗ 0 0 0 0 Q5 = −4000
12000 200 4000 200 240
Q6 80000
17 17 17 −17 646 −17 34
0 0 0 Rx 3
200 5 162 200 45 162 9
−17 −17 17 −17 0 R y3
0 0 0 0 0 0 M3
8748 162 8748 162
−17 17
0 0 0 0 0 0 0
240 240
17 34 −17 68
0 0 0 0 0
162 9 162 9

Applying boundary conditions for node 1, we neglect 1st, 2nd and 3rd rows and columns, for
node 3, we neglect 7th, 8th, 9th rows and columns, then we have
[ ]
51 17 17
+ 0

{ }{ }
800 8748 162
Q4 0
289 −17
20∗106 0 Q5 = −4000
4000 200
80000
17 −17 646 Q6
162 200 45
 Finally, the horizotal, vertical displacements and the rotation at node 2, or the
upper right corner can be calculated as

[ ]
−1
51 17 17
+ 0

{} { }{ }
800 8748 162 −4
Q4 0 −4.2687∗10 (¿)
1 289 −17
Q5 = 6
0 −4000 = −3
−2.4538∗10 (¿)
20∗10 4000 200
Q6 80000 −4
2.6723∗10 (rad )
17 −17 646
162 200 45

2. Solving by coding in MatLab


 Code in MatLab
clc
clear
format shortG
format compact

%Units: in, lb, psi


length_unit = '[in]';
force_unit = '[lb]';
stress_unit = '[psi]';

%Sectional properties
nodes=input('Enter the coordinates of the nodes in
the vector form: ');
conn=input('Enter the start and end nodes of each
element in the vector form: ');
isol=input('Input 1 if the DOFs is free and 0 if the
DOFs is fixed (all displacements and rotation)
following the order of DOFs in the vector form: ');
A=input('Input the cross-sectional area: '); %in^2
I=input('Input the moment of inertia: '); %in^4
E=input('Input the Young modulus: '); %psi;

%Generating empty vector, matrices for storing values


%The number of elements in the model
nel=length(conn);
%The number of nodes in the model
nnode=length(nodes);
%Number of degrees of freedome in the model, one
horizontal translation,
%one vertical translation and one rotation
ndof=3*nnode;
%Allocate space for the vector of element lengths
lengths = zeros(1,nel);
%Allocate space for the vector of element inclination
angle
angles=zeros(1,nel);
%Allocate memory for the stiffness matrix, the force
vector and
%displacement vector
K=zeros(ndof,ndof); %Allocate memory for the
stiffness matrix
F=zeros(ndof,1); % for the right hand side (forces)
D=zeros(ndof,1); % for the displacement
%Vector and rotation matrix
kel_store=cell(nel,1);
index_store = cell(nel,1);
rot_store = cell(nel,1);

%Calculate the length and angle of each element


for i=1:nel
n1=conn(i,1);
n2=conn(i,2);
x1=nodes(n1,1);
x2=nodes(n2,1);
y1=nodes(n1,2);
y2=nodes(n2,2);
dx=x2-x1;
dy=y2-y1;
lengths(i) = sqrt(dx^2+dy^2);
angles(i) = atan2(dy,dx);
end
for i=1:length(angles)
disp(' ')
disp(['Length of element ', num2str(i), ' = ',
num2str(lengths(i)),length_unit])
disp(['Angle of elemnet ', num2str(i), '=',
num2str(angles(i)*180/pi), ' [degrees]'])
end
%Boundary conditions and displacement vector
f=logical(isol'); %Free DOFs
s=not(f); %Fixed DOFs
D(s)=0; %Specify the displacement of the fixed dofs
%Load vector assembly
F(4)=0;
F(5)=-4000;
F(6)=80000;
F_ext_load = F;
index_store{1} = [1 2 3 4 5 6];
index_store{2} = [7 8 9 4 5 6];
%Globa siffness matrix assembly
for iel=1:nel
ind=index_store{iel};
L=lengths(iel);
theta=angles(iel);
S=sin(theta);
C=cos(theta);
%Generating the element rotation matrix
T=[C, S, 0, 0, 0, 0;
-S, C, 0, 0, 0, 0;
0, 0, 1, 0, 0, 0;
0, 0, 0, C, S, 0;
0, 0, 0, -S, C, 0;
0, 0, 0, 0, 0, 1];
rot_store{iel}=T;
%Generate the element stiffness matrix in the
element's local
%coordinate system;
C1=(A*E/L);
C2=(E*I/L^3);
%Rotate the element's stiffness matrix to global
coordinates
kel_bar=C1*[1, 0, 0, -1, 0, 0;
0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0;
-1, 0, 0, 1, 0, 0;
0, 0, 0, 0, 0, 0;
0, 0, 0, 0, 0, 0];
kel_beam=C2*[0, 0, 0, 0, 0, 0;
0, 12, 6*L, 0, -12, 6*L;
0, 6*L, 4*L^2, 0, -6*L, 2*L^2;
0, 0, 0, 0, 0, 0;
0, -12, -6*L, 0, 12, -6*L;
0, 6*L, 2*L^2, 0, -6*L, 4*L^2];
kel=kel_bar+kel_beam; %element stiffness matrix
in local coordinates
kel_rot=transpose(T)*kel*T; %%element stiffness
matrix in global coordinates system
%store the stiffnessmatrix for later use
kel_store{iel}=kel;
K(ind,ind)=K(ind,ind)+kel_rot;
end
%K;
%Solve for free displacement
Kff=K(f,f);
Ksf=K(s,f);
%Find unknown displacements at free DOFs
D(f)=Kff\(F(f)-K(f,s)*D(s));
%Displacement vector at free DOFs
fprintf('\nThe horizontal, vertical displacements
(in) and rotation (rad) at node 2 or the upper right
corner, respectively are: \n');
Df=D(f);
disp(Df);

 Input:
[0,108;120,108;120,0]
[1,2;3,2]
[0 0 0 1 1 1 0 0 0]
7.65
204
20*10^6
 Output:
Length of element 1 = 120[in]
Angle of elemnet 1=0 [degrees]

Length of element 2 = 108[in]


Angle of elemnet 2=90 [degrees]
The horizontal, vertical displacements (in) and rotation (rad) at node 2 or the
upper right corner, respectively are:
-0.00042687
-0.0024538
0.00026723

You might also like