You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.6 KiB
56 lines
1.6 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2020-10-29 15:04:15
|
|
% @LastEditTime: 2021-03-13 16:40:38
|
|
%--------------------------
|
|
|
|
% FE-ANALYSIS
|
|
function [Ue, sigma] = microFEAsimp(nelx, nely, iK, jK, d1, d2, d3, d4, ...
|
|
ufixed, wfixed, xPhys, KE0, KE1)
|
|
|
|
% if nargin>13
|
|
% % 1-mat
|
|
% sK = reshape(KE0(:) * (Emin + xPhys(:)' * (E0 - Emin)), 64 * nelx * nely, 1);
|
|
% else
|
|
|
|
% 2-mat
|
|
sK = zeros(64, nelx*nely);
|
|
for i = 1:nelx
|
|
for j = 1:nely
|
|
ele = j + (i-1)*nely;
|
|
if xPhys(ele)==1
|
|
sK(:, ele) = KE1(:);
|
|
else
|
|
sK(:, ele) = KE0(:);
|
|
end
|
|
end
|
|
end
|
|
sK = sK(:);
|
|
% end
|
|
|
|
|
|
K = sparse(iK, jK, sK);
|
|
K = (K + K') / 2;
|
|
|
|
Kr = [K(d2, d2), K(d2, d3) + K(d2, d4);
|
|
K(d3, d2) + K(d4, d2), K(d3, d3) + K(d3, d4) + K(d4, d3) + K(d4, d4)];
|
|
Ue(d1, :) = ufixed;
|
|
Ue([d2, d3], :) = Kr \ (-[K(d2, d1); K(d3, d1) + K(d4, d1)] * ufixed - ...
|
|
[K(d2, d4); K(d3, d4) + K(d4, d4)] * wfixed);
|
|
Ue(d4, :) = Ue(d3, :) + wfixed;
|
|
|
|
R = K*Ue;
|
|
lxx = ((2*nelx*(nely+1)+1):2:2*(nelx+1)*(nely+1));
|
|
lyy = (2:2*(nely+1):2*(nelx+1)*(nely+1));
|
|
lxy = ((2*nelx*(nely+1)+2):2:2*(nelx+1)*(nely+1));
|
|
sigma = [sum(R(lxx))/nely;sum(R(lyy))/nelx;sum(R(lxy))/nely];
|
|
|
|
% % test
|
|
% [cx,cy] = meshgrid((0:nelx)/nelx, (0:nely)/nely);
|
|
% for j = 1:3
|
|
% figure;
|
|
% coorx = reshape(Ue(1:2:end,j),nely+1,nelx+1) + cx;
|
|
% coory = reshape(Ue(2:2:end,j),nely+1,nelx+1) + flipud(cy);
|
|
% scatter(coorx(:),coory(:)); hold on;
|
|
% end
|
|
end
|