a 2D version
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.
 
 

57 lines
2.4 KiB

%--------------------------
% @Author: Jingqiao Hu
% @Date: 2021-02-05 16:13:00
% @LastEditTime: 2021-02-23 10:15:37
% fixed_ma: if this macro-ele contains fixed dofs = 1, else 0
% fixed_mi: micro fixeddofs
%--------------------------
function [fixed_mi, fixed_ma] = fixed_micro_dofs(fixeddofs, nelx, nely, microx, ...
edofMat_ma, optDesign, vF)
fixed_ma = fixed_ele(fixeddofs, edofMat_ma); % if contain fixed dofs = 1, else 0
fixed_mi = cell(nelx * nely, 1);
globaly = nely * microx;
globalx = nelx * microx;
[~, fixeddofs_full, ~, ~] = designDomain(optDesign, globalx, globaly, vF);
[~, ~, edofMat_full] = forAssemble(globalx, globaly);
[~, ~, edofMat_mi] = forAssemble(microx, microx);
alldofs_mi = 1 : 2*(microx+1)^2;
for i = 1:nelx
for j = 1:nely
ele = (i-1)*nely + j;
if fixed_ma(ele)
if_fixeddofs = zeros((microx+1)^2, 1);
for ii = 1:microx
for jj = 1:microx
% which micro element in full domain
last_col_full = (i - 1) * microx + ii - 1;
this_col_full = (j - 1) * microx + jj;
global_ele = last_col_full * globaly + this_col_full;
global_edof = edofMat_full(global_ele, :); % [1,8]
% find fixeddofs in this micro-ele ordered in full-scale
[~, imi, ~] = intersect(global_edof, fixeddofs_full);
% which micro element in this macro ele
ele_mi = jj + (ii - 1) * microx;
edof_mi = edofMat_mi(ele_mi, :);
% find fixeddofs in this micro-ele ordered in micro-scale
fixed_edofs_mi = edof_mi(imi);
if_fixeddofs(fixed_edofs_mi, 1) = 1;
end
end
% now we get micro fixeddofs in this macro-ele
% but the fixeddofs is col by col as edofMat_mi
% we should change the order to bezier_order, i.e. [border, inner]
fixed_mi{ele} = alldofs_mi(if_fixeddofs>0);
% fixed_mi{ele} = dofid(fixeddofs_mi);
end
end
end
end