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.
68 lines
2.1 KiB
68 lines
2.1 KiB
%--------------------------
|
|
% @Author: Jingqiao Hu
|
|
% @Date: 2021-11-01 16:00:36
|
|
% @LastEditTime: 2022-01-12 20:51:13
|
|
|
|
% NOTE: the bounding box is [minx, maxx] & [miny, maxy]
|
|
%--------------------------
|
|
function [freedofs, fixeddofs, fext, alldofs] = design_domain_nonregular(nodes, ...
|
|
opt, vF, minx, maxx, miny, maxy)
|
|
|
|
nodes(:,3) = 1 : size(nodes,1);
|
|
|
|
switch opt
|
|
case 'Lshape'
|
|
% fixed: (:, maxy)
|
|
[ix, ~] = find(abs(nodes(:,2)-maxy) < 1e-5);
|
|
fixednid = nodes(ix, 3);
|
|
fixeddofs = [2*fixednid(:), 2*fixednid(:)-1]';
|
|
|
|
% load: (maxx, 0) on y
|
|
[ix, ~] = find(abs(nodes(:, 1)-maxx) < 1e-5);
|
|
nodes1 = nodes(ix, :);
|
|
[iy, ~] = find(abs(nodes1(:, 2)) < 1e-5);
|
|
loadnid = nodes1(iy, 3);
|
|
loaddofs = 2 * loadnid;
|
|
|
|
vF = -vF;
|
|
|
|
case 'cantilever'
|
|
% fixed: (minx, :)
|
|
[ix, ~] = find(abs(nodes(:,1)-minx) < 1e-5);
|
|
fixednid = nodes(ix, 3);
|
|
fixeddofs = [2*fixednid(:), 2*fixednid(:)-1]';
|
|
|
|
% load: (maxx, miny) on y
|
|
[ix, ~] = find(abs(nodes(:, 1)-maxx) < 1e-5);
|
|
nodes1 = nodes(ix, :);
|
|
[iy, ~] = find(abs(nodes1(:, 2)-miny) < 1e-5);
|
|
loadnid = nodes1(iy, 3);
|
|
loaddofs = 2 * loadnid;
|
|
|
|
vF = -vF;
|
|
|
|
case 'michell'
|
|
% fixed: (minx, :)
|
|
[ix, ~] = find(abs(nodes(:,1)-minx) < 1e-5);
|
|
fixednid = nodes(ix, 3);
|
|
fixeddofs = [2*fixednid(:), 2*fixednid(:)-1]';
|
|
|
|
% load: (maxx, (maxy-miny)/2) on y
|
|
[ix, ~] = find(abs(nodes(:, 1)-maxx) < 1e-5);
|
|
nodes1 = nodes(ix, :);
|
|
[iy, ~] = find(abs(nodes1(:, 2)-(maxy-miny)/2) < 1e-5);
|
|
loadnid = nodes1(iy, 3);
|
|
loaddofs = 2 * loadnid;
|
|
|
|
vF = [-vF,vF]*sqrt(2)/2;
|
|
|
|
end
|
|
% figure; scatter(nodes(:,1), nodes(:,2)); hold on;
|
|
% scatter(nodes(fixednid,1), nodes(fixednid,2), 'filled', 'r'); hold on;
|
|
% scatter(nodes(loadnid,1), nodes(loadnid,2), 'filled', 'k');
|
|
|
|
alldofs = size(nodes, 1) * 2;
|
|
fixeddofs = fixeddofs(:);
|
|
freedofs = setdiff(1:alldofs, fixeddofs);
|
|
fext = sparse(loaddofs(:), 1, vF(:), alldofs, 1);
|
|
end
|