From 520a6e2303cef1e36ca4f2cfb4c40ce8236f7bf3 Mon Sep 17 00:00:00 2001 From: Thomas Witkowski <thomas.witkowski@gmx.de> Date: Wed, 30 May 2012 13:27:08 +0000 Subject: [PATCH] Implemented 2D periodic boundaries for FETI-DP method. --- AMDiS/src/parallel/ElementObjectDatabase.cc | 54 +++++++++++++++------ AMDiS/src/parallel/ElementObjectDatabase.h | 13 ++++- AMDiS/src/parallel/MeshDistributor.cc | 12 ++--- 3 files changed, 55 insertions(+), 24 deletions(-) diff --git a/AMDiS/src/parallel/ElementObjectDatabase.cc b/AMDiS/src/parallel/ElementObjectDatabase.cc index 2450ab36..bd1e4480 100644 --- a/AMDiS/src/parallel/ElementObjectDatabase.cc +++ b/AMDiS/src/parallel/ElementObjectDatabase.cc @@ -98,22 +98,41 @@ namespace AMDiS { DofEdge edge0 = el->getEdge(i); DofEdge edge1 = neigh->getEdge(elInfo->getOppVertex(i)); BoundaryType boundaryType = elInfo->getBoundary(EDGE, i); - - // Add the periodic edge. - periodicEdges[make_pair(edge0, edge1)] = boundaryType; - periodicEdgeAssoc[edge0].insert(edge1); - - // Add both vertices of the edge to be periodic. - periodicVertices[make_pair(edge0.first, edge1.first)] = boundaryType; - periodicVertices[make_pair(edge0.second, edge1.second)] = boundaryType; - periodicDofAssoc[edge0.first].insert(boundaryType); - periodicDofAssoc[edge0.second].insert(boundaryType); - - TEST_EXIT_DBG(edge0.first == - mesh->getPeriodicAssociations(boundaryType)[edge1.first] && - edge0.second == - mesh->getPeriodicAssociations(boundaryType)[edge1.second]) - ("Should not happen!\n"); + + + if (removePeriodicBoundary) { + ElementObjectData elObjEdge(el->getIndex(), i); + edgeElements[edge1].push_back(elObjEdge); + edgeLocalMap[elObjEdge] = edge1; + +#if 0 + ElementObjectData elObjVertex0(el->getIndex(), + el->getVertexOfEdge(i, 0)); + vertexElements[edge1.first].push_back(elObjVertex0); + vertexLocalMap[elObjVertex0] = edge1.first; + + ElementObjectData elObjVertex1(el->getIndex(), + el->getVertexOfEdge(i, 1)); + vertexElements[edge1.second].push_back(elObjVertex1); + vertexLocalMap[elObjVertex1] = edge1.first; +#endif + } else { + // Add the periodic edge. + periodicEdges[make_pair(edge0, edge1)] = boundaryType; + periodicEdgeAssoc[edge0].insert(edge1); + + // Add both vertices of the edge to be periodic. + periodicVertices[make_pair(edge0.first, edge1.first)] = boundaryType; + periodicVertices[make_pair(edge0.second, edge1.second)] = boundaryType; + periodicDofAssoc[edge0.first].insert(boundaryType); + periodicDofAssoc[edge0.second].insert(boundaryType); + + TEST_EXIT_DBG(edge0.first == + mesh->getPeriodicAssociations(boundaryType)[edge1.first] && + edge0.second == + mesh->getPeriodicAssociations(boundaryType)[edge1.second]) + ("Should not happen!\n"); + } } } break; @@ -128,6 +147,9 @@ namespace AMDiS { DofFace face0 = el->getFace(i); DofFace face1 = neigh->getFace(elInfo->getOppVertex(i)); BoundaryType boundaryType = elInfo->getBoundary(FACE, i); + + TEST_EXIT(removePeriodicBoundary == false) + ("Not yet implemented for 3D!\n"); // Add the periodic face. periodicFaces[make_pair(face0, face1)] = elInfo->getBoundary(i); diff --git a/AMDiS/src/parallel/ElementObjectDatabase.h b/AMDiS/src/parallel/ElementObjectDatabase.h index 1e0ba1a0..6366f4d2 100644 --- a/AMDiS/src/parallel/ElementObjectDatabase.h +++ b/AMDiS/src/parallel/ElementObjectDatabase.h @@ -107,8 +107,11 @@ namespace AMDiS { mesh(NULL), iterGeoPos(CENTER), macroElementRankMap(NULL), - levelData(NULL) - {} + levelData(NULL), + removePeriodicBoundary(false) + { + Parameters::get("parallel->remove periodic boundary", removePeriodicBoundary); + } void setFeSpace(const FiniteElemSpace *fe) { @@ -575,6 +578,12 @@ namespace AMDiS { map<int, int> macroElIndexTypeMap; MeshLevelData* levelData; + + /// If this variable is set to true, the mesh distributor removes all + /// periodic boundary conditions. The element neighbourhood relation is + /// not changed. Thus, when using some domain decomposition method, this is + /// a natural way to deal with periodic boundary conditions. + bool removePeriodicBoundary; }; } diff --git a/AMDiS/src/parallel/MeshDistributor.cc b/AMDiS/src/parallel/MeshDistributor.cc index fdc0e96b..644c52ed 100644 --- a/AMDiS/src/parallel/MeshDistributor.cc +++ b/AMDiS/src/parallel/MeshDistributor.cc @@ -185,13 +185,13 @@ namespace AMDiS { } - // Test, if the mesh is the macro mesh only! Paritioning of the mesh is supported - // only for macro meshes, so it will not work yet if the mesh is already refined - // in some way. + // Test, if the mesh is the macro mesh only! Paritioning of the mesh is + // supported only for macro meshes, so it will not work yet if the mesh is + // already refined in some way. testForMacroMesh(); - // For later mesh repartitioning, we need to store some information about the - // macro mesh. + // For later mesh repartitioning, we need to store some information about + // the macro mesh. createMacroElementInfo(); // create an initial partitioning of the mesh @@ -741,7 +741,7 @@ namespace AMDiS { // Remove periodic boundaries on elements in mesh. TraverseStack stack; - ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); + ElInfo *elInfo = stack.traverseFirst(mesh, -1, Mesh::CALL_EVERY_EL_PREORDER); while (elInfo) { elInfo->getElement()->deleteElementData(PERIODIC); elInfo = stack.traverseNext(elInfo); -- GitLab