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.
34 lines
1.1 KiB
34 lines
1.1 KiB
4 years ago
|
% periodic boundary conditions
|
||
|
function [wfixed,ufixed,d1,d2,d3,d4,testNum] = microPBC(nelx,nely,lx,ly)
|
||
|
|
||
|
nodenrs = reshape(1:(1 + nelx) * (1 + nely), 1 + nely, 1 + nelx);
|
||
|
|
||
|
e0 = eye(3);
|
||
|
ufixed = zeros(8, 3);
|
||
|
|
||
|
alldofs = 1:2 * (nely + 1) * (nelx + 1);
|
||
|
|
||
|
% four corner points
|
||
|
n1 = [nodenrs(end, [1, end]), nodenrs(1, [end, 1])];
|
||
|
d1 = reshape([2 * n1 - 1; 2 * n1], 1, 8);
|
||
|
|
||
|
% left+bottom boundaries
|
||
|
n3 = [nodenrs(2:end - 1, 1)', nodenrs(end, 2:end - 1)];
|
||
|
d3 = reshape([2 * n3 - 1; 2 * n3], 1, 2 * (nelx + nely - 2));
|
||
|
|
||
|
% right+up boundaries
|
||
|
n4 = [nodenrs(2:end - 1, end)', nodenrs(1, 2:end - 1)];
|
||
|
d4 = reshape([2 * n4 - 1; 2 * n4], 1, 2 * (nelx + nely - 2));
|
||
|
|
||
|
d2 = setdiff(alldofs, [d1, d4, d3]);
|
||
|
|
||
|
for j = 1:3
|
||
|
ufixed(3:4, j) = [e0(1, j), e0(3, j) / 2; e0(3, j) / 2, e0(2, j)] * [lx; 0]; % set lx=ly=1
|
||
|
ufixed(7:8, j) = [e0(1, j), e0(3, j) / 2; e0(3, j) / 2, e0(2, j)] * [0; ly]; % down->up,-nely
|
||
|
ufixed(5:6, j) = ufixed(7:8, j) + ufixed(3:4, j);
|
||
|
end
|
||
|
|
||
|
wfixed = [repmat(ufixed(3:4, :), nely - 1, 1); repmat(ufixed(7:8, :), nelx - 1, 1)];
|
||
|
|
||
|
testNum = 3;
|
||
|
end
|