CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (
-   -   mesh conversion Salome --> OpenFoam (

vaina74 March 21, 2010 10:19

mesh conversion Salome --> OpenFoam
I generated a grid around a blade section with Salome and I want to import it in OpenFOAM. I set the domain boundaries, as in this procedure definition (from the Salome forum):

STEP1 Create groups of faces for all patches (undefined sufaces will became in OpenFOAM as defaultFaces patch). For example, for internal simulation, we need 3 groups: inlet, outlet and walls.

STEP2 Mesh geometry.

STEP3 Create group of faces for mesh. This is done by using Create group command in SMESH module and selecting checkbox faces. In the appeared dialog box we must enter name for group (or patch in OpenFOAM), e.g., inlet, outlet, walls. Then, we must select Group using geometry option and click on interesting group in tree view of meshed solid.

STEP4 Export your mesh to I-DEAS format file (filename.unv). This file should be saved to the root of OpenFOAM case (where directories 0, constant, system).

STEP5 Run utility ideasUnvToFoam. For example, if we are using terminal in case root, we should type:

ideasUnvToFoam filename.unv
STEP6 Check mesh. run:

STEP7 If checkMesh reports no error, change dimensions. To convert from mm to m, we must type

transformPoints -scale '(0.001 0.001 0.001)'
STEP8 Change physical boundaris: enter file constant/polyMesh/boundaries and edit entries according to your case

I have a problem. At STEP5 I obtain:


| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.6                                  |
|  \\  /    A nd          | Web:                      |
|    \\/    M anipulation  |                                                |
Build  : 1.6-53b7f692aa41
Exec  : ideasUnvToFoam mesh.unv
Date  : Mar 21 2010
Time  : 14:40:56
Host  : giulia-laptop
PID    : 7755
Case  : /home/giulia/OpenFOAM/OpenFOAM-1.6/run/hydrofoil
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

cannot open file

file: /home/giulia/OpenFOAM/OpenFOAM-1.6/run/hydrofoil/system/controlDict at line 0.

    From function regIOobject::readStream()
    in file db/regIOobject/regIOobjectRead.C at line 62.

FOAM exiting

Can you help me, please?

philippose March 21, 2010 10:52


A Good Afternoon to you!

In order to get: ideasUnvToFoam <filename>.unv

working, you need to have a valid controlDict file present in the <case name>/system folder.

Usually what is done, is to create a skeleton OpenFOAM case, with the following structure:


<case name>
|--> 0
| |--> p
| |--> U
| |--> ... <the folder could also be left empty>
|--> constant
| |--> transportProperties
| |--> RASProperties
| |--> ... <the folder could also be left empty>
|--> system
| |--> controlDict <this file must be present>
| |--> fvSolution
| |--> fvSchemes
| |--> ...
|--> ...
Once this structure is available, you can run the mesh conversion routine, and this will create a folder called polyMesh within the constant folder, with the mesh in OpenFOAM format.

Hope this helps...


vaina74 March 21, 2010 12:19

Thank you for your reply. I can't believe someone would help me on sunday :)

I read about creating a new case in the user guide, but I found 3 tutorials for SimpleFoam. The subdirectories are not all the same ones, so i got confused. For example, I could copy the pitzDaily tutorial and edit the case files, but I don't know which subdirectories or files are to be deleted. My case is about a blade section (a 'hydro' foil) and I'll apply a turbulent model.
I'm a beginner, as you can see ;)

philippose March 21, 2010 14:13

Hello again :-)!

So... as you rightly noticed, the file structure for the different OpenFOAM cases are not always the same.... however, I am sure you would have noticed some folders and files to be always present in most OpenFOAM cases.

In essence, there is a minimal setup required for running most OpenFOAM cases. In addition to this minimal setup, some special solvers or configurations may require additional files.

The typical structure of an OpenFOAM case used for an incompressible, turbulent simulation (for example, simpleFoam) is as given below:


<case name>
|--> system
| |
| |--> controlDict <basic simulation run information - mandatory>
| |--> fvSolution <solver selection / solver settings for the various solved variables (p, U, k, omega, etc...) - mandatory>
| |--> fvSchemes <Numerical schemes for interpolation / div / laplacian / etc... - mandatory>
|--> constant
| |
| |--> polyMesh <folder containing the mesh - mandatory>
| | |--> boundary <boundary specifications for mesh patches - mandatory>
| | |--> points <co-ordinates of the points which make up the mesh - mandatory>
| | |--> faces <faces (specified as point IDs) which make up the mesh - mandatory>
| | |--> owner <owner cell of each face - mandatory>
| | |--> neighbour <neighbour cell of each face - mandatory>
| |
| |--> RASProperties <settings related to the turbulence model - mandatory (for RANS based turbulence models)>
| |--> transportProperties <settings related to the fluid medium - mandatory>
| |
| |--> 0
| | |--> p <BCs and initialisation of the pressure field for mesh interior and boundary patches - mandatory>
| | |--> U <BCs and initialisation of the velocity field for mesh interior and boundary patches - mandatory>
| | |--> k <BCs and initialisation of the turbulent kinetic energy (k) field for mesh interior and boundary patches - mandatory>
| | |--> epsilon/omega <BCs and initialisation of the turbulent dissipation field for mesh interior and boundary patches - mandatory>
Usually, the folder polyMesh and its contents are automatically generated by the mesh conversion tool that you use. The rest of the files need to be either created by the user, or copied from a similar case (such as a tutorial case).

The contents of the 0 time-step folder also has to be modified depending on the boundary conditions for a particular simulation.

For a specific family of simulations (such as incompressible, turbulent using simpleFoam), usually the contents of the system and constant (except for the polyMesh folder of course) folders will need only minimal modifications across simulations.

For further information regarding the folder structure of an OpenFOAM simulation, and the various files used, refer to the OpenFOAM User Manual.

Have a nice evening ahead!


vaina74 March 22, 2010 06:13

Thanks a lot, I got it. I create a new case and the mesh seems ok :)
Now I'm going to edit the configuration files for my simulation.

maysmech October 17, 2010 07:13

i've created a mesh in Salome but i don't know how can i create a group. my case is a simple lid-drive cavity. can anyone who know about creation of group in Salome help me?

elvis October 18, 2010 07:34


Originally Posted by maysmech (Post 279490)
i've created a mesh in Salome but i don't know how can i create a group. my case is a simple lid-drive cavity. can anyone who know about creation of group in Salome help me?

you mean groups for inlet outlet etc.

tutorial is for a older version of Salome but easy to transfer to new version

maysmech October 19, 2010 02:10

Thanks Elvis,
I'll check it :)

maysmech October 19, 2010 02:35

i've succeeded to create group and export it to OpenFOAM.

But i don't know how to define cyclic B.C for two face for example front and back of a backward facing step case. Any idea about this problem?

hamcer November 3, 2010 06:46


Originally Posted by maysmech (Post 279719)
i've succeeded to create group and export it to OpenFOAM.

But i don't know how to define cyclic B.C for two face for example front and back of a backward facing step case. Any idea about this problem?


you can find an example which use the kind of cyclic boundary in these tutorials:
~ OpenFOAM/hamdi-1.7.1/run/tutorials/incompressible/simpleSRFFoam/mixer/0
~ OpenFOAM/hamdi-1.7.1/run/tutorials/incompressible/channelFoam/channel395
~ OpenFOAM/hamdi-1.7.1/run/tutorials/incompressible/boundaryFoam/boundaryWallFunctions


hope that you help you


maysmech November 3, 2010 10:35

Thanks Hamdi,

I checked your mentioned cases. all of their meshes were created by blockMeshDict file. they are not conversion from other softwares like Salome. And as you know when we convert from other softwares, the mesh is imported and there is no need to blockMeshDict and blockMesh command. and in this situation (when importing from Salome) it doesn't understand which faces should be cyclic together .

hamcer November 3, 2010 13:03

hi maysam
here is an example that uses cyclic boundary.
Test cases are in the folder tubomachinery (especially turboMachinery/tutorials/cgnsConverters/test123
the original mesh is made with CGNS
you must install the utility cgnsTofoam, see:
or if you have Ubuntu you can install it with synaptic (also OpenFOAM, OpenFOAM-dev, and paraview openfoamparaview) and do not forget m4 pakage
hope that help you.


francois January 5, 2011 09:41

5 Attachment(s)
Hi all,

Happy new year to everybody !

I'm trying to do my best to learn Salome but I'm now facing a point where I can't go any further and need some kind help

The goal is simple: try to build a 3D mesh with a non-uniform revolution of 2D elements. It looks rather simple isn't it ? But I can't do it ...

My workflow is as follow:

1. I build a Face
2. I use an Arc as a path for the extrusion
3. I mesh the Face with Quadrangle Mapping
4. I mesh the Arc with a Wire discretisation and a non-uniform 1D hypothesis
5. I mesh the volume using the 3D extrusion algorithm:
Then menu Modification > Extrusion along a path
I select the 2D elements of my Face then the path mesh, the starting node and the base point

The 3D mesh is created and looks like OK but in fact it contains no Prisms (only Hexahedrons) .

The suggested procedure consists of merging the duplicate nodes.This creates prisms elements but the numbers of prisms doesn't seems to be wrong.

I've made a very basic mesh to illustrate this problem:

* It's a square face meshed with Quadrangle Mapping which is extruded along an Arc.
* I mesh the Arc with a Wire discretization and a non-uniform 1D hypothesis.
* I mesh the volume using the 3D extrusion algorithm.

In the screenshot of the resulting mesh using the Extrusion along the non-uniform meshed Arc before merging the duplicate nodes you can see some "holes" in the mesh: don't know if it's graphical or not. There is no prisms before merging duplicated nodes.

You can see that 16 prisms were created after merging the duplicate nodes BUT this number seems to be wrong I think the correct prisms number should rather be 6*4=24 but I may be wrong here. There is still some "holes" in the mesh.

The mesh shown in wireframe mode is also strange.
It looks like some prisms are indeed missing.

You will find the corresponding hdf file before merging duplicate nodes.

What's wrong here ?
I'm using the Salome_5.1.4 32 bits Universal Package

Any help/advice will be greatly appreciate.:D


alkochevsky March 3, 2011 12:17

Hi all,

it is to be mentioned that pyramid-shaped cells are missed by exporting a mesh in an I-DEAS format file (filename.unv) (I use SALOME 5.1.5). It's a pity, otherwise I would have some success in generation of nice hexa-shaped boundary cells near walls, with tetra-cells for the core flow. Unfortunately, pyramid cells seem to be inevitably needed for transition between hexa and tetra cells. Is it possible to get pyramid cells somehow saved in the unv-file?

Regards, Alexey

vaina74 March 3, 2011 13:58

I had the same problem some time ago and I was explained that:

pyramid elements may be generated by SMESH, and exist in the MED format, but do not exist in the UNV format specification, so converters could either export them as degenerate hexahadra (with 4 merged vertices), or ignore them. Most choose to ignore them, as is the case here, which means you are more or less stuck, unless you can find a way not to generate pyramid elements (either not using quadrangle mapping, or doing full blocking, but not mixing both, as this will require pyramids for the transition at some point).
The best solution for OpenFoam would be to add a MEDtoFoam converter, as the MED format can handle pyramids, polyhedra,... but this would require someone working with OpenFoam contributing it...
If you really need pyramids for the transition, take a look at this thread on the SALOME users forum and try some tricky procedures through MED meshes and gmsh OpenFOAM converter.

alkochevsky March 9, 2011 04:52

Thank you for the explanation and the link, I have just tried the procedure described over there, the conversion was successful.

Tobi May 2, 2011 09:08

1 Attachment(s)
hey all,

i 've meshed a simple geometry like the steps below.

after i export the mesh (unv) and start ideasUnvToFoam i get these error message


tobi@shorty:~/OpenFOAM/tobi-1.7.x/run/test$ ideasUnvToFoam Mesh_1.unv
| =========                |                                                |
| \\      /  F ield        | OpenFOAM: The Open Source CFD Toolbox          |
|  \\    /  O peration    | Version:  1.7.x                                |
|  \\  /    A nd          | Web:                      |
|    \\/    M anipulation  |                                                |
Build  : 1.7.x-2d00769395fa
Exec  : ideasUnvToFoam Mesh_1.unv
Date  : May 02 2011
Time  : 15:03:39
Host  : shorty
PID    : 6882
Case  : /home/tobi/OpenFOAM/tobi-1.7.x/run/test
nProcs : 1
SigFpe : Enabling floating point exception trapping (FOAM_SIGFPE).

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Create time

Processing tag:2411
Starting reading points at line 3.
Read 10562 points.

Processing tag:2412
Starting reading cells at line 21130.
First occurrence of element type 22 for cell 1 at line 21131
--> FOAM Warning :
    From function readCells(IFstream&, label&)
    in file ideasUnvToFoam.C at line 461
    Reading "Mesh_1.unv" at line 21131
    Cell type 22 not supported

Attempt to get back from bad stream

file: IStringStream.sourceFile at line 0.

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

FOAM exiting

What did i get wrong ?

Regards Tobi

vaina74 May 2, 2011 10:02

I think something is wrong in your mesh creation: the openFOAM converter cannot manage some elements. Could you attach your case or dump it?

Tobi May 2, 2011 11:12


its the first time i make the mesh with Salome. I am usally using sHM but i wanna get a 2D - mesh and thats not possible with snappyHexMesh.

Here my Salome hdf - file

Don 't know if i get everything correct. Maybe someone could help me ?
Thanks for your help :)

Regards Tobi

vaina74 May 2, 2011 12:23

I think you're a bit confused about meshing in SALOME and in openFOAM. About SALOME, I suggest to try the tutorials first. About openFOAM, you should read again the pre-processing section in the User Guide. You cannot manage 2D meshes, as in your case: in OpenFOAM you always have a third dimension. Anyway, you can do a lot of things with blockMesh, snappyHexMesh and other openFOAM meshing tools. When you are ready, you can follow the above procedure (and apply colours when creating mesh groups).
Hope this helps, regards.

All times are GMT -4. The time now is 21:04.