Input mesh does not form a closed volume error; checked that mesh is watertight
13 views (last 30 days)
Show older comments
I encountered the following error message while using geometryFromMesh
"Error using checkMeshWatertight; Input mesh does not form a closed volume. Likely, there are missing faces or gaps in the input."
Below is the code, example input parameters are attached:
% gengerate mesh
load('input.mat')
tnodes = [P(:, 1)'; P(:, 2)'; P(:, 3)'];
telements = T';
model = createpde;
geometryFromMesh(model,tnodes,telements); % this line is where error is produced
mesh = generateMesh(model,'Hmin', 300 , 'Hmax', 310 ,'GeometricOrder','linear');
Background: my goal is to make a 3D surface triangular mesh automatically from spherical harmonics. The reason I'm using geometryFromMesh is that, I would 1. sample the spherical harmonics analytical expression using a regular grid in spherical coordinates; 2. use surf2patch to roughly convert this into a triangular mesh; 3. use my own algorithm to mend any holes on the mesh 4. convert this mesh to geometry object, and create a more uniform-sized mesh using "generateMesh". It is a convoluted process, but one seemed necessary given that I want the meshing process to be done in Matlab for any spherical harmonics.
For the attached example, I have checked that the mesh is watertight using Find-holes-in-triangular-mesh, but did not find any hole. If you could point me to what produced the error, or suggest more elegant workflow than what I described above, I would really appreciate it.
0 Comments
Answers (1)
Cris LaPierre
on 10 May 2022
I wouldn't say I can suggest a more elegant workflow, but here is one that I have found to work in the past. It involves using stlwrite to export the mesh, and then importgeometry to create the geometry.
% gengerate mesh
load('input.mat')
TR = triangulation(T,P);
stlwrite(TR,'Geom.stl')
% create geometry
model = createpde;
gm = importGeometry(model,'Geom.stl')
pdegplot(gm)
2 Comments
See Also
Categories
Find more on Geometry and Mesh in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!