CFD Online Discussion Forums

CFD Online Discussion Forums (
-   Open Source Meshers: Gmsh, Netgen, CGNS, ... (
-   -   Internal faces from gmsh how to create patches in OpenFoam (

podallaire June 5, 2008 11:21

Good morning, I created a s
Good morning,

I created a simple geometry with gmsh which represents a box
with a tube inside. As suggested by Takuya, the geometry is made
with 2 volumes so all faces are recognized by gmsh2ToFoam.
Those inner faces are removed by gmsh2ToFoam but saved ("sets" directory).

Is there a way to import those internal faces as patches ?

Best regards,


(how can I post the geo file ?)

7islands June 6, 2008 06:00

Hi Pierre-Olivier, For severa
Hi Pierre-Olivier,
For several reasons I also wanted a testcase with baffles so I changed your .geo to inlets.geo and as you mentioned applying createBaffles to FanCenter and FanShell did the trick.

I assigned wall boundary conditions to the outer surfaces ("Inlet," "Outlet" and "Room"), and assigned inlet- and outlet- conditions to each side of the fan baffle (I'm not an axial fan expert so there should be the correct way though). Trying the case a bit with simpleFoam it seems to be working:


7islands June 6, 2008 06:07

Sorry for the typo in the file
Sorry for the typo in the file name. The inlets.geo in the post above is the corrected one.

podallaire June 6, 2008 07:10

Thanks a lot Takuya, I will tr
Thanks a lot Takuya, I will try this today.
Really appreciated.

Have a good day


podallaire June 6, 2008 08:26

Takuya, did you modify your

did you modify your boundary file in order to use createBaffles ?



7islands June 6, 2008 08:58

Yes, I think you have to creat
Yes, I think you have to create the target patch with nFaces 0 in polyMesh/boundary.

In fact at first I thought I could post the case here with some sort of tutorial-ish makeMesh scripts, but had to give up the idea since it involved a good amount of hand-editing and mesh manipulation. For example it seems you have to recreate faceSets from faceZones using the faceSet command before the second run of createBaffles, since createBaffles writes the updated faceZones with the new mesh but does not write faceSets.

Further if you would like to employ separate boundary conditions on each side of FanCenter (like I did), I think you have to select each side of FanCenter faces with faceSet using the directions of the face normals as clue and run createPatches.


podallaire June 6, 2008 09:42

Thanks for those infos, it wor
Thanks for those infos, it worked !

What I did :

1) Modified boundary file and added new patch nFaces 0 in polyMesh/boundary
2) Modified all files in 0
3) createBaffles root case set patch
4) created a faceSetDict to select a second faceZone
5) faceSet root case
6) Moved my mesh from 0 to constant
7) ... restart at 1) to 3)



podallaire June 10, 2008 21:25

Hi Takuya, I'd like to have
Hi Takuya,

I'd like to have more details on how to create two different patches (inlet/outlet) for one surface (FanCenter). The createBaffles procedure was successful - I want to understand how to run createPatches.

Thanks !


7islands June 11, 2008 02:39

Hi Pierre-Olivier, If I rem
Hi Pierre-Olivier,

If I remember correctly, the procedure continues as follows after 7) of your post.

8) Move your mesh from 0 to constant after a second createBaffles run
9) Create a faceSetDict to select FanCenter
10) faceSet root case
11) Create another faceSetDict to select a subset of FanCenter according to normalToFace<pre>name FanCenter;
action subset;
normal (1 0 0); // Vector
cos 0.01; // Tolerance (max cos of angle)
);</pre>12) faceSet root case
13) Create a createPatchDict to create a patch FanCenter2 from the faceSet<pre>patches
name FanCenter2;
type patch;
constructFrom set;
set FanCenter;
);</pre>14) createPatch root case

And you will see FanCenter and FanCenter2 separated by their normal directions, with FanCenter2 being the intake-side of the fan.


podallaire June 12, 2008 08:44

Ok, thanks Takuya ! About c
Ok, thanks Takuya !

About createBaffles - by default, it generates double-sided walls - right ? Can you confirm that the following procedure is not needed : s

I want to be sure that each side of the shell is considered to be a wall - not only one side.

Best regards,


7islands June 12, 2008 09:28

Hi Pierre-Olivier, Yes crea
Hi Pierre-Olivier,

Yes createBaffles does create dobule-sided walls. So for example if you see the baffle patch (before splitting) having 50 faces when displayed with ParaView you can confirm the nFaces entry of the patch in polyMesh/boundary is in fact 100.

splitMesh may work as written in the Wiki you mentioned (and things will be simpler if it does work), but I was not able to find how splitMesh determines which side of the wall belongs to which patch (i. e. the notion of master/slave patches).


podallaire June 12, 2008 09:49

Hi Takuya, perfect, I wante
Hi Takuya,

perfect, I wanted to be sure.

I tried to use splitMesh because checkMesh complains about "multiply connected surface (shared edge)" but the procedure from the Wiki did not work for me - trying to split the shell (selected again using faceSet) returns an error saying it is not an internal face. I guess that's not a big deal since I already have double-sided walls.

Best regards,


hsieh July 20, 2008 18:45

Hi, Takuya, I am interested
Hi, Takuya,

I am interested in modeling a "fan" inside fluid domain too. I am wondering if you are willing to send the me the simple test case that you posted picture above (axial fan inside a box)? I am curious about how you setup BCs expecially. Thanks!


hsieh July 21, 2008 14:15

Hi, Pierre-Olivier, I am tr
Hi, Pierre-Olivier,

I am trying to follow your steps, but, has a couple of questions. It will be appreciated if you can clarify:

1. After generating the inlet.msh (using inlet.geo posted above), boundary has 6 patches, FanCenter (nFaces =0), inlet (nFaces =1932), Oulet (nFaces = 1976), Room (nFaces = 10174), FanShell (nFaces = 0), defaultFaces (nFaces = 0). Also, in sets directory, I have faceZone_4 and Fluid.
2. In step #1, do I need to add a new patch (say I give it a patch name, fanInletOutlet) in boundary with nFaces = 0?
3. In step 3, exactly what do I type in the terminal window? Is it "createBaffles root case set fanInletOut"?
4. can you post the createSetDict in step 4?
5. In step 7, why you say "restart at 1) to 3)?



7islands July 21, 2008 20:03

Hi Pei, The inlet/outlet BCs
Hi Pei,
The inlet/outlet BCs I used were a verbatim copy of simpleFoam/pitzDaily case where fixedValue (1 0 0)/zeroGradient for U and zeroGradient/fixedValue 0 for p. But I don't think these were physically correct for emulating an axial fan as far as reading another thread [1].

My main purpose was to obtain a baffle case to test my ParaView3-reader so I didn't elaborated more. Maybe Pierre-Olivier could give you a better suggestion.



podallaire July 21, 2008 20:55

Hey guys, 2. -> Since Fance
Hey guys,

2. -> Since Fancenter is considered as a wall, it should be splitted in two patches using the command createPatch (as described by Takuya).
3. -> Should be something like "createBaffle root case nameofset patchname" where the nameofset was FanCenter or FanShell (if I remember correctly...)
4. -> Could be something like :

version 2.0;
format ascii;

root "";
case "";
instance "system";
local "";

class dictionary;
object createPatcheDict;

// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

// Name of new patch
name FanCenter2;

// Type of new patch
type patch;

// How to construct: either 'patches' or 'set'
constructFrom set;
set FanCenter;


// ************************************************** *********************** //

An example of this dictionnary is avaible in applications/utilities/mesh/manipulation/createPatch

5. Because I had to apply the createBaffle command for two internal patches: FanCenter and FanShell.

Now, for the boundary conditions, I have working on this in the last few weeks. On each face on the fan,
a fixed velocity can be used coupled with zero-gradient on pressure. For the room inlet and outlet, pressureInlet and
pressureInletOutlet physical patches are possibilities. It really depends of your case.

Hope this helps,


hsieh July 21, 2008 21:39

Hi, Takuya and Pierre-Olivier,
Hi, Takuya and Pierre-Olivier,

Thanks a lot for the answer!

I am mostly interested in the fan BCs. Can you commend on whether the following is correct?

The original FanCenter (imported from gmsh) is now split into FanCenter and FanCenter2 (two sides of the same patch). Fixed velocity (say, (1 0 0)) and zeroGradient are applied to both FanCenter and FanCenter2, correct?

In OF-1.5, a new "fan type" BC was implemented (basically a cyclic BC with pressure jump). Will it be more appropriated for this? I did some testing of the fan type BC, but, still are not quite sure about whether I did it correctly.


eugene July 22, 2008 08:40

Hi Pei, The attached applic
Hi Pei,

The attached application creates an internal cyclic boundary usable for jump conditions using a circular cutting disk as input. createJump.tgz

podallaire July 22, 2008 08:52

sounds interesting - will it c
sounds interesting - will it compile under 1.5 ?

eugene July 22, 2008 09:12

Not sure, I haven't tried yet.
Not sure, I haven't tried yet.

All times are GMT -4. The time now is 10:33.