Technological University of Panama | Faculty of Mechanical Engineering | Victor Campus
Levi Sasso
% Nombre: Javier Alexander Bernal León
% ID Card: 8-886-1198
Degree: Mechanical Engineering (Trend in Dynamic and Automatic Systems)
Subject: Approximate Methodology of Mechanical Solutions
Professor: Ilka Banfield
Problem Statement: A simply supported beam is to be analyzed.
through the use of Finite Element Methods (FEM for its acronym in Spanish)
Such beam will be subjected to a distributed load and it is intended
To obtain the final product, the deformation graph of the beam.
Solution: The solution to this problem is based on the beam theorem.
Bernoulli.
Tools: Within the available tools for development of
For this assignment we have:
% 1- Notes and information provided by Professor Ilka Bnafield.
Textbooks such as: Solid Mechanics: A Variational
Approach (Clive Dym & Irving Shames), Mechanics of Continuous Media for
% Engineers (Xavier Olivella & Carlos Agelet) and MATLAB Codes for Finite
% Element Analysis (A.J.M. Ferrerira).
% 3- MATLAB as a platform to program the program to be studied.
From this line, the code for the solution starts to be programmed.
% of the problem:
PROGRAM NUMBER ONE: CALCULATION OF BEAM DEFLECTION USING FINITE ELEMENTS
USING MATLAB
clear all
% Parameters of mechanical and geometric properties of the beam:
Variable(E): Modulus of elasticity (Specified in assignment one).
Variable(I): Moment of inertia (Arbitrarily chosen).
% Structural parameters of the beam analysis:
Variable (P): Distributed Load applied on the beam
Variable (displacements): Displacement vector of the beam.
Variable (force): Applied force vector.
Stiffness (variable): Stiffness matrix of the beam.
Variable (GDof): General amount of degrees of freedom of the system.
% Parameters for generating coordinates on the beam:
Calculation for the generation of coordinates in the beam: It is specified
% some observations for this section:
% Variable (numberElements): Número o cantidad de elementos a analizar.
Variable (L): Maximum length of the beam.
E = 5000000;
I=1000;
EI=E*I;
numberElements=150;
nodeCoordinates=linspace(0,1,numberElements+1)';
xx=nodeCoordinates;
L=max(nodeCoordinates);
numberNodes=size(nodeCoordinates,1);
xx=nodeCoordinates(:,1);
fori=1:numberElements;
elementNodes(i,1)=i;
elementNodes(i,2)=i+1;
end
P=-1500;
GDof=2*numberNodes;
U=zeros(GDof,1);
[stiffness,force]=...
formStiffnessBernoulliBeam(GDof,numberElements,...
elementNodes, numberNodes, xx, EI, P);
Boundary conditions for the analysis of the simply supported beam:
% Variable for node U (fixedNodeU)=[1 2*numberElements+1]’;
% Variable for node V (fixedNodeV)=[2 2*numberElements+2]’;
fixedNodeU = [1, 2 * numberElements + 1];
fixedNodeV =[]';
prescribedDof=[fixedNodeU;fixedNodeV];
% solution
displacements=solution(GDof,prescribedDof,stiffness,force);
Resulting from displacements and reactions
outputDisplacementsReactions(displacements, stiffness,...
GDof, prescribed Dof
% Deformed beam graph
U=displacements([Link]*numberNodes);
plot(nodeCoordinates,U,'-')
title('COMPORTAMIENTO DE LA VIGA SIMPLEMENTE APOYADA')
Beam Length
ylabel('DESPLAZAMIENTOS')
legend('DEFLECTION UNDER 1500 N LOAD')
gridon
GRAPH NUMBER ONE: BEHAVIOR OF THE SIMPLY SUPPORTED BEAM
PROGRAM NUMBER TWO: CALCULATION OF THE APPLIED FORCE VECTOR AND THE STIFFNESS MATRIX.
OBSERVATIONS:
THIS IS A SUBPROGRAM CALLED IN THE ROUTINE OF PROGRAM NUMBER ONE.
2. THE VARIABLES OF THIS PROGRAM ARE ALSO SPECIFIED IN THE COMMENTS OF THE
PROGRAM NUMBER ONE.
function[stiffness,force]=...
formStiffnessBernoulliBeam(GDof,numberElements,...
elementNodes,numberNodes,xx,EI,P);
force=zeros(GDof,1);
stiffness=zeros(GDof);
for=1:numberElements;
index=elementNodes(e,:);
elementDof=[ 2*(index(1)-1)+1 2*(index(2)-1)...
2*(indice(2)-1)+1 2*(indice(2)-1)+2];
LElem=xx(index(2))-xx(index(1));
ll=LElem;
k1=EI/(LElem)^3*[12 6*LElem -12 6*LElem; 6*LElem 4*LElem^2
-6*LElem 2*LElem^2;
-12 -6*LElem 12 -6*LElem ;
6*LElem 2*LElem^2 -6*LElem 4*LElem^2];
f1=[P*LElem/2 P*LElem*LElem/12 P*LElem/2...
-P*LElem*LElem/12]';
Force vector result
force(elementDof)=force(elementDof)+f1;
Stiffness matrix result
stiffness(elementDof,elementDof)=...
stiffness(elementDof,elementDof)+k1;
end
PROGRAM NUMBER THREE: CALCULATION OF REACTIONS AND DISPLACEMENTS IN THE BEAM.
OBSERVATIONS:
THIS IS A SUBPROGRAM CALLED IN THE ROUTINE OF PROGRAM NUMBER ONE.
functionoutputDisplacementsReactions...
(displacements,stiffness,GDof,prescribedDof)
This function is designed for the output of displacements and
% reactions are presented in table form.
% Calculation for displacements
Displacements
%displacements=displacements1;
jj=1:GDof; format;
[jj' displacements];
Calculation for the reactions
F = stiffness * displacements;
reactions = F(prescribedDof);
display('reactions');
[prescribedDof reactions];
end
PROGRAM NUMBER FOUR: CALCULATION OF THE GENERAL SOLUTION.
OBSERVATIONS:
THIS IS A SUBPROGRAM CALLED IN THE ROUTINE OF PROGRAM NUMBER ONE.
functiondisplacements=solution(GDof,prescribedDof,stiffness,force)
% Calculation to find the solution in terms of the degrees of freedom
% global or general.
activeDof=setdiff([1:GDof]',[prescribedDof]);
U=stiffness(activeDof,activeDof)*force(activeDof);
displacements=zeros(GDof,1);
displacements(activeDof)=U;
end