%-------------------------- % @Author: Jingqiao Hu % @Date: 2021-02-28 15:48:13 % @LastEditTime: 2021-02-28 15:48:59 %-------------------------- % assemble micro global stiffness, % NOTE: the order must be the same as dofid, i.e. [ub; uf; ui;] function K = micro_assembleK(dofid, material, ke0, ke1, iK, jK) microx = size(material, 1); sK = zeros(24^2, microx^3); for i = 1 : microx^3 if material(i)==1 sK(:, i) = ke1(:); else sK(:, i) = ke0(:); end end new_iK = dofid(iK); new_jK = dofid(jK); % sK = reshape(ke(:) * (emin + material(:)' * (e0 - emin)), 64*microx^2, 1); K = sparse(new_iK, new_jK, sK(:)); K = (K + K') / 2; end