function homogenization_before_smooth() resolution=25; h =1.0/resolution; [D0,Ke,Fe] = LocalSMRT(resolution); intB = GaussIntB(h); [eleidx,mesh,VE]=periodicMesh(resolution); nele=size(mesh,1);nnode = size(VE,1); edofMat = zeros(nele,24); edofMat(:,1:3:24) = mesh.*3-2; edofMat(:,2:3:24) = mesh.*3-1; edofMat(:,3:3:24) = mesh.*3; load('ani_fittingALL_pnorm5.mat') term_choose=68; aPhys=a_log{term_choose,2};bPhys=b_log{term_choose,2};cPhys=c_log{term_choose,2}; nz=size(aPhys,1);ny=size(aPhys,2);nx=size(aPhys,3); h=1.0/resolution; x2=h/2:h:1-h/2; y2=h/2:h:1-h/2; z2=h/2:h:1-h/2; [x,y,z]=meshgrid(x2,y2,z2); DH=cell(nx,ny,nz); for ix=1:nx for iy=1:ny for iz=1:nz % VOXEL_ele = voxel((iy-1)*resolution+1:iy*resolution,... % (ix-1)*resolution+1:ix*resolution,... % (iz-1)*resolution+1:iz*resolution); a=aPhys(iz,iy,ix);b=bPhys(iz,iy,ix);c=cPhys(iz,iy,ix); p=cos(2*pi.*(x-1/2))+ a.*cos(2*pi.*(y-1/2))+ b.*cos(2*pi.*(z-1/2))- c; VOXEL_ele = p>=0; u = FEA_homo(resolution,VOXEL_ele,edofMat,Ke,Fe); DH{ix,iy,iz} = Disp2DH(VOXEL_ele,u,edofMat,D0,intB,h); % DH{ix,iy,iz} = max(DH{ix,iy,iz},D0.*1e-6); end end end save DH_beforeSmooth25.mat DH end