CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Native Meshers: snappyHexMesh and Others (
-   -   snappyHexMesh - 2D Cylinder Problems (

Logan Page March 5, 2011 13:16

snappyHexMesh - 2D Cylinder Problem - Flange / Jagged edge
5 Attachment(s)
Hi All

Ive got a problem that hopefully someone can help with.
Im trying to mesh a series of large and small cylinders to be cooled by natural convection.
It is strictly a 2D problem and as you know sHM refines the mesh in all 3 directions creating additional elements in the z-direction.

I have read the post reply by Ziad (2D Cylinder mesh problems with Snappy ) which has also been uploaded to wiki (Main ContribExamples/2DsHM ).
This post was very informative and helpfully and I was able to easily redo this for the "wingMotion_snappyHexMesh" tutorial.

However when I try to adapt this the my problem im getting garbage from the extrude step. (The empty space where the cylinders should be is being filled)

After further work, I've figured out the problem as follows:

Im getting jagged edges on the front and back patched where the cylinder edges join, which kind of creates a flange inwards from the cylinder edge as shown in the second attached figure. The problem is that this flange is part of the front patch and similarly the back patch.

When extruding the front patch the jagged faces extrude inward into the cylinder :confused: .

I've looked into the snapEdge utility from Niklas, but so far I've had no luck with fixing this problem.

Ive attached the "blockMeshDict" ; "snappyHexMeshDict" and "Cyl1.obj" files

Any advise would be appreciated !



ziad March 6, 2011 16:06

Hi Logan,

I took a look at your case and I get the jagged edges as well. Not sure how to get rid of those. Maybe use edges (*.eMesh files) like the igloo tutorial, or create *.obj surfaces to represent the front and back? Maybe even one *.obj surface to represent the entire front-cyl1-back group with edges for the cylinder surface. After all you only need one plane right.

Mind you I stopped using sHM and co. myself. I find it to be still an alpha package. Went back to Pointwise and Gridgen which export directly into OpenFOAM format.


Logan Page March 6, 2011 16:27

Hi Ziad

Thanks for looking into that for me and for the feedback.

Yes I only need the one plane.
Even with creating a *.obj file I get the same result.
Didn't try adding a *.eMesh file for additional edge refinement tho.

I did however manage to get a decent looking mesh by doing the following (for thos that have a similar problem):

1) blockMesh
2) snappyHexMesh -overwrite
3) flattenMesh (this got rid of the jagged edge and most of the elements in the z-direction, but if the refinement around the surface isn't fine enough then it causes some elements to be added to the cylinder wall patch i.e. gives it a slight thickness)
4) extrudeMesh

this gave a reasonable looking 2D mesh for my situation.

Im also not so happy with sHM, I find it to be very resource hungry and slow for getting this simple 2D scenario.

You wouldn't happen to know off-hand of any free linux based meshing software that both exports directly to OpenFOAM and can be u

ziad March 6, 2011 16:36

Hey whatever gets the job done! Just make sure you run checkMesh before using your mesh.

I use Pointwise and Gridgen. You can find more info about them at
Pointwise is easier to use than Gridgen, which in turn has more features. You can get a demo license for free and use it anyway you want for a month. Your mesh would take 30 minutes to do. I think they have cylinders meshed in the tutorials as well.

sh.d May 27, 2013 12:07

1 Attachment(s)
Hello Ziad
I want to mesh a 2d airfoil in snappy but it cant snap the airfoil
can you help me please?

All times are GMT -4. The time now is 01:48.