Full Text 4
Full Text 4
Analysis of 2D trusses
4.1 Introduction
This chapter deals with the static analysis of two dimensional trusses, which are basically bars oriented in two dimensional cartesian systems. A transformation of coordinate basis is necessary to translate the local element matrices (stiness matrix, force vector) into the structural (global) coordinate system. Trusses support compressive and tensile forces only, as in bars. All forces are applied at the nodes. After the presentation of the element formulation, some examples are solved by MATLAB codes.
4.2 2D trusses
In gure 4.1 we consider a typical 2D truss in global x y plane. The local system of coordinates x y denes the local displacements u1 , u2 . The element possesses two degrees of freedom in the local setting, u
T
= [u1
u2 ]
(4.1)
while in the global coordinate system, the element is dened by four degrees of freedom uT = [u1 u2 u3 u4 ] (4.2) The relation between both local and global displacements is given by u1 = u1 cos() + u2 sin() u2 = u3 cos() + u4 sin() (4.3) (4.4)
A.J.M. Ferreira, MATLAB Codes for Finite Element Analysis: Solids and Structures, Solid Mechanics and Its Applications 157, c Springer Science+Business Media B.V. 2009
51
52
4 Analysis of 2D trusses u4 x u2 u3
u2 u1 y x u1
where is the angle between local axis x and global axis x, or in matrix form as u = Lu being matrix L dened as L= l m0 0 0 0 l m (4.5)
(4.6)
53
In the local coordinate system, the strain energy of this element is given by Ue = Replacing u = Lu in (4.10) we obtain Ue = 1 T T u [L K L]u 2 (4.11) 1 T u Ku 2 (4.10)
(4.13)
By transformation of local to global coordinates, we obtain stresses as function of the displacements as = E [1 Le 1]Lu = E [l Le m l m]u (4.15)
54
4 Analysis of 2D trusses
10
2 E = 30e6, A = 2
1 3 y 10000 x 10
4 3
6 5
1 2 x 8
55
The code (problem4.m) listing is as: %................................................................ % MATLAB codes for Finite Element Analysis % problem4.m % antonio ferreira 2008 % clear memory clear all % E; modulus of elasticity % A: area of cross section % L: length of bar E=30e6; A=2; EA=E*A; % generation of coordinates and connectivities numberElements=3; numberNodes=4; elementNodes=[1 2;1 3;1 4]; nodeCoordinates=[ 0 0;0 120;120 120;120 0]; xx=nodeCoordinates(:,1); yy=nodeCoordinates(:,2); % for % % % structure: displacements: displacement vector force : force vector stiffness: stiffness matrix
GDof=2*numberNodes; % GDof: total number of degrees of freedom displacements=zeros(GDof,1); force=zeros(GDof,1); % applied load at node 2 force(2)=-10000.0; % computation of the system stiffness matrix [stiffness]=... formStiffness2Dtruss(GDof,numberElements,... elementNodes,numberNodes,nodeCoordinates,xx,yy,EA); % boundary conditions and solution prescribedDof=[3:8];
56
4 Analysis of 2D trusses
% solution displacements=solution(GDof,prescribedDof,stiffness,force); % drawing displacements us=1:2:2*numberNodes-1; vs=2:2:2*numberNodes; figure L=xx(2)-xx(1); %L=node(2,1)-node(1,1); XX=displacements(us);YY=displacements(vs); dispNorm=max(sqrt(XX.^2+YY.^2)); scaleFact=15000*dispNorm; clf hold on drawingMesh(nodeCoordinates+scaleFact*[XX YY],elementNodes,L2, k.-); drawingMesh(nodeCoordinates,elementNodes,L2,k.--); % stresses at elements stresses2Dtruss(numberElements,elementNodes,... xx,yy,displacements,E) % output displacements/reactions outputDisplacementsReactions(displacements,stiffness,... GDof,prescribedDof) Note that this code calls some new functions. The rst function (formStiness2Dtruss.m) computes the stiness matrix of the 2D truss two-node element.
stiffness=zeros(GDof); % computation of the system stiffness matrix for e=1:numberElements; % elementDof: element degrees of freedom (Dof) indice=elementNodes(e,:) ;
57
elementDof=[ indice(1)*2-1 indice(1)*2 indice(2)*2-1 indice(2)*2] ; xa=xx(indice(2))-xx(indice(1)); ya=yy(indice(2))-yy(indice(1)); length_element=sqrt(xa*xa+ya*ya); C=xa/length_element; S=ya/length_element; k1=EA/length_element*... [C*C C*S -C*C -C*S; C*S S*S -C*S -S*S; -C*C -C*S C*C C*S;-C*S -S*S C*S S*S]; stiffness(elementDof,elementDof)=... stiffness(elementDof,elementDof)+k1; end The function (stresses2Dtruss.m) computes stresses of the 2D truss elements.
% stresses at elements for e=1:numberElements indice=elementNodes(e,:); elementDof=[ indice(1)*2-1 indice(1)*2 indice(2)*2-1 indice(2)*2] ; xa=xx(indice(2))-xx(indice(1)); ya=yy(indice(2))-yy(indice(1)); length_element=sqrt(xa*xa+ya*ya); C=xa/length_element; S=ya/length_element; sigma(e)=E/length_element* ... [-C -S C S]*displacements(elementDof); end disp(stresses) sigma The code problem4.m is therefore easier to read by using functions that can also be used for other 2D truss problems. Displacements, reactions and stresses are in full agreement with analytical results by Logan [11].
58
4 Analysis of 2D trusses
Displacements ans = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 reactions ans = 1.0e+03 * 0.0030 0.0040 0.0050 0.0060 stresses ans = 1.0e+03 * 3.9645 1.4645 -1.0355 The deformation of the structure is illustrated in gure 4.4. We use a drawing routine drawingMesh for the purpose. This routine needs the input of nodal coordinates and elements connectivities and draws either undeformed and deformed meshes. 0 7.9289 2.0711 2.0711 0.0041 -0.0159 0 0 0 0 0 0
59
100kN 4 9 8 6 7 11 6
50kN
3m 5
2 3m
10 3m
%................................................................ % MATLAB codes for Finite Element Analysis % problem5.m % antonio ferreira 2008
60
4 Analysis of 2D trusses
11
12
y x
10
% clear memory clear all % E; modulus of elasticity % A: area of cross section % L: length of bar E=70000; A=300; EA=E*A; % generation of coordinates and connectivities elementNodes=[ 1 2;1 3;2 3;2 4;1 4;3 4;3 6;4 5;4 6;3 5;5 6]; nodeCoordinates=[ 0 0;0 3000;3000 0;3000 3000;6000 0;6000 3000]; numberElements=size(elementNodes,1); numberNodes=size(nodeCoordinates,1); xx=nodeCoordinates(:,1); yy=nodeCoordinates(:,2); % for structure: % displacements: displacement vector % force : force vector % stiffness: stiffness matrix GDof=2*numberNodes; U=zeros(GDof,1); force=zeros(GDof,1); % applied load at node 2
61
force(4)=-50000; force(8)=-100000; force(12)=-50000; % computation of the system stiffness matrix [stiffness]=... formStiffness2Dtruss(GDof,numberElements,... elementNodes,numberNodes,nodeCoordinates,xx,yy,EA); % boundary conditions and solution prescribedDof=[1 2 10]; % solution displacements=solution(GDof,prescribedDof,stiffness,force); us=1:2:2*numberNodes-1; vs=2:2:2*numberNodes; % drawing displacements figure L=xx(2)-xx(1); %L=node(2,1)-node(1,1); XX=displacements(us);YY=displacements(vs); dispNorm=max(sqrt(XX.^2+YY.^2)); scaleFact=2*dispNorm; clf hold on drawingMesh(nodeCoordinates+scaleFact*[XX YY],... elementNodes,L2,k.-); drawingMesh(nodeCoordinates,elementNodes,L2,k.--); % output displacements/reactions outputDisplacementsReactions(displacements,stiffness,... GDof,prescribedDof) % stresses at elements stresses2Dtruss(numberElements,elementNodes,... xx,yy,displacements,E)
62
4 Analysis of 2D trusses
Results are the following: Displacements ans = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 9.0000 10.0000 11.0000 12.0000 reactions ans = 1.0e+05 * 0.0000 0.0000 0.0001 stresses ans = -210.9015 122.4318 62.5575 -44.2349 -173.1447 -88.4697 62.5575 -173.1447 -44.2349 122.4318 -210.9015 >> 0.0000 1.0000 1.0000 0 0 7.1429 -9.0386 5.2471 -16.2965 5.2471 -20.0881 10.4942 0 3.3513 -9.0386
4.7 An example of 2D truss with spring Fig. 4.7 Deformed shape, problem 5
3500 3000 2500 2000 1500 1000 500 0 500 1000 0 1000 2000 3000 4000 5000
63
6000
2 1 25kN 3 y x 4 10m 2 5m 45 1
64
4 Analysis of 2D trusses
4 3 6 5 y x 7
Fig. 4.9 Mixing 2D truss elements with spring elements: degrees of freedom
2 1
%................................................................ % % % % % MATLAB codes for Finite Element Analysis problem6.m ref: D. Logan, A first couse in the finite element method, third Edition, mixing trusses with springs antonio ferreira 2008
% clear memory clear all % E; modulus of elasticity % A: area of cross section % L: length of bar E=210000; A=500; EA=E*A; % generation of coordinates and connectivities nodeCoordinates=[0 0;-5000*cos(pi/4) 5000*sin(pi/4); -10000 0]; elementNodes=[ 1 2;1 3;1 4]; numberElements=size(elementNodes,1); numberNodes=size(nodeCoordinates,1)+1; % spring added xx=nodeCoordinates(:,1); yy=nodeCoordinates(:,2);
65
% for structure: % displacements: displacement vector % force : force vector % stiffness: stiffness matrix GDof=2*numberNodes; U=zeros(GDof,1); force=zeros(GDof,1); stiffness=zeros(GDof); % applied load at node 2 force(2)=-25000; % computation of the system stiffness matrix for e=1:numberElements-1; % elementDof: element degrees of freedom (Dof) indice=elementNodes(e,:) ; elementDof=[ indice(1)*2-1 indice(1)*2 indice(2)*2-1 indice(2)*2] ; xa=xx(indice(2))-xx(indice(1)); ya=yy(indice(2))-yy(indice(1)); length_element=sqrt(xa*xa+ya*ya); C=xa/length_element; S=ya/length_element; k1=EA/length_element*... [C*C C*S -C*C -C*S; C*S S*S -C*S -S*S; -C*C -C*S C*C C*S;-C*S -S*S C*S S*S]; stiffness(elementDof,elementDof)=... stiffness(elementDof,elementDof)+k1; end % spring stiffness in global Dof stiffness([2 7],[2 7])= stiffness([2 7],[2 7])+2000*[1 -1;-1 1]; % boundary conditions and solution prescribedDof=[3:8]; % solution displacements=solution(GDof,prescribedDof,stiffness,force); % output displacements/reactions outputDisplacementsReactions(displacements,stiffness,... GDof,prescribedDof)
66
4 Analysis of 2D trusses
% stresses at elements for e=1:numberElements-1 indice=elementNodes(e,:); elementDof=[ indice(1)*2-1 indice(1)*2 indice(2)*2-1 indice(2)*2] ; xa=xx(indice(2))-xx(indice(1)); ya=yy(indice(2))-yy(indice(1)); length_element=sqrt(xa*xa+ya*ya); C=xa/length_element; S=ya/length_element; sigma(e)=E/length_element* ... [-C -S C S]*displacements(elementDof); end disp(stresses) sigma Note that the spring stiness is added to global degrees of freedom 2 and 7, corresponding to vertical displacements at nodes 1 and 4. Displacements, reactions and stresses are listed below. Displacements are exactly the same as the analytical solution [11]. Stresses in bars show that bar 1 is under tension and bar 2 is under compression. Displacements ans = 1.0000 2.0000 3.0000 4.0000 5.0000 6.0000 7.0000 8.0000 reactions ans = 1.0e+04 * 0.0003 0.0004 0.0005 -1.8103 1.8103 1.8103 -1.7241 -3.4483 0 0 0 0 0 0
67
0 0.6897 0