getting 'tetgen command failed' error using surf2mesh

305 views
Skip to first unread message

Hang Deng

unread,
Sep 18, 2019, 5:59:00 PM9/18/19
to iso2mes...@googlegroups.com
Hi, 

I am having some issues generating volume mesh from surface mesh. It always complains about 'tetgen command failed'. I found online an open ticket on this topic, but there was no follow-up. I wonder if there is anything that can be done to solve this. 

Here is the problem I am working on and the workflow. 

I need to generate a volume mesh for CFD simulations for a fracture based on processed CT images (so binary). 

I did preprocessing to fill the holes. I generated surface mesh using 'cgalmesh' method and tested a range of opt values. I also ran meshcheckrepair with 'meshfix' to remove any intersected surfaces. 
Then, I call surf2mesh for volume mesh generation. I tried different parameters, it  always fails. 

I used the same workflow for similar purpose a couple of years back, so not sure what I am missing here. It is a very complex geometry, I wonder whether that requires different methods or workflow. 

Any suggestion is greatly appreciated!

Many thanks,
Best,
hang

Qianqian Fang

unread,
Sep 18, 2019, 10:19:03 PM9/18/19
to iso2mes...@googlegroups.com

Hi Hang

 

For TetGen to work, the input mesh must be well-posted  - i.e.  it must be water-tight with no self-intersecting elements or  degenerated elements.

 

If your mesh was created other tools or processed by merging multiple surfaces, you have to check/repair to ensure the input mesh is valid. Unfortunately, invalid surface is very easy to generate, for example, smoothing, downsampling, Boolean operations, all these steps are prune to self-intersecting cases.

 

If the input surface is a simple closed surface, calling meshcheckrepair(…, ‘meshfix’) can fix these defect in most cases, but it does not work if the surface contains multiple closed-compartments.

 

There is no robust way, as far as I know, to repair a complex polyhedral surface to avoid self intersections. One thing that we do know is that v2s output using cgalsurf and cgalmesh are guaranteed to be well-conditioned, but surfaces often have a non-smooth boundary or do not contain sharp features (in newer CGAL libraries, one can force sharp features by manually inserting 1D feature lines, but this function has not been added to iso2mesh – such feature line is also hard to define in many datasets).

 

Qianqian

--
You received this message because you are subscribed to the Google Groups "iso2mesh-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to iso2mesh-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/iso2mesh-users/CAGcvOTUxPUetQ5G9AOGkSLHN4xu%3D%2BBEkxPfFCv8r3ktfqVZh%3DA%40mail.gmail.com.

 

Hang Deng

unread,
Sep 19, 2019, 1:29:44 AM9/19/19
to iso2mes...@googlegroups.com
Hi Qianqian,

Thank you so much for the information. This is very helpful. 

I did use meshcheckrepair before generating the volume mesh. I will check whether I have multiple closed-compartments, and also try to minimize the steps such as smoothing. 

Thanks,
Best,
hang

Hang Deng

unread,
Sep 26, 2019, 1:40:37 PM9/26/19
to iso2mes...@googlegroups.com
Hi Qianqian,

I've been playing with different parameter combinations in iso2mesh to generate the volume mesh, and had a couple of questions:

(1) seems that remeshsurf and meshcheckrepair both can be used to remove self-intersecting faces. What are the differences? I am asking because I noticed that for the same surf mesh, meshcheckrepair works but remeshsurf does not. 
(2) in surf2mesh, I added a fourth column in the node matrix, to better control the mesh density. However, for a range of values I tested, I got the tetgen error as before, but if I do not include the fourth column, it generates the volume mesh successfully. I didn't find other setting requirement in the examples, am I missing something? Or is there any guideline as to the surface node size in the fourth column? 

Many thanks,
Best,
Hang

Qianqian Fang

unread,
Sep 26, 2019, 3:53:37 PM9/26/19
to iso2mes...@googlegroups.com, Hang Deng
On 9/26/19 1:40 PM, Hang Deng wrote:
Hi Qianqian,

I've been playing with different parameter combinations in iso2mesh to generate the volume mesh, and had a couple of questions:

(1) seems that remeshsurf and meshcheckrepair both can be used to remove self-intersecting faces. What are the differences? I am asking because I noticed that for the same surf mesh, meshcheckrepair works but remeshsurf does not.


both functions can convert a ill-posed surface into a well-posed surface, but based on different workflows.

the remeshsurf function first rasterizes a surface into a voxelated image (a binary mask), and then re-extract the external surface using cgal's surface extraction tool.

the meshcheckrepair('meshfix') calls meshfix, a utility written by Marco Attene to repair a simple closed surface

   M. Attene. A lightweight approach to repairing digitized polygon meshes.
   The Visual Computer, 2010. (c) Springer. DOI: 10.1007/s00371-010-0416-3

https://github.com/MarcoAttene/MeshFix-V2.1

the remeshsurf approach is more robust, but the output mesh have two minor issues: 1) sharp features, if any, will disappear due to the CGAL surface extraction algorithm, and 2) the output mesh are completely different discretization and won't share nodes/elements with the original input;

the 2nd approach, meshfix, does not have the above problems, but is often more sensitive to input surface's quality - if the input surface contains multiple compartments or open-edges, it can give an invalid output.


(2) in surf2mesh, I added a fourth column in the node matrix, to better control the mesh density. However, for a range of values I tested, I got the tetgen error as before, but if I do not include the fourth column, it generates the volume mesh successfully. I didn't find other setting requirement in the examples, am I missing something? Or is there any guideline as to the surface node size in the fourth column?


again, this sounds like a tetgen issue. if it was not successful, tetgen must print an error, you may want to send the input as well as the error message to Dr. Hang Si, the author of tetgen for further debugging.


Qianqian


Reply all
Reply to author
Forward
0 new messages