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] CreatePatch to create cyclic boundary (https://www.cfd-online.com/Forums/openfoam-meshing/61479-createpatch-create-cyclic-boundary.html)

sbence January 21, 2009 18:23

CreatePatch to create cyclic boundary
 
Hi All!

I would need some help on the usage of the i{createPatch} utility.
I am calculating a straight pipe. I would like to create cyclic boundary conditions for the inlet and outlet. I have existing patches for the inlet "in", and outlet "out". I have created the mesh with CalculiX, so the files in the polyMesh directory (boundary, cells, faces, etc.) are existing already and there is no blockMeshDict file.

Here is the boundary file:
FoamFile
{
version 2.0;
format ascii;

root "..";
case ".";
instance "constant";
local "polyMesh";

class polyBoundaryMesh;
object boundary;
}

3
(
in
{
type cyclic;
nFaces 768;
startFace 224160;
}

out
{
type cyclic;
nFaces 768;
startFace 224928;
}

wall
{
type wall;
nFaces 6336;
startFace 225696;
}

)

Here is the createPatchDict file:
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.0 |
| \ / A nd | Web: http://www.openfoam.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/

FoamFile
{
version 2.0;
format ascii;

root "/home/bence/OpenFOAM/bence-1.5/run/practice/tube3/";
case "tube_turbulent_kEpsilon_HighRe-cyclic";
instance "system";
local "";

class dictionary;
object createPatcheDict;
}

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

// 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 io_cyclic;

// Type of new patch
type cyclic;

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

// If constructFrom = patches : names of patches
patches (in out);

// If constructFrom = set : name of faceSet
//set f0;
}
);

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


Could somebody have a look at them?

Thanks in advance!

BR,
Bence

sbence January 21, 2009 18:54

I have changed the boundary fi
 
I have changed the boundary file:
FoamFile
{
version 2.0;
format ascii;

root "..";
case ".";
instance "constant";
local "polyMesh";

class polyBoundaryMesh;
object boundary;
}

3
(
in
{
type patch;
nFaces 768;
startFace 224160;
}

out
{
type patch;
nFaces 768;
startFace 224928;
}

wall
{
type wall;
nFaces 6336;
startFace 225696;
}

)


Now my createPatch output looks the following:
Create time

Reading createPatchDict.

Using relative tolerance 0.001 to match up faces and points

Create polyMesh for time = 0

Adding new patch io_cyclic of type cyclic as patch 3

Moving faces from patch in to patch 3
Moving faces from patch out to patch 3

Doing topology modification to order faces.

#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/bence/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#1 Foam::sigSegv::sigSegvHandler(int) in "/home/bence/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#2 Uninterpreted: [0xb7f80420]
#3 Foam::face::normal(Foam::Field<foam::vector<double > > const&) const in "/home/bence/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#4 Foam::cyclicPolyPatch::getCentresAndAnchors(Foam:: PrimitivePatch<foam::face,> > const&, Foam::Vector<double> > const&, Foam::List<foam::face> const&, Foam::List<foam::face> const&, Foam::Field<foam::vector<double> >&, Foam::Field<foam::vector<double> >&, Foam::Field<foam::vector<double> >&, Foam::Field<double>&) const in "/home/bence/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#5 Foam::cyclicPolyPatch::order(Foam::PrimitivePatch< foam::face,> > const&, Foam::Vector<double> > const&, Foam::List<int>&, Foam::List<int>&) const in "/home/bence/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libOpenFOAM.so"
#6 Foam::polyTopoChange::reorderCoupledFaces(bool, Foam::polyBoundaryMesh const&, Foam::List<int> const&, Foam::List<int> const&, Foam::Field<foam::vector<double> > const&) in "/home/bence/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libdynamicMesh.so"
#7 Foam::polyTopoChange::compactAndReorder(Foam::poly Mesh const&, bool, bool, bool, int&, Foam::Field<foam::vector<double> >&, Foam::List<int>&, Foam::List<int>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::map<int> >&, Foam::List<int>&, Foam::List<int>&, Foam::List<foam::map<int> >&) in "/home/bence/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libdynamicMesh.so"
#8 Foam::polyTopoChange::changeMesh(Foam::polyMesh&, bool, bool, bool, bool) in "/home/bence/OpenFOAM/OpenFOAM-1.5/lib/linuxGccDPOpt/libdynamicMesh.so"
#9 main in "/home/bence/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/createPatch"
#10 __libc_start_main in "/lib/tls/i686/cmov/libc.so.6"
#11 __gxx_personality_v0 in "/home/bence/OpenFOAM/OpenFOAM-1.5/applications/bin/linuxGccDPOpt/createPatch"
Segmentation fault


Any help is appreciated!

BR,
Bence

sbence January 27, 2009 04:36

Solved meanwhile... Bence
 
Solved meanwhile...

Bence

eriklarsson February 12, 2009 03:47

Dear Foamers I also have pr
 
Dear Foamers

I also have problems with setting up my cyclic boundaries. I'm using 1.5-dev.

My mesh is simple and was made in ANSA and exported as a .msh. The case runs well with simpleFoam with both wall and symmetry BCs.

My /constant/polymesh/boundary is:
5
(
Right
{
type patch;
nFaces 2121;
startFace 122699;
}
wall
{
type patch;
nFaces 4040;
startFace 124820;
}
Left
{
type patch;
nFaces 2121;
startFace 128860;
}
Out
{
type patch;
nFaces 420;
startFace 130981;
}
In
{
type patch;
nFaces 420;
startFace 131401;
}
)}

And my createPatchDict is

matchTolerance 1E-7;
pointSync true;
patches
(
{
name LR_cyclic;
type cyclic;
constructFrom patches;
patches (Right Left);

}
);

This simply returns
Create time

Reading createPatchDict.

Using relative tolerance 1e-07 to match up faces and points

Create polyMesh for time = 0

Adding new patch LR_cyclic of type cyclic as patch 5

Moving faces from patch Right to patch 5
Moving faces from patch Left to patch 5

Doing topology modification to order faces.

Segmentation fault




I also tried setting /constant/polyMesh/boundary
Right
{
type cyclic;
separationOffset (0 0 0);
rotationAxis (1 0 0);
rotationAngle -60;
shadowPatch Left;
nFaces 2121;
startFace 122699;
}
Left
{
type cyclic;
separationOffset (0 0 0);
rotationAxis (1 0 0);
rotationAngle 60;
shadowPatch Right;
nFaces 2121;
startFace 128860;
}

However, this only causes the soloution to diverge.

Can someone please give me some hints?

Bence, can you post your fix to the your problem?

Regards
Erik Larsson

mbeaudoin February 12, 2009 10:11

Hello Erik, For your second
 
Hello Erik,

For your second example of the file /constant/polyMesh/boundary:

You are using a patch definition appropriate for a cyclicGgi, and not for a "standard" cyclic patch.

You might want to try using a cyclicGgi instead of the cyclic patch for your problem. The cyclicGgi can handle conformal patches as well.

Just make sure your rotation axis and rotation angle are properly defined. And also replace cyclic with cyclicGgi where needed.

Martin

saasebo February 19, 2009 06:33

Hello Bence, Could I ask wh
 
Hello Bence,

Could I ask what the solution was to the segmentation fault error from createPatch above?

BR, Steinar

eriklarsson February 19, 2009 08:51

Dear Foamers, I would just
 
Dear Foamers,

I would just like to add that my rotation sngles in the cyclicGgi case were defined with the wrong sign, just as Beaudoin suggested. The cyclicGgi is working now.

Apparently, even with the rotation angles badly defined, OpenFOAM still solves for the velocities. In my case, it was not until the pressure loop that OpenFOAM returned "Floating exception".

Regards
Erik Larsson

obraun February 20, 2009 11:21

I would be interested in the s
 
I would be interested in the solution of the segmentation fault too, it's just what happens to me... I will let you know if I find out...

obraun February 20, 2009 11:24

Hi all, I would be interest
 
Hi all,

I would be interested in the solution of the segmentation fault too, it's just what happens to me... I will let you know if I find out...

Cheers

Olivier

crazysumi February 24, 2009 09:45

Dear Mr Somogyi, In respect
 
Dear Mr Somogyi,

In respect to your post dated "Wednesday, January 21, 2009" regarding the createPatch utility. I am also getting the same error 'segmentation fault' as you have reported.

Could you tell us how you resolved it.

Thanks
SK

mattijs February 24, 2009 17:46

Hello Erik, createPatch sho
 
Hello Erik,

createPatch should be able to create a cyclic from two non-cyclic patches and worked last time I tried in 1.5.x.
The faces have to match but don't have to be ordered. Report a bug in OpenFOAM-bugs if you have a testcase.

crazysumi February 25, 2009 05:27

Dear Mr Somogyi, In respect
 
Dear Mr Somogyi,

In respect to your post dated "Wednesday, January 21, 2009" regarding the createPatch utility. I am also getting the same error 'segmentation fault' as you have reported.

Could you tell us how you resolved it.

Thanks
SK

crazysumi February 25, 2009 06:24

My createPatchDict File :- ma
 
My createPatchDict File :-
matchTolerance 1E-6;

// 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 periodic;

// Type of new patch
type cyclic;

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

// If constructFrom = patches : names of patches
patches (periodic2 periodic1);

// If constructFrom = set : name of faceSet
//set f0;
}

On running the createPatch utility, the error messages I received:-

sm.kumar@linux:~/OpenFOAM/sm.kumar-1.5/Sumeet/Nozzle/Of_Nozzle> createPatch
/*---------------------------------------------------------------------------*\
| ========= | |
| \ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \ / O peration | Version: 1.5 |
| \ / A nd | Web: http://www.OpenFOAM.org |
| \/ M anipulation | |
\*---------------------------------------------------------------------------*/
Exec : createPatch
Date : Feb 25 2009
Time : 16:41:47
Host : linux
PID : 27071
Case : /home/sm.kumar/OpenFOAM/sm.kumar-1.5/Sumeet/Nozzle/Of_Nozzle
nProcs : 1

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

Reading createPatchDict.

Using relative tolerance 1e-06 to match up faces and points

Create polyMesh for time = 0

Adding new patch periodic of type cyclic as patch 9

Moving faces from patch periodic2 to patch 9
Moving faces from patch periodic1 to patch 9

Doing topology modification to order faces.

#0 Foam::error::printStack(Foam:http://www.cfd-online.com/OpenFOAM_D...part/proud.gifstream&) in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#1 Foam::sigSegv::sigSegvHandler(int) in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#2 ?? in "/lib64/libc.so.6"
#3 Foam::face::normal(Foam::Field<foam::vector<double > > const&) const in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#4 Foam::cyclicPolyPatch::getCentresAndAnchors(Foam:: PrimitivePatch<foam::face,> > const&, Foam::Vector<double> > const&, Foam::List<foam::face> const&, Foam::List<foam::face> const&, Foam::Field<foam::vector<double> >&, Foam::Field<foam::vector<double> >&, Foam::Field<foam::vector<double> >&, Foam::Field<double>&) const in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#5 Foam::cyclicPolyPatch::order(Foam::PrimitivePatch< foam::face,> > const&, Foam::Vector<double> > const&, Foam::List<int>&, Foam::List<int>&) const in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"
#6 Foam::polyTopoChange::reorderCoupledFaces(bool, Foam::polyBoundaryMesh const&, Foam::List<int> const&, Foam::List<int> const&, Foam::Field<foam::vector<double> > const&) in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libdynamicMesh.so"
#7 Foam::polyTopoChange::compactAndReorder(Foam::poly Mesh const&, bool, bool, bool, int&, Foam::Field<foam::vector<double> >&, Foam::List<int>&, Foam::List<int>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::objectmap>&, Foam::List<foam::map<int> >&, Foam::List<int>&, Foam::List<int>&, Foam::List<foam::map<int> >&) in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libdynamicMesh.so"
#8 Foam::polyTopoChange::changeMesh(Foam::polyMesh&, bool, bool, bool, bool) in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/lib/linux64GccDPOpt/libdynamicMesh.so"
#9 main in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/createPat ch"
#10 __libc_start_main in "/lib64/libc.so.6"
#11 __gxx_personality_v0 in "/home/sm.kumar/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/createPat ch"
Segmentation fault

obraun February 25, 2009 08:36

Hi all, http://www.cfd-onl
 
Hi all,

http://www.cfd-online.com/OpenFOAM_D...tml?1222760531

http://www.cfd-online.com/OpenFOAM_D...s/1/10743.html

and as told by Mattijs this is supposed to be fixed in 1.5.x I am just having it compiled and looking forward to the problem being solved. I'll keep you informed.

Olivier

P.S.: The trickky thing was I did not get into this trouble with a rather coarse grid after declaring periodic/shadow pair in fluent and remerging this first as a normal patch and then decalring it as cyclic, must have been luck that no renumbering took place. So I thought it should work with a fine one, but for some spurious reasons the same procedure ended up in badly ordered faces and the segfault with the finer mesh.

obraun February 25, 2009 12:21

Confirm everything is fine wit
 
Confirm everything is fine with 1.5.x

waterboy March 25, 2009 07:10

Face size important for cyclic
 
Hi,
As I am using SHM to create a propeller mesh I can hardly guarantee that the two patches are equal when it comes to face size. In general it should be possible to interpolate from one patch to the other although there are different face sizes, just like mapFields does it, or not?
Has anyone already tried and succeeded in using "different" patches? Bence tried it according to his boundary file, right?
Any hints welcome,
Pal

Fonss July 26, 2009 15:51

It looks like I have that problem.

$ createPatch
/*---------------------------------------------------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 1.5 |
| \\ / A nd | Web: http://www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
Exec : createPatch
Date : Jul 26 2009
Time : 11:38:16
Host : Studio
PID : 14494
Case : /home/alfo/Desktop/Foam_run/test_1
nProcs : 1

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

Reading createPatchDict.

Using relative tolerance 0.001 to match up faces and points

Create polyMesh for time = 0

Adding new patch fan1 of type cyclic as patch 3

Moving faces from patch fan_in to patch 3
Moving faces from patch fan_out to patch 3

Doing topology modification to order faces.

cyclicPolyPatch::getGeometricHalves : Writing half0 faces to OBJ file "/home/alfo/Desktop/Foam_run/test_1/fan1_half0_faces.obj"
cyclicPolyPatch::getGeometricHalves : Writing half1 faces to OBJ file "/home/alfo/Desktop/Foam_run/test_1/fan1_half1_faces.obj"
cyclicPolyPatch::getGeometricHalves : Writing half0 face centres to OBJ file "/home/alfo/Desktop/Foam_run/test_1/fan1_half0.obj"
cyclicPolyPatch::getGeometricHalves : Writing half1 face centres to OBJ file "/home/alfo/Desktop/Foam_run/test_1/fan1_half1.obj"
--> FOAM Serious Error :
From function cyclicPolyPatch::getGeometricHalves(const primitivePatch&, labelList&, labelList&) const
in file meshes/polyMesh/polyPatches/constraint/cyclic/cyclicPolyPatch.C at line 362
Patch fan1 gets decomposed in two zones ofinequal size: 347 and 377
This means that the patch is either not two separate regions or one region where the angle between the different regions is not sufficiently sharp.
Please adapt the featureCos setting.
Continuing with incorrect face ordering from now on!


face 0 area does not match neighbour 362 by 2.06188% -- possible face ordering problem.
patch:fan1 my area:5.01411 neighbour area:5.11857 matching tolerance:0.001
Mesh face:26040 vertices:3((0 0 -50.9467) (0 0 -47.6196) (3.0141 0 -49.577))
Neighbour face:26402 vertices:3((3.136 3 -22.1557) (2.19942 3 -26.0631) (4.92856 3 -25.6075))
Rerun with cyclic debug flag set for more information.

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

FOAM exiting

alfo@Studio:~/Desktop/Foam_run/test_1$ couplePatches
bash: couplePatches: command not found


I was just trying to use this command because some people suggested that couplePatches might do something... maybe but its not there. I'm going to have to try to recompile the 1.5.x again. The first time it did not work.

ouafa August 17, 2009 09:35

Quote:

Originally Posted by obraun (Post 187030)
Confirm everything is fine with 1.5.x

Hi,

I have modified the cavity case to a real cube with front and back patches in order to make a cyclic condition with the createPatch tool later. The mesh seems to be fine.
The createPatchDict looks like this:

matchTolerance 1E-3;
pointSync true;

patches
({name inout;
type cyclic;
constructFrom patches;
patches (inlet outlet);
});

I am also getting the same error 'segmentation fault' as you have reported. i try to use developpement version but i can't see any difference between the two createPatch files.



Doing topology modification to order faces.


#0 Foam::error: rintStack(Foam::Ostream&) in "/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"

#1 Foam::sigSegv::sigSegvHandler(int) in "/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"

#2 __restore_rt at sigaction.c:0

#3 Foam::face::normal(Foam::Field<Foam::Vector<double > > const&) const in "/ OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"

#4 Foam::cyclicPolyPatch::getCentresAndAnchors(Foam:: PrimitivePatch<Foam::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> > const&, Foam::List<Foam::face> const&, Foam::List<Foam::face> const&, Foam::Field<Foam::Vector<double> >&, Foam::Field<Foam::Vector<double> >&, Foam::Field<Foam::Vector<double> >&, Foam::Field<double>&) const in "/OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"

#5 Foam::cyclicPolyPatch:rder(Foam::PrimitivePatch<Fo am::face, Foam::SubList, Foam::Field<Foam::Vector<double> > const&, Foam::Vector<double> > const&, Foam::List<int>&, Foam::List<int>&) const in /OpenFOAM-1.5/lib/linux64GccDPOpt/libOpenFOAM.so"

#6 Foam:olyTopoChange::reorderCoupledFaces(bool, Foam:olyBoundaryMesh const&, Foam::List<int> const&, Foam::List<int> const&, Foam::Field<Foam::Vector<double> > const&) in "/OpenFOAM-1.5/lib/linux64GccDPOpt/libdynamicMesh.so"

#7 Foam::polyTopoChange::compactAndReorder(Foam::poly Mesh const&, bool, bool, bool, int&, Foam::Field<Foam::Vector<double> >&, Foam::List<int>&, Foam::List<int>&, Foam::List<Foam:bjectMap>&, Foam::List<Foam:bjectMap>&, Foam::List<Foam:bjectMap>&, Foam::List<Foam:bjectMap>&, Foam::List<Foam:bjectMap>&, Foam::List<Foam:bjectMap>&, Foam::List<Foam:bjectMap>&, Foam::List<Foam:bjectMap>&, Foam::List<Foam::Map<int> >&, Foam::List<int>&, Foam::List<int>&, Foam::List<Foam::Map<int> >&) in /OpenFOAM-1.5/lib/linux64GccDPOpt/libdynamicMesh.so"

#8 Foam::polyTopoChange::changeMesh(Foam::polyMesh&, bool, bool, bool, bool) in "/OpenFOAM-1.5/lib/linux64GccDPOpt/libdynamicMesh.so"

#9 main in "/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/createPatch"
#10 __libc_start_main in "/lib64/libc.so.6"

#11 __gxx_personality_v0 in "/home/flurec/commun/OpenFOAM/OpenFOAM-1.5/applications/bin/linux64GccDPOpt/createPatch"

Erreur de segmentation

Thanks in advance for help!
Ouafa

JackW August 30, 2012 06:51

Hi,

Probably not much help, but when I get a seg fault at the topology stage when I run createPatch, It is because I am trying to create it from the wrong patches or ones that I have already used (an artifact from copying and pasting carelessness), so the topology doesn't match.


All times are GMT -4. The time now is 00:11.