Parallelisation updates on dynamic mesh classes: mixer

This commit is contained in:
Hrvoje Jasak 2011-05-28 13:01:34 +01:00
parent 7ccb738219
commit 03c0f8a3c6
2 changed files with 88 additions and 22 deletions

View file

@ -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<const ggiPolyPatch>(boundaryMesh()[movingSliderID.index()]);
refCast<const ggiPolyPatch>(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<const ggiPolyPatch>(boundaryMesh()[staticSliderID.index()]);
refCast<const ggiPolyPatch>(boundaryMesh()[staticSliderID]);
const labelList& staticSliderAddr = staticGgiPatch.zone();

View file

@ -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<ggiPolyPatch>(mesh_.boundaryMesh()[movingSliderIndex]))
{
const ggiPolyPatch& movingSliderGgi =
refCast<const ggiPolyPatch>
(
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<ggiPolyPatch>(mesh_.boundaryMesh()[staticSliderIndex]))
{
const ggiPolyPatch& staticSliderGgi =
refCast<const ggiPolyPatch>
(
mesh_.boundaryMesh()[staticSliderIndex]
);
ssI = mesh_.faceZones().findZoneID(staticSliderGgi.zoneName());
}
}
}
if (ssI > -1)
{