CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: snappyHexMesh and Others (
-   -   External mesh crawls into car model. Holes in STL model? (

MadsR April 6, 2010 09:33

External mesh crawls into car model. Holes in STL model?

I have a geometry of a car in STL and I have generated a blockMesh around it with cell-aspect ratio of unity. I can generate a snappyHexMesh without problems, except for the following:

I can only surface-refine up to around level (2 2). If I go to higher refinement ratios (say level (5 5)), the mesh crawls into my geometry and fills the inside of the car as well as the outside.
I am not entirely sure that my STL file is completely watertight but I can't SEE any holes so if they are there, they must be VERY small. The STL is quite coarse though.

I am going to make a small program which checks my STL for holes but before that I was wondering if you guys had any hints on this.

Thanks in advance, it would be a GREAT help.

ps. I already read the STL into meshLab and "closed holes" without any more luck
pps. I've made a test-cube out of 12 simple STL surfaces and that one I can surface-refine to "infinity".

wyldckat April 6, 2010 13:29

Hi Mads,

My experience with snappyHexMesh is still a bit limited, but there are two other reasons that come to mind that could influence the mesh leaking inside:
  • there should be a tolerance setting for point/line proximity in snappyHexMeshDict, which will aid sHM to assume if two or more points are actually the same. Sadly, I don't know what is the name of the variable :(
  • there might be a strict alignment between the base mesh and some edges in the solid. Try rotating the STL a few (3-5) degrees and/or changing the base mesh limits and number of divisions.
The latter is a guess based on the comment that the user manual has on how to define the point that indicated which part should be meshed, internal or external... which has to be strictly inside a cell of the mesh, even after various levels of refining! Uhm... this could also be it... the point you're using for defining the exterior falls on an edge of the mesh, but I think sHM would complain about that!

Best regards,

vinz April 7, 2010 02:16

Hi mads,

I would say that there must be a hole somewhere. It is sometime difficult to find, but there must be one. The last time I had a similar problem I used the program AdMesh which is free. With the option --fill-holes, it worked for me and gave me a watertight surface. You can give it a try.



MadsR April 7, 2010 03:45

Hi Vincent.

Seems like a good tool, thanks for the info!


louisgag May 12, 2010 13:30

Thanks Vincent,

Admesh solved that "hole" problem and provided me with the translate option which I had been looking for all weekend!


peterwy May 27, 2010 10:04


only two small points that I want to add:
1.) with transformPoints you've a lot of functions in OF directly as well
2.) find a hole is quite easy as you define two points (one inside the domain that should be meshed, and one outside) and just write a small program that finds a way to connect those two points. (For very nice programming with only medium skills in c++ you should plan 1-2 days for it) Perhaps I will put my program online some day but at the moment I can't because of company restrictions.

Best Regards,

lovecraft22 October 22, 2013 05:34

Hi Peter,
Would you mind sharing some details on what your script does roughly? What's the concept at the bottom of it to try and connect the two points?


wyldckat October 26, 2013 05:07

Greetings to all!

@lovecraft22: If I'm not mistaken, as of OpenFOAM 2.0.0, there is a utility in OpenFOAM named surfaceClean which can help close holes, as well as fixing some other issues in STL files.

Best regards,

lovecraft22 October 26, 2013 10:21

Thanks Bruno. I'm not using OpenFoam at the moment. I found such a function in ANSA 14.x but I was interested in making such a script by myself anyway.

All times are GMT -4. The time now is 01:29.