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/)
-   -   [Commercial meshers] Conversion of OpenFoam mesh to .msh (https://www.cfd-online.com/Forums/openfoam-meshing/213941-conversion-openfoam-mesh-msh.html)

Srinath Reddy January 14, 2019 05:43

Conversion of OpenFoam mesh to .msh
 
Hi,

I want to convert foam mesh to Fluent. Is there any Utility? I Have tried foamMeshTofluent but it improting my block mesh but not the main geometry.

Can any one have an Idea?

thank you

simrego January 14, 2019 09:22

Hi!


You can export it to EnSight ("foamToEnsight") and you can import EnSight into fluent.

ICS January 14, 2019 12:19

Ensight Mesh Precision
 
I'm working on a case with a very high mesh aspect ratio (I need to solve the boundary layer for a supersonic flow). Hence, I need to increase the writing precision for the "geometry" file when I use the application foamToEnsightParts... the default result using the -ascii option is scientific notation with 5 decimals and that's not enougth for me.
Changing the controlDict writePrecision doesn't help, neither the foamToEnsightParts -width option... Any ideas how to do that?

Srinath Reddy January 15, 2019 06:20

Hello Simrego!!!

thank you for the Information... it actually worked, but I am facing same Problem. it just improting my blockMesh. Have any idea how to do it so that i could get 3D geometry?

ICS January 23, 2019 08:34

Ensight mesh precision
 
After a lot of work, here are some conclusions I came with:

1 - I managed to improve the precision of the geometry files generated by foamMeshToEnsight and foamMeshToEnsightParts. I did it by changing some parameters on both applications files and compiling again with wmake. But I found out that It was in vain, since Ensight geometry files must be written on 12.5e format (scientific notation with 5 decimal places) according to http://www3.ensight.com/EnSight92_Docs/UserManual.pdf... So I gor error messages when I tried to import into Fluent... :(

2 - The foamMeshToFluent combine all cell zones into one internal fluid region... but my case must have distinct cell zones since I'm modelling fluid-solid interation... the default precision of the generated .msh file is scientific notation with 10 decimal places. If you need to improve that just change "fluentMeshFile.precision(10);" on the fluentFvMesh.C file and compile with wmake.

3 - The best solution I got was:
a) use the splitMeshRegions -cellzones -overwrite in order to generate polyMesh files for each cell zone (my original mesh was generated on SALOME and imported using ideasUnvToFoam).
b) copy the polyMesh folder generated for each cell zone to the constant directory (substituting the original polyMesh folder).
c) use the foamMeshToFLuent to generate the .msh file for each cell zone once at a time and save them with diferent names.
d) open Fluent, read one .msh file and load the other ones by using the append option (see https://www.sharcnet.ca/Software/Flu...ug/node171.htm)
e) for each interface between cell zones use the combine/fuse option.

It's quite some work, but it's a solution for converting OpenFoam mesh with multiple cell zones into fluent and preserve the precision.

simrego January 23, 2019 08:59

Quote:

Originally Posted by Srinath Reddy (Post 721989)
Hello Simrego!!!

thank you for the Information... it actually worked, but I am facing same Problem. it just improting my blockMesh. Have any idea how to do it so that i could get 3D geometry?




Hi!


Sorry, but i don't know what do you mean exactly under 3D geometry. You need the mesh or the geometry itself? If you need the geometry you can use the surfaceMeshTriangulate utility to export your surface mesh as an stl file. I don't think if there are any another way to export the geometry. And also not clear for me why do you have to export the geometry.

DaveD! January 11, 2021 12:10

Quote:

Originally Posted by ICS (Post 722715)
After a lot of work, here are some conclusions I came with:

1 - I managed to improve the precision of the geometry files generated by foamMeshToEnsight and foamMeshToEnsightParts. I did it by changing some parameters on both applications files and compiling again with wmake. But I found out that It was in vain, since Ensight geometry files must be written on 12.5e format (scientific notation with 5 decimal places) according to http://www3.ensight.com/EnSight92_Docs/UserManual.pdf... So I gor error messages when I tried to import into Fluent... :(

2 - The foamMeshToFluent combine all cell zones into one internal fluid region... but my case must have distinct cell zones since I'm modelling fluid-solid interation... the default precision of the generated .msh file is scientific notation with 10 decimal places. If you need to improve that just change "fluentMeshFile.precision(10);" on the fluentFvMesh.C file and compile with wmake.

3 - The best solution I got was:
a) use the splitMeshRegions -cellzones -overwrite in order to generate polyMesh files for each cell zone (my original mesh was generated on SALOME and imported using ideasUnvToFoam).
b) copy the polyMesh folder generated for each cell zone to the constant directory (substituting the original polyMesh folder).
c) use the foamMeshToFLuent to generate the .msh file for each cell zone once at a time and save them with diferent names.
d) open Fluent, read one .msh file and load the other ones by using the append option (see https://www.sharcnet.ca/Software/Flu...ug/node171.htm)
e) for each interface between cell zones use the combine/fuse option.

It's quite some work, but it's a solution for converting OpenFoam mesh with multiple cell zones into fluent and preserve the precision.


Realizing ICS's answer #3 a-c, here is a code that does the job (exporting each cell zone as separate msh-file):


Code:



#!/bin/bash
. $WM_PROJECT_DIR/bin/tools/RunFunctions


runApplication splitMeshRegions -cellZones -overwrite


mv constant/polyMesh constant/polyMesh.bak
for folder in constant/*/polyMesh/
do
    regionName=$(echo $folder | cut -d '/' -f2)
    echo "Exporting cell zone $regionName"
    cp -r $folder constant
    foamMeshToFluent >> log.foamMeshToFluent
    mv fluentInterface/OF1912.msh  fluentInterface/$regionName.msh
done
mv constant/polyMesh.bak constant/polyMesh



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