mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: Store additional information to handle split cyclics (still not correct though)
This commit is contained in:
@ -30,6 +30,9 @@ License
|
||||
#include "faceCoupleInfo.H"
|
||||
#include "processorFvPatchField.H"
|
||||
#include "processorFvsPatchField.H"
|
||||
#include "processorCyclicPolyPatch.H"
|
||||
#include "processorCyclicFvPatchField.H"
|
||||
#include "processorCyclicFvsPatchField.H"
|
||||
#include "polyTopoChange.H"
|
||||
#include "removeCells.H"
|
||||
#include "polyModifyFace.H"
|
||||
@ -129,6 +132,7 @@ void Foam::fvMeshDistribute::printMeshInfo(const fvMesh& mesh)
|
||||
{
|
||||
Pout<< "Primitives:" << nl
|
||||
<< " points :" << mesh.nPoints() << nl
|
||||
<< " bb :" << boundBox(mesh.points(), false) << nl
|
||||
<< " internalFaces:" << mesh.nInternalFaces() << nl
|
||||
<< " faces :" << mesh.nFaces() << nl
|
||||
<< " cells :" << mesh.nCells() << nl;
|
||||
@ -188,7 +192,8 @@ void Foam::fvMeshDistribute::printCoupleInfo
|
||||
const primitiveMesh& mesh,
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourceNewProc
|
||||
const labelList& sourcePatch,
|
||||
const labelList& sourceNewNbrProc
|
||||
)
|
||||
{
|
||||
Pout<< nl
|
||||
@ -203,7 +208,7 @@ void Foam::fvMeshDistribute::printCoupleInfo
|
||||
<< " fc:" << mesh.faceCentres()[meshFaceI]
|
||||
<< " connects to proc:" << sourceProc[bFaceI]
|
||||
<< "/face:" << sourceFace[bFaceI]
|
||||
<< " which will move to proc:" << sourceNewProc[bFaceI]
|
||||
<< " which will move to proc:" << sourceNewNbrProc[bFaceI]
|
||||
<< endl;
|
||||
}
|
||||
}
|
||||
@ -271,32 +276,87 @@ Foam::label Foam::fvMeshDistribute::findNonEmptyPatch() const
|
||||
}
|
||||
|
||||
|
||||
// Appends processorPolyPatch. Returns patchID.
|
||||
Foam::label Foam::fvMeshDistribute::addProcPatch
|
||||
(
|
||||
const word& patchName,
|
||||
const label nbrProc
|
||||
)
|
||||
//// Appends processorPolyPatch. Returns patchID.
|
||||
//Foam::label Foam::fvMeshDistribute::addProcPatch
|
||||
//(
|
||||
// const word& patchName,
|
||||
// const label nbrProc
|
||||
//)
|
||||
//{
|
||||
// // Clear local fields and e.g. polyMesh globalMeshData.
|
||||
// mesh_.clearOut();
|
||||
//
|
||||
//
|
||||
// polyBoundaryMesh& polyPatches =
|
||||
// const_cast<polyBoundaryMesh&>(mesh_.boundaryMesh());
|
||||
// fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh_.boundary());
|
||||
//
|
||||
// if (polyPatches.findPatchID(patchName) != -1)
|
||||
// {
|
||||
// FatalErrorIn("fvMeshDistribute::addProcPatch(const word&, const label)")
|
||||
// << "Cannot create patch " << patchName << " since already exists."
|
||||
// << nl
|
||||
// << "Current patch names:" << polyPatches.names()
|
||||
// << exit(FatalError);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// // Add the patch
|
||||
// // ~~~~~~~~~~~~~
|
||||
//
|
||||
// label sz = polyPatches.size();
|
||||
//
|
||||
// // Add polyPatch
|
||||
// polyPatches.setSize(sz+1);
|
||||
// polyPatches.set
|
||||
// (
|
||||
// sz,
|
||||
// new processorPolyPatch
|
||||
// (
|
||||
// patchName,
|
||||
// 0, // size
|
||||
// mesh_.nFaces(),
|
||||
// sz,
|
||||
// mesh_.boundaryMesh(),
|
||||
// Pstream::myProcNo(),
|
||||
// nbrProc
|
||||
// )
|
||||
// );
|
||||
// fvPatches.setSize(sz+1);
|
||||
// fvPatches.set
|
||||
// (
|
||||
// sz,
|
||||
// fvPatch::New
|
||||
// (
|
||||
// polyPatches[sz], // point to newly added polyPatch
|
||||
// mesh_.boundary()
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// return sz;
|
||||
//}
|
||||
|
||||
|
||||
// Appends polyPatch. Returns patchID.
|
||||
Foam::label Foam::fvMeshDistribute::addPatch(polyPatch* patchPtr)
|
||||
{
|
||||
// Clear local fields and e.g. polyMesh globalMeshData.
|
||||
mesh_.clearOut();
|
||||
|
||||
|
||||
polyBoundaryMesh& polyPatches =
|
||||
const_cast<polyBoundaryMesh&>(mesh_.boundaryMesh());
|
||||
fvBoundaryMesh& fvPatches = const_cast<fvBoundaryMesh&>(mesh_.boundary());
|
||||
|
||||
if (polyPatches.findPatchID(patchName) != -1)
|
||||
if (polyPatches.findPatchID(patchPtr->name()) != -1)
|
||||
{
|
||||
FatalErrorIn("fvMeshDistribute::addProcPatch(const word&, const label)")
|
||||
<< "Cannot create patch " << patchName << " since already exists."
|
||||
<< nl
|
||||
<< "Current patch names:" << polyPatches.names()
|
||||
<< exit(FatalError);
|
||||
FatalErrorIn("fvMeshDistribute::addPatch(polyPatch*)")
|
||||
<< "Cannot create patch " << patchPtr->name()
|
||||
<< " since already exists." << nl
|
||||
<< "Current patch names:" << polyPatches.names() << exit(FatalError);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Add the patch
|
||||
// ~~~~~~~~~~~~~
|
||||
|
||||
@ -304,20 +364,7 @@ Foam::label Foam::fvMeshDistribute::addProcPatch
|
||||
|
||||
// Add polyPatch
|
||||
polyPatches.setSize(sz+1);
|
||||
polyPatches.set
|
||||
(
|
||||
sz,
|
||||
new processorPolyPatch
|
||||
(
|
||||
patchName,
|
||||
0, // size
|
||||
mesh_.nFaces(),
|
||||
sz,
|
||||
mesh_.boundaryMesh(),
|
||||
Pstream::myProcNo(),
|
||||
nbrProc
|
||||
)
|
||||
);
|
||||
polyPatches.set(sz, patchPtr);
|
||||
fvPatches.setSize(sz+1);
|
||||
fvPatches.set
|
||||
(
|
||||
@ -625,25 +672,27 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
const labelList& distribution,
|
||||
labelList& sourceFace,
|
||||
labelList& sourceProc,
|
||||
labelList& sourceNewProc
|
||||
labelList& sourcePatch,
|
||||
labelList& sourceNewNbrProc
|
||||
) const
|
||||
{
|
||||
label nBnd = mesh_.nFaces() - mesh_.nInternalFaces();
|
||||
sourceFace.setSize(nBnd);
|
||||
sourceProc.setSize(nBnd);
|
||||
sourceNewProc.setSize(nBnd);
|
||||
sourcePatch.setSize(nBnd);
|
||||
sourceNewNbrProc.setSize(nBnd);
|
||||
|
||||
const polyBoundaryMesh& patches = mesh_.boundaryMesh();
|
||||
|
||||
// Get neighbouring meshFace labels and new processor of coupled boundaries.
|
||||
labelList nbrFaces(nBnd, -1);
|
||||
labelList nbrNewProc(nBnd, -1);
|
||||
labelList nbrNewNbrProc(nBnd, -1);
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (isA<processorPolyPatch>(pp))
|
||||
if (pp.coupled())
|
||||
{
|
||||
label offset = pp.start() - mesh_.nInternalFaces();
|
||||
|
||||
@ -655,7 +704,7 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
}
|
||||
|
||||
// Which processor they will end up on
|
||||
SubList<label>(nbrNewProc, pp.size(), offset).assign
|
||||
SubList<label>(nbrNewNbrProc, pp.size(), offset).assign
|
||||
(
|
||||
UIndirectList<label>(distribution, pp.faceCells())()
|
||||
);
|
||||
@ -665,7 +714,7 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
|
||||
// Exchange the boundary data
|
||||
syncTools::swapBoundaryFaceList(mesh_, nbrFaces);
|
||||
syncTools::swapBoundaryFaceList(mesh_, nbrNewProc);
|
||||
syncTools::swapBoundaryFaceList(mesh_, nbrNewNbrProc);
|
||||
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -680,7 +729,7 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
|
||||
// Check which of the two faces we store.
|
||||
|
||||
if (Pstream::myProcNo() < procPatch.neighbProcNo())
|
||||
if (procPatch.owner())
|
||||
{
|
||||
// Use my local face labels
|
||||
forAll(pp, i)
|
||||
@ -688,7 +737,7 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
label bndI = offset + i;
|
||||
sourceFace[bndI] = pp.start()+i;
|
||||
sourceProc[bndI] = Pstream::myProcNo();
|
||||
sourceNewProc[bndI] = nbrNewProc[bndI];
|
||||
sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -699,7 +748,50 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
label bndI = offset + i;
|
||||
sourceFace[bndI] = nbrFaces[bndI];
|
||||
sourceProc[bndI] = procPatch.neighbProcNo();
|
||||
sourceNewProc[bndI] = nbrNewProc[bndI];
|
||||
sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
label patchI = -1;
|
||||
if (isA<processorCyclicPolyPatch>(pp))
|
||||
{
|
||||
patchI = refCast<const processorCyclicPolyPatch>
|
||||
(
|
||||
pp
|
||||
).referPatchID();
|
||||
}
|
||||
|
||||
forAll(pp, i)
|
||||
{
|
||||
label bndI = offset + i;
|
||||
sourcePatch[bndI] = patchI;
|
||||
}
|
||||
}
|
||||
else if (isA<cyclicPolyPatch>(pp))
|
||||
{
|
||||
const cyclicPolyPatch& cpp = refCast<const cyclicPolyPatch>(pp);
|
||||
|
||||
if (cpp.owner())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
label bndI = offset + i;
|
||||
sourceFace[bndI] = pp.start()+i;
|
||||
sourceProc[bndI] = Pstream::myProcNo();
|
||||
sourcePatch[bndI] = patchI;
|
||||
sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
label bndI = offset + i;
|
||||
sourceFace[bndI] = nbrFaces[bndI];
|
||||
sourceProc[bndI] = Pstream::myProcNo();
|
||||
sourcePatch[bndI] = patchI;
|
||||
sourceNewNbrProc[bndI] = nbrNewNbrProc[bndI];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -709,9 +801,10 @@ void Foam::fvMeshDistribute::getNeighbourData
|
||||
forAll(pp, i)
|
||||
{
|
||||
label bndI = offset + i;
|
||||
sourceFace[bndI] = patchI;
|
||||
sourceFace[bndI] = -1;
|
||||
sourceProc[bndI] = -1;
|
||||
sourceNewProc[bndI] = -1;
|
||||
sourcePatch[bndI] = patchI;
|
||||
sourceNewNbrProc[bndI] = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -732,16 +825,19 @@ void Foam::fvMeshDistribute::subsetBoundaryData
|
||||
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourceNewProc,
|
||||
const labelList& sourcePatch,
|
||||
const labelList& sourceNewNbrProc,
|
||||
|
||||
labelList& subFace,
|
||||
labelList& subProc,
|
||||
labelList& subNewProc
|
||||
labelList& subPatch,
|
||||
labelList& subNewNbrProc
|
||||
)
|
||||
{
|
||||
subFace.setSize(mesh.nFaces() - mesh.nInternalFaces());
|
||||
subProc.setSize(mesh.nFaces() - mesh.nInternalFaces());
|
||||
subNewProc.setSize(mesh.nFaces() - mesh.nInternalFaces());
|
||||
subPatch.setSize(mesh.nFaces() - mesh.nInternalFaces());
|
||||
subNewNbrProc.setSize(mesh.nFaces() - mesh.nInternalFaces());
|
||||
|
||||
forAll(subFace, newBFaceI)
|
||||
{
|
||||
@ -754,6 +850,7 @@ void Foam::fvMeshDistribute::subsetBoundaryData
|
||||
{
|
||||
subFace[newBFaceI] = oldFaceI;
|
||||
subProc[newBFaceI] = Pstream::myProcNo();
|
||||
subPatch[newBFaceI] = -1;
|
||||
|
||||
label oldOwn = oldFaceOwner[oldFaceI];
|
||||
label oldNei = oldFaceNeighbour[oldFaceI];
|
||||
@ -761,12 +858,12 @@ void Foam::fvMeshDistribute::subsetBoundaryData
|
||||
if (oldOwn == cellMap[mesh.faceOwner()[newFaceI]])
|
||||
{
|
||||
// We kept the owner side. Where does the neighbour move to?
|
||||
subNewProc[newBFaceI] = oldDistribution[oldNei];
|
||||
subNewNbrProc[newBFaceI] = oldDistribution[oldNei];
|
||||
}
|
||||
else
|
||||
{
|
||||
// We kept the neighbour side.
|
||||
subNewProc[newBFaceI] = oldDistribution[oldOwn];
|
||||
subNewNbrProc[newBFaceI] = oldDistribution[oldOwn];
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -776,7 +873,8 @@ void Foam::fvMeshDistribute::subsetBoundaryData
|
||||
|
||||
subFace[newBFaceI] = sourceFace[oldBFaceI];
|
||||
subProc[newBFaceI] = sourceProc[oldBFaceI];
|
||||
subNewProc[newBFaceI] = sourceNewProc[oldBFaceI];
|
||||
subPatch[newBFaceI] = sourcePatch[oldBFaceI];
|
||||
subNewNbrProc[newBFaceI] = sourceNewNbrProc[oldBFaceI];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -789,11 +887,13 @@ void Foam::fvMeshDistribute::findCouples
|
||||
const primitiveMesh& mesh,
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourcePatch,
|
||||
|
||||
const label domain,
|
||||
const primitiveMesh& domainMesh,
|
||||
const labelList& domainFace,
|
||||
const labelList& domainProc,
|
||||
const labelList& domainPatch,
|
||||
|
||||
labelList& masterCoupledFaces,
|
||||
labelList& slaveCoupledFaces
|
||||
@ -803,9 +903,16 @@ void Foam::fvMeshDistribute::findCouples
|
||||
// with same face+proc.
|
||||
HashTable<label, labelPair, labelPair::Hash<> > map(domainFace.size());
|
||||
|
||||
forAll(domainFace, bFaceI)
|
||||
forAll(domainProc, bFaceI)
|
||||
{
|
||||
map.insert(labelPair(domainFace[bFaceI], domainProc[bFaceI]), bFaceI);
|
||||
if (domainProc[bFaceI] != -1 && domainPatch[bFaceI] == -1)
|
||||
{
|
||||
map.insert
|
||||
(
|
||||
labelPair(domainFace[bFaceI], domainProc[bFaceI]),
|
||||
bFaceI
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -817,7 +924,7 @@ void Foam::fvMeshDistribute::findCouples
|
||||
|
||||
forAll(sourceFace, bFaceI)
|
||||
{
|
||||
if (sourceProc[bFaceI] != -1)
|
||||
if (sourceProc[bFaceI] != -1 && sourcePatch[bFaceI] == -1)
|
||||
{
|
||||
labelPair myData(sourceFace[bFaceI], sourceProc[bFaceI]);
|
||||
|
||||
@ -935,105 +1042,202 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::fvMeshDistribute::doRemoveCells
|
||||
// the processor patchID.
|
||||
void Foam::fvMeshDistribute::addProcPatches
|
||||
(
|
||||
const labelList& neighbourNewProc, // processor that neighbour is on
|
||||
labelList& procPatchID
|
||||
const labelList& nbrProc, // processor that neighbour is now on
|
||||
const labelList& referPatchID, // patchID (or -1) I originated from
|
||||
List<Map<label> >& procPatchID
|
||||
)
|
||||
{
|
||||
// Now use the neighbourFace/Proc to repatch the mesh. These two lists
|
||||
// Now use the neighbourFace/Proc to repatch the mesh. These lists
|
||||
// contain for all current boundary faces the global patchID (for non-proc
|
||||
// patch) or the processor.
|
||||
|
||||
labelList procPatchSizes(Pstream::nProcs(), 0);
|
||||
|
||||
forAll(neighbourNewProc, bFaceI)
|
||||
{
|
||||
if (neighbourNewProc[bFaceI] != -1)
|
||||
{
|
||||
procPatchSizes[neighbourNewProc[bFaceI]]++;
|
||||
}
|
||||
}
|
||||
|
||||
// Per neighbour processor the label of the processor patch
|
||||
procPatchID.setSize(Pstream::nProcs());
|
||||
|
||||
forAll(procPatchSizes, procI)
|
||||
forAll(nbrProc, bFaceI)
|
||||
{
|
||||
if (procPatchSizes[procI] > 0)
|
||||
label procI = nbrProc[bFaceI];
|
||||
|
||||
if (procI != -1 && procI != Pstream::myProcNo())
|
||||
{
|
||||
const word patchName =
|
||||
"procBoundary"
|
||||
+ name(Pstream::myProcNo())
|
||||
+ "to"
|
||||
+ name(procI);
|
||||
if (!procPatchID[procI].found(referPatchID[bFaceI]))
|
||||
{
|
||||
// No patch for neighbour yet. Is either a normal processor
|
||||
// patch or a processorCyclic patch.
|
||||
|
||||
if (referPatchID[bFaceI] == -1)
|
||||
{
|
||||
// Ordinary processor boundary
|
||||
|
||||
procPatchID[procI] = addProcPatch(patchName, procI);
|
||||
addPatchFields<volScalarField>
|
||||
(
|
||||
processorFvPatchField<scalar>::typeName
|
||||
);
|
||||
addPatchFields<volVectorField>
|
||||
(
|
||||
processorFvPatchField<vector>::typeName
|
||||
);
|
||||
addPatchFields<volSphericalTensorField>
|
||||
(
|
||||
processorFvPatchField<sphericalTensor>::typeName
|
||||
);
|
||||
addPatchFields<volSymmTensorField>
|
||||
(
|
||||
processorFvPatchField<symmTensor>::typeName
|
||||
);
|
||||
addPatchFields<volTensorField>
|
||||
(
|
||||
processorFvPatchField<tensor>::typeName
|
||||
);
|
||||
const word patchName =
|
||||
"procBoundary"
|
||||
+ name(Pstream::myProcNo())
|
||||
+ "to"
|
||||
+ name(procI);
|
||||
|
||||
addPatchFields<surfaceScalarField>
|
||||
(
|
||||
processorFvPatchField<scalar>::typeName
|
||||
);
|
||||
addPatchFields<surfaceVectorField>
|
||||
(
|
||||
processorFvPatchField<vector>::typeName
|
||||
);
|
||||
addPatchFields<surfaceSphericalTensorField>
|
||||
(
|
||||
processorFvPatchField<sphericalTensor>::typeName
|
||||
);
|
||||
addPatchFields<surfaceSymmTensorField>
|
||||
(
|
||||
processorFvPatchField<symmTensor>::typeName
|
||||
);
|
||||
addPatchFields<surfaceTensorField>
|
||||
(
|
||||
processorFvPatchField<tensor>::typeName
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
procPatchID[procI] = -1;
|
||||
procPatchID[procI].insert
|
||||
(
|
||||
referPatchID[bFaceI],
|
||||
addPatch
|
||||
(
|
||||
new processorPolyPatch
|
||||
(
|
||||
patchName,
|
||||
0, // size
|
||||
mesh_.nFaces(),
|
||||
mesh_.boundaryMesh().size(),
|
||||
mesh_.boundaryMesh(),
|
||||
Pstream::myProcNo(),
|
||||
nbrProc[bFaceI]
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
addPatchFields<volScalarField>
|
||||
(
|
||||
processorFvPatchField<scalar>::typeName
|
||||
);
|
||||
addPatchFields<volVectorField>
|
||||
(
|
||||
processorFvPatchField<vector>::typeName
|
||||
);
|
||||
addPatchFields<volSphericalTensorField>
|
||||
(
|
||||
processorFvPatchField<sphericalTensor>::typeName
|
||||
);
|
||||
addPatchFields<volSymmTensorField>
|
||||
(
|
||||
processorFvPatchField<symmTensor>::typeName
|
||||
);
|
||||
addPatchFields<volTensorField>
|
||||
(
|
||||
processorFvPatchField<tensor>::typeName
|
||||
);
|
||||
|
||||
addPatchFields<surfaceScalarField>
|
||||
(
|
||||
processorFvPatchField<scalar>::typeName
|
||||
);
|
||||
addPatchFields<surfaceVectorField>
|
||||
(
|
||||
processorFvPatchField<vector>::typeName
|
||||
);
|
||||
addPatchFields<surfaceSphericalTensorField>
|
||||
(
|
||||
processorFvPatchField<sphericalTensor>::typeName
|
||||
);
|
||||
addPatchFields<surfaceSymmTensorField>
|
||||
(
|
||||
processorFvPatchField<symmTensor>::typeName
|
||||
);
|
||||
addPatchFields<surfaceTensorField>
|
||||
(
|
||||
processorFvPatchField<tensor>::typeName
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Processor boundary originating from cyclic
|
||||
const word& cycName = mesh_.boundaryMesh()
|
||||
[
|
||||
referPatchID[bFaceI]
|
||||
].name();
|
||||
|
||||
const word patchName =
|
||||
"procBoundary"
|
||||
+ name(Pstream::myProcNo())
|
||||
+ "to"
|
||||
+ name(procI)
|
||||
+ "through"
|
||||
+ cycName;
|
||||
|
||||
procPatchID[procI].insert
|
||||
(
|
||||
referPatchID[bFaceI],
|
||||
addPatch
|
||||
(
|
||||
new processorCyclicPolyPatch
|
||||
(
|
||||
patchName,
|
||||
0, // size
|
||||
mesh_.nFaces(),
|
||||
mesh_.boundaryMesh().size(),
|
||||
mesh_.boundaryMesh(),
|
||||
Pstream::myProcNo(),
|
||||
nbrProc[bFaceI],
|
||||
cycName
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
addPatchFields<volScalarField>
|
||||
(
|
||||
processorCyclicFvPatchField<scalar>::typeName
|
||||
);
|
||||
addPatchFields<volVectorField>
|
||||
(
|
||||
processorCyclicFvPatchField<vector>::typeName
|
||||
);
|
||||
addPatchFields<volSphericalTensorField>
|
||||
(
|
||||
processorCyclicFvPatchField<sphericalTensor>::typeName
|
||||
);
|
||||
addPatchFields<volSymmTensorField>
|
||||
(
|
||||
processorCyclicFvPatchField<symmTensor>::typeName
|
||||
);
|
||||
addPatchFields<volTensorField>
|
||||
(
|
||||
processorCyclicFvPatchField<tensor>::typeName
|
||||
);
|
||||
|
||||
addPatchFields<surfaceScalarField>
|
||||
(
|
||||
processorCyclicFvPatchField<scalar>::typeName
|
||||
);
|
||||
addPatchFields<surfaceVectorField>
|
||||
(
|
||||
processorCyclicFvPatchField<vector>::typeName
|
||||
);
|
||||
addPatchFields<surfaceSphericalTensorField>
|
||||
(
|
||||
processorCyclicFvPatchField<sphericalTensor>::typeName
|
||||
);
|
||||
addPatchFields<surfaceSymmTensorField>
|
||||
(
|
||||
processorCyclicFvPatchField<symmTensor>::typeName
|
||||
);
|
||||
addPatchFields<surfaceTensorField>
|
||||
(
|
||||
processorCyclicFvPatchField<tensor>::typeName
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Get boundary faces to be repatched. Is -1 or new patchID
|
||||
Foam::labelList Foam::fvMeshDistribute::getProcBoundaryPatch
|
||||
Foam::labelList Foam::fvMeshDistribute::getBoundaryPatch
|
||||
(
|
||||
const labelList& neighbourNewProc, // new processor per boundary face
|
||||
const labelList& procPatchID // patchID
|
||||
const labelList& nbrProc, // new processor per boundary face
|
||||
const labelList& referPatchID, // patchID (or -1) I originated from
|
||||
const List<Map<label> >& procPatchID // per proc the new procPatches
|
||||
)
|
||||
{
|
||||
labelList patchIDs(neighbourNewProc);
|
||||
labelList patchIDs(nbrProc);
|
||||
|
||||
forAll(neighbourNewProc, bFaceI)
|
||||
forAll(nbrProc, bFaceI)
|
||||
{
|
||||
if (neighbourNewProc[bFaceI] != -1)
|
||||
if (nbrProc[bFaceI] == Pstream::myProcNo())
|
||||
{
|
||||
label nbrProc = neighbourNewProc[bFaceI];
|
||||
|
||||
patchIDs[bFaceI] = procPatchID[nbrProc];
|
||||
label origPatchI = referPatchID[bFaceI];
|
||||
patchIDs[bFaceI] = origPatchI;
|
||||
}
|
||||
else if (nbrProc[bFaceI] != -1)
|
||||
{
|
||||
label origPatchI = referPatchID[bFaceI];
|
||||
patchIDs[bFaceI] = procPatchID[nbrProc[bFaceI]][origPatchI];
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1056,7 +1260,8 @@ void Foam::fvMeshDistribute::sendMesh
|
||||
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourceNewProc,
|
||||
const labelList& sourcePatch,
|
||||
const labelList& sourceNewNbrProc,
|
||||
UOPstream& toDomain
|
||||
)
|
||||
{
|
||||
@ -1192,7 +1397,8 @@ void Foam::fvMeshDistribute::sendMesh
|
||||
|
||||
<< sourceFace
|
||||
<< sourceProc
|
||||
<< sourceNewProc;
|
||||
<< sourcePatch
|
||||
<< sourceNewNbrProc;
|
||||
|
||||
|
||||
if (debug)
|
||||
@ -1213,7 +1419,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
|
||||
const Time& runTime,
|
||||
labelList& domainSourceFace,
|
||||
labelList& domainSourceProc,
|
||||
labelList& domainSourceNewProc,
|
||||
labelList& domainSourcePatch,
|
||||
labelList& domainSourceNewNbrProc,
|
||||
UIPstream& fromNbr
|
||||
)
|
||||
{
|
||||
@ -1231,7 +1438,8 @@ Foam::autoPtr<Foam::fvMesh> Foam::fvMeshDistribute::receiveMesh
|
||||
fromNbr
|
||||
>> domainSourceFace
|
||||
>> domainSourceProc
|
||||
>> domainSourceNewProc;
|
||||
>> domainSourcePatch
|
||||
>> domainSourceNewNbrProc;
|
||||
|
||||
// Construct fvMesh
|
||||
autoPtr<fvMesh> domainMeshPtr
|
||||
@ -1449,16 +1657,37 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
|
||||
// physical boundary:
|
||||
// sourceProc = -1
|
||||
// sourceNewProc = -1
|
||||
// sourceFace = patchID
|
||||
// coupled boundary:
|
||||
// sourceProc = proc
|
||||
// sourceNewProc = distribution[cell on proc]
|
||||
// sourceFace = face
|
||||
// sourceNewNbrProc = -1
|
||||
// sourceFace = -1
|
||||
// sourcePatch = patchID
|
||||
// processor boundary:
|
||||
// sourceProc = proc (on owner side)
|
||||
// sourceNewNbrProc = distribution of coupled cell
|
||||
// sourceFace = face (on owner side)
|
||||
// sourcePatch = -1
|
||||
// ?cyclic:
|
||||
// ? sourceProc = proc
|
||||
// ? sourceNewNbrProc = distribution of coupled cell
|
||||
// ? sourceFace = face (on owner side)
|
||||
// ? sourcePatch = patchID
|
||||
// processor-cyclic boundary:
|
||||
// sourceProc = proc (on owner side)
|
||||
// sourceNewNbrProc = distribution of coupled cell
|
||||
// sourceFace = face (on owner side)
|
||||
// sourcePatch = patchID
|
||||
|
||||
labelList sourcePatch;
|
||||
labelList sourceFace;
|
||||
labelList sourceProc;
|
||||
labelList sourceNewProc;
|
||||
getNeighbourData(distribution, sourceFace, sourceProc, sourceNewProc);
|
||||
labelList sourceNewNbrProc;
|
||||
getNeighbourData
|
||||
(
|
||||
distribution,
|
||||
sourceFace,
|
||||
sourceProc,
|
||||
sourcePatch,
|
||||
sourceNewNbrProc
|
||||
);
|
||||
|
||||
|
||||
// Remove meshPhi. Since this would otherwise disappear anyway
|
||||
@ -1530,7 +1759,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
|
||||
inplaceReorder(bFaceMap, sourceFace);
|
||||
inplaceReorder(bFaceMap, sourceProc);
|
||||
inplaceReorder(bFaceMap, sourceNewProc);
|
||||
inplaceReorder(bFaceMap, sourcePatch);
|
||||
inplaceReorder(bFaceMap, sourceNewNbrProc);
|
||||
}
|
||||
|
||||
|
||||
@ -1633,7 +1863,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// Subset the boundary fields (owner/neighbour/processor)
|
||||
labelList procSourceFace;
|
||||
labelList procSourceProc;
|
||||
labelList procSourceNewProc;
|
||||
labelList procSourcePatch;
|
||||
labelList procSourceNewNbrProc;
|
||||
|
||||
subsetBoundaryData
|
||||
(
|
||||
@ -1648,11 +1879,13 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
|
||||
sourceFace,
|
||||
sourceProc,
|
||||
sourceNewProc,
|
||||
sourcePatch,
|
||||
sourceNewNbrProc,
|
||||
|
||||
procSourceFace,
|
||||
procSourceProc,
|
||||
procSourceNewProc
|
||||
procSourcePatch,
|
||||
procSourceNewNbrProc
|
||||
);
|
||||
|
||||
|
||||
@ -1669,7 +1902,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
|
||||
procSourceFace,
|
||||
procSourceProc,
|
||||
procSourceNewProc,
|
||||
procSourcePatch,
|
||||
procSourceNewNbrProc,
|
||||
str
|
||||
);
|
||||
sendFields<volScalarField>(recvProc, volScalars, subsetter, str);
|
||||
@ -1772,7 +2006,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// fields
|
||||
labelList domainSourceFace;
|
||||
labelList domainSourceProc;
|
||||
labelList domainSourceNewProc;
|
||||
labelList domainSourcePatch;
|
||||
labelList domainSourceNewNbrProc;
|
||||
|
||||
subsetBoundaryData
|
||||
(
|
||||
@ -1787,16 +2022,19 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
|
||||
sourceFace,
|
||||
sourceProc,
|
||||
sourceNewProc,
|
||||
sourcePatch,
|
||||
sourceNewNbrProc,
|
||||
|
||||
domainSourceFace,
|
||||
domainSourceProc,
|
||||
domainSourceNewProc
|
||||
domainSourcePatch,
|
||||
domainSourceNewNbrProc
|
||||
);
|
||||
|
||||
sourceFace.transfer(domainSourceFace);
|
||||
sourceProc.transfer(domainSourceProc);
|
||||
sourceNewProc.transfer(domainSourceNewProc);
|
||||
sourcePatch.transfer(domainSourcePatch);
|
||||
sourceNewNbrProc.transfer(domainSourceNewNbrProc);
|
||||
}
|
||||
|
||||
|
||||
@ -1849,7 +2087,8 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// Receive from sendProc
|
||||
labelList domainSourceFace;
|
||||
labelList domainSourceProc;
|
||||
labelList domainSourceNewProc;
|
||||
labelList domainSourcePatch;
|
||||
labelList domainSourceNewNbrProc;
|
||||
|
||||
autoPtr<fvMesh> domainMeshPtr;
|
||||
PtrList<volScalarField> vsf;
|
||||
@ -1875,10 +2114,14 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
const_cast<Time&>(mesh_.time()),
|
||||
domainSourceFace,
|
||||
domainSourceProc,
|
||||
domainSourceNewProc,
|
||||
domainSourcePatch,
|
||||
domainSourceNewNbrProc,
|
||||
str
|
||||
);
|
||||
fvMesh& domainMesh = domainMeshPtr();
|
||||
// Force construction of various on mesh.
|
||||
//(void)domainMesh.globalData();
|
||||
|
||||
|
||||
// Receive fields. Read as single dictionary because
|
||||
// of problems reading consecutive fields from single stream.
|
||||
@ -2007,11 +2250,13 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
|
||||
sourceFace,
|
||||
sourceProc,
|
||||
sourcePatch,
|
||||
|
||||
sendProc,
|
||||
domainMesh,
|
||||
domainSourceFace,
|
||||
domainSourceProc,
|
||||
domainSourcePatch,
|
||||
|
||||
masterCoupledFaces,
|
||||
slaveCoupledFaces
|
||||
@ -2046,33 +2291,38 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// Update mesh data: sourceFace,sourceProc for added
|
||||
// mesh.
|
||||
|
||||
sourceFace =
|
||||
mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
map(),
|
||||
sourceFace,
|
||||
domainMesh.nInternalFaces(),
|
||||
domainSourceFace
|
||||
);
|
||||
sourceProc =
|
||||
mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
map(),
|
||||
sourceProc,
|
||||
domainMesh.nInternalFaces(),
|
||||
domainSourceProc
|
||||
);
|
||||
sourceNewProc =
|
||||
mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
map(),
|
||||
sourceNewProc,
|
||||
domainMesh.nInternalFaces(),
|
||||
domainSourceNewProc
|
||||
);
|
||||
sourceFace = mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
map(),
|
||||
sourceFace,
|
||||
domainMesh.nInternalFaces(),
|
||||
domainSourceFace
|
||||
);
|
||||
sourceProc = mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
map(),
|
||||
sourceProc,
|
||||
domainMesh.nInternalFaces(),
|
||||
domainSourceProc
|
||||
);
|
||||
sourcePatch = mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
map(),
|
||||
sourcePatch,
|
||||
domainMesh.nInternalFaces(),
|
||||
domainSourcePatch
|
||||
);
|
||||
sourceNewNbrProc = mapBoundaryData
|
||||
(
|
||||
mesh_,
|
||||
map(),
|
||||
sourceNewNbrProc,
|
||||
domainMesh.nInternalFaces(),
|
||||
domainSourceNewNbrProc
|
||||
);
|
||||
|
||||
// Update all addressing so xxProcAddressing points to correct item
|
||||
// in masterMesh.
|
||||
@ -2142,11 +2392,13 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// Add processorPatches
|
||||
// ~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
// Per neighbour processor the patchID to it (or -1).
|
||||
labelList procPatchID;
|
||||
// Per neighbour processor, per originating patch, the patchID
|
||||
// For faces resulting from internal faces or normal processor patches
|
||||
// the originating patch is -1. For cyclics this is the cyclic patchID.
|
||||
List<Map<label> > procPatchID;
|
||||
|
||||
// Add processor patches.
|
||||
addProcPatches(sourceNewProc, procPatchID);
|
||||
// Add processor and processorCyclic patches.
|
||||
addProcPatches(sourceNewNbrProc, sourcePatch, procPatchID);
|
||||
|
||||
// Put faces into correct patch. Note that we now have proper
|
||||
// processorPolyPatches again so repatching will take care of coupled face
|
||||
@ -2155,9 +2407,10 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
// Get boundary faces to be repatched. Is -1 or new patchID
|
||||
labelList newPatchID
|
||||
(
|
||||
getProcBoundaryPatch
|
||||
getBoundaryPatch
|
||||
(
|
||||
sourceNewProc,
|
||||
sourceNewNbrProc,
|
||||
sourcePatch,
|
||||
procPatchID
|
||||
)
|
||||
);
|
||||
|
||||
@ -103,8 +103,8 @@ class fvMeshDistribute
|
||||
//- Find patch to put exposed faces into.
|
||||
label findNonEmptyPatch() const;
|
||||
|
||||
//- Appends processorPolyPatch. Returns patchID.
|
||||
label addProcPatch(const word& patchName, const label nbrProc);
|
||||
//- Appends polyPatch. Returns patchID.
|
||||
label addPatch(polyPatch*);
|
||||
|
||||
//- Add patch field
|
||||
template<class GeoField>
|
||||
@ -170,6 +170,7 @@ class fvMeshDistribute
|
||||
const labelList& distribution,
|
||||
labelList& sourceFace,
|
||||
labelList& sourceProc,
|
||||
labelList& sourcePatch,
|
||||
labelList& sourceNewProc
|
||||
) const;
|
||||
|
||||
@ -187,10 +188,12 @@ class fvMeshDistribute
|
||||
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourcePatch,
|
||||
const labelList& sourceNewProc,
|
||||
|
||||
labelList& subFace,
|
||||
labelList& subProc,
|
||||
labelList& subPatch,
|
||||
labelList& subNewProc
|
||||
);
|
||||
|
||||
@ -201,11 +204,13 @@ class fvMeshDistribute
|
||||
const primitiveMesh&,
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourcePatch,
|
||||
|
||||
const label domain,
|
||||
const primitiveMesh& domainMesh,
|
||||
const labelList& domainFace,
|
||||
const labelList& domainProc,
|
||||
const labelList& domainPatch,
|
||||
|
||||
labelList& masterCoupledFaces,
|
||||
labelList& slaveCoupledFaces
|
||||
@ -236,15 +241,17 @@ class fvMeshDistribute
|
||||
// proc the processor patchID.
|
||||
void addProcPatches
|
||||
(
|
||||
const labelList&, // processor that neighbour is on
|
||||
labelList& procPatchID
|
||||
const labelList&, // processor that neighbour is now on
|
||||
const labelList&, // -1 or patch that face originated from
|
||||
List<Map<label> >& procPatchID
|
||||
);
|
||||
|
||||
//- Get boundary faces to be repatched. Is -1 or new patchID
|
||||
static labelList getProcBoundaryPatch
|
||||
static labelList getBoundaryPatch
|
||||
(
|
||||
const labelList& neighbourNewProc,// new processor per b. face
|
||||
const labelList& procPatchID // patchID
|
||||
const labelList& neighbourNewProc, // new processor per b. face
|
||||
const labelList& referPatchID, // -1 or original patch
|
||||
const List<Map<label> >& procPatchID// patchID
|
||||
);
|
||||
|
||||
//- Send mesh and coupling data.
|
||||
@ -257,6 +264,7 @@ class fvMeshDistribute
|
||||
const wordList& cellZoneNames,
|
||||
const labelList& sourceFace,
|
||||
const labelList& sourceProc,
|
||||
const labelList& sourcePatch,
|
||||
const labelList& sourceNewProc,
|
||||
UOPstream& toDomain
|
||||
);
|
||||
@ -280,6 +288,7 @@ class fvMeshDistribute
|
||||
const Time& runTime,
|
||||
labelList& domainSourceFace,
|
||||
labelList& domainSourceProc,
|
||||
labelList& domainSourcePatch,
|
||||
labelList& domainSourceNewProc,
|
||||
UIPstream& fromNbr
|
||||
);
|
||||
@ -329,6 +338,7 @@ public:
|
||||
const primitiveMesh&,
|
||||
const labelList&,
|
||||
const labelList&,
|
||||
const labelList&,
|
||||
const labelList&
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user