CFD Online Logo CFD Online URL
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] snappyHexMesh - 3D Wing Meshing Setup & Trials

Register Blogs Members List Search Today's Posts Mark Forums Read

Like Tree3Likes
  • 3 Post By denbjornen

LinkBack Thread Tools Search this Thread Display Modes
Old   February 21, 2018, 22:49
Default snappyHexMesh - 3D Wing Meshing Setup & Trials
New Member
Brandon Johnson
Join Date: Jul 2017
Posts: 4
Rep Power: 5
denbjornen is on a distinguished road
Hello all,

My name is Brandon and I'm an aspiring CFD pupil and aeronautical engineer. The purpose of this post will be to, in part, collate pertinent information I've found regarding the meshing of wing geometry, and secondly, to open a discussion about further improvements on the matter. Please forgive me if any posts of this sort have been made already, or if this is posted in the wrong area of the forum. Additionally, it is to be noted that I am relatively new to OpenFOAM (less than one month), so don't blast me on simple mistakes that I may have made. This post is for others that may encounter the trials that I have while trying to stabilize this mesh.

I'll start by saying that this case setup is intended for use in a genetic algorithm for the evolutionary optimization of subsonic wing geometry based on 15 wing "genes." Anybody that is interested in my algorithm may contact me on the matter. Each wing phenotype to be tested is randomly (at first) generated using Python; the STL geometry files are generated by hand (sort of) using Python's numpy-stl package. Attached is my case setup and several screenshots of test geometry and meshing results. I will briefly explain the reasoning behind my snappyHexMeshdict values and the information I have scraped off of this forum regarding certain entries.

1. Refinement Regions

I've found that when meshing with refinement regions, it is not good to jump multiple refinement levels from one region to the next. I believe this both for meshing and for simulation. By this I mean that if your refinement region that intersects with the background mesh has a level of anything more than 2, sometimes there will be mesh regions that are not "pretty." Perhaps this is a symptom of something else entirely and somebody would care to elaborate on the topic. For my case, I need level 5 refinement in the region closest to the wing, therefore I introduce 4 separate refinement regions to "step" down from level 1 refinement (background mesh) to the level 5 refinement region.

2. Feature Snapping

I've increased the number of feature snapping iterations to 30 in order to combat viscous layer addition not happening sometimes. There are several other measure to make sure that layers were generated all the way around the airfoil, and this may have been something that helped.

3. Surface Layer Generation

I like to use relative layer sizing so that I can change geometry (genetic algorithm) without changing the reproduction ability of the mesh. My layers go from 0.05 to 1. In the early stages of my meshing I found it very difficult to get the layers to wrap entirely around the airfoil. To combat this, I've significantly increased the featureAngle, maxFaceThicknessRatio, and medialAxisRatio. I will try to link the forum posts that suggested this later, perhaps. Ensuring that nGrow is set to 0 will also help.

4. Mesh Quality Controls

Additionally, I've found that adjusting the maxNonOrtho = 65 and the maxInternalSkewness = 4 also helps with layer generation around the entire airfoil profile.

5. Overall Meshing Notes

I've found that if you are constantly recreating new meshes, you must delete ALL files in the case folders that are non-essential. This includes files in the polyMesh, extendedFeatureEdgeMesh, 0, timestep, processor#, and the .eMesh files in the triSurface folders. This is provided, of course, that you are regenerating the blockMesh and running surfaceFeatureExtract every time. Without doing this, I've found that sometimes snappy will complain with errors including but not limited to a segmentation fault.

In the surfaceFeatureExtractdict I've found that changing the featureAngle parameter to 160 suits my application best. It seems to capture both the LE and TE of the wing effectively. This may be true for you if you are also meshing a wing.

For mesh generation in parallel, ensure that your decomposePar dictionary n values multiply to the number of cores you have specified. Also, I have found that running snappy as such:
mpirun -np 8 snappyHexMesh -overwrite
Uses much more RAM and overall CPU resources that running it like this:
mpirun -np 8 snappyHexMesh -overwrite -parallel
When running without the "-parallel" snappy seems to freeze up my computer and I'm not sure why. Perhaps somebody can shed light on this as well. For mesh reconstruction after the parallel run (if desired), I use:
reconstructParMesh -constant
I've found that running without -constant somehow overwrites the refinement data and all that I can see of the mesh is the background mesh in ParaView. Perhaps this is something that I'm not understanding as well.

6. Preguntas tengo

I've noticed that on some parts of the mesh there are some "ugly" looking cells that seem to originate and spread from the boundary layers. This may be a consequence of my STL files, but I am currently investigating the cause. It should be fairly easy to see which cells I am talking about in the screenshots. Is there anything that I can do to combat this? I guess the mesh appearance is secondary to the performance of the simulation, but I believe these tiny cells are unecessary and lead to excessively high courant numbers compared with the rest of the domain.

Additionally, I've been incapable of getting the layers to grow away from the trailing edge of the airfoil at nearly every section. In simulation, I've noticed some odd pressure behavior at the trailing edge that my be caused by this. Even with nGrow set to 0 the layers seem to collapse one cell before the trailing edge. Is there something obvious I am missing in my case setup for this? I've scoured the internet to no avail.

Lastly, I'm wondering if anybody would be generous enough to post their mesh if it looks better than this. I'll be moving on the to simulation refinement portion of this project, but will make adjustments to the mesh as I see fit. Additionally, I'm looking for somebody to clear up some of the points that I've mentioned. I hope this post will help anybody that is having problems meshing (or setting up the mesh) for subsonic wing geometry!

Thanks for reading
Attached Images
File Type: png layer_collapse.png (30.2 KB, 123 views)
File Type: png layers.png (19.1 KB, 120 views)
File Type: png ugly_cells.png (49.8 KB, 125 views)
File Type: png zoom2.png (13.3 KB, 129 views)
Attached Files
File Type: gz case.tar.gz (98.6 KB, 44 views)
denbjornen is offline   Reply With Quote

Old   May 25, 2020, 11:14
Smile Layers for fairing of landing gear
New Member
Join Date: Apr 2020
Posts: 6
Rep Power: 2
Mateus Elias is on a distinguished road
Firstly, thank you a lot for your post, it is really helpfull for me in my project.
Second, I have some doubts about nGrow and layer thikness for Sparlar Allmaras setup. My mesh dont converge. I doing a project of a fairing of a landing gear, and belive that the error is in layer on snappyHexMesh.
The nGrow, by what I read should be at leat 1 for my case, but when I see you nGrow as 0, I tried to modified but dont have a sucess, because the error message say that the nGrow wa set for my case wrong.
There is any way to excplain better or pass some links for setup the lays for snappyHexMesh for SA turbulence model? Because in SA, according with my understanding, dont be necessary use the y+. Am I correct?

Thank you a lot, and my case setup system is on the attachment zip.

Thank you and my regardd\s.
Attached Files
File Type: zip (10.5 KB, 3 views)
Mateus Elias is offline   Reply With Quote


cfd, meshing, problems, snappyhexmesh, wing

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[ICEM] Unstructure Meshing at the Wing Tip Surface from Imported Plot3D Structured Mesh yona ANSYS Meshing & Geometry 8 January 21, 2014 10:06
[GAMBIT] Meshing of flipper wing dv.darshan ANSYS Meshing & Geometry 9 May 21, 2012 01:38
[GAMBIT] F1 Front Wing Meshing andyjo22 ANSYS Meshing & Geometry 3 April 3, 2012 03:54
[GAMBIT] Meshing Complex Wing Shape racerdude777 ANSYS Meshing & Geometry 1 December 16, 2010 09:31
Parallel case setup boundry conditions snappyhexmesh oskar OpenFOAM Pre-Processing 5 September 11, 2009 01:12

All times are GMT -4. The time now is 14:04.