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.
64 lines
2.1 KiB
64 lines
2.1 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2021-04-21 15:11:06
|
|
% @LastEditTime: 2021-06-07 11:16:17
|
|
%--------------------------
|
|
% --------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2021-04-21 15:11:06
|
|
% @LastEditTime: 2021-04-21 15:13:45
|
|
%--------------------------
|
|
function plot_deformation_split(deform_nodes, rho, nelx, nely, microx)
|
|
|
|
figure;
|
|
globaly = nely * microx;
|
|
globalx = nelx * microx;
|
|
[~, ~, edofMat_full] = forAssemble(globalx, globaly);
|
|
|
|
for i = 1 : nelx
|
|
for j = 1 : nely
|
|
rho_e = 1-rho{j,i};
|
|
% rho_e(rho_e>0) = rho_e(rho_e>0) + j + (i-1)*nely;
|
|
|
|
% rho_e = global_rho((j-1)*microx+1:j*microx, (i-1)*microx+1:i*microx);
|
|
% global_rho((j-1)*microx+1:j*microx, (i-1)*microx+1:i*microx) = rho_e;
|
|
|
|
plot_ele(i, j, deform_nodes{j,i}, edofMat_full, rho_e, microx, globaly);
|
|
end
|
|
end
|
|
end
|
|
|
|
function plot_ele(i, j, deform_nodes, edofMat, rho, microx, globaly)
|
|
|
|
defn = reshape(deform_nodes', [], 1);
|
|
|
|
nele = microx^2;
|
|
global_cx = zeros(4, nele);
|
|
global_cy = zeros(4, nele);
|
|
global_info = zeros(4, nele);
|
|
|
|
for ii = 1:microx
|
|
for jj = 1:microx
|
|
% which micro element in full domain
|
|
fulli = (i - 1) * microx + ii;
|
|
fullj = (j - 1) * microx + jj;
|
|
global_ele = (fulli - 1) * globaly + fullj;
|
|
global_edof = edofMat(global_ele, :);
|
|
|
|
coor = reshape(defn(global_edof), 2, [])'; % [4,2]
|
|
|
|
% which micro element in this sub
|
|
local_ele = jj + (ii - 1) * microx;
|
|
global_cx(:, local_ele) = coor(:,1);
|
|
global_cy(:, local_ele) = coor(:,2);
|
|
global_info(:, local_ele) = repmat(rho(local_ele), 4, 1);
|
|
end
|
|
end
|
|
|
|
h = fill(global_cx, global_cy, 1-global_info); axis equal;
|
|
set(h, {'LineStyle'}, {'none'}, 'facealpha', 0.6);
|
|
map = [ 0.4, 0.4, 0.4
|
|
0.83, 0.83, 0.83];
|
|
colormap(map); axis off;
|
|
hold on;
|
|
end
|