%-------------------------- % @Author: Jingqiao Hu % @Date: 2021-06-16 15:55:30 % @LastEditTime: 2021-08-05 21:15:22 % plot on one coarse-ele, over different nodes %-------------------------- function plot_NH(cx, cy, lx, microx, nelx, nely, addNum, NH) dx = lx / microx; [gridx, gridy] = meshgrid(0:2*dx:2*lx, 0:2*dx:2*lx); gridy = flipud(gridy); for e = 1:1 NHe = NH{e,1}; % [(microx+1)^2, 2, 2, nnodes] for node = 1:4 % for i = 1:2 % for j = 1:2 figure; NHi = NHe(:,:,:,node); cv = reshape(NHi(:,2,2), microx+1, microx+1); s = surf(gridx, gridy, cv); colormap(jet); caxis([0,1]); s.FaceColor = 'w'; s.EdgeColor = [0.2,0.2,0.2]; hold on; grid off; axis equal; axis off; set(gca,'FontSize',14,'FontWeight','bold'); % end % end end end end % if vx / vy < 0, means taking all indices function nodes2 = project_force(vx, vz, nodes) nodes(:,3) = 1:size(nodes,1); if vx > -1e-3 % valid v = min(abs(nodes(:,1) - vx)); [ix, ~] = find(abs(nodes(:,1)-v-vx) < 1e-3); nodes1 = nodes(ix, :); else nodes1 = nodes; end if vz > -1e-3 % valid v = min(abs(nodes1(:,2) - vz)); [iz, ~] = find(abs(nodes1(:,2)-v-vz) < 1e-3); nodes2 = nodes1(iz, 3); else nodes2 = nodes1(:,3); end end