CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Mesh Utilities (
-   -   How to create patch after snappyHexMesh (

hsieh August 8, 2008 09:00

Hi, snappyHexMesh is a grea

snappyHexMesh is a great tool. Save me lots of time creating meshes. However, I do run into a problem with some situations. I am wondering if anyone has encounter the same isssue and have ways to resolve it.

As seen in the picture, I want to create a mesh "inside" the cup. I have stl file of the geometry. So, I create a simple block to contain the cup. After snappyHexMesh, I got the mesh inside the cup. But, at the point, there is only 1 patch, that is the wall of the whole geometry. I need to separate this 1 patch into: inlet, wall1, wall2, and atmospheric. How to achieve this? Sometimes, the patch I am interested in may be curved surfaces, so that patch is not always flat. Suggestions will be highly appreciated.


hsieh August 8, 2008 09:01

press send too fast before add
press send too fast before adding the picture.



hsieh August 8, 2008 09:02

OK, let me try this again.
OK, let me try this again.

eugene August 8, 2008 10:08

We do this by either: 1. Usin
We do this by either:
1. Using separate STL surfaces for each region
2. Using STL or NASTRAN surfaces with multiple internal regions.

You can also get additional patches from the original blockMesh by intersecting the surface geometry with the block boundary.

hsieh August 8, 2008 11:59

Hi, Eugene, Thanks. I thin
Hi, Eugene,

Thanks. I think I understand approach #1, but, can you explain approach #2? It is not clear to me what STL/Nastran surfaces with multiple internal regions means. How to create that?


PS: I use SolidWorks to create geometries.

bastil August 10, 2008 16:28

Thanks Eugene, I was not aw
Thanks Eugene,

I was not aware that the file may also be in Nastran format? This is quite helpful. I am also wondering how you make snappyhexmesh to use multiple stl-Files at one time? Is it sufficant to place them into the trisurface dictionary?


eugene August 11, 2008 06:12

Hi Bastil, We use CATIA/ANS
Hi Bastil,

We use CATIA/ANSA to make surfaces and these tools provides the capability of exporting multi-regioned surfaces. I have never personally used solidWorks, so I cannot comment on that.

To use multiple surfaces just add more surfaces to the geometry and refinementSurfaces sections of the snappyHexMesh dict. Of course they need to be in the triSurface directory as well.

hsieh August 11, 2008 08:10

Hi, Eugene, My understandin
Hi, Eugene,

My understanding is that, the geometry has to "close". For example, say, a cube. It has 6 sides, top, bottom, left, right, front, back. When exporting to STL, the STL file consists of several triangulates, and we no longer have patch name, such as top/bottom/front/back/left/right associate with the STL file. In snappyHexMesh, all 6 surfaces got lumpped into 1 surface, say called cubeWall. Is ther a way to keep the the original patch names in STL?

In SolidWorks, it can select a surface, split it into two surfaces (can be any shape). But, once exporting to STL, there is no name assocates with the surface. I can export specific patch surface to STL, but, can it be used in snappyHexMesh?


eugene August 11, 2008 11:40

Like I said, I don't know soli
Like I said, I don't know solidWorks. But in our regioned STL files regions look something like this:

solid top
'triangle stuff'
endsolid top
solid bottom
'more triangle stuff'
endsolid bottom

I don't think this kind of regioning is a standard STL feature. However, NASTRAN does support regions by default.

bastil August 11, 2008 11:43

Eugene, thanks once more. I

thanks once more. I also do not use SolidWorks. I guess from CATIA your way is multi-part stl? What about ANSA? I do not know ANSA, do you use stl there, too? The other question was if nastran-Format is possible, too. This seems to be the case.


eugene August 12, 2008 05:13

These days we mostly use NASTR
These days we mostly use NASTRAN with and without multi-regions.

bastil September 1, 2008 11:53

Hi all, I have problems exp
Hi all,

I have problems exporting multi-region Nastran files from Hypermesh. It seems HM has different Nastan formats (long, CFD, standard,..) OF only reads "standard" option. However, regions are not discovered and I have some warnings about unrecognised NASTRAN-commands. I see HM has written regions into the file, but obviously the format is wrong. What does it have to look like?


nitsud September 13, 2008 13:57

Hey all, What I've found to w
Hey all,
What I've found to work in solidwork is to generate individual solid bodies for each patch that you'd like to generate, then save them as individual, ASCII .stl files (not allowing solidworks to translate them to positive space, so you insure relative positioning is correct), then concatenate the .stl files, and apply the snappyHexMesh to that.

This worked OK for me, and actually sort of makes sense with the way that my solidworks assemblies work.

hsieh September 22, 2008 17:41

Hi, Eugene, I am wondering
Hi, Eugene,

I am wondering if you can post a complete multi-part stl (simple geometries will do). I am wondering if I can edit my stl file from SolidWorks to try out snappyHexMesh.



bastil September 23, 2008 04:05

Pei, you can have a look at

you can have a look at the Motorbike Tutorial. This is exactly what you are looking for.
However, I would be interested in a example Nastran-File from a simple geometry that works (remain both patches and patch-names). I am struggeling with the Hypermesh-Export so far. Thanks.

Regards Basti

linnemann November 25, 2008 03:45

Hey all just an FYI.. If yo
Hey all just an FYI..

If you are using Salome to create your geometry. (CAElinux is a live dvd with salome installed if you want to try it out)

You have the option to explode your geometry into faces give them names like vel_inlet press_outlet etc.. and export each face to their own .stl file.

exporting to an ASCII .stl will allow you to edit the text and give each solid names.

You can then use these multiple files in snappyHexMesh (haven't tried this so don't know if it handles multiple files).

The other way is to combine the face .stl files into a fully defined solid by appending each separate .stl file into one by for example using a command like this. (assuming it is a cylinder)

cat inlet.stl >> assembly.stl
cat outlet.stl >> assembly.stl
cat walls.stl >> assembly.stl

Then you have a fully defined solid and provided you have given the three solids names these will be added to your final boundaries file and you can specify the inlet/oulet conditions as usual after running snappyHexMesh.

Hope this helps anyone.


bholbek December 12, 2008 05:39

Hi, i'm trying to create a

i'm trying to create a mesh inside a geometry with the snappyHexMesh utility.
The mesh seems ok but i can get the patch i want. I have different stl surfaces and i would like to have a patch for each of them. However, I just have the patchs related to my initial background hex mesh and one, corresponding to te complete geometry...

Is using different stl surfaces not sufficient?

Thank you


bholbek December 12, 2008 06:19

Last thing, what should i d
Last thing,

what should i do with the boundaries of my background hex mesh. I don't simulate anything outside the geometry. Put empty for example?

Thank you


fra76 December 12, 2008 08:28

It's enough that you put all y
It's enough that you put all your patches in one STL file. At the end you will have different patches in your mesh, where the mesh has been built. Using multiple stl files is fine as well. Check that you saved your STL as ascii, as in binary files patch names are not written.

I cannot understand your last question. If you need to mesh inside your geometry, you should not have any mesh between it and your background mesh, as your keep point must be inside.
If you have a mesh on both sides, it means that you have a hole in your geometry.

Hope this helps,

bholbek December 12, 2008 12:37

Hi, Thank you for your answ

Thank you for your answer.
actually, i don't have mesh outside my geometry, it's ok. However, snappyHexMesh creates a defaultFaces patch, which comes from my background hex mesh, i think.
Is it normal?



All times are GMT -4. The time now is 03:09.