Mesh the Inside of a 3D Patch

4 次查看(过去 30 天)
Paul Safier
Paul Safier 2020-3-26
I am trying to solve a PDE via the PDE Toolbox and am having trouble building the mesh/geometry. I have built the volume via the patch function (see image). Here's how I made it:
fac = [1 2 6 5;2 6 7 3;1 2 3 4;1 5 8 4;5 6 7 8;9 4 8 12;9 12 11 10;10 13 14 11;3 7 14 13;9 3 13 10;12 7 14 11];
vert = [0 0 0;1 0 0;1 0 1; 0 0 1; 0 1 0; 1 1 0; 1 1 1; 0 1 1;-1 0 1; -1 0 3; -1 1 3;-1 1 1; 1 0 3; 1 1 3];
patch('Vertices',vert,'Faces',fac,...
'FaceVertexCData',hsv(size(fac,1)),'FaceColor','flat')
view(3)
axis vis3d
I need to find a way to make this a geometry that I can mesh and then solve a PDE within. I have tried writing this as an STL file with the command:
stlwrite('test.stl',fac,vert)
which throws an error instructing me to use the command triangulateFaces first, as:
[fac, inds] = triangulateFaces(fac);
Then, the call to stlwrite works. However, when I load the geometry with the command importGeometry I get the following error:
model = createpde();
importGeometry(model,'test.stl');
Error using pde.DiscreteGeometry
Failed to create geometry, the input does not form a closed volume.
This may be due to missing faces or gaps in the input.
Error in pde.EquationModel/importGeometry (line 60)
gm = pde.DiscreteGeometry(geofilename);
Can anyone offer any suggestions?
Thanks!

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Geometry and Mesh 的更多信息

产品


版本

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by