CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: blockMesh (
-   -   mesh generation inside/around 3D cylinder (

Cloudy1988 August 6, 2012 19:57

mesh generation inside/around 3D cylinder
Dear all,

I am a new user of openFOAM and I would like to learn how to generate mesh around 3D cylinder in native mesher in openFOAM

I tried the blockMesh method But the cylinder does not have "cover", and it looks like a "hole" not a cylinder in the domain.
1. how should I mesh the top and bottom of the cylinder in the method above?
2. how should I describe the cylinder itself like the image below and place it in the middle of the domain ( not connected with the top and bottom of the domain).
3. I also tried cylinderToCell in Cellset, while the whole domain is generated by blockMesh so that the boundary of the cylinder is not smooth, is there any way solve this?

If possible, I prefer the mesh generated by the native mesher in openFOAM. Any answer will be appreciated.

Many thanks,

wyldckat August 7, 2012 07:45

Greetings Cloudy and welcome to the forum.

There are several examples of cylinder meshes here in the forum, some of which are listed in this sub-forum:

Anyway, one such example is this one:

Best regards,

Cloudy1988 August 10, 2012 08:49

Hi Bruno,

Thanks for you reply,
the 3-D Mesh in a cylinder describe a cylindrical domain, I would like to put the clyinder in a larger rectangular box while i dont know how to set the "face to face" mesh connection between the cylinder boundary and box.

I am reading the snappyHex mesh in the openFOAM guider, First he used a STL surface to describe the object bouondary but I didnt find how does he do that, is STL a native function in openFOAM? could you please attache me any tutorial for that?


wyldckat August 10, 2012 09:09

Greetings Cloudy,

There is something better than having to go around editing files. Use can use Blender with these two marvellous scripts:
Best regards,

Cloudy1988 August 13, 2012 15:05

Hi Bruno,

I downloaded blender and installed these two addons, and I also tried their example. While, after i import the examples and click the "write" button, there are some errors shown below:
Traceback (most recent call last):
File "/../../../../2.63/scripts/addons/swiftsnap/", line 548, in execute os.makedirs(pathtrisurface)
File"....../2.63/python/lib/python3.2/", line 152, in makedirs mkdir(name,mode)
OSError: [Errno 13] Permission denied: '/triSurface'
location:<unknown location>:-1

Any idea for these?


wyldckat August 13, 2012 15:52

Hi Cloudy,

Both instruction pages indicate that you need:

Compatible Blender versions
v2.6x, with x<3.

Which means that you'll need Blender 2.60 or 2.61 or 2.62... all available here:

Best regards,

kalle August 14, 2012 02:15

Like Bruno says, stick to the compatible Blender versions. However, in this case, judging from the error message, it seems you are trying to put your files in a location where you do not have full write permissions.


Cloudy1988 August 14, 2012 05:31

Hi Bruno,

Thanks for your reply, I get the stl.file and locate it in trisurface. With command: blockMesh+snappyHexmesh -overwrite, I got the mesh for cylinder.

While the meshes around the cylinder are cut out, could I keep the mesh around the cylinder and remove the inner mesh instead?


wyldckat August 14, 2012 17:13

Hi Cloudy,

What you are looking for is this:

Originally Posted by
Set locationInMesh Sets the corresponding entry in snappyHexMeshDict to the coordinate of Blender's 3D cursor.

If you look at a "snappyHexMeshDict" file, you'll see comments like this one:

Originally Posted by
// After refinement patches get added for all refinementSurfaces and
// all cells intersecting the surfaces get put into these patches. The
// section reachable from the locationInMesh is kept.
// NOTE: This point should never be on a face, always inside a cell, even
// after refinement.
// This is an outside point locationInMesh (-0.033 -0.033 0.0033);
locationInMesh (-9.23149e-05 -0.0025 -0.0025); // Inside point

Best regards,

Cloudy1988 August 23, 2012 09:35

Hi bruno,

I got some questions would like to ask you,

The first one, in snappyHexMesh tutorial (in OPENFOAM user guide), there are more cells around the car surface, which part in snappyhexDict is to achieve this?

Secondly, what does the "level" mean? for example,
level (2 2)
what are the real meaning of the numbers in the ()? any detailed explanation?

Finally, normally we need a blockMesh as a blackground mesh for snappyHex, for the cylinder case, if the blockMesh size is larger than the cylinder , the top/bottom surface generated is not smooth (
while if i use small blockMesh , the surface of top/bottom is quite good (
Since I need the background block as a water tank to test the forces on the cylinder, is that possible to use 2 blockMesh, one small block for generate cylinder and one for water tank? or could I use any utility like Cellset to "define" a small region in blockMesh as the background for cylinder ?

Many thanks,

wyldckat August 23, 2012 14:13

I've answered you here: post #2

It would be nice if you didn't repeat the same questions in two separate threads. If you create a new one with basically the same question, edit your previous post indicating where you've moved your question to.

All times are GMT -4. The time now is 02:20.