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] How to create an O-grid mesh for flow in a pipe using OpenFOAM? (https://www.cfd-online.com/Forums/openfoam-meshing/239244-how-create-o-grid-mesh-flow-pipe-using-openfoam.html)

nepomnyi October 27, 2021 21:51

How to create an O-grid mesh for flow in a pipe using OpenFOAM?
 
Hello dear CFDonline community.


I'm wondering if anybody can tell me, please, how to create an O-grid mesh in OpenFoam (for flow in a circular pipe obviously).


So far, I tried this tutorial. That helped me a lot. I managed to create an O-grid mesh using blockMeshDict. But then I wanted to add inflation layers. I did it via snappyHesMeshDict. And after running it I didn't get inflation layers and got some unstructured mesh closer to the walls instead.


What is the general procedure of getting an O-grid mesh in OpenFOAM?


Thank you in advance.


Ivan



Please see attached picture: I want to get the same thing in OpenFOAM.
https://external-content.duckduckgo....3F1&f=1&nofb=1

Daniel_C October 28, 2021 04:01

2 Attachment(s)
Hallo Ivan,

I highly suggest you to have a look at blender and the swiftBlock add-on. It gave me gave nice Hexa meshes. As you can see from an early attempt with an airfoil, it does its job pretty well. It is knda ICEM, and comparable in usage. And most important, it is totally free to use!

swiftBlock

swiftblock.readthedocs.io/en/latest/

blender
http://www.blender.org/

Greetings

Daniel


PS: Don't judge the mesh, I canceled work on it because I just wanted a quick look inside the tool. :-)

nepomnyi October 28, 2021 11:13

Quote:

Originally Posted by Daniel_C (Post 815266)
Hallo Ivan,

I highly suggest you to have a look at blender and the swiftBlock add-on. It gave me gave nice Hexa meshes. As you can see from an early attempt with an airfoil, it does its job pretty well. It is knda ICEM, and comparable in usage. And most important, it is totally free to use!

swiftBlock

swiftblock.readthedocs.io/en/latest/

blender
http://www.blender.org/

Greetings

Daniel


PS: Don't judge the mesh, I canceled work on it because I just wanted a quick look inside the tool. :-)


Thank you Daniel.
I know about Blender. I even have SpaceClaim which can do the job exceptionally well.
But I, specifically, want to know how to do it using OpenFOAM native tools.
In other words, the goal behind my question is not to do the job quickly by any means, but rather learn how to do it in OpenFOAM.

Ivan

linnemann October 28, 2021 15:04

1 Attachment(s)
Hi


This is just my personal oppinon so take is as you want.


Dont spend too much time learning how to use Blockmesh unless is some very niche cases.


As soon as you go into industry (expect you will) you wont have time to deal with the perfect mesh every time. Then you start looking into trends of design changes and will only deep dive into the setup to make sorta sure that you follow best practice guidelines.


Learn automated meshing strategies to make rapid design changes and optimization loops. Here is a small comparison for builtin meshers for OpenFOAM https://www.cfd-online.com/Forums/op...trategies.html


Would also advice you to learn how to use Salome as it is a very powerfull tool for making simple meshes and surface STL files for OpenFOAM.


I can do what you want in Salome in about 10min but would probably use cfmesh if I were to thoose the mesher.

Daniel_C October 29, 2021 07:53

Hallo Ivan,

well if you already know how to use blender, then siftBlock Add-on is your friend :-)

It generates native openFoam blockMesh dictionary, that you can study and learn from. Beside SALOME tool, that is all I know, how to generate HEXA mesh within openFoam environment.

Greetings

Daniel

nepomnyi November 26, 2021 19:06

Thank you @Daniel_C and @linnemann.


To sum up, I did my best trying to make blockMesh and snappyHexMesh give me what I need and I failed. I can make nice inflation layers (i.e. those expanding circles at the boundary) with unstructured mesh in the middle or I can make the structured block mesh that I showed in my question but without the inflation layers. For the life of me, I can't figure out how to make both inflation layers and the structured block mesh that I showed in my original question.


Therefore, at this point I conclude that it is impossible to do what I want using OpenFOAM native tools (which I regret a lot because I hate learning new GUIs and like very much the programmatic approach to meshing used in blockMesh).


But I still have to do the job.


I tried Blender with that add-on suggested by Daniel_C and I didn't like it at the first glance.


Then I moved to cfmesh. Didn't work for me as well. That's because cfmesh comes with the openfoam.com. But I use openfoam.org. And it turned out to be a great pain to integrate it with my OpenFOAM.



And then I moved to SALOME. I liked it more than Blender at the first glance because its GUI looks like any other GUI of any other piece of CAD software. I found this tutorial showing how to make structured mesh in SALOME. But even with the help of that tutorial I failed to generate the mesh I wanted. Primarily because I didn't figure out how to create those planes when I didn't have that cube around my pipe.


Therefore, in order to close my question I'm wondering if you @linnemann can be so kind to share the way you created the block mesh please. I don't need the cross, just a circular pipe.


Thank you in advance.


Ivan

olesen November 27, 2021 05:44

Quote:

Originally Posted by nepomnyi (Post 817458)
Then I moved to cfmesh. Didn't work for me as well. That's because cfmesh comes with the openfoam.com. But I use openfoam.org. And it turned out to be a great pain to integrate it with my OpenFOAM.

I won't bother with why you use openfoam.org, but you should keep in mind that there are still a variety of ways that you can integrate openfoam.com and cfmesh into your workflow (depending on your system). If you are using fedora/centos/opensuse/ubuntu you can quickly install the latest (currently openfoam2106) packages. Once they are installed, can simply use the included shell session to fire off a single command without additional sourcing etc.
Another alternative could be the dockerized version of openfoam2106, which also includes cfmesh and can also be used to fire off a single command.

nepomnyi July 15, 2022 17:04

How to do it in Salome
 
I figured out how to do what I want in Salome (in case anybody is interested).


You can do it two ways:
  1. draw the cylinder first and mesh it afterwards,
  2. draw the base of the cylinder, mesh it and extrude the mesh (this one's nice).
Now let's see how to do each one of those.
  1. For the first method, you'll need two tutorials. First, use this tutorial to create a cylinder (first draw a sketch of a circle with the O-grid pattern in it, then extrude it to get the cylinder). Then use this tutorial to create a mesh. Note the issue Cyprien is talking about starting the 9th minute. He found a way around, but, actually, Salome has an option to delete that extra edge. That option is implemented in the Geometry module, the Shaper module doesn't have it. Therefore, if you followed the first video to create the cylinder and you used the Shaper module, you'll have to convert your Shaper study to Geometry study first. To do the conversion, left click once on your part in the tree to highlight it. Then go to Features->export to GEOM. Then activate the Geometry module. Left click once on the name of your part in the tree (or on the name of the partition if you used partitions like Cyprien did). Then go to Repair->remove extra edges.Then you can proceed with meshing.
  2. For the second method, you'll have to register on the Salome's forum and read this post. If the link doesn't work, then log in to your account on the Salome's forum and find the post by its name: "Generating o type grid by Salome". The post was created by Isaiah on the 19th of June, 2022. You can find the main response and my clarifying remarks there.

nepomnyi September 1, 2022 12:55

Actually, my guide on how to do it in Salome is not complete and leaves some unanswered questions.


Here's the better post to read if you want to learn how to do the O-grid mesh in Salome. That's Salome's forum. A really good forum. I highly recommend it for any Salome related questions.


And to complete the answer, see this tutorial (starting the 18:54min) on how to export the mesh to OpenFOAM from Salome.

nepomnyi September 2, 2022 12:34

Quote:

Originally Posted by nepomnyi (Post 817458)
To sum up, I did my best trying to make blockMesh and snappyHexMesh give me what I need and I failed. I can make nice inflation layers (i.e. those expanding circles at the boundary) with unstructured mesh in the middle or I can make the structured block mesh that I showed in my question but without the inflation layers. For the life of me, I can't figure out how to make both inflation layers and the structured block mesh that I showed in my original question.


Therefore, at this point I conclude that it is impossible to do what I want using OpenFOAM native tools (which I regret a lot because I hate learning new GUIs and like very much the programmatic approach to meshing used in blockMesh).


Turns out, I was wrong. One can do that in OpenFOAM blockMesh! The solution is offered by the awesome folks from Wolf Dynamics. Here's their awesome presentation on how to do O-grid mesh in a round pipe (see the last slides). Even though inflation layers are not implemented there, they say one can change mesh stretching to get more cells close to the wall. That will look like an inflation layer (like the one I posted the picture of in my question). I'm going to play with that and I'm going to post the detailed guide here once I'm done. Huge thank you to Wolf Dynamics!

Teresa.Z July 12, 2023 17:39

Quote:

Originally Posted by linnemann (Post 815313)
Hi


This is just my personal oppinon so take is as you want.


Dont spend too much time learning how to use Blockmesh unless is some very niche cases.


As soon as you go into industry (expect you will) you wont have time to deal with the perfect mesh every time. Then you start looking into trends of design changes and will only deep dive into the setup to make sorta sure that you follow best practice guidelines.


Learn automated meshing strategies to make rapid design changes and optimization loops. Here is a small comparison for builtin meshers for OpenFOAM https://www.cfd-online.com/Forums/op...trategies.html


Would also advice you to learn how to use Salome as it is a very powerfull tool for making simple meshes and surface STL files for OpenFOAM.


I can do what you want in Salome in about 10min but would probably use cfmesh if I were to thoose the mesher.

@linnemann and @nepomnyi,

thanks for sharing your knowledge on mesh generation. Based on your discussion, I can create O-grid mesh for one pipe with Salome and blockMesh. But I'm stuck on how to do it for T-connecting pipes. If I saw it correctly, linnermann already achieved it with Salome. Could you give me some advice? Thanks in advance.

Teresa


All times are GMT -4. The time now is 23:51.