% wspornik - rozwiazanie MES

% przy uzyciu pakietu CALFEM 

% (belka - ale ES ramowe!)

%

% opracowal: Adam Wosatko



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% dane

E=200000;

I=0.0001;

A=0.01;

q=0.2;

L=2;

ep = [E A I]



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% dyskretyzacja

LE=4; LW=LE+1; LSSW=3; 

LSSU=LW*LSSW;

K=zeros(LSSU);

F=zeros(LSSU,1);



%wspolrzedne

Coord=[0 0;

       L/4 0;

       L/2 0;

       3*L/4 0;

       L 0];



% topologia 

% (przynaleznosc stopni swobody do ES)

% numery st.sw. dla wezlow:

Dof=[ 1 2 3;

      4 5 6;

      7 8 9;

      10 11 12;

      13 14 15];

% numery st.sw. dla poszczegolnych ES: 

Edof=[1  1 2 3     4 5 6;

      2  4 5 6     7 8 9;

      3  7 8 9     10 11 12;

      4  10 11 12  13 14 15];

[Ex,Ey]=coordxtr(Edof, Coord, Dof, 2)

pause;



% rysunek siatki ES

elnum=Edof(:,1);

eldraw2(Ex,Ey,[1,3,1],elnum);

pause;



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% obciazenie:

eq=[0 -q];



% przyklad dla 2 ES: 

%eq1=[0 -q] 

%eq2=[0 -q]



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% macierze i wektory ES

% agregacja

%

% i-ty ES: [Ke, Fe]=beam2e(Ex(i,:),Ey(i,:),ep,eq);

% przyklad dla 2 ES:

%[Ke, Fe]=beam2e(Ex(1,:),Ey(1,:),ep,eq1)

%[K,F]=assem(Edof(1,:),K,Ke,F,Fe)

%[Ke, Fe]=beam2e(Ex(2,:),Ey(2,:),ep,eq2)

%[K,F]=assem(Edof(2,:),K,Ke,F,Fe)

%

% jak nie ma obciazenia to dla i-tego ES:

% [Ke, Fe]=beam2e(Ex(i,:),Ey(i,:),ep);

% K=assem(Edof(i,:),K,Ke);



for i=1:LE

    [Ke, Fe]=beam2e(Ex(i,:),Ey(i,:),ep,eq);

    [K,F]=assem(Edof(i,:),K,Ke,F,Fe);

end %for 



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% warunki brzegowe

bc=[1 0; 2 0; 3 0];



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%rozwiazanie

[a,R]=solveq(K,F,bc)

pause;



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% postprocessing



% powrot do ES

% przemieszczenia w poszczegolnych ES

Ed=extract(Edof,a)



% rysunek zdeformowanej siatki ES

[sfac]=scalfact2(Ex,Ey,Ed,2.0);

eldisp2(Ex,Ey,Ed,[2,1,1],sfac);



% rysunek porownawczy

figure(2)

plot(Coord(:,1),a(2:3:LSSU))





%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

