Professional Documents
Culture Documents
Fea With Matlab (12) - A
Fea With Matlab (12) - A
using MATLAB
Also for CEP
1/78
Contents
2/86
Example: Simple Spring (Static Analysis)
k1 1000 N / m
P=100N
1 2 3
k 2 2000 N / m
f11 f 21 f 22 f 32
F1 2 2 2
FBD
F3
1 1 3 3
F2
Step 1: element equations
1 2
k1 k1 u1 f 1 k 2 u2 f 22
1
k2
k k u f 1 k
k 2 u3 f 32
1 1 2 2 2
Step 2: assemble global stiffness matrix
1 k1 k1 0 u1 f 1
1 2 0 0 0 u1 0
u f 1 0 k
k
1 k1 0 2 2 2 k 2 u2 f 22
0 0 0 u3 0 0 k 2 k 2 u3 f 32
3/86
1 + 2 k1 k1 0 u1 f 11 F1
k k k K u F
1 1 2 k 2 u2 f 21 f 22 F2
0 k2 k 2 u3 f 32 F3 where
K : global stiffness matrix
Step 3: apply boundary conditions => u1=0 u : global displacement vector
F : global force vector
k1 k1 0 0 F1
k k k
1 1 2 k 2 u2 0 k1 k 2 k 2 u2 0
k
0 k2 k 2 u3 P 2 k 2 u3 P
Step 4: solve
1 1
u2 k1 k 2 k 2 0 1000 2000 2000 0 0.10
u3 k 2 k 2 P 2000 2000 100 0.15
Displacement-nodal dof relation: u N de , u N d e , u N de
N d e B d e
Strain-displacement relation: S u S
M e de Ce d e Ke de fext
7/86
Free vibration: simple harmonic motion
Free body diagram of static equilibrium: fig. (b)
k static W
Equation of motion
my ky 0 y n2 y 0
k
where n2 : circular natural frequency(rad/sec)
m
y (t ) y0 cos nt
How to solve?
2k k
x1 x1 x2 0
From EOM: m1 m1 or in matrix form x M 1 K x 0
k 2k
x2 x1 x2 0
m2 m2
x1 (t ) X1 sin(t ) X
Assume solution: or in matrix form x X sin(t ) Xsin(t )
1
x2 (t ) X 2 sin(t ) 2
9/86
Substitute assumed solution into EOM:
2k k
2 X1 sin(t ) X1 sin(t ) X 2 sin(t ) 0
m1 m1
k 2k
2 X 2 sin(t ) X 1 sin(t ) X 2 sin(t ) 0
m2 m2
2k k
2 X1 m1 m1 X1 0
X 2 k 2 k X 2 0
m2 m2
1
or 2 x M K x 0 or 2 M x K x 0
d (t ) c1 1ei1t c2 2ei2t cn n eint where c1 ,c2 ,...,cn are determined by initial conditions
Substitute assumed solution into equation of motion: M K e
2 i t
0
11/86
2. Truss Element
12/86
1D truss element
1D truss (bar element): only axial displacement exist, no moment
y
L
u1 u2
x
① ②
u L x x
Displacement-nodal dof relation: u N d N u1 where N
2 L L
du d d
Strain-displacement relation: x u N d B d
dx dx dx
1 1
B
L L
13/86
1D truss element
L x
L
T L
L L x x AL 2 1
T
M e N N dV N N Adx A dx
0 0 x L L 6 1 2
L
T L EA L 1 EA 1 1
T
K e B C B
dV B
E B Adx 1 1
Adx
0 L2 0 1 L 1 1
14/86
Plane truss element
V2
Nodal degree of freedom for element coordinate
v2 u2
de u1 v1 u2 v2 T
Nodal degree of freedom for global coordinate U2
②
d U1 V1 U 2 V2T V1
Coordinate transformation u1
v1
u1 cos sin 0 0 U1 U1
v1 sin cos 0 0 V1
①
T d de T d
u2 0 0 cos sin U 2
1 1
v2 cos
V2 2 B d e )T B d e dV
sin T
0 0 Ref) U dV (C
2
1 1
Strain energy of truss de T
T T T
B C B dV d e d e K e d e
1 0 1 0 2 2
0
EA 0 0 0 1 1 1
K e
L 1 0 1 0
U de T K e de d T T T Ke T d dT Ke d
2 2 2
T
0 0 0 0 K e T K e T element stiffness matrix for global coordinate
2
0 1 0
Similarly obtained from kinetic energy of truss
AL 0 2 0 1
M e 6 1 0 2 0
due to inertia for y-dir. M e T T M e T element mass matrix
for global coordinate
0 1 0 2
15/86
Finite element code of plane truss using
MATLAB
Input data:truss_in.m
Materials, node and element definition
1. Input data Boundary conditions, loads
Node data
Element data Solve:truss_sol.m
Area
Material data Evaluate results:truss_out.m
Boundary conditions
External load no
Is this satisfy
2. Output data design requirement?
Static Analysis
yes
Nodal displacement
Present results
Element stress
Modal Analysis Flow chart of 2D-truss problem
Natural frequency
16/86
Mode shape
Truss ex1
Find natural frequency and mode shape of the given truss structure
Aluminum: E=70GPa, A=0.002m2, rho=2700Kg/m3
2 3
(2)
1m (1)
(3) 4
1
1m
1 MN
17/86
0. Truss main program : truss.m %--------------------------------------------------------------
% < Solution Procedure >
% %--------------------------------------------------------------
% Truss program truss_sol
%
clear all; close all; %--------------------------------------------------------------
% < Postprocess >
%-------------------------------------------------------------- %--------------------------------------------------------------
% < Input Truss information > if Atype==1
%-------------------------------------------------------------- truss_out_static
truss_ex1 elseif Atype==2
%truss_ex2 truss_out_modal %truss_ex1, 2
%truss_ex3 %truss_out1 %truss_ex3, 4, 5
%truss_ex4 %truss_movie
%truss_ex5 end
%--------------------------------------------------------------
% < Choose Static or Modal Analysis >
%--------------------------------------------------------------
fprintf('\n\n* < Press 1 or 2 to choose analysis type >')
fprintf('\n => Static Analysis = 1') See truss/truss.m
fprintf('\n Modal Analysis = 2\n')
Atype=input(' Analysis type ? ');
18/86
%
1. Input Data : truss_ex1.m % Area of the cross-section 2 3
% %
% INPUT FOR 2D-PLANE TRUSS PROBLEM A=0.002;
% SI unit %
% Information of truss element % Young's Modulus
(2)
% %
1m (1)
ndof=2; % degree of freedom for each node E=70E9;
npe=2; % node per element %
nmode=2; % number of mode extracted % mass density
% Node data % 4
(3)
% NODE=[#1 #2 #3] rho=2700; 1
% #1: node number %
% #2: x-coordinate % Input boundary conditions 1m
% #3: y-coordinate % BC=[#1 #2 #3] 1 MN
NODE=[ % #1: node number
10 0 % #2: x-constraint (0:free, 1:fixed)
20 1 % #3: y-constraint (0:free, 1:fixed) Example 1
31 1 BC=zeros(nnode,3);
4 1 0]; for i=1:nnode, BC(i,1)=i;, end
nnode=length(NODE); % total number of node %
% BC(2,2)=1; BC(2,3)=1;
% Element data BC(3,2)=1; BC(3,3)=1;
% ELEM=[#1 #2 #3] BC(4,2)=1; BC(4,3)=1;
% #1: element number %%%%%%%%%%%%%%%%%% See
% #2: node number 1 % External loads
% #3: node number 2 % F=[#1 #2 #3]
truss/truss_ex1.m
% % #1: node number
ELEM=[ % #2: x-directional load
112 % #3: y-directional load
213 F=zeros(nnode,3);
3 1 4]; for i=1:nnode, F(i,1)=i;, end
nelem=length(ELEM); % total number of elements F(1,3)=-1E6; 19/86
1. Input Data : truss_ex1.m 2 3
%%%%%%%%%%%%%%%%%%%%%%%%
% Plot truss structure
%%%%%%%%%%%%%%%%%%%%%%%%
figure(1) (2)
plot(NODE(:,2),NODE(:,3),'ro'), hold on 1m (1)
text(NODE(:,2)+0.02*max(NODE(:,2)),NODE(:,3),int2str(NODE(:,1)));
for i=1:nelem
x1=NODE(ELEM(i,2),2); 4
y1=NODE(ELEM(i,2),3); (3)
1
x2=NODE(ELEM(i,3),2);
y2=NODE(ELEM(i,3),3); 1m
1 MN
X=[x1,x2]; Y = [y1,y2];
original shape of the structure
figure(1) 1 2 3
plot(X,Y)
0.9
text((x1+x2)/2,(y1+y2)/2,int2str(ELEM(i,1)));
end 0.8
title('original shape of the structure'), axis equal 0.7
hold off
0.6
0.5 1 2
0.4
0.3
0.2
0.1
0 1 3 4
0 0.2 0.4 0.6 0.8 1
20/86
2. Solve : truss_sol.m %
% Apply boundary conditions
% %
% Construct system matrix and solve 2D-plane truss problem lambda=1e6*GK(1,1);
% Global mass and stiffness matrices for i=1:nnode, for j=1:ndof
% if BC(i,j+1)==1
GK=zeros(ndof*nnode,ndof*nnode); ii=ndof*(i-1)+j;
GM=zeros(ndof*nnode,ndof*nnode); GK(:,ndof*(i-1)+j)=0; GK(ndof*(i-1)+j,:)=0;
GF=zeros(ndof*nnode,1); GK(ii,ii)=lambda;
for l=1:nelem GM(:,ndof*(i-1)+j)=0; GM(ndof*(i-1)+j,:)=0;
% GM(ii,ii)=1;
% Element stiffness matrix end, end,end
% if Atype==1
dx=NODE(ELEM(l,3),2)-NODE(ELEM(l,2),2); %
dy=NODE(ELEM(l,3),3)-NODE(ELEM(l,2),3); % Solve static truss problem
L=sqrt(dx^2+dy^2); % element length %
Ca=dx/L; Sa=dy/L; % cos & sin (alpha) GU=inv(GK)*GF;
elseif Atype==2
T=[Ca Sa 0 0;-Sa Ca 0 0;0 0 Ca Sa;0 0 -Sa Ca]; % transform matrix %
SKE1=E*A/L*[1 0 -1 0;0 0 0 0;-1 0 1 0;0 0 0 0]; % element stiffness matrix % Solve eigenvalue problem
SME1=rho*A*L/6*[2 0 1 0;0 2 0 1;1 0 2 0;0 1 0 2]; %
SKE=T'*SKE1*T; % element stiffness matrix [eig_vec1,eig_val1]=eig(GK,GM);
SME=T'*SME1*T; % element mass matrix %
% Sort Eigenvectors and Eigenvalues
% Assemble global stiffness matrix %
for i=1:npe [eig_val2,index]=sort(diag(eig_val1));
for j=1:npe eig_vec2=eig_vec1(:,index);
ii=ndof*ELEM(l,i+1)-ndof+1; jj=ndof*ELEM(l,j+1)-ndof+1;
GK(ii:ii+ndof-1,jj:jj+ndof-1)=GK(ii:ii+ndof-1,jj:jj+ndof-1) ... % extract required modes
+SKE(ndof*i-ndof+1:ndof*i,ndof*j-ndof+1:ndof*j); eigval=eig_val2(1:nmode,1);
eigvec=eig_vec2(:,1:nmode);
GM(ii:ii+ndof-1,jj:jj+ndof-1)=GM(ii:ii+ndof-1,jj:jj+ndof-1) ... % natural frequency
+SME(ndof*i-ndof+1:ndof*i,ndof*j-ndof+1:ndof*j); omega=sqrt(eigval)/2/pi %Hz
end end
GF(ndof*(i-1)+j,1)=F(i,j+1);
end, end 21/86
3. Post process (static) : truss_out_static.m
% Displacement: U[#1,#2,#3]
% #1: node number
% #2: x-directional displacement deformed and undeformed shape
U(i,j+1)=GU(ndof*(i-1)+j); 0.6
% 0.4
% Plot deformed shape 0.3
%
0.2
figure(2)
0.1
mag=20;
for i=1:nelem 0 3
x1=NODE(ELEM(i,2),2); -0.1
-0.2 0 0.2 0.4 0.6 0.8 1 1.2
y1=NODE(ELEM(i,2),3);
x2=NODE(ELEM(i,3),2);
y2=NODE(ELEM(i,3),3);
X=[x1,x2]; Y = [y1,y2]; Deformed and undeformed shape
dx1=NODE(ELEM(i,2),2)+mag*U(ELEM(i,2),2);
dy1=NODE(ELEM(i,2),3)+mag*U(ELEM(i,2),3);
dx2=NODE(ELEM(i,3),2)+mag*U(ELEM(i,3),2);
dy2=NODE(ELEM(i,3),3)+mag*U(ELEM(i,3),3);
dX=[dx1,dx2]; dY = [dy1,dy2];
figure(2)
plot(X,Y,'-b',dX,dY,'-r'),hold on
legend('undeformed shape','deformed shape')
text((x1+x2)/2,(y1+y2)/2,int2str(ELEM(i,1)));
end 22/86
title('deformed and undeformed shape'), axis equal, hold off
stress at each truss
% 400
% Computation of axial stress
% Axial stress: sigma[#1,#2] 300
% #1: node number
% #2: axial stress
200
%
stress (MPa)
for l=1:nelem
100
sigma(l,1)=l;
%
% Element stiffness matrix 0
%
dx=NODE(ELEM(l,3),2)-NODE(ELEM(l,2),2); -100
dy=NODE(ELEM(l,3),3)-NODE(ELEM(l,2),3);
L=sqrt(dx^2+dy^2); % element length -200
1 2 3
Ca=dx/L; Sa=dy/L; % cos & sin (alpha) element number
T1=[-Ca -Sa Ca Sa]; % transform matrix
for i=1:2*ndof
DU(1,1)=U(ELEM(l,2),2); Stresses of each element
DU(2,1)=U(ELEM(l,2),3);
DU(3,1)=U(ELEM(l,3),2);
DU(4,1)=U(ELEM(l,3),3); >> load disp.dat
end >> disp
sigma(l,2)=E/L*T1*DU/1e6; % element stiffness matrix disp =
end 1.0000 0.0015 -0.0057
figure(3) 2.0000 0 0
bar(sigma(:,2)) 3.0000 0 0
xlabel('element number') 4.0000 0 0
ylabel('stress (MPa)') >> load sigma.dat
title('stress at each truss') >> sigma
sigma =
save disp.dat U -ascii 1.0000 396.4466
save sigma.dat sigma -ascii 2.0000 146.4466
3.0000 -103.5534
23/86
4. Post process (modal) : truss_out_modal.m 1
1
% Displacement: U[#1,#2,#3] undeformed shape
for mm=1:nmode
GU(:,1)=eigvec(:,mm);
for i=1:nnode
U(i,1)=i; 0
for j=1:ndof
U(i,j+1)=GU(ndof*(i-1)+j);
end -0.5
end -0.5 0 0.5 1
X=[x1,x2]; Y = [y1,y2];
0.5
dx1=NODE(ELEM(i,2),2)+mag*U(ELEM(i,2),2);
dy1=NODE(ELEM(i,2),3)+mag*U(ELEM(i,2),3);
dx2=NODE(ELEM(i,3),2)+mag*U(ELEM(i,3),2);
dy2=NODE(ELEM(i,3),3)+mag*U(ELEM(i,3),3); 0
dX=[dx1,dx2]; dY = [dy1,dy2];
figure(mm+1)
plot(X,Y,'-b',dX,dY,'-r'),hold on -0.5
-0.5 0 0.5 1
end
title(mm); % mode number
legend('undeformed shape','deformed shape') mode2
hold off 24/86
end
5. Post process : truss_movie.m
% Free response of each mode shape
mm=1; % mode number
GU(:,1)=eigvec(:,mm);
for i=1:nnode
U(i,1)=i;
for j=1:ndof, U(i,j+1)=GU(ndof*(i-1)+j); end
end
% Plot deformed shape
for kk=1:100
for i=1:nelem
x1=NODE(ELEM(i,2),2); y1=NODE(ELEM(i,2),3);
x2=NODE(ELEM(i,3),2); y2=NODE(ELEM(i,3),3);
X=[x1,x2]; Y = [y1,y2];
mode1
mag=sin(pi/12*(kk-1));
dx1=NODE(ELEM(i,2),2)+mag*U(ELEM(i,2),2);
dy1=NODE(ELEM(i,2),3)+mag*U(ELEM(i,2),3);
dx2=NODE(ELEM(i,3),2)+mag*U(ELEM(i,3),2);
dy2=NODE(ELEM(i,3),3)+mag*U(ELEM(i,3),3);
dX=[dx1,dx2]; dY = [dy1,dy2];
figure(mm+1)
plot(X,Y,'-b',dX,dY,'-r'),hold on
end
title('modal vibration')
hold off
axis([0 13 -1 4])
F1(kk)=getframe;
end
movie(F1) mode2
%movie2avi(F1,'temp.avi') 25/86
Truss ex1
Provide ANSYS solution Using workbench ( )
2 3
(2)
1m (1)
(3) 4
1
1m
1 MN
26/86
Truss ex2
Find natural frequency and mode shape of the given truss structure
Aluminum: E=70GPa, A=0.002m2, rho=2700Kg/m3, P=1MN
L=1m
27/86
%
1. Input Data : truss_ex2.m % Area of the cross-section
% %
% INPUT FOR 2D-PLANE TRUSS PROBLEM A=0.002;
% SI unit %
% Information of truss element % Young's Modulus
% %
ndof=2; % degree of freedom for each node E=70E9; L=1m
npe=2; % node per element %
nmode=2; % number of mode extracted % mass density
% Node data %
% NODE=[#1 #2 #3] rho=2700;
% #1: node number %
% #2: x-coordinate % Input boundary conditions
% #3: y-coordinate % BC=[#1 #2 #3]
NODE=[ % #1: node number
10 0 % #2: x-constraint (0:free, 1:fixed)
21 0 % #3: y-constraint (0:free, 1:fixed)
3 0.5 0.866]; BC=zeros(nnode,3);
nnode=length(NODE); % total number of node for i=1:nnode, BC(i,1)=i;, end
% %
% Element data BC(1,2)=1;
% ELEM=[#1 #2 #3] BC(2,3)=1;
% #1: element number BC(3,2)=1; BC(3,3)=1;
% #2: node number 1 %%%%%%%%%%%%%%%%%%
% #3: node number 2 % External loads
% % F=[#1 #2 #3]
ELEM=[ % #1: node number
112 % #2: x-directional load
213 % #3: y-directional load
3 2 3]; F=zeros(nnode,3);
nelem=length(ELEM); % total number of elements for i=1:nnode, F(i,1)=i;, end
F(2,2)=1E6; 28/86
Truss ex2 (Static Analysis)
deformed and undeformed shape stress at each truss
400
undeformed shape
0.8
deformed shape
350
0.7
300
0.6
250
0.5
stress (MPa)
2 3 200
0.4
150
0.3
100
0.2
0.1 50
0 1 0
0 0.2 0.4 0.6 0.8 1 1 2 3
element number
29/86
Truss ex2 (Modal Analysis)
1 2
0.9 0.9
undeformed shape undeformed shape
0.8 deformed shape 0.8 deformed shape
0.7 0.7
0.6 0.6
0.5 0.5
0.4 0.4
0.3 0.3
0.2 0.2
0.1 0.1
0 0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6
mode1 mode2
30/86
Exercise: Truss ex3
Find first six natural frequencies and mode shapes of the given truss structure
Aluminum: E=70GPa, A=0.002m2, rho=2700Kg/m3
100kN 200kN
1m 1m
1m
31/86
Truss ex3 (Static analysis)
deformed and undeformed shape stress at each truss
1.2 250
undeformed shape
deformed shape 200
1 3 6
150
0.8
100
0.6
50
stress (MPa)
2 4 5
0.4 0
-50
0.2
-100
0 1
-150
-0.2
-200
-0.4 -250
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 1 2 3 4 5 6
element number
32/86
Truss ex3 (Modal analysis)
original shape of the structure
Mode shapes
1.2
1 2
1 3 3 4 6 5 1.5 1.5
1 1
0.8
0.5 0.5
0.6 0 0
2 4 5
-0.5 -0.5
0.4 0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5
3 4
0.2
1.5 1.5
1 1
0 1 1 2
0.5 0.5
-0.2 0 0
0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2 -0.5 -0.5
0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5
5 6
1.5 1.5
1 1
0.5 0.5
0 0
-0.5 -0.5
0 0.5 1 1.5 2 2.5 0 0.5 1 1.5 2 2.5
33/86
Exercise: Truss ex4
Find first six natural frequencies and mode shapes of the given truss structure
Aluminum: E=70GPa, A=0.002m2, rho=2700Kg/m3
2m
2m 2m
500kN
34/86
Truss ex4 (Static analysis)
deformed and undeformed shape stress at each truss
150
undeformed shape
2 deformed shape
7 100
1.5
50
1
stress (MPa)
3 4 5 6
0
0.5
-50
0 1 2
-100
-0.5
-150
0 0.5 1 1.5 2 2.5 3 3.5 4 1 2 3 4 5 6 7
element number
Mode shapes
2
4 7 5
1 2
1.5 3 3
2 2
1
3 4 5 6 1 1
0 0
0.5
-1 -1
0 1 2 3 4 5 0 1 2 3 4 5
0 1 1 2 2 3 3 4
3 3
-0.5 2 2
1 1
0 0.5 1 1.5 2 2.5 3 3.5 4
0 0
-1 -1
0 1 2 3 4 5 0 1 2 3 4 5
5 6
3 3
2 2
1 1
0 0
-1 -1
0 1 2 3 4 5 0 1 2 3 4 5
36/86
Exercise: Truss ex5
Find first six natural frequencies and mode shapes of the given truss structure
Steel: E=200GPa, A=0.0025m2, rho=7850Kg/m3
100kN 300kN
37/86
Truss ex5 (Static analysis)
deformed and undeformed shape stress at each truss
6 150
undeformed shape
5 deformed shape
100
4
50
3 6
stress (MPa)
2 0
2 3 5 7 9
1
-50
0 1 4 8
-100
-1
-2 -150
-3
-200
0 2 4 6 8 10 12 1 2 3 4 5 6 7 8 9
element number
4 1 2
4 4
3 3 6 5
2
2 2
2 3 5 7 9
1 0 0
0 1 1 2 4 4 8 6 -2 -2
0 5 10 0 5 10
-1 3 4
4 4
-2
2 2
-3
0 2 4 6 8 10 12 0 0
-2 -2
0 5 10 0 5 10
5 6
4 4
2 2
0 0
-2 -2
0 5 10 0 5 10
39/86
3. Beam Element
40/86
Beam element
Nodal degree of freedom: deflection(v), rotation() y
v(x) 2
T
d v1 1 v2 2
1
v1 v2
Hermite shape function:
v c1 c2 x c3 x 2 c4 x 3 x
① ②
Boundary conditions: at node 1 (x 0) at node 2 (x Le )
v(0) c1 v1 v( Le ) c1 c2 Le c3 L2e c4 L3e v1 1Le c3 L2e c4 L3e v2
dv(0) dv ( Le )
c2 1 1 2c3 Le 3c4 L2e 2
dx dx
3 ( 21 ) 2 1
c3 2 (v1 v2 ) 2 , c4 2 (v1 v2 ) 2 (1 2 )
Le Le Le Le
3x 2 2 x 3 x 2 x 2 x3 3x 2 2 x 3 x2 x3
Shape function: v( x) (1 ) v1 Le ( )1 ( ) v 2 Le ( 3 ) 2
L2e L3e Le L2e L3e L2e L3e L2e Le
3x 2 2 x3 x 2x2 x3 3x 2 2 x 3 x 2 x3
N1 (1 ), N 2 Le ( ), N 3 ( ), N 4 Le ( 3)
L2e L3e Le L2e L3e L2e L3e L2e Le
41/86
Beam element
42/86
Finite element code of beam using MATLAB
1. Input data Input data:beam_in.m
Materials, node and element definition
Node data Boundary conditions, loads
Element data
Area, Solve:beam_sol.m
Second moment of area (Izz)
Material data Evaluate results:beam_out.m
Boundary conditions
External load Is this satisfy no
2. Output data design requirement?
Static Analysis
yes
Nodal displacement
Present results
Modal Analysis
Natural frequency Flow chart of beam problem
Mode shape
43/86
beam ex1
Find static deflection, first three natural frequencies and mode shapes of the given
cantilevered beam.
Steel: E=100GPa, rho=1000 Kg/m3
500N
Cross section
20cm
1m
20cm
A 0.02 0.02 4e 4m 2
bh3 0.02(0.02)3
I zz 1.3333e 8m 4
12 12
44/86
0. Beam main program : beam.m %--------------------------------------------------------------
% < Solution Procedure >
% %--------------------------------------------------------------
% Beam program beam_sol
% SI unit
% %--------------------------------------------------------------
clear all; close all; % < Postprocess >
%--------------------------------------------------------------
%-------------------------------------------------------------- if Atype==1
% < Input Beam information > beam_out_static
%-------------------------------------------------------------- elseif Atype==2
beam_ex1 beam_out_modal
%beam_ex2 %beam_movie
end
%--------------------------------------------------------------
% < Choose Static or Modal Analysis >
%--------------------------------------------------------------
fprintf('\n\n* < Press 1 or 2 to choose analysis type >')
fprintf('\n => Static Analysis = 1')
fprintf('\n Modal Analysis = 2\n')
Atype=input(' Analysis type ? '); See beam/beam.m
45/86
%
1. Input Data : beam_ex1.m % Area of the cross-section
% % 500N
% INPUT FOR 2D-PLANE TRUSS PROBLEM A=4e-4;
% SI unit Izz=1.3333e-8;
% Information of truss element %
% % Young's Modulus 1m
ndof=2; % degree of freedom for each node %
npe=2; % node per element E=100E9;%
nmode=3; % number of mode extracted % mass density 20cm
% Node data %
% NODE=[#1 #2 #3] rho=1000;
% #1: node number 20cm
%
% #2: x-coordinate % Input boundary conditions
% #3: y-coordinate % BC=[#1 #2 #3]
nelem=3; % number of element
original shape of the structure
% #1: node number
nnode=nelem+1; % total number of node % #2: x-constraint (0:free, 1:fixed) 0.3
48/86
figure(2)
3. Post process (static) : beam_out_static.m plot(X,Y,'-b',dX,dY,'-r'),hold on
% legend('undeformed shape','deformed shape')
% Post process of beam structures text((x1+x2)/2,(y1+y2)/2,int2str(ELEM(i,1)));
% end
% Displacement: U[#1,#2,#3] title('deformed and undeformed shape'), axis equal
% #1: node number hold off
% #2: y-directional displacement save disp.dat U -ascii
% #3: z-directional rotation
%
for i=1:nnode
U(i,1)=i;
for j=1:ndof deformed and undeformed shape
%
% Plot deformed shape 0.1
% 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
figure(2)
mag=1; -0.1
x2=NODE(ELEM(i,3),2); -0.4
y2=NODE(ELEM(i,3),3);
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
X=[x1,x2]; Y = [y1,y2];
dx1=NODE(ELEM(i,2),2);
dy1=NODE(ELEM(i,2),3)+mag*U(ELEM(i,2),2);
dx2=NODE(ELEM(i,3),2);
dy2=NODE(ELEM(i,3),3)+mag*U(ELEM(i,3),2);
dX=[dx1,dx2]; dY = [dy1,dy2];
49/86
beam ex1 (Static analysis)
Number of elements: 1 Number of elements: 2 Number of elements: 4
deformed and undeformed shape deformed and undeformed shape deformed and undeformed shape
0.3 undeformed shape 0.3 0.3
undeformed shape undeformed shape
deformed shape deformed shape deformed shape
0.2 0.2 0.2
0 1 0 1 2 0 1 2 3 4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
dx1=NODE(ELEM(i,2),2);
dy1=NODE(ELEM(i,2),3)+mag*U(ELEM(i,2),2);
dx2=NODE(ELEM(i,3),2);
dy2=NODE(ELEM(i,3),3)+mag*U(ELEM(i,3),2);
dX=[dx1,dx2]; dY = [dy1,dy2];
figure(2)
subplot(3,1,mm),plot(X,Y,'-b',dX,dY,'-r'), hold on, axis([0 1 -4 4])
end
title(mm); % mode number
hold off
end
51/86
beam ex1 (modal analysis)
original shape of the structure Number of element: 3
1
4
0.3
2
0
0.2
-2
-4
0.1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2
4
0 1 1 2 2 3 3 4
2
0
-0.1
-2
-4
-0.2 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
3
4
-0.3
2
0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 -2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Number
3 10 20 Number of element: 10
of elements:
1
4
2
0
Convergence -2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
of frequency 4
2
2
0
-2
Unlike static analysis, it is necessary to -4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
20cm
1m
20cm
A 0.02 0.02 4e 4m 2
bh3 0.02(0.02)3
I zz 1.3333e 8m 4
12 12
53/86
beam ex2 (Static analysis)
Number of elements: 4 Number of elements: 8 Number of elements: 16
deformed and undeformed shape deformed and undeformed shape deformed and undeformed shape
0 1 2 3 4 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
54/86
beam ex2 (Modal analysis)
Number of element: 4 Number of element: 8
1 1
4 4
2 2
0 0
-2 -2
-4 -4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2 2
4 4
2 2
0 0
-2 -2
-4 -4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
3 3
4 4
2 2
0 0
-2 -2
-4 -4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Number of element: 16
Number 4
1
4 8 16
of elements:
2
0
-2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2
4
Convergence 2
0
of frequency -2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
3
4
2
0
-2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
55/86
Exercise: beam ex3
Find static deflection, first three natural frequencies and mode shapes of the given
simply supported beam using 4, 8, 16 elements
Steel: E=100GPa, rho=1000 Kg/m3
20cm
1m
20cm
A 0.02 0.02 4e 4m 2
bh3 0.02(0.02)3
I zz 1.3333e 8m 4
12 12
56/86
beam ex3 (Static analysis)
Number of elements: 4 Number of elements: 8 Number of elements: 16
deformed and undeformed shape
deformed and undeformed shape deformed and undeformed shape
undeformed shape
undeformed shape undeformed shape
0.3 deformed shape
deformed shape 0.3 deformed shape
0.3
0.2
0.2 0.2
0.1
0.1 0.1
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
0 1 2 3 4 0 1 2 3 4 5 6 7 8
-0.1
-0.1 -0.1
-0.2
-0.2 -0.2
-0.3
-0.3 -0.3
57/86
beam ex3 (Modal analysis)
Number of element: 4 1 Number of element: 8 1
4 4
2 2
0 0
-2 -2
-4 -4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2 2
4 4
2 2
0 0
-2 -2
-4 -4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
3 3
4 4
2 2
0 0
-2 -2
-4 -4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Number of element: 16 1
Number 4
4 8 16 2
of elements: -2
0
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
2
4
Convergence 2
0
of frequency
-2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
3
4
2
0
-2
-4
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 58/86
4. Frame Element
59/86
Frame element
Nodal degree of freedom: axial displacement(u), deflection(v), rotation()
Frame element = bar element + beam element v2
d u1 v1 1 u2 v2 2
T
① 1
x
Coordinate transformation
u1 cos sin 0 0 0 0 u1
v1 sin cos 0 0 0 0 v1
1 0 0 1 0 0 0 1 de T d
u2 0 0 0 cos sin 0 u2
v2 0 0 0 sin cos 0 v2
2
0 0 0 0 0 1
2
60/86
Frame element
Element mass and stiffness matrices for local coordinate
EA EA
0 0 0 0
Le Le
12 EI 6 EI 12 EI 6 EI
140 0 0 70 0 0 0 0
L3e L2e L3e L2e
0 156 22 Le 0 54 13Le
0 6 EI 4 EI 6 EI 2 EI
4 L2e 3L2e 0
ALe 0 22 Le 0 13Le L2e Le L2e Le
M e 420 70 0 0 140 0 0 K e EA
EA
L 0 0 0 0
0 54 13Le 0 156 22 Le e Le
0 13Le 3L2e 0 22 Le 4 L2e 12 EI 6 EI 12 EI 6 EI
0 0 2
L3e L2e L3e Le
6 EI 2 EI 6 EI 4 EI
0 0
L2e Le L2e Le
61/86
Finite element code of frame using MATLAB
1. Input data
Input data:frame_in.m
Node data Materials, node and element definition
Boundary conditions, loads
Element data
Area, Solve:frame_sol.m
Second moment of area (Izz)
Material data Evaluate results:frame_out.m
Boundary conditions
External load
Is this satisfy no
2. Output data design requirement?
Static Analysis
yes
Nodal displacement
Modal Analysis Present results
5kN 30cm
1.5 m 10cm
A 0.01 0.03 3e 4m 2
bh3 0.01(0.03)3
I zz 2.25e 8m 4
1 4 12 12
63/86
0. Frame main program : frame.m %--------------------------------------------------------------
% < Solution Procedure >
% %--------------------------------------------------------------
% 2D-Frame program frame_sol
% SI unit
% %--------------------------------------------------------------
clear all; close all; % < Postprocess >
%--------------------------------------------------------------
%-------------------------------------------------------------- if Atype==1
% < Input Beam information > frame_out_static
%-------------------------------------------------------------- elseif Atype==2
frame_ex1 frame_out_modal
%frame_ex11 %frame_movie
%frame_ex2 end
%frame_ex22
%--------------------------------------------------------------
% < Choose Static or Modal Analysis >
%--------------------------------------------------------------
fprintf('\n\n* < Press 1 or 2 to choose analysis type >')
fprintf('\n => Static Analysis = 1') See frame/frame.m
fprintf('\n Modal Analysis = 2\n')
Atype=input(' Analysis type ? ');
64/86
%
1. Input Data : frame_ex1.m % Area of the cross-section
2m
% %
% INPUT FOR 2D-FRAME PROBLEM A=3e-4;
% SI unit Izz=2.25e-8; 1.5 m
% Information of truss element %
% % Young's Modulus
ndof=3; % degree of freedom for each node %
npe=2; % node per element E=200E9;%
nmode=6; % number of mode extracted % mass density
% Node data %
% NODE=[#1 #2 #3] rho=7850;
% #1: node number % 2
original shape of the structure
SME=T'*SMExy*T;
67/86
2. Solve : frame_sol.m if Atype==1
%
% Solve static beam problem
(same as truss) %
% GU=inv(GK)*GF;
% Apply boundary conditions
% elseif Atype==2
lambda=1e6*GK(1,1); %
for i=1:nnode, for j=1:ndof % Solve eigenvalue problem
if BC(i,j+1)==1 %
ii=ndof*(i-1)+j; [eig_vec1,eig_val1]=eig(GK,GM);
GK(:,ndof*(i-1)+j)=0; GK(ndof*(i-1)+j,:)=0;
GK(ii,ii)=lambda; %
% Sort Eigenvectors and Eigenvalues
GM(:,ndof*(i-1)+j)=0; GM(ndof*(i-1)+j,:)=0; %
GM(ii,ii)=1; [eig_val2,index]=sort(diag(eig_val1));
end eig_vec2=eig_vec1(:,index);
GF(ndof*(i-1)+j,1)=F(i,j+1);
end,end % extract required modes
eigval=eig_val2(1:nmode,1);
eigvec=eig_vec2(:,1:nmode);
% natural frequency
omega=sqrt(eigval)/2/pi %Hz
end
68/86
figure(2)
3. Post process : frame_out_static.m plot(X,Y,'-b',dX,dY,'-r'),hold on
% Post process of 2D-plane frame structures legend('undeformed shape','deformed shape')
% Displacement: U[#1,#2,#3,#4] text((x1+x2)/2,(y1+y2)/2,int2str(ELEM(i,1)));
% #1: node number end
% #2: x-directional displacement title('deformed and undeformed shape'), axis equal
% #3: y-directional displacement hold off
% #4: z-directional rotation
for i=1:nnode save disp.dat U -ascii
U(i,1)=i;
for j=1:ndof
U(i,j+1)=GU(ndof*(i-1)+j);
end
end deformed and undeformed shape
1.6
% 11 12 13 14 15 16 17 18 19 20
% Plot deformed shape 1.4 10 21
% 1.2
9
undeformed shape
22
x1=NODE(ELEM(i,2),2); 0.6
5 26
y1=NODE(ELEM(i,2),3); 4 27
0.4 3
x2=NODE(ELEM(i,3),2); 28
y2=NODE(ELEM(i,3),3); 0.2 2 29
X=[x1,x2]; Y = [y1,y2]; 0
1 30
0 0.5 1 1.5 2
dx1=NODE(ELEM(i,2),2)+mag*U(ELEM(i,2),2);
dy1=NODE(ELEM(i,2),3)+mag*U(ELEM(i,2),3);
dx2=NODE(ELEM(i,3),2)+mag*U(ELEM(i,3),2);
dy2=NODE(ELEM(i,3),3)+mag*U(ELEM(i,3),3);
dX=[dx1,dx2]; dY = [dy1,dy2];
69/86
frame ex1 (Static analysis)
Number of elements: 3 Number of elements: 15 Number of elements: 30
deformed and undeformed shape deformed and undeformed shape deformed and undeformed shape
1.6 1.6 1.6
undeformed shape undeformed shape
2 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
deformed shape deformed shape
1.4 1.4 1.4 10 21
5 11
9 22
1.2 1.2 1.2 undeformed shape
8 deformed shape 23
4 12
1 1 17 24
70/86
3. Post process (modal) : frame_out_modal.m
%
% Post process of beam structures
for mm=1:nmode
GU(:,1)=eigvec(:,mm);
for i=1:nnode
U(i,1)=i;
for j=1:ndof, U(i,j+1)=GU(ndof*(i-1)+j);
end, end
% Plot deformed shape
mag=1; % magnification factor
for i=1:nelem
x1=NODE(ELEM(i,2),2); y1=NODE(ELEM(i,2),3);
x2=NODE(ELEM(i,3),2); y2=NODE(ELEM(i,3),3);
X=[x1,x2]; Y = [y1,y2];
dx1=NODE(ELEM(i,2),2)+mag*U(ELEM(i,2),2);
dy1=NODE(ELEM(i,2),3)+mag*U(ELEM(i,2),3);
dx2=NODE(ELEM(i,3),2)+mag*U(ELEM(i,3),2);
dy2=NODE(ELEM(i,3),3)+mag*U(ELEM(i,3),3);
dX=[dx1,dx2]; dY = [dy1,dy2];
figure(2)
subplot(3,2,mm),plot(X,Y,'-b',dX,dY,'-r'), hold on, axis([-1 3 0 2])
end
title(mm); % mode number
hold off
end
71/86
Frame ex1(Modal analysis)
Number of element: 3 Number of element: 15
1 2 1 2
2 2
2 2
1 1 1 1
0 0 0 0
-1 0 1 2 3 -1 0 1 2 3 -1 0 1 2 3 -1 0 1 2 3
3 4 3 4
2 2
2 2
1 1 1 1
0 0 0 0
-1 0 1 2 3 -1 0 1 2 3 -1 0 1 2 3 -1 0 1 2 3
5 6 5 6
2 2
2 2
1 1 1 1
0 0 0 0
-1 0 1 2 3 -1 0 1 2 3 -1 0 1 2 3 -1 0 1 2 3
Number of element: 30
1 2
Number 2 2
3 15 30
of elements: 1 1
0 0
-1 0 1 2 3 -1 0 1 2 3
3 4
2 2
Convergence 1 1
of frequency 0
-1 0 1 2 3
0
-1 0 1 2 3
5 6
2 2
1 1
0 0
-1 0 1 2 3 -1 0 1 2 3
72/86
Exercise: Frame ex2
Find first six natural frequencies and mode shapes of the given frame structure
using 7, 21, 70 elements
Steel: E=200GPa, rho=7850 Kg/m3
Cross section
30cm
3m
3 kN m
10cm
5kN
A 0.01 0.03 3e 4m 2
3m bh3 0.01(0.03)3
I zz 2.25e 8m 4
12 12
1 2 3
4m 4m
73/86
frame ex2 (Static analysis)
Number of elements: 7 Number of elements: 21 Number of elements: 70
deformed and undeformed shape deformed and undeformed shape deformed and undeformed shape
7 7 7
undeformed shape undeformed shape undeformed shape
6 deformed shape 6 deformed shape 6 deformed shape
40 50
12 15 39 49
38 48
5 5 5 37 47
6 7 11 14 36 46
35 45
4 4 4 34 44
33 43
10 13 32 42
31 41
3 4 5 3 16 17 18 19 20 21 3 1051 52 53 54 55 56 57 58 59 602061 62 63 64 65 66 67 68 69 7030
3 6 9 9 19 29
8 18 28
2 2 2 7 17 27
6 16 26
1 2 3 2 5 8 5 15 25
1 1 1 4 14 24
3 13 23
1 4 7 2 12 22
1 11 21
0 0 0
-1 -1 -1
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9
74/86
Exercise: Frame ex2 (Modal analysis)
original shape of the structure
Number of element: 7
6 7 8
5
6 7
Mode shapes
1 2
4
6 6
3 4 4 5 5 6
4 4
2 2 2
1 2 3 0 0
1
0 2 4 6 8 0 2 4 6 8
0 1 2 3 3 4
6 6
-1 0 1 2 3 4 5 6 7 8 9 4 4
2 2
0 0
0 2 4 6 8 0 2 4 6 8
5 6
6 6
4 4
2 2
0 0
0 2 4 6 8 0 2 4 6 8
75/86
Exercise: Frame ex2 (Modal analysis)
Number of elements: 21
6 15
original shape of the structure
18
Number of elements: 21
1 2
12 15 6 6
4 4
5 14 17
2 2
11 14
0 0
4 13 16
0 2 4 6 8 0 2 4 6 8
10 13 3 4
3 4 16 19 17 20 18 8 19 21 20 22 21 12 6 6
4 4
3 6 9
2 2
2 3 7 11 0 0
2 5 8 0 2 4 6 8 0 2 4 6 8
5 6
1 2 6 10
6 6
1 4 7
4 4
0 1 5 9 2 2
0 1 2 3 4 5 6 7 8 0 0
0 2 4 6 8 0 2 4 6 8
Number of elements: 70
Number 1 2
7 21 70 6 6
of elements: 4
2
4
2
0 0
0 2 4 6 8 0 2 4 6 8
3 4
6 6
Convergence
4 4
2 2
0 0
of frequency 0 2 4
5
6 8 0 2 4
6
6 8
6 6
4 4
2 2
0 0
0 2 4 6 8 0 2 4 6 8
76/86
Summary
Static and modal analysis of structure using finite element method was
studied
78/86