MRF: Made compatible with non-conformal couplings (NCC)
MRF requires mapping from a given set of polyMesh cells and faces to internal and boundary faces of the finite volume system. It therefore has to use the polyBFacePatches and polyBFacePatchFaces maps in order to be compatible with NCC. This has been implemented, and now MRF should be fully compatible with NCC.
This commit is contained in:
@ -44,48 +44,39 @@ namespace Foam
|
|||||||
|
|
||||||
void Foam::MRFZone::setMRFFaces()
|
void Foam::MRFZone::setMRFFaces()
|
||||||
{
|
{
|
||||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
const polyBoundaryMesh& pbMesh = mesh_.boundaryMesh();
|
||||||
|
const fvBoundaryMesh& fvbMesh = mesh_.boundary();
|
||||||
|
|
||||||
// Is face in MRF zone:
|
// Determine cells and faces in the MRF zone
|
||||||
// false: not in MRF zone
|
|
||||||
// true: in MRF zone
|
|
||||||
boolList faceInMRF(mesh_.nFaces(), false);
|
boolList faceInMRF(mesh_.nFaces(), false);
|
||||||
|
boolList cellInMRF(mesh_.nCells(), false);
|
||||||
// Determine faces in cell zone
|
|
||||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
||||||
// (without constructing cells)
|
|
||||||
|
|
||||||
const labelList& own = mesh_.faceOwner();
|
|
||||||
const labelList& nei = mesh_.faceNeighbour();
|
|
||||||
|
|
||||||
// Cells in zone
|
|
||||||
boolList zoneCell(mesh_.nCells(), false);
|
|
||||||
|
|
||||||
const labelUList cells = cellSet_.cells();
|
|
||||||
forAll(cells, i)
|
|
||||||
{
|
{
|
||||||
zoneCell[cells[i]] = true;
|
const labelUList MRFCells = cellSet_.cells();
|
||||||
|
|
||||||
|
forAll(MRFCells, i)
|
||||||
|
{
|
||||||
|
cellInMRF[MRFCells[i]] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
|
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
|
||||||
{
|
{
|
||||||
if (zoneCell[own[facei]] || zoneCell[nei[facei]])
|
if
|
||||||
|
(
|
||||||
|
cellInMRF[mesh_.faceOwner()[facei]]
|
||||||
|
|| cellInMRF[mesh_.faceNeighbour()[facei]]
|
||||||
|
)
|
||||||
{
|
{
|
||||||
faceInMRF[facei] = true;
|
faceInMRF[facei] = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
forAll(patches, patchi)
|
forAll(pbMesh, patchi)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchi];
|
forAll(pbMesh[patchi], patchFacei)
|
||||||
|
{
|
||||||
|
const label facei = pbMesh[patchi].start() + patchFacei;
|
||||||
|
|
||||||
if (!isA<emptyPolyPatch>(pp))
|
if (cellInMRF[mesh_.faceOwner()[facei]])
|
||||||
{
|
|
||||||
forAll(pp, i)
|
|
||||||
{
|
|
||||||
const label facei = pp.start() + i;
|
|
||||||
|
|
||||||
if (zoneCell[own[facei]])
|
|
||||||
{
|
{
|
||||||
faceInMRF[facei] = true;
|
faceInMRF[facei] = true;
|
||||||
}
|
}
|
||||||
@ -96,85 +87,48 @@ void Foam::MRFZone::setMRFFaces()
|
|||||||
// Synchronise the faceInMRF across processor patches
|
// Synchronise the faceInMRF across processor patches
|
||||||
syncTools::syncFaceList(mesh_, faceInMRF, orEqOp<bool>());
|
syncTools::syncFaceList(mesh_, faceInMRF, orEqOp<bool>());
|
||||||
|
|
||||||
// Sort into lists per patch.
|
// Construct a list of all internal FV faces in the MRF zone
|
||||||
|
internalFaces_ =
|
||||||
|
findIndices
|
||||||
|
(
|
||||||
|
SubList<bool>(faceInMRF, mesh_.nInternalFaces()),
|
||||||
|
true
|
||||||
|
);
|
||||||
|
|
||||||
internalFaces_.setSize(mesh_.nFaces());
|
// Construct lists of patch FV faces in the MRF zone
|
||||||
label nInternal = 0;
|
|
||||||
|
|
||||||
for (label facei = 0; facei < mesh_.nInternalFaces(); facei++)
|
|
||||||
{
|
{
|
||||||
if (faceInMRF[facei])
|
patchFaces_.setSize(fvbMesh.size());
|
||||||
{
|
|
||||||
internalFaces_[nInternal++] = facei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
internalFaces_.setSize(nInternal);
|
|
||||||
|
|
||||||
labelList nPatchFaces(patches.size(), 0);
|
forAll(fvbMesh, patchi)
|
||||||
|
|
||||||
forAll(patches, patchi)
|
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchi];
|
patchFaces_[patchi].setSize(fvbMesh[patchi].size());
|
||||||
|
|
||||||
forAll(pp, patchFacei)
|
|
||||||
{
|
|
||||||
const label facei = pp.start() + patchFacei;
|
|
||||||
|
|
||||||
if (faceInMRF[facei])
|
|
||||||
{
|
|
||||||
nPatchFaces[patchi]++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
patchFaces_.setSize(patches.size());
|
labelList patchNFaces(fvbMesh.size(), 0);
|
||||||
forAll(patchFaces_, patchi)
|
|
||||||
|
for
|
||||||
|
(
|
||||||
|
label facei = mesh_.nInternalFaces(), bFacei = 0;
|
||||||
|
facei < mesh_.nFaces();
|
||||||
|
++ facei, ++ bFacei
|
||||||
|
)
|
||||||
{
|
{
|
||||||
patchFaces_[patchi].setSize(nPatchFaces[patchi]);
|
if (!faceInMRF[facei]) continue;
|
||||||
}
|
|
||||||
nPatchFaces = 0;
|
|
||||||
|
|
||||||
forAll(patches, patchi)
|
const labelUList patches = mesh_.polyBFacePatches()[bFacei];
|
||||||
|
const labelUList patchFaces = mesh_.polyBFacePatchFaces()[bFacei];
|
||||||
|
|
||||||
|
forAll(patches, i)
|
||||||
{
|
{
|
||||||
const polyPatch& pp = patches[patchi];
|
patchFaces_[patches[i]][patchNFaces[patches[i]] ++] =
|
||||||
|
patchFaces[i];
|
||||||
forAll(pp, patchFacei)
|
|
||||||
{
|
|
||||||
const label facei = pp.start() + patchFacei;
|
|
||||||
|
|
||||||
if (faceInMRF[facei])
|
|
||||||
{
|
|
||||||
patchFaces_[patchi][nPatchFaces[patchi]++] = patchFacei;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (debug)
|
|
||||||
{
|
|
||||||
faceSet internalFaces(mesh_, "internalFaces", internalFaces_);
|
|
||||||
|
|
||||||
Pout<< "Writing " << internalFaces.size()
|
|
||||||
<< " internal faces in MRF zone to faceSet "
|
|
||||||
<< internalFaces.name() << endl;
|
|
||||||
|
|
||||||
internalFaces.write();
|
|
||||||
|
|
||||||
faceSet patchFaces(mesh_, "patchFaces", 100);
|
|
||||||
forAll(patchFaces_, patchi)
|
|
||||||
{
|
|
||||||
forAll(patchFaces_[patchi], i)
|
|
||||||
{
|
|
||||||
const label patchFacei = patchFaces_[patchi][i];
|
|
||||||
patchFaces.insert(patches[patchi].start()+patchFacei);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Pout<< "Writing " << patchFaces.size()
|
forAll(fvbMesh, patchi)
|
||||||
<< " faces in MRF zone with special handling to faceSet "
|
{
|
||||||
<< patchFaces.name() << endl;
|
patchFaces_[patchi].setSize(patchNFaces[patchi]);
|
||||||
|
}
|
||||||
patchFaces.write();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user