feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

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

User avatar
bernd
Posts: 7049
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby bernd » Thu Aug 23, 2018 11:49 am

cool

BTW: does blockMeshDict really have not file extension at all?
Jee-Bee
Posts: 1615
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby Jee-Bee » Thu Aug 23, 2018 12:11 pm

don't know if it's handy but i found this: https://openfoamwiki.net/index.php/BlockMesh
thschrader
Posts: 1365
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby thschrader » Thu Aug 23, 2018 2:46 pm

My 2 cent...
After running blockmesh with bluecfd-core console:
Load mesh (blockmesh.pvsm) in paraview (use „file/load state“).
I tried to export a FC-usable fem mesh from paraview. The only what
I get in the end is the surface mesh display in fem-pipeline. The imported „mesh“
was scaled down by a factor of 1000.

@bernd:
In openfoam, there is a command (ideasUnvToFoam) for transforming
a unv-mesh to openfoam polymesh, but not reverse. (or have I something overlooked...)

BlockMeshDict line 17, convertToMeters:
this is a scaling factor. The x/y/z coordinates of the vertices are given in meters.
In reality, the body is only 30 cm long.

BlockmeshDict: vertices which have y=0 coordinate are not necessary to
construct the flow-domain. They are helping points inside the volume for mesh-refinement.
BlockMeshdict lines 85 ff: commands for mesh-refinement.

It should be easier to reconstruct a mesh from the point-file in polymesh folder.
For description of polymesh please see openfoam user guide page 139.
http://foam.sourceforge.net/docs/Guides ... ide-A4.pdf

Very useful tutorial how to use the blockMesh dict:
https://www.youtube.com/watch?v=Ds0eK1wXMks

I ran the pitzdaily-test case in cfd-wb using cf-mesh. Instead of snappyhexmesh,
cfmesh uses no background mesh (the blockmesh).

The zip contains the paraview/Freecad files and the openfoam polymeshes
after running blockmesh/cfmesh.
upload_FC.7z
(829.44 KiB) Downloaded 3 times
blockmesh_paraview.JPG
blockmesh_paraview.JPG (212.64 KiB) Viewed 349 times
blockmesh_FC.JPG
blockmesh_FC.JPG (86.19 KiB) Viewed 349 times
foadsf
Posts: 25
Joined: Fri Mar 06, 2015 10:02 pm

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby foadsf » Thu Aug 23, 2018 2:53 pm

Jee-Bee wrote:
Thu Aug 23, 2018 12:11 pm
don't know if it's handy but i found this: https://openfoamwiki.net/index.php/BlockMesh
If look for FreeCAD, we are already mentioned there :D
foadsf
Posts: 25
Joined: Fri Mar 06, 2015 10:02 pm

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby foadsf » Thu Aug 23, 2018 2:55 pm

thschrader wrote:
Thu Aug 23, 2018 2:46 pm
My 2 cent...
After running blockmesh with bluecfd-core console:
Load mesh (blockmesh.pvsm) in paraview (use „file/load state“).
I tried to export a FC-usable fem mesh from paraview. The only what
I get in the end is the surface mesh display in fem-pipeline. The imported „mesh“
was scaled down by a factor of 1000.
The whole point of this idea is to be able to debug the controlMeshDict file without generating the mesh.
foadsf
Posts: 25
Joined: Fri Mar 06, 2015 10:02 pm

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby foadsf » Thu Aug 23, 2018 2:56 pm

bernd wrote:
Thu Aug 23, 2018 11:49 am
cool

BTW: does blockMeshDict really have not file extension at all?
It doesn't. OpenFOAM is freaking weird!
thschrader
Posts: 1365
Joined: Sat May 20, 2017 12:06 pm
Location: Germany

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby thschrader » Thu Aug 23, 2018 3:36 pm

foadsf wrote:
Thu Aug 23, 2018 2:55 pm
The whole point of this idea is to be able to debug the controlMeshDict file without generating the mesh.
Can you post a controlMeshdict?
In my tutorials (I use bluecfd-core 2017-2) is not one...
Isnt the information in blockMeshDict enough to reconstruct a mesh?
The cfd-wb in FC writes the case-files automatically. When having
complex geometries, this saves a lot of work. Try to write a blockMeshdict
by hand for a H-beam with holes... :)
foadsf
Posts: 25
Joined: Fri Mar 06, 2015 10:02 pm

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby foadsf » Thu Aug 23, 2018 3:47 pm

thschrader wrote:
Thu Aug 23, 2018 3:36 pm
Can you post a controlMeshdict?
In my tutorials (I use bluecfd-core 2017-2) is not one...
Every example must have a blockMeshDict file, unless external programs like Gmsh has been used for mesh generation. The file should be found in the case folder under system folder. Here in this GitGub Gist I have provided the latest version of the script, plus a sample blockMeshDict file (worse case scenario), plus other information.
thschrader wrote:
Thu Aug 23, 2018 3:36 pm
Isnt the information in blockMeshDict enough to reconstruct a mesh?
Ideally yes, except writing a huge file representing a complicated geometry is very intuitive and many people, including me, have problems. There not many tools available to debug the file.
thschrader wrote:
Thu Aug 23, 2018 3:36 pm
The cfd-wb in FC writes the case-files automatically. When having
complex geometries, this saves a lot of work. Try to write a blockMeshdict
by hand for a H-beam with holes... :)
Would you please elaborate on this?
User avatar
oliveroxtoby
Posts: 219
Joined: Fri Dec 23, 2016 9:43 am

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby oliveroxtoby » Thu Aug 23, 2018 4:06 pm

Just to give my perspective. OpenFOAM also includes snappyHexMesh, which is a cut-cell cartesian mesher that is better suited to complex or dirty geometries. cfMesh is an alternative, and CfdOF supports both snappy and cfMesh's cut-cell cartesian mesher. Our focus is more towards hands-off, more automated tools.

That said, blockMesh certainly has its place, and it's possible to create incredibly beautiful and high quality structured meshes with it, and with a lot of work one can go to surprisingly complex geometries. For that, one can't really do without a tool like the one being discussed here. These structured meshes have the potential to yield a more accurate solution due to better quality cells and more gradual gradations between cell sizes. The investment in time is usually only worth it if one is doing a lot of analyses on the same mesh (rather than using the brute-force approach of increasing the refinement level of a less labour-intensive mesher), but it certainly has its uses.
foadsf
Posts: 25
Joined: Fri Mar 06, 2015 10:02 pm

Re: feature request: Viewing and editing OpenFOAM blockMeshDict in FreeCAD?

Postby foadsf » Wed Aug 29, 2018 11:56 pm

Guys, is there any chance we can move this thread to the CFD CfdOF forum? They are already working on an penFOAM-FreeCAD integration!