CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Meshing & Mesh Conversion

[snappyHexMesh] Prism Layers Not Generating

Register Blogs Community New Posts Updated Threads Search

Like Tree8Likes
  • 4 Post By Ship Designer
  • 2 Post By Yann
  • 1 Post By AtoHM
  • 1 Post By Ship Designer

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 15, 2021, 11:54
Default Prism Layers Not Generating
  #1
New Member
 
Jack B
Join Date: Jul 2018
Posts: 11
Rep Power: 8
Jack B is on a distinguished road
Hi Foamers,

I have seen this issue relatively often on this forum where people struggle to get the prism layers to generate off more complex geometries using SHM. In my case I can't get my head around the issue and was hoping for someone to point me in the right direction.

I want to simulate the attached geometry in air at a velocity of 33m/s. I decided on using the Realizable K-E turbulence model as this is faster at producing results and I am not so fussed on the accuracy and more focused on a fast simulation with where I can have a fast turnaround time of designs. I am interested in the drag values. Using boundary layer theory, I calculated the first PL height to be ~0.0003m (y+~30) however I struggle to get snappy to build layers that small hence I decided to try with a first cell height of 0.001m and then to try and reduce this value if possible.

I have attached my geometry, snappyHexMeshDict and meshQualityDict.

https://drive.google.com/file/d/1l82...ew?usp=sharing

The images below illustrate the issue.

I have tried turning off the minTetQuality which had a really positive effect. Also reducing the resolveFeatureAngle to 15 and the featureAngle to 130 had some effect. However much I play with the parameters in SHM dict I feel like I am going in circles.

Could anyone lend me a hand?

Thanks in advance.
Attached Images
File Type: jpg Slice_TE_2.jpg (200.2 KB, 124 views)
File Type: jpg slice_TE.jpg (181.0 KB, 112 views)
File Type: jpg geom.jpg (72.6 KB, 101 views)
Attached Files
File Type: zip Dicts.zip (4.9 KB, 8 views)
Jack B is offline   Reply With Quote

Old   April 15, 2021, 22:14
Default
  #2
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7
Ship Designer is on a distinguished road
Hello Jack,

I see from your snappyHexMeshDict that you are trying to generate viscous layers based on absolute size. I never managed to get that to work and therefore I gave up using sHM for that. If you ever find out how to make it work, please let me know! You can try the following:

  1. Generate the mesh with sHM except the viscous layers and let cfMesh's generateBoundaryLayers utility generate them. It works in stand-alone, but the polyMesh needs to be written in uncompressed asciii format for it to work. Alternatively you can try meshing everything with cfMesh.
  2. Given that your geometry is convex almost everywhere, it lends itself for a structured multi-block mesh. This could be done in blockMesh alone, including high-quality viscous layers. See attached pictures of a work-in-progress of what is possible. It's tedious to edit the blockMeshDict, but once it's set up, you have very fine control over viscous layers and can expect very good mesh quality. Also, as long as the geometry changes only slightly, you can simply swap the geometry file. Mesh generation with blockMesh is very fast, taking only a few minutes. If your model should be enriched with wings or appendages on the other hand, then it might quickly become unfeasible. If you want to try that, please let me know and I can give you some info on how to do it. If I find the time, I would like to make a tutorial about this someday.
  3. You might consider a third-party application for generating the mesh, if you have access to academic licenses or something open source, if it suits your needs. Through this forum you should be able to find other software for meshing.
Hope this helps.

Best, Claudio
Jack B, Richal Sun, IFX21 and 1 others like this.
Ship Designer is offline   Reply With Quote

Old   April 16, 2021, 02:44
Default
  #3
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Very cool stuff, Claudio
I am not so familiar with blockMesh, I definetely have to get more into it at some point.

I am investing a bit more into snappy. A few things I would recommend: try to play with the featureAngle setting (I have not opened the dictionaries, no idea what value you use). Also, you can try the alternative mesh shrinker to produce boundary layers. However, Claudio is right, boundary layers are the weak spot of sHM.
@Claudio: I use relative/absolute layers like 50:50. I never know which one works better, but usually one does. Its not impossible, though.
AtoHM is offline   Reply With Quote

Old   April 16, 2021, 04:50
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,238
Rep Power: 29
Yann will become famous soon enoughYann will become famous soon enough
Hello all,

Just to add my 2 cents on the relative/absolute sizes: a new hybrid mode is available in OpenFOAM-v2012, allowing to set an absolute size on the wall layer and a relative size on the final layer: https://www.openfoam.com/news/main-n...id-layer-input

I did not have the chance to try it myself yet so I have no idea how it performs but since you are discussing this topic I thought it could be worth mentioning.

Cheers,
Yann

PS: if someone tries it, please share your thoughts here, I would be interested in having some feedback about it!
AtoHM and Jack B like this.

Last edited by Yann; April 16, 2021 at 09:40. Reason: typo
Yann is offline   Reply With Quote

Old   April 16, 2021, 07:25
Default
  #5
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
Interesting, thanks for the tip. I will definetely try it at some point.
Yann likes this.
AtoHM is offline   Reply With Quote

Old   April 16, 2021, 21:18
Default
  #6
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7
Ship Designer is on a distinguished road
Thanks Yann and AtoHM for the suggestions. I don't quite see the value of this hybrid absolute/relative approach. I think it would be sufficient if absolute size would just work as expected. But I don't want to go off-topic with this.

Two things I would like to add for Jack. If the absolute size of cells gets very small like for your first layer thickness, at some point it might become necessary to increase writePrecision in controlDict. A resolveFeatureAngle of 15 is very coarse actually, although I'm not sure if this is related to your problem. If you are not clear what this setting does, let me know.
Jack B likes this.
Ship Designer is offline   Reply With Quote

Old   April 17, 2021, 04:40
Default
  #7
Senior Member
 
M
Join Date: Dec 2017
Posts: 703
Rep Power: 13
AtoHM is on a distinguished road
I assume it can come in handy, especially for simulations with multiple phases. With the absolute setting you have no control of the volume ratio between last layer and surrounding mesh. High volume ratios at phase interfaces can have a bad influence on stability and convergence. So I guess thats one point.
AtoHM is offline   Reply With Quote

Old   April 19, 2021, 05:52
Default
  #8
New Member
 
Jack B
Join Date: Jul 2018
Posts: 11
Rep Power: 8
Jack B is on a distinguished road
Hi all,

Thanks for your help. I was not able to reply earlier as I was having some trouble accessing the website.

Claudio:
I will take a look at cfMesh and see if I can use it to mesh my case well from scratch. Although I was hoping to be able to useSHM as it is the in-built tool. The blockMesh you showed on the attached images is really amazing. Would you mind uploading your blockMeshDict? I am not able to use this as I intend to change the geometry and don't want to have to edit the dict every time.

I believe resolveFeatureAngle refines curves with angles smaller than the value set in resolveFeatureAngle? I played with decreasing this value down to 5 however it didn't fix the problem and increased the cell count a lot.

I will give a try modifying the writePrecision and observing if that fixes the issue.

Thanks
Jack B is offline   Reply With Quote

Old   May 12, 2021, 20:29
Default
  #9
New Member
 
Shreya Agrawal
Join Date: Nov 2020
Posts: 1
Rep Power: 0
shreyaag is on a distinguished road
Hello All,

I have a similar issue with SHM for my geometry (a 3D square building with corner cuts). The layers are extruding nicely for most of the geometry, except for at the corners (please look at the attached images of a 2D slice). I played around quite a lot with different settings of SHM (changing featureAngle etc.), and the following settings have worked the best so far (openfoam v2012):

<< Relevant code from SHM >>

layers
{
building
{
nSurfaceLayers 12;
}
}
relativeSizes false;
thicknessModel firstAndOverall;
// expansionRatio 1.0627;
firstLayerThickness 0.00005;
thickness 0.000857;
minThickness 0.00004;
featureAngle 180;
layerTerminationAngle -180;
resolveFeatureAngle 40;
nLayerIter 100;
nSmoothSurfaceNormals 10;
nSmoothThickness 20;
minMedialAxisAngle 90;
maxThicknessToMedialRatio 0.3;
nMedialAxisIter 10;
nSmoothDisplacement 90;
// detectExtrusionIsland true;
nRelaxedIter 100;
}

Do you have any suggestions to extrude the boundary layers at the corners?
Thank you!
Attached Images
File Type: jpg buildingMesh1.jpg (96.8 KB, 69 views)
File Type: jpg buildingMesh2.jpg (152.1 KB, 57 views)
File Type: jpg buildingMesh3.jpg (200.0 KB, 70 views)

Last edited by shreyaag; May 12, 2021 at 22:02.
shreyaag is offline   Reply With Quote

Old   May 13, 2021, 05:14
Default
  #10
New Member
 
Jack B
Join Date: Jul 2018
Posts: 11
Rep Power: 8
Jack B is on a distinguished road
Hi shreyaag,
Check out this post where they deal with a similar issue. SnappyHexMesh: Layer on corners. It's from 2014 but I think it should at the very least point you in the right direction.
Jack B is offline   Reply With Quote

Old   July 10, 2021, 10:33
Default
  #11
Senior Member
 
Claudio Boezio
Join Date: May 2020
Location: Europe
Posts: 137
Rep Power: 7
Ship Designer is on a distinguished road
Hello all,

First of all, apologies for not having replied again to this thread earlier.

@AtoHM:
Quote:
I assume it can come in handy, especially for simulations with multiple phases. With the absolute setting you have no control of the volume ratio between last layer and surrounding mesh. High volume ratios at phase interfaces can have a bad influence on stability and convergence. So I guess thats one point.
I see what you mean. Knowing or being able to measure cell sizes close to the boundary, one can calculate appropriate values of amount of layers, expanding ratios as well as start and end thicknesses for absolute values, in order to obtain the desired transition to interior cells. The problem with relative sizes is that in my understanding it works only reliably if the grid has uniform cell size surrounding the geometry. I work mostly with graded meshes and relative size doesn't work. This requires inevitably to have too small cells in areas where they are not needed, just to allow the program to add viscous layers. Thus, generation of an inefficient grid comes at the expense of hours of added computation time later on.

@Jack B:
Quote:
The blockMesh you showed on the attached images is really amazing. Would you mind uploading your blockMeshDict? I am not able to use this as I intend to change the geometry and don't want to have to edit the dict every time.
Unfortunately, this grid was made with tens of blocks and several blockMeshDicts, making up multiple regions that where then stitched together. This is highly impractical and I worked on it for several weeks, but I wanted to see what's possible with blockMesh. The difficulty is two-fold: first, creating a block topology around protrusions with the least number of blocks and so that all their faces match without gaps is a challenge in itself, especially with limited visual aid. Second, implementing the aforementioned with textual input in form of blockMeshDicts is error-prone and excruciating. However, that which is set up, once the shell script is started, takes just a few minutes to generate the grid. blockMesh is very fast, accurate and produces high quality meshes, as long as the input allows it.

Jack, were you able to make any progress?
Ship Designer is offline   Reply With Quote

Old   October 16, 2023, 01:31
Default
  #12
New Member
 
Aero_Cats!
Join Date: Jul 2021
Location: Indonesia
Posts: 7
Rep Power: 5
IFX21 is on a distinguished road
Quote:
Originally Posted by Ship Designer View Post
Hello Jack,

I see from your snappyHexMeshDict that you are trying to generate viscous layers based on absolute size. I never managed to get that to work and therefore I gave up using sHM for that. If you ever find out how to make it work, please let me know! You can try the following:

  1. Generate the mesh with sHM except the viscous layers and let cfMesh's generateBoundaryLayers utility generate them. It works in stand-alone, but the polyMesh needs to be written in uncompressed asciii format for it to work. Alternatively you can try meshing everything with cfMesh.
  2. Given that your geometry is convex almost everywhere, it lends itself for a structured multi-block mesh. This could be done in blockMesh alone, including high-quality viscous layers. See attached pictures of a work-in-progress of what is possible. It's tedious to edit the blockMeshDict, but once it's set up, you have very fine control over viscous layers and can expect very good mesh quality. Also, as long as the geometry changes only slightly, you can simply swap the geometry file. Mesh generation with blockMesh is very fast, taking only a few minutes. If your model should be enriched with wings or appendages on the other hand, then it might quickly become unfeasible. If you want to try that, please let me know and I can give you some info on how to do it. If I find the time, I would like to make a tutorial about this someday.
  3. You might consider a third-party application for generating the mesh, if you have access to academic licenses or something open source, if it suits your needs. Through this forum you should be able to find other software for meshing.
Hope this helps.

Best, Claudio

Hi Claudio, I worked on a similar project as shown by your thread. Currently I'm trying to mesh the DTMB 5415 ship model and get lost on how to create a good mesh using SHM to generate the prism layer. Could you give us guide on how to mesh such ship geometry using blockMesh only? I believe some foamers also worked on the same project and will get benefit from your side
IFX21 is offline   Reply With Quote

Reply


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
Prism Layers at Slip Wall to Non-Slip Wall Transition InfernoxCJC STAR-CCM+ 4 November 26, 2017 20:06
[ICEM] Generating prism layers undziabundzia ANSYS Meshing & Geometry 1 November 22, 2015 15:21
[ICEM] Prism layers distorted near trailing edge of blade-Unstructured Mesh Rohith Giridhar ANSYS Meshing & Geometry 3 June 29, 2015 18:52
Doxygen documentation Tanay OpenFOAM Installation 9 September 23, 2011 12:40
ICEM Prism Layer transition between surface with prism layers and one without TWaung ANSYS Meshing & Geometry 2 October 12, 2009 15:56


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