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.
40 lines
1.0 KiB
40 lines
1.0 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2021-11-26 18:33:42
|
|
% @LastEditTime: 2022-05-06 20:12:23
|
|
%--------------------------
|
|
function [c_psi, c_proj] = preparation_cvt(e1, e0, penal, c_phi, c_dofid, ...
|
|
c_rho, c_tet, c_sK)
|
|
|
|
ncvt = size(c_rho, 1);
|
|
|
|
c_psi = cell(ncvt, 1);
|
|
c_proj = cell(ncvt, 1);
|
|
|
|
parfor ele = 1 : ncvt
|
|
|
|
tets = c_tet{ele};
|
|
nele = size(tets, 1);
|
|
[iK, jK, edofMat] = forAssemble_tetmesh(tets);
|
|
order1 = reshape(edofMat', [], 1);
|
|
|
|
rho = c_rho{ele}(:);
|
|
phi = c_phi{ele};
|
|
sK0 = c_sK{ele};
|
|
dofid = c_dofid{ele};
|
|
|
|
nbdofs = size(phi, 1);
|
|
|
|
k = assemble_micro_k_hetero(dofid, rho, e0, e1, penal, sK0, iK, jK);
|
|
Me = build_M_simply(nbdofs, k, phi);
|
|
|
|
Re = [phi; Me]; % [3n, 3v]
|
|
R1 = Re(dofid(order1), :); % [12m, 3v]
|
|
R2 = reshape(R1, 12, nele, []); % [12, m, 3v]
|
|
R3 = permute(R2, [1,3,2]); % [12, 3v, m]
|
|
|
|
c_psi{ele} = R3;
|
|
c_proj{ele} = Re;
|
|
end
|
|
|
|
end
|