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.
42 lines
1.3 KiB
42 lines
1.3 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2021-01-22 17:09:20
|
|
% @LastEditTime: 2021-01-22 17:09:31
|
|
|
|
% init macro U with singal stiffer material ke
|
|
% init micro u for loop=1, when n = 0
|
|
%--------------------------
|
|
function [U, U_cell, Umi_cell] = init_macro_U(nelx, nely, ke, optDesign, vF, lx, microx, bdofs, multi_edofMat, alldofs)
|
|
[iK, jK, edofMat, ~] = forAssemble(nelx, nely);
|
|
sK = repmat(ke(:), nelx*nely, 1);
|
|
K = sparse(iK, jK, sK);
|
|
|
|
[freedofs, ~, fext, ~] = designDomain(optDesign, nelx, nely, vF);
|
|
U0 = zeros(2*(nelx+1)*(nely+1), 1);
|
|
U0(freedofs) = K(freedofs,freedofs)\fext(freedofs);
|
|
|
|
% interpolation to get the macro-U on the borders
|
|
N_b = interpolate_N_4nodes(lx, microx, bdofs);
|
|
|
|
alldofs_mi = 1 : 2*(microx+1)^2;
|
|
N_i = interpolate_N_4nodes(lx, microx, alldofs_mi);
|
|
|
|
U = zeros(alldofs, 1);
|
|
U_cell = cell(nelx*nely, 1);
|
|
Umi_cell = cell(nelx*nely, 1);
|
|
|
|
for ele = 1:nelx*nely
|
|
edof = edofMat(ele, :);
|
|
uc = U0(edof);
|
|
ub = N_b * uc;
|
|
|
|
multi_edof = multi_edofMat(ele, :);
|
|
U(multi_edof) = [uc; ub];
|
|
|
|
ui = N_i * uc;
|
|
Umi_cell{ele} = ui;
|
|
|
|
% U(multi_edof) = 0;
|
|
U_cell{ele} = U(multi_edof);
|
|
end
|
|
end
|