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!