Personal tools
You are here: Home Forum Use Openfoam conversion

Openfoam conversion

Up to Use
  • Openfoam conversion

    Posted by Andrea P at August 31. 2009
    Hi to everybody
    i'm trying to build a tetrahedric mesh of an airbox that i'll use in openfoam; i'm really going mad with the conversion, i keep getting that error:

    ...
    For facegroup 1 named cono1 trying to read 33 patch face indices.


    --> FOAM FATAL IO ERROR : Attempt to get back from bad stream

    file: IStringStream.sourceFile at line 0.

        From function void Istream::getBack(token& t)
        in file db/IOstreams/IOstreams/Istream.C at line 44.

    FOAM exiting

    that as i've read in some (all that i found on google) topics, is related to a bad mesh.
    i've followed a suggestion that i read in a forum about the parametres to give to the mesh, but it works only sometimes.
    I'm not building a quadratic mesh, so that is not the problem.
    Thank to anybody who will try to help.
    • Re: Openfoam conversion

      Posted by Christoph Hossfeld at October 01. 2009

      I've done a mistake. In OF1.6 there no cells in constant/polyMesh. This file is obsolet.

    • Re: Openfoam conversion

      Posted by Siegfried Lösch at August 31. 2009
      Andrea,

      the only way for successfull mesh conversion Salome - OpenFOAM that worked for me was:

      1) Generate the mesh in Salome (including groups on faces for the patches an groups on volumes for the cellZones - if needed)
      2) save the mesh in Salome as med - file
      3) load the med-file into gmsh and save it as gmsh-mesh (ASCII, version2)
      4) activate 'gmsh2ToFoam', which can be downloaded from the openfoamwiki (the original gmshToFoam didn't work for me)
      5) start your work with OpenFOAM (boundaries, initial conditions) ...

      I also gave ideasUnvToFoam a try, but that didn't work.

      Using: Salome 5.1.2 gmsh 2.3 and OpenFoam 1.5 and 1.6

      Hope that helps

      Siegfried
      • Re: Openfoam conversion

        Posted by Andrea P at October 02. 2009

        Previously Siegfried Lösch wrote:

        Andrea,

        the only way for successfull mesh conversion Salome - OpenFOAM that worked for me was:

        1) Generate the mesh in Salome (including groups on faces for the patches an groups on volumes for the cellZones - if needed)
        2) save the mesh in Salome as med - file
        3) load the med-file into gmsh and save it as gmsh-mesh (ASCII, version2)
        4) activate 'gmsh2ToFoam', which can be downloaded from the openfoamwiki (the original gmshToFoam didn't work for me)
        5) start your work with OpenFOAM (boundaries, initial conditions) ...

        I also gave ideasUnvToFoam a try, but that didn't work.

        Using: Salome 5.1.2 gmsh 2.3 and OpenFoam 1.5 and 1.6

        Hope that helps

        Siegfried

        Sorry for replying so late, but i saw that this post is not dead, so i thank you, i'll give a try to what you said, i hope it will work with of1.4.1 (i must use that version)

        Grazie

      • Re: Openfoam conversion

        Posted by Alexey PETROV at August 31. 2009
        Siegfried Lösch wrote:
        Andrea,

        the only way for successfull mesh conversion Salome - OpenFOAM that worked for me was:

        1) Generate the mesh in Salome (including groups on faces for the patches an groups on volumes for the cellZones - if needed)
        2) save the mesh in Salome as med - file
        3) load the med-file into gmsh and save it as gmsh-mesh (ASCII, version2)
        4) activate 'gmsh2ToFoam', which can be downloaded from the openfoamwiki (the original gmshToFoam didn't work for me)
        5) start your work with OpenFOAM (boundaries, initial conditions) ...

        I also gave ideasUnvToFoam a try, but that didn't work.

        Using: Salome 5.1.2 gmsh 2.3 and OpenFoam 1.5 and 1.6

        Hope that helps

        Siegfried

        Hello Andrea and Siegfried, I could suggest a more strightforward method for SALOME to OpenFOAM conversion - 1)"Generate the mesh in Salome (including groups on faces for the patches an groups on volumes for the cellZones - if needed)" 2) save the mesh in Salome as UNV - file 3) activate 'ideasUNVToFoam' to convert the produced UNV file to the native format 4) "start your work with OpenFOAM (boundaries, initial conditions) ..." Best regards, Alexey
    • Re: Openfoam conversion

      Posted by Karl Heinz at December 09. 2009

      Hey guys,

       

      I was trying to install GMESH unter Ubuntu but don't why I not able to compile med support... I ve try different versions and actived always med support by cmake or ./configure.

      Is is also possible using the unv-file from salome to import it to gmesh instead of using the med-mesh, or would it make some differenz?

       

      Thanks in advance.

    • Re: Openfoam conversion

      Posted by Dads Army at February 09. 2011

      Weird situation on CAELinux, but it works in the end:

      In the beginning, a .med-file was created in Salome. When exporting, "Automatically create groups" had to be enabled.

      On Ubuntu, gmsh is located inside /usr/bin/ . This version (2.4.2), although automatically invoked when using the terminal command gmsh (it had precedence in the PATH-structure), yields

      Error   : Gmsh must be compiled with MED support to read '/home/openfoam/Test/sonicFoam/CMTest/withPyramidsSmall.med'

      when trying to open a .med file. Another version (but also 2.4.2) of gmsh, located in /opt/aster101/public/gmsh-2.4.2-Linux/bin does the trick.

      Here however, Save As... doesn't work (the Ok-button is greyed out). Save Mesh does work, but it places a <nameless>.msh file in the home directory.

      Renaming it with mv .msh <name>.msh and putting it in the OpenFoam case directory, we run gmshToFoam on it, and get a consistent PolyMesh (at least it's viewable with ParaView).

       

      Hope this helps someone out there, but since the process is a bit tricky (discovered mainly by trial-and-error), it'd be great if someone could point out improvements or explanations (for the strange behaviour of gmsh for example).

      Kind regards,

      J Nauta

    • Re: Openfoam conversion

      Posted by Christoph Hossfeld at October 01. 2009

      Dear all,

       

      I know that this tread is not used since 1 month, but I think here it is the best place to put my comments....

       

      I have tried both ways. I have to state, that ideasUNVToFoam does not work with defined volumes in Salome (and same element like pyramids are skipped anyway). The way with med and gmsh is also not straight forward, cause whether gmshToFoam nor gmsh2ToFoam produces cells in constant/polyMesh. It is also to mention, that one must use med version 2.3 and deactivate the autogroup button during the save dialog. If you are using gmsh2ToFoam you must use a gmsh with a version <2.4 cause there a small change in the msh-format. This is taken into account with the gmshToFoam version which comes with OF1.6.

       

      To summarize:

       

      I can produce a mesh for OF using the way Salome->med2.3->gmsh->gmshToFoam. But I was not able to get the cells in constant/polyMesh.

       

      Can anyone help?

       

      Best Regards

       

      Christoph

    • Re: Openfoam conversion

      Posted by David Gisen at November 10. 2009

      It finally worked for me with OF 1.5, Gmsh 2.3.1 and Salome 5.1.2 but i had to ACTIVATE the automatically create groups feature in Salome! Further on I used gmsh2ToFoam.

Powered by Ploneboard
Document Actions