CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [snappyHexMesh] snappyHexMesh 2D axisymmetric (https://www.cfd-online.com/Forums/openfoam-meshing/226105-snappyhexmesh-2d-axisymmetric.html)

JM27 April 17, 2020 10:10

snappyHexMesh 2D axisymmetric
 
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

GerhardHolzinger April 20, 2020 03:25

1 Attachment(s)
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.

JM27 April 20, 2020 15:00

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?

linnemann April 21, 2020 02:11

2 Attachment(s)
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.

Flowkersma April 21, 2020 03:23

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

JM27 April 21, 2020 05:32

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?:confused: It's straightforward to refine in blockMesh but of course it would not be automated...

Flowkersma April 21, 2020 06:05

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.

JM27 April 22, 2020 06:04

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!

Flowkersma April 22, 2020 07:54

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}

JM27 April 24, 2020 05:05

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?

Flowkersma April 24, 2020 05:09

https://en.wikipedia.org/wiki/Geometric_series


All times are GMT -4. The time now is 15:13.