From fee3998d24ab688e289414c8a976d7590987f687 Mon Sep 17 00:00:00 2001 From: Henrik Rusche Date: Wed, 10 Jul 2013 00:58:53 +0200 Subject: [PATCH] BUG: send-receive addressing could be recalculated asymmetrically in parallel ENH: Avoid recalculation off addressing on plain attach/detach --- .../constraint/ggi/ggiPolyPatchTemplates.C | 9 +++++ .../regionCouple/regionCouplePolyPatch.C | 33 ++++++++++++++----- .../regionCouple/regionCouplePolyPatch.H | 7 ++-- .../regionCouplePolyPatchTemplates.C | 11 ++++++- .../regionCouplingFvPatchField.C | 2 -- 5 files changed, 49 insertions(+), 13 deletions(-) diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatchTemplates.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatchTemplates.C index 563549be8..10a116a76 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatchTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/ggi/ggiPolyPatchTemplates.C @@ -82,6 +82,15 @@ Foam::tmp > Foam::ggiPolyPatch::fastExpand << abort(FatalError); } + // HR, 10/Jul/2013 + // This function requires send-receive-addressing, but usage is not + // symmetric across processors. Hence trigger re-calculate at this point + if (Pstream::parRun() && !localParallel()) + { + receiveAddr(); + shadow().receiveAddr(); + } + // Expand the field to zone size tmp > texpandField ( diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C index e4b7904ae..76943f88f 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.C @@ -318,13 +318,13 @@ void Foam::regionCouplePolyPatch::calcLocalParallel() const localParallelPtr_ = new bool(false); bool& emptyOrComplete = *localParallelPtr_; - // If running in serial, all GGIs are expanded to zone size. + // If running in parallel, all GGIs are expanded to zone size. // This happens on decomposition and reconstruction where // size and shadow size may be zero, but zone size may not // HJ, 1/Jun/2011 if (!Pstream::parRun()) { - emptyOrComplete = false; + emptyOrComplete = true; } else { @@ -346,7 +346,7 @@ void Foam::regionCouplePolyPatch::calcLocalParallel() const if (emptyOrComplete) { - Info<< "local parallel" << endl; + Info<< "local parallel" << endl; } else { @@ -468,9 +468,15 @@ Foam::regionCouplePolyPatch& Foam::regionCouplePolyPatch::shadow() } -void Foam::regionCouplePolyPatch::clearGeom() const +void Foam::regionCouplePolyPatch::clearDeltas() const { deleteDemandDrivenData(reconFaceCellCentresPtr_); +} + + +void Foam::regionCouplePolyPatch::clearGeom() const +{ + clearDeltas(); // Remote addressing and send-receive maps depend on the local // position. Therefore, it needs to be recalculated at mesh motion. @@ -480,16 +486,19 @@ void Foam::regionCouplePolyPatch::clearGeom() const deleteDemandDrivenData(receiveAddrPtr_); deleteDemandDrivenData(sendAddrPtr_); + + // localParallel depends on geometry - must be cleared! + // HR, 11/Jul/2013 + deleteDemandDrivenData(localParallelPtr_); } -void Foam::regionCouplePolyPatch::clearOut() +void Foam::regionCouplePolyPatch::clearOut() const { clearGeom(); deleteDemandDrivenData(zoneAddressingPtr_); deleteDemandDrivenData(patchToPatchPtr_); - deleteDemandDrivenData(localParallelPtr_); } @@ -800,7 +809,11 @@ void Foam::regionCouplePolyPatch::attach() const // Patch-to-patch interpolation does not need to be cleared, // only face/cell centres and interpolation factors // HJ, 6/Jun/2011 - clearGeom(); + //clearGeom() + + // Clear delta coefficients, but keep the rest. + // HR, 10/Jul/2013 + clearDeltas(); } } @@ -815,7 +828,11 @@ void Foam::regionCouplePolyPatch::detach() const // Patch-to-patch interpolation does not need to be cleared, // only face/cell centres and interpolation factors // HJ, 6/Jun/2011 - clearGeom(); + //clearGeom() + + // Clear delta coefficients, but keep the rest. + // HR, 10/Jul/2013 + clearDeltas(); } } diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.H b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.H index 970295cd9..4379613c0 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.H +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatch.H @@ -155,11 +155,14 @@ class regionCouplePolyPatch // Memory management + //- Clear delta coefficients + void clearDeltas() const; + //- Clear geometry - void clearGeom() const; + void clearGeom() const; //- Clear out - void clearOut(); + void clearOut() const; protected: diff --git a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatchTemplates.C b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatchTemplates.C index 617af8cf0..0106df1e1 100644 --- a/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatchTemplates.C +++ b/src/OpenFOAM/meshes/polyMesh/polyPatches/constraint/regionCouple/regionCouplePolyPatchTemplates.C @@ -51,7 +51,7 @@ Foam::tmp > Foam::regionCouplePolyPatch::fastExpand // Notes: // A) If the size of zone addressing is zero, data is not sent // B) Communicated data on each processor has the size of live faces - // C) Expanded data will be equal to actual data fronm other processors + // C) Expanded data will be equal to actual data from other processors // only for the faces marked in remote; for other faces, it will be // equal to zero // D) On processor zero, complete data is available @@ -81,6 +81,15 @@ Foam::tmp > Foam::regionCouplePolyPatch::fastExpand << abort(FatalError); } + // This function requires send-receive-addressing, but usage is not + // symmetric across processors. Hence trigger re-calculate at this point + // HR, 10/Jul/2013 + if (Pstream::parRun() && !localParallel()) + { + receiveAddr(); + shadow().receiveAddr(); + } + // Expand the field to zone size tmp > texpandField ( diff --git a/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.C b/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.C index 1ee72e8bc..af0cfc2b2 100644 --- a/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.C +++ b/src/finiteVolume/fields/fvPatchFields/constraint/regionCoupling/regionCouplingFvPatchField.C @@ -410,7 +410,6 @@ void regionCouplingFvPatchField::initInterfaceMatrixUpdate "regionCouplingFvPatchField::initInterfaceMatrixUpdate" ) << "init matrix update called in detached state" << abort(FatalError); - } } @@ -461,7 +460,6 @@ void regionCouplingFvPatchField::updateInterfaceMatrix "regionCouplingFvPatchField::updateInterfaceMatrix" ) << "Matrix update called in detached state" << abort(FatalError); - } }