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

[snappyHexMesh] snappyHexMesh 2D axisymmetric

Register Blogs Community New Posts Updated Threads Search

Like Tree1Likes
  • 1 Post By Flowkersma

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 17, 2020, 10:10
Question snappyHexMesh 2D axisymmetric
  #1
Member
 
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 8
JM27 is on a distinguished road
Hi,

I have created a 2D axisymmetric wedge and meshed it using blockMesh. The result is a uniform mesh having one cell thickness.
The problem is that I have two parallel wall boundaries in my setup (imagine a gap or channel) and I would like to refine the cells in the near-wall regions so I can calculate the wall shear stress. Ideally, I would like to control the height of the first cell next to the wall.

I have looked at the snappyHexMesh setup and there is an option to refine the mesh, however this divides each cell into 2^3 = 8 cells. This is a problem for my setup as I need my wedge to be only 1 cell thick.

Can anyone confirm whether this can be done in snappyHexMesh and how?
If not, what other utilities in OpenFOAM can I use to refine the wall region e.g. refineWallLayer utility?

It would be great if someone can point me in the right direction
JM27 is offline   Reply With Quote

Old   April 20, 2020, 03:25
Default
  #2
Senior Member
 
Gerhard Holzinger
Join Date: Feb 2012
Location: Austria
Posts: 339
Rep Power: 28
GerhardHolzinger will become famous soon enoughGerhardHolzinger will become famous soon enough
There is no way to create a 2D mesh using snappyHexMesh alone, since it cuts cells in all three spatial directions.

However, just proceed as if this was not the case. Since you need a 2D mesh, you can create one again from the front or back patch of your mesh.

Thus, follow this rough workflow.

* Create your back-ground mesh using blockMesh, in your case this would be the 2D wedge.
* Perform all the refinements using snappy; do not care about the mesh becoming 3D.
* extrude the front or back patch of the mesh, and discard the old mesh

Attached, you find a 2D "cylinder in cross-flow mesh" which was created using blockMesh, snappyHexHesh and extrudeMesh.
Attached Images
File Type: jpg snappy2Dmesh.jpg (88.1 KB, 122 views)
GerhardHolzinger is offline   Reply With Quote

Old   April 20, 2020, 15:00
Default
  #3
Member
 
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 8
JM27 is on a distinguished road
Hi Gerhard,

Thank you for the reply and the suggestion.

With your guidance I have a better idea of how this can be done using extrudeMesh now, but I am having a bit of a problem with snappyHexMesh.
1. The user guide only describes setup for an external flow, whereas in my case flow through the channel is internal flow, and I do not need to 'remove' any cells.

2. Furthermore, I have created my 2D wedge using blockMesh, so I'm not sure what I should specify as a triSurface and how to create a .stl file of my blockMesh geometry.
Do you have any tips with regards to this?
JM27 is offline   Reply With Quote

Old   April 21, 2020, 02:11
Default
  #4
Senior Member
 
linnemann's Avatar
 
Niels Nielsen
Join Date: Mar 2009
Location: NJ - Denmark
Posts: 555
Rep Power: 27
linnemann will become famous soon enough
Hi

For such a "simple" case I would go with Salome instead.

There you can mesh it in 2D and control the boundary layers and then revolve the mesh by 1 in thickness.
Attached Images
File Type: jpg salome.jpg (200.0 KB, 71 views)
Attached Files
File Type: txt 2DTest.hdf.txt (142.4 KB, 22 views)
__________________
Linnemann

PS. I do not do personal support, so please post in the forums.
linnemann is offline   Reply With Quote

Old   April 21, 2020, 03:23
Default
  #5
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 12
Flowkersma is on a distinguished road
Hi,

If you want to create a simple rectangular mesh with boundary layer refinements, it is easy with blockMesh and you don't need snappyHexMesh. Look 5.3.1.4 Multi-grading of a block
here
. SnappyHexMesh you will need if you want to add complex obstacles in the channel. Then you cut these obstacles out of the channel mesh.

Best, Mikko
Flowkersma is offline   Reply With Quote

Old   April 21, 2020, 05:32
Default
  #6
Member
 
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 8
JM27 is on a distinguished road
Hi all,

Thanks for the replies.

I have made some progress with regards to generating a .stl file of my blockMesh geometry by using the OpenFOAM utility surfaceMeshTriangulate that extracts a surface from the polyMesh.

@ linnemann: I have never used Salome before so I feel that the effort in figuring that out would be similar to understanding sHM.

@ flowkersma/Mikko: I have tried using multi-grading of a block in the past but I was under the impression that snappyHexMesh would provide more control of the boundary layer refinement (e.g. boundary layer thickness, first cell thickness, expansion ratios etc.), although of course more effort and more expensive than blockMesh. In blockMesh there are only a few controls, but perhaps they are the essentials.

Furthermore, I'm following a paper in which 'the initial grid is successively refined 5 times with further refinement near the walls', so that hinted towards sHM. Perhaps I'm misunderstanding this successive refinement? It's straightforward to refine in blockMesh but of course it would not be automated...
JM27 is offline   Reply With Quote

Old   April 21, 2020, 06:05
Default
  #7
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 12
Flowkersma is on a distinguished road
With blockMesh you have much more control over the refinements than with snappyHexMesh. You can control the first cell size, the expansion ratio and the boundary layer thickness. Actually, some years ago I made a video to show the (then new) multi-grading feature of blockMesh. SwiftBlock is merely a GUI for blockMesh.

SnappyHexMesh should be used for complex geometries but blockMesh is better for simple geometries because you have much more control of your mesh and less automagic things happening.
Flowkersma is offline   Reply With Quote

Old   April 22, 2020, 06:04
Default
  #8
Member
 
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 8
JM27 is on a distinguished road
Hi Flowkersma,

Thanks for the quick reply and for sharing the video. I had a second look at multigrading and it seems this is the most convenient option

The remaining issue is how to control the various sizes in my mesh. I have found this blockMesh grading calculator on the wiki https://openfoamwiki.net/index.php/S...ng_calculation which is helpful. But I'd like to know how the various parameters are calculated e.g. total expansion ratio, number of cells, cell to cell expansion ratio. The user-guide only seems to provide that the expansion ratio is the size of the last cell to the first cell but not how this varies based on the number of cells...

Do you happen to know how these are calculated or a source that explains this?

Thanks!
JM27 is offline   Reply With Quote

Old   April 22, 2020, 07:54
Default
  #9
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 12
Flowkersma is on a distinguished road
Hi,

BlockMesh uses geometric series for the grading which is commonly used for boundary layer meshes. Expansion ratio can be determined from this simple equation:
y_N/y_0 = r^N
where y_N/y_0 is the ratio between the last and the first cell, r is the expansion ratio and N is the number of cells.

The length of the BL mesh is given by:
L=y_0 \frac{1-r^N}{1-r}
Flowkersma is offline   Reply With Quote

Old   April 24, 2020, 05:05
Default
  #10
Member
 
Join Date: Apr 2018
Location: UK
Posts: 78
Rep Power: 8
JM27 is on a distinguished road
Hi Flowkersma,

Thanks for the equations. I have compared this to the results from the grading calculator on the Wiki several times and they are slightly off, e.g. number of cells is off by about 3 cells...

Could you perhaps direct me to a reference for these equations so I can look into it further?
JM27 is offline   Reply With Quote

Old   April 24, 2020, 05:09
Default
  #11
Senior Member
 
Mikko
Join Date: Jul 2014
Location: The Hague, The Netherlands
Posts: 243
Rep Power: 12
Flowkersma is on a distinguished road
https://en.wikipedia.org/wiki/Geometric_series
JM27 likes this.
Flowkersma is offline   Reply With Quote

Reply

Tags
refinement, snappyhexmesh, wall


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
snappyHexMesh axisymmetric multiRegion Henning86 OpenFOAM Running, Solving & CFD 0 October 23, 2014 12:05
[snappyHexMesh] stitchMesh and snappyHexMesh gdbaldw OpenFOAM Meshing & Mesh Conversion 0 December 23, 2009 02:09


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