CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Mesh Utilities (
-   -   SnappyHexMesh meshes inside and outside of an STL geometry (

villier August 6, 2008 07:08

Hello! I have created a sim

I have created a simple box, meshed with blockMesh, and placed another (quite simple) closed geometry from an STL file in this box using a modified snappyHexMeshDict from the motorbike tutorial.
I set the locationInMesh outside the STL geometry, and inside the surrounding box. snappyHexMesh works fine, but if I display the resulting mesh in paraFoam, I see that although the cells have snapped to the STL geometry, also the interior of this geometry is meshed. I assume it is no supposed to?

Did I forget some step to have only the outside of the STL geometry meshed as displayed in the "5.4 Mesh generation with the snappyHexMesh utility" chapter of the users guide ("cell removal" step)?

(If I set the locationInMesh inside the STL geometry, the resulting mesh is only the STL interior.)

Looking forward to your advice

villier August 6, 2008 07:53

Forget my question. I had offs
Forget my question. I had offset the STL geometry by an unexpected value, and what I thought was the STL interior was in fact the effect of the STL geom on the outside mesh structure. Now I find the void space at the STL geometry as expected.

Nice tool!

piradeepan August 23, 2008 13:53

hello all, I am using reac
hello all,

I am using reactingFoam in a simple geometry with 2 inlets and a outlet.I have manually edited all the files of U,O2,etc.. but on solving with reactingFoam , I get the following error:

#0 Foam::error::printStack(Foam:stream&)
#1 Foam::sigFpe::sigFpeHandler(int)
#2 ??
#3 Foam::polyMesh::calcDirections() const
#4 Foam::polyMesh::directions() const
#5 Foam::fvMatrix<foam::vector<double> >::solve(Foam::Istream&)
#6 Foam::lduMatrix::solverPerformance Foam::solve<foam::vector<double> >(Foam::tmp<foam::fvmatrix<foam::vector<double> > > const&)
#7 main
#8 __libc_start_main
#9 __gxx_personality_v0

What does this error mean?and how to resolve it?
I am using OF 1.5


wendywu April 28, 2009 15:40

is my doing correctly in the process of snappyHexMesh?
Hi, I am beginning to learn snappyHexMesh. I tried according to the tutorial. I typed bockmesh in the motorBike case directory, and then I viewed in paraFoam only a rectangle geometry, no any other shape inside. and then I typed snappyHexMesh. It executed and then I open paraFoam. The reaction is really slow that it can hardly show anything to me. I am wondering if there is something wrong in the process, for example, there should be a shape inside the box, Anybody can give me a hint or advice?
Thank you very much.


wolle1982 April 30, 2009 06:03

if there is a rectangle geometry inside only, this sounds like the "outline" display methode. just change the display methode of the geometrie to shape or shape and edges or mesh.

to view the motor bycicle unmark the min_y max_x etc.

wendywu April 30, 2009 10:49

I can see motorBike finally
wolle, Thank you for your reply. Yes, I saw the motorBike finally, But it is so small compared with the outside rectangle. I have to hide the rectangle and fit the window to see it and it is not located in the middle of the rectangle but at the side face. Is it because the unit of the motorBike is mm and the rectangle is m? I think the motorBike should be located in the middle of the rectangle and should have similar size.

Thank you.


wolle1982 May 4, 2009 05:46

i have no idea why it's so small, but your theory sounds plausible to me. however, i only started meshing without any change in the sHM-Dict. so no idea why in your case there is a divergence.

wendywu May 4, 2009 17:07

mesh for complex outer contour
Thank you for your reply. I now have another question : If I need a flow area with complex shape in outer contour. It will be troublesome to create the blockMeshDict. So can I create mesh with snappyHexMesh utility for the outer contour or do I have to convert it from fluent or else?

thank you very much.


wolle1982 May 5, 2009 03:45


yes, snappyHexMesh is feasible for Meshing this kind of task you'd like to do.

just proceede like the tutorial, search this forum and try by yourself. It is handleable.

I once wrote a little manual how the mesh different reagion in different refinement grades.


You need the geometry as a STL-File. This can be created by most of the CAD programs. If not, use Salome to convert an imported STEP-File. Create a blockMeshDict around your geometry and then play around with the parameters.

You will achieve good results with the right parameters. however, there are still some major problems in snappyHexMesh (boundary layer, feature edge lines,....)

hope that helps.

wendywu May 5, 2009 10:18

method for creating blockMeshDict
Thank you very much for your reply.
I have read that detailed tutorial and it really helped.
Now my question is another one.
In the first step I should use blockMesh to create the first mesh in the whole area according to the information in blockMeshDict. In the tutorial it is a rectangle block. Because it is 8 vertex block so it is easy to write the blockMeshDict by myself. But if now I want to create a more complex area for blockMeshing, it will be troublesome. Is there any method to create the blockMeshDict for complex shape geometry conveniently? Did I make sense?

Thank you very much.


wolle1982 May 5, 2009 11:17


as i understand, you'd like to simulate a free stream flow. ..? you want to mesh a complex geometry and the initial Mesh should also be complex..

why would you want to have that? could you tell, what exactly it should look like?!

the only way i could think of doing that would be to create the inside geometry and the outside geometry as ONE closed stl-file and then put a rectangle mesh over it and pointInMesh the space between inside and outside geometry.

maybe you can add a little sketch or something.

wendywu May 6, 2009 14:44

Dear Wolfgang,

Thank you so much for your patience.
I understand your suggestion now. I will try as you suggested right after. What I am going to simulate is aluminum extrusion. My final goal is to simulate the hollow profile extrusion process. The initial material is a round stick,it will be extruded by a ram at the one end, and the material will be pushed to go through several seperate holes and then meet together in a chamber and then go out of the die with a core to form the inner shape. so the inside and outside geometry both are not regular shape. And the boundary is moving(ram pushing). Next step I will have to know how to do it with moving boundary and then I will have to know how to do it in the outlet to describe the free surface after the material is pushed out the die.
Could you also give me some advice about that?
Thank you again.
Have a nice day!


wolle1982 May 7, 2009 03:28


no sorry, never worked with dynamic mesh before. and what you want to do sounds very difficult to me.

i would suggest to mesh the inside where the aluminum is flowing. this would be an inside mesh of a shape. dont work with moving mesh. better make the aluminum flow in constantly. so create the geometry of your severel forms the aluminum will be pushed through. your inlet should then be round (like the initila shape) and your outlet has to have the final shape of your profile.
create the initial rectangle mesh with blockmesh around the geometry in that way, that the inlet is exactly fitting your blockmesh grid-end (or create the geometry a little longer, so it stands out of the blockmesh grid). the outlet then should be the same with your final shape.
meshing it with sHM then will creat you a mesh that is only the flowarea with round inlet and shaped outlet. as solver you a non-newtonian one (see user-guide). at the inlet then let your aluminum flow in a a certain speed. since it is not compressible it is the speed of your pushing advice.

so make an easy flow-simulation out of it without any moving mesh.

maybe you really post a sketch of your simulation

good luck.

wendywu May 7, 2009 12:45

2 Attachment(s)
Hi, Thank you. I think you are understanding aluminum extrusion process well. I am considering to do it according to your suggestion.
The attachment is my simple geometry about the flow field.
My constitutive model is viscoplastic model.
I can also attach it to you,. I have not think out how to modify the code yet. Could you give me some advice about that? I think I have to understand the solver well before I can do it.

Thank you so much, I really appreciate it.


wolle1982 May 11, 2009 05:51

hi wendywu,

i don't know nothing about solver-variation....sorry.

but for meshing your geometry, sHM is perfect. Take your geometry put it inside a larger blockMesh-Mesh and set locationInMesh point inside geometry. check that the inlet-outlet boundaries are exactly on blockmesh-mesh boundary.

your geometry can also be easily meshed with the progtramm engrid by engits. it's a great tool for solving geometries like yours. I am using the comparing-cheap CastNet.


wendywu May 11, 2009 17:40

can Engrid create

Thank you for your reply always. I have succesfully finished meshing with sHM after enough trying. I think the mesh is perfect. I created separate stl files for each small face (in CAD software) and then added them together to form one stl file. I think if I can export one whole stl once in one step from CAD and then in meshing to designate inlet and outlet patches ( for applying boundary conditions in OpenFOAM) I can save a lot of time. Can Engrid do that? Thank you.



wolle1982 May 12, 2009 05:20


yes ui think engrid can do this. if you have separated patches you can separatly mesh them.... just try.

tachyon_me June 15, 2010 19:51

tutorial one more to check it out

All times are GMT -4. The time now is 08:44.