Create Hole in Multigeometry (Matlab PDE)
古いコメントを表示
I'm currently having trouble creating a certain geometry that consists of two rectangular prisms stacked on top of each other, and one of the rectangular prisms has a hole.
What I've curently done is separately create two rectangular prisms: one with a unit circle hole in it, and then another regular prism (with equal dimensions) but no hole. However, I have absolutely no idea how to concatenate these two geometries so that they are stacked on top of one another (with the rectangular prism with the hole on the bottom).
If anyone can offer any advice on how to do this I'd greatly appreciate it!
Here's my current code. When I run it, I get an error "The input mesh is invalid. Neighboring elements in the mesh are not properly connected":
%Create 2D Mesh
[xg,yg] = meshgrid(-3:0.25:3);
xg = xg(:);
yg = yg(:);
%Upper object
[xg1,yg1] = meshgrid(-3:0.25:3);
xg1 = xg1(:);
yg1 = yg1(:);
%Cut a unit disk hole in the mesh grid
t = (pi/24:pi/24:2*pi)';
x = cos(t);
y = sin(t);
circShp = alphaShape(x,y,2);
in = inShape(circShp,xg,yg);
xg = [xg(~in); cos(t)];
yg = [yg(~in); sin(t)];
%Create 3D copies with z-coord ranging from 0 through 1. Combine through
%alphaShape
zg = ones(numel(xg),1);
xg = repmat(xg,5,1);
yg = repmat(yg,5,1);
zg = zg*(0:.25:1);
zg = zg(:);
shp = alphaShape(xg,yg,zg);
[lowerElements,lowerNodes] = boundaryFacets(shp);
lowerElements = lowerElements +6;
zg1 = ones(numel(xg1),1);
xg1 = repmat(xg1,5,1);
yg1 = repmat(yg1,5,1);
zg1 = zg1*(0:.25:1);
zg1 = zg1(:);
shp1 = alphaShape(xg1,yg1,zg1);
[upperElements,upperNodes] = boundaryFacets(shp1);
upperElements = upperElements';
upperNodes = upperNodes';
lowerElements = lowerElements';
lowerNodes = lowerNodes';
elements = [upperElements lowerElements];
nodes = [upperNodes lowerNodes];
%Create PDE
model = createpde('structural', 'static-solid');
geometryFromMesh(model,nodes,elements);
pdegplot(model,'FaceLabels','on','FaceAlpha',0.5)
bracketThickness = 1e-2;
generateMesh(model);
回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Structural Mechanics についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!