BUG: finite volume did not work before.

This commit is contained in:
mattijs
2010-03-03 10:12:35 +00:00
parent 46ad2e55d6
commit 5ece14ec6f
108 changed files with 3119 additions and 2099 deletions

45
TODO Normal file
View File

@ -0,0 +1,45 @@
- allocate/free tags.
Not tested.
OK - test blockMesh with cyclics
unitTestCases/singleCyclic/
OK - test cyclics sequential running.
unitTestCases/singleCyclic/
OK - test decomposePar
OK - FaceCellWave
unitTestCases/twoCavityCyclicForWallDistance/
OK - non-parallel finite volume : channelFoam
unitTestCases/channel395-splitCyclic vs. channel395-dev
OK - parallel finite volume with processorCyclic: channelFoam
unitTestCases/channel395-splitCyclic vs. channel395-dev
- amg
- test createPatch pointSync
- pointFields on cyclics. volPointInterpolation.
- jumpCyclics
- fanFvPatchField
- activeBaffleVelocity
- work out overlapping communication for PstreamBuffers.
Different tag?
- fvMeshDistribute to split processor patches into ones with different
separation.
- fvMeshSubset
- kivaToFoam/readKivaGrid.H sorts cyclics (but in incorrect order?)
- grep for size()/2
- pointEdgeWave (maybe through inversePointDistanceDiffusivity?)
- regionSplit
- scotchDecomp
- isoSurface.C
- preProcessing/foamUpgradeCyclics
- referredCellList.C
- renumberMesh
- work out scheduled communication?
compile:

View File

@ -296,12 +296,7 @@ label mergePatchFaces
const faceZone& fZone = mesh.faceZones()[zoneID]; const faceZone& fZone = mesh.faceZones()[zoneID];
zoneFlip = fZone.flipMap()[fZone.whichFace(newMasterI)]; zoneFlip = fZone.flipMap()[fZone.whichFace(newMasterI)];
} }
labelPair patchIDs = polyTopoChange::whichPatch label patchID = mesh.boundaryMesh().whichPatch(newMasterI);
(
mesh.boundaryMesh(),
newMasterI
);
Pout<< "Restoring new master face " << newMasterI Pout<< "Restoring new master face " << newMasterI
<< " to vertices " << setFaceVerts[0] << endl; << " to vertices " << setFaceVerts[0] << endl;
@ -316,11 +311,10 @@ label mergePatchFaces
own, // owner own, // owner
-1, // neighbour -1, // neighbour
false, // face flip false, // face flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face flip in zone zoneFlip // face flip in zone
patchIDs[1] // subPatch
) )
); );
@ -342,10 +336,9 @@ label mergePatchFaces
-1, // masterEdgeID, -1, // masterEdgeID,
newMasterI, // masterFaceID, newMasterI, // masterFaceID,
false, // flipFaceFlux, false, // flipFaceFlux,
patchIDs[0], // patchID, patchID, // patchID,
zoneID, // zoneID, zoneID, // zoneID,
zoneFlip, // zoneFlip zoneFlip // zoneFlip
patchIDs[1] // subPatch
) )
); );
} }

View File

@ -45,12 +45,17 @@ defineTypeNameAndDebug(Foam::cellSplitter, 0);
void Foam::cellSplitter::getFaceInfo void Foam::cellSplitter::getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchIDs, label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const ) const
{ {
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI); patchID = -1;
if (!mesh_.isInternalFace(faceI))
{
patchID = mesh_.boundaryMesh().whichPatch(faceI);
}
zoneID = mesh_.faceZones().whichZone(faceI); zoneID = mesh_.faceZones().whichZone(faceI);
@ -161,16 +166,17 @@ void Foam::cellSplitter::setRefinement
label anchorPoint = mesh_.cellPoints()[cellI][0]; label anchorPoint = mesh_.cellPoints()[cellI][0];
label addedPointI = meshMod.setAction label addedPointI =
( meshMod.setAction
polyAddPoint
( (
iter(), // point polyAddPoint
anchorPoint, // master point (
-1, // zone for point iter(), // point
true // supports a cell anchorPoint, // master point
) -1, // zone for point
); true // supports a cell
)
);
addedPoints_.insert(cellI, addedPointI); addedPoints_.insert(cellI, addedPointI);
//Pout<< "Added point " << addedPointI //Pout<< "Added point " << addedPointI
@ -199,17 +205,19 @@ void Foam::cellSplitter::setRefinement
// Add other pyramids // Add other pyramids
for (label i = 1; i < cFaces.size(); i++) for (label i = 1; i < cFaces.size(); i++)
label addedCellI = meshMod.setAction {
( label addedCellI =
polyAddCell meshMod.setAction
( (
-1, // master point polyAddCell
-1, // master edge (
-1, // master face -1, // master point
cellI, // master cell -1, // master edge
-1 // zone -1, // master face
) cellI, // master cell
); -1 // zone
)
);
newCells[i] = addedCellI; newCells[i] = addedCellI;
} }
@ -296,8 +304,7 @@ void Foam::cellSplitter::setRefinement
false, // flux flip false, // flux flip
-1, // patch for face -1, // patch for face
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // subPatch
) )
); );
} }
@ -343,8 +350,7 @@ void Foam::cellSplitter::setRefinement
false, // flux flip false, // flux flip
-1, // patch for face -1, // patch for face
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // subPatch
) )
); );
} }
@ -399,8 +405,7 @@ void Foam::cellSplitter::setRefinement
-1, // patch for face -1, // patch for face
false, // remove from zone false, // remove from zone
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // subPatch
) )
); );
} }
@ -418,8 +423,7 @@ void Foam::cellSplitter::setRefinement
-1, // patch for face -1, // patch for face
false, // remove from zone false, // remove from zone
-1, // zone for face -1, // zone for face
false, // face zone flip false // face zone flip
-1 // subPatch
) )
); );
} }
@ -429,9 +433,9 @@ void Foam::cellSplitter::setRefinement
{ {
label newOwn = newOwner(faceI, cellToCells); label newOwn = newOwner(faceI, cellToCells);
labelPair patchIDs; label patchID, zoneID, zoneFlip;
label zoneID, zoneFlip; getFaceInfo(faceI, patchID, zoneID, zoneFlip);
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
meshMod.setAction meshMod.setAction
( (
polyModifyFace polyModifyFace
@ -441,11 +445,10 @@ void Foam::cellSplitter::setRefinement
newOwn, // owner newOwn, // owner
-1, // neighbour -1, // neighbour
false, // flux flip false, // flux flip
patchIDs[0], // patch for face patchID, // patch for face
false, // remove from zone false, // remove from zone
zoneID, // zone for face zoneID, // zone for face
zoneFlip, // face zone flip zoneFlip // face zone flip
patchIDs[1]
) )
); );
} }

View File

@ -39,7 +39,6 @@ SourceFiles
#include "Map.H" #include "Map.H"
#include "edge.H" #include "edge.H"
#include "labelPair.H"
#include "typeInfo.H" #include "typeInfo.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -74,7 +73,7 @@ class cellSplitter
void getFaceInfo void getFaceInfo
( (
const label faceI, const label faceI,
labelPair& patchIDs, label& patchID,
label& zoneID, label& zoneID,
label& zoneFlip label& zoneFlip
) const; ) const;

View File

@ -1200,8 +1200,7 @@ int main(int argc, char *argv[])
false, // flipFaceFlux false, // flipFaceFlux
-1, // patchID -1, // patchID
faceZonei, // zoneID faceZonei, // zoneID
fm[facei], // zoneFlip fm[facei] // zoneFlip
-1 // subPatchID
); );
} }
@ -1252,8 +1251,7 @@ int main(int argc, char *argv[])
false, // flipFaceFlux false, // flipFaceFlux
patchi, // patchID patchi, // patchID
-1, // zoneID -1, // zoneID
false, // zoneFlip false // zoneFlip
-1 // subPatchID
); );
// For baffles create the opposite face // For baffles create the opposite face
@ -1270,8 +1268,7 @@ int main(int argc, char *argv[])
false, // flipFaceFlux false, // flipFaceFlux
patchi, // patchID patchi, // patchID
-1, // zoneID -1, // zoneID
false, // zoneFlip false // zoneFlip
-1
); );
} }
} }
@ -1320,8 +1317,7 @@ int main(int argc, char *argv[])
false, //flipFaceFlux false, //flipFaceFlux
-1, //patchID -1, //patchID
-1, //zoneID -1, //zoneID
false, //zoneFlip false //zoneFlip
-1 //subPatchID
); );
} }
} }

View File

@ -136,8 +136,7 @@ void Foam::extrude2DMesh::setRefinement
false, // flipFaceFlux false, // flipFaceFlux
-1, // patchID -1, // patchID
zoneID, // zoneID zoneID, // zoneID
zoneFlip, // zoneFlip zoneFlip // zoneFlip
-1 // subPatchID
); );
} }
@ -174,8 +173,7 @@ void Foam::extrude2DMesh::setRefinement
false, // flipFaceFlux false, // flipFaceFlux
patchI, // patchID patchI, // patchID
zoneID, // zoneID zoneID, // zoneID
zoneFlip, // zoneFlip zoneFlip // zoneFlip
-1 //?TBD subPatchID
); );
} }
} }
@ -238,8 +236,7 @@ void Foam::extrude2DMesh::setRefinement
false, // flipFaceFlux false, // flipFaceFlux
frontPatchI, // patchID frontPatchI, // patchID
-1, // zoneID -1, // zoneID
false, // zoneFlip false // zoneFlip
-1 //?TDB subPatchID
); );
// Offset to create front face. // Offset to create front face.
@ -258,8 +255,7 @@ void Foam::extrude2DMesh::setRefinement
false, // flipFaceFlux false, // flipFaceFlux
frontPatchI, // patchID frontPatchI, // patchID
-1, // zoneID -1, // zoneID
false, // zoneFlip false // zoneFlip
-1 //?TDB subPatchID
); );
} }
} }

View File

@ -198,69 +198,55 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
forAll(patches, patchI) forAll(patches, patchI)
{ {
if (isA<cyclicPolyPatch>(patches[patchI])) if
(
isA<cyclicPolyPatch>(patches[patchI])
&& refCast<const cyclicPolyPatch>(patches[patchI]).owner()
)
{ {
const cyclicPolyPatch& cycPatch = const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(patches[patchI]); refCast<const cyclicPolyPatch>(patches[patchI]);
label halfSize = cycPatch.size()/2; // Dump patches
// Dump halves
{ {
OFstream str(prefix+cycPatch.name()+"_half0.obj"); OFstream str(prefix+cycPatch.name()+".obj");
Pout<< "Dumping " << cycPatch.name() Pout<< "Dumping " << cycPatch.name()
<< " half0 faces to " << str.name() << endl; << " faces to " << str.name() << endl;
meshTools::writeOBJ meshTools::writeOBJ
( (
str, str,
static_cast<faceList> cycPatch,
(
SubList<face>
(
cycPatch,
halfSize
)
),
cycPatch.points() cycPatch.points()
); );
} }
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
{ {
OFstream str(prefix+cycPatch.name()+"_half1.obj"); OFstream str(prefix+nbrPatch.name()+".obj");
Pout<< "Dumping " << cycPatch.name() Pout<< "Dumping " << nbrPatch.name()
<< " half1 faces to " << str.name() << endl; << " faces to " << str.name() << endl;
meshTools::writeOBJ meshTools::writeOBJ
( (
str, str,
static_cast<faceList> nbrPatch,
( nbrPatch.points()
SubList<face>
(
cycPatch,
halfSize,
halfSize
)
),
cycPatch.points()
); );
} }
// Lines between corresponding face centres // Lines between corresponding face centres
OFstream str(prefix+cycPatch.name()+"_match.obj"); OFstream str(prefix+cycPatch.name()+nbrPatch.name()+"_match.obj");
label vertI = 0; label vertI = 0;
Pout<< "Dumping cyclic match as lines between face centres to " Pout<< "Dumping cyclic match as lines between face centres to "
<< str.name() << endl; << str.name() << endl;
for (label faceI = 0; faceI < halfSize; faceI++) forAll(cycPatch, faceI)
{ {
const point& fc0 = mesh.faceCentres()[cycPatch.start()+faceI]; const point& fc0 = mesh.faceCentres()[cycPatch.start()+faceI];
meshTools::writeOBJ(str, fc0); meshTools::writeOBJ(str, fc0);
vertI++; vertI++;
const point& fc1 = mesh.faceCentres()[nbrPatch.start()+faceI];
label nbrFaceI = halfSize + faceI;
const point& fc1 =
mesh.faceCentres()[cycPatch.start()+nbrFaceI];
meshTools::writeOBJ(str, fc1); meshTools::writeOBJ(str, fc1);
vertI++; vertI++;
@ -273,34 +259,13 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
void separateList void separateList
( (
const vectorField& separation, const vector& separation,
UList<vector>& field UList<vector>& field
) )
{ {
if (separation.size() == 1) forAll(field, i)
{ {
// Single value for all. field[i] += separation;
forAll(field, i)
{
field[i] += separation[0];
}
}
else if (separation.size() == field.size())
{
forAll(field, i)
{
field[i] += separation[i];
}
}
else
{
FatalErrorIn
(
"separateList(const vectorField&, UList<vector>&)"
) << "Sizes of field and transformation not equal. field:"
<< field.size() << " transformation:" << separation.size()
<< abort(FatalError);
} }
} }
@ -427,13 +392,19 @@ void syncPoints
{ {
const polyPatch& pp = patches[patchI]; const polyPatch& pp = patches[patchI];
if (isA<cyclicPolyPatch>(pp)) if
(
isA<cyclicPolyPatch>(pp)
&& refCast<const cyclicPolyPatch>(pp).owner()
)
{ {
const cyclicPolyPatch& cycPatch = const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(pp); refCast<const cyclicPolyPatch>(pp);
const edgeList& coupledPoints = cycPatch.coupledPoints(); const edgeList& coupledPoints = cycPatch.coupledPoints();
const labelList& meshPts = cycPatch.meshPoints(); const labelList& meshPts = cycPatch.meshPoints();
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
const labelList& nbrMeshPts = nbrPatch.meshPoints();
pointField half0Values(coupledPoints.size()); pointField half0Values(coupledPoints.size());
@ -452,14 +423,14 @@ void syncPoints
else if (cycPatch.separated()) else if (cycPatch.separated())
{ {
hasTransformation = true; hasTransformation = true;
const vectorField& v = cycPatch.coupledPolyPatch::separation(); const vector& v = cycPatch.separation();
separateList(v, half0Values); separateList(v, half0Values);
} }
forAll(coupledPoints, i) forAll(coupledPoints, i)
{ {
const edge& e = coupledPoints[i]; const edge& e = coupledPoints[i];
label point1 = meshPts[e[1]]; label point1 = nbrMeshPts[e[1]];
points[point1] = half0Values[i]; points[point1] = half0Values[i];
} }
} }
@ -783,13 +754,8 @@ int main(int argc, char *argv[])
// current separation also includes the normal // current separation also includes the normal
// ( separation_ = (nf&(Cr - Cf))*nf ). // ( separation_ = (nf&(Cr - Cf))*nf ).
// For processor patches:
// - disallow multiple separation/transformation. This basically
// excludes decomposed cyclics. Use the (probably 0) separation
// to align the points.
// For cyclic patches: // For cyclic patches:
// - for separated ones use our own recalculated offset vector // - for separated ones use user specified offset vector
// - for rotational ones use current one.
forAll(mesh.boundaryMesh(), patchI) forAll(mesh.boundaryMesh(), patchI)
{ {
@ -813,51 +779,18 @@ int main(int argc, char *argv[])
if (cycpp.transform() == cyclicPolyPatch::TRANSLATIONAL) if (cycpp.transform() == cyclicPolyPatch::TRANSLATIONAL)
{ {
// Force to wanted separation
Info<< "On cyclic translation patch " << pp.name() Info<< "On cyclic translation patch " << pp.name()
<< " forcing uniform separation of " << " forcing uniform separation of "
<< cycpp.separationVector() << endl; << cycpp.separationVector() << endl;
const_cast<vectorField&>(cpp.separation()) = const_cast<vector&>(cpp.separation()) =
pointField(1, cycpp.separationVector()); cycpp.separationVector();
} }
else
{
const_cast<vectorField&>(cpp.separation()) =
pointField
(
1,
pp[pp.size()/2].centre(mesh.points())
- pp[0].centre(mesh.points())
);
}
}
else
{
const_cast<vectorField&>(cpp.separation())
.setSize(1);
} }
Info<< "On coupled patch " << pp.name() Info<< "On coupled patch " << pp.name()
<< " forcing uniform separation of " << " forcing uniform separation of "
<< cpp.separation() << endl; << cpp.separation() << endl;
} }
else if (!cpp.parallel())
{
Info<< "On coupled patch " << pp.name()
<< " forcing uniform rotation of "
<< cpp.forwardT()[0] << endl;
const_cast<tensorField&>
(
cpp.forwardT()
).setSize(1);
const_cast<tensorField&>
(
cpp.reverseT()
).setSize(1);
Info<< "On coupled patch " << pp.name()
<< " forcing uniform rotation of "
<< cpp.forwardT() << endl;
}
} }
} }

View File

@ -306,8 +306,6 @@ autoPtr<mapPolyMesh> reorderMesh
labelList patchStarts(patches.size()); labelList patchStarts(patches.size());
labelList oldPatchNMeshPoints(patches.size()); labelList oldPatchNMeshPoints(patches.size());
labelListList patchPointMap(patches.size()); labelListList patchPointMap(patches.size());
labelListList subPatches(patches.size());
labelListList subPatchStarts(patches.size());
forAll(patches, patchI) forAll(patches, patchI)
{ {
@ -315,16 +313,6 @@ autoPtr<mapPolyMesh> reorderMesh
patchStarts[patchI] = patches[patchI].start(); patchStarts[patchI] = patches[patchI].start();
oldPatchNMeshPoints[patchI] = patches[patchI].nPoints(); oldPatchNMeshPoints[patchI] = patches[patchI].nPoints();
patchPointMap[patchI] = identity(patches[patchI].nPoints()); patchPointMap[patchI] = identity(patches[patchI].nPoints());
if (isA<processorPolyPatch>(patches[patchI]))
{
const processorPolyPatch& ppp = refCast<const processorPolyPatch>
(
patches[patchI]
);
subPatches[patchI] = ppp.patchIDs();
subPatchStarts[patchI] = ppp.starts();
}
} }
mesh.resetPrimitives mesh.resetPrimitives
@ -335,8 +323,7 @@ autoPtr<mapPolyMesh> reorderMesh
xferMove(newNeighbour), xferMove(newNeighbour),
patchSizes, patchSizes,
patchStarts, patchStarts,
subPatches, true
subPatchStarts
); );
return autoPtr<mapPolyMesh> return autoPtr<mapPolyMesh>

View File

@ -556,7 +556,7 @@ void getInterfaceSizes
label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()]; label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()];
coupledRegion[i] = cellRegion[cellI]; coupledRegion[i] = cellRegion[cellI];
} }
syncTools::swapBoundaryFaceList(mesh, coupledRegion, false); syncTools::swapBoundaryFaceList(mesh, coupledRegion);
forAll(coupledRegion, i) forAll(coupledRegion, i)
{ {
@ -726,7 +726,7 @@ autoPtr<mapPolyMesh> createRegionMesh
label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()]; label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()];
coupledRegion[i] = cellRegion[cellI]; coupledRegion[i] = cellRegion[cellI];
} }
syncTools::swapBoundaryFaceList(mesh, coupledRegion, false); syncTools::swapBoundaryFaceList(mesh, coupledRegion);
// Topology change container. Start off from existing mesh. // Topology change container. Start off from existing mesh.
@ -1375,7 +1375,7 @@ int main(int argc, char *argv[])
{ {
neiZoneID[i] = zoneID[mesh.faceOwner()[i+mesh.nInternalFaces()]]; neiZoneID[i] = zoneID[mesh.faceOwner()[i+mesh.nInternalFaces()]];
} }
syncTools::swapBoundaryFaceList(mesh, neiZoneID, false); syncTools::swapBoundaryFaceList(mesh, neiZoneID);
// Determine connected regions // Determine connected regions

View File

@ -337,22 +337,22 @@ int main(int argc, char *argv[])
// Construct the point fields // Construct the point fields
// ~~~~~~~~~~~~~~~~~~~~~~~~~~ // ~~~~~~~~~~~~~~~~~~~~~~~~~~
pointMesh pMesh(mesh); // pointMesh pMesh(mesh);
PtrList<pointScalarField> pointScalarFields; PtrList<pointScalarField> pointScalarFields;
readFields(pMesh, objects, pointScalarFields); // readFields(pMesh, objects, pointScalarFields);
PtrList<pointVectorField> pointVectorFields; PtrList<pointVectorField> pointVectorFields;
readFields(pMesh, objects, pointVectorFields); // readFields(pMesh, objects, pointVectorFields);
PtrList<pointSphericalTensorField> pointSphericalTensorFields; PtrList<pointSphericalTensorField> pointSphericalTensorFields;
readFields(pMesh, objects, pointSphericalTensorFields); // readFields(pMesh, objects, pointSphericalTensorFields);
PtrList<pointSymmTensorField> pointSymmTensorFields; PtrList<pointSymmTensorField> pointSymmTensorFields;
readFields(pMesh, objects, pointSymmTensorFields); // readFields(pMesh, objects, pointSymmTensorFields);
PtrList<pointTensorField> pointTensorFields; PtrList<pointTensorField> pointTensorFields;
readFields(pMesh, objects, pointTensorFields); // readFields(pMesh, objects, pointTensorFields);
// Construct the Lagrangian fields // Construct the Lagrangian fields
@ -652,45 +652,45 @@ int main(int argc, char *argv[])
} }
// Point fields // // Point fields
if // if
( // (
pointScalarFields.size() // pointScalarFields.size()
|| pointVectorFields.size() // || pointVectorFields.size()
|| pointSphericalTensorFields.size() // || pointSphericalTensorFields.size()
|| pointSymmTensorFields.size() // || pointSymmTensorFields.size()
|| pointTensorFields.size() // || pointTensorFields.size()
) // )
{ // {
labelIOList pointProcAddressing // labelIOList pointProcAddressing
( // (
IOobject // IOobject
( // (
"pointProcAddressing", // "pointProcAddressing",
procMesh.facesInstance(), // procMesh.facesInstance(),
procMesh.meshSubDir, // procMesh.meshSubDir,
procMesh, // procMesh,
IOobject::MUST_READ, // IOobject::MUST_READ,
IOobject::NO_WRITE // IOobject::NO_WRITE
) // )
); // );
//
pointMesh procPMesh(procMesh, true); // pointMesh procPMesh(procMesh, true);
//
pointFieldDecomposer fieldDecomposer // pointFieldDecomposer fieldDecomposer
( // (
pMesh, // pMesh,
procPMesh, // procPMesh,
pointProcAddressing, // pointProcAddressing,
boundaryProcAddressing // boundaryProcAddressing
); // );
//
fieldDecomposer.decomposeFields(pointScalarFields); // fieldDecomposer.decomposeFields(pointScalarFields);
fieldDecomposer.decomposeFields(pointVectorFields); // fieldDecomposer.decomposeFields(pointVectorFields);
fieldDecomposer.decomposeFields(pointSphericalTensorFields); // fieldDecomposer.decomposeFields(pointSphericalTensorFields);
fieldDecomposer.decomposeFields(pointSymmTensorFields); // fieldDecomposer.decomposeFields(pointSymmTensorFields);
fieldDecomposer.decomposeFields(pointTensorFields); // fieldDecomposer.decomposeFields(pointTensorFields);
} // }
// If there is lagrangian data write it out // If there is lagrangian data write it out

View File

@ -29,6 +29,7 @@ License
#include "dictionary.H" #include "dictionary.H"
#include "labelIOList.H" #include "labelIOList.H"
#include "processorPolyPatch.H" #include "processorPolyPatch.H"
#include "processorCyclicPolyPatch.H"
#include "fvMesh.H" #include "fvMesh.H"
#include "OSspecific.H" #include "OSspecific.H"
#include "Map.H" #include "Map.H"
@ -293,10 +294,34 @@ bool Foam::domainDecomposition::writeDecomposition()
const polyPatchList& meshPatches = boundaryMesh(); const polyPatchList& meshPatches = boundaryMesh();
// Count the number of inter-proc patches
label nInterProcPatches = 0;
forAll(curSubPatchIDs, procPatchI)
{
Info<< "For processor " << procI
<< " have to destination processor "
<< curNeighbourProcessors[procPatchI] << endl;
forAll(curSubPatchIDs[procPatchI], i)
{
Info<< " from patch:" << curSubPatchIDs[procPatchI][i]
<< " starting at:" << curSubStarts[procPatchI][i]
<< endl;
}
nInterProcPatches += curSubPatchIDs[procPatchI].size();
}
Info<< "For processor " << procI
<< " have " << nInterProcPatches << " to neighbouring processors"
<< endl;
List<polyPatch*> procPatches List<polyPatch*> procPatches
( (
curPatchSizes.size() curPatchSizes.size()
+ curProcessorPatchSizes.size(), + nInterProcPatches, //curProcessorPatchSizes.size(),
reinterpret_cast<polyPatch*>(0) reinterpret_cast<polyPatch*>(0)
); );
@ -335,23 +360,72 @@ bool Foam::domainDecomposition::writeDecomposition()
forAll(curProcessorPatchSizes, procPatchI) forAll(curProcessorPatchSizes, procPatchI)
{ {
procPatches[nPatches] = const labelList& subPatchID = curSubPatchIDs[procPatchI];
new processorPolyPatch const labelList& subStarts = curSubStarts[procPatchI];
(
word("procBoundary") + Foam::name(procI)
+ word("to")
+ Foam::name(curNeighbourProcessors[procPatchI]),
curProcessorPatchSizes[procPatchI],
curProcessorPatchStarts[procPatchI],
nPatches,
procMesh.boundaryMesh(),
procI,
curNeighbourProcessors[procPatchI],
curSubPatchIDs[procPatchI],
curSubStarts[procPatchI]
);
nPatches++; label curStart = curProcessorPatchStarts[procPatchI];
forAll(subPatchID, i)
{
label size =
(
i < subPatchID.size()-1
? subStarts[i+1] - subStarts[i]
: curProcessorPatchSizes[procPatchI] - subStarts[i]
);
Info<< "From processor:" << procI << endl
<< " to processor:" << curNeighbourProcessors[procPatchI]
<< endl
<< " via patch:" << subPatchID[i] << endl
<< " start :" << curStart << endl
<< " size :" << size << endl;
if (subPatchID[i] == -1)
{
// From internal faces
procPatches[nPatches] =
new processorPolyPatch
(
word("procBoundary") + Foam::name(procI)
+ "to"
+ Foam::name(curNeighbourProcessors[procPatchI]),
size,
curStart,
nPatches,
procMesh.boundaryMesh(),
procI,
curNeighbourProcessors[procPatchI]
);
}
else
{
// From cyclic
const word& referPatch =
boundaryMesh()[subPatchID[i]].name();
procPatches[nPatches] =
new processorCyclicPolyPatch
(
word("procBoundary") + Foam::name(procI)
+ "to"
+ Foam::name(curNeighbourProcessors[procPatchI])
+ "through"
+ referPatch,
size,
curStart,
nPatches,
procMesh.boundaryMesh(),
procI,
curNeighbourProcessors[procPatchI],
referPatch
);
}
curStart += size;
nPatches++;
}
} }

View File

@ -40,7 +40,7 @@ Description
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
void domainDecomposition::append(labelList& lst, const label elem) void Foam::domainDecomposition::append(labelList& lst, const label elem)
{ {
label sz = lst.size(); label sz = lst.size();
lst.setSize(sz+1); lst.setSize(sz+1);
@ -48,7 +48,7 @@ void domainDecomposition::append(labelList& lst, const label elem)
} }
void domainDecomposition::addInterProcFace void Foam::domainDecomposition::addInterProcFace
( (
const label facei, const label facei,
const label ownerProc, const label ownerProc,
@ -97,7 +97,7 @@ void domainDecomposition::addInterProcFace
} }
void domainDecomposition::decomposeMesh(const bool filterEmptyPatches) void Foam::domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
{ {
// Decide which cell goes to which processor // Decide which cell goes to which processor
distributeCells(); distributeCells();
@ -230,14 +230,15 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
facei, facei,
ownerProc, ownerProc,
nbrProc, nbrProc,
procNbrToInterPatch, procNbrToInterPatch,
interPatchFaces interPatchFaces
); );
} }
} }
// Add the proper processor faces to the sub information. Since faces // Add the proper processor faces to the sub information. For faces
// originate from internal faces this is always -1. // originating from internal faces this is always -1.
List<labelListList> subPatchIDs(nProcs_); List<labelListList> subPatchIDs(nProcs_);
List<labelListList> subPatchStarts(nProcs_); List<labelListList> subPatchStarts(nProcs_);
forAll(interPatchFaces, procI) forAll(interPatchFaces, procI)
@ -415,7 +416,16 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
forAll(procBoundaryAddressing_, procI) forAll(procBoundaryAddressing_, procI)
{ {
label nNormal = procPatchSize_[procI].size(); label nNormal = procPatchSize_[procI].size();
label nInterProc = procProcessorPatchSize_[procI].size();
const labelListList& curSubPatchIDs =
procProcessorPatchSubPatchIDs_[procI];
// label nInterProc = procProcessorPatchSize_[procI].size();
label nInterProc = 0;
forAll(curSubPatchIDs, procPatchI)
{
nInterProc += curSubPatchIDs[procPatchI].size();
}
procBoundaryAddressing_[procI].setSize(nNormal + nInterProc); procBoundaryAddressing_[procI].setSize(nNormal + nInterProc);
@ -423,9 +433,14 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
{ {
procBoundaryAddressing_[procI][patchI] = patchI; procBoundaryAddressing_[procI][patchI] = patchI;
} }
for (label patchI = nNormal; patchI < nNormal+nInterProc; patchI++) label patchI = nNormal;
forAll(curSubPatchIDs, procPatchI)
{ {
procBoundaryAddressing_[procI][patchI] = -1; forAll(curSubPatchIDs[procPatchI], i)
{
procBoundaryAddressing_[procI][patchI++] =
curSubPatchIDs[procPatchI][i];
}
} }
} }

View File

@ -145,7 +145,11 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
{ {
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (boundaryAddressing_[patchi] >= 0) if
(
boundaryAddressing_[patchi] >= 0
&& !isA<processorLduInterface>(procMesh.boundary()[patchi])
)
{ {
patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer
( (

View File

@ -27,6 +27,8 @@ License
#include "fvFieldDecomposer.H" #include "fvFieldDecomposer.H"
#include "processorFvPatchField.H" #include "processorFvPatchField.H"
#include "processorFvsPatchField.H" #include "processorFvsPatchField.H"
#include "processorCyclicFvPatchField.H"
#include "processorCyclicFvsPatchField.H"
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -45,7 +47,7 @@ Foam::fvFieldDecomposer::decomposeField
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (boundaryAddressing_[patchi] >= 0) if (patchFieldDecomposerPtrs_[patchi])
{ {
patchFields.set patchFields.set
( (
@ -59,7 +61,24 @@ Foam::fvFieldDecomposer::decomposeField
) )
); );
} }
else else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi]))
{
patchFields.set
(
patchi,
new processorCyclicFvPatchField<Type>
(
procMesh_.boundary()[patchi],
DimensionedField<Type, volMesh>::null(),
Field<Type>
(
field.internalField(),
*processorVolPatchFieldDecomposerPtrs_[patchi]
)
)
);
}
else if (isA<processorFvPatch>(procMesh_.boundary()[patchi]))
{ {
patchFields.set patchFields.set
( (
@ -76,6 +95,11 @@ Foam::fvFieldDecomposer::decomposeField
) )
); );
} }
else
{
FatalErrorIn("fvFieldDecomposer::decomposeField()")
<< "Unknown type." << abort(FatalError);
}
} }
// Create the field for the processor // Create the field for the processor
@ -156,7 +180,7 @@ Foam::fvFieldDecomposer::decomposeField
forAll(boundaryAddressing_, patchi) forAll(boundaryAddressing_, patchi)
{ {
if (boundaryAddressing_[patchi] >= 0) if (patchFieldDecomposerPtrs_[patchi])
{ {
patchFields.set patchFields.set
( (
@ -170,7 +194,24 @@ Foam::fvFieldDecomposer::decomposeField
) )
); );
} }
else else if (isA<processorCyclicFvPatch>(procMesh_.boundary()[patchi]))
{
patchFields.set
(
patchi,
new processorCyclicFvsPatchField<Type>
(
procMesh_.boundary()[patchi],
DimensionedField<Type, surfaceMesh>::null(),
Field<Type>
(
allFaceField,
*processorSurfacePatchFieldDecomposerPtrs_[patchi]
)
)
);
}
else if (isA<processorFvPatch>(procMesh_.boundary()[patchi]))
{ {
patchFields.set patchFields.set
( (
@ -187,6 +228,11 @@ Foam::fvFieldDecomposer::decomposeField
) )
); );
} }
else
{
FatalErrorIn("fvFieldDecomposer::decomposeField()")
<< "Unknown type." << abort(FatalError);
}
} }
// Create the field for the processor // Create the field for the processor

View File

@ -80,7 +80,7 @@ void Foam::channelIndex::walkOppositeFaces
isFrontBndFace[faceI-mesh.nInternalFaces()] = true; isFrontBndFace[faceI-mesh.nInternalFaces()] = true;
} }
} }
syncTools::swapBoundaryFaceList(mesh, isFrontBndFace, false); syncTools::swapBoundaryFaceList(mesh, isFrontBndFace);
// Add // Add
forAll(isFrontBndFace, i) forAll(isFrontBndFace, i)

View File

@ -31,7 +31,6 @@ Description
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "fvCFD.H" #include "fvCFD.H"
#include "cyclicPolyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Main program: // Main program:
@ -77,35 +76,12 @@ int main(int argc, char *argv[])
} }
// Give patch area // Give patch area
if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchi])) Info<< " Area vector of patch "
{ << patchName << '[' << patchi << ']' << " = "
Info<< " Cyclic patch vector area: " << nl; << gSum(mesh.Sf().boundaryField()[patchi]) << endl;
label nFaces = mesh.boundaryMesh()[patchi].size(); Info<< " Area magnitude of patch "
vector sum1 = vector::zero; << patchName << '[' << patchi << ']' << " = "
vector sum2 = vector::zero; << gSum(mesh.magSf().boundaryField()[patchi]) << endl;
for (label i=0; i<nFaces/2; i++)
{
sum1 += mesh.Sf().boundaryField()[patchi][i];
sum2 += mesh.Sf().boundaryField()[patchi][i+nFaces/2];
}
reduce(sum1, sumOp<vector>());
reduce(sum2, sumOp<vector>());
Info<< " - half 1 = " << sum1 << ", " << mag(sum1) << nl
<< " - half 2 = " << sum2 << ", " << mag(sum2) << nl
<< " - total = " << (sum1 + sum2) << ", "
<< mag(sum1 + sum2) << endl;
Info<< " Cyclic patch area magnitude = "
<< gSum(mesh.magSf().boundaryField()[patchi])/2.0 << endl;
}
else
{
Info<< " Area vector of patch "
<< patchName << '[' << patchi << ']' << " = "
<< gSum(mesh.Sf().boundaryField()[patchi]) << endl;
Info<< " Area magnitude of patch "
<< patchName << '[' << patchi << ']' << " = "
<< gSum(mesh.magSf().boundaryField()[patchi]) << endl;
}
// Read field and calc integral // Read field and calc integral
if (fieldHeader.headerClassName() == volScalarField::typeName) if (fieldHeader.headerClassName() == volScalarField::typeName)

View File

@ -0,0 +1,3 @@
foamUpgradeCyclics.C
EXE = $(FOAM_APPBIN)/foamUpgradeCyclics

View File

@ -0,0 +1,281 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Application
foamUpgradeCyclics
Description
Simple tool to upgrade mesh and fields for split cyclics
Usage
- foamUpgradeCyclics [OPTION]
@param -test \n
Suppress writing the updated files with split cyclics
\*---------------------------------------------------------------------------*/
#include "argList.H"
#include "Time.H"
#include "IOdictionary.H"
#include "polyMesh.H"
#include "entry.H"
#include "IOPtrList.H"
#include "cyclicPolyPatch.H"
using namespace Foam;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
defineTemplateTypeNameAndDebug(IOPtrList<entry>, 0);
}
// Main program:
int main(int argc, char *argv[])
{
argList::addBoolOption("test");
#include "addRegionOption.H"
# include "setRootCase.H"
# include "createTime.H"
Foam::word regionName = polyMesh::defaultRegion;
args.optionReadIfPresent("region", regionName);
fileName regionPrefix = "";
if (regionName != polyMesh::defaultRegion)
{
regionPrefix = regionName;
}
// Per cyclic patch the new name for this side and the other side
HashTable<word> thisNames;
HashTable<word> nbrNames;
// Read boundary file without reading mesh
{
IOobject io
(
"boundary",
runTime.findInstance
(
regionPrefix/polyMesh::meshSubDir,
"boundary"
),
polyMesh::meshSubDir,
runTime,
IOobject::MUST_READ,
IOobject::NO_WRITE,
false
);
Info<< "Reading boundary from " << io.filePath() << endl;
// Read PtrList of dictionary.
const word oldTypeName = IOPtrList<entry>::typeName;
const_cast<word&>(IOPtrList<entry>::typeName) = word::null;
IOPtrList<entry> patches(io);
const_cast<word&>(IOPtrList<entry>::typeName) = oldTypeName;
// Fake type back to what was in field
const_cast<word&>(patches.type()) = patches.headerClassName();
// Temporary convert to dictionary
dictionary patchDict;
forAll(patches, i)
{
patchDict.add(patches[i].keyword(), patches[i].dict());
}
// Replace any 'cyclic'
label nOldCyclics = 0;
forAll(patches, patchI)
{
const dictionary& patchDict = patches[patchI].dict();
if (word(patchDict["type"]) == cyclicPolyPatch::typeName)
{
if (patchDict.found("neighbourPatch"))
{
Info<< "Patch " << patches[patchI].keyword()
<< " already has 'neighbourPatch' entry; assuming it"
<< " is already converted." << endl;
}
else
{
Info<< "Patch " << patches[patchI].keyword()
<< " does not have 'neighbourPatch' entry; assuming it"
<< " is of the old type." << endl;
nOldCyclics++;
}
}
}
Info<< "Detected " << nOldCyclics << " old cyclics." << nl << endl;
// edo the
PtrList<entry> oldPatches(patches);
Pout<< "oldPatches:" << oldPatches << endl;
// Extend
label nOldPatches = patches.size();
patches.setSize(nOldPatches+nOldCyclics);
// Add new entries
label newPatchI = 0;
forAll(oldPatches, patchI)
{
const dictionary& patchDict = oldPatches[patchI].dict();
if
(
word(patchDict["type"]) == cyclicPolyPatch::typeName
&& !patchDict.found("neighbourPatch")
)
{
const word& name = oldPatches[patchI].keyword();
label nFaces = readLabel(patchDict["nFaces"]);
label startFace = readLabel(patchDict["startFace"]);
word thisName = name + "_half0";
word nbrName = name + "_half1";
thisNames.insert(name, thisName);
nbrNames.insert(name, nbrName);
// Change entry on this side
patches.set(newPatchI, oldPatches(patchI));
dictionary& thisPatchDict = patches[newPatchI].dict();
thisPatchDict.add("neighbourPatch", nbrName);
thisPatchDict.set("nFaces", nFaces/2);
patches[newPatchI].keyword() = thisName;
newPatchI++;
// Add entry on other side
patches.set(newPatchI, oldPatches(patchI));
dictionary& nbrPatchDict = patches[newPatchI].dict();
nbrPatchDict.add("neighbourPatch", nbrName);
nbrPatchDict.set("nFaces", nFaces/2);
nbrPatchDict.set("startFace", startFace+nFaces/2);
patches[newPatchI].keyword() = nbrName;
newPatchI++;
}
else
{
patches.set(newPatchI++, oldPatches(patchI));
}
}
Info<< "boundary:" << patches << endl;
if (returnReduce(nOldCyclics, sumOp<label>()) >= 0)
{
if (args.optionFound("test"))
{
Info<< "-test option: no changes made" << nl << endl;
}
else
{
if (mvBak(patches.objectPath(), "old"))
{
Info<< "Backup to "
<< (patches.objectPath() + ".old") << nl;
}
Info<< "Write to "
<< patches.objectPath() << nl << endl;
patches.write();
}
}
}
// {
// // Read dictionary. (disable class type checking so we can load
// // field)
// Info<< "Loading dictionary " << fieldName << endl;
// const word oldTypeName = IOdictionary::typeName;
// const_cast<word&>(IOdictionary::typeName) = word::null;
//
// IOdictionary fieldDict
// (
// IOobject
// (
// "p",
// instance,
// mesh,
// IOobject::MUST_READ,
// IOobject::NO_WRITE,
// false
// )
// );
// const_cast<word&>(IOdictionary::typeName) = oldTypeName;
// // Fake type back to what was in field
// const_cast<word&>(fieldDict.type()) = fieldDict.headerClassName();
//
// Info<< "Loaded dictionary " << fieldName
// << " with entries " << fieldDict.toc() << endl;
//
// dictionary& boundaryField = fieldDict.subDict("boundaryField");
//
// forAllConstIter(HashTable<word>, thisNames, iter)
// {
// const word& patchName = iter.key();
// const word& newName = iter();
//
// Info<< "Looking for entry for patch " << patchName << endl;
//
// if (boundaryField.found(patchName) && !boundaryField.found(iter()))
// {
// const dictionary& patchDict = boundaryField[patchName];
//
// Field<scalar> fld(patchDict.lookup("value"));
//
//
// }
//
//
// forAllIter(IDLList<entry>, boundaryField, patchIter)
// {
//
// }
return 0;
}
// ************************************************************************* //

View File

@ -252,12 +252,13 @@ bool Foam::FaceCellWave<Type>::updateFace
template <class Type> template <class Type>
void Foam::FaceCellWave<Type>::checkCyclic(const polyPatch& patch) const void Foam::FaceCellWave<Type>::checkCyclic(const polyPatch& patch) const
{ {
label cycOffset = patch.size()/2; const cyclicPolyPatch& nbrPatch =
refCast<const cyclicPolyPatch>(patch).neighbPatch();
for (label patchFaceI = 0; patchFaceI < cycOffset; patchFaceI++) forAll(patch, patchFaceI)
{ {
label i1 = patch.start() + patchFaceI; label i1 = patch.start() + patchFaceI;
label i2 = i1 + cycOffset; label i2 = nbrPatch.start() + patchFaceI;
if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_)) if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_))
{ {
@ -335,8 +336,7 @@ void Foam::FaceCellWave<Type>::mergeFaceInfo
const polyPatch& patch, const polyPatch& patch,
const label nFaces, const label nFaces,
const labelList& changedFaces, const labelList& changedFaces,
const List<Type>& changedFacesInfo, const List<Type>& changedFacesInfo
const bool
) )
{ {
for (label changedFaceI = 0; changedFaceI < nFaces; changedFaceI++) for (label changedFaceI = 0; changedFaceI < nFaces; changedFaceI++)
@ -454,40 +454,6 @@ void Foam::FaceCellWave<Type>::transform
} }
// Send face info to neighbour.
template <class Type>
void Foam::FaceCellWave<Type>::sendPatchInfo
(
const label neighbour,
const label nFaces,
const labelList& faceLabels,
const List<Type>& faceInfo
) const
{
OPstream toNeighbour(Pstream::blocking, neighbour);
writeFaces(nFaces, faceLabels, faceInfo, toNeighbour);
}
// Receive face info from neighbour
template <class Type>
Foam::label Foam::FaceCellWave<Type>::receivePatchInfo
(
const label neighbour,
labelList& faceLabels,
List<Type>& faceInfo
) const
{
IPstream fromNeighbour(Pstream::blocking, neighbour);
label nFaces = 0;
readFaces(nFaces, faceLabels, faceInfo, fromNeighbour);
return nFaces;
}
// Offset mesh face. Used for transferring from one cyclic half to the other. // Offset mesh face. Used for transferring from one cyclic half to the other.
template <class Type> template <class Type>
void Foam::FaceCellWave<Type>::offset void Foam::FaceCellWave<Type>::offset
@ -511,6 +477,8 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
{ {
// Send all // Send all
PstreamBuffers pBufs(Pstream::nonBlocking);
forAll(mesh_.boundaryMesh(), patchI) forAll(mesh_.boundaryMesh(), patchI)
{ {
const polyPatch& patch = mesh_.boundaryMesh()[patchI]; const polyPatch& patch = mesh_.boundaryMesh()[patchI];
@ -552,16 +520,13 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
<< endl; << endl;
} }
sendPatchInfo UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
( writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour);
procPatch.neighbProcNo(),
nSendFaces,
sendFaces,
sendFacesInfo
);
} }
} }
pBufs.finishedSends();
// Receive all // Receive all
forAll(mesh_.boundaryMesh(), patchI) forAll(mesh_.boundaryMesh(), patchI)
@ -574,16 +539,20 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
refCast<const processorPolyPatch>(patch); refCast<const processorPolyPatch>(patch);
// Allocate buffers // Allocate buffers
label nReceiveFaces; label nReceiveFaces = 0;
labelList receiveFaces(patch.size()); labelList receiveFaces(patch.size());
List<Type> receiveFacesInfo(patch.size()); List<Type> receiveFacesInfo(patch.size());
nReceiveFaces = receivePatchInfo {
( UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
procPatch.neighbProcNo(), readFaces
receiveFaces, (
receiveFacesInfo nReceiveFaces,
); receiveFaces,
receiveFacesInfo,
fromNeighbour
);
}
if (debug) if (debug)
{ {
@ -619,8 +588,7 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
patch, patch,
nReceiveFaces, nReceiveFaces,
receiveFaces, receiveFaces,
receiveFacesInfo, receiveFacesInfo
procPatch.parallel()
); );
} }
} }
@ -639,87 +607,42 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
if (isA<cyclicPolyPatch>(patch)) if (isA<cyclicPolyPatch>(patch))
{ {
label halfSize = patch.size()/2; const cyclicPolyPatch& nbrPatch =
refCast<const cyclicPolyPatch>(patch).neighbPatch();
// Allocate buffers // Allocate buffers
label nSendFaces;
labelList sendFaces(halfSize);
List<Type> sendFacesInfo(halfSize);
label nReceiveFaces; label nReceiveFaces;
labelList receiveFaces(halfSize); labelList receiveFaces(patch.size());
List<Type> receiveFacesInfo(halfSize); List<Type> receiveFacesInfo(patch.size());
// Half1: Determine which faces changed. Use sendFaces for storage // Determine which faces changed
nSendFaces = getChangedPatchFaces
(
patch,
0,
halfSize,
sendFaces,
sendFacesInfo
);
// Half2: Determine which faces changed. Use receiveFaces_ ,,
nReceiveFaces = getChangedPatchFaces nReceiveFaces = getChangedPatchFaces
( (
patch, nbrPatch,
halfSize, 0,
halfSize, nbrPatch.size(),
receiveFaces, receiveFaces,
receiveFacesInfo receiveFacesInfo
); );
//Info<< "Half1:" << endl; // Adapt wallInfo for leaving domain
//writeFaces(nSendFaces, sendFaces, sendFacesInfo, Info);
//Info<< endl;
//
//Info<< "Half2:" << endl;
//writeFaces(nReceiveFaces, receiveFaces, receiveFacesInfo, Info);
//Info<< endl;
// Half1: Adapt wallInfo for leaving domain
leaveDomain leaveDomain
( (
patch, nbrPatch,
nSendFaces,
sendFaces,
sendFacesInfo
);
// Half2: Adapt wallInfo for leaving domain
leaveDomain
(
patch,
nReceiveFaces, nReceiveFaces,
receiveFaces, receiveFaces,
receiveFacesInfo receiveFacesInfo
); );
// Half1: 'transfer' to other side by offsetting patchFaceI
offset(patch, halfSize, nSendFaces, sendFaces);
// Half2: 'transfer' to other side
offset(patch, -halfSize, nReceiveFaces, receiveFaces);
// Apply rotation for non-parallel planes
const cyclicPolyPatch& cycPatch = const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(patch); refCast<const cyclicPolyPatch>(patch);
if (!cycPatch.parallel()) if (!cycPatch.parallel())
{ {
// sendFaces = received data from half1 // received data from other half
transform transform
( (
cycPatch.forwardT(), cycPatch.forwardT(),
nSendFaces,
sendFacesInfo
);
// receiveFaces = received data from half2
transform
(
cycPatch.reverseT(),
nReceiveFaces, nReceiveFaces,
receiveFacesInfo receiveFacesInfo
); );
@ -727,25 +650,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
if (debug) if (debug)
{ {
Pout<< " Cyclic patch " << patchI << ' ' << patch.name() Pout<< " Cyclic patch " << patchI << ' ' << cycPatch.name()
<< " Changed on first half : " << nSendFaces << " Changed : " << nReceiveFaces
<< " Changed on second half : " << nReceiveFaces
<< endl; << endl;
} }
// Half1: Adapt wallInfo for entering domain
enterDomain
(
patch,
nSendFaces,
sendFaces,
sendFacesInfo
);
// Half2: Adapt wallInfo for entering domain // Half2: Adapt wallInfo for entering domain
enterDomain enterDomain
( (
patch, cycPatch,
nReceiveFaces, nReceiveFaces,
receiveFaces, receiveFaces,
receiveFacesInfo receiveFacesInfo
@ -754,25 +667,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
// Merge into global storage // Merge into global storage
mergeFaceInfo mergeFaceInfo
( (
patch, cycPatch,
nSendFaces,
sendFaces,
sendFacesInfo,
cycPatch.parallel()
);
// Merge into global storage
mergeFaceInfo
(
patch,
nReceiveFaces, nReceiveFaces,
receiveFaces, receiveFaces,
receiveFacesInfo, receiveFacesInfo
cycPatch.parallel()
); );
if (debug) if (debug)
{ {
checkCyclic(patch); checkCyclic(cycPatch);
} }
} }
} }

View File

@ -193,8 +193,7 @@ class FaceCellWave
const polyPatch& patch, const polyPatch& patch,
const label nFaces, const label nFaces,
const labelList&, const labelList&,
const List<Type>&, const List<Type>&
const bool isParallel
); );
//- Extract info for single patch only //- Extract info for single patch only
@ -225,23 +224,6 @@ class FaceCellWave
List<Type>& faceInfo List<Type>& faceInfo
) const; ) const;
//- Send info to neighbour
void sendPatchInfo
(
const label neighbour,
const label nFaces,
const labelList&,
const List<Type>&
) const;
//- Receive info from neighbour. Returns number of faces received.
label receivePatchInfo
(
const label neighbour,
labelList&,
List<Type>&
) const;
//- Offset face labels by constant value //- Offset face labels by constant value
static void offset static void offset
( (

View File

@ -109,7 +109,6 @@ struct HashTableCore
{ {
return iteratorEnd(); return iteratorEnd();
} }
}; };
@ -139,6 +138,7 @@ class HashTable
//- Construct from key, next pointer and object //- Construct from key, next pointer and object
inline hashedEntry(const Key&, hashedEntry* next, const T&); inline hashedEntry(const Key&, hashedEntry* next, const T&);
private: private:
//- Disallow default bitwise copy construct //- Disallow default bitwise copy construct
hashedEntry(const hashedEntry&); hashedEntry(const hashedEntry&);
@ -209,9 +209,8 @@ public:
HashTable(const Xfer<HashTable<T, Key, Hash> >&); HashTable(const Xfer<HashTable<T, Key, Hash> >&);
// Destructor //- Destructor
~HashTable();
~HashTable();
// Member Functions // Member Functions
@ -247,6 +246,7 @@ public:
//- Print information //- Print information
Ostream& printInfo(Ostream&) const; Ostream& printInfo(Ostream&) const;
// Edit // Edit
//- Insert a new hashedEntry //- Insert a new hashedEntry
@ -291,7 +291,7 @@ public:
void transfer(HashTable<T, Key, Hash>&); void transfer(HashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
inline Xfer< HashTable<T, Key, Hash> > xfer(); inline Xfer<HashTable<T, Key, Hash> > xfer();
// Member Operators // Member Operators
@ -356,9 +356,8 @@ public:
//- Current hash index //- Current hash index
label hashIndex_; label hashIndex_;
protected:
// Protected Member Functions protected:
// Constructors // Constructors
@ -380,6 +379,8 @@ public:
); );
// Protected Member Functions
//- Increment to the next position //- Increment to the next position
inline void increment(); inline void increment();
@ -392,6 +393,7 @@ public:
//- Return const access to referenced object //- Return const access to referenced object
inline const T& cobject() const; inline const T& cobject() const;
public: public:
// Member operators // Member operators
@ -434,6 +436,7 @@ public:
const label hashIndex const label hashIndex
); );
public: public:
// Constructors // Constructors
@ -444,13 +447,12 @@ public:
//- Construct end iterator //- Construct end iterator
inline iterator(const iteratorEnd& unused); inline iterator(const iteratorEnd& unused);
// Member operators // Member operators
//- Conversion to a const_iterator //- Conversion to a const_iterator
inline operator const_iterator() const; inline operator const_iterator() const;
// Access
//- Return referenced hash value //- Return referenced hash value
inline T& operator*(); inline T& operator*();
inline T& operator()(); inline T& operator()();
@ -492,6 +494,7 @@ public:
const label hashIndex const label hashIndex
); );
public: public:
// Constructors // Constructors
@ -502,9 +505,8 @@ public:
//- Construct end iterator //- Construct end iterator
inline const_iterator(const iteratorEnd& unused); inline const_iterator(const iteratorEnd& unused);
// Member operators
// Access // Member operators
//- Return referenced hash value //- Return referenced hash value
inline const T& operator*() const; inline const T& operator*() const;
@ -536,7 +538,6 @@ public:
Ostream&, Ostream&,
const HashTable<T, Key, Hash>& const HashTable<T, Key, Hash>&
); );
}; };

View File

@ -97,11 +97,10 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
{} {}
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
( (
const Xfer< StaticHashTable<T, Key, Hash> >& ht const Xfer<StaticHashTable<T, Key, Hash> >& ht
) )
: :
StaticHashTableCore(), StaticHashTableCore(),
@ -452,7 +451,6 @@ void Foam::StaticHashTable<T, Key, Hash>::clearStorage()
} }
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
void Foam::StaticHashTable<T, Key, Hash>::transfer void Foam::StaticHashTable<T, Key, Hash>::transfer
( (

View File

@ -72,10 +72,6 @@ template<class T, class Key, class Hash> Ostream& operator<<
); );
/*---------------------------------------------------------------------------*\
Class StaticHashTableName Declaration
\*---------------------------------------------------------------------------*/
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class StaticHashTableCore Declaration Class StaticHashTableCore Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
@ -100,7 +96,6 @@ struct StaticHashTableCore
iteratorEnd() iteratorEnd()
{} {}
}; };
}; };
@ -135,6 +130,7 @@ class StaticHashTable
//- Assign a new hashed entry to a possibly already existing key //- Assign a new hashed entry to a possibly already existing key
bool set(const Key&, const T& newElmt, bool protect); bool set(const Key&, const T& newElmt, bool protect);
public: public:
@ -183,11 +179,11 @@ public:
StaticHashTable(const StaticHashTable<T, Key, Hash>&); StaticHashTable(const StaticHashTable<T, Key, Hash>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
StaticHashTable(const Xfer< StaticHashTable<T, Key, Hash> >&); StaticHashTable(const Xfer<StaticHashTable<T, Key, Hash> >&);
// Destructor
~StaticHashTable(); //- Destructor
~StaticHashTable();
// Member Functions // Member Functions
@ -251,7 +247,7 @@ public:
void transfer(StaticHashTable<T, Key, Hash>&); void transfer(StaticHashTable<T, Key, Hash>&);
//- Transfer contents to the Xfer container //- Transfer contents to the Xfer container
inline Xfer< StaticHashTable<T, Key, Hash> > xfer(); inline Xfer<StaticHashTable<T, Key, Hash> > xfer();
// Member Operators // Member Operators
@ -275,6 +271,7 @@ public:
//- The opposite of the equality operation. //- The opposite of the equality operation.
bool operator!=(const StaticHashTable<T, Key, Hash>&) const; bool operator!=(const StaticHashTable<T, Key, Hash>&) const;
// STL type definitions // STL type definitions
//- Type of values the StaticHashTable contains. //- Type of values the StaticHashTable contains.
@ -317,6 +314,7 @@ public:
//- Index of current element at hashIndex //- Index of current element at hashIndex
label elemIndex_; label elemIndex_;
public: public:
// Constructors // Constructors

View File

@ -79,7 +79,7 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::set
template<class T, class Key, class Hash> template<class T, class Key, class Hash>
inline Foam::Xfer< Foam::StaticHashTable<T, Key, Hash> > inline Foam::Xfer<Foam::StaticHashTable<T, Key, Hash> >
Foam::StaticHashTable<T, Key, Hash>::xfer() Foam::StaticHashTable<T, Key, Hash>::xfer()
{ {
return xferMove(*this); return xferMove(*this);
@ -417,6 +417,4 @@ Foam::StaticHashTable<T, Key, Hash>::end() const
} }
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// ************************************************************************* // // ************************************************************************* //

View File

@ -74,7 +74,7 @@ public:
( (
const UList<T>& posList, const UList<T>& posList,
const UList<T>& negList, const UList<T>& negList,
const Xfer< List<label> >& const Xfer<List<label> >&
); );
@ -102,7 +102,7 @@ public:
//- Reset addressing //- Reset addressing
inline void resetAddressing(const UList<label>&); inline void resetAddressing(const UList<label>&);
inline void resetAddressing(const Xfer< List<label> >&); inline void resetAddressing(const Xfer<List<label> >&);
// Member Operators // Member Operators

View File

@ -45,7 +45,7 @@ inline Foam::BiIndirectList<T>::BiIndirectList
( (
const UList<T>& posList, const UList<T>& posList,
const UList<T>& negList, const UList<T>& negList,
const Xfer< List<label> >& addr const Xfer<List<label> >& addr
) )
: :
posList_(const_cast<UList<T>&>(posList)), posList_(const_cast<UList<T>&>(posList)),
@ -105,7 +105,7 @@ inline void Foam::BiIndirectList<T>::resetAddressing
template<class T> template<class T>
inline void Foam::BiIndirectList<T>::resetAddressing inline void Foam::BiIndirectList<T>::resetAddressing
( (
const Xfer< List<label> >& addr const Xfer<List<label> >& addr
) )
{ {
addressing_.transfer(addr()); addressing_.transfer(addr());

View File

@ -224,7 +224,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[]
) )
{ {
label start = offsets_[i]; label start = offsets_[i];
return UList<T>(&m_[start], offsets_[i+1] - start); return UList<T>((m_.size() ? &m_[start] : NULL), offsets_[i+1] - start);
} }
@ -238,7 +238,7 @@ Foam::CompactListList<T, Container>::operator[]
label start = offsets_[i]; label start = offsets_[i];
return UList<T> return UList<T>
( (
const_cast<T*>(&m_[start]), (m_.size() ? const_cast<T*>(&m_[start]) : NULL),
offsets_[i+1] - start offsets_[i+1] - start
); );
} }

View File

@ -84,7 +84,6 @@ class DynamicList
//- The capacity (allocated size) of the underlying list. //- The capacity (allocated size) of the underlying list.
label capacity_; label capacity_;
// Private Member Functions
public: public:
@ -93,6 +92,7 @@ public:
//- Declare friendship with the List class //- Declare friendship with the List class
friend class List<T>; friend class List<T>;
// Constructors // Constructors
//- Construct null //- Construct null
@ -115,7 +115,7 @@ public:
explicit inline DynamicList(const UIndirectList<T>&); explicit inline DynamicList(const UIndirectList<T>&);
//- Construct by transferring the parameter contents //- Construct by transferring the parameter contents
explicit inline DynamicList(const Xfer< List<T> >&); explicit inline DynamicList(const Xfer<List<T> >&);
//- Construct from Istream. Size set to size of read list. //- Construct from Istream. Size set to size of read list.
explicit DynamicList(Istream&); explicit DynamicList(Istream&);
@ -125,103 +125,105 @@ public:
// Access // Access
//- Size of the underlying storage. //- Size of the underlying storage.
inline label capacity() const; inline label capacity() const;
// Edit // Edit
//- Alter the size of the underlying storage. //- Alter the size of the underlying storage.
// The addressed size will be truncated if needed to fit, but will // The addressed size will be truncated if needed to fit, but will
// remain otherwise untouched. // remain otherwise untouched.
// Use this or reserve() in combination with append(). // Use this or reserve() in combination with append().
inline void setCapacity(const label); inline void setCapacity(const label);
//- Alter the addressed list size. //- Alter the addressed list size.
// New space will be allocated if required. // New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for // Use this to resize the list prior to using the operator[] for
// setting values (as per List usage). // setting values (as per List usage).
inline void setSize(const label); inline void setSize(const label);
//- Alter the addressed list size and fill new space with a constant. //- Alter the addressed list size and fill new space with a constant.
inline void setSize(const label, const T&); inline void setSize(const label, const T&);
//- Alter the addressed list size. //- Alter the addressed list size.
// New space will be allocated if required. // New space will be allocated if required.
// Use this to resize the list prior to using the operator[] for // Use this to resize the list prior to using the operator[] for
// setting values (as per List usage). // setting values (as per List usage).
inline void resize(const label); inline void resize(const label);
//- Alter the addressed list size and fill new space with a constant. //- Alter the addressed list size and fill new space with a constant.
inline void resize(const label, const T&); inline void resize(const label, const T&);
//- Reserve allocation space for at least this size. //- Reserve allocation space for at least this size.
// Never shrinks the allocated size, use setCapacity() for that. // Never shrinks the allocated size, use setCapacity() for that.
inline void reserve(const label); inline void reserve(const label);
//- Clear the addressed list, i.e. set the size to zero. //- Clear the addressed list, i.e. set the size to zero.
// Allocated size does not change // Allocated size does not change
inline void clear(); inline void clear();
//- Clear the list and delete storage. //- Clear the list and delete storage.
inline void clearStorage(); inline void clearStorage();
//- Shrink the allocated space to the number of elements used. //- Shrink the allocated space to the number of elements used.
// Returns a reference to the DynamicList. // Returns a reference to the DynamicList.
inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink(); inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink();
//- Transfer contents of the argument List into this DynamicList //- Transfer contents of the argument List into this DynamicList
inline void transfer(List<T>&); inline void transfer(List<T>&);
//- Transfer contents of the argument DynamicList into this DynamicList //- Transfer contents of the argument DynamicList into this DynamicList
inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&); inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
//- Transfer contents to the Xfer container as a plain List //- Transfer contents to the Xfer container as a plain List
inline Xfer< List<T> > xfer(); inline Xfer<List<T> > xfer();
// Member Operators
//- Append an element at the end of the list // Member Operators
inline void append(const T&);
//- Append a List at the end of this list //- Append an element at the end of the list
inline void append(const UList<T>&); inline void append(const T&);
//- Append a UIndirectList at the end of this list //- Append a List at the end of this list
inline void append(const UIndirectList<T>&); inline void append(const UList<T>&);
//- Remove and return the top element //- Append a UIndirectList at the end of this list
inline T remove(); inline void append(const UIndirectList<T>&);
//- Return non-const access to an element, resizing list if necessary //- Remove and return the top element
inline T& operator()(const label); inline T remove();
//- Assignment of all addressed entries to the given value //- Return non-const access to an element, resizing list if necessary
inline void operator=(const T&); inline T& operator()(const label);
//- Assignment from DynamicList //- Assignment of all addressed entries to the given value
inline void operator= inline void operator=(const T&);
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Assignment from UList //- Assignment from DynamicList
inline void operator=(const UList<T>&); inline void operator=
(
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
// IOstream operators //- Assignment from UList
inline void operator=(const UList<T>&);
// Write DynamicList to Ostream.
friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv>
(
Ostream&,
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Read from Istream, discarding contents of existing DynamicList. // IOstream operators
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
( // Write DynamicList to Ostream.
Istream&, friend Ostream& operator<< <T, SizeInc, SizeMult, SizeDiv>
DynamicList<T, SizeInc, SizeMult, SizeDiv>& (
); Ostream&,
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
//- Read from Istream, discarding contents of existing DynamicList.
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
(
Istream&,
DynamicList<T, SizeInc, SizeMult, SizeDiv>&
);
}; };

View File

@ -298,7 +298,7 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer
template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv> template<class T, unsigned SizeInc, unsigned SizeMult, unsigned SizeDiv>
inline Foam::Xfer< Foam::List<T> > inline Foam::Xfer<Foam::List<T> >
Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::xfer() Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::xfer()
{ {
return xferMoveTo< List<T> >(*this); return xferMoveTo< List<T> >(*this);

View File

@ -64,7 +64,8 @@ public:
inline IndirectList(const UList<T>&, const UList<label>&); inline IndirectList(const UList<T>&, const UList<label>&);
//- Construct given the complete list and by transferring addressing //- Construct given the complete list and by transferring addressing
inline IndirectList(const UList<T>&, const Xfer< List<label> >&); inline IndirectList(const UList<T>&, const Xfer<List<label> >&);
// Member Functions // Member Functions
@ -94,11 +95,12 @@ public:
//- Return the list addressing //- Return the list addressing
inline const List<label>& addressing() const; inline const List<label>& addressing() const;
// Edit // Edit
//- Reset addressing //- Reset addressing
inline void resetAddressing(const UList<label>&); inline void resetAddressing(const UList<label>&);
inline void resetAddressing(const Xfer< List<label> >&); inline void resetAddressing(const Xfer<List<label> >&);
// Member Operators // Member Operators

View File

@ -42,7 +42,7 @@ template<class T>
inline Foam::IndirectList<T>::IndirectList inline Foam::IndirectList<T>::IndirectList
( (
const UList<T>& completeList, const UList<T>& completeList,
const Xfer< List<label> >& addr const Xfer<List<label> >& addr
) )
: :
completeList_(const_cast<UList<T>&>(completeList)), completeList_(const_cast<UList<T>&>(completeList)),
@ -121,7 +121,7 @@ inline void Foam::IndirectList<T>::resetAddressing
template<class T> template<class T>
inline void Foam::IndirectList<T>::resetAddressing inline void Foam::IndirectList<T>::resetAddressing
( (
const Xfer< List<label> >& addr const Xfer<List<label> >& addr
) )
{ {
addressing_.transfer(addr()); addressing_.transfer(addr());

View File

@ -38,7 +38,8 @@ Foam::IPstream::IPstream
) )
: :
Pstream(commsType, bufSize), Pstream(commsType, bufSize),
UIPstream(commsType, fromProcNo, buf_) UIPstream(commsType, fromProcNo, buf_, externalBufPosition_),
externalBufPosition_(0)
{} {}

View File

@ -55,6 +55,9 @@ class IPstream
public UIPstream public UIPstream
{ {
//- Receive index
label externalBufPosition_;
public: public:
// Constructors // Constructors

View File

@ -51,10 +51,31 @@ Foam::PstreamBuffers::PstreamBuffers
version_(version), version_(version),
sendBuf_(UPstream::nProcs()), sendBuf_(UPstream::nProcs()),
recvBuf_(UPstream::nProcs()), recvBuf_(UPstream::nProcs()),
recvBufPos_(UPstream::nProcs(), 0),
finishedSendsCalled_(false) finishedSendsCalled_(false)
{} {}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::PstreamBuffers::~PstreamBuffers()
{
// Check that all data has been consumed.
forAll(recvBufPos_, procI)
{
if (recvBufPos_[procI] < recvBuf_[procI].size())
{
FatalErrorIn("PstreamBuffers::~PstreamBuffers()")
<< "Message from processor " << procI
<< " not fully consumed. messageSize:" << recvBuf_[procI].size()
<< " bytes of which only " << recvBufPos_[procI]
<< " consumed."
<< Foam::abort(FatalError);
}
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
void Foam::PstreamBuffers::finishedSends(const bool block) void Foam::PstreamBuffers::finishedSends(const bool block)

View File

@ -106,6 +106,9 @@ class PstreamBuffers
//- receive buffer //- receive buffer
List<DynamicList<char> > recvBuf_; List<DynamicList<char> > recvBuf_;
//- read position in recvBuf_
labelList recvBufPos_;
bool finishedSendsCalled_; bool finishedSendsCalled_;
// Private member functions // Private member functions
@ -129,6 +132,10 @@ public:
IOstream::versionNumber version=IOstream::currentVersion IOstream::versionNumber version=IOstream::currentVersion
); );
// Destructor
~PstreamBuffers();
// Member functions // Member functions

View File

@ -77,20 +77,6 @@ inline void Foam::UIPstream::readFromBuffer
} }
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::UIPstream::~UIPstream()
{
if (externalBufPosition_ < messageSize_)
{
FatalErrorIn("UIPstream::~UIPstream()")
<< "Message not fully consumed. messageSize:" << messageSize_
<< " bytes of which only " << externalBufPosition_
<< " consumed." << Foam::abort(FatalError);
}
}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::Istream& Foam::UIPstream::read(token& t) Foam::Istream& Foam::UIPstream::read(token& t)

View File

@ -63,7 +63,7 @@ class UIPstream
DynamicList<char>& externalBuf_; DynamicList<char>& externalBuf_;
label externalBufPosition_; label& externalBufPosition_;
const int tag_; const int tag_;
@ -94,6 +94,7 @@ public:
const commsTypes commsType, const commsTypes commsType,
const int fromProcNo, const int fromProcNo,
DynamicList<char>& externalBuf, DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag = UPstream::msgType(), const int tag = UPstream::msgType(),
streamFormat format=BINARY, streamFormat format=BINARY,
versionNumber version=currentVersion versionNumber version=currentVersion
@ -103,11 +104,6 @@ public:
UIPstream(const int fromProcNo, PstreamBuffers&); UIPstream(const int fromProcNo, PstreamBuffers&);
// Destructor
~UIPstream();
// Member functions // Member functions
// Inquiry // Inquiry

View File

@ -220,6 +220,30 @@ Foam::List<int> Foam::UPstream::procIDs_(1, 0);
// Standard transfer message type // Standard transfer message type
int Foam::UPstream::msgType_(1); int Foam::UPstream::msgType_(1);
// New message type
int Foam::UPstream::freeTag_(msgType()+1);
// Free'd message types
Foam::LIFOStack<int> Foam::UPstream::freedTags_;
int Foam::UPstream::allocateTag()
{
if (freedTags_.empty())
{
return freeTag_++;
}
else
{
return freedTags_.pop();
}
}
void Foam::UPstream::freeTag(const int tag)
{
freedTags_.push(tag);
}
// Linear communication schedule // Linear communication schedule
Foam::List<Foam::UPstream::commsStruct> Foam::UPstream::linearCommunication_(0); Foam::List<Foam::UPstream::commsStruct> Foam::UPstream::linearCommunication_(0);

View File

@ -46,6 +46,7 @@ SourceFiles
#include "HashTable.H" #include "HashTable.H"
#include "string.H" #include "string.H"
#include "NamedEnum.H" #include "NamedEnum.H"
#include "LIFOStack.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -191,6 +192,14 @@ private:
static List<commsStruct> treeCommunication_; static List<commsStruct> treeCommunication_;
//- Current free tag
static int freeTag_;
//- Freed tags
static LIFOStack<int> freedTags_;
// Private member functions // Private member functions
//- Set data for parallel running //- Set data for parallel running
@ -340,6 +349,11 @@ public:
{ {
return msgType_; return msgType_;
} }
//- Allocate new tag
static int allocateTag();
//- Release allocated tag
static void freeTag(const int tag);
//- Get the communications type of the stream //- Get the communications type of the stream

View File

@ -298,7 +298,11 @@ evaluate()
} }
// Block for any outstanding requests // Block for any outstanding requests
if (Pstream::defaultCommsType == Pstream::nonBlocking) if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking
)
{ {
Pstream::waitRequests(); Pstream::waitRequests();
} }

View File

@ -108,7 +108,8 @@ void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
Pstream::blocking, Pstream::blocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
reinterpret_cast<const char*>(pf.begin()), reinterpret_cast<const char*>(pf.begin()),
pf.byteSize() pf.byteSize(),
procPatch_.tag()
); );
} }
} }
@ -126,7 +127,8 @@ void processorPointPatchField<Type>::swapAdd(Field<Type>& pField) const
Pstream::blocking, Pstream::blocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
reinterpret_cast<char*>(pnf.begin()), reinterpret_cast<char*>(pnf.begin()),
pnf.byteSize() pnf.byteSize(),
procPatch_.tag()
); );
if (doTransform()) if (doTransform())

View File

@ -109,7 +109,8 @@ const
Pstream::blocking, Pstream::blocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
reinterpret_cast<const char*>(pf.begin()), reinterpret_cast<const char*>(pf.begin()),
pf.byteSize() pf.byteSize(),
procPatch_.tag()
); );
} }
} }
@ -127,7 +128,8 @@ void processorCyclicPointPatchField<Type>::swapAdd(Field<Type>& pField) const
Pstream::blocking, Pstream::blocking,
procPatch_.neighbProcNo(), procPatch_.neighbProcNo(),
reinterpret_cast<char*>(pnf.begin()), reinterpret_cast<char*>(pnf.begin()),
pnf.byteSize() pnf.byteSize(),
procPatch_.tag()
); );
if (doTransform()) if (doTransform())

View File

@ -33,8 +33,7 @@ Description
#ifndef parRun_H #ifndef parRun_H
#define parRun_H #define parRun_H
#include "OPstream.H" #include "Pstream.H"
#include "IPstream.H"
#include "IOstreams.H" #include "IOstreams.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -95,6 +95,9 @@ public:
//- Return face transformation tensor //- Return face transformation tensor
virtual const tensor& forwardT() const = 0; virtual const tensor& forwardT() const = 0;
//- Return message tag used for sending
virtual int tag() const = 0;
// //- Set send buffer to sufficient size to hold List<Type>(nElems). // //- Set send buffer to sufficient size to hold List<Type>(nElems).
// // Returns reference to buffer (note:buffer.size() is number // // Returns reference to buffer (note:buffer.size() is number
// // of characters, not nElems) // // of characters, not nElems)

View File

@ -87,7 +87,8 @@ void Foam::processorLduInterface::send
commsType, commsType,
neighbProcNo(), neighbProcNo(),
reinterpret_cast<const char*>(f.begin()), reinterpret_cast<const char*>(f.begin()),
f.byteSize() f.byteSize(),
tag()
); );
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::nonBlocking)
@ -100,7 +101,8 @@ void Foam::processorLduInterface::send
commsType, commsType,
neighbProcNo(), neighbProcNo(),
receiveBuf_.begin(), receiveBuf_.begin(),
receiveBuf_.size() receiveBuf_.size(),
tag()
); );
//setSendBuf<Type>(f.size()); //setSendBuf<Type>(f.size());
@ -112,7 +114,8 @@ void Foam::processorLduInterface::send
commsType, commsType,
neighbProcNo(), neighbProcNo(),
sendBuf_.begin(), sendBuf_.begin(),
f.byteSize() f.byteSize(),
tag()
); );
} }
else else
@ -138,7 +141,8 @@ void Foam::processorLduInterface::receive
commsType, commsType,
neighbProcNo(), neighbProcNo(),
reinterpret_cast<char*>(f.begin()), reinterpret_cast<char*>(f.begin()),
f.byteSize() f.byteSize(),
tag()
); );
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::nonBlocking)
@ -202,7 +206,8 @@ void Foam::processorLduInterface::compressedSend
commsType, commsType,
neighbProcNo(), neighbProcNo(),
sendBuf_.begin(), sendBuf_.begin(),
nBytes nBytes,
tag()
); );
} }
else if (commsType == Pstream::nonBlocking) else if (commsType == Pstream::nonBlocking)
@ -215,7 +220,8 @@ void Foam::processorLduInterface::compressedSend
commsType, commsType,
neighbProcNo(), neighbProcNo(),
receiveBuf_.begin(), receiveBuf_.begin(),
receiveBuf_.size() receiveBuf_.size(),
tag()
); );
OPstream::write OPstream::write
@ -223,7 +229,8 @@ void Foam::processorLduInterface::compressedSend
commsType, commsType,
neighbProcNo(), neighbProcNo(),
sendBuf_.begin(), sendBuf_.begin(),
nBytes nBytes,
tag()
); );
} }
else else
@ -264,7 +271,8 @@ void Foam::processorLduInterface::compressedReceive
commsType, commsType,
neighbProcNo(), neighbProcNo(),
receiveBuf_.begin(), receiveBuf_.begin(),
nBytes nBytes,
tag()
); );
} }
else if (commsType != Pstream::nonBlocking) else if (commsType != Pstream::nonBlocking)
@ -350,7 +358,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType, // commsType,
// neighbProcNo(), // neighbProcNo(),
// sendBuf_.begin(), // sendBuf_.begin(),
// sendBuf_.size() // sendBuf_.size(),
// tag()
// ); // );
// } // }
// else if (commsType == Pstream::nonBlocking) // else if (commsType == Pstream::nonBlocking)
@ -362,7 +371,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType, // commsType,
// neighbProcNo(), // neighbProcNo(),
// receiveBuf_.begin(), // receiveBuf_.begin(),
// receiveBuf_.size() // receiveBuf_.size(),
// tag()
// ); // );
// //
// OPstream::write // OPstream::write
@ -370,7 +380,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType, // commsType,
// neighbProcNo(), // neighbProcNo(),
// sendBuf_.begin(), // sendBuf_.begin(),
// sendBuf_.size() // sendBuf_.size(),
// tag()
// ); // );
// } // }
// else // else
@ -405,7 +416,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType, // commsType,
// neighbProcNo(), // neighbProcNo(),
// receiveBuf_.begin(), // receiveBuf_.begin(),
// receiveBuf_.size() // receiveBuf_.size(),
// tag()
// ); // );
// } // }
// else if (commsType != Pstream::nonBlocking) // else if (commsType != Pstream::nonBlocking)
@ -441,7 +453,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
// commsType, // commsType,
// neighbProcNo(), // neighbProcNo(),
// receiveBuf_.begin(), // receiveBuf_.begin(),
// receiveBuf_.size() // receiveBuf_.size(),
// tag()
// ); // );
// } // }
// else if (commsType != Pstream::nonBlocking) // else if (commsType != Pstream::nonBlocking)

View File

@ -112,10 +112,13 @@ void Foam::lduMatrix::updateMatrixInterfaces
) )
{ {
// Block until all sends/receives have been finished // Block until all sends/receives have been finished
if (Pstream::defaultCommsType == Pstream::nonBlocking) if
(
Pstream::parRun()
&& Pstream::defaultCommsType == Pstream::nonBlocking
)
{ {
IPstream::waitRequests(); UPstream::waitRequests();
OPstream::waitRequests();
} }
forAll (interfaces, interfaceI) forAll (interfaces, interfaceI)

View File

@ -81,20 +81,13 @@ void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix
const Pstream::commsTypes const Pstream::commsTypes
) const ) const
{ {
scalarField pnf(size()); // 'send' neighbouring field
scalarField pnf(cyclicInterface_.interfaceInternalField(psiInternal)());
label sizeby2 = size()/2;
const unallocLabelList& faceCells = cyclicInterface_.faceCells();
for (label facei=0; facei<sizeby2; facei++)
{
pnf[facei] = psiInternal[faceCells[facei + sizeby2]];
pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
}
transformCoupleField(pnf, cmpt); transformCoupleField(pnf, cmpt);
const unallocLabelList& faceCells = cyclicInterface_.faceCells();
forAll(faceCells, elemI) forAll(faceCells, elemI)
{ {
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];

View File

@ -136,6 +136,12 @@ public:
} }
} }
//- Return message tag to use for communication
virtual int tag() const
{
return procPolyPatch_.tag();
}
//- Return processor number //- Return processor number
int myProcNo() const int myProcNo() const
{ {

View File

@ -382,7 +382,8 @@ processorCyclicPointPatch::processorCyclicPointPatch
const pointBoundaryMesh& bm const pointBoundaryMesh& bm
) )
: :
processorPointPatch(patch, bm) processorPointPatch(patch, bm),
procCycPolyPatch_(refCast<const processorCyclicPolyPatch>(patch))
{} {}

View File

@ -60,6 +60,9 @@ class processorCyclicPointPatch
: :
public processorPointPatch public processorPointPatch
{ {
// Private data
const processorCyclicPolyPatch& procCycPolyPatch_;
//- Disallow default construct as copy //- Disallow default construct as copy
processorCyclicPointPatch(const processorCyclicPointPatch&); processorCyclicPointPatch(const processorCyclicPointPatch&);
@ -90,6 +93,13 @@ public:
// Member functions // Member functions
//- Return message tag to use for communication
virtual int tag() const
{
return procCycPolyPatch_.tag();
}
// //- Return true if running parallel // //- Return true if running parallel
// virtual bool coupled() const // virtual bool coupled() const
// { // {

View File

@ -78,34 +78,38 @@ void Foam::globalMeshData::initProcAddr()
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send indices of my processor patches to my neighbours // Send indices of my processor patches to my neighbours
forAll (processorPatches_, i) forAll (processorPatches_, i)
{ {
label patchi = processorPatches_[i]; label patchi = processorPatches_[i];
OPstream toNeighbour UOPstream toNeighbour
( (
Pstream::blocking,
refCast<const processorPolyPatch> refCast<const processorPolyPatch>
( (
mesh_.boundaryMesh()[patchi] mesh_.boundaryMesh()[patchi]
).neighbProcNo() ).neighbProcNo(),
pBufs
); );
toNeighbour << processorPatchIndices_[patchi]; toNeighbour << processorPatchIndices_[patchi];
} }
pBufs.finishedSends();
forAll(processorPatches_, i) forAll(processorPatches_, i)
{ {
label patchi = processorPatches_[i]; label patchi = processorPatches_[i];
IPstream fromNeighbour UIPstream fromNeighbour
( (
Pstream::blocking,
refCast<const processorPolyPatch> refCast<const processorPolyPatch>
( (
mesh_.boundaryMesh()[patchi] mesh_.boundaryMesh()[patchi]
).neighbProcNo() ).neighbProcNo(),
pBufs
); );
fromNeighbour >> processorPatchNeighbours_[patchi]; fromNeighbour >> processorPatchNeighbours_[patchi];
@ -1560,6 +1564,8 @@ void Foam::globalMeshData::updateMesh()
pointStatus.set(meshPointI, SHARED); pointStatus.set(meshPointI, SHARED);
} }
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send patch local points // Send patch local points
forAll(processorPatches_, i) forAll(processorPatches_, i)
{ {
@ -1568,11 +1574,13 @@ void Foam::globalMeshData::updateMesh()
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]); refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
OPstream toNeighbour(Pstream::blocking, procPatch.neighbProcNo()); UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
toNeighbour << procPatch.localPoints(); toNeighbour << procPatch.localPoints();
} }
pBufs.finishedSends();
// Receive patch local points and uncount if coincident (and not shared) // Receive patch local points and uncount if coincident (and not shared)
forAll(processorPatches_, i) forAll(processorPatches_, i)
{ {
@ -1581,7 +1589,7 @@ void Foam::globalMeshData::updateMesh()
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]); refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
IPstream fromNeighbour(Pstream::blocking, procPatch.neighbProcNo()); UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
pointField nbrPoints(fromNeighbour); pointField nbrPoints(fromNeighbour);

View File

@ -431,17 +431,16 @@ void Foam::globalPoints::receivePatchPoints
const cyclicPolyPatch& cycPatch = const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(pp); refCast<const cyclicPolyPatch>(pp);
const labelList& meshPoints = pp.meshPoints(); const labelList& meshPoints = cycPatch.meshPoints();
const labelList coupledMeshPoints(reverseMeshPoints(cycPatch));
//const edgeList& connections = cycPatch.coupledPoints(); //const edgeList& connections = cycPatch.coupledPoints();
const edgeList connections(coupledPoints(cycPatch)); //const edgeList connections(coupledPoints(cycPatch));
forAll(connections, i) forAll(meshPoints, i)
{ {
const edge& e = connections[i]; label meshPointA = meshPoints[i];
label meshPointB = coupledMeshPoints[i];
label meshPointA = meshPoints[e[0]];
label meshPointB = meshPoints[e[1]];
label localA = meshToLocalPoint label localA = meshToLocalPoint
( (
@ -823,13 +822,15 @@ void Foam::globalPoints::receiveSharedPoints
// Sync all info. // Sync all info.
//const edgeList& connections = cycPatch.coupledPoints(); //const edgeList& connections = cycPatch.coupledPoints();
const edgeList connections(coupledPoints(cycPatch)); //const edgeList connections(coupledPoints(cycPatch));
forAll(connections, i) const labelList& meshPoints = cycPatch.meshPoints();
const labelList coupledMeshPoints(reverseMeshPoints(cycPatch));
forAll(meshPoints, i)
{ {
const edge& e = connections[i]; label meshPointA = meshPoints[i];
label meshPointA = pp.meshPoints()[e[0]]; label meshPointB = coupledMeshPoints[i];
label meshPointB = pp.meshPoints()[e[1]];
label localA = meshToLocalPoint label localA = meshToLocalPoint
( (
@ -902,51 +903,25 @@ void Foam::globalPoints::receiveSharedPoints
} }
Foam::edgeList Foam::globalPoints::coupledPoints(const cyclicPolyPatch& pp) Foam::labelList Foam::globalPoints::reverseMeshPoints
(
const cyclicPolyPatch& pp
)
{ {
// Look at cyclic patch as two halves, A and B. const cyclicPolyPatch& nbrPatch = pp.neighbPatch();
// Now all we know is that relative face index in halfA is same
// as coupled face in halfB and also that the 0th vertex
// corresponds.
// From halfA point to halfB or -1. faceList masterFaces(nbrPatch.size());
labelList coupledPoint(pp.nPoints(), -1);
for (label patchFaceA = 0; patchFaceA < pp.size()/2; patchFaceA++) forAll (nbrPatch, faceI)
{ {
const face& fA = pp.localFaces()[patchFaceA]; masterFaces[faceI] = nbrPatch[faceI].reverseFace();
forAll(fA, indexA)
{
label patchPointA = fA[indexA];
if (coupledPoint[patchPointA] == -1)
{
const face& fB = pp.localFaces()[patchFaceA + pp.size()/2];
label indexB = (fB.size() - indexA) % fB.size();
coupledPoint[patchPointA] = fB[indexB];
}
}
} }
edgeList connected(pp.nPoints()); return primitiveFacePatch
(
// Extract coupled points. masterFaces,
label connectedI = 0; nbrPatch.points()
).meshPoints();
forAll(coupledPoint, i)
{
if (coupledPoint[i] != -1)
{
connected[connectedI++] = edge(i, coupledPoint[i]);
}
}
connected.setSize(connectedI);
return connected;
} }

View File

@ -156,9 +156,6 @@ class globalPoints
// information is collected. // information is collected.
static label countPatchPoints(const polyBoundaryMesh&); static label countPatchPoints(const polyBoundaryMesh&);
////- Get all faces on coupled patches
//static labelListl coupledFaces(const polyBoundaryMesh&);
//- Add information about patchPointI in relative indices to send //- Add information about patchPointI in relative indices to send
// buffers (patchFaces, indexInFace etc.) // buffers (patchFaces, indexInFace etc.)
static void addToSend static void addToSend
@ -246,9 +243,8 @@ class globalPoints
labelList& labelList&
); );
//- Should move into cyclicPolyPatch ordering problem //- Return mesh points of other side in same order as my meshPoints.
// keeps on giving problems. static labelList reverseMeshPoints(const cyclicPolyPatch&);
static edgeList coupledPoints(const cyclicPolyPatch&);
//- Do all calculations. //- Do all calculations.
void calculateSharedPoints void calculateSharedPoints

View File

@ -75,7 +75,7 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
slave++ slave++
) )
{ {
IPstream fromSlave(Pstream::blocking, slave); IPstream fromSlave(Pstream::scheduled, slave);
List<labelPair> nbrData(fromSlave); List<labelPair> nbrData(fromSlave);
forAll(nbrData, i) forAll(nbrData, i)
@ -96,18 +96,18 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
slave++ slave++
) )
{ {
OPstream toSlave(Pstream::blocking, slave); OPstream toSlave(Pstream::scheduled, slave);
toSlave << allComms; toSlave << allComms;
} }
} }
else else
{ {
{ {
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster << allComms; toMaster << allComms;
} }
{ {
IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
fromMaster >> allComms; fromMaster >> allComms;
} }
} }
@ -596,6 +596,7 @@ void Foam::mapDistribute::compact(const boolList& elemIsUsed)
// Send elemIsUsed field to neighbour. Use nonblocking code from // Send elemIsUsed field to neighbour. Use nonblocking code from
// mapDistribute but in reverse order. // mapDistribute but in reverse order.
if (Pstream::parRun())
{ {
List<boolList> sendFields(Pstream::nProcs()); List<boolList> sendFields(Pstream::nProcs());

View File

@ -42,6 +42,30 @@ void Foam::mapDistribute::distribute
List<T>& field List<T>& field
) )
{ {
if (!Pstream::parRun())
{
// Do only me to me.
const labelList& mySubMap = subMap[Pstream::myProcNo()];
List<T> subField(mySubMap.size());
forAll(mySubMap, i)
{
subField[i] = field[mySubMap[i]];
}
// Receive sub field from myself (subField)
const labelList& map = constructMap[Pstream::myProcNo()];
field.setSize(constructSize);
forAll(map, i)
{
field[map[i]] = subField[i];
}
return;
}
if (commsType == Pstream::blocking) if (commsType == Pstream::blocking)
{ {
// Since buffered sending can reuse the field to collect the // Since buffered sending can reuse the field to collect the
@ -407,6 +431,30 @@ void Foam::mapDistribute::distribute
const T& nullValue const T& nullValue
) )
{ {
if (!Pstream::parRun())
{
// Do only me to me.
const labelList& mySubMap = subMap[Pstream::myProcNo()];
List<T> subField(mySubMap.size());
forAll(mySubMap, i)
{
subField[i] = field[mySubMap[i]];
}
// Receive sub field from myself (subField)
const labelList& map = constructMap[Pstream::myProcNo()];
field.setSize(constructSize);
forAll(map, i)
{
field[map[i]] = subField[i];
}
return;
}
if (commsType == Pstream::blocking) if (commsType == Pstream::blocking)
{ {
// Since buffered sending can reuse the field to collect the // Since buffered sending can reuse the field to collect the

View File

@ -294,13 +294,13 @@ Foam::polyMesh::polyMesh(const IOobject& io)
// Calculate the geometry for the patches (transformation tensors etc.) // Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry(); boundary_.calcGeometry();
// Warn if global empty mesh (constructs globalData!) // Warn if global empty mesh
if (globalData().nTotalPoints() == 0) if (returnReduce(nPoints(), sumOp<label>()) == 0)
{ {
WarningIn("polyMesh(const IOobject&)") WarningIn("polyMesh(const IOobject&)")
<< "no points in mesh" << endl; << "no points in mesh" << endl;
} }
if (globalData().nTotalCells() == 0) if (returnReduce(nCells(), sumOp<label>()) == 0)
{ {
WarningIn("polyMesh(const IOobject&)") WarningIn("polyMesh(const IOobject&)")
<< "no cells in mesh" << endl; << "no cells in mesh" << endl;
@ -744,8 +744,12 @@ void Foam::polyMesh::resetPrimitives
// Calculate the geometry for the patches (transformation tensors etc.) // Calculate the geometry for the patches (transformation tensors etc.)
boundary_.calcGeometry(); boundary_.calcGeometry();
// Warn if global empty mesh (constructs globalData!) // Warn if global empty mesh
if (globalData().nTotalPoints() == 0 || globalData().nTotalCells() == 0) if
(
(returnReduce(nPoints(), sumOp<label>()) == 0)
|| (returnReduce(nCells(), sumOp<label>()) == 0)
)
{ {
FatalErrorIn FatalErrorIn
( (

View File

@ -265,7 +265,8 @@ void Foam::coupledPolyPatch::calcTransformTensors
Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl
<< " (half)size:" << Cf.size() << nl << " (half)size:" << Cf.size() << nl
<< " absTol:" << absTol << nl << " absTol:" << absTol << nl
//<< " smallDist:" << smallDist << nl << " smallDist min:" << min(smallDist) << nl
<< " smallDist max:" << max(smallDist) << nl
<< " sum(mag(nf & nr)):" << sum(mag(nf & nr)) << endl; << " sum(mag(nf & nr)):" << sum(mag(nf & nr)) << endl;
} }
@ -277,7 +278,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
// Then the overall error of summing the normals is sqrt(size())*absTol // Then the overall error of summing the normals is sqrt(size())*absTol
// - separation calculation: pass in from the outside an allowable error. // - separation calculation: pass in from the outside an allowable error.
if (size() == 0) if (Cf.size() == 0)
{ {
// Dummy geometry. // Dummy geometry.
separated = false; separated = false;
@ -308,7 +309,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
// Check // Check
forAll (forwardT, facei) forAll(forwardT, facei)
{ {
tensor T = rotationTensor(-nr[facei], nf[facei]); tensor T = rotationTensor(-nr[facei], nf[facei]);

View File

@ -235,6 +235,15 @@ public:
return true; return true;
} }
//- Does this side own the patch ?
virtual bool owner() const = 0;
//- Does the coupled side own the patch ?
virtual bool neighbour() const
{
return !owner();
}
//- Transform a patch-based field from other side to this side. //- Transform a patch-based field from other side to this side.
//!! TDB with macros? //!! TDB with macros?
virtual bool doTransform() const = 0; virtual bool doTransform() const = 0;

View File

@ -175,13 +175,6 @@ void Foam::cyclicPolyPatch::calcTransforms
const UList<point>& half1Areas const UList<point>& half1Areas
) )
{ {
Pout<< "cyclicPolyPatch::calcTransforms : name:" << name() << endl
<< " half0Ctrs:"
<< " min:" << min(half0Ctrs) << " max:" << max(half0Ctrs)<< endl
<< " half1Ctrs:"
<< " min:" << min(half1Ctrs) << " max:" << max(half1Ctrs)<< endl
<< endl;
if (half0Ctrs.size() != half1Ctrs.size()) if (half0Ctrs.size() != half1Ctrs.size())
{ {
FatalErrorIn FatalErrorIn
@ -265,16 +258,6 @@ Pout<< "cyclicPolyPatch::calcTransforms : name:" << name() << endl
half1Normals, half1Normals,
half0Tols half0Tols
); );
Pout<< "cyclicPolyPatch::calcTransforms : calculated transforms for:"
<< name() << endl
<< " separated_:" << separated_ << endl
<< " separation_:" << separation_ << endl
<< " parallel_:" << parallel_ << endl
<< " forwardT_:" << forwardT_ << endl
<< " reverseT_:" << reverseT_ << endl
<< endl;
} }
} }
@ -445,7 +428,7 @@ Foam::label Foam::cyclicPolyPatch::getConsistentRotationFace
if (debug) if (debug)
{ {
Info<< "getConsistentRotationFace(const pointField&)" << nl Pout<< "getConsistentRotationFace(const pointField&)" << nl
<< " rotFace = " << rotFace << nl << " rotFace = " << rotFace << nl
<< " point = " << faceCentres[rotFace] << endl; << " point = " << faceCentres[rotFace] << endl;
} }
@ -679,7 +662,7 @@ void Foam::cyclicPolyPatch::calcGeometry
//polyPatch::calcGeometry(); //polyPatch::calcGeometry();
Pout<< "cyclicPolyPatch::calcGeometry : name:" << name() Pout<< "cyclicPolyPatch::calcGeometry : name:" << name()
<< " referred from:" << referPatch.size() << endl; << " referred from a patch with nFaces:" << referPatch.size() << endl;
calcTransforms calcTransforms
( (
@ -694,7 +677,6 @@ Pout<< "cyclicPolyPatch::calcGeometry : name:" << name()
void Foam::cyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs) void Foam::cyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{ {
Pout<< "cyclicPolyPatch::calcGeometry() for " << name() << endl;
calcGeometry calcGeometry
( (
*this, *this,

View File

@ -417,34 +417,34 @@ public:
// Low level geometric information // Low level geometric information
//- Are the coupled planes separated //- Are the coupled planes separated
virtual bool separated() const virtual bool separated() const
{ {
return separated_; return separated_;
} }
virtual const vector& separation() const virtual const vector& separation() const
{ {
return separation_; return separation_;
} }
//- Are the cyclic planes parallel //- Are the cyclic planes parallel
virtual bool parallel() const virtual bool parallel() const
{ {
return parallel_; return parallel_;
} }
//- Return face transformation tensor //- Return face transformation tensor
virtual const tensor& forwardT() const virtual const tensor& forwardT() const
{ {
return forwardT_; return forwardT_;
} }
//- Return neighbour-cell transformation tensor //- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const virtual const tensor& reverseT() const
{ {
return reverseT_; return reverseT_;
} }
label transformGlobalFace(const label facei) const label transformGlobalFace(const label facei) const
{ {
@ -466,6 +466,31 @@ public:
} }
} }
//- Type of transform
transformType transform() const
{
return transform_;
}
//- Axis of rotation for rotational cyclics
const vector& rotationAxis() const
{
return rotationAxis_;
}
//- point on axis of rotation for rotational cyclics
const point& rotationCentre() const
{
return rotationCentre_;
}
//- Translation vector for translational cyclics
const vector& separationVector() const
{
return separationVector_;
}
//- Initialize ordering for primitivePatch. Does not //- Initialize ordering for primitivePatch. Does not
// refer to *this (except for name() and type() etc.) // refer to *this (except for name() and type() etc.)
virtual void initOrder(PstreamBuffers&, const primitivePatch&) const; virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;

View File

@ -158,7 +158,7 @@ Foam::processorPolyPatch::~processorPolyPatch()
void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs) void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
Pout<< "**processorPolyPatch::initGeometry()" << endl; //Pout<< "**processorPolyPatch::initGeometry()" << endl;
if (Pstream::parRun()) if (Pstream::parRun())
{ {
UOPstream toNeighbProc(neighbProcNo(), pBufs); UOPstream toNeighbProc(neighbProcNo(), pBufs);
@ -187,22 +187,94 @@ Pout<< "processorPolyPatch::calcGeometry() for " << name() << endl;
Pout<< "processorPolyPatch::calcGeometry() : received data for " Pout<< "processorPolyPatch::calcGeometry() : received data for "
<< neighbFaceCentres_.size() << " faces." << endl; << neighbFaceCentres_.size() << " faces." << endl;
//Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl;
//Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl;
//Pout<< "**neighbFaceCellCentres_:" << neighbFaceCellCentres_ << endl;
calcGeometry
(
*this, // // My normals
faceCentres(), // vectorField faceNormals(size());
faceAreas(), //
faceCellCentres()(), // // Neighbour normals
neighbFaceCentres_, // vectorField nbrFaceNormals(neighbFaceAreas_.size());
neighbFaceAreas_, //
neighbFaceCellCentres_ // // Calculate normals from areas and check
); // forAll(faceNormals, facei)
// {
// scalar magSf = mag(faceAreas()[facei]);
// scalar nbrMagSf = mag(neighbFaceAreas_[facei]);
// scalar avSf = (magSf + nbrMagSf)/2.0;
//
// if (magSf < ROOTVSMALL && nbrMagSf < ROOTVSMALL)
// {
// // Undetermined normal. Use dummy normal to force separation
// // check. (note use of sqrt(VSMALL) since that is how mag
// // scales)
// faceNormals[facei] = point(1, 0, 0);
// nbrFaceNormals[facei] = faceNormals[facei];
// }
// else if (mag(magSf - nbrMagSf)/avSf > coupledPolyPatch::matchTol)
// {
// fileName nm
// (
// boundaryMesh().mesh().time().path()
// /name()+"_faces.obj"
// );
// Pout<< "processorPolyPatch::order : Writing my " << size()
// << " faces to OBJ file " << nm << endl;
// writeOBJ(nm, *this, points());
//
// FatalErrorIn
// (
// "processorPolyPatch::calcGeometry()"
// ) << "face " << facei << " area does not match neighbour by "
// << 100*mag(magSf - nbrMagSf)/avSf
// << "% -- possible face ordering problem." << endl
// << "patch:" << name()
// << " my area:" << magSf
// << " neighbour area:" << nbrMagSf
// << " matching tolerance:" << coupledPolyPatch::matchTol
// << endl
// << "Mesh face:" << start()+facei
// << " vertices:"
// << UIndirectList<point>(points(), operator[](facei))()
// << endl
// << "Rerun with processor debug flag set for"
// << " more information." << exit(FatalError);
// }
// else
// {
// faceNormals[facei] = faceAreas()[facei]/magSf;
// nbrFaceNormals[facei] = neighbFaceAreas_[facei]/nbrMagSf;
// }
// }
//
//
// // Calculate transformation tensors
// calcTransformTensors
// (
// separated_,
// separation_,
// parallel_,
// forwardT_,
// reverseT_,
// faceCentres(),
// neighbFaceCentres_,
// faceNormals,
// nbrFaceNormals,
// calcFaceTol(*this, points(), faceCentres())
// );
//
//Pout<< "cyclicPolyPatch::calcTransforms : calculated transforms for:"
// << name() << endl
// << " separated_:" << separated_ << endl
// << " separation_:" << separation_ << endl
// << " parallel_:" << parallel_ << endl
// << " forwardT_:" << forwardT_ << endl
// << " reverseT_:" << reverseT_ << endl
// << endl;
} }
Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl;
Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl;
Pout<< "**neighbFaceCellCentres_:" << neighbFaceCellCentres_ << endl;
} }
@ -292,7 +364,7 @@ void Foam::processorPolyPatch::updateMesh(PstreamBuffers& pBufs)
{ {
// Note cannot predict exact size since opposite nPoints might // Note cannot predict exact size since opposite nPoints might
// be different from one over here. // be different from one over here.
IPstream fromNeighbProc(Pstream::blocking, neighbProcNo()); UIPstream fromNeighbProc(neighbProcNo(), pBufs);
fromNeighbProc fromNeighbProc
>> nbrPointFace >> nbrPointFace

View File

@ -292,6 +292,12 @@ public:
//- Return neighbour edge labels. WIP. //- Return neighbour edge labels. WIP.
const labelList& neighbEdges() const; const labelList& neighbEdges() const;
//- Return message tag to use for communication
virtual int tag() const
{
return Pstream::msgType();
}
//- Transform a patch-based field from other side to this side. //- Transform a patch-based field from other side to this side.
virtual bool doTransform() const virtual bool doTransform() const
{ {
@ -317,21 +323,21 @@ public:
//- Are the planes separated. //- Are the planes separated.
virtual bool separated() const virtual bool separated() const
{ {
notImplemented("processorPolyPatch::separated(..)"); //notImplemented("processorPolyPatch::separated(..)");
return false; return false;
} }
//- If the planes are separated the separation vector. //- If the planes are separated the separation vector.
virtual const vector& separation() const virtual const vector& separation() const
{ {
notImplemented("processorPolyPatch::separation(..)"); //notImplemented("processorPolyPatch::separation(..)");
return vector::zero; return vector::zero;
} }
//- Are the cyclic planes parallel. //- Are the cyclic planes parallel.
virtual bool parallel() const virtual bool parallel() const
{ {
notImplemented("processorPolyPatch::parallel()"); //notImplemented("processorPolyPatch::parallel()");
return true; return true;
} }

View File

@ -55,6 +55,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
) )
: :
processorPolyPatch(name, size, start, index, bm, myProcNo, neighbProcNo), processorPolyPatch(name, size, start, index, bm, myProcNo, neighbProcNo),
tag_(UPstream::allocateTag()),
referPatchName_(referPatchName), referPatchName_(referPatchName),
referPatchID_(-1) referPatchID_(-1)
{} {}
@ -69,6 +70,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
) )
: :
processorPolyPatch(name, dict, index, bm), processorPolyPatch(name, dict, index, bm),
tag_(UPstream::allocateTag()),
referPatchName_(dict.lookup("referPatch")), referPatchName_(dict.lookup("referPatch")),
referPatchID_(-1) referPatchID_(-1)
{} {}
@ -81,6 +83,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
) )
: :
processorPolyPatch(pp, bm), processorPolyPatch(pp, bm),
tag_(pp.tag_),
referPatchName_(pp.referPatchName()), referPatchName_(pp.referPatchName()),
referPatchID_(-1) referPatchID_(-1)
{} {}
@ -97,6 +100,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
) )
: :
processorPolyPatch(pp, bm, index, newSize, newStart), processorPolyPatch(pp, bm, index, newSize, newStart),
tag_(pp.tag_),
referPatchName_(referPatchName), referPatchName_(referPatchName),
referPatchID_(-1) referPatchID_(-1)
{} {}
@ -112,6 +116,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
) )
: :
processorPolyPatch(pp, bm, index, mapAddressing, newStart), processorPolyPatch(pp, bm, index, mapAddressing, newStart),
tag_(pp.tag_),
referPatchName_(pp.referPatchName()), referPatchName_(pp.referPatchName()),
referPatchID_(-1) referPatchID_(-1)
{} {}
@ -120,7 +125,9 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch() Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
{} {
UPstream::freeTag(tag_);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -128,8 +135,6 @@ Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
void Foam::processorCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs) void Foam::processorCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
{ {
Pout<< "**processorCyclicPolyPatch::initGeometry()" << endl;
// Send over processorPolyPatch data // Send over processorPolyPatch data
processorPolyPatch::initGeometry(pBufs); processorPolyPatch::initGeometry(pBufs);
} }
@ -137,8 +142,6 @@ Pout<< "**processorCyclicPolyPatch::initGeometry()" << endl;
void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs) void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
{ {
Pout<< "processorCyclicPolyPatch::calcGeometry() for " << name() << endl;
// Receive and initialise processorPolyPatch data // Receive and initialise processorPolyPatch data
processorPolyPatch::calcGeometry(pBufs); processorPolyPatch::calcGeometry(pBufs);
@ -158,7 +161,7 @@ Pout<< "processorCyclicPolyPatch::calcGeometry() for " << name() << endl;
pp.calcGeometry pp.calcGeometry
( (
pp, *this,
faceCentres(), faceCentres(),
faceAreas(), faceAreas(),
faceCellCentres(), faceCellCentres(),

View File

@ -55,13 +55,15 @@ class processorCyclicPolyPatch
{ {
// Private data // Private data
//- Message tag to use for communication
const int tag_;
//- Name of originating patch //- Name of originating patch
const word referPatchName_; const word referPatchName_;
//- Index of originating patch //- Index of originating patch
mutable label referPatchID_; mutable label referPatchID_;
// Private member functions // Private member functions
@ -270,7 +272,19 @@ public:
const coupledPolyPatch& referPatch() const const coupledPolyPatch& referPatch() const
{ {
const polyPatch& pp = this->boundaryMesh()[referPatchID()]; const polyPatch& pp = this->boundaryMesh()[referPatchID()];
return refCast<const processorCyclicPolyPatch>(pp); return refCast<const coupledPolyPatch>(pp);
}
//- Return message tag to use for communication
virtual int tag() const
{
return tag_;
}
//- Does this side own the patch ?
virtual bool owner() const
{
return referPatch().owner();
} }
//- Transform a patch-based field from other side to this side. //- Transform a patch-based field from other side to this side.

View File

@ -137,63 +137,25 @@ Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
{ {
if (patches[patchI].coupled()) if (patches[patchI].coupled())
{ {
if const coupledPolyPatch& pp =
( refCast<const coupledPolyPatch>(patches[patchI]);
Pstream::parRun()
&& isA<processorPolyPatch>(patches[patchI]) const labelList& meshPoints = pp.meshPoints();
)
forAll(meshPoints, i)
{ {
const processorPolyPatch& pp = label pointI = meshPoints[i];
refCast<const processorPolyPatch>(patches[patchI]);
const labelList& meshPoints = pp.meshPoints(); if (donePoint.get(pointI) == 0u)
forAll(meshPoints, i)
{ {
label pointI = meshPoints[i]; donePoint.set(pointI, 1u);
if (donePoint.get(pointI) == 0u) if (pp.owner())
{ {
donePoint.set(pointI, 1u); isMasterPoint.set(pointI, 1u);
if (pp.owner())
{
isMasterPoint.set(pointI, 1u);
}
} }
} }
} }
else if (isA<cyclicPolyPatch>(patches[patchI]))
{
const cyclicPolyPatch& pp =
refCast<const cyclicPolyPatch>(patches[patchI]);
const edgeList& coupledPoints = pp.coupledPoints();
const labelList& meshPoints = pp.meshPoints();
forAll(coupledPoints, i)
{
// First one of couple points is master
const edge& pointPair = coupledPoints[i];
label p0 = meshPoints[pointPair[0]];
label p1 = meshPoints[pointPair[1]];
if (donePoint.get(p0) == 0u)
{
donePoint.set(p0, 1u);
isMasterPoint.set(p0, 1u);
donePoint.set(p1, 1u);
}
}
}
else
{
FatalErrorIn("syncTools::getMasterPoints(const polyMesh&)")
<< "Cannot handle coupled patch " << patches[patchI].name()
<< " of type " << patches[patchI].type()
<< abort(FatalError);
}
} }
} }
@ -256,63 +218,25 @@ Foam::PackedBoolList Foam::syncTools::getMasterEdges(const polyMesh& mesh)
{ {
if (patches[patchI].coupled()) if (patches[patchI].coupled())
{ {
if const coupledPolyPatch& pp =
( refCast<const coupledPolyPatch>(patches[patchI]);
Pstream::parRun()
&& isA<processorPolyPatch>(patches[patchI]) const labelList& meshEdges = pp.meshEdges();
)
forAll(meshEdges, i)
{ {
const processorPolyPatch& pp = label edgeI = meshEdges[i];
refCast<const processorPolyPatch>(patches[patchI]);
const labelList& meshEdges = pp.meshEdges(); if (doneEdge.get(edgeI) == 0u)
forAll(meshEdges, i)
{ {
label edgeI = meshEdges[i]; doneEdge.set(edgeI, 1u);
if (doneEdge.get(edgeI) == 0u) if (pp.owner())
{ {
doneEdge.set(edgeI, 1u); isMasterEdge.set(edgeI, 1u);
if (pp.owner())
{
isMasterEdge.set(edgeI, 1u);
}
} }
} }
} }
else if (isA<cyclicPolyPatch>(patches[patchI]))
{
const cyclicPolyPatch& pp =
refCast<const cyclicPolyPatch>(patches[patchI]);
const edgeList& coupledEdges = pp.coupledEdges();
const labelList& meshEdges = pp.meshEdges();
forAll(coupledEdges, i)
{
// First one of couple edges is master
const edge& edgePair = coupledEdges[i];
label e0 = meshEdges[edgePair[0]];
label e1 = meshEdges[edgePair[1]];
if (doneEdge.get(e0) == 0u)
{
doneEdge.set(e0, 1u);
isMasterEdge.set(e0, 1u);
doneEdge.set(e1, 1u);
}
}
}
else
{
FatalErrorIn("syncTools::getMasterEdges(const polyMesh&)")
<< "Cannot handle coupled patch " << patches[patchI].name()
<< " of type " << patches[patchI].type()
<< abort(FatalError);
}
} }
} }
@ -344,36 +268,16 @@ Foam::PackedBoolList Foam::syncTools::getMasterFaces(const polyMesh& mesh)
{ {
if (patches[patchI].coupled()) if (patches[patchI].coupled())
{ {
if (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI])) const coupledPolyPatch& pp =
{ refCast<const coupledPolyPatch>(patches[patchI]);
const processorPolyPatch& pp =
refCast<const processorPolyPatch>(patches[patchI]);
if (!pp.owner()) if (!pp.owner())
{
forAll(pp, i)
{
isMasterFace.unset(pp.start()+i);
}
}
}
else if (isA<cyclicPolyPatch>(patches[patchI]))
{ {
const cyclicPolyPatch& pp = forAll(pp, i)
refCast<const cyclicPolyPatch>(patches[patchI]);
for (label i = pp.size()/2; i < pp.size(); i++)
{ {
isMasterFace.unset(pp.start()+i); isMasterFace.unset(pp.start()+i);
} }
} }
else
{
FatalErrorIn("syncTools::getMasterFaces(const polyMesh&)")
<< "Cannot handle coupled patch " << patches[patchI].name()
<< " of type " << patches[patchI].type()
<< abort(FatalError);
}
} }
} }

View File

@ -101,6 +101,8 @@ void Foam::syncTools::syncPointMap
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send // Send
forAll(patches, patchI) forAll(patches, patchI)
@ -134,11 +136,12 @@ void Foam::syncTools::syncPointMap
} }
} }
OPstream toNeighb(Pstream::blocking, procPatch.neighbProcNo()); UOPstream toNeighb(procPatch.neighbProcNo(), pBufs);
toNeighb << patchInfo; toNeighb << patchInfo;
} }
} }
pBufs.finishedSends();
// Receive and combine. // Receive and combine.
@ -153,7 +156,7 @@ void Foam::syncTools::syncPointMap
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(patches[patchI]); refCast<const processorPolyPatch>(patches[patchI]);
IPstream fromNb(Pstream::blocking, procPatch.neighbProcNo()); UIPstream fromNb(procPatch.neighbProcNo(), pBufs);
Map<T> nbrPatchInfo(fromNb); Map<T> nbrPatchInfo(fromNb);
// Transform // Transform
@ -198,7 +201,7 @@ void Foam::syncTools::syncPointMap
const labelList& meshPtsA = cycPatch.meshPoints(); const labelList& meshPtsA = cycPatch.meshPoints();
const labelList& meshPtsB = nbrPatch.meshPoints(); const labelList& meshPtsB = nbrPatch.meshPoints();
// Extract local values. Create map from nbrPoint to value. // Extract local values. Create map from coupled-edge to value.
Map<T> half0Values(meshPtsA.size() / 20); Map<T> half0Values(meshPtsA.size() / 20);
Map<T> half1Values(half0Values.size()); Map<T> half1Values(half0Values.size());
@ -311,7 +314,7 @@ void Foam::syncTools::syncPointMap
slave++ slave++
) )
{ {
IPstream fromSlave(Pstream::blocking, slave); IPstream fromSlave(Pstream::scheduled, slave);
Map<T> nbrValues(fromSlave); Map<T> nbrValues(fromSlave);
// Merge neighbouring values with my values // Merge neighbouring values with my values
@ -335,7 +338,7 @@ void Foam::syncTools::syncPointMap
slave++ slave++
) )
{ {
OPstream toSlave(Pstream::blocking, slave); OPstream toSlave(Pstream::scheduled, slave);
toSlave << sharedPointValues; toSlave << sharedPointValues;
} }
} }
@ -343,14 +346,14 @@ void Foam::syncTools::syncPointMap
{ {
// Slave: send to master // Slave: send to master
{ {
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster << sharedPointValues; toMaster << sharedPointValues;
} }
// Receive merged values // Receive merged values
{ {
IPstream fromMaster IPstream fromMaster
( (
Pstream::blocking, Pstream::scheduled,
Pstream::masterNo() Pstream::masterNo()
); );
fromMaster >> sharedPointValues; fromMaster >> sharedPointValues;
@ -416,6 +419,8 @@ void Foam::syncTools::syncEdgeMap
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send // Send
forAll(patches, patchI) forAll(patches, patchI)
@ -453,11 +458,12 @@ void Foam::syncTools::syncEdgeMap
} }
} }
OPstream toNeighb(Pstream::blocking, procPatch.neighbProcNo()); UOPstream toNeighb(procPatch.neighbProcNo(), pBufs);
toNeighb << patchInfo; toNeighb << patchInfo;
} }
} }
pBufs.finishedSends();
// Receive and combine. // Receive and combine.
@ -474,11 +480,7 @@ void Foam::syncTools::syncEdgeMap
EdgeMap<T> nbrPatchInfo; EdgeMap<T> nbrPatchInfo;
{ {
IPstream fromNbr UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
(
Pstream::blocking,
procPatch.neighbProcNo()
);
fromNbr >> nbrPatchInfo; fromNbr >> nbrPatchInfo;
} }
@ -704,7 +706,7 @@ void Foam::syncTools::syncEdgeMap
slave++ slave++
) )
{ {
IPstream fromSlave(Pstream::blocking, slave); IPstream fromSlave(Pstream::scheduled, slave);
EdgeMap<T> nbrValues(fromSlave); EdgeMap<T> nbrValues(fromSlave);
// Merge neighbouring values with my values // Merge neighbouring values with my values
@ -729,7 +731,7 @@ void Foam::syncTools::syncEdgeMap
) )
{ {
OPstream toSlave(Pstream::blocking, slave); OPstream toSlave(Pstream::scheduled, slave);
toSlave << sharedEdgeValues; toSlave << sharedEdgeValues;
} }
} }
@ -737,12 +739,12 @@ void Foam::syncTools::syncEdgeMap
{ {
// Send to master // Send to master
{ {
OPstream toMaster(Pstream::blocking, Pstream::masterNo()); OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
toMaster << sharedEdgeValues; toMaster << sharedEdgeValues;
} }
// Receive merged values // Receive merged values
{ {
IPstream fromMaster(Pstream::blocking, Pstream::masterNo()); IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
fromMaster >> sharedEdgeValues; fromMaster >> sharedEdgeValues;
} }
} }
@ -807,6 +809,8 @@ void Foam::syncTools::syncPointList
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send // Send
forAll(patches, patchI) forAll(patches, patchI)
@ -832,11 +836,12 @@ void Foam::syncTools::syncPointList
patchInfo[nbrPointI] = pointValues[meshPts[pointI]]; patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo; toNbr << patchInfo;
} }
} }
pBufs.finishedSends();
// Receive and combine. // Receive and combine.
@ -853,11 +858,7 @@ void Foam::syncTools::syncPointList
Field<T> nbrPatchInfo(procPatch.nPoints()); Field<T> nbrPatchInfo(procPatch.nPoints());
{ {
IPstream fromNbr UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
(
Pstream::blocking,
procPatch.neighbProcNo()
);
fromNbr >> nbrPatchInfo; fromNbr >> nbrPatchInfo;
} }
@ -1032,6 +1033,8 @@ void Foam::syncTools::syncEdgeList
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send // Send
forAll(patches, patchI) forAll(patches, patchI)
@ -1058,11 +1061,13 @@ void Foam::syncTools::syncEdgeList
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]]; patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo; toNbr << patchInfo;
} }
} }
pBufs.finishedSends();
// Receive and combine. // Receive and combine.
forAll(patches, patchI) forAll(patches, patchI)
@ -1083,11 +1088,7 @@ void Foam::syncTools::syncEdgeList
Field<T> nbrPatchInfo(procPatch.nEdges()); Field<T> nbrPatchInfo(procPatch.nEdges());
{ {
IPstream fromNeighb UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
(
Pstream::blocking,
procPatch.neighbProcNo()
);
fromNeighb >> nbrPatchInfo; fromNeighb >> nbrPatchInfo;
} }
@ -1215,6 +1216,8 @@ void Foam::syncTools::syncBoundaryFaceList
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send // Send
forAll(patches, patchI) forAll(patches, patchI)
@ -1230,31 +1233,21 @@ void Foam::syncTools::syncBoundaryFaceList
label patchStart = procPatch.start()-mesh.nInternalFaces(); label patchStart = procPatch.start()-mesh.nInternalFaces();
if (contiguous<T>()) UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
{ toNbr <<
OPstream::write SubField<T>
( (
Pstream::blocking, faceValues,
procPatch.neighbProcNo(), procPatch.size(),
reinterpret_cast<const char*>(&faceValues[patchStart]), patchStart
procPatch.size()*sizeof(T)
); );
}
else
{
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
toNbr <<
SubField<T>
(
faceValues,
procPatch.size(),
patchStart
);
}
} }
} }
pBufs.finishedSends();
// Receive and combine. // Receive and combine.
forAll(patches, patchI) forAll(patches, patchI)
@ -1270,25 +1263,8 @@ void Foam::syncTools::syncBoundaryFaceList
Field<T> nbrPatchInfo(procPatch.size()); Field<T> nbrPatchInfo(procPatch.size());
if (contiguous<T>()) UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
{ fromNeighb >> nbrPatchInfo;
IPstream::read
(
Pstream::blocking,
procPatch.neighbProcNo(),
reinterpret_cast<char*>(nbrPatchInfo.begin()),
nbrPatchInfo.byteSize()
);
}
else
{
IPstream fromNeighb
(
Pstream::blocking,
procPatch.neighbProcNo()
);
fromNeighb >> nbrPatchInfo;
}
top(procPatch, nbrPatchInfo); top(procPatch, nbrPatchInfo);
@ -1373,6 +1349,8 @@ void Foam::syncTools::syncFaceList
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send // Send
forAll(patches, patchI) forAll(patches, patchI)
@ -1392,12 +1370,14 @@ void Foam::syncTools::syncFaceList
patchInfo[i] = faceValues[procPatch.start()+i]; patchInfo[i] = faceValues[procPatch.start()+i];
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo; toNbr << patchInfo;
} }
} }
pBufs.finishedSends();
// Receive and combine. // Receive and combine.
forAll(patches, patchI) forAll(patches, patchI)
@ -1413,11 +1393,7 @@ void Foam::syncTools::syncFaceList
List<unsigned int> patchInfo(procPatch.size()); List<unsigned int> patchInfo(procPatch.size());
{ {
IPstream fromNbr UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
(
Pstream::blocking,
procPatch.neighbProcNo()
);
fromNbr >> patchInfo; fromNbr >> patchInfo;
} }
@ -1508,6 +1484,8 @@ void Foam::syncTools::syncPointList
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send // Send
forAll(patches, patchI) forAll(patches, patchI)
@ -1532,12 +1510,14 @@ void Foam::syncTools::syncPointList
patchInfo[nbrPointI] = pointValues[meshPts[pointI]]; patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo; toNbr << patchInfo;
} }
} }
pBufs.finishedSends();
// Receive and combine. // Receive and combine.
forAll(patches, patchI) forAll(patches, patchI)
@ -1555,11 +1535,7 @@ void Foam::syncTools::syncPointList
{ {
// We do not know the number of points on the other side // We do not know the number of points on the other side
// so cannot use Pstream::read. // so cannot use Pstream::read.
IPstream fromNbr UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
(
Pstream::blocking,
procPatch.neighbProcNo()
);
fromNbr >> nbrPatchInfo; fromNbr >> nbrPatchInfo;
} }
@ -1672,6 +1648,8 @@ void Foam::syncTools::syncEdgeList
if (Pstream::parRun()) if (Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send // Send
forAll(patches, patchI) forAll(patches, patchI)
@ -1696,11 +1674,12 @@ void Foam::syncTools::syncEdgeList
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]]; patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
} }
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo()); UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
toNbr << patchInfo; toNbr << patchInfo;
} }
} }
pBufs.finishedSends();
// Receive and combine. // Receive and combine.
@ -1719,11 +1698,7 @@ void Foam::syncTools::syncEdgeList
List<unsigned int> nbrPatchInfo(procPatch.nEdges()); List<unsigned int> nbrPatchInfo(procPatch.nEdges());
{ {
IPstream fromNeighb UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
(
Pstream::blocking,
procPatch.neighbProcNo()
);
fromNeighb >> nbrPatchInfo; fromNeighb >> nbrPatchInfo;
} }

View File

@ -36,6 +36,7 @@ Foam::UIPstream::UIPstream
const commsTypes commsType, const commsTypes commsType,
const int fromProcNo, const int fromProcNo,
DynamicList<char>& externalBuf, DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag, const int tag,
streamFormat format, streamFormat format,
versionNumber version versionNumber version
@ -45,7 +46,7 @@ Foam::UIPstream::UIPstream
Istream(format, version), Istream(format, version),
fromProcNo_(fromProcNo), fromProcNo_(fromProcNo),
externalBuf_(externalBuf), externalBuf_(externalBuf),
externalBufPosition_(0), externalBufPosition_(externalBufPosition),
tag_(tag), tag_(tag),
messageSize_(0) messageSize_(0)
{ {
@ -56,6 +57,7 @@ Foam::UIPstream::UIPstream
"const commsTypes," "const commsTypes,"
"const int fromProcNo," "const int fromProcNo,"
"DynamicList<char>&," "DynamicList<char>&,"
"label&,"
"const int tag," "const int tag,"
"streamFormat, versionNumber" "streamFormat, versionNumber"
")" ")"

View File

@ -40,6 +40,7 @@ Foam::UIPstream::UIPstream
const commsTypes commsType, const commsTypes commsType,
const int fromProcNo, const int fromProcNo,
DynamicList<char>& externalBuf, DynamicList<char>& externalBuf,
label& externalBufPosition,
const int tag, const int tag,
streamFormat format, streamFormat format,
versionNumber version versionNumber version
@ -49,7 +50,7 @@ Foam::UIPstream::UIPstream
Istream(format, version), Istream(format, version),
fromProcNo_(fromProcNo), fromProcNo_(fromProcNo),
externalBuf_(externalBuf), externalBuf_(externalBuf),
externalBufPosition_(0), externalBufPosition_(externalBufPosition),
tag_(tag), tag_(tag),
messageSize_(0) messageSize_(0)
{ {
@ -122,7 +123,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
Istream(buffers.format_, buffers.version_), Istream(buffers.format_, buffers.version_),
fromProcNo_(fromProcNo), fromProcNo_(fromProcNo),
externalBuf_(buffers.recvBuf_[fromProcNo]), externalBuf_(buffers.recvBuf_[fromProcNo]),
externalBufPosition_(0), externalBufPosition_(buffers.recvBufPos_[fromProcNo]),
tag_(buffers.tag_), tag_(buffers.tag_),
messageSize_(0) messageSize_(0)
{ {

View File

@ -45,7 +45,7 @@ bool Foam::UOPstream::write
{ {
if (debug) if (debug)
{ {
Pout<< "UIPstream::write : starting write to:" << toProcNo Pout<< "UOPstream::write : starting write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize) << " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType] << " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl; << Foam::endl;
@ -67,7 +67,7 @@ bool Foam::UOPstream::write
if (debug) if (debug)
{ {
Pout<< "UIPstream::write : finished write to:" << toProcNo Pout<< "UOPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize) << " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType] << " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl; << Foam::endl;
@ -87,7 +87,7 @@ bool Foam::UOPstream::write
if (debug) if (debug)
{ {
Pout<< "UIPstream::write : finished write to:" << toProcNo Pout<< "UOPstream::write : finished write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize) << " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType] << " commsType:" << UPstream::commsTypeNames[commsType]
<< Foam::endl; << Foam::endl;
@ -110,7 +110,7 @@ bool Foam::UOPstream::write
if (debug) if (debug)
{ {
Pout<< "UIPstream::write : started write to:" << toProcNo Pout<< "UOPstream::write : started write to:" << toProcNo
<< " tag:" << tag << " size:" << label(bufSize) << " tag:" << tag << " size:" << label(bufSize)
<< " commsType:" << UPstream::commsTypeNames[commsType] << " commsType:" << UPstream::commsTypeNames[commsType]
<< " request:" << PstreamGlobals::outstandingRequests_.size() << " request:" << PstreamGlobals::outstandingRequests_.size()

View File

@ -21,13 +21,12 @@ $(constraintFvPatches)/symmetry/symmetryFvPatch.C
$(constraintFvPatches)/wedge/wedgeFvPatch.C $(constraintFvPatches)/wedge/wedgeFvPatch.C
$(constraintFvPatches)/cyclic/cyclicFvPatch.C $(constraintFvPatches)/cyclic/cyclicFvPatch.C
$(constraintFvPatches)/processor/processorFvPatch.C $(constraintFvPatches)/processor/processorFvPatch.C
$(constraintFvPatches)/processorCyclic/processorCyclicFvPatch.C
derivedFvPatches = $(fvPatches)/derived derivedFvPatches = $(fvPatches)/derived
$(derivedFvPatches)/wall/wallFvPatch.C $(derivedFvPatches)/wall/wallFvPatch.C
/*
$(derivedFvPatches)/directMapped/directMappedFvPatch.C $(derivedFvPatches)/directMapped/directMappedFvPatch.C
$(derivedFvPatches)/directMapped/directMappedWallFvPatch.C $(derivedFvPatches)/directMapped/directMappedWallFvPatch.C
*/
wallDist = fvMesh/wallDist wallDist = fvMesh/wallDist
$(wallDist)/wallPointYPlus/wallPointYPlus.C $(wallDist)/wallPointYPlus/wallPointYPlus.C
@ -101,6 +100,8 @@ $(constraintFvPatchFields)/empty/emptyFvPatchFields.C
$(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C $(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C
$(constraintFvPatchFields)/processor/processorFvPatchFields.C $(constraintFvPatchFields)/processor/processorFvPatchFields.C
$(constraintFvPatchFields)/processor/processorFvPatchScalarField.C $(constraintFvPatchFields)/processor/processorFvPatchScalarField.C
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchFields.C
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchScalarField.C
$(constraintFvPatchFields)/symmetry/symmetryFvPatchFields.C $(constraintFvPatchFields)/symmetry/symmetryFvPatchFields.C
$(constraintFvPatchFields)/wedge/wedgeFvPatchFields.C $(constraintFvPatchFields)/wedge/wedgeFvPatchFields.C
$(constraintFvPatchFields)/wedge/wedgeFvPatchScalarField.C $(constraintFvPatchFields)/wedge/wedgeFvPatchScalarField.C
@ -109,15 +110,12 @@ derivedFvPatchFields = $(fvPatchFields)/derived
$(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C $(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
$(derivedFvPatchFields)/advective/advectiveFvPatchFields.C $(derivedFvPatchFields)/advective/advectiveFvPatchFields.C
/*
$(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C $(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C
$(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C $(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C
$(derivedFvPatchFields)/fan/fanFvPatchFields.C $(derivedFvPatchFields)/fan/fanFvPatchFields.C
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C $(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C $(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
*/
$(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C $(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C
/*
$(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C $(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C
$(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C $(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C
$(derivedFvPatchFields)/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C $(derivedFvPatchFields)/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C
@ -156,7 +154,6 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C $(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C $(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C $(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
*/
fvsPatchFields = fields/fvsPatchFields fvsPatchFields = fields/fvsPatchFields
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C $(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
@ -171,6 +168,7 @@ constraintFvsPatchFields = $(fvsPatchFields)/constraint
$(constraintFvsPatchFields)/cyclic/cyclicFvsPatchFields.C $(constraintFvsPatchFields)/cyclic/cyclicFvsPatchFields.C
$(constraintFvsPatchFields)/empty/emptyFvsPatchFields.C $(constraintFvsPatchFields)/empty/emptyFvsPatchFields.C
$(constraintFvsPatchFields)/processor/processorFvsPatchFields.C $(constraintFvsPatchFields)/processor/processorFvsPatchFields.C
$(constraintFvsPatchFields)/processorCyclic/processorCyclicFvsPatchFields.C
$(constraintFvsPatchFields)/symmetry/symmetryFvsPatchFields.C $(constraintFvsPatchFields)/symmetry/symmetryFvsPatchFields.C
$(constraintFvsPatchFields)/wedge/wedgeFvsPatchFields.C $(constraintFvsPatchFields)/wedge/wedgeFvsPatchFields.C
@ -206,7 +204,6 @@ $(surfaceInterpolation)/surfaceInterpolationScheme/surfaceInterpolationSchemes.C
schemes = $(surfaceInterpolation)/schemes schemes = $(surfaceInterpolation)/schemes
$(schemes)/linear/linear.C $(schemes)/linear/linear.C
$(schemes)/midPoint/midPoint.C $(schemes)/midPoint/midPoint.C
/*
$(schemes)/downwind/downwind.C $(schemes)/downwind/downwind.C
$(schemes)/weighted/weighted.C $(schemes)/weighted/weighted.C
$(schemes)/cubic/cubic.C $(schemes)/cubic/cubic.C
@ -221,6 +218,7 @@ $(schemes)/localBlended/localBlended.C
$(schemes)/localMax/localMax.C $(schemes)/localMax/localMax.C
$(schemes)/localMin/localMin.C $(schemes)/localMin/localMin.C
/*
$(schemes)/linearFit/linearFit.C $(schemes)/linearFit/linearFit.C
$(schemes)/biLinearFit/biLinearFit.C $(schemes)/biLinearFit/biLinearFit.C
$(schemes)/quadraticLinearFit/quadraticLinearFit.C $(schemes)/quadraticLinearFit/quadraticLinearFit.C
@ -236,7 +234,6 @@ $(schemes)/linearPureUpwindFit/linearPureUpwindFit.C
limitedSchemes = $(surfaceInterpolation)/limitedSchemes limitedSchemes = $(surfaceInterpolation)/limitedSchemes
$(limitedSchemes)/limitedSurfaceInterpolationScheme/limitedSurfaceInterpolationSchemes.C $(limitedSchemes)/limitedSurfaceInterpolationScheme/limitedSurfaceInterpolationSchemes.C
$(limitedSchemes)/upwind/upwind.C $(limitedSchemes)/upwind/upwind.C
/*
$(limitedSchemes)/blended/blended.C $(limitedSchemes)/blended/blended.C
$(limitedSchemes)/linearUpwind/linearUpwind.C $(limitedSchemes)/linearUpwind/linearUpwind.C
$(limitedSchemes)/linearUpwind/linearUpwindV.C $(limitedSchemes)/linearUpwind/linearUpwindV.C
@ -258,7 +255,6 @@ $(limitedSchemes)/filteredLinear/filteredLinear.C
$(limitedSchemes)/filteredLinear2/filteredLinear2.C $(limitedSchemes)/filteredLinear2/filteredLinear2.C
$(limitedSchemes)/filteredLinear3/filteredLinear3.C $(limitedSchemes)/filteredLinear3/filteredLinear3.C
$(limitedSchemes)/limitWith/limitWith.C $(limitedSchemes)/limitWith/limitWith.C
*/
multivariateSchemes = $(surfaceInterpolation)/multivariateSchemes multivariateSchemes = $(surfaceInterpolation)/multivariateSchemes
$(multivariateSchemes)/multivariateSurfaceInterpolationScheme/multivariateSurfaceInterpolationSchemes.C $(multivariateSchemes)/multivariateSurfaceInterpolationScheme/multivariateSurfaceInterpolationSchemes.C
@ -340,7 +336,6 @@ general = cfdTools/general
$(general)/findRefCell/findRefCell.C $(general)/findRefCell/findRefCell.C
$(general)/adjustPhi/adjustPhi.C $(general)/adjustPhi/adjustPhi.C
$(general)/bound/bound.C $(general)/bound/bound.C
/*
porousMedia = $(general)/porousMedia porousMedia = $(general)/porousMedia
$(porousMedia)/porousZone.C $(porousMedia)/porousZone.C
$(porousMedia)/porousZones.C $(porousMedia)/porousZones.C
@ -363,6 +358,5 @@ $(fieldSources)/timeActivatedExplicitCellSource/timeActivatedExplicitCellSource.
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C $(fieldSources)/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourceProperties.C $(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourceProperties.C
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourcePropertiesIO.C $(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourcePropertiesIO.C
*/
LIB = $(FOAM_LIBBIN)/libfiniteVolume LIB = $(FOAM_LIBBIN)/libfiniteVolume

View File

@ -109,9 +109,9 @@ cyclicFvPatchField<Type>::cyclicFvPatchField
<< exit(FatalIOError); << exit(FatalIOError);
} }
Pout<< "Construct from dictionary for " << p.name() << endl // Pout<< "Construct from dictionary for " << p.name() << endl
<< "Underlying cyclic:" << cyclicPatch_.name() // << "Underlying cyclic:" << cyclicPatch_.name()
<< " with parallel:" << cyclicPatch_.parallel() << endl; // << " with parallel:" << cyclicPatch_.parallel() << endl;
this->coupledFvPatchField<Type>::evaluate(Pstream::blocking); this->coupledFvPatchField<Type>::evaluate(Pstream::blocking);
} }

View File

@ -100,7 +100,8 @@ template<class Type>
tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const
{ {
const Field<Type>& iField = this->internalField(); const Field<Type>& iField = this->internalField();
const unallocLabelList& faceCells = this->cyclicPatch().faceCells(); const unallocLabelList& nbrFaceCells =
this->cyclicPatch().neighbFvPatch().faceCells();
tmp<Field<Type> > tpnf(new Field<Type>(this->size())); tmp<Field<Type> > tpnf(new Field<Type>(this->size()));
Field<Type>& pnf = tpnf(); Field<Type>& pnf = tpnf();
@ -108,29 +109,21 @@ tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const
tmp<Field<scalar> > tjf = jump(); tmp<Field<scalar> > tjf = jump();
const Field<scalar>& jf = tjf(); const Field<scalar>& jf = tjf();
label sizeby2 = this->size()/2;
if (this->doTransform()) if (this->doTransform())
{ {
for (label facei=0; facei<sizeby2; facei++) forAll(*this, facei)
{ {
pnf[facei] = transform pnf[facei] = transform
( (
this->forwardT()[0], iField[faceCells[facei + sizeby2]] this->forwardT(), iField[nbrFaceCells[facei]]
) - jf[facei]; ) - jf[facei];
pnf[facei + sizeby2] = transform
(
this->reverseT()[0], iField[faceCells[facei]] + jf[facei]
);
} }
} }
else else
{ {
for (label facei=0; facei<sizeby2; facei++) forAll(*this, facei)
{ {
pnf[facei] = iField[faceCells[facei + sizeby2]] - jf[facei]; pnf[facei] = iField[nbrFaceCells[facei]] - jf[facei];
pnf[facei + sizeby2] = iField[faceCells[facei]] + jf[facei];
} }
} }
@ -151,26 +144,24 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
{ {
scalarField pnf(this->size()); scalarField pnf(this->size());
label sizeby2 = this->size()/2; const unallocLabelList& nbrFaceCells =
const unallocLabelList& faceCells = this->cyclicPatch().faceCells(); this->cyclicPatch().neighbFvPatch().faceCells();
if (&psiInternal == &this->internalField()) if (&psiInternal == &this->internalField())
{ {
tmp<Field<scalar> > tjf = jump(); tmp<Field<scalar> > tjf = jump();
const Field<scalar>& jf = tjf(); const Field<scalar>& jf = tjf();
for (label facei=0; facei<sizeby2; facei++) forAll(*this, facei)
{ {
pnf[facei] = psiInternal[faceCells[facei + sizeby2]] - jf[facei]; pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei];
pnf[facei + sizeby2] = psiInternal[faceCells[facei]] + jf[facei];
} }
} }
else else
{ {
for (label facei=0; facei<sizeby2; facei++) forAll(*this, facei)
{ {
pnf[facei] = psiInternal[faceCells[facei + sizeby2]]; pnf[facei] = psiInternal[nbrFaceCells[facei]];
pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
} }
} }
@ -178,6 +169,7 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
this->transformCoupleField(pnf, cmpt); this->transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result // Multiply the field by coefficients and add into the result
const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
forAll(faceCells, elemI) forAll(faceCells, elemI)
{ {
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI]; result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];

View File

@ -74,7 +74,7 @@ processorFvPatchField<Type>::processorFvPatchField
coupledFvPatchField<Type>(ptf, p, iF, mapper), coupledFvPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorFvPatch>(p)) procPatch_(refCast<const processorFvPatch>(p))
{ {
if (!isType<processorFvPatch>(this->patch())) if (!isA<processorFvPatch>(this->patch()))
{ {
FatalErrorIn FatalErrorIn
( (
@ -106,7 +106,7 @@ processorFvPatchField<Type>::processorFvPatchField
coupledFvPatchField<Type>(p, iF, dict), coupledFvPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorFvPatch>(p)) procPatch_(refCast<const processorFvPatch>(p))
{ {
if (!isType<processorFvPatch>(p)) if (!isA<processorFvPatch>(p))
{ {
FatalIOErrorIn FatalIOErrorIn
( (

View File

@ -0,0 +1,267 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorCyclicFvPatchField.H"
#include "processorCyclicFvPatch.H"
#include "demandDrivenData.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
//coupledFvPatchField<Type>(p, iF),
processorFvPatchField<Type>(p, iF),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{}
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const Field<Type>& f
)
:
//coupledFvPatchField<Type>(p, iF, f),
processorFvPatchField<Type>(p, iF, f),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{}
// Construct by mapping given processorCyclicFvPatchField<Type>
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
//coupledFvPatchField<Type>(ptf, p, iF, mapper),
processorFvPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{
if (!isType<processorCyclicFvPatch>(this->patch()))
{
FatalErrorIn
(
"processorCyclicFvPatchField<Type>::processorCyclicFvPatchField\n"
"(\n"
" const processorCyclicFvPatchField<Type>& ptf,\n"
" const fvPatch& p,\n"
" const DimensionedField<Type, volMesh>& iF,\n"
" const fvPatchFieldMapper& mapper\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
//coupledFvPatchField<Type>(p, iF, dict),
processorFvPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{
if (!isType<processorCyclicFvPatch>(p))
{
FatalIOErrorIn
(
"processorCyclicFvPatchField<Type>::processorCyclicFvPatchField\n"
"(\n"
" const fvPatch& p,\n"
" const Field<Type>& field,\n"
" const dictionary& dict\n"
")\n",
dict
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>& ptf
)
:
//processorLduInterfaceField(),
//coupledFvPatchField<Type>(ptf),
processorFvPatchField<Type>(ptf),
procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch()))
{}
template<class Type>
processorCyclicFvPatchField<Type>::processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
//coupledFvPatchField<Type>(ptf, iF),
processorFvPatchField<Type>(ptf, iF),
procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch()))
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvPatchField<Type>::~processorCyclicFvPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
//template<class Type>
//tmp<Field<Type> > processorCyclicFvPatchField<Type>::patchNeighbourField() const
//{
// return *this;
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::initEvaluate
//(
// const Pstream::commsTypes commsType
//)
//{
// if (Pstream::parRun())
// {
// procPatch_.compressedSend(commsType, this->patchInternalField()());
// }
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::evaluate
//(
// const Pstream::commsTypes commsType
//)
//{
// if (Pstream::parRun())
// {
// procPatch_.compressedReceive<Type>(commsType, *this);
//
// if (doTransform())
// {
// transform(*this, procPatch_.forwardT(), *this);
// }
// }
//}
//
//
//template<class Type>
//tmp<Field<Type> > processorCyclicFvPatchField<Type>::snGrad() const
//{
// return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::initInterfaceMatrixUpdate
//(
// const scalarField& psiInternal,
// scalarField&,
// const lduMatrix&,
// const scalarField&,
// const direction,
// const Pstream::commsTypes commsType
//) const
//{
// procPatch_.compressedSend
// (
// commsType,
// this->patch().patchInternalField(psiInternal)()
// );
//}
//
//
//template<class Type>
//void processorCyclicFvPatchField<Type>::updateInterfaceMatrix
//(
// const scalarField&,
// scalarField& result,
// const lduMatrix&,
// const scalarField& coeffs,
// const direction cmpt,
// const Pstream::commsTypes commsType
//) const
//{
// scalarField pnf
// (
// procPatch_.compressedReceive<scalar>(commsType, this->size())()
// );
//
// // Transform according to the transformation tensor
// transformCoupleField(pnf, cmpt);
//
// // Multiply the field by coefficients and add into the result
//
// const unallocLabelList& faceCells = this->patch().faceCells();
//
// forAll(faceCells, elemI)
// {
// result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
// }
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,338 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::processorCyclicFvPatchField
Description
Foam::processorCyclicFvPatchField
SourceFiles
processorCyclicFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvPatchField_H
#define processorCyclicFvPatchField_H
//#include "coupledFvPatchField.H"
//#include "processorLduInterfaceField.H"
#include "processorCyclicFvPatch.H"
#include "processorFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorCyclicFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class processorCyclicFvPatchField
:
// public processorLduInterfaceField,
// public coupledFvPatchField<Type>
public processorFvPatchField<Type>
{
// Private data
//- Local reference cast into the processor patch
const processorCyclicFvPatch& procPatch_;
// Private Member Functions
// //- Get other patchfield
// const coupledFvPatchField<Type>& patchField(const label patchID) const;
public:
//- Runtime type information
TypeName(processorCyclicFvPatch::typeName_());
// Constructors
//- Construct from patch and internal field
processorCyclicFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch and internal field and patch field
processorCyclicFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const Field<Type>&
);
//- Construct from patch, internal field and dictionary
processorCyclicFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given processorCyclicFvPatchField onto a
// new patch
processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
processorCyclicFvPatchField(const processorCyclicFvPatchField<Type>&);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new processorCyclicFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
processorCyclicFvPatchField
(
const processorCyclicFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new processorCyclicFvPatchField<Type>(*this, iF)
);
}
// Destructor
~processorCyclicFvPatchField();
// Member functions
// Access
// //- Return true if running parallel
// virtual bool coupled() const
// {
// if (Pstream::parRun())
// {
// return true;
// }
// else
// {
// return false;
// }
// }
//
// //- Return neighbour field given internal field
// tmp<Field<Type> > patchNeighbourField() const;
//
//
// // Evaluation functions
//
// //- Initialise the evaluation of the patch field
// virtual void initEvaluate(const Pstream::commsTypes commsType);
//
// //- Evaluate the patch field
// virtual void evaluate(const Pstream::commsTypes commsType);
//
// //- Return patch-normal gradient
// virtual tmp<Field<Type> > snGrad() const;
//
// //- Initialise neighbour matrix update
// virtual void initInterfaceMatrixUpdate
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix& m,
// const scalarField& coeffs,
// const direction cmpt,
// const Pstream::commsTypes commsType
// ) const;
//
// //- Update result field based on interface functionality
// virtual void updateInterfaceMatrix
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix& m,
// const scalarField& coeffs,
// const direction cmpt,
// const Pstream::commsTypes commsType
// ) const;
//
// //- Processor coupled interface functions
//
// //- Return processor number
// virtual int myProcNo() const
// {
// return procPatch_.myProcNo();
// }
//
// //- Return neigbour processor number
// virtual int neighbProcNo() const
// {
// return procPatch_.neighbProcNo();
// }
//- Does the patch field perform the transfromation
virtual bool doTransform() const
{
return !(procPatch_.parallel() || pTraits<Type>::rank == 0);
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return procPatch_.forwardT();
}
// //- Return rank of component for transform
// virtual int rank() const
// {
// return pTraits<Type>::rank;
// }
// //- Transform given patch component field
// void transformCoupleField
// (
// scalarField& f,
// const direction cmpt
// ) const;
// // Referred-patch functionality. Get called with a slice (size, start)
// // of a patch that supplies fields and geometry/topology.
//
// //- Get patch-normal gradient
// virtual void snGrad
// (
// Field<Type>& exchangeBuf,
// const Field<Type>& subFld,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start
// ) const
// {
// notImplemented("processorCyclicFvPatchField::snGrad(..)");
// }
//
// //- Initialise the evaluation of the patch field.
// virtual void initEvaluate
// (
// Field<Type>& exchangeBuf,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start
// ) const
// {
// notImplemented("processorCyclicFvPatchField::initEvaluate(..)");
// }
//
// //- Evaluate the patch field.
// virtual void evaluate
// (
// Field<Type>& exchangeBuf,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start
// ) const
// {
// notImplemented("processorCyclicFvPatchField::evaluate(..)");
// }
//
// //- Initialise neighbour matrix update
// virtual void initInterfaceMatrixUpdate
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix& m,
// const scalarField& coeffs,
// const direction cmpt,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start,
// scalarField& exchangeBuf
// ) const
// {
// notImplemented
// (
// "processorCyclicFvPatchField::initInterfaceMatrixUpdate(..)"
// );
// }
//
// //- Update result field based on interface functionality
// virtual void updateInterfaceMatrix
// (
// const scalarField& psiInternal,
// scalarField& result,
// const lduMatrix&,
// const scalarField& coeffs,
// const direction,
// const coupledFvPatch& referringPatch,
// const label size,
// const label start,
// scalarField& exchangeBuf
// ) const
// {
// notImplemented
// (
// "processorCyclicFvPatchField::updateInterfaceMatrix(..)"
// );
// }
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorCyclicFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "processorFvPatchFields.H" #include "processorCyclicFvPatchFields.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "volFields.H" #include "volFields.H"
@ -35,8 +35,8 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makePatchFields(processor); makePatchFields(processorCyclic);
//makePatchTypeField(fvPatchScalarField, processorFvPatchScalarField); //makePatchTypeField(fvPatchScalarField, processorCyclicFvPatchScalarField);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,10 +24,10 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef processorFvPatchFields_H #ifndef processorCyclicFvPatchFields_H
#define processorFvPatchFields_H #define processorCyclicFvPatchFields_H
#include "processorFvPatchScalarField.H" #include "processorCyclicFvPatchScalarField.H"
#include "fieldTypes.H" #include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -37,7 +37,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makePatchTypeFieldTypedefs(processor) makePatchTypeFieldTypedefs(processorCyclic)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,8 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef processorFvPatchFieldsFwd_H #ifndef processorCyclicFvPatchFieldsFwd_H
#define processorFvPatchFieldsFwd_H #define processorCyclicFvPatchFieldsFwd_H
#include "fieldTypes.H" #include "fieldTypes.H"
@ -36,7 +36,7 @@ namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class processorFvPatchField; template<class Type> class processorCyclicFvPatchField;
makePatchTypeFieldTypedefs(processor) makePatchTypeFieldTypedefs(processor)

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "processorFvPatchScalarField.H" #include "processorCyclicFvPatchScalarField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -33,48 +33,48 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<> //template<>
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate //void processorCyclicFvPatchField<scalar>::initInterfaceMatrixUpdate
( //(
const scalarField& psiInternal, // const scalarField& psiInternal,
scalarField&, // scalarField&,
const lduMatrix&, // const lduMatrix&,
const scalarField&, // const scalarField&,
const direction, // const direction,
const Pstream::commsTypes commsType // const Pstream::commsTypes commsType
) const //) const
{ //{
procPatch_.compressedSend // procPatch_.compressedSend
( // (
commsType, // commsType,
patch().patchInternalField(psiInternal)() // patch().patchInternalField(psiInternal)()
); // );
} //}
//
//
template<> //template<>
void processorFvPatchField<scalar>::updateInterfaceMatrix //void processorCyclicFvPatchField<scalar>::updateInterfaceMatrix
( //(
const scalarField&, // const scalarField&,
scalarField& result, // scalarField& result,
const lduMatrix&, // const lduMatrix&,
const scalarField& coeffs, // const scalarField& coeffs,
const direction, // const direction,
const Pstream::commsTypes commsType // const Pstream::commsTypes commsType
) const //) const
{ //{
scalarField pnf // scalarField pnf
( // (
procPatch_.compressedReceive<scalar>(commsType, this->size())() // procPatch_.compressedReceive<scalar>(commsType, this->size())()
); // );
//
const unallocLabelList& faceCells = patch().faceCells(); // const unallocLabelList& faceCells = patch().faceCells();
//
forAll(faceCells, facei) // forAll(faceCells, facei)
{ // {
result[faceCells[facei]] -= coeffs[facei]*pnf[facei]; // result[faceCells[facei]] -= coeffs[facei]*pnf[facei];
} // }
} //}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,10 +24,10 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef processorFvPatchScalarField_H #ifndef processorCyclicFvPatchScalarField_H
#define processorFvPatchScalarField_H #define processorCyclicFvPatchScalarField_H
#include "processorFvPatchField.H" #include "processorCyclicFvPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -36,28 +36,28 @@ namespace Foam
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<> //template<>
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate //void processorCyclicFvPatchField<scalar>::initInterfaceMatrixUpdate
( //(
const scalarField&, // const scalarField&,
scalarField&, // scalarField&,
const lduMatrix&, // const lduMatrix&,
const scalarField&, // const scalarField&,
const direction, // const direction,
const Pstream::commsTypes commsType // const Pstream::commsTypes commsType
) const; //) const;
//
//
template<> //template<>
void processorFvPatchField<scalar>::updateInterfaceMatrix //void processorCyclicFvPatchField<scalar>::updateInterfaceMatrix
( //(
const scalarField&, // const scalarField&,
scalarField& result, // scalarField& result,
const lduMatrix&, // const lduMatrix&,
const scalarField& coeffs, // const scalarField& coeffs,
const direction, // const direction,
const Pstream::commsTypes commsType // const Pstream::commsTypes commsType
) const; //) const;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,261 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorFvPatchField.H"
#include "processorFvPatch.H"
#include "demandDrivenData.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF
)
:
coupledFvPatchField<Type>(p, iF),
procPatch_(refCast<const processorFvPatch>(p))
{}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const Field<Type>& f
)
:
coupledFvPatchField<Type>(p, iF, f),
procPatch_(refCast<const processorFvPatch>(p))
{}
// Construct by mapping given processorFvPatchField<Type>
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
coupledFvPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorFvPatch>(p))
{
if (!isType<processorFvPatch>(this->patch()))
{
FatalErrorIn
(
"processorFvPatchField<Type>::processorFvPatchField\n"
"(\n"
" const processorFvPatchField<Type>& ptf,\n"
" const fvPatch& p,\n"
" const DimensionedField<Type, volMesh>& iF,\n"
" const fvPatchFieldMapper& mapper\n"
")\n"
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const fvPatch& p,
const DimensionedField<Type, volMesh>& iF,
const dictionary& dict
)
:
coupledFvPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorFvPatch>(p))
{
if (!isType<processorFvPatch>(p))
{
FatalIOErrorIn
(
"processorFvPatchField<Type>::processorFvPatchField\n"
"(\n"
" const fvPatch& p,\n"
" const Field<Type>& field,\n"
" const dictionary& dict\n"
")\n",
dict
) << "\n patch type '" << p.type()
<< "' not constraint type '" << typeName << "'"
<< "\n for patch " << p.name()
<< " of field " << this->dimensionedInternalField().name()
<< " in file " << this->dimensionedInternalField().objectPath()
<< exit(FatalIOError);
}
}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf
)
:
processorLduInterfaceField(),
coupledFvPatchField<Type>(ptf),
procPatch_(refCast<const processorFvPatch>(ptf.patch()))
{}
template<class Type>
processorFvPatchField<Type>::processorFvPatchField
(
const processorFvPatchField<Type>& ptf,
const DimensionedField<Type, volMesh>& iF
)
:
coupledFvPatchField<Type>(ptf, iF),
procPatch_(refCast<const processorFvPatch>(ptf.patch()))
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorFvPatchField<Type>::~processorFvPatchField()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type>
tmp<Field<Type> > processorFvPatchField<Type>::patchNeighbourField() const
{
return *this;
}
template<class Type>
void processorFvPatchField<Type>::initEvaluate
(
const Pstream::commsTypes commsType
)
{
if (Pstream::parRun())
{
procPatch_.compressedSend(commsType, this->patchInternalField()());
}
}
template<class Type>
void processorFvPatchField<Type>::evaluate
(
const Pstream::commsTypes commsType
)
{
if (Pstream::parRun())
{
procPatch_.compressedReceive<Type>(commsType, *this);
if (doTransform())
{
transform(*this, procPatch_.forwardT(), *this);
}
}
}
template<class Type>
tmp<Field<Type> > processorFvPatchField<Type>::snGrad() const
{
return this->patch().deltaCoeffs()*(*this - this->patchInternalField());
}
template<class Type>
void processorFvPatchField<Type>::initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField&,
const lduMatrix&,
const scalarField&,
const direction,
const Pstream::commsTypes commsType
) const
{
procPatch_.compressedSend
(
commsType,
this->patch().patchInternalField(psiInternal)()
);
}
template<class Type>
void processorFvPatchField<Type>::updateInterfaceMatrix
(
const scalarField&,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const
{
scalarField pnf
(
procPatch_.compressedReceive<scalar>(commsType, this->size())()
);
// Transform according to the transformation tensor
transformCoupleField(pnf, cmpt);
// Multiply the field by coefficients and add into the result
const unallocLabelList& faceCells = this->patch().faceCells();
forAll(faceCells, elemI)
{
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,323 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::processorFvPatchField
Description
Foam::processorFvPatchField
SourceFiles
processorFvPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef processorFvPatchField_H
#define processorFvPatchField_H
#include "coupledFvPatchField.H"
#include "processorLduInterfaceField.H"
#include "processorFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorFvPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class processorFvPatchField
:
public processorLduInterfaceField,
public coupledFvPatchField<Type>
{
// Private data
//- Local reference cast into the processor patch
const processorFvPatch& procPatch_;
// Private Member Functions
//- Get other patchfield
const coupledFvPatchField<Type>& patchField(const label patchID) const;
public:
//- Runtime type information
TypeName(processorFvPatch::typeName_());
// Constructors
//- Construct from patch and internal field
processorFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&
);
//- Construct from patch and internal field and patch field
processorFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const Field<Type>&
);
//- Construct from patch, internal field and dictionary
processorFvPatchField
(
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const dictionary&
);
//- Construct by mapping given processorFvPatchField onto a new patch
processorFvPatchField
(
const processorFvPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, volMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
processorFvPatchField(const processorFvPatchField<Type>&);
//- Construct and return a clone
virtual tmp<fvPatchField<Type> > clone() const
{
return tmp<fvPatchField<Type> >
(
new processorFvPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
processorFvPatchField
(
const processorFvPatchField<Type>&,
const DimensionedField<Type, volMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvPatchField<Type> > clone
(
const DimensionedField<Type, volMesh>& iF
) const
{
return tmp<fvPatchField<Type> >
(
new processorFvPatchField<Type>(*this, iF)
);
}
// Destructor
~processorFvPatchField();
// Member functions
// Access
//- Return true if running parallel
virtual bool coupled() const
{
if (Pstream::parRun())
{
return true;
}
else
{
return false;
}
}
//- Return neighbour field given internal field
tmp<Field<Type> > patchNeighbourField() const;
// Evaluation functions
//- Initialise the evaluation of the patch field
virtual void initEvaluate(const Pstream::commsTypes commsType);
//- Evaluate the patch field
virtual void evaluate(const Pstream::commsTypes commsType);
//- Return patch-normal gradient
virtual tmp<Field<Type> > snGrad() const;
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const Pstream::commsTypes commsType
) const;
//- Processor coupled interface functions
//- Return processor number
virtual int myProcNo() const
{
return procPatch_.myProcNo();
}
//- Return neigbour processor number
virtual int neighbProcNo() const
{
return procPatch_.neighbProcNo();
}
//- Return rank of component for transform
virtual int rank() const
{
return pTraits<Type>::rank;
}
// //- Transform given patch component field
// void transformCoupleField
// (
// scalarField& f,
// const direction cmpt
// ) const;
// Referred-patch functionality. Get called with a slice (size, start)
// of a patch that supplies fields and geometry/topology.
//- Get patch-normal gradient
virtual void snGrad
(
Field<Type>& exchangeBuf,
const Field<Type>& subFld,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::snGrad(..)");
}
//- Initialise the evaluation of the patch field.
virtual void initEvaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::initEvaluate(..)");
}
//- Evaluate the patch field.
virtual void evaluate
(
Field<Type>& exchangeBuf,
const coupledFvPatch& referringPatch,
const label size,
const label start
) const
{
notImplemented("processorFvPatchField::evaluate(..)");
}
//- Initialise neighbour matrix update
virtual void initInterfaceMatrixUpdate
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix& m,
const scalarField& coeffs,
const direction cmpt,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
notImplemented
(
"processorFvPatchField::initInterfaceMatrixUpdate(..)"
);
}
//- Update result field based on interface functionality
virtual void updateInterfaceMatrix
(
const scalarField& psiInternal,
scalarField& result,
const lduMatrix&,
const scalarField& coeffs,
const direction,
const coupledFvPatch& referringPatch,
const label size,
const label start,
scalarField& exchangeBuf
) const
{
notImplemented
(
"processorFvPatchField::updateInterfaceMatrix(..)"
);
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorFvPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -28,6 +28,7 @@ License
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
#include "volFields.H" #include "volFields.H"
#include "surfaceFields.H" #include "surfaceFields.H"
#include "cyclicFvPatch.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
@ -45,6 +46,7 @@ activeBaffleVelocityFvPatchVectorField
orientation_(1), orientation_(1),
initWallSf_(0), initWallSf_(0),
initCyclicSf_(0), initCyclicSf_(0),
nbrCyclicSf_(0),
openFraction_(0), openFraction_(0),
openingTime_(0), openingTime_(0),
maxOpenFractionDelta_(0), maxOpenFractionDelta_(0),
@ -68,6 +70,7 @@ activeBaffleVelocityFvPatchVectorField
orientation_(ptf.orientation_), orientation_(ptf.orientation_),
initWallSf_(ptf.initWallSf_), initWallSf_(ptf.initWallSf_),
initCyclicSf_(ptf.initCyclicSf_), initCyclicSf_(ptf.initCyclicSf_),
nbrCyclicSf_(ptf.nbrCyclicSf_),
openFraction_(ptf.openFraction_), openFraction_(ptf.openFraction_),
openingTime_(ptf.openingTime_), openingTime_(ptf.openingTime_),
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_), maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
@ -84,23 +87,25 @@ activeBaffleVelocityFvPatchVectorField
) )
: :
fixedValueFvPatchVectorField(p, iF), fixedValueFvPatchVectorField(p, iF),
pName_("p"), pName_(dict.lookupOrDefault<word>("p", "p")),
cyclicPatchName_(dict.lookup("cyclicPatch")), cyclicPatchName_(dict.lookup("cyclicPatch")),
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)), cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),
orientation_(readLabel(dict.lookup("orientation"))), orientation_(readLabel(dict.lookup("orientation"))),
initWallSf_(p.Sf()), initWallSf_(p.Sf()),
initCyclicSf_(p.boundaryMesh()[cyclicPatchLabel_].Sf()), initCyclicSf_(p.boundaryMesh()[cyclicPatchLabel_].Sf()),
nbrCyclicSf_
(
refCast<const cyclicFvPatch>
(
p.boundaryMesh()[cyclicPatchLabel_]
).neighbFvPatch().Sf()
),
openFraction_(readScalar(dict.lookup("openFraction"))), openFraction_(readScalar(dict.lookup("openFraction"))),
openingTime_(readScalar(dict.lookup("openingTime"))), openingTime_(readScalar(dict.lookup("openingTime"))),
maxOpenFractionDelta_(readScalar(dict.lookup("maxOpenFractionDelta"))), maxOpenFractionDelta_(readScalar(dict.lookup("maxOpenFractionDelta"))),
curTimeIndex_(-1) curTimeIndex_(-1)
{ {
fvPatchVectorField::operator=(vector::zero); fvPatchVectorField::operator=(vector::zero);
if (dict.found("p"))
{
dict.lookup("p") >> pName_;
}
} }
@ -117,6 +122,7 @@ activeBaffleVelocityFvPatchVectorField
orientation_(ptf.orientation_), orientation_(ptf.orientation_),
initWallSf_(ptf.initWallSf_), initWallSf_(ptf.initWallSf_),
initCyclicSf_(ptf.initCyclicSf_), initCyclicSf_(ptf.initCyclicSf_),
nbrCyclicSf_(ptf.nbrCyclicSf_),
openFraction_(ptf.openFraction_), openFraction_(ptf.openFraction_),
openingTime_(ptf.openingTime_), openingTime_(ptf.openingTime_),
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_), maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
@ -138,6 +144,7 @@ activeBaffleVelocityFvPatchVectorField
orientation_(ptf.orientation_), orientation_(ptf.orientation_),
initWallSf_(ptf.initWallSf_), initWallSf_(ptf.initWallSf_),
initCyclicSf_(ptf.initCyclicSf_), initCyclicSf_(ptf.initCyclicSf_),
nbrCyclicSf_(ptf.nbrCyclicSf_),
openFraction_(ptf.openFraction_), openFraction_(ptf.openFraction_),
openingTime_(ptf.openingTime_), openingTime_(ptf.openingTime_),
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_), maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
@ -166,6 +173,13 @@ void Foam::activeBaffleVelocityFvPatchVectorField::autoMap
[ [
cyclicPatchLabel_ cyclicPatchLabel_
].patchSlice(areas); ].patchSlice(areas);
nbrCyclicSf_ = refCast<const cyclicFvPatch>
(
patch().boundaryMesh()
[
cyclicPatchLabel_
]
).neighbFvPatch().patch().patchSlice(areas);
} }
void Foam::activeBaffleVelocityFvPatchVectorField::rmap void Foam::activeBaffleVelocityFvPatchVectorField::rmap
@ -183,6 +197,13 @@ void Foam::activeBaffleVelocityFvPatchVectorField::rmap
[ [
cyclicPatchLabel_ cyclicPatchLabel_
].patchSlice(areas); ].patchSlice(areas);
nbrCyclicSf_ = refCast<const cyclicFvPatch>
(
patch().boundaryMesh()
[
cyclicPatchLabel_
]
).neighbFvPatch().patch().patchSlice(areas);
} }
@ -203,31 +224,42 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_]; const fvPatch& cyclicPatch = patch().boundaryMesh()[cyclicPatchLabel_];
const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells(); const labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
label nCyclicFaces = cyclicFaceCells.size(); const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
label nCyclicFacesPerSide = nCyclicFaces/2; (
cyclicPatch
).neighbFvPatch();
const labelList& nbrFaceCells = nbrPatch.patch().faceCells();
scalar forceDiff = 0; scalar forceDiff = 0;
for (label facei=0; facei<nCyclicFacesPerSide; facei++) // Add this side
forAll(cyclicFaceCells, facei)
{ {
forceDiff += p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]); forceDiff += p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]);
} }
for (label facei=nCyclicFacesPerSide; facei<nCyclicFaces; facei++) // Remove other side
forAll(nbrFaceCells, facei)
{ {
forceDiff -= p[cyclicFaceCells[facei]]*mag(initCyclicSf_[facei]); forceDiff -= p[nbrFaceCells[facei]]*mag(nbrCyclicSf_[facei]);
} }
openFraction_ = openFraction_ =
max(min( max
openFraction_ (
+ max min
( (
this->db().time().deltaTValue()/openingTime_, openFraction_
maxOpenFractionDelta_ + max
) (
*(orientation_*sign(forceDiff)), this->db().time().deltaTValue()/openingTime_,
1 - 1e-6), 1e-6); maxOpenFractionDelta_
)
*(orientation_*sign(forceDiff)),
1 - 1e-6
),
1e-6
);
Info<< "openFraction = " << openFraction_ << endl; Info<< "openFraction = " << openFraction_ << endl;
@ -239,10 +271,16 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
} }
const_cast<scalarField&>(patch().magSf()) = mag(patch().Sf()); const_cast<scalarField&>(patch().magSf()) = mag(patch().Sf());
// Update owner side of cyclic
const_cast<vectorField&>(cyclicPatch.Sf()) = const_cast<vectorField&>(cyclicPatch.Sf()) =
openFraction_*initCyclicSf_; openFraction_*initCyclicSf_;
const_cast<scalarField&>(cyclicPatch.magSf()) = const_cast<scalarField&>(cyclicPatch.magSf()) =
mag(cyclicPatch.Sf()); mag(cyclicPatch.Sf());
// Update neighbour side of cyclic
const_cast<vectorField&>(nbrPatch.Sf()) =
openFraction_*nbrCyclicSf_;
const_cast<scalarField&>(nbrPatch.magSf()) =
mag(nbrPatch.Sf());
curTimeIndex_ = this->db().time().timeIndex(); curTimeIndex_ = this->db().time().timeIndex();
} }
@ -264,8 +302,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::write(Ostream& os) const
<< maxOpenFractionDelta_ << token::END_STATEMENT << nl; << maxOpenFractionDelta_ << token::END_STATEMENT << nl;
os.writeKeyword("openFraction") os.writeKeyword("openFraction")
<< openFraction_ << token::END_STATEMENT << nl; << openFraction_ << token::END_STATEMENT << nl;
os.writeKeyword("p") writeEntryIfDifferent<word>(os, "p", "p", pName_);
<< pName_ << token::END_STATEMENT << nl;
writeEntry("value", os); writeEntry("value", os);
} }

View File

@ -72,9 +72,12 @@ class activeBaffleVelocityFvPatchVectorField
//- Initial wall patch areas //- Initial wall patch areas
vectorField initWallSf_; vectorField initWallSf_;
//- Initial cyclic patch areas //- Initial this-side cyclic patch areas
vectorField initCyclicSf_; vectorField initCyclicSf_;
//- Initial neighbour-side cyclic patch areas
vectorField nbrCyclicSf_;
//- Current fraction of the active baffle which is open //- Current fraction of the active baffle which is open
scalar openFraction_; scalar openFraction_;

View File

@ -43,7 +43,7 @@ fanFvPatchField<Type>::fanFvPatchField
: :
jumpCyclicFvPatchField<Type>(p, iF), jumpCyclicFvPatchField<Type>(p, iF),
f_(0), f_(0),
jump_(this->size()/2, 0.0) jump_(this->size(), 0.0)
{} {}
@ -72,12 +72,14 @@ fanFvPatchField<Type>::fanFvPatchField
: :
jumpCyclicFvPatchField<Type>(p, iF), jumpCyclicFvPatchField<Type>(p, iF),
f_(), f_(),
jump_(this->size()/2, 0.0) jump_(this->size(), 0.0)
{ {
{ {
Istream& is = dict.lookup("f"); Istream& is = dict.lookup("f");
is.format(IOstream::ASCII); is.format(IOstream::ASCII);
is >> f_; is >> f_;
// Check that f_ table is same on both sides.?
} }
if (dict.found("value")) if (dict.found("value"))
@ -129,21 +131,7 @@ void fanFvPatchField<Type>::autoMap
) )
{ {
jumpCyclicFvPatchField<Type>::autoMap(m); jumpCyclicFvPatchField<Type>::autoMap(m);
jump_.autoMap(m);
// Jump is half size. Expand to full size, map and truncate.
if (jump_.size() && jump_.size() == this->size()/2)
{
label oldSize = jump_.size();
jump_.setSize(this->size());
for (label i = oldSize; i < jump_.size(); i++)
{
jump_[i] = jump_[i-oldSize];
}
jump_.autoMap(m);
jump_.setSize(oldSize);
}
} }
@ -156,24 +144,9 @@ void fanFvPatchField<Type>::rmap
{ {
jumpCyclicFvPatchField<Type>::rmap(ptf, addr); jumpCyclicFvPatchField<Type>::rmap(ptf, addr);
// Jump is half size. Expand to full size, map and truncate. const fanFvPatchField<Type>& tiptf =
if (jump_.size() && jump_.size() == this->size()/2) refCast<const fanFvPatchField<Type> >(ptf);
{ jump_.rmap(tiptf.jump_, addr);
label oldSize = jump_.size();
jump_.setSize(this->size());
for (label i = oldSize; i < jump_.size(); i++)
{
jump_[i] = jump_[i-oldSize];
}
const fanFvPatchField<Type>& tiptf =
refCast<const fanFvPatchField<Type> >(ptf);
jump_.rmap(tiptf.jump_, addr);
jump_.setSize(oldSize);
}
} }

View File

@ -132,7 +132,13 @@ public:
// Access // Access
//- Return the "jump" across the patch as a "half" field //- Return the polynomial coefficients
const List<scalar>& f() const
{
return f_;
}
//- Return the "jump" across the patch.
virtual tmp<Field<Type> > jump() const virtual tmp<Field<Type> > jump() const
{ {
return jump_; return jump_;

View File

@ -47,6 +47,7 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
return; return;
} }
// Constant
jump_ = f_[0]; jump_ = f_[0];
if (f_.size() > 1) if (f_.size() > 1)
@ -57,21 +58,11 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
const fvsPatchField<scalar>& phip = const fvsPatchField<scalar>& phip =
patch().patchField<surfaceScalarField, scalar>(phi); patch().patchField<surfaceScalarField, scalar>(phi);
scalarField Un = max scalarField Un = max(phip/patch().magSf(), scalar(0));
(
scalarField::subField(phip, size()/2)
/scalarField::subField(patch().magSf(), size()/2),
scalar(0)
);
if (phi.dimensions() == dimDensity*dimVelocity*dimArea) if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
{ {
Un /= Un /= patch().lookupPatchField<volScalarField, scalar>("rho");
scalarField::subField
(
patch().lookupPatchField<volScalarField, scalar>("rho"),
size()/2
);
} }
for (label i=1; i<f_.size(); i++) for (label i=1; i<f_.size(); i++)

View File

@ -0,0 +1,157 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorCyclicFvsPatchField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF
)
:
coupledFvsPatchField<Type>(p, iF),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{}
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF,
const Field<Type>& f
)
:
coupledFvsPatchField<Type>(p, iF, f),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{}
// Construct by mapping given processorCyclicFvsPatchField<Type>
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>& ptf,
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF,
const fvPatchFieldMapper& mapper
)
:
coupledFvsPatchField<Type>(ptf, p, iF, mapper),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{
if (!isType<processorCyclicFvPatch>(this->patch()))
{
FatalErrorIn
(
"processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField\n"
"(\n"
" const processorCyclicFvsPatchField<Type>& ptf,\n"
" const fvPatch& p,\n"
" const DimensionedField<Type, surfaceMesh>& iF,\n"
" const fvPatchFieldMapper& mapper\n"
")\n"
) << "Field type does not correspond to patch type for patch "
<< this->patch().index() << "." << endl
<< "Field type: " << typeName << endl
<< "Patch type: " << this->patch().type()
<< exit(FatalError);
}
}
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const fvPatch& p,
const DimensionedField<Type, surfaceMesh>& iF,
const dictionary& dict
)
:
coupledFvsPatchField<Type>(p, iF, dict),
procPatch_(refCast<const processorCyclicFvPatch>(p))
{
if (!isType<processorCyclicFvPatch>(p))
{
FatalIOErrorIn
(
"processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField\n"
"(\n"
" const fvPatch& p,\n"
" const Field<Type>& field,\n"
" const dictionary& dict\n"
")\n",
dict
) << "patch " << this->patch().index() << " not processor type. "
<< "Patch type = " << p.type()
<< exit(FatalIOError);
}
}
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>& ptf
)
:
coupledFvsPatchField<Type>(ptf),
procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch()))
{}
template<class Type>
processorCyclicFvsPatchField<Type>::processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>& ptf,
const DimensionedField<Type, surfaceMesh>& iF
)
:
coupledFvsPatchField<Type>(ptf, iF),
procPatch_(refCast<const processorCyclicFvPatch>(ptf.patch()))
{}
// * * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * //
template<class Type>
processorCyclicFvsPatchField<Type>::~processorCyclicFvsPatchField()
{}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,173 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::processorCyclicFvsPatchField
Description
Foam::processorCyclicFvsPatchField
SourceFiles
processorCyclicFvsPatchField.C
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvsPatchField_H
#define processorCyclicFvsPatchField_H
#include "coupledFvsPatchField.H"
#include "processorCyclicFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorCyclicFvsPatch Declaration
\*---------------------------------------------------------------------------*/
template<class Type>
class processorCyclicFvsPatchField
:
public coupledFvsPatchField<Type>
{
// Private data
//- Local reference cast into the processor patch
const processorCyclicFvPatch& procPatch_;
public:
//- Runtime type information
TypeName(processorCyclicFvPatch::typeName_());
// Constructors
//- Construct from patch and internal field
processorCyclicFvsPatchField
(
const fvPatch&,
const DimensionedField<Type, surfaceMesh>&
);
//- Construct from patch and internal field and patch field
processorCyclicFvsPatchField
(
const fvPatch&,
const DimensionedField<Type, surfaceMesh>&,
const Field<Type>&
);
//- Construct from patch, internal field and dictionary
processorCyclicFvsPatchField
(
const fvPatch&,
const DimensionedField<Type, surfaceMesh>&,
const dictionary&
);
//- Construct by mapping given processorCyclicFvsPatchField onto a
// new patch
processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>&,
const fvPatch&,
const DimensionedField<Type, surfaceMesh>&,
const fvPatchFieldMapper&
);
//- Construct as copy
processorCyclicFvsPatchField(const processorCyclicFvsPatchField<Type>&);
//- Construct and return a clone
virtual tmp<fvsPatchField<Type> > clone() const
{
return tmp<fvsPatchField<Type> >
(
new processorCyclicFvsPatchField<Type>(*this)
);
}
//- Construct as copy setting internal field reference
processorCyclicFvsPatchField
(
const processorCyclicFvsPatchField<Type>&,
const DimensionedField<Type, surfaceMesh>&
);
//- Construct and return a clone setting internal field reference
virtual tmp<fvsPatchField<Type> > clone
(
const DimensionedField<Type, surfaceMesh>& iF
) const
{
return tmp<fvsPatchField<Type> >
(
new processorCyclicFvsPatchField<Type>(*this, iF)
);
}
// Destructor
~processorCyclicFvsPatchField();
// Member functions
// Access
//- Return true if running parallel
virtual bool coupled() const
{
if (Pstream::parRun())
{
return true;
}
else
{
return false;
}
}
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository
# include "processorCyclicFvsPatchField.C"
#endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorCyclicFvsPatchFields.H"
#include "fvsPatchFields.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeFvsPatchFields(processorCyclic);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvsPatchFields_H
#define processorCyclicFvsPatchFields_H
#include "processorCyclicFvsPatchField.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
makeFvsPatchTypeFieldTypedefs(processorCyclic)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,51 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvsPatchFieldsFwd_H
#define processorCyclicFvsPatchFieldsFwd_H
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
template<class Type> class processorCyclicFvsPatchField;
makeFvsPatchTypeFieldTypedefs(processor)
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -103,6 +103,8 @@ void Foam::fvMeshSubset::doCoupledPatches
if (syncPar && Pstream::parRun()) if (syncPar && Pstream::parRun())
{ {
PstreamBuffers pBufs(Pstream::nonBlocking);
// Send face usage across processor patches // Send face usage across processor patches
forAll (oldPatches, oldPatchI) forAll (oldPatches, oldPatchI)
{ {
@ -113,17 +115,14 @@ void Foam::fvMeshSubset::doCoupledPatches
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp); refCast<const processorPolyPatch>(pp);
OPstream toNeighbour UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
(
Pstream::blocking,
procPatch.neighbProcNo()
);
toNeighbour toNeighbour
<< SubList<label>(nCellsUsingFace, pp.size(), pp.start()); << SubList<label>(nCellsUsingFace, pp.size(), pp.start());
} }
} }
pBufs.finishedSends();
// Receive face usage count and check for faces that become uncoupled. // Receive face usage count and check for faces that become uncoupled.
forAll (oldPatches, oldPatchI) forAll (oldPatches, oldPatchI)
@ -135,11 +134,7 @@ void Foam::fvMeshSubset::doCoupledPatches
const processorPolyPatch& procPatch = const processorPolyPatch& procPatch =
refCast<const processorPolyPatch>(pp); refCast<const processorPolyPatch>(pp);
IPstream fromNeighbour UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
(
Pstream::blocking,
procPatch.neighbProcNo()
);
labelList nbrCellsUsingFace(fromNeighbour); labelList nbrCellsUsingFace(fromNeighbour);

View File

@ -100,6 +100,12 @@ public:
return procPolyPatch_.neighbProcNo(); return procPolyPatch_.neighbProcNo();
} }
//- Return message tag used for sending
virtual int tag() const
{
return UPstream::msgType();
}
//- Return true if running parallel //- Return true if running parallel
virtual bool coupled() const virtual bool coupled() const
{ {

View File

@ -0,0 +1,170 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "processorCyclicFvPatch.H"
#include "addToRunTimeSelectionTable.H"
#include "transformField.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
defineTypeNameAndDebug(processorCyclicFvPatch, 0);
addToRunTimeSelectionTable(fvPatch, processorCyclicFvPatch, polyPatch);
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
//void processorCyclicFvPatch::makeWeights(scalarField& w) const
//{
// if (Pstream::parRun())
// {
// // The face normals point in the opposite direction on the other side
// scalarField neighbFaceCentresCn
// (
// (
// procPolyPatch_.neighbFaceAreas()
// /(mag(procPolyPatch_.neighbFaceAreas()) + VSMALL)
// )
// & (
// procPolyPatch_.neighbFaceCentres()
// - procPolyPatch_.neighbFaceCellCentres())
// );
//
// w = neighbFaceCentresCn/((nf()&fvPatch::delta()) + neighbFaceCentresCn);
// }
// else
// {
// w = 1.0;
// }
//}
//
//
//void processorCyclicFvPatch::makeDeltaCoeffs(scalarField& dc) const
//{
// if (Pstream::parRun())
// {
// dc = (1.0 - weights())/(nf() & fvPatch::delta());
// }
// else
// {
// dc = 1.0/(nf() & fvPatch::delta());
// }
//}
//
//
//tmp<vectorField> processorCyclicFvPatch::delta() const
//{
// if (Pstream::parRun())
// {
// // To the transformation if necessary
// if (parallel())
// {
// return
// fvPatch::delta()
// - (
// procPolyPatch_.neighbFaceCentres()
// - procPolyPatch_.neighbFaceCellCentres()
// );
// }
// else
// {
// return
// fvPatch::delta()
// - transform
// (
// forwardT(),
// (
// procPolyPatch_.neighbFaceCentres()
// - procPolyPatch_.neighbFaceCellCentres()
// )
// );
// }
// }
// else
// {
// return fvPatch::delta();
// }
//}
//
//
//tmp<labelField> processorCyclicFvPatch::interfaceInternalField
//(
// const unallocLabelList& internalData
//) const
//{
// return patchInternalField(internalData);
//}
// void processorCyclicFvPatch::initTransfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& interfaceData
// ) const
// {
// send(commsType, interfaceData);
// }
//
//
// tmp<labelField> processorCyclicFvPatch::transfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList&
// ) const
// {
// return receive<label>(commsType, this->size());
// }
//void processorCyclicFvPatch::initInternalFieldTransfer
//(
// const Pstream::commsTypes commsType,
// const unallocLabelList& iF
//) const
//{
// send(commsType, patchInternalField(iF)());
//}
//
//
//tmp<labelField> processorCyclicFvPatch::internalFieldTransfer
//(
// const Pstream::commsTypes commsType,
// const unallocLabelList&
//) const
//{
// return receive<label>(commsType, this->size());
//}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,214 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::processorCyclicFvPatch
Description
Processor patch.
SourceFiles
processorCyclicFvPatch.C
\*---------------------------------------------------------------------------*/
#ifndef processorCyclicFvPatch_H
#define processorCyclicFvPatch_H
//#include "coupledFvPatch.H"
//#include "processorLduInterface.H"
#include "processorCyclicPolyPatch.H"
#include "processorFvPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class processorCyclicFvPatch Declaration
\*---------------------------------------------------------------------------*/
class processorCyclicFvPatch
:
// public coupledFvPatch,
// public processorLduInterface
public processorFvPatch
{
// Private Data
const processorCyclicPolyPatch& procPolyPatch_;
//protected:
//
// // Protected Member functions
//
// //- Make patch weighting factors
// void makeWeights(scalarField&) const;
//
// //- Make patch face - neighbour cell distances
// void makeDeltaCoeffs(scalarField&) const;
public:
//- Runtime type information
TypeName(processorCyclicPolyPatch::typeName_());
// Constructors
//- Construct from components
processorCyclicFvPatch(const polyPatch& patch, const fvBoundaryMesh& bm)
:
// coupledFvPatch(patch, bm),
processorFvPatch(patch, bm),
procPolyPatch_(refCast<const processorCyclicPolyPatch>(patch))
{}
// Member functions
// //- Return processor number
// int myProcNo() const
// {
// return procPolyPatch_.myProcNo();
// }
//
// //- Return neigbour processor number
// int neighbProcNo() const
// {
// return procPolyPatch_.neighbProcNo();
// }
//
// //- Return true if running parallel
// virtual bool coupled() const
// {
// if (Pstream::parRun())
// {
// return true;
// }
// else
// {
// return false;
// }
// }
//- Return message tag used for sending
virtual int tag() const
{
// Allocate from Pstream?
return procPolyPatch_.tag();
}
const processorCyclicPolyPatch& procPolyPatch() const
{
return procPolyPatch_;
}
// //- Are the planes separated.
// virtual bool separated() const
// {
// return procPolyPatch_.separated();
// }
//
// //- If the planes are separated the separation vector.
// virtual const vector& separation() const
// {
// return procPolyPatch_.separation();
// }
//
//- Are the cyclic planes parallel
virtual bool parallel() const
{
return procPolyPatch_.parallel();
}
//- Return face transformation tensor
virtual const tensor& forwardT() const
{
return procPolyPatch_.forwardT();
}
//- Return neighbour-cell transformation tensor
virtual const tensor& reverseT() const
{
return procPolyPatch_.reverseT();
}
//
//
// //- Return delta (P to N) vectors across coupled patch
// virtual tmp<vectorField> delta() const;
// Interface transfer functions
// //- Return the values of the given internal data adjacent to
// // the interface as a field
// virtual tmp<labelField> interfaceInternalField
// (
// const unallocLabelList& internalData
// ) const;
// //- Initialise interface data transfer
// virtual void initTransfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& interfaceData
// ) const;
//
// //- Transfer and return neighbour field
// virtual tmp<labelField> transfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& interfaceData
// ) const;
// //- Initialise neighbour field transfer
// virtual void initInternalFieldTransfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& internalData
// ) const;
//
// //- Return neighbour field
// virtual tmp<labelField> internalFieldTransfer
// (
// const Pstream::commsTypes commsType,
// const unallocLabelList& internalData
// ) const;
};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -322,36 +322,18 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
forAll(patches, patchI) forAll(patches, patchI)
{ {
if (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI])) if
(
patches[patchI].coupled()
&& refCast<const coupledPolyPatch>(patches[patchI]).owner()
)
{ {
const processorPolyPatch& pp = const coupledPolyPatch& pp =
refCast<const processorPolyPatch>(patches[patchI]); refCast<const coupledPolyPatch>(patches[patchI]);
if (pp.myProcNo() < pp.neighbProcNo())
{
const vectorField::subField faceCentres = pp.faceCentres();
forAll(pp, i)
{
const face& f = pp[i];
const point& fc = faceCentres[i];
forAll(f, fp)
{
globalSum[f[fp]] += fc;
globalNum[f[fp]]++;
}
}
}
}
else if (isA<cyclicPolyPatch>(patches[patchI]))
{
const cyclicPolyPatch& pp =
refCast<const cyclicPolyPatch>(patches[patchI]);
const vectorField::subField faceCentres = pp.faceCentres(); const vectorField::subField faceCentres = pp.faceCentres();
for (label i = 0; i < pp.size()/2; i++) forAll(pp, i)
{ {
const face& f = pp[i]; const face& f = pp[i];
const point& fc = faceCentres[i]; const point& fc = faceCentres[i];

View File

@ -91,20 +91,6 @@ bool Foam::blockMesh::readPatches
>> patchTypes[nPatches] >> patchTypes[nPatches]
>> patchNames[nPatches]; >> patchNames[nPatches];
// Read optional neighbour patch name
if (patchTypes[nPatches] == cyclicPolyPatch::typeName)
{
patchStream >> lastToken;
if (lastToken.isWord())
{
nbrPatchNames[nPatches] = lastToken.wordToken();
}
else
{
patchStream.putBack(lastToken);
}
}
// Read patch faces // Read patch faces
patchStream >> tmpBlocksPatches[nPatches]; patchStream >> tmpBlocksPatches[nPatches];
@ -138,57 +124,56 @@ bool Foam::blockMesh::readPatches
if (patchTypes[nPatches-1] == cyclicPolyPatch::typeName) if (patchTypes[nPatches-1] == cyclicPolyPatch::typeName)
{ {
if (nbrPatchNames[nPatches] == word::null) word halfA = patchNames[nPatches-1] + "_half0";
word halfB = patchNames[nPatches-1] + "_half1";
WarningIn("blockMesh::createTopology(IOdictionary&)")
<< "Old-style cyclic definition."
<< " Splitting patch "
<< patchNames[nPatches-1] << " into two halves "
<< halfA << " and " << halfB << endl
<< " Alternatively use new 'boundary' dictionary syntax."
<< endl;
// Add extra patch
if (tmpBlocksPatches.size() <= nPatches)
{ {
word halfA = patchNames[nPatches-1] + "_half0"; tmpBlocksPatches.setSize(nPatches + 1);
word halfB = patchNames[nPatches-1] + "_half1"; patchNames.setSize(nPatches + 1);
patchTypes.setSize(nPatches + 1);
WarningIn("blockMesh::createTopology(IOdictionary&)") nbrPatchNames.setSize(nPatches + 1);
<< "Old-style cyclic definition."
<< " Splitting patch "
<< patchNames[nPatches-1] << " into two halves "
<< halfA << " and " << halfB << endl
<< " Alternatively use new syntax "
<< " cyclic <name> <neighbourname> <faces>" << endl;
// Add extra patch
if (tmpBlocksPatches.size() <= nPatches)
{
tmpBlocksPatches.setSize(nPatches + 1);
patchNames.setSize(nPatches + 1);
patchTypes.setSize(nPatches + 1);
nbrPatchNames.setSize(nPatches + 1);
}
patchNames[nPatches-1] = halfA;
nbrPatchNames[nPatches-1] = halfB;
patchTypes[nPatches] = patchTypes[nPatches-1];
patchNames[nPatches] = halfB;
nbrPatchNames[nPatches] = halfA;
// Split faces
if ((tmpBlocksPatches[nPatches-1].size() % 2) != 0)
{
FatalErrorIn
(
"blockMesh::createTopology(IOdictionary&)"
) << "Size of cyclic faces is not a multiple of 2 :"
<< tmpBlocksPatches[nPatches-1]
<< exit(FatalError);
}
label sz = tmpBlocksPatches[nPatches-1].size()/2;
faceList unsplitFaces(tmpBlocksPatches[nPatches-1], true);
tmpBlocksPatches[nPatches-1] = faceList
(
SubList<face>(unsplitFaces, sz)
);
tmpBlocksPatches[nPatches] = faceList
(
SubList<face>(unsplitFaces, sz, sz)
);
nPatches++;
} }
// Update halfA info
patchNames[nPatches-1] = halfA;
nbrPatchNames[nPatches-1] = halfB;
// Update halfB info
patchTypes[nPatches] = patchTypes[nPatches-1];
patchNames[nPatches] = halfB;
nbrPatchNames[nPatches] = halfA;
// Split faces
if ((tmpBlocksPatches[nPatches-1].size() % 2) != 0)
{
FatalErrorIn
(
"blockMesh::createTopology(IOdictionary&)"
) << "Size of cyclic faces is not a multiple of 2 :"
<< tmpBlocksPatches[nPatches-1]
<< exit(FatalError);
}
label sz = tmpBlocksPatches[nPatches-1].size()/2;
faceList unsplitFaces(tmpBlocksPatches[nPatches-1], true);
tmpBlocksPatches[nPatches-1] = faceList
(
SubList<face>(unsplitFaces, sz)
);
tmpBlocksPatches[nPatches] = faceList
(
SubList<face>(unsplitFaces, sz, sz)
);
nPatches++;
} }
patchStream >> lastToken; patchStream >> lastToken;
@ -495,6 +480,29 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
patchPhysicalTypes patchPhysicalTypes
); );
// Convert into dictionary
PtrList<dictionary> patchDicts(patchNames.size());
forAll(patchDicts, patchI)
{
patchDicts.set(patchI, new dictionary());
patchDicts[patchI].set("name", patchNames[patchI]);
patchDicts[patchI].set("type", patchTypes[patchI]);
if (nbrPatchNames[patchI] != word::null)
{
patchDicts[patchI].set("neighbourPatch", nbrPatchNames[patchI]);
}
if (patchPhysicalTypes[patchI] != word::null)
{
patchDicts[patchI].set
(
"physicalType",
patchPhysicalTypes[patchI]
);
}
}
blockMeshPtr = new polyMesh blockMeshPtr = new polyMesh
( (
IOobject IOobject
@ -509,11 +517,9 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
xferCopy(blockPointField_), // copy these points, do NOT move xferCopy(blockPointField_), // copy these points, do NOT move
tmpBlockCells, tmpBlockCells,
tmpBlocksPatches, tmpBlocksPatches,
patchNames, patchDicts,
patchTypes,
defaultPatchName, defaultPatchName,
defaultPatchType, defaultPatchType
patchPhysicalTypes
); );
} }
else if (meshDescription.found("boundary")) else if (meshDescription.found("boundary"))

View File

@ -57,49 +57,6 @@ void Foam::PointEdgeWave<Type>::offset(const label val, labelList& elems)
// - list of halfA points (in cyclic patch points) // - list of halfA points (in cyclic patch points)
// - list of halfB points (can overlap with A!) // - list of halfB points (can overlap with A!)
// - for every patchPoint its corresponding point // - for every patchPoint its corresponding point
template <class Type>
void Foam::PointEdgeWave<Type>::calcCyclicAddressing()
{
label cycHalf = 0;
forAll(mesh_.boundaryMesh(), patchI)
{
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
if (isA<cyclicPolyPatch>(patch))
{
label halfSize = patch.size()/2;
SubList<face> halfAFaces
(
mesh_.faces(),
halfSize,
patch.start()
);
cycHalves_.set
(
cycHalf++,
new primitivePatch(halfAFaces, mesh_.points())
);
SubList<face> halfBFaces
(
mesh_.faces(),
halfSize,
patch.start() + halfSize
);
cycHalves_.set
(
cycHalf++,
new primitivePatch(halfBFaces, mesh_.points())
);
}
}
}
// Handle leaving domain. Implementation referred to Type // Handle leaving domain. Implementation referred to Type
template <class Type> template <class Type>
void Foam::PointEdgeWave<Type>::leaveDomain void Foam::PointEdgeWave<Type>::leaveDomain
@ -559,96 +516,57 @@ void Foam::PointEdgeWave<Type>::handleCyclicPatches()
// 1. Send all point info on cyclic patches. Send as // 1. Send all point info on cyclic patches. Send as
// face label + offset in face. // face label + offset in face.
label cycHalf = 0;
forAll(mesh_.boundaryMesh(), patchI) forAll(mesh_.boundaryMesh(), patchI)
{ {
const polyPatch& patch = mesh_.boundaryMesh()[patchI]; const polyPatch& patch = mesh_.boundaryMesh()[patchI];
if (isA<cyclicPolyPatch>(patch)) if (isA<cyclicPolyPatch>(patch))
{ {
const primitivePatch& halfA = cycHalves_[cycHalf++];
const primitivePatch& halfB = cycHalves_[cycHalf++];
// HalfA : get all changed points in relative addressing
DynamicList<Type> halfAInfo(halfA.nPoints());
DynamicList<label> halfAPoints(halfA.nPoints());
DynamicList<label> halfAOwner(halfA.nPoints());
DynamicList<label> halfAIndex(halfA.nPoints());
getChangedPatchPoints
(
halfA,
halfAInfo,
halfAPoints,
halfAOwner,
halfAIndex
);
// HalfB : get all changed points in relative addressing
DynamicList<Type> halfBInfo(halfB.nPoints());
DynamicList<label> halfBPoints(halfB.nPoints());
DynamicList<label> halfBOwner(halfB.nPoints());
DynamicList<label> halfBIndex(halfB.nPoints());
getChangedPatchPoints
(
halfB,
halfBInfo,
halfBPoints,
halfBOwner,
halfBIndex
);
// HalfA : adapt for leaving domain
leaveDomain(patch, halfA, halfAPoints, halfAInfo);
// HalfB : adapt for leaving domain
leaveDomain(patch, halfB, halfBPoints, halfBInfo);
// Apply rotation for non-parallel planes
const cyclicPolyPatch& cycPatch = const cyclicPolyPatch& cycPatch =
refCast<const cyclicPolyPatch>(patch); refCast<const cyclicPolyPatch>(patch);
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
DynamicList<Type> nbrInfo(nbrPatch.nPoints());
DynamicList<label> nbrPoints(nbrPatch.nPoints());
DynamicList<label> nbrOwner(nbrPatch.nPoints());
DynamicList<label> nbrIndex(nbrPatch.nPoints());
getChangedPatchPoints
(
nbrPatch,
nbrInfo,
nbrPoints,
nbrOwner,
nbrIndex
);
// nbr : adapt for leaving domain
leaveDomain(nbrPatch, nbrPatch, nbrPoints, nbrInfo);
// Apply rotation for non-parallel planes
if (!cycPatch.parallel()) if (!cycPatch.parallel())
{ {
// received data from half1 // received data from half1
transform(cycPatch.forwardT(), halfAInfo); transform(cycPatch.forwardT(), nbrInfo);
// received data from half2
transform(cycPatch.reverseT(), halfBInfo);
} }
if (debug) if (debug)
{ {
Pout<< "Cyclic patch " << patchI << ' ' << patch.name() Pout<< "Cyclic patch " << patchI << ' ' << patch.name()
<< " Changed on first half : " << halfAInfo.size() << " Changed : " << nbrInfo.size()
<< " Changed on second half : " << halfBInfo.size()
<< endl; << endl;
} }
// Half1: update with data from halfB // Half1: update with data from halfB
updateFromPatchInfo updateFromPatchInfo
( (
patch, cycPatch,
halfA, cycPatch,
halfBOwner, nbrOwner,
halfBIndex, nbrIndex,
halfBInfo nbrInfo
);
// Half2: update with data from halfA
updateFromPatchInfo
(
patch,
halfB,
halfAOwner,
halfAIndex,
halfAInfo
); );
if (debug) if (debug)
@ -687,7 +605,6 @@ Foam::PointEdgeWave<Type>::PointEdgeWave
changedEdges_(mesh_.nEdges()), changedEdges_(mesh_.nEdges()),
nChangedEdges_(0), nChangedEdges_(0),
nCyclicPatches_(countPatchType<cyclicPolyPatch>()), nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
cycHalves_(2*nCyclicPatches_),
nEvals_(0), nEvals_(0),
nUnvisitedPoints_(mesh_.nPoints()), nUnvisitedPoints_(mesh_.nPoints()),
nUnvisitedEdges_(mesh_.nEdges()) nUnvisitedEdges_(mesh_.nEdges())
@ -720,13 +637,6 @@ Foam::PointEdgeWave<Type>::PointEdgeWave
} }
// Calculate cyclic halves addressing.
if (nCyclicPatches_ > 0)
{
calcCyclicAddressing();
}
// Set from initial changed points data // Set from initial changed points data
setPointInfo(changedPoints, changedPointsInfo); setPointInfo(changedPoints, changedPointsInfo);

Some files were not shown because too many files have changed in this diff Show More