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.4 KiB
42 lines
1.4 KiB
3 years ago
|
% 1. get U of coarse-eles in this sub
|
||
|
% 2. rearange U as the order of scaled_fixeddofs
|
||
|
function ufixed = prepareU_scaled(edofMat_macro, U, sub_nelx, sub_nely, subx, suby, scalar)
|
||
|
|
||
|
coarsex = subx/scalar;
|
||
|
coarsey = suby/scalar;
|
||
|
nely = sub_nely*scalar;
|
||
|
ufixed = cell(sub_nely, sub_nelx);
|
||
|
|
||
|
for subi = 1 : sub_nelx
|
||
|
for subj = 1 : sub_nely
|
||
|
|
||
|
us = zeros(2*(subx+1)*(suby+1), 1);
|
||
|
|
||
|
for is = 1:scalar
|
||
|
for js = 1:scalar
|
||
|
% which coarse element in the whole domain
|
||
|
jc = (subj-1)*scalar+js;
|
||
|
ic = (subi-1)*scalar+is;
|
||
|
ele = jc+(ic-1)*nely;
|
||
|
|
||
|
edof = edofMat_macro(ele,:);
|
||
|
ue = U(edof,:);
|
||
|
|
||
|
% compute dofs of ue in this sub
|
||
|
last_col = (is-1)*coarsex;
|
||
|
this_col = (js-1)*coarsey + 1;
|
||
|
|
||
|
node4 = last_col*(suby+1) + this_col;
|
||
|
node1 = node4 + coarsey;
|
||
|
node3 = is*coarsex*(suby+1) + this_col;
|
||
|
node2 = node3 + coarsey;
|
||
|
|
||
|
dofs = [2*node1-1, 2*node1, 2*node2-1, 2*node2, ...
|
||
|
2*node3-1, 2*node3, 2*node4-1, 2*node4];
|
||
|
us(dofs,1) = ue;
|
||
|
end
|
||
|
end
|
||
|
ufixed{subj, subi} = us;
|
||
|
end
|
||
|
end
|
||
|
end
|