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.
51 lines
1.6 KiB
51 lines
1.6 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2020-10-29 15:04:15
|
|
% @LastEditors: Please set LastEditors
|
|
% @LastEditTime: 2020-12-11 16:57:35
|
|
% @FilePath: \CMCM-two mat\utility-func\shape_gradient_global.m
|
|
%--------------------------
|
|
% gradN on all micro eles in one macro-ele
|
|
% for every gp & micro-ele:
|
|
% global_gradN = 4 * ndofs
|
|
% global_gradN2 = 3 * ndofs
|
|
% N_dofs = 2 * ndofs (2*8)
|
|
% N_nodes = 1 * 4
|
|
function [global_gradN, global_gradN2, N_dofs, N_nodes] = shape_gradient_global(gradN, gradN2, microx, edofMat, dofid, N)
|
|
|
|
global_gradN = cell(4, microx^2);
|
|
global_gradN2 = cell(4, microx^2);
|
|
N_dofs = cell(4, microx^2);
|
|
N_nodes = zeros(4, microx^2, 4);
|
|
|
|
for gp = 1:4
|
|
B1 = gradN{gp}; % 4*8;
|
|
B2 = gradN2{gp}; % 3*8;
|
|
Ne = N{gp}; % 2*4
|
|
% Nhe = Ne(1, 1:2:end); % 1*4
|
|
|
|
for ele = 1:microx^2
|
|
edof = edofMat(ele, :);
|
|
new_edof = dofid(edof); % change order of [u, h']
|
|
|
|
% gradN = 4*8
|
|
gradN_gpe = sparse(4, 2*(microx+1)^2);
|
|
gradN_gpe(:, new_edof) = B1;
|
|
global_gradN{gp, ele} = gradN_gpe;
|
|
|
|
% 3*8
|
|
% gradN_gpe = zeros(3, 2*(microx+1)^2);
|
|
% gradN_gpe(:, new_edof) = B2;
|
|
% global_gradN2{gp, ele} = gradN_gpe;
|
|
|
|
% N = 2*8
|
|
N_gpe = zeros(2, 2*(microx+1)^2);
|
|
N_gpe(:, new_edof) = Ne;
|
|
N_dofs{gp, ele} = N_gpe;
|
|
|
|
% % Nh = 1*4
|
|
% % node_id = edof(2:2:end)/2;
|
|
% N_nodes(gp, ele, :) = Nhe;
|
|
end
|
|
end
|
|
end
|