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.
44 lines
1.2 KiB
44 lines
1.2 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2020-10-29 15:04:15
|
|
% @LastEditTime: 2021-03-13 16:28:28
|
|
%--------------------------
|
|
|
|
% obj and sensitivies
|
|
function [Q, dQ] = homogenization(KE0, KE1, edofMat, U, lx, ly, Emin, E0, xPhys)
|
|
% function [Q,dQ] = homogenization(KE, edofMat, U, lx, ly, Emin, E0, xPhys)
|
|
qe = cell(3, 3);
|
|
Q = zeros(3, 3);
|
|
dQ = cell(3, 3);
|
|
|
|
[nely, nelx] = size(xPhys);
|
|
|
|
for i = 1:3
|
|
|
|
for j = 1:3
|
|
U1 = U(:, i);
|
|
U2 = U(:, j);
|
|
|
|
for ii = 1:nelx
|
|
for jj = 1:nely
|
|
ele = jj + (ii-1)*nely;
|
|
if xPhys(jj,ii)==1
|
|
KE = KE1;
|
|
else
|
|
KE = KE0;
|
|
end
|
|
end
|
|
end
|
|
|
|
% these three are all col vec
|
|
qe{i, j} = sum((U1(edofMat) * KE) .* U2(edofMat), 2) / (lx * ly);
|
|
Q(i, j) = sum(qe{i, j});
|
|
|
|
% qe{i, j} = sum((U1(edofMat) * KE) .* U2(edofMat), 2) / (lx * ly);
|
|
% Q(i, j) = sum((Emin + xPhys(:) * (E0 - Emin)) .* qe{i, j});
|
|
|
|
% dQ{i, j} = penal * (E0 - Emin) * xPhys.^(penal - 1) .* qe{i, j};
|
|
end
|
|
|
|
end
|
|
end
|