CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Meshing Format & General Technical (
-   -   How to hex mesh geometry in STL format? (

bigphil May 12, 2009 07:10

How to hex mesh geometry in STL format?

I have geometry in the STL format, and I would like to hex mesh it.

Has any done this before, starting from a STL and finishing with a hex mesh?

Any advice would be much appreciated,

santos May 12, 2009 07:34

Hi Philip,

Have you tried snappyHexMesh? It does exactly what you need. Have a look in the User Guide to see how it can be used.

Jose Santos

bigphil May 12, 2009 08:26

Hi Jose,

I read through snappyHexMesh in the manual.

Is it possible to use snappyHexMesh for meshing the geometry itself, as apposed to around the geometry like in the snappyHesMesh example?

I have a femur (thigh bone) which I would like to mesh.

Thanks for you reply,
If snappyHexMesh suits, that would be great!


santos May 12, 2009 09:15

Yes, its possible. You need to define the locationInMesh point in the region you are interested in, ie, inside the femur in you case.

Jose Santos

bigphil May 12, 2009 09:21


That's great. I didn't realise I could use snappyHexMesh to hex mesh objects.

I shall head off now, and try to learn snappyHexMesh.

Thanks very much for the advice,
it is much appreciated.

Best Regards,


wendywu June 30, 2009 22:55

Hi, Jose,
Now I am facing a weird problem.
I am going to hex mesh the flow field in a screw extruder.
I blockMeshed the barrel back ground . it worked.
I then tried to snappyHexMesh the field between the screw and the barrel.
I defined the location in mesh , but when I run sHM, it always exited with saying:
Point (x x x) is not inside the mesh or on a face or edge.
Bounding box of the mesh:(-13.1 -13.1 0) (13.1 13.1 197)
I tried several point , even though I pretend to mesh the area inside the screw.
it does so also. I have tried to avoid the point on the face or edge.
I can not solve the problem. Would you give me some hint?
Thank you.


santos July 1, 2009 04:37

Make sure the dimensions of blockMesh and STL meshes are consistent (eg. m or mm). Its hard to help without extra info on your mesh!

Jose Santos

wendywu July 2, 2009 11:40

Now the problem is, when I run sHM, it stops with the error information:
#0 Foam::error::printStack(Foam::Ostream&) in "/home/xhw/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#1 Foam::sigFpe::sigFpeHandler(int) in "/home/xhw/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#2 Uninterpreted: [0xb8076400]
#3 Foam::meshRefinement::markSurfaceCurvatureRefineme nt(double, int, Foam::List<int> const&, Foam::Field<Foam::Vector<double> > const&, Foam::List<int>&, int&) const in "/home/xhw/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#4 Foam::meshRefinement::refineCandidates(Foam::Vecto r<double> const&, double, Foam::PtrList<Foam::featureEdgeMesh> const&, Foam::List<int> const&, bool, bool, bool, bool, int, int) const in "/home/xhw/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#5 Foam::autoRefineDriver::surfaceOnlyRefine(Foam::re finementParameters const&, int) in "/home/xhw/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#6 Foam::autoRefineDriver::doRefine(Foam::dictionary const&, Foam::refinementParameters const&, bool) in "/home/xhw/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/"
#7 main in "/home/xhw/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/snappyHexMesh"
#8 __libc_start_main in "/lib/tls/i686/cmov/"
#9 Foam::regIOobject::writeObject(Foam::IOstream::str eamFormat, Foam::IOstream::versionNumber, Foam::IOstream::compressionType) const in "/home/xhw/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/snappyHexMesh"
Floating point exception

I am considering if it is caused by shortage of memory space?
Thank you.


wendywu July 2, 2009 23:36

I just tried another simpler case. it is just a cylinder inside a bigger rectangular container.

when sHM for several iterations, it stoped with information: killed.
no sHM results created.
Anybody has such experience?
Thank you.


wendywu July 6, 2009 12:29

sHM , refinement level
I modified refinement level , it worked finally.
but what is the problem that it works well with lower level and doesn't work with higher level? I still want to get better mesh so I would prefer higher refinement level.
Many thanks to any advice.


All times are GMT -4. The time now is 00:57.