From e74451a7700739750fec88c5e1c848a3b2509c30 Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 21 Feb 2014 16:17:23 +0000 Subject: [PATCH 01/13] BUG: processorCyclic - updated group naming on consttuct from components --- .../polyPatches/constraint/processor/processorPolyPatch.C | 7 ++++--- .../polyPatches/constraint/processor/processorPolyPatch.H | 5 +++-- .../constraint/processorCyclic/processorCyclicPolyPatch.C | 6 ++++-- .../constraint/processorCyclic/processorCyclicPolyPatch.H | 3 ++- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C index 37e2fb4d..c72f4ea7 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -56,10 +56,11 @@ Foam::processorPolyPatch::processorPolyPatch const polyBoundaryMesh& bm, const int myProcNo, const int neighbProcNo, - const transformType transform + const transformType transform, + const word& patchType ) : - coupledPolyPatch(name, size, start, index, bm, typeName, transform), + coupledPolyPatch(name, size, start, index, bm, patchType, transform), myProcNo_(myProcNo), neighbProcNo_(neighbProcNo), neighbFaceCentres_(), diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H index 6a3d202a..63c2a7dd 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processor/processorPolyPatch.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -136,7 +136,8 @@ public: const polyBoundaryMesh& bm, const int myProcNo, const int neighbProcNo, - const transformType transform = UNKNOWN // transformation type + const transformType transform = UNKNOWN, // transformation type + const word& patchType = typeName ); //- Construct from dictionary diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C index 927c0e80..e2d86a49 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.C @@ -49,7 +49,8 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch const int myProcNo, const int neighbProcNo, const word& referPatchName, - const transformType transform + const transformType transform, + const word& patchType ) : processorPolyPatch @@ -61,7 +62,8 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch bm, myProcNo, neighbProcNo, - transform + transform, + patchType ), referPatchName_(referPatchName), tag_(-1), diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H index 2bfc2c98..3ede0219 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/processorCyclic/processorCyclicPolyPatch.H @@ -122,7 +122,8 @@ public: const int myProcNo, const int neighbProcNo, const word& referPatchName, - const transformType transform = UNKNOWN + const transformType transform = UNKNOWN, + const word& patchType = typeName ); //- Construct from dictionary From 9e38fbdbe4aa38f13e15e8ad9a5c99f1f3e3e6be Mon Sep 17 00:00:00 2001 From: andy Date: Fri, 21 Feb 2014 16:18:00 +0000 Subject: [PATCH 02/13] BUG: decomposePar - updated to handle multiple processor cyclic patches - mantis 879 --- .../decomposePar/domainDecomposition.H | 23 ++- .../decomposePar/domainDecompositionMesh.C | 163 ++++++++---------- .../domainDecompositionTemplates.C | 125 ++++++++++++++ 3 files changed, 216 insertions(+), 95 deletions(-) create mode 100644 applications/utilities/parallelProcessing/decomposePar/domainDecompositionTemplates.C diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H index 9487aefe..21bc8e61 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecomposition.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2013 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -130,7 +130,7 @@ class domainDecomposition //- Append single element to list static void append(labelList&, const label); - //- Add face to interProcessor patch. + //- Add face to inter-processor patch void addInterProcFace ( const label facei, @@ -141,6 +141,19 @@ class domainDecomposition List > >& ) const; + //- Generate sub patch info for processor cyclics + template + void processInterCyclics + ( + const polyBoundaryMesh& patches, + List > >& interPatchFaces, + List >& procNbrToInterPatch, + List& subPatchIDs, + List& subPatchStarts, + bool owner, + BinaryOp bop + ) const; + public: @@ -187,6 +200,12 @@ public: } // End namespace Foam +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#ifdef NoRepository + #include "domainDecompositionTemplates.C" +#endif + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // #endif diff --git a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C index 14512332..f5a76722 100644 --- a/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C +++ b/applications/utilities/parallelProcessing/decomposePar/domainDecompositionMesh.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,9 +32,7 @@ Description #include "domainDecomposition.H" #include "IOstreams.H" -#include "SLPtrList.H" #include "boolList.H" -#include "primitiveMesh.H" #include "cyclicPolyPatch.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -209,10 +207,11 @@ void Foam::domainDecomposition::decomposeMesh() // Done internal bits of the new mesh and the ordinary patches. - // Per processor, from neighbour processor to the interprocessorpatch that - // communicates with that neighbour. + // Per processor, from neighbour processor to the inter-processor patch + // that communicates with that neighbour List > procNbrToInterPatch(nProcs_); - // Per processor the faces per interprocessorpatch. + + // Per processor the faces per inter-processor patch List > > interPatchFaces(nProcs_); // Processor boundaries from internal faces @@ -248,95 +247,73 @@ void Foam::domainDecomposition::decomposeMesh() subPatchStarts[procI].setSize(nInterfaces, labelList(1, label(0))); } - // Processor boundaries from split cyclics - forAll(patches, patchi) - { - if (isA(patches[patchi])) - { - const cyclicPolyPatch& pp = refCast - ( - patches[patchi] - ); - // cyclic: check opposite side on this processor - const labelUList& patchFaceCells = pp.faceCells(); - const labelUList& nbrPatchFaceCells = - pp.neighbPatch().faceCells(); + // Special handling needed for the case that multiple processor cyclic + // patches are created on each local processor domain, e.g. if a 3x3 case + // is decomposed using the decomposition: + // + // | 1 | 0 | 2 | + // cyclic left | 2 | 0 | 1 | cyclic right + // | 2 | 0 | 1 | + // + // - processors 1 and 2 will both have pieces of both cyclic left- and + // right sub-patches present + // - the interface patch faces are stored in a single list, where each + // sub-patch is referenced into the list using a patch start index and + // size + // - if the patches are in order (in the boundary file) of left, right + // - processor 1 will send: left, right + // - processor 1 will need to receive in reverse order: right, left + // - similarly for processor 2 + // - the sub-patches are therefore generated in 4 passes of the patch lists + // 1. add faces from owner patch where local proc i < nbr proc i + // 2. add faces from nbr patch where local proc i < nbr proc i + // 3. add faces from owner patch where local proc i > nbr proc i + // 4. add faces from nbr patch where local proc i > nbr proc i - // Store old sizes. Used to detect which inter-proc patches - // have been added to. - labelListList oldInterfaceSizes(nProcs_); - forAll(oldInterfaceSizes, procI) - { - labelList& curOldSizes = oldInterfaceSizes[procI]; + processInterCyclics + ( + patches, + interPatchFaces, + procNbrToInterPatch, + subPatchIDs, + subPatchStarts, + true, + lessOp