CFD Online Discussion Forums

CFD Online Discussion Forums (http://www.cfd-online.com/Forums/)
-   OpenFOAM (http://www.cfd-online.com/Forums/openfoam/)
-   -   Problem with cyclic boundaries in Openfoam 1.5 (http://www.cfd-online.com/Forums/openfoam/64299-problem-cyclic-boundaries-openfoam-1-5-a.html)

fs82 May 6, 2009 11:26

Problem with cyclic boundaries in Openfoam 1.5
 
Hello,

I have a really annoying problem concerning cylic boundaries with OpenFoam 1.5. The mesh generator is Gambit and I convert the mesh with fluentMeshToFoam and for cyclic boundaries is use the createPatch utility. With a simple channel everything works fine but the thats not what I am interested in. My focus lies on a circular cylinder with perodic boundary in spanwise direction. Gambit exports the mesh without any problems and my periodic boundary is defined as "wall". FluentMeshToFoam converts the mesh and I have to change in constants/polymesh/boundary the wall entry of my perodic boundary to cyclic. In createPatchDict I have to define every periodic patch, a matchingTolerance and if I want to have a synchronisation of coupled points. I set matchingTolerance to 1E-3 and Sync to true. And this is what I get after using createPatch utility:

face 0 area does not match neighbour 2520 by 188.925% -- possible face ordering problem.
patch:p_z15 my area:0.00822951 neighbour area:0.000234351 matching tolerance:0.001
Mesh face:914248 vertices:4((1.37852 1.44903 4) (1.25963 1.32406 4) (1.29225 1.29225 4) (1.41421 1.41421 4))
Neighbour face:916768 vertices:4((0.428847 0.450783 4) (0.418304 0.439701 4) (0.429136 0.429136 4) (0.439952 0.439952 4))
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.

Increasing the matchingTolerance produces the same error, exept if it becomes greater than 2, than it works ... but I dont trust the periodic boundary, because 2 seems to be a little bit to high for a tolerance? Where is my mistake? I dont have any idea. Please help :(

chegdan May 6, 2009 23:25

Change write precision
 
Try changing your write precision in your controlDict to 10 before you convert your mesh. If it is 3D try using the fluent3DMeshToFoam command. Also, make sure you have linked your edges correctly in Gambit. I had a similar problem a few weeks ago.

Dan

fs82 May 7, 2009 05:02

Thx for your quick help, but this doesn't work. :-/
1) I tested the writePrecision but nothing changed ... I still have this anoying error. I guess this was a major problem of earlier OpenFoam versions and should be fixed in 1.5.
2) fluent3DMeshToFoam produces a segmentation fault:
Creating cellZone 0 name: fluid type: fluid
#0 Foam::error::printStack(Foam::Ostream&)
#1 Foam::sigSegv::sigSegvHandler(int)
...
Segmentation fault
3) During my test with the channel I recognized, that linking the faces of the periodic boundary produces an error in createPatch and without linking everything is fine.
For my cylinder mesh I tried first without linking, which produces the error above. Now due to your reply I linked every face of my perodic boundary (I have to decompose my boundary in serveral parts to help gambit with meshing) and the error above is still the same.

I dont have any idea what to do. The cylinder test case is just a simplification of my real problem and I need this periodic boundaries and Gambit for meshing (blockMesh utility is no option). I am open for any idea which could fix my problem. If anybody needs my mesh-files, please tell me I will upload them.

Thx,
fs82

chegdan May 7, 2009 13:39

Try posting your mesh and let me know what patches are cyclic. If you have a .jou file to go with it so I can generate the mesh myself that would be great. I had this problem a few months ago and it was incredibly annoying. I found some posts on the message board that helped.

Dan

fs82 May 8, 2009 02:45

This would be great if you could try it. I have no more idea, what to try next :/
I uploaded the files to my webaccount. If you klick on the link below, you will find a zip-archiv with all neccesary gambit files included and my createPatchDict. I think I named everything in english, except the file name :D Periodic are all "p_z<number>" patches.

Thanks a lot.

Fabian

http://wwwpub.zih.tu-dresden.de/~fschleg/cylinder.zip

chegdan May 10, 2009 13:18

still not sure
 
I took a look at your mesh file and imported the mesh with no problems. I did however get the same problem that you have. I would make sure of a few things.

1. Make sure that you liked the faces correctly. I had a similar problem and I wasn't linking the faces correctly and reversing the direction correctly. Make sure that you pick the mirror image of the vertex on opposing sides and the arrows that leave the opposing vertices are going the same direction. Since your mesh is nice, it may be hard to tell if you have the right direction. If you use a tet mesh the mesh becomes twisted and its obvious that its going the wrong direction. I suspect that this is it.

2. Make sure you change the write precision. Once i fixed my mesh linking problem, that was another problem. I think that this problem was pointed out in:
http://www.cfd-online.com/Forums/ope...-boundary.html

3. Try making the the periodic boundaries as separate faces in GAMBIT (after the edges/faces have been linked and volume meshed), then check to make sure that the number of points and cells match. After that you can make them into cyclic patches in OF.

Thats all I can think of right now. Try some of those and if it doesn't work, then go back to a simple geometry and try that until you have the method down.

Dan

fs82 May 11, 2009 08:32

Yeah I found the problem. For everyone who is dealing with the same problem concerning cyclic boundaries in OpenFoam try the following:

1) as mentioned above from chegdan, make sure that you have linked all your faces correctly (Reverse orientation switch in Gambit have to be ON)

2) if you have split your perodic boundaries into parts to help gambit for meshing, put every part of your periodic boundary into one patch. Do not put both faces which should be periodic into the same boundary patch. They have to be separate patches.

3) export mesh with Gambit

4) use fluentMeshToFoam

5) create a CreatePatchDict dictionary in system/ folder and combine your separate perodic patches to one. For type use cyclic. Do not touch constant/polymesh/boundary for this step.

Example:
{
name pz_1;
type cyclic;
constructFrom patches;
patches (pz_1 pz_1shadow);
set f0;
}

6) run createPatch utility. This will combine the periodic patches to one and renumber it for OpenFoam.

7) open constant/polymesh/boundary and change wall to cyclic for your periodic boundaries. Do not forget to change your createPatchDict, because you have combined two patches to one right before.

8) rerun createPatch for making your boundaries perodic

This should work und looks good for me. I guess the problem ist Gambit, which numbers the faces without any order if you put both parts of your perodic boundary into one patch. I think fluent does not care about the numbering of the boundary faces but OpenFoam (CreatePatch) does. So for me it works :-D

Thx chegdan for your help.

Fabian

Edit: If you still have Problems: Make sure you have set WritePrecision in controlDict to a value greater than 10. Also try to remove functions from controlDict (comment them out).

chegdan May 11, 2009 10:57

glad I could help
 
Glad I could help.

fs82 May 13, 2009 09:31

I still have another problem with periodic boundaries. I tried another Gambit mesh to convert it to OpenFoam. This is a simple channel with two periodic boundaries. With the steps I described above I get a error during the second run of createPatch:

Synchronising points.
--> FOAM Warning :
From function syncTools<class T, class CombineOp>::syncPointList(const polyMesh&, UList<T>&, const CombineOp&, const T&, const bool)
in file /home/dm2/henry/OpenFOAM/OpenFOAM-1.5/src/OpenFOAM/lnInclude/syncToolsTemplates.C at line 1047
There are decomposed cyclics in this mesh with transformations.
This is not supported. The result will be incorrect
Points changed by average:0.00458973012292 max:7.02481475253

I am not really sure what synchronisation of points does, but if I turn it of everything works fine. Is this problem due to my TWO periodic boundaries? May be the converter is not able to distinguish between the two periodic patches?

Fabian

cwang5 May 13, 2009 21:46

I've had similar problem before. It turned out that I set the write tolerance too small (it was initially set as 1e-6 or something, now it's happily staying at 2e-2 and works great.) I'll try and see if I can get your grid working when I get back into my lab later today, though (that's where I have openfoam installed,I'm still trying to figure out how to scp a file on a windows machine to a linux machine.)

________

EDIT:

Yeah, I just realized that I do have X windows on my current workstation and downloaded your file through firefox. Anyway, I think there's a few problem with your setup.

First of all, I don't think the createPatchDict are setup to handle more than two patches, so you should probably group all the faces on the RHS into a boundary patch called sidewall_right and the faces on LHS into sidewall_left (they should be in the same order when you assign the faces to BC in Gambit, e.g. top to down, front to back or something similar). Hope that helps.

If you need more than one patch on each wall, create the cyclic sets on a 1 to 1 basis just to make sure the face order does not get messed up.

fs82 May 14, 2009 04:44

Thx for having a look to my mesh. Linux offers you a nice little tool called dos2unix which converts Linux files for usage in a microsoft environment. By default is is not installed but you can simple download it via your package manager.
So my cyclinder is now working fine with the process discribed some posts before. Which variable have you set to 2e-2? WritePrecision or matchingTolerance ? I know the easiest way to get createPatch work is adjusting the matchingTolerance, but for my cylinder mesh I have to set the matchingTolerance to a value greater than 2. So if you try my way with two times createPatch, first to combine the two boundaries which should be periodic into one patch and second to make this patch periodic, this works ... that was what I thought until yesterday.
I need a channel mesh, so I created one with Gambit and tried my way to get periodic/cyclic boundaries in flow and crossflow direction. But this does not work and I get the error mentioned one post before.
The solution was to turn of syncronisation of points for the last run of createPatch. So for me it would be interesting what synconisation really does and why it sometimes works and sometimes not. It is not satisfying do figure out a special way of creating periodic boundaries for every new mesh.
While having a closer look to the channel395 tutorial I also noticed another mystery. In this tutorial the cyclic boundaries are in several patches for every side. So one patch for left side, one for right side, one for inflow and one for outflow. I thought you have to have one patch for every perodic boundary, for this example one patch in- and outflow and one patch left and right ... if I try this for my channel I get the annoying possible face ordering problem. I dont know where is my problem?

cwang5 May 14, 2009 05:36

I don't really understand the whole process of channel395 either, but from observation I've concluded that the boundary setup they used for that case only works if the boundary is meshed uniformly.

I've never looked further into the problem since I've managed to get the cyclic patch working by grouping each side of the wall with one patch and combining the two using createPatch, and since I deal more with airfoil simulation instead of channel flow, I guess I never felt the need to look further into the issue. Hope that helps.

fs82 May 14, 2009 06:47

I get the problem ... try and error and a hint in a thread. I have the situation of two periodic boundaries which are orthogonal to each other and this is a problem. CreatePatch is not able to synchronize the nodes which are situated along the corner egde which connect both boundaries. This is because of a different transformation tensor for the same node belonging to several patches. For one the synchronization works but not for both. The nice thing is - may be only for my channel - that the mesh with and without synchronization is the same, so it doesn't mather (a diff on all files in polymesh shows no difference). This could be a result of my writePrecision of 12 but I am not sure. So if you have two periodic boundaries which are connected and lie on different planes turn off pointSync and it will work!
Thx for help
P.S.: May be anybody know what pointSync really does I guess it adjusts the point coordinates?

mcjicpm2 May 28, 2009 10:13

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?

fs82 May 28, 2009 10:23

This looks pretty good, but while reading your post I figured out two possible problems.

1) When you define your boundary conditions in gambit use "wall" not "periodic" or something else. But make sure that you link all your periodic faces.

2) After your step 9 you have to use createPatch again and you will get another directory like in step 7 with a new polymesh (remove the directory from step 7 before you start createPatch again)

Try this and hopefully this will work.

mcjicpm2 June 1, 2009 06:13

creating cyclic boundary condition
 
Hi

I did what you told me but I still have problems,.....

fs82 June 2, 2009 08:25

You still get the error you posted a view days ago? May be you could upload your mesh anywhere? I would try to convert it to OpenFoam for myself.

gascortado January 23, 2011 16:32

cyclic bc problem
 
I have the exact same problem with cyclic BCs and mesh exported from Gambit/Fluent. I followed the procedures described above and still cannot make it work. Did you guys find what the problem was? I'm running out of ideas of how to fix this problem. Thanks

gascortado January 23, 2011 19:18

Aha! I figure it out. I did what mcjicpm2 did above, however, i used Fluent3DtoFoam instead of FluenttoFoam and that made all the difference. Make sure that the faces are properly linked in Gambit though.

gooya_mehdy September 24, 2011 06:23

Quote:

Originally Posted by fs82 (Post 215721)
Yeah I found the problem. For everyone who is dealing with the same problem concerning cyclic boundaries in OpenFoam try the following:

1) as mentioned above from chegdan, make sure that you have linked all your faces correctly (Reverse orientation switch in Gambit have to be ON)

2) if you have split your perodic boundaries into parts to help gambit for meshing, put every part of your periodic boundary into one patch. Do not put both faces which should be periodic into the same boundary patch. They have to be separate patches.

3) export mesh with Gambit

4) use fluentMeshToFoam

5) create a CreatePatchDict dictionary in system/ folder and combine your separate perodic patches to one. For type use cyclic. Do not touch constant/polymesh/boundary for this step.

Example:
{
name pz_1;
type cyclic;
constructFrom patches;
patches (pz_1 pz_1shadow);
set f0;
}

6) run createPatch utility. This will combine the periodic patches to one and renumber it for OpenFoam.

7) open constant/polymesh/boundary and change wall to cyclic for your periodic boundaries. Do not forget to change your createPatchDict, because you have combined two patches to one right before.

8) rerun createPatch for making your boundaries perodic

This should work und looks good for me. I guess the problem ist Gambit, which numbers the faces without any order if you put both parts of your perodic boundary into one patch. I think fluent does not care about the numbering of the boundary faces but OpenFoam (CreatePatch) does. So for me it works :-D

Thx chegdan for your help.

Fabian

Edit: If you still have Problems: Make sure you have set WritePrecision in controlDict to a value greater than 10. Also try to remove functions from controlDict (comment them out).

hi fabian
that realy worked, thanks a lot!!


All times are GMT -4. The time now is 13:38.