%************************************************************************** % % Truss % Minize C= alfa_1 *fg^T*ug +alfa_2* ECC % A_e % Subject to Kg(A_e) * ug(A_e) = fg % g_w= \SUM^nel( We) <= Wf % Amintau & ite<250 & Vol_ite>=Wf ite=ite+1; %% ****************** Solver Linear ******************** ug=zeros(2*nnos,1); ug(FreeDofs)=kg(FreeDofs,FreeDofs)\fg(FreeDofs); %% ************** Função Objetivo ****************** C=fg'*ug; %% ************** Sensitivity Analysis ******************* % dCda = - ue' (ke') ue for e=1:nel noi=inci(e,5); noj=inci(e,6); xi=coord(noi,1); yi=coord(noi,2); xj=coord(noj,1); yj=coord(noj,2); l=sqrt((xj-xi)^2+ (yj-yi)^2); c=(xj-xi)/l; s=(yj-yi)/l; E=Tmat(inci(e,3),1); A=Tgeo(inci(e,4),1); ke= (E/l)*[ c^2 c*s -c^2 -c*s; c*s s^2 -c*s -s^2; -c^2 -c*s c^2 c*s; -c*s -s^2 c*s s^2]; ue=[ ug(2*noi-1) ug(2*noi) ug(2*noj-1) ug(2*noj)]'; dCdA(e)=ue'*ke*ue; vVol(e)=A*l; rho=Tmat(inci(e,3),4); We(e)=A*l*rho; ECC(e)=A*l*rho*Tmat(inci(e,3),5); end dCdATotal(ite)=sum(dCdA); WeTotal(ite)=sum(We); ECCTotal(ite)=sum(ECC); % ***************** Compliance Normalization if ite==1 nMax=max(dCdA); else end dCdA=(1/nMax)*dCdA; % Initial Normalization dCdA [a,b] = sort(dCdA,'descend'); % Sort of dCdA % ************* Add and Remove Area section Ai i=0; j=0; while jAmin Tgeo(b(end-i))=Tgeo(b(end-i))-Ai;j=j+1; else Tgeo(b(end-i))=Amin; end i=i+1; end i=1; j=0; while j<(nel_met-1) if Tgeo(b(i))=2*N erro=abs(sum(vC(ite-N+1:ite))- sum(vC(ite-N*2+1:ite-N)) )/ sum(vC(ite-N+1:ite)); end end % loop while % % xmin = min(coord(:,1)); xmax = max(coord(:,1)); ymin = min(coord(:,2)); ymax = max(coord(:,2)); Lx = xmax - xmin; Ly = ymax - ymin; xmin = xmin - 0.2*Lx; xmax = xmax + 0.2*Lx; ymin = ymin - 0.2*Ly; ymax = ymax + 0.2*Ly; escala = (0.1*max(Lx,Ly)/(max(abs(ug)))); a=zeros(nnos,2); a(:,1)=coord(:,1)+escala*ug(1:2:2*nnos-1); a(:,2)=coord(:,2)+escala*ug(2:2:2*nnos); scrsz = get(groot,'ScreenSize'); figure('Position',[ scrsz(4)*.5 scrsz(4)*.25 scrsz(3)*.35 scrsz(4)*.65]) tit=''; subplot(2,1,1);plotMalha(coord,inci,1,tit); hold on; tit=[' Finite Element Mesh & Max. Displamcement [m] = ',num2str((max(abs(ug))))]; subplot(2,1,1);plotMalha(a,inci,0,tit); axis([xmin xmax ymin ymax]); hold off tit=[' Finite Element Mesh ']; subplot(2,1,2);plotMalha2Mat(coord,inci,0,tit,Tgeo,Tmat,Lsize); hold on; axis([xmin xmax ymin ymax]); figure; yyaxis left plot(1:ite,vC); grid on;hold on; yyaxis right plot(1:ite,Vol);grid on; legend('Compliance along Iterations','Volume along Iterations'); hold off;