CFD Online Discussion Forums

CFD Online Discussion Forums (
-   OpenFOAM Meshing & Mesh Conversion (
-   -   blockMeshDict (

Ruehri January 27, 2012 18:07

Dear Foamers,

I have an OpenFOAM mesh (polyMesh folder) which was created by another department. Unfortunately that mesh-file got lost and all I have left is the OpenFOAM mesh, in which I would like to introduce some changes. It would be possible to simply edit some coordinates if I had a blockMeshDict file, so my question is if there is a way to convert a polyMesh mesh back into a blockMeshDict file?


wyldckat January 28, 2012 04:19

Greetings Ruehri,

AFAIK, there is no automated way to convert an already generated mesh back to "blockMeshDict". You might be able to re-create it manually, if the mesh is simple enough.

By what I know, you have a few possibilities:
  1. You can extract the surface mesh, manipulate it a proper geometry editing tool and then generate a new mesh based on the previous mesh. For example:
    1. Code:

      foamToSurface -time 0 test.a
      This command will show you the supported file extensions. For me, with OpenFOAM 2.1.x, it gave:

      Valid types: ( ac gts inp obj off ofs smesh stl stlb tri vtk wrl x3d )
    2. If for example, I needed to do this, I would export to STL:

      foamToSurface -time 0 test.stl
      And manipulate the surface using Blender.
    3. Then I would do a new mesh using enGrid or snappyHexMesh.
  2. If you only need to either remove parts of the mesh or add more refinement in certain zones, then you can use setSet and refineMesh.
Best regards,

akidess January 29, 2012 08:15

Is foamMeshToFluent of any use?

Ruehri January 30, 2012 10:50

Thanks a lot you two for the quick response!

Since the mesh already has its own refinements and grid density distributions, using a stl would result in a lot of workload, but I agree that this could be a good way for creating a suitable new mesh.

I just tried the foamMeshToFluent tool and everything looks awesome. I got some error warnings about cell shapes needing to be converted to polyhedrals, but the mesh looks good.
I will try to convert that mesh back into foam (unmodified) and see if anything got messed up during forth-and-back conversion. If yes, I will switch over and do the diligence work with stls, otherwise I'd be happy to use akidess solution.

Anyways thanks you two!

Ruehri February 7, 2012 19:18

Just to report back, foamMeshToFluent worked for my case. There seemed to be some weirdly shaped cells when I inspected the mesh manually in paraFoam, but those were in a rather coarse region and rerunning after back-conversion yielded the same result. Thanks again for all the help!

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