Está en la página 1de 4

clear all

clc
%
%Creo la matriz H a partir de las derivadas parciales de las funciones de forma
%
syms h
syms hi
syms r
syms s
syms H0
%
%MATRIZ con las funciones de forma para cada nodo.
h = [(((1+r)*(1+s))/4 -((1-r^2)*(1+s))/4 - ((1-s^2)*(1+r))/4);
(((1-r)*(1+s))/4 -((1-r^2)*(1+s))/4 - ((1-s^2)*(1-r))/4);
(((1-r)*(1-s))/4 -((1-s^2)*(1-r))/4 - ((1-r^2)*(1-s))/4);
(((1+r)*(1-s))/4 -((1-r^2)*(1-s))/4 - ((1-s^2)*(1+r))/4);
(((1-r^2)*(1+s))/2);
(((1-s^2)*(1-r))/2);
(((1-r^2)*(1-s))/2);
(((1-s^2)*(1+r))/2)];
%
%Hago las derivadas parciales y armo la matriz H simbolica(H0)
Nh = size (h,1);
for i = 1:Nh
hi = h(i,1);
%
hr = diff (hi,r);
hs = diff (hi,s);
%
H0(1,i)= hr;
H0(2,i)= hs;
end
%
%----------Datos de la maya-----------------------------------------------%'Matriz coordenada'
COORD = [10 10;0 10;0 0;10 0;5 10;0 5;5 0;10 5];
%
%'Matriz de conectividades'
CNOD = [1 2 3 4 5 6 7 8];
%
% Matriz conectividad de grados de libertad (CGL)
NNODLOC = size (CNOD,2) ;
NELEM = size (CNOD,1) ;
NNODGLOB = size (COORD,1) ;
for m = 1:NELEM ;
for a = 1:NNODLOC ;
CGL (m,a*2-1)=CNOD(m,a)*2-1 ;
CGL (m,a*2)=CNOD(m,a)*2 ;
end
end
%
%-------datos del material------------------------------------------------%modulo de Young'
E = 2.1e6;
%
%Coeficiente de Poisson'
v = 0.0003;
%--------------------------------------------------------------------------

%Matriz C de Tencin (stress)


C = E/(1-v^2)*[1 v 0;v 1 0;0 0 (1-v)/2];
%
%'Puntos de Gauss'
PG = [-0.774596669241483 0 0.774596669241483];
%'alfas'
A = [0.555555555555556 0.888888888888889 0.555555555555556];
%numero de Puntos de Gauss
NPG = size (PG,2);
%
%-------------------------------------------------------------------------%Matriz K global
KGLOB = zeros(NNODGLOB*2,NNODGLOB*2);
%
for m = 1:NELEM
%matriz K elemental
KELEM = zeros(NNODLOC*2,NNODLOC*2);
for i = 1:NPG ;
for j = 1:NPG ;
r = PG(i) ;
s = PG(j) ;
%
%Matriz H evaluada para elemento cuadrado de 8 nodos
H = H0;
H = eval(H);
%
%Armo e invierto el J
J = H*COORD(CNOD(m,:),:) ;
DETJ = det(J) ;
INVJ = J^(-1) ;
%
%rearreglo la matriz H
H2 = zeros(4,NNODLOC*2) ;
for HR = 1:NNODLOC ;
H2(1,(HR*2)-1)= H(1,HR) ;
H2(3,(HR*2)) = H(1,HR) ;
H2(2,(HR*2)-1) = H(2,HR) ;
H2(4,(HR*2)) = H(2,HR) ;
end
%
%rearreglo la matriz J^-1
INVJR = zeros (3,4) ;
INVJR(1,1) = INVJ(1,1) ;
INVJR(3,3) = INVJ(1,1) ;
INVJR(1,2) = INVJ(1,2) ;
INVJR(3,4) = INVJ(1,2) ;
INVJR(2,3) = INVJ(2,1) ;
INVJR(3,1) = INVJ(2,1) ;
INVJR(2,4) = INVJ(2,2) ;
INVJR(3,2) = INVJ(2,2) ;
%
%Armo la matriz B
B = INVJR*H2;
%
%Armo la Matriz Kt elemental
KELEM = KELEM + B'*C*B*DETJ*A(i)*A(j) ;
end
end
%Ensamblo las K global
NGLLOC = size (CGL,2);

for i = 1:(NGLLOC)
for j = (1:NGLLOC)
KGLOB(CGL(m,i),CGL(m,j)) = KELEM(i,j) + KGLOB(CGL(m,i),C
GL(m,j)) ;
end
end
end
%
KGLOB2 = KGLOB;
%
%------------------Impongo las CC y resuelvo----------------------------%
%
%Armo los vectores fuerza
CC = zeros(NNODGLOB*2,1);
%
%'desplazamientos nulos en "Y" en los nodos'
DNY = [3 4 7];
Nccy = size (DNY,2);
%
for tc = 1:Nccy
COL=2*DNY(tc);
KGLOB(COL,:) = zeros(1,NNODGLOB*2);
for cc = 1:NNODGLOB*2
CC(cc,1) = CC(cc,1) - KGLOB(cc,COL);
KGLOB(cc,COL)=0;
end
KGLOB(COL,COL)=1;
CC(COL,1)= 0;
end
%
%'desplazamientos nulos en "X" en los nodos'
DNX = [4 7];
NCC = size (DNX,2);
for tc = 1:NCC
COL=DNX(tc)*2-1;
KGLOB(COL,:) = zeros(1,NNODGLOB*2);
for cc = 1:NNODGLOB*2
CC(cc,1) = CC(cc,1) - KGLOB(cc,COL);
KGLOB(cc,COL)=0;
end
KGLOB(COL,COL)=1;
CC(COL,1)= 0;
end
%'Fuerzas nodales en direccin "y"'
Fnod = [1 100 -100;2 100 100;5 100 100];
f = size (Fnod,2);
for Fu = 2:f
FNOD = [Fnod(:,1) Fnod(:,Fu)];
disp ('fuerzas puntuales aplicadas en sentido del eje Y')
disp ('nodo N Fuerza')
disp (FNOD)
%
NCC = size (FNOD,1);
for tc = 1:NCC
COL = FNOD(tc,1)*2;
CC(COL,1) = FNOD(tc,2);
end
%
%invierto KGLOB y resuelvo el sistema
DESPL = inv(KGLOB) * CC;

disp('Desplazamientos [cm]')
disp (DESPL)
%
DESFT=zeros(NNODLOC,3);
%Matriz de coordenadas r s para cada noda
COORDN = [1 1;-1 1;-1 -1;1 -1;0 1;-1 0;0 -1;1 0];
for i = 1:NNODLOC ;
r = COORDN(i,1);
s = COORDN(i,2);
%
%Matriz H para elemento cuadrado de 8 nodos evaluada
H = H0;
H = eval (H);
%
%Armo e invierto el J
J = H*COORD(CNOD(m,:),:) ;
DETJ = det(J) ;
INVJ = J^(-1) ;
%
%rearreglo la matriz H
H2 = zeros(4,NNODLOC*2) ;
for HR = 1:NNODLOC ;
H2(1,(HR*2)-1)= H(1,HR) ;
H2(3,(HR*2)) = H(1,HR) ;
H2(2,(HR*2)-1) = H(2,HR) ;
H2(4,(HR*2)) = H(2,HR) ;
end
%
%rearreglo la matriz J^-1
INVJR = zeros (3,4) ;
INVJR(1,1) = INVJ(1,1) ;
INVJR(3,3) = INVJ(1,1) ;
INVJR(1,2) = INVJ(1,2) ;
INVJR(3,4) = INVJ(1,2) ;
INVJR(2,3) = INVJ(2,1) ;
INVJR(3,1) = INVJ(2,1) ;
INVJR(2,4) = INVJ(2,2) ;
INVJR(3,2) = INVJ(2,2) ;
%
%Armo la matriz B
B = INVJR*H2;
%Armo la Matriz Kt elemental
DESF=B*DESPL;
DESFT(i,:)=DESF;
end
disp('Deformaciones por nodos [cm^2]')
disp('
Exx
Eyy
2Exy')
disp(DESFT)
%
F = KGLOB2*DESPL;
disp('Fuerzas [kgf')
disp(F)
disp('.....................................')
end

También podría gustarte