diff --git a/src/dynamicMesh/dynamicFvMesh/mixerGgiFvMesh/mixerGgiFvMesh.C b/src/dynamicMesh/dynamicFvMesh/mixerGgiFvMesh/mixerGgiFvMesh.C index a320de585..f0562f8bc 100644 --- a/src/dynamicMesh/dynamicFvMesh/mixerGgiFvMesh/mixerGgiFvMesh.C +++ b/src/dynamicMesh/dynamicFvMesh/mixerGgiFvMesh/mixerGgiFvMesh.C @@ -138,8 +138,16 @@ void Foam::mixerGgiFvMesh::calcMovingMasks() const const cellList& c = cells(); const faceList& f = allFaces(); - const labelList& cellAddr = - cellZones()[cellZones().findZoneID("movingCells")]; + label movingCellsID = cellZones().findZoneID("movingCells"); + + if (movingCellsID < 0) + { + FatalErrorIn("void mixerGgiFvMesh::calcMovingMasks() const") + << "Cannot find moving cell zone ID" + << abort(FatalError); + } + + const labelList& cellAddr = cellZones()[movingCellsID]; forAll (cellAddr, cellI) { @@ -162,13 +170,10 @@ void Foam::mixerGgiFvMesh::calcMovingMasks() const forAll (movingPatches, patchI) { - polyPatchID movingSliderID - ( - movingPatches[patchI], - boundaryMesh() - ); + const label movingSliderID = + boundaryMesh().findPatchID(movingPatches[patchI]); - if (!movingSliderID.active()) + if (movingSliderID < 0) { FatalErrorIn("void mixerGgiFvMesh::calcMovingMasks() const") << "Moving slider named " << movingPatches[patchI] @@ -177,7 +182,7 @@ void Foam::mixerGgiFvMesh::calcMovingMasks() const } const ggiPolyPatch& movingGgiPatch = - refCast(boundaryMesh()[movingSliderID.index()]); + refCast(boundaryMesh()[movingSliderID]); const labelList& movingSliderAddr = movingGgiPatch.zone(); @@ -197,13 +202,10 @@ void Foam::mixerGgiFvMesh::calcMovingMasks() const forAll (staticPatches, patchI) { - polyPatchID staticSliderID - ( - staticPatches[patchI], - boundaryMesh() - ); + const label staticSliderID = + boundaryMesh().findPatchID(movingPatches[patchI]); - if (!staticSliderID.active()) + if (staticSliderID < 0) { FatalErrorIn("void mixerGgiFvMesh::calcMovingMasks() const") << "Static slider named " << staticPatches[patchI] @@ -212,7 +214,7 @@ void Foam::mixerGgiFvMesh::calcMovingMasks() const } const ggiPolyPatch& staticGgiPatch = - refCast(boundaryMesh()[staticSliderID.index()]); + refCast(boundaryMesh()[staticSliderID]); const labelList& staticSliderAddr = staticGgiPatch.zone(); diff --git a/src/dynamicMesh/topoChangerFvMesh/multiMixerFvMesh/mixerRotor.C b/src/dynamicMesh/topoChangerFvMesh/multiMixerFvMesh/mixerRotor.C index a3197a2c4..503be205d 100644 --- a/src/dynamicMesh/topoChangerFvMesh/multiMixerFvMesh/mixerRotor.C +++ b/src/dynamicMesh/topoChangerFvMesh/multiMixerFvMesh/mixerRotor.C @@ -28,6 +28,7 @@ License #include "regionSplit.H" #include "polyTopoChanger.H" #include "slidingInterface.H" +#include "ggiPolyPatch.H" #include "Time.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -221,8 +222,17 @@ void Foam::mixerRotor::calcMovingMask() const const cellList& c = mesh_.cells(); const faceList& f = mesh_.allFaces(); - const labelList& cellAddr = mesh_.cellZones() - [mesh_.cellZones().findZoneID("movingCellsZone" + name_)]; + label movingCellZoneID = + mesh_.cellZones().findZoneID("movingCellsZone" + name_); + + if (movingCellZoneID < 0) + { + FatalErrorIn("void mixerRotor::calcMovingMask() const") + << "Cannot find moving cell zone ID" + << abort(FatalError); + } + + const labelList& cellAddr = mesh_.cellZones()[movingCellZoneID]; forAll (cellAddr, cellI) { @@ -241,8 +251,35 @@ void Foam::mixerRotor::calcMovingMask() const } // Attempt to enforce motion on sliders if zones exist - const label msI = - mesh_.faceZones().findZoneID(movingSliderName_ + "Zone" + name_); + + // Master side + label msI = -1; + + if (useTopoSliding_) + { + // For topological changes, find the zone + msI = mesh_.faceZones().findZoneID(movingSliderName_ + "Zone" + name_); + } + else + { + // For GGI, take face zone from ggi interpolator + label movingSliderIndex = + mesh_.boundaryMesh().findPatchID(movingSliderName_); + + if (movingSliderIndex > -1) + { + if (isA(mesh_.boundaryMesh()[movingSliderIndex])) + { + const ggiPolyPatch& movingSliderGgi = + refCast + ( + mesh_.boundaryMesh()[movingSliderIndex] + ); + + msI = mesh_.faceZones().findZoneID(movingSliderGgi.zoneName()); + } + } + } if (msI > -1) { @@ -259,8 +296,35 @@ void Foam::mixerRotor::calcMovingMask() const } } - const label ssI = - mesh_.faceZones().findZoneID(staticSliderName_ + "Zone" + name_); + // Slave side + label ssI = -1; + + if (useTopoSliding_) + { + // For topological changes, find the zone + ssI = mesh_.faceZones().findZoneID(staticSliderName_ + "Zone" + name_); + } + else + { + // For GGI, take face zone from ggi interpolator + label staticSliderIndex = + mesh_.boundaryMesh().findPatchID(staticSliderName_); + + if (staticSliderIndex > -1) + { + if (isA(mesh_.boundaryMesh()[staticSliderIndex])) + { + const ggiPolyPatch& staticSliderGgi = + refCast + ( + mesh_.boundaryMesh()[staticSliderIndex] + ); + + ssI = mesh_.faceZones().findZoneID(staticSliderGgi.zoneName()); + } + } + } + if (ssI > -1) {