CFD Online Discussion Forums

CFD Online Discussion Forums (https://www.cfd-online.com/Forums/)
-   OpenFOAM Meshing & Mesh Conversion (https://www.cfd-online.com/Forums/openfoam-meshing/)
-   -   [mesh manipulation] Using createPatch in place of couplePatches (https://www.cfd-online.com/Forums/openfoam-meshing/61478-using-createpatch-place-couplepatches.html)

sripplinger February 24, 2009 10:52

Using createPatch in place of couplePatches
 
Hi, all.

I used to use couplePatches whenever I imported a mesh file with cyclic bc's. I know that with 1.5 couplePatches has been integrated into createPatch, but I have been unable to find any significant documentation or examples on how to do this. If any of you could, please provide an example or point me to some documentation.

The specifics of what I'm doing are creating a mesh in gmsh. The cyclic bc's are created as one physical group and they import into openfoam as such. Apparently, though, the importation involves some ordering problems for the cyclic bc faces. Previously to v1.5 couplePatches solved this problem.

obraun February 25, 2009 11:43

Hi Scott, have a look in the
 
Hi Scott,
have a look in the thread entitled

CreatePatch to create cyclic boundary

it tells you all about how to use createPatch and about a bug in 1.5 that seems to be fixed in 1.5.x. I still dit not test it, it's compiling ... The createPatchDict examples all look correct to me and it's quite straighforward definition of the patches (or the patch) to use.

obraun February 25, 2009 12:18

So, finished compiling 1.5.x.
 
So, finished compiling 1.5.x. 5 minutes walltime left were just entough to run it and it's fine. So I think you definitively have to move to 1.5.x to use it.

sripplinger February 25, 2009 13:53

That's what I get for asking a
 
That's what I get for asking a question before really trying to find the answer myself. I found the createPatchDict example file and it is indeed rather straightforward. Thank you for taking the time to respond, nonetheless.

waterboy April 20, 2009 04:19

createPatch in 1.5-dev for cyclic Patches
 
Hi,
I am trying to import a fluent mesh similar to the one in boundaryLaunderSharma and need to create cyclic patches. After import I change the boundary file to look like this:

Quote:

6
(
XMAX
{
type cyclic;
nFaces 14;
startFace 13;
}
XMIN
{
type cyclic;
nFaces 14;
startFace 27;
}
YMAX
{
type wall;
nFaces 1;
startFace 41;
}
YMIN
{
type wall;
nFaces 1;
startFace 42;
}
ZMAX
{
type wall;
nFaces 14;
startFace 43;
}
ZMIN
{
type wall;
nFaces 14;
startFace 57;
}
)
And run createPatch with the following dict.

Quote:

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

// Tolerance used in matching faces. Absolute tolerance is span of
// face times this factor.
matchTolerance 1E-3;

// Do a synchronisation of coupled points.
pointSync true;


// Patches to create.
// If no patches does a coupled point and face synchronisation anyway.
patches
(
{
// Name of new patch
name cyclicTest;

// Type of new patch
type cyclic;

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

// If constructFrom = patches : names of patches
patches (XMIN XMAX);

}

);
Using the 1.5-dev version of OpenFOAM I only get the following :
Quote:

Create time

Reading createPatchDict.

Using relative tolerance 0.001 to match up faces and points

Create polyMesh for time = 0

Adding new patch cyclicTest of type cyclic as patch 6

Moving faces from patch XMIN to patch 6
Moving faces from patch XMAX to patch 6

Doing topology modification to order faces.

Segmentation fault

Am I missing something obvious? I thought the bug was solved years ago....
Thanks in advance...
Pal

mcjicpm2 May 28, 2009 10:15

creating cyclic boundary condition
 
Hi, I am having difficulty in creating cyclic boundary condition, I have done it this way:
1- I created a mesh in Gambit (Quarter of a cylinder) and I called the two planes symmetrya and symmetryb. and I set them to be symmetry for periodic bc.
2-set the writePrecision in system/controlDict to 12.
3-In the end of *.msh file I saw
(0 "Cells:")
(12 (0 1 5eb78 0))
(12 (2 1 5eb78 1 4))

(0 "Zones:")
(45 (2 fluid fluid)())
(45 (3 mass-flow-inlet ariinlet2)())
(45 (4 symmetry symmetryb)())
(45 (5 symmetry symmetrya)())
(45 (6 pressure-outlet outlet)())
(45 (7 wall wall)())
(45 (8 mass-flow-inlet airinlet1)())
(45 (9 mass-flow-inlet fuelinlet)())
(45 (11 interior default-interior)())

I did not change anything here, and leave it as it is.
3-then I ran fluentMeshTofoam *.msh :

Building boundary and internal patches.
Creating patch 0 for zone: 3 start: 1 end: 25 type: mass-flow-inlet name: ariinlet2
Creating patch 1 for zone: 4 start: 26 end: 10345 type: symmetry name: symmetryb
Creating patch 2 for zone: 5 start: 10346 end: 20665 type: symmetry name: symmetrya
Creating patch 3 for zone: 6 start: 20666 end: 23898 type: pressure-outlet name: outlet
Creating patch 4 for zone: 7 start: 23899 end: 34233 type: wall name: wall
Creating patch 5 for zone: 8 start: 34234 end: 34263 type: mass-flow-inlet name: airinlet1
Creating patch 6 for zone: 9 start: 34264 end: 34306 type: mass-flow-inlet name: fuelinlet
Creating patch 7 for zone: 11 start: 34307 end: 1181033 type: interior name: default-interior
Adding new patch ariinlet2 of type patch as patch 0
Adding new patch symmetryb of type symmetryPlane as patch 1
Adding new patch symmetrya of type symmetryPlane as patch 2
Adding new patch outlet of type patch as patch 3
Adding new patch wall of type wall as patch 4
Adding new patch airinlet1 of type patch as patch 5
Adding new patch fuelinlet of type patch as patch 6
Patch default-interior is internal to the mesh and is not being added to the boundary.

Default patch type set to empty

Writing mesh... to "constant/polyMesh" done.


End


4-It creates in the constant/polymesh ---> boundary :

7
(
ariinlet2
{
type patch;
nFaces 25;
startFace 1146727;
}
symmetryb
{
type symmetryPlane;
nFaces 10320;
startFace 1146752;
}
symmetrya
{
type symmetryPlane;
nFaces 10320;
startFace 1157072;
}
outlet
{
type patch;
nFaces 3233;
startFace 1167392;
}
wall
{
type wall;
nFaces 10335;
startFace 1170625;
}
airinlet1
{
type patch;
nFaces 30;
startFace 1180960;
}
fuelinlet
{
type patch;
nFaces 43;
startFace 1180990;
}
)


5-then I define the createPatchDict in /system and within that I have:
matchTolerance 1E-3;
pointSync true;
patches
(
{
name symmetrya;

type cyclic;

constructFrom patches;

patches (symmetrya symmetryb);
}
);

6-then I ran createPatch, this was the outcome:
Create time

Reading createPatchDict.

Using relative tolerance 0.001 to match up faces and points

Create polyMesh for time = 0


Moving faces from patch symmetrya to patch 2
Moving faces from patch symmetryb to patch 2

Doing topology modification to order faces.

Synchronising points.
Points changed by average:0 max:0

Removing patches with no faces in them.

Removing empty patch symmetryb at position 1
Removing patches.
Writing repatched mesh to 1

End
7-It creates a folder /1/polyMesh and within that:
[]$ ls
boundary cellZones faces faceZones neighbour owner points pointZones

8-vi boundary :
6
(
ariinlet2
{
type patch;
nFaces 25;
startFace 1146727;
}
symmetrya
{
type symmetryPlane;
nFaces 20640;
startFace 1146752;
}
outlet
{
type patch;
nFaces 3233;
startFace 1167392;
}
wall
{
type wall;
nFaces 10335;
startFace 1170625;
}
airinlet1
{
type patch;
nFaces 30;
startFace 1180960;
}
fuelinlet
{
type patch;
nFaces 43;
startFace 1180990;
}
)

8-I copy all the contents of this folder to constant/polymesh/

9- I did changed the symmetryplane type now to cyclic for symmetrya

10-I did the simpleFoam and I received this error:

Create time
Create mesh for time = 0
face 0 area does not match neighbour 10320 by 21.8435% -- possible face ordering problem.
patch:symmetrya my area:0.000277 neighbour area:0.000344925 matching tolerance:0.001
Mesh face:1146752 vertices:4((0 0 0.1123) (0.05 0 0.1123) (0.05 0 0.11784) (0 0 0.11784))
Neighbour face:1157072 vertices:4((0 0.043315 0) (0 0.0502135 0) (0.05 0.0502135 0) (0.05 0.043315 0))
Rerun with cyclic debug flag set for more information.

From function cyclicPolyPatch::calcTransforms()
in file meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C at line 150.

FOAM exiting



Can anyone help me with this problem?

waynezw0618 June 17, 2009 05:00

You need renumbering the patches.
i am not sure if the createPatch utilites has as function.
i do the renumbering in ICEMCFD
Quote:

Originally Posted by mcjicpm2 (Post 217442)
Hi, I am having difficulty in creating cyclic boundary condition, I have done it this way:
1- I created a mesh in Gambit (Quarter of a cylinder) and I called the two planes symmetrya and symmetryb. and I set them to be symmetry for periodic bc.
2-set the writePrecision in system/controlDict to 12.
3-In the end of *.msh file I saw
(0 "Cells:")
(12 (0 1 5eb78 0))
(12 (2 1 5eb78 1 4))

(0 "Zones:")
(45 (2 fluid fluid)())
(45 (3 mass-flow-inlet ariinlet2)())
(45 (4 symmetry symmetryb)())
(45 (5 symmetry symmetrya)())
(45 (6 pressure-outlet outlet)())
(45 (7 wall wall)())
(45 (8 mass-flow-inlet airinlet1)())
(45 (9 mass-flow-inlet fuelinlet)())
(45 (11 interior default-interior)())

I did not change anything here, and leave it as it is.
3-then I ran fluentMeshTofoam *.msh :

Building boundary and internal patches.
Creating patch 0 for zone: 3 start: 1 end: 25 type: mass-flow-inlet name: ariinlet2
Creating patch 1 for zone: 4 start: 26 end: 10345 type: symmetry name: symmetryb
Creating patch 2 for zone: 5 start: 10346 end: 20665 type: symmetry name: symmetrya
Creating patch 3 for zone: 6 start: 20666 end: 23898 type: pressure-outlet name: outlet
Creating patch 4 for zone: 7 start: 23899 end: 34233 type: wall name: wall
Creating patch 5 for zone: 8 start: 34234 end: 34263 type: mass-flow-inlet name: airinlet1
Creating patch 6 for zone: 9 start: 34264 end: 34306 type: mass-flow-inlet name: fuelinlet
Creating patch 7 for zone: 11 start: 34307 end: 1181033 type: interior name: default-interior
Adding new patch ariinlet2 of type patch as patch 0
Adding new patch symmetryb of type symmetryPlane as patch 1
Adding new patch symmetrya of type symmetryPlane as patch 2
Adding new patch outlet of type patch as patch 3
Adding new patch wall of type wall as patch 4
Adding new patch airinlet1 of type patch as patch 5
Adding new patch fuelinlet of type patch as patch 6
Patch default-interior is internal to the mesh and is not being added to the boundary.

Default patch type set to empty

Writing mesh... to "constant/polyMesh" done.


End


4-It creates in the constant/polymesh ---> boundary :

7
(
ariinlet2
{
type patch;
nFaces 25;
startFace 1146727;
}
symmetryb
{
type symmetryPlane;
nFaces 10320;
startFace 1146752;
}
symmetrya
{
type symmetryPlane;
nFaces 10320;
startFace 1157072;
}
outlet
{
type patch;
nFaces 3233;
startFace 1167392;
}
wall
{
type wall;
nFaces 10335;
startFace 1170625;
}
airinlet1
{
type patch;
nFaces 30;
startFace 1180960;
}
fuelinlet
{
type patch;
nFaces 43;
startFace 1180990;
}
)


5-then I define the createPatchDict in /system and within that I have:
matchTolerance 1E-3;
pointSync true;
patches
(
{
name symmetrya;

type cyclic;

constructFrom patches;

patches (symmetrya symmetryb);
}
);

6-then I ran createPatch, this was the outcome:
Create time

Reading createPatchDict.

Using relative tolerance 0.001 to match up faces and points

Create polyMesh for time = 0


Moving faces from patch symmetrya to patch 2
Moving faces from patch symmetryb to patch 2

Doing topology modification to order faces.

Synchronising points.
Points changed by average:0 max:0

Removing patches with no faces in them.

Removing empty patch symmetryb at position 1
Removing patches.
Writing repatched mesh to 1

End
7-It creates a folder /1/polyMesh and within that:
[]$ ls
boundary cellZones faces faceZones neighbour owner points pointZones

8-vi boundary :
6
(
ariinlet2
{
type patch;
nFaces 25;
startFace 1146727;
}
symmetrya
{
type symmetryPlane;
nFaces 20640;
startFace 1146752;
}
outlet
{
type patch;
nFaces 3233;
startFace 1167392;
}
wall
{
type wall;
nFaces 10335;
startFace 1170625;
}
airinlet1
{
type patch;
nFaces 30;
startFace 1180960;
}
fuelinlet
{
type patch;
nFaces 43;
startFace 1180990;
}
)

8-I copy all the contents of this folder to constant/polymesh/

9- I did changed the symmetryplane type now to cyclic for symmetrya

10-I did the simpleFoam and I received this error:

Create time
Create mesh for time = 0
face 0 area does not match neighbour 10320 by 21.8435% -- possible face ordering problem.
patch:symmetrya my area:0.000277 neighbour area:0.000344925 matching tolerance:0.001
Mesh face:1146752 vertices:4((0 0 0.1123) (0.05 0 0.1123) (0.05 0 0.11784) (0 0 0.11784))
Neighbour face:1157072 vertices:4((0 0.043315 0) (0 0.0502135 0) (0.05 0.0502135 0) (0.05 0.043315 0))
Rerun with cyclic debug flag set for more information.

From function cyclicPolyPatch::calcTransforms()
in file meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C at line 150.

FOAM exiting



Can anyone help me with this problem?


AirS November 5, 2009 11:11

Hi mcjicpm2,
Ive got exactly the same problem as you.
I did renumberMesh as waynezw0618 mentionned, but It does not work...
I created a cycle patch by using createPatch like so :

////////////////////////////////////////
matchToTolerance 1E-3;
pointSync true;
patches
{
{
name frontAndBack;
dictionary
{
type patch;
}
constructFrom patches;
patches (front back);
}
}
/////////////////////////////////////////

After having successfully run createPatch, I went to the boundary file and removed the type "patch" as the type "cyclic".
Then, when I want to use decomposePar I got this on the screen:

///////////////////////////////////////////////////////////////////////////////
Create time

Create mesh for time = 0



face 66 area does not match neighbour 14089 by 0.106552% -- possible face ordering problem.
patch:frontAndBack my area:9.9849e-06 neighbour area:9.99554e-06 matching tolerance:0.001
Mesh face:1215005 vertices:4((-0.711454 -0.08125 0.625) (-0.667023 -0.08125 0.625) (-0.666929 -0.0810225 0.625) (-0.711373 -0.0810281 0.625))
Neighbour face:1229028 vertices:4((-0.711454 -0.08125 0.103) (-0.711373 -0.0810279 0.103) (-0.66693 -0.0810222 0.103) (-0.667023 -0.08125 0.103))
Rerun with cyclic debug flag set for more information.

From function cyclicPolyPatch::calcTransforms()
in file meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C at line 180.

FOAM exiting
///////////////////////////////////////////////////////////////////////////////////

I hope you guys can help me :).
Thanks in advance!

AirS November 13, 2009 07:14

Problem solved by changing the match tolerance to 0.2.


All times are GMT -4. The time now is 15:08.