CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Software User Forums > OpenFOAM > OpenFOAM Pre-Processing

How to do a proper SnappyHexMesh?

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Yann

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   March 27, 2024, 21:26
Default How to do a proper SnappyHexMesh?
  #1
New Member
 
Alberto Campuzano
Join Date: Mar 2021
Posts: 14
Rep Power: 5
baezacaljo is on a distinguished road
Dear all.


I am quite new using OpenFoam and of course snappyHexMesh. i have a geometry which is not quite simple, is a stack of material they holes arranged in zigzag from plate to plate (material to material), the liquid must pass through those holes, hence i made my geometry in Salome having inlet.stl, outlet.stl, and plate.stl, this last one is composed by the plates and the holes, hence doing my blockMesh everything is fine but after applying the SnappyHexMesh only one plate is meshed and the rest it thrown away. What did i do wrong?


In attache file you will find the snappyHexMesh file and also the geometry.


Finally i am planning to use incompressibleVOFluid solver
Attached Files
File Type: zip geometry_snappy.zip (121.1 KB, 2 views)
baezacaljo is offline   Reply With Quote

Old   March 28, 2024, 03:28
Default
  #2
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,066
Rep Power: 26
Yann will become famous soon enough
Hello,

We will need to have more information to be able to help you.
Check here How to give enough info to get help

Can you show screenshots of the mesh you get?
What is the cell size of your initial mesh (blockMesh) ?

My first thought is that your mesh is too coarse compared to the size of the holes in your plate, so snappy doesn't "see" the holes and keeps only the plate corresponding to your locationInMesh point.
Of course this is a total blind guess as I didn't see your mesh and I have no idea how you defined your blockMesh.

Regards,
Yann
Yann is offline   Reply With Quote

Old   March 29, 2024, 16:36
Default
  #3
New Member
 
Alberto Campuzano
Join Date: Mar 2021
Posts: 14
Rep Power: 5
baezacaljo is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hello,

We will need to have more information to be able to help you.
Check here How to give enough info to get help

Can you show screenshots of the mesh you get?
What is the cell size of your initial mesh (blockMesh) ?

My first thought is that your mesh is too coarse compared to the size of the holes in your plate, so snappy doesn't "see" the holes and keeps only the plate corresponding to your locationInMesh point.
Of course this is a total blind guess as I didn't see your mesh and I have no idea how you defined your blockMesh.

Regards,
Yann

First of all sorry for the late reply, i saw your answer and i decided to take a deeper look at my blockMeshDict. Well in attached file you will see the screen shot of the blockMeshDict, look, (the cells are not highly visible but you will more or less see s simplegrading), such a block belongs just to one plate, exactly at
Code:
locationInMesh (0.0 0.0 -0.00045);
and the rest of the cells were removed, hence i refined everything in blockMeshDict but i notice that 20000000 cells where created, something i didn't expect. Hence, what i did was a
Code:
simpleGrading
and of course the cells were reduced but not too much, also the holes where "considered" but not all of them, this was your idea and it worked. Well i know that i refining the mesh will help, but that will increase the amount of cells considerably. This brings up, three questions.


What can i do in order to get a proper mesh but not having too many cells?.


the inlet and outlet are not considered after performing the snappyHexMesh, just the internal Mesh and of course the plate, do i have to increase a bit the size of the initial mesh?



If a simplification of the geometry is needed, hence ill remove the upper and bottom plates but ill have to consider the upper holes "cylinders" as inlets, (many inlets), and the bottom holes as outlets (many outlets). hence, how to do that? because ill use the solver
Code:
incompressibleVoF
and those inlets will have continuous flow.


Finally you will see the screenshot and also the
Code:
blockMeshdict
Attached Files
File Type: zip info.zip (165.6 KB, 2 views)

Last edited by baezacaljo; March 29, 2024 at 16:43. Reason: Forgot more info
baezacaljo is offline   Reply With Quote

Old   April 2, 2024, 05:04
Default
  #4
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,066
Rep Power: 26
Yann will become famous soon enough
Hello,

It is difficult to see on your screenshot, but snappy often struggles to properly snap to geometry when there is "high" aspect ratio on the cells in the background mesh. It behaves way better with an aspect ratio of 1.
Long and thing geometries like your are always tricky to mesh with snappy due to the way snappy works.

You mentioned blockMesh, but you didn't post your snappyHexMeshDict file. How did you define the surface refinement levels for the holes, inlet and outlet?

Few recommendations :
  • Keep an aspect ratio of 1 for the background mesh in the area of the holes (but this comes with constraints on the overall mesh size)
  • In snappyHexMeshDict, specify surface refinement levels fine enough to properly capture the holes

Regards,
Yann
baezacaljo likes this.
Yann is offline   Reply With Quote

Old   April 12, 2024, 15:05
Default
  #5
New Member
 
Alberto Campuzano
Join Date: Mar 2021
Posts: 14
Rep Power: 5
baezacaljo is on a distinguished road
Quote:
Originally Posted by Yann View Post
Hello,

It is difficult to see on your screenshot, but snappy often struggles to properly snap to geometry when there is "high" aspect ratio on the cells in the background mesh. It behaves way better with an aspect ratio of 1.
Long and thing geometries like your are always tricky to mesh with snappy due to the way snappy works.

You mentioned blockMesh, but you didn't post your snappyHexMeshDict file. How did you define the surface refinement levels for the holes, inlet and outlet?

Few recommendations :
  • Keep an aspect ratio of 1 for the background mesh in the area of the holes (but this comes with constraints on the overall mesh size)
  • In snappyHexMeshDict, specify surface refinement levels fine enough to properly capture the holes

Regards,
Yann

Dear Yann


First of all sorry for the late reply, i have been testing several things on my mesh and geometry



Thank you very much for your help, now everything is getting easier and better, however, after several test as i mentioned before we decide to change to 2D. of course the mesh is easier and faster i even i already did a simulation and everything was as i expected.


After all that, i have a question, look as i already mentioned the geometry will be in 2D hence, i took a "tiny slice" of my geometry because OpenFoam needs 3D, then after performing the
Code:
blockMesh
i got several cell in X and Y direction and just 1 cell in the other direction, which is right because at the end i only want 2D. Then after doing
Code:
snappyHexMesh
i got 2 cells, i dont want that, because my cells increases by double. Hence how to keep 1 cell?. In attached file you will find the blockMeshDict, snappyHexMeshDict, and the geometry


thanks in advance
Attached Files
File Type: zip question.zip (6.2 KB, 2 views)
baezacaljo is offline   Reply With Quote

Old   April 13, 2024, 04:54
Default
  #6
Senior Member
 
Yann
Join Date: Apr 2012
Location: France
Posts: 1,066
Rep Power: 26
Yann will become famous soon enough
Hello Alberto,

You are right, you should keep only one cell in the 3rd direction (and use the empty type on the faces normal to the 3rd direction)

Snappy cannot do that due to the way it refines the cells (octree structure).
However, you can use the extrudeMesh utility to create a one cell thickness mesh from the mesh generated with snappy.

You can type this to get some information and examples:

Code:
foamInfo extrudeMesh
Cheers,
Yann
Yann is offline   Reply With Quote

Reply

Tags
openfoam, snappyhesmesh, snappyhesmeshdict


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
[CAD formats] Creating waterproof STL using snappyHexMesh or salome Tobi OpenFOAM Meshing & Mesh Conversion 58 May 13, 2020 06:01
[snappyHexMesh] Running snappyHexMesh in parallel - optimizing peterhess OpenFOAM Meshing & Mesh Conversion 2 January 3, 2018 02:54
[snappyHexMesh] Tutorial crashes: snappyHexMesh floating point exception. jasv OpenFOAM Meshing & Mesh Conversion 4 May 10, 2016 02:55
Generating a proper STL mesh for snappyHexMesh riccardomaione OpenFOAM Pre-Processing 2 August 25, 2015 02:17
[snappyHexMesh] stitchMesh and snappyHexMesh gdbaldw OpenFOAM Meshing & Mesh Conversion 0 December 23, 2009 02:09


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