CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Bugs (
-   -   SnappyHexMesh plane surface bounding box (

podallaire August 8, 2008 10:06

Good morning, using snappyH
Good morning,

using snappyHexMesh, I was able to mesh compilcated surfaces - great tool !

I just found out that if one of the stl files is a perfect plane surface that sits on one of the 3 orthogonal planes (X-Y, Y-Z, or X-Z), the bounding box detector creates an error. Here is an example :

Determining initial surface intersections

Edge intersection testing:
Number of edges : 725100
Number of edges to retest : 725100
sh: gaddr2line: command not found
sh: gaddr2line: command not found
sh: gaddr2line: command not found
sh: gaddr2line: command not found
sh: gaddr2line: command not found
sh: gaddr2line: command not found
sh: gaddr2line: command not found
sh: gaddr2line: command not found
sh: gaddr2line: command not found
sh: gaddr2line: command not found
sh: gaddr2line: command not found

Badly formed bounding box -11.25 1.99967) (0.500362 -11.25 3.00077)#0 Foam::error::printStack(Foam: addr2line failed
#1 Foam::error::abort() addr2line failed
#2 Foam::indexedOctree<foam::treedatatrisurface>::div ide(Foam::treeBoundBox const&, Foam::DynamicList<foam::list<int>, 0u, 2u, 1u>&, int) const addr2line failed
#3 Foam::indexedOctree<foam::treedatatrisurface>::ind exedOctree(Foam::treeDataTriSu rface const&, Foam::treeBoundBox const&, int, double, double) addr2line failed



mattijs August 11, 2008 05:22

Hi Pierre-Olivier, the (axi
Hi Pierre-Olivier,

the (axis-aligned) octree used for doing geometric tests on surfaces does not like 2D axis-aligned geometries (planes, lines, points). You could try perturbing your surface or rotate the whole lot. Anything that causes the bounding box to be non 2d-axis-aligned should work.

podallaire August 11, 2008 22:43

Yes, it worked - thanks !
Yes, it worked - thanks !

waterboy November 12, 2008 07:38

Hi, I was able to use snappyH
I was able to use snappyHexmesh on geometries I created myself with SALOME. When trying another STL file, created with some unknown program it fails with a segmentation fault. Blender refuses to open it,but Paraview can read it alright. Are there any known STL format issues? Recommendations how to check/repair such a STL file?
Thanks for any advice,

norman1981 November 12, 2008 08:29

Hi, you can have a look at

you can have a look at this very useful tutorial: exmesh

I know that it is written in Italian but you can figure out how to use these things reading the reported "command box"!

In any case Blender should open your file so I think that something wrong is present there...

Have a nice day!


mattijs November 12, 2008 10:38

Is the STL binary? Binary STL
Is the STL binary? Binary STL is not very well defined. If it is Ascii snappedHexMesh should not fail. What kind of error do you get? Can you run e.g. surfaceCheck on the surface?

waterboy November 17, 2008 18:30

Great Thanks Norman and Mattij
Great Thanks Norman and Mattijs,
In prefer spanish but will see how far I get with italian:-) The STL is ASCII... Will see for any error message tomorow and check that surfaceCheck. Sorry for being so slow but as a student I only work part time on FOAM...
Have a nice day/night:-)

waterboy November 18, 2008 08:35

Hi, Back to work I tried agai
Back to work I tried again and yes, the STL was bad. After processing it with admesh surfaceCheck tells me

Dumping bad quality faces to "badFaces"
Paste this into the input for surfaceSubset

min 0.000141144 for edge 113249 points (53.4499 9.918 2.5517e-06)(53.4499 9.91786 2.40737e-06)
max 160.585 for edge 124347 points (149.285 0 16.5)(-11.2999 0.0101797 16.5)

Checking for points less than 1E-6 of bounding box ((162.57 27.5 16.5) meter) apart.
Found 0 nearby points.

Surface is closed. All edges connected to two faces.

Number of unconnected parts : 1

Number of zones (connected area with consistent normal) : 333194
More than one normal orientation.

Checking self-intersection.
Surface is not self-intersecting


Seems OK to me. With blockMesh I tried to put a box around and the locationinMesh point inside, quite similar to the racing car example. snappyHexmesh now segfaults:-(

Create time

Create mesh for time = 0

Read mesh in = 1.58 s
Reading refinement surfaces.
Read refinement surfaces in = 3.24 s

Reading refinement shells.
#0 Foam::error::printStack(Foam: in "/home/pasch/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#1 Foam::sigSegv::sigSegvHandler(int) in "/home/pasch/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#2 Uninterpreted: [0xffffe420]
#3 Foam::triSurfaceMesh::isSurfaceClosed() const in "/home/pasch/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#4 Foam::triSurfaceMesh::hasVolumeType() const in "/home/pasch/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#5 Foam::shellSurfaces::setAndCheckLevels(double, Foam::List<foam::tuple2<double,> > const&) in "/home/pasch/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#6 Foam::shellSurfaces::shellSurfaces(Foam::searchabl eSurfaces const&, Foam::dictionary const&) in "/home/pasch/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#7 main in "/home/pasch/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/snappyHexMesh"
#8 __libc_start_main in "/lib/tls/"
#9 Foam::regIOobject::writeObject(Foam::IOstream::str eamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType) const in "/home/pasch/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/snappyHexMesh"
Segmentation fault

Any clue?
Thanks in advance,

waterboy November 18, 2008 10:40

Thanks a lot, its running....
Thanks a lot, its running....

erik023 November 19, 2008 04:11

Dear SnappyHex Users, i have
Dear SnappyHex Users,
i have a bit of trouble getting nice results when using interfoam in combination with snappy. I try to simulate a sphere with water flowing around it. what i see is that, when looking at the gamma 0.5 isosurface i have an area that looks very bumpy, like the region was made up from triangles (some polygons in 3d i guess) and that the isosurface is following them. i have been given the indication that this might just be a fault in paraview (and ensight) but could there also be another explination. i cant find anywhere how to turn of the spliting of hexcells by drawing a diagonal through them as is done in snappy. is there a way around this, or do i simply need to make a finer mesh? finer background mesh?


mattijs November 19, 2008 06:07

foamToVTK/paraFoam/foamToEnsight all will decompose any cell which is not a pure hex into pyramids and tetrahedra and this can lead to low quality isosurfaces.

(a pure hex is a cell with 6 quad faces. Even a single edge being split will cause the cell to become a polyhedron and be decomposed)

- make sure your iso surface does not go through any refinement region.
- map the solution onto a pure hex mesh.
- write a small utility to do double averaging - cell to point and then point to cell. This will produce very smooth isosurfaces but will lose precision so is a cheat.

erik023 November 19, 2008 08:28

Ah, many thanks to Niklas Wiks
Ah, many thanks to Niklas Wikström who gave me pretty much the same explication.

Mattijs - I like the idea of mapping the solution, it there a utility to do this or would I write it myself?
I need not to Worry then about the quality of the solution if I understand it right, just the graphical output!?

thank you both!

waterboy November 25, 2008 04:53

Hi, I noticed that snappyHexm
I noticed that snappyHexmesh fails with a segmentation fault if the refinement level of a region is higher than the one specified at the surface. Although I can't imagine why anyone might want to do this , a clear message may be helpful to users and should be very easy to implement. Or is this supposed to work?

waterboy November 25, 2008 05:13

Sorry, I posted false informat
Sorry, I posted false information above.
My case fails with a floating point exception if the refinement level is higher than 5 in either the region or the surface... I don't really need such a high resolution but it shouldn't fail just like that, I believe.

mattijs November 25, 2008 08:01

No it shouldn't fail with norm
No it shouldn't fail with normal input. Do you have a testcase? You can send it to me directly (domain, user m.janssens)

mattijs November 25, 2008 08:07

I assume you are using 1.5.x ?
I assume you are using 1.5.x ? It has got various fixes in snappyHexMesh.

waterboy November 25, 2008 10:33

Hi Mattijs, Yes, I am using v
Hi Mattijs,
Yes, I am using version 1.5.
I need to ask wether I am allowed to share the geometry.
If not I will try to reproduce the error with another case and send You the setup. Right now it is running with a refinement level of 5 in the refinement region and seems fine.
Thanks a lot,

waterboy November 25, 2008 12:53

Hi again, Someone smart told
Hi again,
Someone smart told me snappyHexmesh might fail due to old data from previous runs. Is that true? I have been cleaning my case before every new calculation since then and my problems seem to be gone.. Can anyone verify? Is it the existing timesteps?...

mattijs November 25, 2008 14:57

Yes that can be the case. It r
Yes that can be the case. It reads a starting mesh to start refining from. Usually this comes from constant/polyMesh but it can also come from a time directory. The starting mesh consists of the usual faces,points,etc. files but also two special files, pointLevel and cellLevel and these have to be consistent with the mesh.

andresbh August 21, 2009 04:08

Hi all,

I have a question regarding the snappyhexmesh. My domain is as large as 1mm^3 with a couple of bodies inside. snappyhexmesh refines the surface intersection to the domain created with blockmesh but it does not remove the volume of the body. I have tried reducing the property


to a very small value. But the results are the same.

do you have any advice for this case?

many thanks


All times are GMT -4. The time now is 04:05.