From b9d1febcdcdcbd8883f5cee4962f1d1e305e634b Mon Sep 17 00:00:00 2001 From: Hrvoje Jasak Date: Fri, 16 Nov 2018 11:58:46 +0000 Subject: [PATCH] Buxfix: multiGgiRotorFvMesh, move ggi zone points --- .../multiGgiRotorFvMesh/ggiRotor.C | 78 ++++++++++++++++++- .../multiGgiRotorFvMesh/ggiRotor.H | 6 ++ 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.C b/src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.C index a116c20a5..2cfbf01a5 100644 --- a/src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.C +++ b/src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.C @@ -25,6 +25,7 @@ License #include "ggiRotor.H" #include "foamTime.H" +#include "ggiPolyPatch.H" // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // @@ -44,8 +45,19 @@ void Foam::ggiRotor::calcMovingMask() const const cellList& c = mesh_.cells(); const faceList& f = mesh_.allFaces(); - const labelList& cellAddr = mesh_.cellZones() - [mesh_.cellZones().findZoneID(movingCellsZoneName_)]; + // Find cellZone + const label cellZoneID = mesh_.cellZones().findZoneID(movingCellsZoneName_); + + if (cellZoneID == -1) + { + FatalErrorIn("void ggiRotor::calcMovingMask() const") + << "Cannot find moving cell zone " << movingCellsZoneName_ + << ". Available cell zones: " << mesh_.cellZones().names() + << abort(FatalError); + + } + + const labelList& cellAddr = mesh_.cellZones()[cellZoneID]; forAll (cellAddr, cellI) { @@ -62,6 +74,66 @@ void Foam::ggiRotor::calcMovingMask() const } } } + + // Grab the ggi patches on the moving side + forAll (movingPatches_, patchI) + { + const label movingSliderID = + mesh_.boundaryMesh().findPatchID(movingPatches_[patchI]); + + if (movingSliderID < 0) + { + FatalErrorIn("void mixerGgiFvMesh::calcMovingMasks() const") + << "Moving slider named " << movingPatches_[patchI] + << " not found. Valid patch names: " + << mesh_.boundaryMesh().names() << abort(FatalError); + } + + const ggiPolyPatch& movingGgiPatch = + refCast(mesh_.boundaryMesh()[movingSliderID]); + + const labelList& movingSliderAddr = movingGgiPatch.zone(); + + forAll (movingSliderAddr, faceI) + { + const face& curFace = f[movingSliderAddr[faceI]]; + + forAll (curFace, pointI) + { + movingPointsMask[curFace[pointI]] = 1; + } + } + } + + // Grab the ggi patches on the static side + forAll (staticPatches_, patchI) + { + const label staticSliderID = + mesh_.boundaryMesh().findPatchID(staticPatches_[patchI]); + + if (staticSliderID < 0) + { + FatalErrorIn("void mixerGgiFvMesh::calcMovingMasks() const") + << "Static slider named " << staticPatches_[patchI] + << " not found. Valid patch names: " + << mesh_.boundaryMesh().names() << abort(FatalError); + } + + const ggiPolyPatch& staticGgiPatch = + refCast(mesh_.boundaryMesh()[staticSliderID]); + + const labelList& staticSliderAddr = staticGgiPatch.zone(); + + forAll (staticSliderAddr, faceI) + { + const face& curFace = f[staticSliderAddr[faceI]]; + + forAll (curFace, pointI) + { + movingPointsMask[curFace[pointI]] = 0; + } + } + } } @@ -101,6 +173,8 @@ Foam::ggiRotor::ggiRotor ), rpm_(readScalar(dict.lookup("rpm"))), movingCellsZoneName_(dict.lookup("movingCells")), + movingPatches_(dict.lookup("movingPatches")), + staticPatches_(dict.lookup("staticPatches")), movingPointsMaskPtr_(NULL) { // Make sure the coordinate system does not operate in degrees diff --git a/src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.H b/src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.H index a35d6449b..2cf705c74 100644 --- a/src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.H +++ b/src/dynamicMesh/dynamicFvMesh/multiGgiRotorFvMesh/ggiRotor.H @@ -74,6 +74,12 @@ class ggiRotor //- Moving cells zone const word movingCellsZoneName_; + //- Moving patches: for zones + const wordList movingPatches_; + + //- Static patches: for zones + const wordList staticPatches_; + //- Markup field for points. Moving points marked with 1 mutable scalarField* movingPointsMaskPtr_;