Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Questions and remarks about code_saturne usage
Forum rules
Please read the forum usage recommendations before posting.
finzeo
Posts: 53
Joined: Fri Sep 09, 2022 4:23 pm

Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by finzeo »

Hi all,

Until recently, I was able to use meshes created in OF 7 (blockMesh + snappy) in Code_Saturne v7.2.0 using the foamMeshToMED utility compiled for OF 4, but working for OF 7. Due to difficulties and wanting to take advantage of the possibilities of the com version, I switched from OF 7 to OF 1812 and later (specifically, because I wanted to use the displacementMotionSolver algorithm for addLayers, only available in the com version). But by doing this, the foamMeshToMED utility is giving me problems (specifically, topology problems that occur during the run in CS, whereas with checkMesh it doesn't throw any errors). I'm attaching the preprocessor.log file.
The specific question is whether you know of any tools to convert an OF mesh to any of the following formats compatible with CS:
  • .case (Ensight) (I already tried this, and as I see this forums, it doesn't copy the patches)
  • .ccm (Star-CCM+) (I couldn't export the mesh as .ccm, but I could with .ccmg, but the latter is not recognized by CS)
  • .cgns
  • .des (Simail NOPO)
  • .med
  • .msh (Gmsh)
  • .neu (GAMBIT neutral)
  • .unv (I-deas universal)
I know there are posts related to this previously, but they are a bit old and maybe there is something new and/or useful for this particular request.

Thank you very much in advance.
Attachments
preprocessor.log
(4.73 KiB) Downloaded 62 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by Yvan Fournier »

Hello,

Did you try without reorient ? There is also a new option (since September 2022, so in v7.3 and 8.0 beta) to allow discarding cells with incorrect connectivity or negative volume (often very flat cells, leaving very small holes in the mesh that might even be filled with mesh joining). This has helped us read some meshes.

Otherwise, for mesh conversion, reading OF files in ParaView and exporting them to CGNS might do the trick.

Best regards,

Yvan
finzeo
Posts: 53
Joined: Fri Sep 09, 2022 4:23 pm

Re: Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by finzeo »

Yvan Fournier wrote: Thu Mar 30, 2023 10:43 pm Hello,

Did you try without reorient ? There is also a new option (since September 2022, so in v7.3 and 8.0 beta) to allow discarding cells with incorrect connectivity or negative volume (often very flat cells, leaving very small holes in the mesh that might even be filled with mesh joining). This has helped us read some meshes.

Otherwise, for mesh conversion, reading OF files in ParaView and exporting them to CGNS might do the trick.

Best regards,

Yvan
Hi Yvan,

I tried without using reorient (that was my first try) and it didn't work. I should try version 7.3 (I can see that they are small cells close to the solid surface), but I'm bothered by the fact that there are errors in the conversion.

I also tried that way of opening the mesh in paraview and exporting it as .cgns, but when loading it in CS it didn't work (it doesn't recognize the format well, see attached file). Maybe I don't export it to cgns correctly (I just load all mesh entities in paraview, and set export as cgns)
Attachments
preprocessor.log
(2.84 KiB) Downloaded 56 times
MatthieuM
Posts: 17
Joined: Thu May 19, 2022 10:44 am

Re: Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by MatthieuM »

Hi,

Maybe you can try to update your foamMeshToMED utility, there are two relatively new versions which are available on GitHub :

- For OF8 (OK with OF9 and OF10 for my part) : https://github.com/oseen/foamMeshToMED

- For OF2106 (OK with OF2112 for my part) : https://github.com/oseen/foamMeshToMED/ ... FOAM-v2106

Be careful, from a quick look, you can't have exactly the same utility for these two forks of OpenFOAM, coding differences tend to increase between the foundation and the ESI versions... However, I don't know if it will work with OF1812.

Don't forget to update the location of the MED library, the default proposes a system location, but if you have an "old" ubuntu version, for example, the MED library available with ubuntu packages is outdated (typically, 3.0.6 with Ubuntu 18.04).

Best regards,
Matthieu
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by Yvan Fournier »

Hello,

Regarding the CGNS import error, if you have a small test mesh, can you post it here ?
I suspect your CGNS library is too old or not build with HDF5 support.

For bad/small cells, yes, trying code_saturne 7.3 can be useful, though there could be additional improvements in the future (I have an interesting test case, and hope to work on it later this year).
I recommend switching directly to code_saturne 8.0-beta rather than 7.3: we are more than half-way through the validation process so v8.0 is probably already more stable than v7.3.

Best regards,

Yvan
finzeo
Posts: 53
Joined: Fri Sep 09, 2022 4:23 pm

Re: Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by finzeo »

MatthieuM wrote: Fri Mar 31, 2023 10:54 am Hi,

Maybe you can try to update your foamMeshToMED utility, there are two relatively new versions which are available on GitHub :

- For OF8 (OK with OF9 and OF10 for my part) : https://github.com/oseen/foamMeshToMED

- For OF2106 (OK with OF2112 for my part) : https://github.com/oseen/foamMeshToMED/ ... FOAM-v2106

Be careful, from a quick look, you can't have exactly the same utility for these two forks of OpenFOAM, coding differences tend to increase between the foundation and the ESI versions... However, I don't know if it will work with OF1812.

Don't forget to update the location of the MED library, the default proposes a system location, but if you have an "old" ubuntu version, for example, the MED library available with ubuntu packages is outdated (typically, 3.0.6 with Ubuntu 18.04).

Best regards,
Matthieu
Hi Matthieu,

Thanks for the help, I had not seen the fork related to the com version of openfoam. It is a possibility to try.
I'm running this on a cluster at my workplace that has CentOS 6.10 installed (yes, it's a problem, but I can't change it).
How can I see the version of the med library? Since I don't handle cluster packages, I'm not very aware of what it has installed.
finzeo
Posts: 53
Joined: Fri Sep 09, 2022 4:23 pm

Re: Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by finzeo »

Yvan Fournier wrote: Fri Mar 31, 2023 6:37 pm Hello,

Regarding the CGNS import error, if you have a small test mesh, can you post it here ?
I suspect your CGNS library is too old or not build with HDF5 support.

For bad/small cells, yes, trying code_saturne 7.3 can be useful, though there could be additional improvements in the future (I have an interesting test case, and hope to work on it later this year).
I recommend switching directly to code_saturne 8.0-beta rather than 7.3: we are more than half-way through the validation process so v8.0 is probably already more stable than v7.3.

Best regards,

Yvan
Yvan,

I am attaching a very light version of the case that I am meshing (as I give it to you, it is not useful to me, it is very unrefined and I removed refinement zones). It was made with OF v1812.
As I told Matthieu, I'm running this on a cluster that has CentOS 6.10 installed (I can't change it, but I can install or ask them to upload newer packages to those who manage the cluster).
Thanks for the info about version 8.0. My first option is to fix the mesh conversion, and if i don't get that, try this.
Attachments
GTS_test1812_CSforum.zip
(290.87 KiB) Downloaded 59 times
Yvan Fournier
Posts: 4070
Joined: Mon Feb 20, 2012 3:25 pm

Re: Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by Yvan Fournier »

Hello,

Sorry, I am not too familiar with OpenFoam (running a few meshing tutorials years ago and following git changes and news once in a while is not sufficient to make one competent), so if you could post the CGNS mesh generated by ParaView (or at least the .foam case importable by ParaView) for this case that would be much more helpful.

Best regards,

Yvan
MatthieuM
Posts: 17
Joined: Thu May 19, 2022 10:44 am

Re: Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by MatthieuM »

finzeo wrote: Fri Mar 31, 2023 9:36 pm
Hi Matthieu,

Thanks for the help, I had not seen the fork related to the com version of openfoam. It is a possibility to try.
I'm running this on a cluster at my workplace that has CentOS 6.10 installed (yes, it's a problem, but I can't change it).
How can I see the version of the med library? Since I don't handle cluster packages, I'm not very aware of what it has installed.
Hi Finzeo,

I don't really manage CentOS (I use Ubuntu), but I think you can try something as yum list installed | grep libmed*, assuming that yum is your package manager (I think it's the default setting with CentOS).

An other solution could be to open a preprocessor.log file built by Code_Saturne, to see the MED version currently supported by your CS installation.

If you plan to install CS 8.0, maybe the most simple solution would be to download the MED package proposed during the semi-automatic installation of Code_Saturne (a choice to specify in the setup.ini file), and then compile the foamMeshtoMED utility using this MED library. You'll be sure the utility conversion will be consistent with the supported MED version of your CS installation.

Best regards,
Matthieu
finzeo
Posts: 53
Joined: Fri Sep 09, 2022 4:23 pm

Re: Exporting a mesh obtained with OF 1812 or later to a format compatible with CS

Post by finzeo »

MatthieuM wrote: Fri Mar 31, 2023 10:54 am Hi,

Maybe you can try to update your foamMeshToMED utility, there are two relatively new versions which are available on GitHub :

- For OF8 (OK with OF9 and OF10 for my part) : https://github.com/oseen/foamMeshToMED

- For OF2106 (OK with OF2112 for my part) : https://github.com/oseen/foamMeshToMED/ ... FOAM-v2106

Be careful, from a quick look, you can't have exactly the same utility for these two forks of OpenFOAM, coding differences tend to increase between the foundation and the ESI versions... However, I don't know if it will work with OF1812.

Don't forget to update the location of the MED library, the default proposes a system location, but if you have an "old" ubuntu version, for example, the MED library available with ubuntu packages is outdated (typically, 3.0.6 with Ubuntu 18.04).

Best regards,
Matthieu
Hi Matthieu,

I am trying to install the version for OpenFOAM v2106. What versions of the med and hdf5 libraries did you use to make it work correctly?
Post Reply