You are on page 1of 15

Numerically Calculating Beam Deections

Shaun Salisbury January 17, 2011

Contents
1 Introduction 2 Review : Solving a Set of Linear Equations 3 One Dimension Spring Elements 3.1 Multiple Connected Spring Elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.2 Spring Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3.3 Summary of Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 Beam Elements 4.1 Beam Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . A Matlab Code 2 2 2 3 4 5 6 6 10

Introduction

Beam deections could be calculated by direct integration but it becomes cumbersome for more complex beams, especially if the problem is statically indeterminate. In this handout we will employ a method based on techniques from nite element analysis but since we will limit ourselves to point loads and constant cross-sections between joints, the solution will be exact.

Review : Solving a Set of Linear Equations

A set of linear equations can be written in matrix form as shown below where K is a square matrix of constants, u is the vector of unknowns and F is a vector of constants. Ku = F In order to solve the equations we require: 1. as many equations as unknowns 2. all the equations to be independent (none of the rows of K can be made from linear combinations of some of the other rows, i.e. K is not a singular matrix) Checking the rst condition is straightforward; K must be square and the number of rows in K , u, and F must be the same. Checking the second condition is easy if you are using Matlab by computing the determinant (det(K)) and ensuring it doesnt equal zero. Provided the above conditions are satised, we can compute the unknowns with Matlab using: u=K\F You could instead use u=inv(K)*F, but Matlab advises against it since it is slower. (1)

One Dimension Spring Elements

To gain an understanding of the process, we will consider simple one-dimensional springs. Each element has two nodes, each which have one degree of freedomdisplacement, u.

ke f1 u1 u2 f2

Figure 1: Spring element. We can write the forces acting on the element, f1 and f2 , in terms of the displacements, u1 and u2 and the stiness ke . ke (u1 u2 ) ke (u2 + u1 ) 2 = f1 = f2 (2) (3)

or in the form ku = f : ke ke ke ke u1 f = 1 u2 f2 (4)

The k matrix is called the stiness matrix and the f matrix is the force matrix. If you look at k , you see that it is singular (the equations are not independent)! We actually have only one independent equation which means at least one displacement must be specied. The physical reason for this is that one side needs to be xed otherwise the whole spring will move (rigid body motion). The specied displacements are called boundary conditions. For the displacements which are not specied, a force must be specied at that joint otherwise you cannot solve the equation. If one species a boundary condition at a joint then you cannot also specify the force at that joint too. The force and displacement are related by the stiness and are not independent.

3.1

Multiple Connected Spring Elements

Now lets consider two springs connected together which have stinesses k1 and k2 . There are three external forces F1 , F2 , and F3 .

F1 k1 u1 u2

F2 k2 u3

F3

Figure 2: Multiple spring elements. We can write the equations for each element: k1 k 1 k2 k 2 F. k1 k1 k2 k2 u1 f = 1,1 u2 f2,1 u2 f = 2,2 u3 f3,2 (5) (6)

Using the equations of equilibrium at each node we can relate the internal forces, f , to the external forces,

f1,1 = F1 f3,2 = F3 f2,1 + f2,2 = F2 We can now combine both sets of matrices via the common node u2 and the equilibrium equations: k1 k1 0 u1 F1 k1 k1 + k2 k2 u2 = F2 0 k2 k2 u3 F3

(7) (8) (9)

(10)

The process of combining the stiness matrices is called assembly. We calculate the stiness matrix for each element and then add it to the total stiness matrix starting at the rst node. k 1 k 1 0 0 0 0 k1 k 1 0 k1 k1 0 + 0 k2 k2 = k1 k1 + k2 k2 (11) 0 0 0 0 k2 k2 0 k 2 k2 If we had 3 spring elements (4 nodes) connected sequentially, the total stiness matrix would be: k1 k1 0 0 k1 k1 + k2 k 2 0 0 k 2 k2 + k3 k3 0 0 k 3 k3

(12)

Again the total stiness matrix is singular and so we need to specify at least one displacement and then either a displacement or a force (external) must be specied for each of the other nodes. Loads are simply put in the force vector at the row corresponding to the node: F1 F2 (13) F3 Incorporating displacement boundary conditions requires a bit more consideration since we wish to use matrices in Matlab to solve the equations. This is best illustrated in an example.

3.2

Spring Example

Consider the two spring arrangement with k1 = 10 N/mm and k2 = 20 N/mm. The displacement of the rst node is 3 mm. The external force on node 2 is 50 N and on node 3 is 100 N. Our total stiness matrix is: 10 10 0 10 30 20 (14) 0 20 20 The total equation with the loads incorporated is: u1 F1 10 10 0 10 30 20 u2 = 50 0 20 20 u3 100

(15)

To incorporate the boundary condition, we would eliminate the top equation and rewrite the other two equations as: 3 50 10 30 20 u2 = (16) 0 20 20 100 u3 but we can move u1 to the right side of the equation since it is known: 10 0 30 20 20 20 u2 50 (10)3 = u3 100 0(3) (17)

Deleting rows is annoying in programs like Matlab so more often the row with the known displacement is left in but simplied to: 1 0 u1 3 3 0 30 20 u2 = 50 (10)3 = 80 (18) 0 20 20 u3 100 0(3) 100 Solving in Matlab gives:

u1 = 3, u2 = 18, u3 = 23. We can get the all the external forces by multiplying the total stiness matrix by the displacements: 1 0 3 F1 150 10 30 20 18 = F2 = 50 (19) 0 20 20 23 F3 100 We can also get the internal forces for each element now that we have all the displacements from the stiness matrix for each individual element. 10 10 20 20 10 10 20 20 3 f 150 = 1,1 = 18 f2,1 150 18 f 100 = 2,2 = 23 f3,2 100 (20)

(21)

3.3

Summary of Method

1. Calculate the stiness matrix for each element. 2. Assemble the element stiness matrix in the total stiness matrix. 3. Put known external loads in appropriate location of load vector. 4. Incorporate boundary conditions (known deections) in stiness matrix and load vector. 5. Solve for unknown displacements. 6. If desired, calculate the external and internal forces from the displacements.

Beam Elements

The same procedure is used for beam elements, but beams have two types of loadsshear force and moment, and two degrees of freedom at each jointdisplacement and slope.

M2

R2

M1 1 x

y2

y1

R1

Figure 3: Beam element. Assuming that the modulus of elasticity, E , and second moment of area, I , are constant over the beam element of length L, the equations for the slope, , and the displacement, y , for the beam element come from direct integration: 1 M 1 x + R 1 x 2 2 1 1 1 y (x) = y1 + 1 x + M1 x 2 + R 1 x 3 EI 2 6 (x) = 1 + We can again write the forces and moments equation for the element. 12 6L EI 6 4 L2 3 L 12 6L 6L 2L2 1 EI

(22) (23)

in terms of the degrees of freedom which gives the matrix y1 12 6L R1 1 M1 6L 2L2 = 12 6L y2 R2 6L 4L2 2 M2

(24)

This equation is in the exact same form Ku = F as before (the EI/L3 term is only factored out for clarity). Analysis of the stiness matrix shows that now two degrees of freedom must be specied and one of them must be a displacement (again to prevent rigid body motion). The solution steps are the same as for spring elements as the following example will illustrate.

4.1

Beam Example

The beam shown below has two parts with dierent moments of inertia but with the same modulus. The loading and boundary conditions are shown.

40 mm F=6 N E=6000 MPa M=5 N.mm I=20mm4 I=60mm4

60 mm
Figure 4: Beam example

60 mm

We need to break the beam into 3 elements (4 nodes) because the force is not at the junction of the two beam sections.

E=6000 MPa L=40mm I=20mm4 Nodes #: 1 2

F=6 N M=5 N.mm L=20mm I=20mm4 3 L=60mm I=60mm4 4

Figure 5: Beam example nodes. The individual stiness matrices are: 22.5 450 22.5 450 180 1800 450 1800 24000 12000 450 6000 , 22.5 450 22.5 450 180 1800 450 6000 450 12000 1800 12000

180 1800 180 1800

1800 20 600 12000 , 1800 20 24000 600

600 20 600 24000 600 12000 (25) 600 20 600 12000 600 24000

The assembled equations 22.5 450 450 12000 22.5 450 450 6000 0 0 0 0 0 0 0 0 Applying the boundary 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0

are: 22.5 450 202.5 1350 180 1800 0 0 450 6000 1350 36000 1800 12000 0 0 0 0 180 1800 200 1200 20 600 0 0 1800 12000 1200 48000 600 12000 0 y1 0 0 0 0 1 0 y2 6 0 0 0 0 2 = 0 y3 0 20 600 600 12000 3 0 20 600 y4 0 50 4 600 24000

(26)

conditions (y1 = 0, 1 = 0, y4 = 0): 0 0 0 0 202.5 1350 1350 36000 180 1800 1800 12000 0 0 0 0 0 0 180 1800 200 1200 0 600 0 0 1800 12000 1200 48000 0 12000 0 y1 0 0 0 0 1 0 y2 6 0 0 0 0 2 = 0 y3 0 0 600 0 12000 3 0 1 0 y4 0 50 4 0 24000

(27)

Solving the equations gives: y1 0 1 0 y2 0.3064 2 0.005404 = y3 0.30985 3 0.0042045 y4 0 0.0035606 4

(28)

Keep in mind that the absolute maximum deection and slope may occur between nodes. But since we know the exact equations (22, 23) we can get any point between the nodes. The Matlab program in the appendix does just this and prints the maximum slope and deection and the shear, moment, slope and deection graphs. The maximum absolute slope is 0.0103 and the maximum absolute deection is 0.3319. The beam graphs are shown in gure 6.

6 4 Shear 2 0 -2 0 20 40 60 80 100 120

100 Moment 0 -100 -200 0 0.01 0 -0.01 -0.02 0 0.4 Deflection 0.2 0 -0.2 -0.4 0 20 40 60 80 100 120

20

40

60

80

100

120

Slope

20

40

60

80

100

120

Figure 6: Beam example graphs.

Matlab Code

%************************************************************************* %*** %*** Beam Shear, Moment, Slope, and Deflection %*** S. Salisbury 2010 %*** %************************************************************************* %This program uses finite element methods to calculate the shear, %moment, slope and deflection distribution along a beam. Analysis is %limited to beams with constant cross-sections between nodes and only %concentrated forces and moments applied at the nodes. This permits %fewer nodes to be used since the form of the equations are known. % %One must be consistent in units (i.e. pounds-inches-psi, N-mm-MPa). %Slope is in radians and deflection is in the consistent units. %*************************************************************************

%************************************************************************* %***Enter Data... %************************************************************************* clc; clear; %clear the workspace and command window %Modulus of Elasticity E=6000; %Properties for each beam element BeamProp=[ %length, I 40, 20; 20, 20; 60, 60; ]; %Known node deflections % need at least 1 if a slope is specified, % otherwise need 2 if no slopes are specified NodeDef=[ %node, deflection 1, 0; 4, 0; ]; %Known node slopes % need at least 1 if only 1 deflection specified NodeSlp=[ %node, slope 1, 0; ]; %Applied node forces 10

ForApp=[ %node, 2, ];

force -6;

%Applied node moments MomApp=[ %node, moment 4, -50; ]; %Number of results per beam element Nres=10; %************************************************************************* % Start calculations... %************************************************************************* Nelem=length(BeamProp(:,1)); %number of beam elements Nnode=Nelem+1; %number of joints Ndof=Nnode*2; %number of degrees of freedom (1 deflection and % 1 slope per node) %Construct stiffness matrix %************************************************************************* K=zeros(Ndof);%initialize stiffness array for i=1:Nelem %for each beam element... L=BeamProp(i,1); %get the length EI=E*BeamProp(i,2); %get the section properties %stiffness of local element Ksect=EI/L^3*[ 12, 6*L, -12, 6*L; 6*L, 4*L^2, -6*L, 2*L^2; -12, -6*L, 12, -6*L; 6*L, 2*L^2, -6*L, 4*L^2; ]; %assemble in global stiffness matrix Loc=2*i-1; %location of element in global matrix for j=0:3 for k=0:3 K(Loc+j,Loc+k)=K(Loc+j,Loc+k)+Ksect(j+1,k+1); end end end %Construct Load Vector %************************************************************************* F=zeros(Ndof,1); %initialize load vector %Incorporate nodal forces if isempty(ForApp)==0 %check that array not empty for i=1:length(ForApp(:,1))

11

F(ForApp(i,1)*2-1)=ForApp(i,2); %put in applied force end end %Incorporate nodal moments if isempty(MomApp)==0 %check that array not empty for i=1:length(MomApp(:,1)) F(MomApp(i,1)*2)=MomApp(i,2); %put in applied moment end end %Incoporate Boundary Conditions %************************************************************************* %deflections for i=1:length(NodeDef(:,1)) %for each constraint... Loc=NodeDef(i,1)*2-1; %get the column the constraint refers to def=NodeDef(i,2); %get the deflection at this node for j=1:Ndof %for each row... if j~=Loc %if the row doesnt correspond to the constraint F(j)=F(j)-K(j,Loc)*def; %move the known to right side of eqn. K(j,Loc)=0; %elminiate it from the left side else %if row corresponds to the constraint... F(j)=def; %set the value on right side to constraint for k=1:Ndof %elminate this equation from left side of eqn. if k==Loc K(j,k)=1; else K(j,k)=0; end end end end end %slopes if isempty(NodeSlp)==0 for i=1:length(NodeSlp(:,1)) %for each constraint... Loc=NodeSlp(i,1)*2; %get the column the constraint refers to def=NodeSlp(i,2); %get the deflection at this node for j=1:Ndof %for each row... if j~=Loc %if the row doesnt correspond to the constraint F(j)=F(j)-K(j,Loc)*def; %move known to right side of eqn. K(j,Loc)=0; %elminiate it from the left side else %if row corresponds to the constraint... F(j)=def; %set the value on right side to constraint for k=1:Ndof %elminate this equation from left side of eqn. if k==Loc K(j,k)=1; else K(j,k)=0; end end

12

end end end end %Solve for deflection and slopes %************************************************************************* u=zeros(Ndof,1); %initialize dof vector u=K\F; %solve %Calculate shear(V) and moment(M) at the nodes %************************************************************************* % limitations on type of problem mean shear is constant along element % and moment varies linearly xVM=zeros(Ndof,1); %initialize distance along beam for V & M V=zeros(Ndof,1); %initialize shear (2 per node) M=zeros(Ndof,1); %initialize moment (2 per node) for i=1:Nelem %for each beam element... % get the element properties L=BeamProp(i,1); EI=E*BeamProp(i,2); %stiffness of local element (as before) Ksect=EI/L^3*[ 12, 6*L, -12, 6*L; 6*L, 4*L^2, -6*L, 2*L^2; -12, -6*L, 12, -6*L; 6*L, 2*L^2, -6*L, 4*L^2; ]; Loc=2*i; %location in the V & M matrices %calculate shear and moment at left and right end of element for k=0:3 V(Loc)=V(Loc)+Ksect(1,k+1)*u(Loc-1+k); M(Loc)=M(Loc)-Ksect(2,k+1)*u(Loc-1+k); V(Loc+1)=V(Loc+1)-Ksect(3,k+1)*u(Loc-1+k); M(Loc+1)=M(Loc+1)+Ksect(4,k+1)*u(Loc-1+k); end %distance xVM(Loc+1)=xVM(Loc)+L; xVM(Loc+2)=xVM(Loc+1); end %Print out nodal results %************************************************************************* disp(**Nodal Results**) %Column titles S=sprintf(%4s,Node); S=strcat(S,sprintf( %12s,Distance)); S=strcat(S,sprintf( %12s,Deflection)); S=strcat(S,sprintf( %12s,Slope));

13

% total force and moment at nodes S=strcat(S,sprintf( %12s,Force)); S=strcat(S,sprintf( %12s,Moment)); % Shear.2 and Moment.2 are at left side of beam element % Shear.1 and Moment.1 are at right side of beam element S=strcat(S,sprintf( %12s,Shear.2)); S=strcat(S,sprintf( %12s,Shear.1)); S=strcat(S,sprintf( %12s,Moment.2)); S=strcat(S,sprintf( %12s\n,Moment.1)); disp(S) %Column Data for i=1:Nnode S=sprintf(%4d,i); S=strcat(S,sprintf( S=strcat(S,sprintf( S=strcat(S,sprintf( S=strcat(S,sprintf( S=strcat(S,sprintf( S=strcat(S,sprintf( S=strcat(S,sprintf( S=strcat(S,sprintf( S=strcat(S,sprintf( disp(S) end

%12.3g,xVM(i*2-1))); %12.3g,u(i*2-1))); %12.3g,u(i*2))); %12.3g,V(i*2-1)+ V(i*2))); %12.3g,M(i*2-1)+ M(i*2))); %12.3g,V(i*2-1))); %12.3g,V(i*2))); %12.3g,M(i*2-1))); %12.3g\n,M(i*2)));

%Calculate slope(slp) and deflection(y) at increments along elements %************************************************************************* % limitations on type of problem allow use of formulae % from direct integration rather than many sub-elements xG=0; %global distance from left end of beam to left end of element xR=zeros(Nelem*Nres,1); %initialize global distance vector for results slp=zeros(Nelem*Nres,1); %initialize slope vector y=zeros(Nelem*Nres,1); %initialize deflection vector for i=1:Nelem %for each beam element... % get the element properties L=BeamProp(i,1); EI=E*BeamProp(i,2); %calculate the distance, slope and deflection for j=1:Nres %for each point along element... xL=L/(Nres-1)*(j-1); %local distance from element left side xR((i-1)*Nres+j)=xG+xL; %global distance slp((i-1)*Nres+j)=u(2*i)+(V(2*i)*xL^2/2+M(2*i)*xL)/EI; y((i-1)*Nres+j)=u(2*i-1)+u(2*i)*xL+ ... (V(2*i)*xL^3/6+M(2*i)*xL^2/2)/EI; end xG=xG+L; end

14

disp(sprintf(Maximum absolute deflection: %12.4f,... max(max(y),abs(min(y))))); disp(sprintf(Maximum absolute slope: %12.4f,... max(max(slp),abs(min(slp)))));

%Plot out the data %************************************************************************* subplot(4,1,1) area(xVM,V) ylabel(Shear) subplot(4,1,2) area(xVM,M) ylabel(Moment) subplot(4,1,3) area(xR,slp) ylabel(Slope) subplot(4,1,4) area(xR,y) ylabel(Deflection)

15

You might also like