External meshers using

A subforum specific to the development of the OpenFoam-based workbenches ( Cfd https://github.com/qingfengxia/Cfd and CfdOF https://github.com/jaheyns/CfdOF )

Moderator: oliveroxtoby

Post Reply
TechnoOwl
Posts: 1
Joined: Sun Mar 20, 2022 6:34 am

External meshers using

Post by TechnoOwl »

Hello everyone!
Is there any way to use external meshers for CFD OF workbench?
Let me explain. I’m just a beginner in FreeCAD and CFD OF. For educational purposes I created a simple air bearing model to simulate air flow in the 0.1 gap between shaft and bush. My problem is: none of built-in meshers can create a proper mesh. Either it creates a broken mesh (in case when cell size is big), or it runs into infinite loop – 2.5 hours – no result (when cell size is 0.05 mm).
I installed standalone mesher – Netgen 6.2, which is perfect for my purposes. Fully automatically it rapidly creates optimized refined mesh. Here starts the trouble – I’m not able to use this perfect mesh. I tried simply replacing the broken mesh in the mesh case with the proper one (remember, I’m just a beginner and not able to use “raw” OpenFoam without GUI). And FreeCAD even was able to load the proper mesh in the view. But the solver can’t use it and stops.
I’m attaching my FreeCAD container. The Forum engine doesn't allow me to attach the mesh, generated with Netgen, as it's too big. Here's the link to the cloud: https://drive.google.com/file/d/14wac-q ... sp=sharing
Attachments
Air bearing design.FCStd
(160.19 KiB) Downloaded 18 times
User avatar
oliveroxtoby
Posts: 629
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: External meshers using

Post by oliveroxtoby »

TechnoOwl wrote: Sun Mar 20, 2022 6:58 am Hello everyone!
Is there any way to use external meshers for CFD OF workbench?
Unfortunately this isn't possible at the moment (unless you start using OpenFOAM utilities directly on the case). Adding an interface to Netgen may be a good idea but isn't a trivial job.
KAKM
Posts: 80
Joined: Tue May 04, 2021 12:17 am

Re: External meshers using

Post by KAKM »

oliveroxtoby wrote: Sun Mar 20, 2022 7:40 pm unless you start using OpenFOAM utilities directly on the case
As far as I can tell, there isn't an up-to-date "NetgenToFoam" function, but there are ones for Fluent/.msh, STAR-CD/Prostar, GAMBIT/.neu, IDEAS/.ans, and CFX/.geo. How hard do you think it would be to incorporate the existing OpenFOAM mesh conversion functions? It seems to me like I could just add a Qt panel somewhere and have some form of "Convert mesh" button hooked up to a line of bash–is there something about the way CfdOF works that would make that trickier than it seems?
User avatar
oliveroxtoby
Posts: 629
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: External meshers using

Post by oliveroxtoby »

KAKM wrote: Tue Mar 22, 2022 6:14 am How hard do you think it would be to incorporate the existing OpenFOAM mesh conversion functions? It seems to me like I could just add a Qt panel somewhere and have some form of "Convert mesh" button hooked up to a line of bash–is there something about the way CfdOF works that would make that trickier than it seems?
It would be great to have that as an option. The only complication I can think of would be defining the boundary conditions on the imported mesh. I think this could be achieved by outputting the surface .stl files as is currenty done when meshing with cfMesh or snappyHexMesh, and then running the surfaceToPatch utility to redefine the boundary patches of the imported mesh.

On the subject, it would also be nice to be able to import meshes from the FEM workbench. If I recall correctly, Qingfeng's original CFD workbench actually used (uses?) FEM functions for its meshing, outputting to .unv files which were then converted using unvToFoam. So a similar approach to the above could be followed. In case you have the energy!
User avatar
oliveroxtoby
Posts: 629
Joined: Fri Dec 23, 2016 9:43 am
Location: South Africa

Re: External meshers using

Post by oliveroxtoby »

oliveroxtoby wrote: Tue Mar 22, 2022 7:50 pm
KAKM wrote: Tue Mar 22, 2022 6:14 am How hard do you think it would be to incorporate the existing OpenFOAM mesh conversion functions? It seems to me like I could just add a Qt panel somewhere and have some form of "Convert mesh" button hooked up to a line of bash–is there something about the way CfdOF works that would make that trickier than it seems?
It would be great to have that as an option. The only complication I can think of would be defining the boundary conditions on the imported mesh. I think this could be achieved by outputting the surface .stl files as is currenty done when meshing with cfMesh or snappyHexMesh, and then running the surfaceToPatch utility to redefine the boundary patches of the imported mesh.
I was talking nonsense here - of course, for an imported mesh you probably don't have the geometry already; the mesh should define the geometry. One would want to be able to link up the boundary conditions to the pre-existing patches on the mesh, so we would need to add this as an option to the boundary conditions. i.e., for an imported mesh, you should be able to choose patch names in the BCs rather than them being matched to shapes.
Post Reply