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
2.0 KiB

3 years ago
%--------------------------
% @Author: Jingqiao Hu
% @Date: 2021-04-16 21:35:35
% @LastEditTime: 2021-04-18 15:30:58
%--------------------------
function plot_deformation_overlap(def_cell, microx, nelx, nely, lx, global_rho)
[~, ~, edofMat_mi, ~] = forAssemble(microx, microx);
% [~,~, cdofs, ~,~,~,~] = microPBC(microx, microx,lx, lx);
% idofs = setdiff(1:2*(microx+1)^2, cdofs);
% dx = lx / microx;
% jac = dx^2/4;
% globalx = microx * nelx;
globaly = nely * microx;
% [~, ~, edofMat_full, ~] = forAssemble(globalx, globaly);
% [ref_full, ~, ~, ~] = GenerateMesh(nelx*lx, nely*lx, globalx, globaly);
% ref0 = reshape(ref_full', [], 1);
figure;
for i = 1:nelx
for j = 1:nely
umicro = reshape(def_cell{j,i}', [], 1);
def_cx = zeros(4, microx^2);
def_cy = zeros(4, microx^2);
info_local = zeros(4, microx^2);
for ii = 1:microx
for jj = 1:microx
% which micro-ele in this subdomain
micro_ele_local = jj + (ii-1)*microx;
edof_mi = edofMat_mi(micro_ele_local, :);
ue = umicro(edof_mi,:); % [8,9]
% which micro element in whole domain
last_col_full = (i-1)*microx + ii-1;
this_col_full = (j-1)*microx + jj;
micro_ele_full = last_col_full * globaly + this_col_full;
% edof_full = edofMat_full(micro_ele_full,:);
def_coor = ue;
def_cx(:, micro_ele_local) = def_coor(1:2:end);
def_cy(:, micro_ele_local) = def_coor(2:2:end);
info_local(:, micro_ele_local) = repmat(global_rho(micro_ele_full), 4, 1);
end
end
h = fill(def_cx, def_cy, 1-info_local); axis equal; hold on;
set(h, {'LineStyle'}, {'none'});
set(h, 'facealpha', 0.6);
end
end
end