Documente Academic
Documente Profesional
Documente Cultură
E = 70C1)a, A = 3e-41712
50kN 100EN 50kN
O
o .̀3m
3
3m
H
12
—1— .,
10
y
¡ :r
clear all
E=70000; A=300; EA=E*A;
elementNodes=[ 1 2;1 3;2 3;2 4;1 4;3 4;3 6;4 5;4 6;3 5;5 6];
nodeCoordinates=[ O 0;0 3000;3000 0;3000 3000;6000 0;6000 30001;
numberElements=size(elementNodes,1);
numberNodes=size(nodeCoordinates,1);
xx=nodeCoordinates(:,1);
yy=nodeCoordinates(:,2);
GDof=2*numberNodes;
U=zeros(GDof,1);
force=zeros(GDof,1);
force(4)=-50000;
force(8)=-100000;
force(12)=-50000;
Istiffness1=formStiffness2Dtruss(GDof,numberElements,elementNodes,numberNodes,nodeCoordinates,xx,y
y,EA);
prescribedDof=[1 2 101';
displacements=solution(GDof,prescribed Dof,stiffness,force);
outputDisplacementsReactions(displacements,stiffness,GDotprestribedDof)
stresses2Dtruss(numberElements,elementNodes,xx,yy,displacements,E)
function
[stiffness]=formStiffness2Dtruss(GDof, numberElements,elementNodes,numberNodes,nodeCoordinates,xx,y
y,EA);
stiffness=zeros(GDof);
for e=1:numberElements;
indice=elementNodes(e,:) ;
elementDoM indice(1)*2-1 indice(1)*2 indice(2)*2-1
indice(2)*21 ;
xa=xx(indice(2))-xx(indice(1));
ya=yy(indice(2))-yy(indice(1));
length_element=scirt(xa*xa+ya*ya);
C=xa/length_element;
S=ya/length_element;
k1=EA/length_element*,..
[C*C C*S -C*C -C*5; C*S S*S -C*S -S*S;-C*C -C*S C*C C*S;-C*S -S*S C*S S*5];
stiffness(elementDotelementDof)=stiffness(elementDof,elementDof)+kl;
end
function stresses2Dtruss(numberElements,elementNodes,xx,yy,dísplacements,E)
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)=Efiength_element*[-C -S C Srdisplacements(elementDof);
end
disp('stresses')
sigma'
function displacements=solution(GDof,prescribedDof,stiffness,force)
activeDof=setdiff([1:GDof]',[prescribedDof]);
U=stiffness(activeDotactiveDoffiforce(activeDof);
displacements=zeros(GDof,1);
displacements(activeDof)=U;
Problema 02 (6 puntos).
En el conjunto de vigas, recibe cargas de dos tipos. Calcular las deformaciones en los nodos 2 y 3
por el método de los elementos finitos.
3m
y
51(..N.m
3m 3m
Problema 03 (4 puntos).
La matriz de rigidez local de una viga (preparada para la obtención de la matriz de rigidez de viga
2D) se puede obtener de la combinación de conceptos de barra y viga Euler, como se muestra en
la siguiente matriz.
E.4
O 0 — O O
Justificar los términos de la siguiente matriz de rigidez local de una viga, preparada para la
transformación a coordenadas globales, que también se puede obtener de la combinación de
conceptos de barra y viga Euler:
O O 0 0 O _ lli O O O O O
-III"
12Eh o O O 8E 17 O _17y_
12Eir_ O O O 1E12_
L V.1 -1:7-
12E1 8E1 o 12E1
_...17.8. o 8E1
o
O O O
-1
7-1 —71- —1.77
GEL o o O o O — q.1- O O
O 8E1u O
41-1 O O
-in- O 111
O 7. _
0E1,, o o O
KfC 41' 2 41"7"
EL% O O O O O
12E/ O O O
-17r- 1Y-1-
12E1u O v
O
GEL o o
41 !v
L
sí m. jE12..
Problema 04 (6 puntos).
olear all;
cic
P = -1;
L = 1;
numberElementsX = 20;
numberElementsY = 20;
numberElements = numberElementsX*numberElementsY;
elementNodes = zeros(numberElements,4);
for j = 1:(numberElementsY)
for i = 1:(numberElementsX)
elementNodes(i+(numberElementsX)*(j-1),:) =
[i+(numberBlementsX+1)*(j-1) i+1+(numberElementsX+1)*(j-1)
1+i+(numberElementsX+1)*j i+(numberElementsX+1)*j7;
end
end
xx=nodeCoordinates(:,1);
yy-nodeCoordinates(:,2);
numberNodes=size(xx,1);
GDof=3*numberNodes;
liStiffness
K=zeros(GDof);
%Bending Stiffness
[gaussWeights,gaussLocations7=gaussQuadrature('complete');
for e=1:numberElements
indice-elementNodes(e,:);
elementDof=[indice indice+numberNodes indice+2*numberNodes];
ndof=length(indice);
for q=1:size(gaussWeights,1)
GaussPoint=gaussLocations(q,:);
xi=GaussPoint(1);
eta=GaussPoint(2);
[shapeFunction,naturalDerivatives] = shapeFunctionQ4(xi,eta);
[Jacob,invJacobian,XYderivatives]=...
Jacobian(nodeCoordinates(indice,:),naturalDerivatives);
B b=zeros(3,3*ndof);
Bib(1,ndof+1:2*ndof) = XYderivatives(:,1)';
B_b(2,2*ndof+1:3*ndof)= XYderivatives(:,2)';
B_b(3,ndof+1:2*ndof) = XYderivatives(:,2)';
Bb(3,2*ndof+1:3*ndof)= XYderivatives(:,1)';
K(elementDof,elementDof)=K(elementDof,elementDof)+
B_b'*C_bending*B_b*gaussWeights(q)*det(Jacob);
end
end
%Shear Stiffness
[gaussWeights,gaussLocations]=gaussQuadrature('reduced.);
for e=l:numberElements
indice=elementNodes(e,:);
elementDof=[indice indice+numberNodes indice+2*numberNodes];
ndof=length(indice);
for q=1:size(gaussWeights,1)
GaussPoint=gaussLocations(q,:);
xi=GaussPoint(1);
eta=GaussPoint(2);
[shapeFunction,naturalDerivatives] = shapeFunctionQ4(xi,eta);
[Jacob,invJacobian,XYderivatives)=...
Jacobian(nodeCoordinates(indice,:),naturalDerivatives);
B s=zeros(2,3*ndof);
Bls(1,1:ndof) = XYderivatives(:,1)';
B s(2,1:ndof) = XYderivatives(:,2)';
Bis(1,ndof+1:2*ndof) = shapePunction;
B s(2,2*ndof+1:3*ndof) = shapeFunction;
K(elementDof,elementDof)=K(elementDof,elementDof)+...
B_s'*C_shear *B_s*gaussWeights(q)*det(Jacob);
end
end
%Force
force=zeros(GDof,1);
[gaussWeights,gaussLocations]=gaussQuadrature('reduced'):
for e=1:numberElements
indice = elementNodes(e,:);
for q=1:size(gaussWeights,1)
GaussPoint = gaussLocations(q,:);
GaussWeight = gaussWeights(q);
xi = GaussPoint(1);
eta = GaussPoint(2);
[shapeFunction,naturalDerivatives] = shapeFunctionQ4(xi,eta);
[Jacob, invJacobian,XYderivatives] =
Jacobian(nodeCoordinates(indice,:),naturalDerivatives);
force(indice) = force(indice)+shapeFunction*P*det(Jacob)*GaussWeight;
end
end
switch typeBC
case 'ssss'
fixedNodeW =find(xx==max(nodeCoordinates(:,1))I...
xx==min(nodeCoordinates(:,1))1..•
yy==min(nodeCoordinates(:,2))I...
yy==max(nodeCoordinates(:,2)));
fixedNodeTX =find(yy==max(nodeCoordinates(:,2))I...
yy==min(nodeCoordinates(:,2)));
fixedNodeTY =find(xx==max(nodeCoordinates(:,1))1...
xx==min(nodeCoordinates(:,1)));
case 'coco'
fixedNodeW =find(xx==max(nodeCoordinates(:,1))I...
xx==min(nodeCoordinates(:,1))1...
yy==min(nodeCoordinates(:,2)11...
yy==max(nodeCoordinates(:,2)));
fixedNodeTX =fixedNodeW;
fixedNodeTY =fixedNodeTX;
case 'scsc'
fixedNodeW =find(xx==max(nodeCoordinates(:,1)11...
xx==min(nodeCoordinates(:,1))1—.
yy==min(nodeCoordinates(:,2))1...
yy==max(nodeCoordinates(:,2)));
fixedNodeTX =find(xx==max(nodeCoordinates(:,2)11...
xx==min(nodeCoordinates(:,2)));
fixedNodeTY=[];
case 'cccf,
fixedNodeW =find(xx==min(nodeCoordinates(:,1)11...
yy==min(nodeCoordinates(:,2)11...
yy==max(nodeCoordinates(:,2)));
fixedNodeTX =fixedNodew;
fixedNodeTY =fixedNodeTX;
end
prescribedDof =
[fixedNodeW;fixedNodeTX+numberNodes;fixedNodeTY+2*numberNodes];
activeD0f=setdiff((1:GDof)',(prescribedDof));
U=K(activeDof,activeDof)\force(activeDof);
displacements=zeros(GDof,1);
displacements(activeDof)=U;
plot3(xx,yy,displacements(1:(numberElementsX+1)*(numberElementsY+1)),...
'MarkerFaceColor',[0 0 1],'MarkerEdgeColor',[0 O 1],...
'MarkerSize',3,'Marker','o, ,, LineStyle','none','Color',[0 0 0]);
function [weights,locations]=gaussQuadrature(option)
switch option
case 'complete'
locations....
[ -0.577350269189626 -0.577350269189626;
0.577350269189626 -0.577350269189626;
0.577350269189626 0.577350269189626;
-0.577350269189626 0.5773502691896263;
weights= [ 1;1;1;1] ;
case 'reduced'
locations=[0 0);
weights=[4];
end
end
function [shape,naturalDerívatives)=shapeFunctionQ4(xi,eta)
shape=1/4*[ (1-xi)*(1-eta);(1+xi)*(1-eta.);
(1+xi)*(1+eta);(1-xi)*(1+eta)1;
naturalDerivatives....
1/4*[-(1-eta), -(1-xi);1-eta, -(1+xi);
1+eta, 1+xi;-(1+eta), 1-xi);
end
function [Jacobianmatrix,invJacobian,XYDerivatives)....
Jacobian(nodeCoordinates,naturalDerivatives)
JacobianMatrix=nodeCoordinates'*naturalDerivatives;
invJacobian=inv(JacobianMatrix);
XYDerivatives=naturalDerivatives*invJacobian;
end