I have a mesh produced from scanning a real 3D object (I don't have a geometry). What is the most convenient way to specify inlets, outlets, etc. for CFD in OpenFOAM? The mesh consists of thousands of faces, so defining each of them manually is not feasible.

Further information if that helps:

  1. The scanner produced a VRML file of the object surface.
  2. I transformed this (using Chisel) into STL, edited it and produced a 3D mesh in Salome.
  3. I exported it as UNV and converted with ideasUnvToFoam into an OpenFOAM mash.
  • $\begingroup$ Could you clarify what you mean with "thousands of faces"? In the OpenFOAM-nomenclature a face is a polygon that is either the border between two cells or the border of a cell to "the outside" (boundary faces). A patch on the other hand is a collection of " boundary faces" that belong together (they have a name) and will receive a common boundary condition. I suspect you mean "thousands of patches", right? $\endgroup$
    – bgschaid
    Jun 14, 2012 at 22:11
  • $\begingroup$ I mean "boundary faces". In my (and probably very common) case they are triangles. $\endgroup$
    – Igor F.
    Jun 15, 2012 at 2:23

2 Answers 2


The best way to do this, since you have already exported the mesh in Salome is to generate groups of faces in your Salome mesh. Since you have no geometry to base your choices on (e.g. group all the faces that belong to a circle A), you will have to use filters.

Go to Mesh->Create Group->Group on Filter, and set such filters that will enable you to isolate the faces of interest. For boundary faces, start with the filter Free faces. You may create additional geometry, such as planes, or rectangles, that you know will determine your set of faces.

Even though all you have is a Mesh in Salome, you can create geometrical entities that you will then use in the Set_filter environment to filter out the faces.

Example of filters:

Free faces + Belong to Geom

Where Geom is e.g. a rectangle that you have drawn in the Geom module. This is the simplest and most elegant way, you just need to know the dimensions of your geometry (which you must know, if you are running a simulation on it). Once you have created the Geoms, they will be selectable: just click on the Threshold value of the Belong to Geom filter and select the geometrical entity from the Geometry tree on the left.


Two workarounds that only need OpenFOAM itself

  1. Regular expressions in boundary conditions: if patches are consistently named (for instance "wall01", "wall02" ... and "inlet01", "inlet02") then OpenFOAM allows to specify boundary conditions where instead of a name a regular expression (OpenFOAM recognizes this by the "") is given and all patches whose names match this regular expression receive the same boundary condition (for instance "wall.+" matches wall01, wall02 etc)
  2. the createPatch-utility: this utility allows creating a new patch from a list of existing patches. The list of patches is specified in a dictionary file (again for specifying the patches regular expressions can be used)

Both methods here require that the names of the patches have some system


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.