Treating Cyclic Boundary Conditions #20
JanGaertner
started this conversation in
Ideas
Replies: 1 comment 2 replies
-
|
Hello, Jan. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment




Uh oh!
There was an error while loading. Please reload this page.
-
In the current implementation, the stencil collection algorithm cannot handle cyclic boundary conditions. This means that for cells at at cyclic boundary condition, cells on the other side of the boundary will not be considered.
Stencil Collection with Cyclic Boundaries
To collect the cells for the stencil the
cellCells()function is used recursively to get all neighboring cells inWENOBase::createStencilID(). This function however, does not return cells beyond any boundary condition even if they are at a cyclic or processor boundary.A possibility to collect all cells even at a cyclic boundary condition could be the usage of a getNeighbourCells() function:
Foam::labelList Foam::WENOBase::getNeighbourCells ( const fvMesh& mesh, const label cellI ) { labelList neighbCells = mesh.cellCells()[cellI]; // Check if cell is at the boundary. const cell& faces = mesh.cells()[cellI]; const polyBoundaryMesh& bMesh = mesh.boundaryMesh(); forAll(faces,faceI) { // Internal faces return -1 other faces return boundaryPatchID const label boundaryPatchID = bMesh.whichPatch(faces[faceI]); if (boundaryPatchID != -1) { if ( bMesh[boundaryPatchID].coupled() && isA<cyclicPolyPatch>(bMesh[boundaryPatchID]) ) { const cyclicPolyPatch& patch = refCast<const cyclicPolyPatch> (bMesh[boundaryPatchID]); // Get the neighbour patch neighbCells.append((patch.neighbPatch()).faceCells()[faces[faceI]]); } } } return neighbCells; }This function can get all the neighbor cells, however within the sort stencil function the distance to the reference cell is calculated with the absolute position of the cells, which does not know that some cells are collected over the cyclic boundary. This could in theory be also solved by tracking an additional list in which the positions of the cells in the stencil list are saved. For cells that are collected over a cyclic boundary the
transform()function ofcyclicPolyPatchcould be used to get the correct, virtual, cell position.However, for the geometryWENO functions, especially the
transformIntegralfunction the cells on the mesh are required. Here, all points that are calculated with thepolyMeshTetDecomposition::cellTetIndiceswould needed to be transformed as well. Yet, at this point in the code it is not known from which cyclic boundary the transformation should be taken, unless this information is tracked as well.In conclusion. adding the function to calculate the stencil list and matrices over cyclic boundaries would require a lot of communication and tracking overhead, which introduce a lot of complexity, and possible errors.
Therefore, I have decided to not include this function.
If anyone sees, a simpler and effective way to integrate the stencil collection for coupled boundaries please post an idea here or generate a pull request if you have a proposed solution.
Beta Was this translation helpful? Give feedback.
All reactions