Input mesh does not form a closed volume error; checked that mesh is watertight
16 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Cris LaPierre
2022-5-10
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Geometry and Mesh 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!