mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
BUG: finite volume did not work before.
This commit is contained in:
45
TODO
Normal file
45
TODO
Normal 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:
|
||||
|
||||
|
||||
@ -296,12 +296,7 @@ label mergePatchFaces
|
||||
const faceZone& fZone = mesh.faceZones()[zoneID];
|
||||
zoneFlip = fZone.flipMap()[fZone.whichFace(newMasterI)];
|
||||
}
|
||||
labelPair patchIDs = polyTopoChange::whichPatch
|
||||
(
|
||||
mesh.boundaryMesh(),
|
||||
newMasterI
|
||||
);
|
||||
|
||||
label patchID = mesh.boundaryMesh().whichPatch(newMasterI);
|
||||
|
||||
Pout<< "Restoring new master face " << newMasterI
|
||||
<< " to vertices " << setFaceVerts[0] << endl;
|
||||
@ -316,11 +311,10 @@ label mergePatchFaces
|
||||
own, // owner
|
||||
-1, // neighbour
|
||||
false, // face flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face flip in zone
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // face flip in zone
|
||||
)
|
||||
);
|
||||
|
||||
@ -342,10 +336,9 @@ label mergePatchFaces
|
||||
-1, // masterEdgeID,
|
||||
newMasterI, // masterFaceID,
|
||||
false, // flipFaceFlux,
|
||||
patchIDs[0], // patchID,
|
||||
patchID, // patchID,
|
||||
zoneID, // zoneID,
|
||||
zoneFlip, // zoneFlip
|
||||
patchIDs[1] // subPatch
|
||||
zoneFlip // zoneFlip
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -45,12 +45,17 @@ defineTypeNameAndDebug(Foam::cellSplitter, 0);
|
||||
void Foam::cellSplitter::getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
labelPair& patchIDs,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
) const
|
||||
{
|
||||
patchIDs = polyTopoChange::whichPatch(mesh_.boundaryMesh(), faceI);
|
||||
patchID = -1;
|
||||
|
||||
if (!mesh_.isInternalFace(faceI))
|
||||
{
|
||||
patchID = mesh_.boundaryMesh().whichPatch(faceI);
|
||||
}
|
||||
|
||||
zoneID = mesh_.faceZones().whichZone(faceI);
|
||||
|
||||
@ -161,16 +166,17 @@ void Foam::cellSplitter::setRefinement
|
||||
|
||||
label anchorPoint = mesh_.cellPoints()[cellI][0];
|
||||
|
||||
label addedPointI = meshMod.setAction
|
||||
(
|
||||
polyAddPoint
|
||||
label addedPointI =
|
||||
meshMod.setAction
|
||||
(
|
||||
iter(), // point
|
||||
anchorPoint, // master point
|
||||
-1, // zone for point
|
||||
true // supports a cell
|
||||
)
|
||||
);
|
||||
polyAddPoint
|
||||
(
|
||||
iter(), // point
|
||||
anchorPoint, // master point
|
||||
-1, // zone for point
|
||||
true // supports a cell
|
||||
)
|
||||
);
|
||||
addedPoints_.insert(cellI, addedPointI);
|
||||
|
||||
//Pout<< "Added point " << addedPointI
|
||||
@ -199,17 +205,19 @@ void Foam::cellSplitter::setRefinement
|
||||
|
||||
// Add other pyramids
|
||||
for (label i = 1; i < cFaces.size(); i++)
|
||||
label addedCellI = meshMod.setAction
|
||||
(
|
||||
polyAddCell
|
||||
{
|
||||
label addedCellI =
|
||||
meshMod.setAction
|
||||
(
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
-1, // master face
|
||||
cellI, // master cell
|
||||
-1 // zone
|
||||
)
|
||||
);
|
||||
polyAddCell
|
||||
(
|
||||
-1, // master point
|
||||
-1, // master edge
|
||||
-1, // master face
|
||||
cellI, // master cell
|
||||
-1 // zone
|
||||
)
|
||||
);
|
||||
|
||||
newCells[i] = addedCellI;
|
||||
}
|
||||
@ -296,8 +304,7 @@ void Foam::cellSplitter::setRefinement
|
||||
false, // flux flip
|
||||
-1, // patch for face
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // subPatch
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -343,8 +350,7 @@ void Foam::cellSplitter::setRefinement
|
||||
false, // flux flip
|
||||
-1, // patch for face
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // subPatch
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -399,8 +405,7 @@ void Foam::cellSplitter::setRefinement
|
||||
-1, // patch for face
|
||||
false, // remove from zone
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // subPatch
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -418,8 +423,7 @@ void Foam::cellSplitter::setRefinement
|
||||
-1, // patch for face
|
||||
false, // remove from zone
|
||||
-1, // zone for face
|
||||
false, // face zone flip
|
||||
-1 // subPatch
|
||||
false // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -429,9 +433,9 @@ void Foam::cellSplitter::setRefinement
|
||||
{
|
||||
label newOwn = newOwner(faceI, cellToCells);
|
||||
|
||||
labelPair patchIDs;
|
||||
label zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchIDs, zoneID, zoneFlip);
|
||||
label patchID, zoneID, zoneFlip;
|
||||
getFaceInfo(faceI, patchID, zoneID, zoneFlip);
|
||||
|
||||
meshMod.setAction
|
||||
(
|
||||
polyModifyFace
|
||||
@ -441,11 +445,10 @@ void Foam::cellSplitter::setRefinement
|
||||
newOwn, // owner
|
||||
-1, // neighbour
|
||||
false, // flux flip
|
||||
patchIDs[0], // patch for face
|
||||
patchID, // patch for face
|
||||
false, // remove from zone
|
||||
zoneID, // zone for face
|
||||
zoneFlip, // face zone flip
|
||||
patchIDs[1]
|
||||
zoneFlip // face zone flip
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@ -39,7 +39,6 @@ SourceFiles
|
||||
|
||||
#include "Map.H"
|
||||
#include "edge.H"
|
||||
#include "labelPair.H"
|
||||
#include "typeInfo.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -74,7 +73,7 @@ class cellSplitter
|
||||
void getFaceInfo
|
||||
(
|
||||
const label faceI,
|
||||
labelPair& patchIDs,
|
||||
label& patchID,
|
||||
label& zoneID,
|
||||
label& zoneFlip
|
||||
) const;
|
||||
|
||||
@ -1200,8 +1200,7 @@ int main(int argc, char *argv[])
|
||||
false, // flipFaceFlux
|
||||
-1, // patchID
|
||||
faceZonei, // zoneID
|
||||
fm[facei], // zoneFlip
|
||||
-1 // subPatchID
|
||||
fm[facei] // zoneFlip
|
||||
);
|
||||
}
|
||||
|
||||
@ -1252,8 +1251,7 @@ int main(int argc, char *argv[])
|
||||
false, // flipFaceFlux
|
||||
patchi, // patchID
|
||||
-1, // zoneID
|
||||
false, // zoneFlip
|
||||
-1 // subPatchID
|
||||
false // zoneFlip
|
||||
);
|
||||
|
||||
// For baffles create the opposite face
|
||||
@ -1270,8 +1268,7 @@ int main(int argc, char *argv[])
|
||||
false, // flipFaceFlux
|
||||
patchi, // patchID
|
||||
-1, // zoneID
|
||||
false, // zoneFlip
|
||||
-1
|
||||
false // zoneFlip
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1320,8 +1317,7 @@ int main(int argc, char *argv[])
|
||||
false, //flipFaceFlux
|
||||
-1, //patchID
|
||||
-1, //zoneID
|
||||
false, //zoneFlip
|
||||
-1 //subPatchID
|
||||
false //zoneFlip
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -136,8 +136,7 @@ void Foam::extrude2DMesh::setRefinement
|
||||
false, // flipFaceFlux
|
||||
-1, // patchID
|
||||
zoneID, // zoneID
|
||||
zoneFlip, // zoneFlip
|
||||
-1 // subPatchID
|
||||
zoneFlip // zoneFlip
|
||||
);
|
||||
}
|
||||
|
||||
@ -174,8 +173,7 @@ void Foam::extrude2DMesh::setRefinement
|
||||
false, // flipFaceFlux
|
||||
patchI, // patchID
|
||||
zoneID, // zoneID
|
||||
zoneFlip, // zoneFlip
|
||||
-1 //?TBD subPatchID
|
||||
zoneFlip // zoneFlip
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -238,8 +236,7 @@ void Foam::extrude2DMesh::setRefinement
|
||||
false, // flipFaceFlux
|
||||
frontPatchI, // patchID
|
||||
-1, // zoneID
|
||||
false, // zoneFlip
|
||||
-1 //?TDB subPatchID
|
||||
false // zoneFlip
|
||||
);
|
||||
|
||||
// Offset to create front face.
|
||||
@ -258,8 +255,7 @@ void Foam::extrude2DMesh::setRefinement
|
||||
false, // flipFaceFlux
|
||||
frontPatchI, // patchID
|
||||
-1, // zoneID
|
||||
false, // zoneFlip
|
||||
-1 //?TDB subPatchID
|
||||
false // zoneFlip
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -198,69 +198,55 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
if
|
||||
(
|
||||
isA<cyclicPolyPatch>(patches[patchI])
|
||||
&& refCast<const cyclicPolyPatch>(patches[patchI]).owner()
|
||||
)
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
|
||||
label halfSize = cycPatch.size()/2;
|
||||
|
||||
// Dump halves
|
||||
// Dump patches
|
||||
{
|
||||
OFstream str(prefix+cycPatch.name()+"_half0.obj");
|
||||
OFstream str(prefix+cycPatch.name()+".obj");
|
||||
Pout<< "Dumping " << cycPatch.name()
|
||||
<< " half0 faces to " << str.name() << endl;
|
||||
<< " faces to " << str.name() << endl;
|
||||
meshTools::writeOBJ
|
||||
(
|
||||
str,
|
||||
static_cast<faceList>
|
||||
(
|
||||
SubList<face>
|
||||
(
|
||||
cycPatch,
|
||||
halfSize
|
||||
)
|
||||
),
|
||||
cycPatch,
|
||||
cycPatch.points()
|
||||
);
|
||||
}
|
||||
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
{
|
||||
OFstream str(prefix+cycPatch.name()+"_half1.obj");
|
||||
Pout<< "Dumping " << cycPatch.name()
|
||||
<< " half1 faces to " << str.name() << endl;
|
||||
OFstream str(prefix+nbrPatch.name()+".obj");
|
||||
Pout<< "Dumping " << nbrPatch.name()
|
||||
<< " faces to " << str.name() << endl;
|
||||
meshTools::writeOBJ
|
||||
(
|
||||
str,
|
||||
static_cast<faceList>
|
||||
(
|
||||
SubList<face>
|
||||
(
|
||||
cycPatch,
|
||||
halfSize,
|
||||
halfSize
|
||||
)
|
||||
),
|
||||
cycPatch.points()
|
||||
nbrPatch,
|
||||
nbrPatch.points()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
// Lines between corresponding face centres
|
||||
OFstream str(prefix+cycPatch.name()+"_match.obj");
|
||||
OFstream str(prefix+cycPatch.name()+nbrPatch.name()+"_match.obj");
|
||||
label vertI = 0;
|
||||
|
||||
Pout<< "Dumping cyclic match as lines between face centres to "
|
||||
<< str.name() << endl;
|
||||
|
||||
for (label faceI = 0; faceI < halfSize; faceI++)
|
||||
forAll(cycPatch, faceI)
|
||||
{
|
||||
const point& fc0 = mesh.faceCentres()[cycPatch.start()+faceI];
|
||||
meshTools::writeOBJ(str, fc0);
|
||||
vertI++;
|
||||
|
||||
label nbrFaceI = halfSize + faceI;
|
||||
const point& fc1 =
|
||||
mesh.faceCentres()[cycPatch.start()+nbrFaceI];
|
||||
const point& fc1 = mesh.faceCentres()[nbrPatch.start()+faceI];
|
||||
meshTools::writeOBJ(str, fc1);
|
||||
vertI++;
|
||||
|
||||
@ -273,34 +259,13 @@ void dumpCyclicMatch(const fileName& prefix, const polyMesh& mesh)
|
||||
|
||||
void separateList
|
||||
(
|
||||
const vectorField& separation,
|
||||
const vector& separation,
|
||||
UList<vector>& field
|
||||
)
|
||||
{
|
||||
if (separation.size() == 1)
|
||||
forAll(field, i)
|
||||
{
|
||||
// Single value for all.
|
||||
|
||||
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);
|
||||
field[i] += separation;
|
||||
}
|
||||
}
|
||||
|
||||
@ -427,13 +392,19 @@ void syncPoints
|
||||
{
|
||||
const polyPatch& pp = patches[patchI];
|
||||
|
||||
if (isA<cyclicPolyPatch>(pp))
|
||||
if
|
||||
(
|
||||
isA<cyclicPolyPatch>(pp)
|
||||
&& refCast<const cyclicPolyPatch>(pp).owner()
|
||||
)
|
||||
{
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
refCast<const cyclicPolyPatch>(pp);
|
||||
|
||||
const edgeList& coupledPoints = cycPatch.coupledPoints();
|
||||
const labelList& meshPts = cycPatch.meshPoints();
|
||||
const cyclicPolyPatch& nbrPatch = cycPatch.neighbPatch();
|
||||
const labelList& nbrMeshPts = nbrPatch.meshPoints();
|
||||
|
||||
pointField half0Values(coupledPoints.size());
|
||||
|
||||
@ -452,14 +423,14 @@ void syncPoints
|
||||
else if (cycPatch.separated())
|
||||
{
|
||||
hasTransformation = true;
|
||||
const vectorField& v = cycPatch.coupledPolyPatch::separation();
|
||||
const vector& v = cycPatch.separation();
|
||||
separateList(v, half0Values);
|
||||
}
|
||||
|
||||
forAll(coupledPoints, i)
|
||||
{
|
||||
const edge& e = coupledPoints[i];
|
||||
label point1 = meshPts[e[1]];
|
||||
label point1 = nbrMeshPts[e[1]];
|
||||
points[point1] = half0Values[i];
|
||||
}
|
||||
}
|
||||
@ -783,13 +754,8 @@ int main(int argc, char *argv[])
|
||||
// current separation also includes the normal
|
||||
// ( 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 separated ones use our own recalculated offset vector
|
||||
// - for rotational ones use current one.
|
||||
// - for separated ones use user specified offset vector
|
||||
|
||||
forAll(mesh.boundaryMesh(), patchI)
|
||||
{
|
||||
@ -813,51 +779,18 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (cycpp.transform() == cyclicPolyPatch::TRANSLATIONAL)
|
||||
{
|
||||
// Force to wanted separation
|
||||
Info<< "On cyclic translation patch " << pp.name()
|
||||
<< " forcing uniform separation of "
|
||||
<< cycpp.separationVector() << endl;
|
||||
const_cast<vectorField&>(cpp.separation()) =
|
||||
pointField(1, cycpp.separationVector());
|
||||
const_cast<vector&>(cpp.separation()) =
|
||||
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()
|
||||
<< " forcing uniform separation of "
|
||||
<< 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -306,8 +306,6 @@ autoPtr<mapPolyMesh> reorderMesh
|
||||
labelList patchStarts(patches.size());
|
||||
labelList oldPatchNMeshPoints(patches.size());
|
||||
labelListList patchPointMap(patches.size());
|
||||
labelListList subPatches(patches.size());
|
||||
labelListList subPatchStarts(patches.size());
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
@ -315,16 +313,6 @@ autoPtr<mapPolyMesh> reorderMesh
|
||||
patchStarts[patchI] = patches[patchI].start();
|
||||
oldPatchNMeshPoints[patchI] = 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
|
||||
@ -335,8 +323,7 @@ autoPtr<mapPolyMesh> reorderMesh
|
||||
xferMove(newNeighbour),
|
||||
patchSizes,
|
||||
patchStarts,
|
||||
subPatches,
|
||||
subPatchStarts
|
||||
true
|
||||
);
|
||||
|
||||
return autoPtr<mapPolyMesh>
|
||||
|
||||
@ -556,7 +556,7 @@ void getInterfaceSizes
|
||||
label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()];
|
||||
coupledRegion[i] = cellRegion[cellI];
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh, coupledRegion, false);
|
||||
syncTools::swapBoundaryFaceList(mesh, coupledRegion);
|
||||
|
||||
forAll(coupledRegion, i)
|
||||
{
|
||||
@ -726,7 +726,7 @@ autoPtr<mapPolyMesh> createRegionMesh
|
||||
label cellI = mesh.faceOwner()[i+mesh.nInternalFaces()];
|
||||
coupledRegion[i] = cellRegion[cellI];
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh, coupledRegion, false);
|
||||
syncTools::swapBoundaryFaceList(mesh, coupledRegion);
|
||||
|
||||
|
||||
// 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()]];
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh, neiZoneID, false);
|
||||
syncTools::swapBoundaryFaceList(mesh, neiZoneID);
|
||||
|
||||
|
||||
// Determine connected regions
|
||||
|
||||
@ -337,22 +337,22 @@ int main(int argc, char *argv[])
|
||||
|
||||
// Construct the point fields
|
||||
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
pointMesh pMesh(mesh);
|
||||
// pointMesh pMesh(mesh);
|
||||
|
||||
PtrList<pointScalarField> pointScalarFields;
|
||||
readFields(pMesh, objects, pointScalarFields);
|
||||
// readFields(pMesh, objects, pointScalarFields);
|
||||
|
||||
PtrList<pointVectorField> pointVectorFields;
|
||||
readFields(pMesh, objects, pointVectorFields);
|
||||
// readFields(pMesh, objects, pointVectorFields);
|
||||
|
||||
PtrList<pointSphericalTensorField> pointSphericalTensorFields;
|
||||
readFields(pMesh, objects, pointSphericalTensorFields);
|
||||
// readFields(pMesh, objects, pointSphericalTensorFields);
|
||||
|
||||
PtrList<pointSymmTensorField> pointSymmTensorFields;
|
||||
readFields(pMesh, objects, pointSymmTensorFields);
|
||||
// readFields(pMesh, objects, pointSymmTensorFields);
|
||||
|
||||
PtrList<pointTensorField> pointTensorFields;
|
||||
readFields(pMesh, objects, pointTensorFields);
|
||||
// readFields(pMesh, objects, pointTensorFields);
|
||||
|
||||
|
||||
// Construct the Lagrangian fields
|
||||
@ -652,45 +652,45 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
|
||||
// Point fields
|
||||
if
|
||||
(
|
||||
pointScalarFields.size()
|
||||
|| pointVectorFields.size()
|
||||
|| pointSphericalTensorFields.size()
|
||||
|| pointSymmTensorFields.size()
|
||||
|| pointTensorFields.size()
|
||||
)
|
||||
{
|
||||
labelIOList pointProcAddressing
|
||||
(
|
||||
IOobject
|
||||
(
|
||||
"pointProcAddressing",
|
||||
procMesh.facesInstance(),
|
||||
procMesh.meshSubDir,
|
||||
procMesh,
|
||||
IOobject::MUST_READ,
|
||||
IOobject::NO_WRITE
|
||||
)
|
||||
);
|
||||
|
||||
pointMesh procPMesh(procMesh, true);
|
||||
|
||||
pointFieldDecomposer fieldDecomposer
|
||||
(
|
||||
pMesh,
|
||||
procPMesh,
|
||||
pointProcAddressing,
|
||||
boundaryProcAddressing
|
||||
);
|
||||
|
||||
fieldDecomposer.decomposeFields(pointScalarFields);
|
||||
fieldDecomposer.decomposeFields(pointVectorFields);
|
||||
fieldDecomposer.decomposeFields(pointSphericalTensorFields);
|
||||
fieldDecomposer.decomposeFields(pointSymmTensorFields);
|
||||
fieldDecomposer.decomposeFields(pointTensorFields);
|
||||
}
|
||||
// // Point fields
|
||||
// if
|
||||
// (
|
||||
// pointScalarFields.size()
|
||||
// || pointVectorFields.size()
|
||||
// || pointSphericalTensorFields.size()
|
||||
// || pointSymmTensorFields.size()
|
||||
// || pointTensorFields.size()
|
||||
// )
|
||||
// {
|
||||
// labelIOList pointProcAddressing
|
||||
// (
|
||||
// IOobject
|
||||
// (
|
||||
// "pointProcAddressing",
|
||||
// procMesh.facesInstance(),
|
||||
// procMesh.meshSubDir,
|
||||
// procMesh,
|
||||
// IOobject::MUST_READ,
|
||||
// IOobject::NO_WRITE
|
||||
// )
|
||||
// );
|
||||
//
|
||||
// pointMesh procPMesh(procMesh, true);
|
||||
//
|
||||
// pointFieldDecomposer fieldDecomposer
|
||||
// (
|
||||
// pMesh,
|
||||
// procPMesh,
|
||||
// pointProcAddressing,
|
||||
// boundaryProcAddressing
|
||||
// );
|
||||
//
|
||||
// fieldDecomposer.decomposeFields(pointScalarFields);
|
||||
// fieldDecomposer.decomposeFields(pointVectorFields);
|
||||
// fieldDecomposer.decomposeFields(pointSphericalTensorFields);
|
||||
// fieldDecomposer.decomposeFields(pointSymmTensorFields);
|
||||
// fieldDecomposer.decomposeFields(pointTensorFields);
|
||||
// }
|
||||
|
||||
|
||||
// If there is lagrangian data write it out
|
||||
|
||||
@ -29,6 +29,7 @@ License
|
||||
#include "dictionary.H"
|
||||
#include "labelIOList.H"
|
||||
#include "processorPolyPatch.H"
|
||||
#include "processorCyclicPolyPatch.H"
|
||||
#include "fvMesh.H"
|
||||
#include "OSspecific.H"
|
||||
#include "Map.H"
|
||||
@ -293,10 +294,34 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
|
||||
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
|
||||
(
|
||||
curPatchSizes.size()
|
||||
+ curProcessorPatchSizes.size(),
|
||||
+ nInterProcPatches, //curProcessorPatchSizes.size(),
|
||||
reinterpret_cast<polyPatch*>(0)
|
||||
);
|
||||
|
||||
@ -335,23 +360,72 @@ bool Foam::domainDecomposition::writeDecomposition()
|
||||
|
||||
forAll(curProcessorPatchSizes, procPatchI)
|
||||
{
|
||||
procPatches[nPatches] =
|
||||
new processorPolyPatch
|
||||
(
|
||||
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]
|
||||
);
|
||||
const labelList& subPatchID = curSubPatchIDs[procPatchI];
|
||||
const labelList& subStarts = 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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -40,7 +40,7 @@ Description
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
void domainDecomposition::append(labelList& lst, const label elem)
|
||||
void Foam::domainDecomposition::append(labelList& lst, const label elem)
|
||||
{
|
||||
label sz = lst.size();
|
||||
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 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
|
||||
distributeCells();
|
||||
@ -230,14 +230,15 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
facei,
|
||||
ownerProc,
|
||||
nbrProc,
|
||||
|
||||
procNbrToInterPatch,
|
||||
interPatchFaces
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Add the proper processor faces to the sub information. Since faces
|
||||
// originate from internal faces this is always -1.
|
||||
// Add the proper processor faces to the sub information. For faces
|
||||
// originating from internal faces this is always -1.
|
||||
List<labelListList> subPatchIDs(nProcs_);
|
||||
List<labelListList> subPatchStarts(nProcs_);
|
||||
forAll(interPatchFaces, procI)
|
||||
@ -415,7 +416,16 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
forAll(procBoundaryAddressing_, procI)
|
||||
{
|
||||
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);
|
||||
|
||||
@ -423,9 +433,14 @@ void domainDecomposition::decomposeMesh(const bool filterEmptyPatches)
|
||||
{
|
||||
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];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -145,7 +145,11 @@ Foam::fvFieldDecomposer::fvFieldDecomposer
|
||||
{
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
{
|
||||
if (boundaryAddressing_[patchi] >= 0)
|
||||
if
|
||||
(
|
||||
boundaryAddressing_[patchi] >= 0
|
||||
&& !isA<processorLduInterface>(procMesh.boundary()[patchi])
|
||||
)
|
||||
{
|
||||
patchFieldDecomposerPtrs_[patchi] = new patchFieldDecomposer
|
||||
(
|
||||
|
||||
@ -27,6 +27,8 @@ License
|
||||
#include "fvFieldDecomposer.H"
|
||||
#include "processorFvPatchField.H"
|
||||
#include "processorFvsPatchField.H"
|
||||
#include "processorCyclicFvPatchField.H"
|
||||
#include "processorCyclicFvsPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
@ -45,7 +47,7 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
{
|
||||
if (boundaryAddressing_[patchi] >= 0)
|
||||
if (patchFieldDecomposerPtrs_[patchi])
|
||||
{
|
||||
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
|
||||
(
|
||||
@ -76,6 +95,11 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("fvFieldDecomposer::decomposeField()")
|
||||
<< "Unknown type." << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the field for the processor
|
||||
@ -156,7 +180,7 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
|
||||
forAll(boundaryAddressing_, patchi)
|
||||
{
|
||||
if (boundaryAddressing_[patchi] >= 0)
|
||||
if (patchFieldDecomposerPtrs_[patchi])
|
||||
{
|
||||
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
|
||||
(
|
||||
@ -187,6 +228,11 @@ Foam::fvFieldDecomposer::decomposeField
|
||||
)
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
FatalErrorIn("fvFieldDecomposer::decomposeField()")
|
||||
<< "Unknown type." << abort(FatalError);
|
||||
}
|
||||
}
|
||||
|
||||
// Create the field for the processor
|
||||
|
||||
@ -80,7 +80,7 @@ void Foam::channelIndex::walkOppositeFaces
|
||||
isFrontBndFace[faceI-mesh.nInternalFaces()] = true;
|
||||
}
|
||||
}
|
||||
syncTools::swapBoundaryFaceList(mesh, isFrontBndFace, false);
|
||||
syncTools::swapBoundaryFaceList(mesh, isFrontBndFace);
|
||||
|
||||
// Add
|
||||
forAll(isFrontBndFace, i)
|
||||
|
||||
@ -31,7 +31,6 @@ Description
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "fvCFD.H"
|
||||
#include "cyclicPolyPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
// Main program:
|
||||
@ -77,35 +76,12 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
// Give patch area
|
||||
if (isA<cyclicPolyPatch>(mesh.boundaryMesh()[patchi]))
|
||||
{
|
||||
Info<< " Cyclic patch vector area: " << nl;
|
||||
label nFaces = mesh.boundaryMesh()[patchi].size();
|
||||
vector sum1 = vector::zero;
|
||||
vector sum2 = vector::zero;
|
||||
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;
|
||||
}
|
||||
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
|
||||
if (fieldHeader.headerClassName() == volScalarField::typeName)
|
||||
|
||||
@ -0,0 +1,3 @@
|
||||
foamUpgradeCyclics.C
|
||||
|
||||
EXE = $(FOAM_APPBIN)/foamUpgradeCyclics
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -252,12 +252,13 @@ bool Foam::FaceCellWave<Type>::updateFace
|
||||
template <class Type>
|
||||
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 i2 = i1 + cycOffset;
|
||||
label i2 = nbrPatch.start() + patchFaceI;
|
||||
|
||||
if (!allFaceInfo_[i1].sameGeometry(mesh_, allFaceInfo_[i2], geomTol_))
|
||||
{
|
||||
@ -335,8 +336,7 @@ void Foam::FaceCellWave<Type>::mergeFaceInfo
|
||||
const polyPatch& patch,
|
||||
const label nFaces,
|
||||
const labelList& changedFaces,
|
||||
const List<Type>& changedFacesInfo,
|
||||
const bool
|
||||
const List<Type>& changedFacesInfo
|
||||
)
|
||||
{
|
||||
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.
|
||||
template <class Type>
|
||||
void Foam::FaceCellWave<Type>::offset
|
||||
@ -511,6 +477,8 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
|
||||
{
|
||||
// Send all
|
||||
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
forAll(mesh_.boundaryMesh(), patchI)
|
||||
{
|
||||
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
|
||||
@ -552,16 +520,13 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
sendPatchInfo
|
||||
(
|
||||
procPatch.neighbProcNo(),
|
||||
nSendFaces,
|
||||
sendFaces,
|
||||
sendFacesInfo
|
||||
);
|
||||
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||
writeFaces(nSendFaces, sendFaces, sendFacesInfo, toNeighbour);
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive all
|
||||
|
||||
forAll(mesh_.boundaryMesh(), patchI)
|
||||
@ -574,16 +539,20 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
|
||||
refCast<const processorPolyPatch>(patch);
|
||||
|
||||
// Allocate buffers
|
||||
label nReceiveFaces;
|
||||
label nReceiveFaces = 0;
|
||||
labelList receiveFaces(patch.size());
|
||||
List<Type> receiveFacesInfo(patch.size());
|
||||
|
||||
nReceiveFaces = receivePatchInfo
|
||||
(
|
||||
procPatch.neighbProcNo(),
|
||||
receiveFaces,
|
||||
receiveFacesInfo
|
||||
);
|
||||
{
|
||||
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||
readFaces
|
||||
(
|
||||
nReceiveFaces,
|
||||
receiveFaces,
|
||||
receiveFacesInfo,
|
||||
fromNeighbour
|
||||
);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
@ -619,8 +588,7 @@ void Foam::FaceCellWave<Type>::handleProcPatches()
|
||||
patch,
|
||||
nReceiveFaces,
|
||||
receiveFaces,
|
||||
receiveFacesInfo,
|
||||
procPatch.parallel()
|
||||
receiveFacesInfo
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -639,87 +607,42 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
|
||||
|
||||
if (isA<cyclicPolyPatch>(patch))
|
||||
{
|
||||
label halfSize = patch.size()/2;
|
||||
const cyclicPolyPatch& nbrPatch =
|
||||
refCast<const cyclicPolyPatch>(patch).neighbPatch();
|
||||
|
||||
// Allocate buffers
|
||||
label nSendFaces;
|
||||
labelList sendFaces(halfSize);
|
||||
List<Type> sendFacesInfo(halfSize);
|
||||
|
||||
label nReceiveFaces;
|
||||
labelList receiveFaces(halfSize);
|
||||
List<Type> receiveFacesInfo(halfSize);
|
||||
labelList receiveFaces(patch.size());
|
||||
List<Type> receiveFacesInfo(patch.size());
|
||||
|
||||
// Half1: Determine which faces changed. Use sendFaces for storage
|
||||
nSendFaces = getChangedPatchFaces
|
||||
(
|
||||
patch,
|
||||
0,
|
||||
halfSize,
|
||||
sendFaces,
|
||||
sendFacesInfo
|
||||
);
|
||||
|
||||
// Half2: Determine which faces changed. Use receiveFaces_ ,,
|
||||
// Determine which faces changed
|
||||
nReceiveFaces = getChangedPatchFaces
|
||||
(
|
||||
patch,
|
||||
halfSize,
|
||||
halfSize,
|
||||
nbrPatch,
|
||||
0,
|
||||
nbrPatch.size(),
|
||||
receiveFaces,
|
||||
receiveFacesInfo
|
||||
);
|
||||
|
||||
//Info<< "Half1:" << endl;
|
||||
//writeFaces(nSendFaces, sendFaces, sendFacesInfo, Info);
|
||||
//Info<< endl;
|
||||
//
|
||||
//Info<< "Half2:" << endl;
|
||||
//writeFaces(nReceiveFaces, receiveFaces, receiveFacesInfo, Info);
|
||||
//Info<< endl;
|
||||
|
||||
|
||||
// Half1: Adapt wallInfo for leaving domain
|
||||
// Adapt wallInfo for leaving domain
|
||||
leaveDomain
|
||||
(
|
||||
patch,
|
||||
nSendFaces,
|
||||
sendFaces,
|
||||
sendFacesInfo
|
||||
);
|
||||
// Half2: Adapt wallInfo for leaving domain
|
||||
leaveDomain
|
||||
(
|
||||
patch,
|
||||
nbrPatch,
|
||||
nReceiveFaces,
|
||||
receiveFaces,
|
||||
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 =
|
||||
refCast<const cyclicPolyPatch>(patch);
|
||||
|
||||
if (!cycPatch.parallel())
|
||||
{
|
||||
// sendFaces = received data from half1
|
||||
// received data from other half
|
||||
transform
|
||||
(
|
||||
cycPatch.forwardT(),
|
||||
nSendFaces,
|
||||
sendFacesInfo
|
||||
);
|
||||
|
||||
// receiveFaces = received data from half2
|
||||
transform
|
||||
(
|
||||
cycPatch.reverseT(),
|
||||
nReceiveFaces,
|
||||
receiveFacesInfo
|
||||
);
|
||||
@ -727,25 +650,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< " Cyclic patch " << patchI << ' ' << patch.name()
|
||||
<< " Changed on first half : " << nSendFaces
|
||||
<< " Changed on second half : " << nReceiveFaces
|
||||
Pout<< " Cyclic patch " << patchI << ' ' << cycPatch.name()
|
||||
<< " Changed : " << nReceiveFaces
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Half1: Adapt wallInfo for entering domain
|
||||
enterDomain
|
||||
(
|
||||
patch,
|
||||
nSendFaces,
|
||||
sendFaces,
|
||||
sendFacesInfo
|
||||
);
|
||||
|
||||
// Half2: Adapt wallInfo for entering domain
|
||||
enterDomain
|
||||
(
|
||||
patch,
|
||||
cycPatch,
|
||||
nReceiveFaces,
|
||||
receiveFaces,
|
||||
receiveFacesInfo
|
||||
@ -754,25 +667,15 @@ void Foam::FaceCellWave<Type>::handleCyclicPatches()
|
||||
// Merge into global storage
|
||||
mergeFaceInfo
|
||||
(
|
||||
patch,
|
||||
nSendFaces,
|
||||
sendFaces,
|
||||
sendFacesInfo,
|
||||
cycPatch.parallel()
|
||||
);
|
||||
// Merge into global storage
|
||||
mergeFaceInfo
|
||||
(
|
||||
patch,
|
||||
cycPatch,
|
||||
nReceiveFaces,
|
||||
receiveFaces,
|
||||
receiveFacesInfo,
|
||||
cycPatch.parallel()
|
||||
receiveFacesInfo
|
||||
);
|
||||
|
||||
if (debug)
|
||||
{
|
||||
checkCyclic(patch);
|
||||
checkCyclic(cycPatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,8 +193,7 @@ class FaceCellWave
|
||||
const polyPatch& patch,
|
||||
const label nFaces,
|
||||
const labelList&,
|
||||
const List<Type>&,
|
||||
const bool isParallel
|
||||
const List<Type>&
|
||||
);
|
||||
|
||||
//- Extract info for single patch only
|
||||
@ -225,23 +224,6 @@ class FaceCellWave
|
||||
List<Type>& faceInfo
|
||||
) 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
|
||||
static void offset
|
||||
(
|
||||
|
||||
@ -109,7 +109,6 @@ struct HashTableCore
|
||||
{
|
||||
return iteratorEnd();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -139,6 +138,7 @@ class HashTable
|
||||
//- Construct from key, next pointer and object
|
||||
inline hashedEntry(const Key&, hashedEntry* next, const T&);
|
||||
|
||||
|
||||
private:
|
||||
//- Disallow default bitwise copy construct
|
||||
hashedEntry(const hashedEntry&);
|
||||
@ -209,9 +209,8 @@ public:
|
||||
HashTable(const Xfer<HashTable<T, Key, Hash> >&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~HashTable();
|
||||
//- Destructor
|
||||
~HashTable();
|
||||
|
||||
|
||||
// Member Functions
|
||||
@ -247,6 +246,7 @@ public:
|
||||
//- Print information
|
||||
Ostream& printInfo(Ostream&) const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Insert a new hashedEntry
|
||||
@ -291,7 +291,7 @@ public:
|
||||
void transfer(HashTable<T, Key, Hash>&);
|
||||
|
||||
//- Transfer contents to the Xfer container
|
||||
inline Xfer< HashTable<T, Key, Hash> > xfer();
|
||||
inline Xfer<HashTable<T, Key, Hash> > xfer();
|
||||
|
||||
|
||||
// Member Operators
|
||||
@ -356,9 +356,8 @@ public:
|
||||
//- Current hash index
|
||||
label hashIndex_;
|
||||
|
||||
protected:
|
||||
|
||||
// Protected Member Functions
|
||||
protected:
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -380,6 +379,8 @@ public:
|
||||
);
|
||||
|
||||
|
||||
// Protected Member Functions
|
||||
|
||||
//- Increment to the next position
|
||||
inline void increment();
|
||||
|
||||
@ -392,6 +393,7 @@ public:
|
||||
//- Return const access to referenced object
|
||||
inline const T& cobject() const;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Member operators
|
||||
@ -434,6 +436,7 @@ public:
|
||||
const label hashIndex
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
@ -444,13 +447,12 @@ public:
|
||||
//- Construct end iterator
|
||||
inline iterator(const iteratorEnd& unused);
|
||||
|
||||
|
||||
// Member operators
|
||||
|
||||
//- Conversion to a const_iterator
|
||||
inline operator const_iterator() const;
|
||||
|
||||
// Access
|
||||
|
||||
//- Return referenced hash value
|
||||
inline T& operator*();
|
||||
inline T& operator()();
|
||||
@ -492,6 +494,7 @@ public:
|
||||
const label hashIndex
|
||||
);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
@ -502,9 +505,8 @@ public:
|
||||
//- Construct end iterator
|
||||
inline const_iterator(const iteratorEnd& unused);
|
||||
|
||||
// Member operators
|
||||
|
||||
// Access
|
||||
// Member operators
|
||||
|
||||
//- Return referenced hash value
|
||||
inline const T& operator*() const;
|
||||
@ -536,7 +538,6 @@ public:
|
||||
Ostream&,
|
||||
const HashTable<T, Key, Hash>&
|
||||
);
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -97,11 +97,10 @@ Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
|
||||
{}
|
||||
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
Foam::StaticHashTable<T, Key, Hash>::StaticHashTable
|
||||
(
|
||||
const Xfer< StaticHashTable<T, Key, Hash> >& ht
|
||||
const Xfer<StaticHashTable<T, Key, Hash> >& ht
|
||||
)
|
||||
:
|
||||
StaticHashTableCore(),
|
||||
@ -452,7 +451,6 @@ void Foam::StaticHashTable<T, Key, Hash>::clearStorage()
|
||||
}
|
||||
|
||||
|
||||
|
||||
template<class T, class Key, class Hash>
|
||||
void Foam::StaticHashTable<T, Key, Hash>::transfer
|
||||
(
|
||||
|
||||
@ -72,10 +72,6 @@ template<class T, class Key, class Hash> Ostream& operator<<
|
||||
);
|
||||
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class StaticHashTableName Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
/*---------------------------------------------------------------------------*\
|
||||
Class StaticHashTableCore Declaration
|
||||
\*---------------------------------------------------------------------------*/
|
||||
@ -100,7 +96,6 @@ struct StaticHashTableCore
|
||||
iteratorEnd()
|
||||
{}
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
|
||||
@ -135,6 +130,7 @@ class StaticHashTable
|
||||
//- Assign a new hashed entry to a possibly already existing key
|
||||
bool set(const Key&, const T& newElmt, bool protect);
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
@ -183,11 +179,11 @@ public:
|
||||
StaticHashTable(const StaticHashTable<T, Key, Hash>&);
|
||||
|
||||
//- 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
|
||||
@ -251,7 +247,7 @@ public:
|
||||
void transfer(StaticHashTable<T, Key, Hash>&);
|
||||
|
||||
//- Transfer contents to the Xfer container
|
||||
inline Xfer< StaticHashTable<T, Key, Hash> > xfer();
|
||||
inline Xfer<StaticHashTable<T, Key, Hash> > xfer();
|
||||
|
||||
|
||||
// Member Operators
|
||||
@ -275,6 +271,7 @@ public:
|
||||
//- The opposite of the equality operation.
|
||||
bool operator!=(const StaticHashTable<T, Key, Hash>&) const;
|
||||
|
||||
|
||||
// STL type definitions
|
||||
|
||||
//- Type of values the StaticHashTable contains.
|
||||
@ -317,6 +314,7 @@ public:
|
||||
//- Index of current element at hashIndex
|
||||
label elemIndex_;
|
||||
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -79,7 +79,7 @@ inline bool Foam::StaticHashTable<T, Key, Hash>::set
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
return xferMove(*this);
|
||||
@ -417,6 +417,4 @@ Foam::StaticHashTable<T, Key, Hash>::end() const
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// ************************************************************************* //
|
||||
|
||||
@ -74,7 +74,7 @@ public:
|
||||
(
|
||||
const UList<T>& posList,
|
||||
const UList<T>& negList,
|
||||
const Xfer< List<label> >&
|
||||
const Xfer<List<label> >&
|
||||
);
|
||||
|
||||
|
||||
@ -102,7 +102,7 @@ public:
|
||||
|
||||
//- Reset addressing
|
||||
inline void resetAddressing(const UList<label>&);
|
||||
inline void resetAddressing(const Xfer< List<label> >&);
|
||||
inline void resetAddressing(const Xfer<List<label> >&);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -45,7 +45,7 @@ inline Foam::BiIndirectList<T>::BiIndirectList
|
||||
(
|
||||
const UList<T>& posList,
|
||||
const UList<T>& negList,
|
||||
const Xfer< List<label> >& addr
|
||||
const Xfer<List<label> >& addr
|
||||
)
|
||||
:
|
||||
posList_(const_cast<UList<T>&>(posList)),
|
||||
@ -105,7 +105,7 @@ inline void Foam::BiIndirectList<T>::resetAddressing
|
||||
template<class T>
|
||||
inline void Foam::BiIndirectList<T>::resetAddressing
|
||||
(
|
||||
const Xfer< List<label> >& addr
|
||||
const Xfer<List<label> >& addr
|
||||
)
|
||||
{
|
||||
addressing_.transfer(addr());
|
||||
|
||||
@ -224,7 +224,7 @@ inline Foam::UList<T> Foam::CompactListList<T, Container>::operator[]
|
||||
)
|
||||
{
|
||||
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];
|
||||
return UList<T>
|
||||
(
|
||||
const_cast<T*>(&m_[start]),
|
||||
(m_.size() ? const_cast<T*>(&m_[start]) : NULL),
|
||||
offsets_[i+1] - start
|
||||
);
|
||||
}
|
||||
|
||||
@ -84,7 +84,6 @@ class DynamicList
|
||||
//- The capacity (allocated size) of the underlying list.
|
||||
label capacity_;
|
||||
|
||||
// Private Member Functions
|
||||
|
||||
public:
|
||||
|
||||
@ -93,6 +92,7 @@ public:
|
||||
//- Declare friendship with the List class
|
||||
friend class List<T>;
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct null
|
||||
@ -115,7 +115,7 @@ public:
|
||||
explicit inline DynamicList(const UIndirectList<T>&);
|
||||
|
||||
//- 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.
|
||||
explicit DynamicList(Istream&);
|
||||
@ -125,103 +125,105 @@ public:
|
||||
|
||||
// Access
|
||||
|
||||
//- Size of the underlying storage.
|
||||
inline label capacity() const;
|
||||
//- Size of the underlying storage.
|
||||
inline label capacity() const;
|
||||
|
||||
// Edit
|
||||
|
||||
//- Alter the size of the underlying storage.
|
||||
// The addressed size will be truncated if needed to fit, but will
|
||||
// remain otherwise untouched.
|
||||
// Use this or reserve() in combination with append().
|
||||
inline void setCapacity(const label);
|
||||
//- Alter the size of the underlying storage.
|
||||
// The addressed size will be truncated if needed to fit, but will
|
||||
// remain otherwise untouched.
|
||||
// Use this or reserve() in combination with append().
|
||||
inline void setCapacity(const label);
|
||||
|
||||
//- Alter the addressed list size.
|
||||
// New space will be allocated if required.
|
||||
// Use this to resize the list prior to using the operator[] for
|
||||
// setting values (as per List usage).
|
||||
inline void setSize(const label);
|
||||
//- Alter the addressed list size.
|
||||
// New space will be allocated if required.
|
||||
// Use this to resize the list prior to using the operator[] for
|
||||
// setting values (as per List usage).
|
||||
inline void setSize(const label);
|
||||
|
||||
//- Alter the addressed list size and fill new space with a constant.
|
||||
inline void setSize(const label, const T&);
|
||||
//- Alter the addressed list size and fill new space with a constant.
|
||||
inline void setSize(const label, const T&);
|
||||
|
||||
//- Alter the addressed list size.
|
||||
// New space will be allocated if required.
|
||||
// Use this to resize the list prior to using the operator[] for
|
||||
// setting values (as per List usage).
|
||||
inline void resize(const label);
|
||||
//- Alter the addressed list size.
|
||||
// New space will be allocated if required.
|
||||
// Use this to resize the list prior to using the operator[] for
|
||||
// setting values (as per List usage).
|
||||
inline void resize(const label);
|
||||
|
||||
//- Alter the addressed list size and fill new space with a constant.
|
||||
inline void resize(const label, const T&);
|
||||
//- Alter the addressed list size and fill new space with a constant.
|
||||
inline void resize(const label, const T&);
|
||||
|
||||
//- Reserve allocation space for at least this size.
|
||||
// Never shrinks the allocated size, use setCapacity() for that.
|
||||
inline void reserve(const label);
|
||||
//- Reserve allocation space for at least this size.
|
||||
// Never shrinks the allocated size, use setCapacity() for that.
|
||||
inline void reserve(const label);
|
||||
|
||||
//- Clear the addressed list, i.e. set the size to zero.
|
||||
// Allocated size does not change
|
||||
inline void clear();
|
||||
//- Clear the addressed list, i.e. set the size to zero.
|
||||
// Allocated size does not change
|
||||
inline void clear();
|
||||
|
||||
//- Clear the list and delete storage.
|
||||
inline void clearStorage();
|
||||
//- Clear the list and delete storage.
|
||||
inline void clearStorage();
|
||||
|
||||
//- Shrink the allocated space to the number of elements used.
|
||||
// Returns a reference to the DynamicList.
|
||||
inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink();
|
||||
//- Shrink the allocated space to the number of elements used.
|
||||
// Returns a reference to the DynamicList.
|
||||
inline DynamicList<T, SizeInc, SizeMult, SizeDiv>& shrink();
|
||||
|
||||
//- Transfer contents of the argument List into this DynamicList
|
||||
inline void transfer(List<T>&);
|
||||
//- Transfer contents of the argument List into this DynamicList
|
||||
inline void transfer(List<T>&);
|
||||
|
||||
//- Transfer contents of the argument DynamicList into this DynamicList
|
||||
inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
|
||||
//- Transfer contents of the argument DynamicList into this DynamicList
|
||||
inline void transfer(DynamicList<T, SizeInc, SizeMult, SizeDiv>&);
|
||||
|
||||
//- Transfer contents to the Xfer container as a plain List
|
||||
inline Xfer< List<T> > xfer();
|
||||
//- Transfer contents to the Xfer container as a plain List
|
||||
inline Xfer<List<T> > xfer();
|
||||
|
||||
// Member Operators
|
||||
|
||||
//- Append an element at the end of the list
|
||||
inline void append(const T&);
|
||||
// Member Operators
|
||||
|
||||
//- Append a List at the end of this list
|
||||
inline void append(const UList<T>&);
|
||||
//- Append an element at the end of the list
|
||||
inline void append(const T&);
|
||||
|
||||
//- Append a UIndirectList at the end of this list
|
||||
inline void append(const UIndirectList<T>&);
|
||||
//- Append a List at the end of this list
|
||||
inline void append(const UList<T>&);
|
||||
|
||||
//- Remove and return the top element
|
||||
inline T remove();
|
||||
//- Append a UIndirectList at the end of this list
|
||||
inline void append(const UIndirectList<T>&);
|
||||
|
||||
//- Return non-const access to an element, resizing list if necessary
|
||||
inline T& operator()(const label);
|
||||
//- Remove and return the top element
|
||||
inline T remove();
|
||||
|
||||
//- Assignment of all addressed entries to the given value
|
||||
inline void operator=(const T&);
|
||||
//- Return non-const access to an element, resizing list if necessary
|
||||
inline T& operator()(const label);
|
||||
|
||||
//- Assignment from DynamicList
|
||||
inline void operator=
|
||||
(
|
||||
const DynamicList<T, SizeInc, SizeMult, SizeDiv>&
|
||||
);
|
||||
//- Assignment of all addressed entries to the given value
|
||||
inline void operator=(const T&);
|
||||
|
||||
//- Assignment from UList
|
||||
inline void operator=(const UList<T>&);
|
||||
//- Assignment from DynamicList
|
||||
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.
|
||||
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
|
||||
(
|
||||
Istream&,
|
||||
DynamicList<T, SizeInc, SizeMult, SizeDiv>&
|
||||
);
|
||||
// IOstream operators
|
||||
|
||||
// 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.
|
||||
friend Istream& operator>> <T, SizeInc, SizeMult, SizeDiv>
|
||||
(
|
||||
Istream&,
|
||||
DynamicList<T, SizeInc, SizeMult, SizeDiv>&
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -298,7 +298,7 @@ Foam::DynamicList<T, SizeInc, SizeMult, SizeDiv>::transfer
|
||||
|
||||
|
||||
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()
|
||||
{
|
||||
return xferMoveTo< List<T> >(*this);
|
||||
|
||||
@ -64,7 +64,8 @@ public:
|
||||
inline IndirectList(const UList<T>&, const UList<label>&);
|
||||
|
||||
//- 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
|
||||
|
||||
@ -94,11 +95,12 @@ public:
|
||||
//- Return the list addressing
|
||||
inline const List<label>& addressing() const;
|
||||
|
||||
|
||||
// Edit
|
||||
|
||||
//- Reset addressing
|
||||
inline void resetAddressing(const UList<label>&);
|
||||
inline void resetAddressing(const Xfer< List<label> >&);
|
||||
inline void resetAddressing(const Xfer<List<label> >&);
|
||||
|
||||
|
||||
// Member Operators
|
||||
|
||||
@ -42,7 +42,7 @@ template<class T>
|
||||
inline Foam::IndirectList<T>::IndirectList
|
||||
(
|
||||
const UList<T>& completeList,
|
||||
const Xfer< List<label> >& addr
|
||||
const Xfer<List<label> >& addr
|
||||
)
|
||||
:
|
||||
completeList_(const_cast<UList<T>&>(completeList)),
|
||||
@ -121,7 +121,7 @@ inline void Foam::IndirectList<T>::resetAddressing
|
||||
template<class T>
|
||||
inline void Foam::IndirectList<T>::resetAddressing
|
||||
(
|
||||
const Xfer< List<label> >& addr
|
||||
const Xfer<List<label> >& addr
|
||||
)
|
||||
{
|
||||
addressing_.transfer(addr());
|
||||
|
||||
@ -38,7 +38,8 @@ Foam::IPstream::IPstream
|
||||
)
|
||||
:
|
||||
Pstream(commsType, bufSize),
|
||||
UIPstream(commsType, fromProcNo, buf_)
|
||||
UIPstream(commsType, fromProcNo, buf_, externalBufPosition_),
|
||||
externalBufPosition_(0)
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -55,6 +55,9 @@ class IPstream
|
||||
public UIPstream
|
||||
{
|
||||
|
||||
//- Receive index
|
||||
label externalBufPosition_;
|
||||
|
||||
public:
|
||||
|
||||
// Constructors
|
||||
|
||||
@ -51,10 +51,31 @@ Foam::PstreamBuffers::PstreamBuffers
|
||||
version_(version),
|
||||
sendBuf_(UPstream::nProcs()),
|
||||
recvBuf_(UPstream::nProcs()),
|
||||
recvBufPos_(UPstream::nProcs(), 0),
|
||||
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 * * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::PstreamBuffers::finishedSends(const bool block)
|
||||
|
||||
@ -106,6 +106,9 @@ class PstreamBuffers
|
||||
//- receive buffer
|
||||
List<DynamicList<char> > recvBuf_;
|
||||
|
||||
//- read position in recvBuf_
|
||||
labelList recvBufPos_;
|
||||
|
||||
bool finishedSendsCalled_;
|
||||
|
||||
// Private member functions
|
||||
@ -129,6 +132,10 @@ public:
|
||||
IOstream::versionNumber version=IOstream::currentVersion
|
||||
);
|
||||
|
||||
// Destructor
|
||||
|
||||
~PstreamBuffers();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
|
||||
@ -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 * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::Istream& Foam::UIPstream::read(token& t)
|
||||
|
||||
@ -63,7 +63,7 @@ class UIPstream
|
||||
|
||||
DynamicList<char>& externalBuf_;
|
||||
|
||||
label externalBufPosition_;
|
||||
label& externalBufPosition_;
|
||||
|
||||
const int tag_;
|
||||
|
||||
@ -94,6 +94,7 @@ public:
|
||||
const commsTypes commsType,
|
||||
const int fromProcNo,
|
||||
DynamicList<char>& externalBuf,
|
||||
label& externalBufPosition,
|
||||
const int tag = UPstream::msgType(),
|
||||
streamFormat format=BINARY,
|
||||
versionNumber version=currentVersion
|
||||
@ -103,11 +104,6 @@ public:
|
||||
UIPstream(const int fromProcNo, PstreamBuffers&);
|
||||
|
||||
|
||||
// Destructor
|
||||
|
||||
~UIPstream();
|
||||
|
||||
|
||||
// Member functions
|
||||
|
||||
// Inquiry
|
||||
|
||||
@ -220,6 +220,30 @@ Foam::List<int> Foam::UPstream::procIDs_(1, 0);
|
||||
// Standard transfer message type
|
||||
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
|
||||
Foam::List<Foam::UPstream::commsStruct> Foam::UPstream::linearCommunication_(0);
|
||||
|
||||
|
||||
@ -46,6 +46,7 @@ SourceFiles
|
||||
#include "HashTable.H"
|
||||
#include "string.H"
|
||||
#include "NamedEnum.H"
|
||||
#include "LIFOStack.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -191,6 +192,14 @@ private:
|
||||
static List<commsStruct> treeCommunication_;
|
||||
|
||||
|
||||
//- Current free tag
|
||||
static int freeTag_;
|
||||
|
||||
//- Freed tags
|
||||
static LIFOStack<int> freedTags_;
|
||||
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
//- Set data for parallel running
|
||||
@ -340,6 +349,11 @@ public:
|
||||
{
|
||||
return msgType_;
|
||||
}
|
||||
//- Allocate new tag
|
||||
static int allocateTag();
|
||||
|
||||
//- Release allocated tag
|
||||
static void freeTag(const int tag);
|
||||
|
||||
|
||||
//- Get the communications type of the stream
|
||||
|
||||
@ -298,7 +298,11 @@ evaluate()
|
||||
}
|
||||
|
||||
// Block for any outstanding requests
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
if
|
||||
(
|
||||
Pstream::parRun()
|
||||
&& Pstream::defaultCommsType == Pstream::nonBlocking
|
||||
)
|
||||
{
|
||||
Pstream::waitRequests();
|
||||
}
|
||||
|
||||
@ -108,7 +108,8 @@ void processorPointPatchField<Type>::initSwapAdd(Field<Type>& pField) const
|
||||
Pstream::blocking,
|
||||
procPatch_.neighbProcNo(),
|
||||
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,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(pnf.begin()),
|
||||
pnf.byteSize()
|
||||
pnf.byteSize(),
|
||||
procPatch_.tag()
|
||||
);
|
||||
|
||||
if (doTransform())
|
||||
|
||||
@ -109,7 +109,8 @@ const
|
||||
Pstream::blocking,
|
||||
procPatch_.neighbProcNo(),
|
||||
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,
|
||||
procPatch_.neighbProcNo(),
|
||||
reinterpret_cast<char*>(pnf.begin()),
|
||||
pnf.byteSize()
|
||||
pnf.byteSize(),
|
||||
procPatch_.tag()
|
||||
);
|
||||
|
||||
if (doTransform())
|
||||
|
||||
@ -33,8 +33,7 @@ Description
|
||||
#ifndef parRun_H
|
||||
#define parRun_H
|
||||
|
||||
#include "OPstream.H"
|
||||
#include "IPstream.H"
|
||||
#include "Pstream.H"
|
||||
#include "IOstreams.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -95,6 +95,9 @@ public:
|
||||
//- Return face transformation tensor
|
||||
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).
|
||||
// // Returns reference to buffer (note:buffer.size() is number
|
||||
// // of characters, not nElems)
|
||||
|
||||
@ -87,7 +87,8 @@ void Foam::processorLduInterface::send
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
reinterpret_cast<const char*>(f.begin()),
|
||||
f.byteSize()
|
||||
f.byteSize(),
|
||||
tag()
|
||||
);
|
||||
}
|
||||
else if (commsType == Pstream::nonBlocking)
|
||||
@ -100,7 +101,8 @@ void Foam::processorLduInterface::send
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.begin(),
|
||||
receiveBuf_.size()
|
||||
receiveBuf_.size(),
|
||||
tag()
|
||||
);
|
||||
|
||||
//setSendBuf<Type>(f.size());
|
||||
@ -112,7 +114,8 @@ void Foam::processorLduInterface::send
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
sendBuf_.begin(),
|
||||
f.byteSize()
|
||||
f.byteSize(),
|
||||
tag()
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -138,7 +141,8 @@ void Foam::processorLduInterface::receive
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
reinterpret_cast<char*>(f.begin()),
|
||||
f.byteSize()
|
||||
f.byteSize(),
|
||||
tag()
|
||||
);
|
||||
}
|
||||
else if (commsType == Pstream::nonBlocking)
|
||||
@ -202,7 +206,8 @@ void Foam::processorLduInterface::compressedSend
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
sendBuf_.begin(),
|
||||
nBytes
|
||||
nBytes,
|
||||
tag()
|
||||
);
|
||||
}
|
||||
else if (commsType == Pstream::nonBlocking)
|
||||
@ -215,7 +220,8 @@ void Foam::processorLduInterface::compressedSend
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.begin(),
|
||||
receiveBuf_.size()
|
||||
receiveBuf_.size(),
|
||||
tag()
|
||||
);
|
||||
|
||||
OPstream::write
|
||||
@ -223,7 +229,8 @@ void Foam::processorLduInterface::compressedSend
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
sendBuf_.begin(),
|
||||
nBytes
|
||||
nBytes,
|
||||
tag()
|
||||
);
|
||||
}
|
||||
else
|
||||
@ -264,7 +271,8 @@ void Foam::processorLduInterface::compressedReceive
|
||||
commsType,
|
||||
neighbProcNo(),
|
||||
receiveBuf_.begin(),
|
||||
nBytes
|
||||
nBytes,
|
||||
tag()
|
||||
);
|
||||
}
|
||||
else if (commsType != Pstream::nonBlocking)
|
||||
@ -350,7 +358,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// sendBuf_.begin(),
|
||||
// sendBuf_.size()
|
||||
// sendBuf_.size(),
|
||||
// tag()
|
||||
// );
|
||||
// }
|
||||
// else if (commsType == Pstream::nonBlocking)
|
||||
@ -362,7 +371,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// receiveBuf_.begin(),
|
||||
// receiveBuf_.size()
|
||||
// receiveBuf_.size(),
|
||||
// tag()
|
||||
// );
|
||||
//
|
||||
// OPstream::write
|
||||
@ -370,7 +380,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// sendBuf_.begin(),
|
||||
// sendBuf_.size()
|
||||
// sendBuf_.size(),
|
||||
// tag()
|
||||
// );
|
||||
// }
|
||||
// else
|
||||
@ -405,7 +416,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// receiveBuf_.begin(),
|
||||
// receiveBuf_.size()
|
||||
// receiveBuf_.size(),
|
||||
// tag()
|
||||
// );
|
||||
// }
|
||||
// else if (commsType != Pstream::nonBlocking)
|
||||
@ -441,7 +453,8 @@ Foam::tmp<Foam::Field<Type> > Foam::processorLduInterface::compressedReceive
|
||||
// commsType,
|
||||
// neighbProcNo(),
|
||||
// receiveBuf_.begin(),
|
||||
// receiveBuf_.size()
|
||||
// receiveBuf_.size(),
|
||||
// tag()
|
||||
// );
|
||||
// }
|
||||
// else if (commsType != Pstream::nonBlocking)
|
||||
|
||||
@ -112,10 +112,13 @@ void Foam::lduMatrix::updateMatrixInterfaces
|
||||
)
|
||||
{
|
||||
// Block until all sends/receives have been finished
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
if
|
||||
(
|
||||
Pstream::parRun()
|
||||
&& Pstream::defaultCommsType == Pstream::nonBlocking
|
||||
)
|
||||
{
|
||||
IPstream::waitRequests();
|
||||
OPstream::waitRequests();
|
||||
UPstream::waitRequests();
|
||||
}
|
||||
|
||||
forAll (interfaces, interfaceI)
|
||||
|
||||
@ -81,20 +81,13 @@ void Foam::cyclicGAMGInterfaceField::updateInterfaceMatrix
|
||||
const Pstream::commsTypes
|
||||
) const
|
||||
{
|
||||
scalarField pnf(size());
|
||||
|
||||
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]];
|
||||
}
|
||||
// 'send' neighbouring field
|
||||
scalarField pnf(cyclicInterface_.interfaceInternalField(psiInternal)());
|
||||
|
||||
transformCoupleField(pnf, cmpt);
|
||||
|
||||
const unallocLabelList& faceCells = cyclicInterface_.faceCells();
|
||||
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||
|
||||
@ -136,6 +136,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
//- Return message tag to use for communication
|
||||
virtual int tag() const
|
||||
{
|
||||
return procPolyPatch_.tag();
|
||||
}
|
||||
|
||||
//- Return processor number
|
||||
int myProcNo() const
|
||||
{
|
||||
|
||||
@ -382,7 +382,8 @@ processorCyclicPointPatch::processorCyclicPointPatch
|
||||
const pointBoundaryMesh& bm
|
||||
)
|
||||
:
|
||||
processorPointPatch(patch, bm)
|
||||
processorPointPatch(patch, bm),
|
||||
procCycPolyPatch_(refCast<const processorCyclicPolyPatch>(patch))
|
||||
{}
|
||||
|
||||
|
||||
|
||||
@ -60,6 +60,9 @@ class processorCyclicPointPatch
|
||||
:
|
||||
public processorPointPatch
|
||||
{
|
||||
// Private data
|
||||
|
||||
const processorCyclicPolyPatch& procCycPolyPatch_;
|
||||
|
||||
//- Disallow default construct as copy
|
||||
processorCyclicPointPatch(const processorCyclicPointPatch&);
|
||||
@ -90,6 +93,13 @@ public:
|
||||
|
||||
// Member functions
|
||||
|
||||
|
||||
//- Return message tag to use for communication
|
||||
virtual int tag() const
|
||||
{
|
||||
return procCycPolyPatch_.tag();
|
||||
}
|
||||
|
||||
// //- Return true if running parallel
|
||||
// virtual bool coupled() const
|
||||
// {
|
||||
|
||||
@ -78,34 +78,38 @@ void Foam::globalMeshData::initProcAddr()
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send indices of my processor patches to my neighbours
|
||||
forAll (processorPatches_, i)
|
||||
{
|
||||
label patchi = processorPatches_[i];
|
||||
|
||||
OPstream toNeighbour
|
||||
UOPstream toNeighbour
|
||||
(
|
||||
Pstream::blocking,
|
||||
refCast<const processorPolyPatch>
|
||||
(
|
||||
mesh_.boundaryMesh()[patchi]
|
||||
).neighbProcNo()
|
||||
).neighbProcNo(),
|
||||
pBufs
|
||||
);
|
||||
|
||||
toNeighbour << processorPatchIndices_[patchi];
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
forAll(processorPatches_, i)
|
||||
{
|
||||
label patchi = processorPatches_[i];
|
||||
|
||||
IPstream fromNeighbour
|
||||
UIPstream fromNeighbour
|
||||
(
|
||||
Pstream::blocking,
|
||||
refCast<const processorPolyPatch>
|
||||
(
|
||||
mesh_.boundaryMesh()[patchi]
|
||||
).neighbProcNo()
|
||||
).neighbProcNo(),
|
||||
pBufs
|
||||
);
|
||||
|
||||
fromNeighbour >> processorPatchNeighbours_[patchi];
|
||||
@ -1560,6 +1564,8 @@ void Foam::globalMeshData::updateMesh()
|
||||
pointStatus.set(meshPointI, SHARED);
|
||||
}
|
||||
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send patch local points
|
||||
forAll(processorPatches_, i)
|
||||
{
|
||||
@ -1568,11 +1574,13 @@ void Foam::globalMeshData::updateMesh()
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
|
||||
|
||||
OPstream toNeighbour(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||
|
||||
toNeighbour << procPatch.localPoints();
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive patch local points and uncount if coincident (and not shared)
|
||||
forAll(processorPatches_, i)
|
||||
{
|
||||
@ -1581,7 +1589,7 @@ void Foam::globalMeshData::updateMesh()
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(mesh_.boundaryMesh()[patchI]);
|
||||
|
||||
IPstream fromNeighbour(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||
|
||||
pointField nbrPoints(fromNeighbour);
|
||||
|
||||
|
||||
@ -431,17 +431,16 @@ void Foam::globalPoints::receivePatchPoints
|
||||
const cyclicPolyPatch& cycPatch =
|
||||
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(coupledPoints(cycPatch));
|
||||
//const edgeList connections(coupledPoints(cycPatch));
|
||||
|
||||
forAll(connections, i)
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
const edge& e = connections[i];
|
||||
|
||||
label meshPointA = meshPoints[e[0]];
|
||||
label meshPointB = meshPoints[e[1]];
|
||||
label meshPointA = meshPoints[i];
|
||||
label meshPointB = coupledMeshPoints[i];
|
||||
|
||||
label localA = meshToLocalPoint
|
||||
(
|
||||
@ -823,13 +822,15 @@ void Foam::globalPoints::receiveSharedPoints
|
||||
|
||||
// Sync all info.
|
||||
//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 = pp.meshPoints()[e[0]];
|
||||
label meshPointB = pp.meshPoints()[e[1]];
|
||||
label meshPointA = meshPoints[i];
|
||||
label meshPointB = coupledMeshPoints[i];
|
||||
|
||||
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.
|
||||
// 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.
|
||||
const cyclicPolyPatch& nbrPatch = pp.neighbPatch();
|
||||
|
||||
// From halfA point to halfB or -1.
|
||||
labelList coupledPoint(pp.nPoints(), -1);
|
||||
faceList masterFaces(nbrPatch.size());
|
||||
|
||||
for (label patchFaceA = 0; patchFaceA < pp.size()/2; patchFaceA++)
|
||||
forAll (nbrPatch, faceI)
|
||||
{
|
||||
const face& fA = pp.localFaces()[patchFaceA];
|
||||
|
||||
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];
|
||||
}
|
||||
}
|
||||
masterFaces[faceI] = nbrPatch[faceI].reverseFace();
|
||||
}
|
||||
|
||||
edgeList connected(pp.nPoints());
|
||||
|
||||
// Extract coupled points.
|
||||
label connectedI = 0;
|
||||
|
||||
forAll(coupledPoint, i)
|
||||
{
|
||||
if (coupledPoint[i] != -1)
|
||||
{
|
||||
connected[connectedI++] = edge(i, coupledPoint[i]);
|
||||
}
|
||||
}
|
||||
|
||||
connected.setSize(connectedI);
|
||||
|
||||
return connected;
|
||||
return primitiveFacePatch
|
||||
(
|
||||
masterFaces,
|
||||
nbrPatch.points()
|
||||
).meshPoints();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -156,9 +156,6 @@ class globalPoints
|
||||
// information is collected.
|
||||
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
|
||||
// buffers (patchFaces, indexInFace etc.)
|
||||
static void addToSend
|
||||
@ -246,9 +243,8 @@ class globalPoints
|
||||
labelList&
|
||||
);
|
||||
|
||||
//- Should move into cyclicPolyPatch ordering problem
|
||||
// keeps on giving problems.
|
||||
static edgeList coupledPoints(const cyclicPolyPatch&);
|
||||
//- Return mesh points of other side in same order as my meshPoints.
|
||||
static labelList reverseMeshPoints(const cyclicPolyPatch&);
|
||||
|
||||
//- Do all calculations.
|
||||
void calculateSharedPoints
|
||||
|
||||
@ -75,7 +75,7 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
|
||||
slave++
|
||||
)
|
||||
{
|
||||
IPstream fromSlave(Pstream::blocking, slave);
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
List<labelPair> nbrData(fromSlave);
|
||||
|
||||
forAll(nbrData, i)
|
||||
@ -96,18 +96,18 @@ Foam::List<Foam::labelPair> Foam::mapDistribute::schedule
|
||||
slave++
|
||||
)
|
||||
{
|
||||
OPstream toSlave(Pstream::blocking, slave);
|
||||
OPstream toSlave(Pstream::scheduled, slave);
|
||||
toSlave << allComms;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster << allComms;
|
||||
}
|
||||
{
|
||||
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
|
||||
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
fromMaster >> allComms;
|
||||
}
|
||||
}
|
||||
@ -596,6 +596,7 @@ void Foam::mapDistribute::compact(const boolList& elemIsUsed)
|
||||
|
||||
// Send elemIsUsed field to neighbour. Use nonblocking code from
|
||||
// mapDistribute but in reverse order.
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
List<boolList> sendFields(Pstream::nProcs());
|
||||
|
||||
|
||||
@ -42,6 +42,30 @@ void Foam::mapDistribute::distribute
|
||||
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)
|
||||
{
|
||||
// Since buffered sending can reuse the field to collect the
|
||||
@ -407,6 +431,30 @@ void Foam::mapDistribute::distribute
|
||||
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)
|
||||
{
|
||||
// Since buffered sending can reuse the field to collect the
|
||||
|
||||
@ -294,13 +294,13 @@ Foam::polyMesh::polyMesh(const IOobject& io)
|
||||
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||
boundary_.calcGeometry();
|
||||
|
||||
// Warn if global empty mesh (constructs globalData!)
|
||||
if (globalData().nTotalPoints() == 0)
|
||||
// Warn if global empty mesh
|
||||
if (returnReduce(nPoints(), sumOp<label>()) == 0)
|
||||
{
|
||||
WarningIn("polyMesh(const IOobject&)")
|
||||
<< "no points in mesh" << endl;
|
||||
}
|
||||
if (globalData().nTotalCells() == 0)
|
||||
if (returnReduce(nCells(), sumOp<label>()) == 0)
|
||||
{
|
||||
WarningIn("polyMesh(const IOobject&)")
|
||||
<< "no cells in mesh" << endl;
|
||||
@ -744,8 +744,12 @@ void Foam::polyMesh::resetPrimitives
|
||||
// Calculate the geometry for the patches (transformation tensors etc.)
|
||||
boundary_.calcGeometry();
|
||||
|
||||
// Warn if global empty mesh (constructs globalData!)
|
||||
if (globalData().nTotalPoints() == 0 || globalData().nTotalCells() == 0)
|
||||
// Warn if global empty mesh
|
||||
if
|
||||
(
|
||||
(returnReduce(nPoints(), sumOp<label>()) == 0)
|
||||
|| (returnReduce(nCells(), sumOp<label>()) == 0)
|
||||
)
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
|
||||
@ -265,7 +265,8 @@ void Foam::coupledPolyPatch::calcTransformTensors
|
||||
Pout<< "coupledPolyPatch::calcTransformTensors : " << name() << endl
|
||||
<< " (half)size:" << Cf.size() << 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;
|
||||
}
|
||||
|
||||
@ -277,7 +278,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
|
||||
// Then the overall error of summing the normals is sqrt(size())*absTol
|
||||
// - separation calculation: pass in from the outside an allowable error.
|
||||
|
||||
if (size() == 0)
|
||||
if (Cf.size() == 0)
|
||||
{
|
||||
// Dummy geometry.
|
||||
separated = false;
|
||||
@ -308,7 +309,7 @@ void Foam::coupledPolyPatch::calcTransformTensors
|
||||
|
||||
|
||||
// Check
|
||||
forAll (forwardT, facei)
|
||||
forAll(forwardT, facei)
|
||||
{
|
||||
tensor T = rotationTensor(-nr[facei], nf[facei]);
|
||||
|
||||
|
||||
@ -235,6 +235,15 @@ public:
|
||||
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.
|
||||
//!! TDB with macros?
|
||||
virtual bool doTransform() const = 0;
|
||||
|
||||
@ -175,13 +175,6 @@ void Foam::cyclicPolyPatch::calcTransforms
|
||||
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())
|
||||
{
|
||||
FatalErrorIn
|
||||
@ -265,16 +258,6 @@ Pout<< "cyclicPolyPatch::calcTransforms : name:" << name() << endl
|
||||
half1Normals,
|
||||
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)
|
||||
{
|
||||
Info<< "getConsistentRotationFace(const pointField&)" << nl
|
||||
Pout<< "getConsistentRotationFace(const pointField&)" << nl
|
||||
<< " rotFace = " << rotFace << nl
|
||||
<< " point = " << faceCentres[rotFace] << endl;
|
||||
}
|
||||
@ -679,7 +662,7 @@ void Foam::cyclicPolyPatch::calcGeometry
|
||||
//polyPatch::calcGeometry();
|
||||
|
||||
Pout<< "cyclicPolyPatch::calcGeometry : name:" << name()
|
||||
<< " referred from:" << referPatch.size() << endl;
|
||||
<< " referred from a patch with nFaces:" << referPatch.size() << endl;
|
||||
|
||||
calcTransforms
|
||||
(
|
||||
@ -694,7 +677,6 @@ Pout<< "cyclicPolyPatch::calcGeometry : name:" << name()
|
||||
|
||||
void Foam::cyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
Pout<< "cyclicPolyPatch::calcGeometry() for " << name() << endl;
|
||||
calcGeometry
|
||||
(
|
||||
*this,
|
||||
|
||||
@ -417,34 +417,34 @@ public:
|
||||
|
||||
// Low level geometric information
|
||||
|
||||
//- Are the coupled planes separated
|
||||
virtual bool separated() const
|
||||
{
|
||||
return separated_;
|
||||
}
|
||||
//- Are the coupled planes separated
|
||||
virtual bool separated() const
|
||||
{
|
||||
return separated_;
|
||||
}
|
||||
|
||||
virtual const vector& separation() const
|
||||
{
|
||||
return separation_;
|
||||
}
|
||||
virtual const vector& separation() const
|
||||
{
|
||||
return separation_;
|
||||
}
|
||||
|
||||
//- Are the cyclic planes parallel
|
||||
virtual bool parallel() const
|
||||
{
|
||||
return parallel_;
|
||||
}
|
||||
//- Are the cyclic planes parallel
|
||||
virtual bool parallel() const
|
||||
{
|
||||
return parallel_;
|
||||
}
|
||||
|
||||
//- Return face transformation tensor
|
||||
virtual const tensor& forwardT() const
|
||||
{
|
||||
return forwardT_;
|
||||
}
|
||||
//- Return face transformation tensor
|
||||
virtual const tensor& forwardT() const
|
||||
{
|
||||
return forwardT_;
|
||||
}
|
||||
|
||||
//- Return neighbour-cell transformation tensor
|
||||
virtual const tensor& reverseT() const
|
||||
{
|
||||
return reverseT_;
|
||||
}
|
||||
//- Return neighbour-cell transformation tensor
|
||||
virtual const tensor& reverseT() const
|
||||
{
|
||||
return reverseT_;
|
||||
}
|
||||
|
||||
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
|
||||
// refer to *this (except for name() and type() etc.)
|
||||
virtual void initOrder(PstreamBuffers&, const primitivePatch&) const;
|
||||
|
||||
@ -158,7 +158,7 @@ Foam::processorPolyPatch::~processorPolyPatch()
|
||||
|
||||
void Foam::processorPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
Pout<< "**processorPolyPatch::initGeometry()" << endl;
|
||||
//Pout<< "**processorPolyPatch::initGeometry()" << endl;
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
UOPstream toNeighbProc(neighbProcNo(), pBufs);
|
||||
@ -187,22 +187,94 @@ Pout<< "processorPolyPatch::calcGeometry() for " << name() << endl;
|
||||
|
||||
Pout<< "processorPolyPatch::calcGeometry() : received data for "
|
||||
<< neighbFaceCentres_.size() << " faces." << endl;
|
||||
//Pout<< "**neighbFaceCentres_:" << neighbFaceCentres_ << endl;
|
||||
//Pout<< "**neighbFaceAreas_:" << neighbFaceAreas_ << endl;
|
||||
//Pout<< "**neighbFaceCellCentres_:" << neighbFaceCellCentres_ << endl;
|
||||
|
||||
calcGeometry
|
||||
(
|
||||
*this,
|
||||
faceCentres(),
|
||||
faceAreas(),
|
||||
faceCellCentres()(),
|
||||
neighbFaceCentres_,
|
||||
neighbFaceAreas_,
|
||||
neighbFaceCellCentres_
|
||||
);
|
||||
|
||||
|
||||
// // My normals
|
||||
// vectorField faceNormals(size());
|
||||
//
|
||||
// // Neighbour normals
|
||||
// vectorField nbrFaceNormals(neighbFaceAreas_.size());
|
||||
//
|
||||
// // 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
|
||||
// be different from one over here.
|
||||
IPstream fromNeighbProc(Pstream::blocking, neighbProcNo());
|
||||
UIPstream fromNeighbProc(neighbProcNo(), pBufs);
|
||||
|
||||
fromNeighbProc
|
||||
>> nbrPointFace
|
||||
|
||||
@ -292,6 +292,12 @@ public:
|
||||
//- Return neighbour edge labels. WIP.
|
||||
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.
|
||||
virtual bool doTransform() const
|
||||
{
|
||||
@ -317,21 +323,21 @@ public:
|
||||
//- Are the planes separated.
|
||||
virtual bool separated() const
|
||||
{
|
||||
notImplemented("processorPolyPatch::separated(..)");
|
||||
//notImplemented("processorPolyPatch::separated(..)");
|
||||
return false;
|
||||
}
|
||||
|
||||
//- If the planes are separated the separation vector.
|
||||
virtual const vector& separation() const
|
||||
{
|
||||
notImplemented("processorPolyPatch::separation(..)");
|
||||
//notImplemented("processorPolyPatch::separation(..)");
|
||||
return vector::zero;
|
||||
}
|
||||
|
||||
//- Are the cyclic planes parallel.
|
||||
virtual bool parallel() const
|
||||
{
|
||||
notImplemented("processorPolyPatch::parallel()");
|
||||
//notImplemented("processorPolyPatch::parallel()");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -55,6 +55,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
)
|
||||
:
|
||||
processorPolyPatch(name, size, start, index, bm, myProcNo, neighbProcNo),
|
||||
tag_(UPstream::allocateTag()),
|
||||
referPatchName_(referPatchName),
|
||||
referPatchID_(-1)
|
||||
{}
|
||||
@ -69,6 +70,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
)
|
||||
:
|
||||
processorPolyPatch(name, dict, index, bm),
|
||||
tag_(UPstream::allocateTag()),
|
||||
referPatchName_(dict.lookup("referPatch")),
|
||||
referPatchID_(-1)
|
||||
{}
|
||||
@ -81,6 +83,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
)
|
||||
:
|
||||
processorPolyPatch(pp, bm),
|
||||
tag_(pp.tag_),
|
||||
referPatchName_(pp.referPatchName()),
|
||||
referPatchID_(-1)
|
||||
{}
|
||||
@ -97,6 +100,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
)
|
||||
:
|
||||
processorPolyPatch(pp, bm, index, newSize, newStart),
|
||||
tag_(pp.tag_),
|
||||
referPatchName_(referPatchName),
|
||||
referPatchID_(-1)
|
||||
{}
|
||||
@ -112,6 +116,7 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
)
|
||||
:
|
||||
processorPolyPatch(pp, bm, index, mapAddressing, newStart),
|
||||
tag_(pp.tag_),
|
||||
referPatchName_(pp.referPatchName()),
|
||||
referPatchID_(-1)
|
||||
{}
|
||||
@ -120,7 +125,9 @@ Foam::processorCyclicPolyPatch::processorCyclicPolyPatch
|
||||
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
|
||||
|
||||
Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
|
||||
{}
|
||||
{
|
||||
UPstream::freeTag(tag_);
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
@ -128,8 +135,6 @@ Foam::processorCyclicPolyPatch::~processorCyclicPolyPatch()
|
||||
|
||||
void Foam::processorCyclicPolyPatch::initGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
Pout<< "**processorCyclicPolyPatch::initGeometry()" << endl;
|
||||
|
||||
// Send over processorPolyPatch data
|
||||
processorPolyPatch::initGeometry(pBufs);
|
||||
}
|
||||
@ -137,8 +142,6 @@ Pout<< "**processorCyclicPolyPatch::initGeometry()" << endl;
|
||||
|
||||
void Foam::processorCyclicPolyPatch::calcGeometry(PstreamBuffers& pBufs)
|
||||
{
|
||||
Pout<< "processorCyclicPolyPatch::calcGeometry() for " << name() << endl;
|
||||
|
||||
// Receive and initialise processorPolyPatch data
|
||||
processorPolyPatch::calcGeometry(pBufs);
|
||||
|
||||
@ -158,7 +161,7 @@ Pout<< "processorCyclicPolyPatch::calcGeometry() for " << name() << endl;
|
||||
|
||||
pp.calcGeometry
|
||||
(
|
||||
pp,
|
||||
*this,
|
||||
faceCentres(),
|
||||
faceAreas(),
|
||||
faceCellCentres(),
|
||||
|
||||
@ -55,13 +55,15 @@ class processorCyclicPolyPatch
|
||||
{
|
||||
// Private data
|
||||
|
||||
//- Message tag to use for communication
|
||||
const int tag_;
|
||||
|
||||
//- Name of originating patch
|
||||
const word referPatchName_;
|
||||
|
||||
//- Index of originating patch
|
||||
mutable label referPatchID_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
|
||||
|
||||
@ -270,7 +272,19 @@ public:
|
||||
const coupledPolyPatch& referPatch() const
|
||||
{
|
||||
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.
|
||||
|
||||
@ -137,63 +137,25 @@ Foam::PackedBoolList Foam::syncTools::getMasterPoints(const polyMesh& mesh)
|
||||
{
|
||||
if (patches[patchI].coupled())
|
||||
{
|
||||
if
|
||||
(
|
||||
Pstream::parRun()
|
||||
&& isA<processorPolyPatch>(patches[patchI])
|
||||
)
|
||||
const coupledPolyPatch& pp =
|
||||
refCast<const coupledPolyPatch>(patches[patchI]);
|
||||
|
||||
const labelList& meshPoints = pp.meshPoints();
|
||||
|
||||
forAll(meshPoints, i)
|
||||
{
|
||||
const processorPolyPatch& pp =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
label pointI = meshPoints[i];
|
||||
|
||||
const labelList& meshPoints = pp.meshPoints();
|
||||
|
||||
forAll(meshPoints, i)
|
||||
if (donePoint.get(pointI) == 0u)
|
||||
{
|
||||
label pointI = meshPoints[i];
|
||||
donePoint.set(pointI, 1u);
|
||||
|
||||
if (donePoint.get(pointI) == 0u)
|
||||
if (pp.owner())
|
||||
{
|
||||
donePoint.set(pointI, 1u);
|
||||
|
||||
if (pp.owner())
|
||||
{
|
||||
isMasterPoint.set(pointI, 1u);
|
||||
}
|
||||
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
|
||||
(
|
||||
Pstream::parRun()
|
||||
&& isA<processorPolyPatch>(patches[patchI])
|
||||
)
|
||||
const coupledPolyPatch& pp =
|
||||
refCast<const coupledPolyPatch>(patches[patchI]);
|
||||
|
||||
const labelList& meshEdges = pp.meshEdges();
|
||||
|
||||
forAll(meshEdges, i)
|
||||
{
|
||||
const processorPolyPatch& pp =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
label edgeI = meshEdges[i];
|
||||
|
||||
const labelList& meshEdges = pp.meshEdges();
|
||||
|
||||
forAll(meshEdges, i)
|
||||
if (doneEdge.get(edgeI) == 0u)
|
||||
{
|
||||
label edgeI = meshEdges[i];
|
||||
doneEdge.set(edgeI, 1u);
|
||||
|
||||
if (doneEdge.get(edgeI) == 0u)
|
||||
if (pp.owner())
|
||||
{
|
||||
doneEdge.set(edgeI, 1u);
|
||||
|
||||
if (pp.owner())
|
||||
{
|
||||
isMasterEdge.set(edgeI, 1u);
|
||||
}
|
||||
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 (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI]))
|
||||
{
|
||||
const processorPolyPatch& pp =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
const coupledPolyPatch& pp =
|
||||
refCast<const coupledPolyPatch>(patches[patchI]);
|
||||
|
||||
if (!pp.owner())
|
||||
{
|
||||
forAll(pp, i)
|
||||
{
|
||||
isMasterFace.unset(pp.start()+i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isA<cyclicPolyPatch>(patches[patchI]))
|
||||
if (!pp.owner())
|
||||
{
|
||||
const cyclicPolyPatch& pp =
|
||||
refCast<const cyclicPolyPatch>(patches[patchI]);
|
||||
|
||||
for (label i = pp.size()/2; i < pp.size(); i++)
|
||||
forAll(pp, 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -101,6 +101,8 @@ void Foam::syncTools::syncPointMap
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -134,11 +136,12 @@ void Foam::syncTools::syncPointMap
|
||||
}
|
||||
}
|
||||
|
||||
OPstream toNeighb(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UOPstream toNeighb(procPatch.neighbProcNo(), pBufs);
|
||||
toNeighb << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
@ -153,7 +156,7 @@ void Foam::syncTools::syncPointMap
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(patches[patchI]);
|
||||
|
||||
IPstream fromNb(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UIPstream fromNb(procPatch.neighbProcNo(), pBufs);
|
||||
Map<T> nbrPatchInfo(fromNb);
|
||||
|
||||
// Transform
|
||||
@ -198,7 +201,7 @@ void Foam::syncTools::syncPointMap
|
||||
const labelList& meshPtsA = cycPatch.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> half1Values(half0Values.size());
|
||||
|
||||
@ -311,7 +314,7 @@ void Foam::syncTools::syncPointMap
|
||||
slave++
|
||||
)
|
||||
{
|
||||
IPstream fromSlave(Pstream::blocking, slave);
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
Map<T> nbrValues(fromSlave);
|
||||
|
||||
// Merge neighbouring values with my values
|
||||
@ -335,7 +338,7 @@ void Foam::syncTools::syncPointMap
|
||||
slave++
|
||||
)
|
||||
{
|
||||
OPstream toSlave(Pstream::blocking, slave);
|
||||
OPstream toSlave(Pstream::scheduled, slave);
|
||||
toSlave << sharedPointValues;
|
||||
}
|
||||
}
|
||||
@ -343,14 +346,14 @@ void Foam::syncTools::syncPointMap
|
||||
{
|
||||
// Slave: send to master
|
||||
{
|
||||
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster << sharedPointValues;
|
||||
}
|
||||
// Receive merged values
|
||||
{
|
||||
IPstream fromMaster
|
||||
(
|
||||
Pstream::blocking,
|
||||
Pstream::scheduled,
|
||||
Pstream::masterNo()
|
||||
);
|
||||
fromMaster >> sharedPointValues;
|
||||
@ -416,6 +419,8 @@ void Foam::syncTools::syncEdgeMap
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -453,11 +458,12 @@ void Foam::syncTools::syncEdgeMap
|
||||
}
|
||||
}
|
||||
|
||||
OPstream toNeighb(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UOPstream toNeighb(procPatch.neighbProcNo(), pBufs);
|
||||
toNeighb << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
@ -474,11 +480,7 @@ void Foam::syncTools::syncEdgeMap
|
||||
|
||||
EdgeMap<T> nbrPatchInfo;
|
||||
{
|
||||
IPstream fromNbr
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
@ -704,7 +706,7 @@ void Foam::syncTools::syncEdgeMap
|
||||
slave++
|
||||
)
|
||||
{
|
||||
IPstream fromSlave(Pstream::blocking, slave);
|
||||
IPstream fromSlave(Pstream::scheduled, slave);
|
||||
EdgeMap<T> nbrValues(fromSlave);
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
@ -737,12 +739,12 @@ void Foam::syncTools::syncEdgeMap
|
||||
{
|
||||
// Send to master
|
||||
{
|
||||
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
|
||||
OPstream toMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
toMaster << sharedEdgeValues;
|
||||
}
|
||||
// Receive merged values
|
||||
{
|
||||
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
|
||||
IPstream fromMaster(Pstream::scheduled, Pstream::masterNo());
|
||||
fromMaster >> sharedEdgeValues;
|
||||
}
|
||||
}
|
||||
@ -807,6 +809,8 @@ void Foam::syncTools::syncPointList
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -832,11 +836,12 @@ void Foam::syncTools::syncPointList
|
||||
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
@ -853,11 +858,7 @@ void Foam::syncTools::syncPointList
|
||||
|
||||
Field<T> nbrPatchInfo(procPatch.nPoints());
|
||||
{
|
||||
IPstream fromNbr
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
@ -1032,6 +1033,8 @@ void Foam::syncTools::syncEdgeList
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -1058,11 +1061,13 @@ void Foam::syncTools::syncEdgeList
|
||||
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -1083,11 +1088,7 @@ void Foam::syncTools::syncEdgeList
|
||||
Field<T> nbrPatchInfo(procPatch.nEdges());
|
||||
|
||||
{
|
||||
IPstream fromNeighb
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
@ -1215,6 +1216,8 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -1230,31 +1233,21 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
|
||||
label patchStart = procPatch.start()-mesh.nInternalFaces();
|
||||
|
||||
if (contiguous<T>())
|
||||
{
|
||||
OPstream::write
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr <<
|
||||
SubField<T>
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo(),
|
||||
reinterpret_cast<const char*>(&faceValues[patchStart]),
|
||||
procPatch.size()*sizeof(T)
|
||||
faceValues,
|
||||
procPatch.size(),
|
||||
patchStart
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
toNbr <<
|
||||
SubField<T>
|
||||
(
|
||||
faceValues,
|
||||
procPatch.size(),
|
||||
patchStart
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -1270,25 +1263,8 @@ void Foam::syncTools::syncBoundaryFaceList
|
||||
|
||||
Field<T> nbrPatchInfo(procPatch.size());
|
||||
|
||||
if (contiguous<T>())
|
||||
{
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo(),
|
||||
reinterpret_cast<char*>(nbrPatchInfo.begin()),
|
||||
nbrPatchInfo.byteSize()
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
IPstream fromNeighb
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
}
|
||||
UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
|
||||
top(procPatch, nbrPatchInfo);
|
||||
|
||||
@ -1373,6 +1349,8 @@ void Foam::syncTools::syncFaceList
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -1392,12 +1370,14 @@ void Foam::syncTools::syncFaceList
|
||||
patchInfo[i] = faceValues[procPatch.start()+i];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -1413,11 +1393,7 @@ void Foam::syncTools::syncFaceList
|
||||
|
||||
List<unsigned int> patchInfo(procPatch.size());
|
||||
{
|
||||
IPstream fromNbr
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
fromNbr >> patchInfo;
|
||||
}
|
||||
|
||||
@ -1508,6 +1484,8 @@ void Foam::syncTools::syncPointList
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -1532,12 +1510,14 @@ void Foam::syncTools::syncPointList
|
||||
patchInfo[nbrPointI] = pointValues[meshPts[pointI]];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -1555,11 +1535,7 @@ void Foam::syncTools::syncPointList
|
||||
{
|
||||
// We do not know the number of points on the other side
|
||||
// so cannot use Pstream::read.
|
||||
IPstream fromNbr
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
UIPstream fromNbr(procPatch.neighbProcNo(), pBufs);
|
||||
fromNbr >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
@ -1672,6 +1648,8 @@ void Foam::syncTools::syncEdgeList
|
||||
|
||||
if (Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send
|
||||
|
||||
forAll(patches, patchI)
|
||||
@ -1696,11 +1674,12 @@ void Foam::syncTools::syncEdgeList
|
||||
patchInfo[nbrEdgeI] = edgeValues[meshEdges[edgeI]];
|
||||
}
|
||||
|
||||
OPstream toNbr(Pstream::blocking, procPatch.neighbProcNo());
|
||||
UOPstream toNbr(procPatch.neighbProcNo(), pBufs);
|
||||
toNbr << patchInfo;
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive and combine.
|
||||
|
||||
@ -1719,11 +1698,7 @@ void Foam::syncTools::syncEdgeList
|
||||
List<unsigned int> nbrPatchInfo(procPatch.nEdges());
|
||||
|
||||
{
|
||||
IPstream fromNeighb
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
UIPstream fromNeighb(procPatch.neighbProcNo(), pBufs);
|
||||
fromNeighb >> nbrPatchInfo;
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,7 @@ Foam::UIPstream::UIPstream
|
||||
const commsTypes commsType,
|
||||
const int fromProcNo,
|
||||
DynamicList<char>& externalBuf,
|
||||
label& externalBufPosition,
|
||||
const int tag,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
@ -45,7 +46,7 @@ Foam::UIPstream::UIPstream
|
||||
Istream(format, version),
|
||||
fromProcNo_(fromProcNo),
|
||||
externalBuf_(externalBuf),
|
||||
externalBufPosition_(0),
|
||||
externalBufPosition_(externalBufPosition),
|
||||
tag_(tag),
|
||||
messageSize_(0)
|
||||
{
|
||||
@ -56,6 +57,7 @@ Foam::UIPstream::UIPstream
|
||||
"const commsTypes,"
|
||||
"const int fromProcNo,"
|
||||
"DynamicList<char>&,"
|
||||
"label&,"
|
||||
"const int tag,"
|
||||
"streamFormat, versionNumber"
|
||||
")"
|
||||
|
||||
@ -40,6 +40,7 @@ Foam::UIPstream::UIPstream
|
||||
const commsTypes commsType,
|
||||
const int fromProcNo,
|
||||
DynamicList<char>& externalBuf,
|
||||
label& externalBufPosition,
|
||||
const int tag,
|
||||
streamFormat format,
|
||||
versionNumber version
|
||||
@ -49,7 +50,7 @@ Foam::UIPstream::UIPstream
|
||||
Istream(format, version),
|
||||
fromProcNo_(fromProcNo),
|
||||
externalBuf_(externalBuf),
|
||||
externalBufPosition_(0),
|
||||
externalBufPosition_(externalBufPosition),
|
||||
tag_(tag),
|
||||
messageSize_(0)
|
||||
{
|
||||
@ -122,7 +123,7 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
|
||||
Istream(buffers.format_, buffers.version_),
|
||||
fromProcNo_(fromProcNo),
|
||||
externalBuf_(buffers.recvBuf_[fromProcNo]),
|
||||
externalBufPosition_(0),
|
||||
externalBufPosition_(buffers.recvBufPos_[fromProcNo]),
|
||||
tag_(buffers.tag_),
|
||||
messageSize_(0)
|
||||
{
|
||||
|
||||
@ -45,7 +45,7 @@ bool Foam::UOPstream::write
|
||||
{
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UIPstream::write : starting write to:" << toProcNo
|
||||
Pout<< "UOPstream::write : starting write to:" << toProcNo
|
||||
<< " tag:" << tag << " size:" << label(bufSize)
|
||||
<< " commsType:" << UPstream::commsTypeNames[commsType]
|
||||
<< Foam::endl;
|
||||
@ -67,7 +67,7 @@ bool Foam::UOPstream::write
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UIPstream::write : finished write to:" << toProcNo
|
||||
Pout<< "UOPstream::write : finished write to:" << toProcNo
|
||||
<< " tag:" << tag << " size:" << label(bufSize)
|
||||
<< " commsType:" << UPstream::commsTypeNames[commsType]
|
||||
<< Foam::endl;
|
||||
@ -87,7 +87,7 @@ bool Foam::UOPstream::write
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UIPstream::write : finished write to:" << toProcNo
|
||||
Pout<< "UOPstream::write : finished write to:" << toProcNo
|
||||
<< " tag:" << tag << " size:" << label(bufSize)
|
||||
<< " commsType:" << UPstream::commsTypeNames[commsType]
|
||||
<< Foam::endl;
|
||||
@ -110,7 +110,7 @@ bool Foam::UOPstream::write
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "UIPstream::write : started write to:" << toProcNo
|
||||
Pout<< "UOPstream::write : started write to:" << toProcNo
|
||||
<< " tag:" << tag << " size:" << label(bufSize)
|
||||
<< " commsType:" << UPstream::commsTypeNames[commsType]
|
||||
<< " request:" << PstreamGlobals::outstandingRequests_.size()
|
||||
|
||||
@ -21,13 +21,12 @@ $(constraintFvPatches)/symmetry/symmetryFvPatch.C
|
||||
$(constraintFvPatches)/wedge/wedgeFvPatch.C
|
||||
$(constraintFvPatches)/cyclic/cyclicFvPatch.C
|
||||
$(constraintFvPatches)/processor/processorFvPatch.C
|
||||
$(constraintFvPatches)/processorCyclic/processorCyclicFvPatch.C
|
||||
|
||||
derivedFvPatches = $(fvPatches)/derived
|
||||
$(derivedFvPatches)/wall/wallFvPatch.C
|
||||
/*
|
||||
$(derivedFvPatches)/directMapped/directMappedFvPatch.C
|
||||
$(derivedFvPatches)/directMapped/directMappedWallFvPatch.C
|
||||
*/
|
||||
|
||||
wallDist = fvMesh/wallDist
|
||||
$(wallDist)/wallPointYPlus/wallPointYPlus.C
|
||||
@ -101,6 +100,8 @@ $(constraintFvPatchFields)/empty/emptyFvPatchFields.C
|
||||
$(constraintFvPatchFields)/jumpCyclic/jumpCyclicFvPatchFields.C
|
||||
$(constraintFvPatchFields)/processor/processorFvPatchFields.C
|
||||
$(constraintFvPatchFields)/processor/processorFvPatchScalarField.C
|
||||
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchFields.C
|
||||
$(constraintFvPatchFields)/processorCyclic/processorCyclicFvPatchScalarField.C
|
||||
$(constraintFvPatchFields)/symmetry/symmetryFvPatchFields.C
|
||||
$(constraintFvPatchFields)/wedge/wedgeFvPatchFields.C
|
||||
$(constraintFvPatchFields)/wedge/wedgeFvPatchScalarField.C
|
||||
@ -109,15 +110,12 @@ derivedFvPatchFields = $(fvPatchFields)/derived
|
||||
$(derivedFvPatchFields)/activeBaffleVelocity/activeBaffleVelocityFvPatchVectorField.C
|
||||
$(derivedFvPatchFields)/advective/advectiveFvPatchFields.C
|
||||
|
||||
/*
|
||||
$(derivedFvPatchFields)/directMappedFixedValue/directMappedFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/directMappedVelocityFluxFixedValue/directMappedVelocityFluxFixedValueFvPatchField.C
|
||||
$(derivedFvPatchFields)/fan/fanFvPatchFields.C
|
||||
$(derivedFvPatchFields)/buoyantPressure/buoyantPressureFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/fixedFluxPressure/fixedFluxPressureFvPatchScalarField.C
|
||||
*/
|
||||
$(derivedFvPatchFields)/fixedInternalValueFvPatchField/fixedInternalValueFvPatchFields.C
|
||||
/*
|
||||
$(derivedFvPatchFields)/fixedNormalSlip/fixedNormalSlipFvPatchFields.C
|
||||
$(derivedFvPatchFields)/fixedPressureCompressibleDensity/fixedPressureCompressibleDensityFvPatchScalarField.C
|
||||
$(derivedFvPatchFields)/fluxCorrectedVelocity/fluxCorrectedVelocityFvPatchVectorField.C
|
||||
@ -156,7 +154,6 @@ $(derivedFvPatchFields)/turbulentIntensityKineticEnergyInlet/turbulentIntensityK
|
||||
$(derivedFvPatchFields)/uniformFixedValue/uniformFixedValueFvPatchFields.C
|
||||
$(derivedFvPatchFields)/waveTransmissive/waveTransmissiveFvPatchFields.C
|
||||
$(derivedFvPatchFields)/uniformDensityHydrostaticPressure/uniformDensityHydrostaticPressureFvPatchScalarField.C
|
||||
*/
|
||||
|
||||
fvsPatchFields = fields/fvsPatchFields
|
||||
$(fvsPatchFields)/fvsPatchField/fvsPatchFields.C
|
||||
@ -171,6 +168,7 @@ constraintFvsPatchFields = $(fvsPatchFields)/constraint
|
||||
$(constraintFvsPatchFields)/cyclic/cyclicFvsPatchFields.C
|
||||
$(constraintFvsPatchFields)/empty/emptyFvsPatchFields.C
|
||||
$(constraintFvsPatchFields)/processor/processorFvsPatchFields.C
|
||||
$(constraintFvsPatchFields)/processorCyclic/processorCyclicFvsPatchFields.C
|
||||
$(constraintFvsPatchFields)/symmetry/symmetryFvsPatchFields.C
|
||||
$(constraintFvsPatchFields)/wedge/wedgeFvsPatchFields.C
|
||||
|
||||
@ -206,7 +204,6 @@ $(surfaceInterpolation)/surfaceInterpolationScheme/surfaceInterpolationSchemes.C
|
||||
schemes = $(surfaceInterpolation)/schemes
|
||||
$(schemes)/linear/linear.C
|
||||
$(schemes)/midPoint/midPoint.C
|
||||
/*
|
||||
$(schemes)/downwind/downwind.C
|
||||
$(schemes)/weighted/weighted.C
|
||||
$(schemes)/cubic/cubic.C
|
||||
@ -221,6 +218,7 @@ $(schemes)/localBlended/localBlended.C
|
||||
$(schemes)/localMax/localMax.C
|
||||
$(schemes)/localMin/localMin.C
|
||||
|
||||
/*
|
||||
$(schemes)/linearFit/linearFit.C
|
||||
$(schemes)/biLinearFit/biLinearFit.C
|
||||
$(schemes)/quadraticLinearFit/quadraticLinearFit.C
|
||||
@ -236,7 +234,6 @@ $(schemes)/linearPureUpwindFit/linearPureUpwindFit.C
|
||||
limitedSchemes = $(surfaceInterpolation)/limitedSchemes
|
||||
$(limitedSchemes)/limitedSurfaceInterpolationScheme/limitedSurfaceInterpolationSchemes.C
|
||||
$(limitedSchemes)/upwind/upwind.C
|
||||
/*
|
||||
$(limitedSchemes)/blended/blended.C
|
||||
$(limitedSchemes)/linearUpwind/linearUpwind.C
|
||||
$(limitedSchemes)/linearUpwind/linearUpwindV.C
|
||||
@ -258,7 +255,6 @@ $(limitedSchemes)/filteredLinear/filteredLinear.C
|
||||
$(limitedSchemes)/filteredLinear2/filteredLinear2.C
|
||||
$(limitedSchemes)/filteredLinear3/filteredLinear3.C
|
||||
$(limitedSchemes)/limitWith/limitWith.C
|
||||
*/
|
||||
|
||||
multivariateSchemes = $(surfaceInterpolation)/multivariateSchemes
|
||||
$(multivariateSchemes)/multivariateSurfaceInterpolationScheme/multivariateSurfaceInterpolationSchemes.C
|
||||
@ -340,7 +336,6 @@ general = cfdTools/general
|
||||
$(general)/findRefCell/findRefCell.C
|
||||
$(general)/adjustPhi/adjustPhi.C
|
||||
$(general)/bound/bound.C
|
||||
/*
|
||||
porousMedia = $(general)/porousMedia
|
||||
$(porousMedia)/porousZone.C
|
||||
$(porousMedia)/porousZones.C
|
||||
@ -363,6 +358,5 @@ $(fieldSources)/timeActivatedExplicitCellSource/timeActivatedExplicitCellSource.
|
||||
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/timeActivatedExplicitMulticomponentPointSource.C
|
||||
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourceProperties.C
|
||||
$(fieldSources)/timeActivatedExplicitMulticomponentPointSource/pointSourceProperties/pointSourcePropertiesIO.C
|
||||
*/
|
||||
|
||||
LIB = $(FOAM_LIBBIN)/libfiniteVolume
|
||||
|
||||
@ -109,9 +109,9 @@ cyclicFvPatchField<Type>::cyclicFvPatchField
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
|
||||
Pout<< "Construct from dictionary for " << p.name() << endl
|
||||
<< "Underlying cyclic:" << cyclicPatch_.name()
|
||||
<< " with parallel:" << cyclicPatch_.parallel() << endl;
|
||||
// Pout<< "Construct from dictionary for " << p.name() << endl
|
||||
// << "Underlying cyclic:" << cyclicPatch_.name()
|
||||
// << " with parallel:" << cyclicPatch_.parallel() << endl;
|
||||
|
||||
this->coupledFvPatchField<Type>::evaluate(Pstream::blocking);
|
||||
}
|
||||
|
||||
@ -100,7 +100,8 @@ template<class Type>
|
||||
tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const
|
||||
{
|
||||
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()));
|
||||
Field<Type>& pnf = tpnf();
|
||||
@ -108,29 +109,21 @@ tmp<Field<Type> > jumpCyclicFvPatchField<Type>::patchNeighbourField() const
|
||||
tmp<Field<scalar> > tjf = jump();
|
||||
const Field<scalar>& jf = tjf();
|
||||
|
||||
label sizeby2 = this->size()/2;
|
||||
|
||||
if (this->doTransform())
|
||||
{
|
||||
for (label facei=0; facei<sizeby2; facei++)
|
||||
forAll(*this, facei)
|
||||
{
|
||||
pnf[facei] = transform
|
||||
(
|
||||
this->forwardT()[0], iField[faceCells[facei + sizeby2]]
|
||||
this->forwardT(), iField[nbrFaceCells[facei]]
|
||||
) - jf[facei];
|
||||
|
||||
pnf[facei + sizeby2] = transform
|
||||
(
|
||||
this->reverseT()[0], iField[faceCells[facei]] + jf[facei]
|
||||
);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (label facei=0; facei<sizeby2; facei++)
|
||||
forAll(*this, facei)
|
||||
{
|
||||
pnf[facei] = iField[faceCells[facei + sizeby2]] - jf[facei];
|
||||
pnf[facei + sizeby2] = iField[faceCells[facei]] + jf[facei];
|
||||
pnf[facei] = iField[nbrFaceCells[facei]] - jf[facei];
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,26 +144,24 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
|
||||
{
|
||||
scalarField pnf(this->size());
|
||||
|
||||
label sizeby2 = this->size()/2;
|
||||
const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
|
||||
const unallocLabelList& nbrFaceCells =
|
||||
this->cyclicPatch().neighbFvPatch().faceCells();
|
||||
|
||||
if (&psiInternal == &this->internalField())
|
||||
{
|
||||
tmp<Field<scalar> > tjf = jump();
|
||||
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 + sizeby2] = psiInternal[faceCells[facei]] + jf[facei];
|
||||
pnf[facei] = psiInternal[nbrFaceCells[facei]] - jf[facei];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (label facei=0; facei<sizeby2; facei++)
|
||||
forAll(*this, facei)
|
||||
{
|
||||
pnf[facei] = psiInternal[faceCells[facei + sizeby2]];
|
||||
pnf[facei + sizeby2] = psiInternal[faceCells[facei]];
|
||||
pnf[facei] = psiInternal[nbrFaceCells[facei]];
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,6 +169,7 @@ void jumpCyclicFvPatchField<Type>::updateInterfaceMatrix
|
||||
this->transformCoupleField(pnf, cmpt);
|
||||
|
||||
// Multiply the field by coefficients and add into the result
|
||||
const unallocLabelList& faceCells = this->cyclicPatch().faceCells();
|
||||
forAll(faceCells, elemI)
|
||||
{
|
||||
result[faceCells[elemI]] -= coeffs[elemI]*pnf[elemI];
|
||||
|
||||
@ -74,7 +74,7 @@ processorFvPatchField<Type>::processorFvPatchField
|
||||
coupledFvPatchField<Type>(ptf, p, iF, mapper),
|
||||
procPatch_(refCast<const processorFvPatch>(p))
|
||||
{
|
||||
if (!isType<processorFvPatch>(this->patch()))
|
||||
if (!isA<processorFvPatch>(this->patch()))
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
@ -106,7 +106,7 @@ processorFvPatchField<Type>::processorFvPatchField
|
||||
coupledFvPatchField<Type>(p, iF, dict),
|
||||
procPatch_(refCast<const processorFvPatch>(p))
|
||||
{
|
||||
if (!isType<processorFvPatch>(p))
|
||||
if (!isA<processorFvPatch>(p))
|
||||
{
|
||||
FatalIOErrorIn
|
||||
(
|
||||
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -24,7 +24,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorFvPatchFields.H"
|
||||
#include "processorCyclicFvPatchFields.H"
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
|
||||
@ -35,8 +35,8 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
makePatchFields(processor);
|
||||
//makePatchTypeField(fvPatchScalarField, processorFvPatchScalarField);
|
||||
makePatchFields(processorCyclic);
|
||||
//makePatchTypeField(fvPatchScalarField, processorCyclicFvPatchScalarField);
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -24,10 +24,10 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorFvPatchFields_H
|
||||
#define processorFvPatchFields_H
|
||||
#ifndef processorCyclicFvPatchFields_H
|
||||
#define processorCyclicFvPatchFields_H
|
||||
|
||||
#include "processorFvPatchScalarField.H"
|
||||
#include "processorCyclicFvPatchScalarField.H"
|
||||
#include "fieldTypes.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -37,7 +37,7 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
makePatchTypeFieldTypedefs(processor)
|
||||
makePatchTypeFieldTypedefs(processorCyclic)
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -24,8 +24,8 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorFvPatchFieldsFwd_H
|
||||
#define processorFvPatchFieldsFwd_H
|
||||
#ifndef processorCyclicFvPatchFieldsFwd_H
|
||||
#define processorCyclicFvPatchFieldsFwd_H
|
||||
|
||||
#include "fieldTypes.H"
|
||||
|
||||
@ -36,7 +36,7 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
template<class Type> class processorFvPatchField;
|
||||
template<class Type> class processorCyclicFvPatchField;
|
||||
|
||||
makePatchTypeFieldTypedefs(processor)
|
||||
|
||||
@ -24,7 +24,7 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "processorFvPatchScalarField.H"
|
||||
#include "processorCyclicFvPatchScalarField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -33,48 +33,48 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
|
||||
(
|
||||
const scalarField& psiInternal,
|
||||
scalarField&,
|
||||
const lduMatrix&,
|
||||
const scalarField&,
|
||||
const direction,
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
procPatch_.compressedSend
|
||||
(
|
||||
commsType,
|
||||
patch().patchInternalField(psiInternal)()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
template<>
|
||||
void processorFvPatchField<scalar>::updateInterfaceMatrix
|
||||
(
|
||||
const scalarField&,
|
||||
scalarField& result,
|
||||
const lduMatrix&,
|
||||
const scalarField& coeffs,
|
||||
const direction,
|
||||
const Pstream::commsTypes commsType
|
||||
) const
|
||||
{
|
||||
scalarField pnf
|
||||
(
|
||||
procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
||||
);
|
||||
|
||||
const unallocLabelList& faceCells = patch().faceCells();
|
||||
|
||||
forAll(faceCells, facei)
|
||||
{
|
||||
result[faceCells[facei]] -= coeffs[facei]*pnf[facei];
|
||||
}
|
||||
}
|
||||
//template<>
|
||||
//void processorCyclicFvPatchField<scalar>::initInterfaceMatrixUpdate
|
||||
//(
|
||||
// const scalarField& psiInternal,
|
||||
// scalarField&,
|
||||
// const lduMatrix&,
|
||||
// const scalarField&,
|
||||
// const direction,
|
||||
// const Pstream::commsTypes commsType
|
||||
//) const
|
||||
//{
|
||||
// procPatch_.compressedSend
|
||||
// (
|
||||
// commsType,
|
||||
// patch().patchInternalField(psiInternal)()
|
||||
// );
|
||||
//}
|
||||
//
|
||||
//
|
||||
//template<>
|
||||
//void processorCyclicFvPatchField<scalar>::updateInterfaceMatrix
|
||||
//(
|
||||
// const scalarField&,
|
||||
// scalarField& result,
|
||||
// const lduMatrix&,
|
||||
// const scalarField& coeffs,
|
||||
// const direction,
|
||||
// const Pstream::commsTypes commsType
|
||||
//) const
|
||||
//{
|
||||
// scalarField pnf
|
||||
// (
|
||||
// procPatch_.compressedReceive<scalar>(commsType, this->size())()
|
||||
// );
|
||||
//
|
||||
// const unallocLabelList& faceCells = patch().faceCells();
|
||||
//
|
||||
// forAll(faceCells, facei)
|
||||
// {
|
||||
// result[faceCells[facei]] -= coeffs[facei]*pnf[facei];
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -24,10 +24,10 @@ License
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#ifndef processorFvPatchScalarField_H
|
||||
#define processorFvPatchScalarField_H
|
||||
#ifndef processorCyclicFvPatchScalarField_H
|
||||
#define processorCyclicFvPatchScalarField_H
|
||||
|
||||
#include "processorFvPatchField.H"
|
||||
#include "processorCyclicFvPatchField.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
@ -36,28 +36,28 @@ namespace Foam
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
template<>
|
||||
void processorFvPatchField<scalar>::initInterfaceMatrixUpdate
|
||||
(
|
||||
const scalarField&,
|
||||
scalarField&,
|
||||
const lduMatrix&,
|
||||
const scalarField&,
|
||||
const direction,
|
||||
const Pstream::commsTypes commsType
|
||||
) const;
|
||||
|
||||
|
||||
template<>
|
||||
void processorFvPatchField<scalar>::updateInterfaceMatrix
|
||||
(
|
||||
const scalarField&,
|
||||
scalarField& result,
|
||||
const lduMatrix&,
|
||||
const scalarField& coeffs,
|
||||
const direction,
|
||||
const Pstream::commsTypes commsType
|
||||
) const;
|
||||
//template<>
|
||||
//void processorCyclicFvPatchField<scalar>::initInterfaceMatrixUpdate
|
||||
//(
|
||||
// const scalarField&,
|
||||
// scalarField&,
|
||||
// const lduMatrix&,
|
||||
// const scalarField&,
|
||||
// const direction,
|
||||
// const Pstream::commsTypes commsType
|
||||
//) const;
|
||||
//
|
||||
//
|
||||
//template<>
|
||||
//void processorCyclicFvPatchField<scalar>::updateInterfaceMatrix
|
||||
//(
|
||||
// const scalarField&,
|
||||
// scalarField& result,
|
||||
// const lduMatrix&,
|
||||
// const scalarField& coeffs,
|
||||
// const direction,
|
||||
// const Pstream::commsTypes commsType
|
||||
//) const;
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -28,6 +28,7 @@ License
|
||||
#include "addToRunTimeSelectionTable.H"
|
||||
#include "volFields.H"
|
||||
#include "surfaceFields.H"
|
||||
#include "cyclicFvPatch.H"
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
@ -45,6 +46,7 @@ activeBaffleVelocityFvPatchVectorField
|
||||
orientation_(1),
|
||||
initWallSf_(0),
|
||||
initCyclicSf_(0),
|
||||
nbrCyclicSf_(0),
|
||||
openFraction_(0),
|
||||
openingTime_(0),
|
||||
maxOpenFractionDelta_(0),
|
||||
@ -68,6 +70,7 @@ activeBaffleVelocityFvPatchVectorField
|
||||
orientation_(ptf.orientation_),
|
||||
initWallSf_(ptf.initWallSf_),
|
||||
initCyclicSf_(ptf.initCyclicSf_),
|
||||
nbrCyclicSf_(ptf.nbrCyclicSf_),
|
||||
openFraction_(ptf.openFraction_),
|
||||
openingTime_(ptf.openingTime_),
|
||||
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
|
||||
@ -84,23 +87,25 @@ activeBaffleVelocityFvPatchVectorField
|
||||
)
|
||||
:
|
||||
fixedValueFvPatchVectorField(p, iF),
|
||||
pName_("p"),
|
||||
pName_(dict.lookupOrDefault<word>("p", "p")),
|
||||
cyclicPatchName_(dict.lookup("cyclicPatch")),
|
||||
cyclicPatchLabel_(p.patch().boundaryMesh().findPatchID(cyclicPatchName_)),
|
||||
orientation_(readLabel(dict.lookup("orientation"))),
|
||||
initWallSf_(p.Sf()),
|
||||
initCyclicSf_(p.boundaryMesh()[cyclicPatchLabel_].Sf()),
|
||||
nbrCyclicSf_
|
||||
(
|
||||
refCast<const cyclicFvPatch>
|
||||
(
|
||||
p.boundaryMesh()[cyclicPatchLabel_]
|
||||
).neighbFvPatch().Sf()
|
||||
),
|
||||
openFraction_(readScalar(dict.lookup("openFraction"))),
|
||||
openingTime_(readScalar(dict.lookup("openingTime"))),
|
||||
maxOpenFractionDelta_(readScalar(dict.lookup("maxOpenFractionDelta"))),
|
||||
curTimeIndex_(-1)
|
||||
{
|
||||
fvPatchVectorField::operator=(vector::zero);
|
||||
|
||||
if (dict.found("p"))
|
||||
{
|
||||
dict.lookup("p") >> pName_;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -117,6 +122,7 @@ activeBaffleVelocityFvPatchVectorField
|
||||
orientation_(ptf.orientation_),
|
||||
initWallSf_(ptf.initWallSf_),
|
||||
initCyclicSf_(ptf.initCyclicSf_),
|
||||
nbrCyclicSf_(ptf.nbrCyclicSf_),
|
||||
openFraction_(ptf.openFraction_),
|
||||
openingTime_(ptf.openingTime_),
|
||||
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
|
||||
@ -138,6 +144,7 @@ activeBaffleVelocityFvPatchVectorField
|
||||
orientation_(ptf.orientation_),
|
||||
initWallSf_(ptf.initWallSf_),
|
||||
initCyclicSf_(ptf.initCyclicSf_),
|
||||
nbrCyclicSf_(ptf.nbrCyclicSf_),
|
||||
openFraction_(ptf.openFraction_),
|
||||
openingTime_(ptf.openingTime_),
|
||||
maxOpenFractionDelta_(ptf.maxOpenFractionDelta_),
|
||||
@ -166,6 +173,13 @@ void Foam::activeBaffleVelocityFvPatchVectorField::autoMap
|
||||
[
|
||||
cyclicPatchLabel_
|
||||
].patchSlice(areas);
|
||||
nbrCyclicSf_ = refCast<const cyclicFvPatch>
|
||||
(
|
||||
patch().boundaryMesh()
|
||||
[
|
||||
cyclicPatchLabel_
|
||||
]
|
||||
).neighbFvPatch().patch().patchSlice(areas);
|
||||
}
|
||||
|
||||
void Foam::activeBaffleVelocityFvPatchVectorField::rmap
|
||||
@ -183,6 +197,13 @@ void Foam::activeBaffleVelocityFvPatchVectorField::rmap
|
||||
[
|
||||
cyclicPatchLabel_
|
||||
].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 labelList& cyclicFaceCells = cyclicPatch.patch().faceCells();
|
||||
label nCyclicFaces = cyclicFaceCells.size();
|
||||
label nCyclicFacesPerSide = nCyclicFaces/2;
|
||||
const fvPatch& nbrPatch = refCast<const cyclicFvPatch>
|
||||
(
|
||||
cyclicPatch
|
||||
).neighbFvPatch();
|
||||
const labelList& nbrFaceCells = nbrPatch.patch().faceCells();
|
||||
|
||||
scalar forceDiff = 0;
|
||||
|
||||
for (label facei=0; facei<nCyclicFacesPerSide; facei++)
|
||||
// Add this side
|
||||
forAll(cyclicFaceCells, 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_ =
|
||||
max(min(
|
||||
openFraction_
|
||||
+ max
|
||||
max
|
||||
(
|
||||
min
|
||||
(
|
||||
this->db().time().deltaTValue()/openingTime_,
|
||||
maxOpenFractionDelta_
|
||||
)
|
||||
*(orientation_*sign(forceDiff)),
|
||||
1 - 1e-6), 1e-6);
|
||||
openFraction_
|
||||
+ max
|
||||
(
|
||||
this->db().time().deltaTValue()/openingTime_,
|
||||
maxOpenFractionDelta_
|
||||
)
|
||||
*(orientation_*sign(forceDiff)),
|
||||
1 - 1e-6
|
||||
),
|
||||
1e-6
|
||||
);
|
||||
|
||||
Info<< "openFraction = " << openFraction_ << endl;
|
||||
|
||||
@ -239,10 +271,16 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
|
||||
}
|
||||
const_cast<scalarField&>(patch().magSf()) = mag(patch().Sf());
|
||||
|
||||
// Update owner side of cyclic
|
||||
const_cast<vectorField&>(cyclicPatch.Sf()) =
|
||||
openFraction_*initCyclicSf_;
|
||||
const_cast<scalarField&>(cyclicPatch.magSf()) =
|
||||
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();
|
||||
}
|
||||
@ -264,8 +302,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::write(Ostream& os) const
|
||||
<< maxOpenFractionDelta_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("openFraction")
|
||||
<< openFraction_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("p")
|
||||
<< pName_ << token::END_STATEMENT << nl;
|
||||
writeEntryIfDifferent<word>(os, "p", "p", pName_);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
||||
@ -72,9 +72,12 @@ class activeBaffleVelocityFvPatchVectorField
|
||||
//- Initial wall patch areas
|
||||
vectorField initWallSf_;
|
||||
|
||||
//- Initial cyclic patch areas
|
||||
//- Initial this-side cyclic patch areas
|
||||
vectorField initCyclicSf_;
|
||||
|
||||
//- Initial neighbour-side cyclic patch areas
|
||||
vectorField nbrCyclicSf_;
|
||||
|
||||
//- Current fraction of the active baffle which is open
|
||||
scalar openFraction_;
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ fanFvPatchField<Type>::fanFvPatchField
|
||||
:
|
||||
jumpCyclicFvPatchField<Type>(p, iF),
|
||||
f_(0),
|
||||
jump_(this->size()/2, 0.0)
|
||||
jump_(this->size(), 0.0)
|
||||
{}
|
||||
|
||||
|
||||
@ -72,12 +72,14 @@ fanFvPatchField<Type>::fanFvPatchField
|
||||
:
|
||||
jumpCyclicFvPatchField<Type>(p, iF),
|
||||
f_(),
|
||||
jump_(this->size()/2, 0.0)
|
||||
jump_(this->size(), 0.0)
|
||||
{
|
||||
{
|
||||
Istream& is = dict.lookup("f");
|
||||
is.format(IOstream::ASCII);
|
||||
is >> f_;
|
||||
|
||||
// Check that f_ table is same on both sides.?
|
||||
}
|
||||
|
||||
if (dict.found("value"))
|
||||
@ -129,21 +131,7 @@ void fanFvPatchField<Type>::autoMap
|
||||
)
|
||||
{
|
||||
jumpCyclicFvPatchField<Type>::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);
|
||||
}
|
||||
jump_.autoMap(m);
|
||||
}
|
||||
|
||||
|
||||
@ -156,24 +144,9 @@ void fanFvPatchField<Type>::rmap
|
||||
{
|
||||
jumpCyclicFvPatchField<Type>::rmap(ptf, addr);
|
||||
|
||||
// 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];
|
||||
}
|
||||
|
||||
const fanFvPatchField<Type>& tiptf =
|
||||
refCast<const fanFvPatchField<Type> >(ptf);
|
||||
|
||||
jump_.rmap(tiptf.jump_, addr);
|
||||
|
||||
jump_.setSize(oldSize);
|
||||
}
|
||||
const fanFvPatchField<Type>& tiptf =
|
||||
refCast<const fanFvPatchField<Type> >(ptf);
|
||||
jump_.rmap(tiptf.jump_, addr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -132,7 +132,13 @@ public:
|
||||
|
||||
// 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
|
||||
{
|
||||
return jump_;
|
||||
|
||||
@ -47,6 +47,7 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
// Constant
|
||||
jump_ = f_[0];
|
||||
|
||||
if (f_.size() > 1)
|
||||
@ -57,21 +58,11 @@ void Foam::fanFvPatchField<Foam::scalar>::updateCoeffs()
|
||||
const fvsPatchField<scalar>& phip =
|
||||
patch().patchField<surfaceScalarField, scalar>(phi);
|
||||
|
||||
scalarField Un = max
|
||||
(
|
||||
scalarField::subField(phip, size()/2)
|
||||
/scalarField::subField(patch().magSf(), size()/2),
|
||||
scalar(0)
|
||||
);
|
||||
scalarField Un = max(phip/patch().magSf(), scalar(0));
|
||||
|
||||
if (phi.dimensions() == dimDensity*dimVelocity*dimArea)
|
||||
{
|
||||
Un /=
|
||||
scalarField::subField
|
||||
(
|
||||
patch().lookupPatchField<volScalarField, scalar>("rho"),
|
||||
size()/2
|
||||
);
|
||||
Un /= patch().lookupPatchField<volScalarField, scalar>("rho");
|
||||
}
|
||||
|
||||
for (label i=1; i<f_.size(); i++)
|
||||
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -103,6 +103,8 @@ void Foam::fvMeshSubset::doCoupledPatches
|
||||
|
||||
if (syncPar && Pstream::parRun())
|
||||
{
|
||||
PstreamBuffers pBufs(Pstream::nonBlocking);
|
||||
|
||||
// Send face usage across processor patches
|
||||
forAll (oldPatches, oldPatchI)
|
||||
{
|
||||
@ -113,17 +115,14 @@ void Foam::fvMeshSubset::doCoupledPatches
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
|
||||
OPstream toNeighbour
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
UOPstream toNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||
|
||||
toNeighbour
|
||||
<< SubList<label>(nCellsUsingFace, pp.size(), pp.start());
|
||||
}
|
||||
}
|
||||
|
||||
pBufs.finishedSends();
|
||||
|
||||
// Receive face usage count and check for faces that become uncoupled.
|
||||
forAll (oldPatches, oldPatchI)
|
||||
@ -135,11 +134,7 @@ void Foam::fvMeshSubset::doCoupledPatches
|
||||
const processorPolyPatch& procPatch =
|
||||
refCast<const processorPolyPatch>(pp);
|
||||
|
||||
IPstream fromNeighbour
|
||||
(
|
||||
Pstream::blocking,
|
||||
procPatch.neighbProcNo()
|
||||
);
|
||||
UIPstream fromNeighbour(procPatch.neighbProcNo(), pBufs);
|
||||
|
||||
labelList nbrCellsUsingFace(fromNeighbour);
|
||||
|
||||
|
||||
@ -100,6 +100,12 @@ public:
|
||||
return procPolyPatch_.neighbProcNo();
|
||||
}
|
||||
|
||||
//- Return message tag used for sending
|
||||
virtual int tag() const
|
||||
{
|
||||
return UPstream::msgType();
|
||||
}
|
||||
|
||||
//- Return true if running parallel
|
||||
virtual bool coupled() const
|
||||
{
|
||||
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -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
|
||||
|
||||
// ************************************************************************* //
|
||||
@ -322,36 +322,18 @@ Foam::pointField Foam::autoSnapDriver::smoothPatchDisplacement
|
||||
|
||||
forAll(patches, patchI)
|
||||
{
|
||||
if (Pstream::parRun() && isA<processorPolyPatch>(patches[patchI]))
|
||||
if
|
||||
(
|
||||
patches[patchI].coupled()
|
||||
&& refCast<const coupledPolyPatch>(patches[patchI]).owner()
|
||||
)
|
||||
{
|
||||
const processorPolyPatch& pp =
|
||||
refCast<const processorPolyPatch>(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 coupledPolyPatch& pp =
|
||||
refCast<const coupledPolyPatch>(patches[patchI]);
|
||||
|
||||
const vectorField::subField faceCentres = pp.faceCentres();
|
||||
|
||||
for (label i = 0; i < pp.size()/2; i++)
|
||||
forAll(pp, i)
|
||||
{
|
||||
const face& f = pp[i];
|
||||
const point& fc = faceCentres[i];
|
||||
|
||||
@ -91,20 +91,6 @@ bool Foam::blockMesh::readPatches
|
||||
>> patchTypes[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
|
||||
patchStream >> tmpBlocksPatches[nPatches];
|
||||
|
||||
@ -138,57 +124,56 @@ bool Foam::blockMesh::readPatches
|
||||
|
||||
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";
|
||||
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 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++;
|
||||
tmpBlocksPatches.setSize(nPatches + 1);
|
||||
patchNames.setSize(nPatches + 1);
|
||||
patchTypes.setSize(nPatches + 1);
|
||||
nbrPatchNames.setSize(nPatches + 1);
|
||||
}
|
||||
|
||||
// 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;
|
||||
@ -495,6 +480,29 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
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
|
||||
(
|
||||
IOobject
|
||||
@ -509,11 +517,9 @@ Foam::polyMesh* Foam::blockMesh::createTopology(IOdictionary& meshDescription)
|
||||
xferCopy(blockPointField_), // copy these points, do NOT move
|
||||
tmpBlockCells,
|
||||
tmpBlocksPatches,
|
||||
patchNames,
|
||||
patchTypes,
|
||||
patchDicts,
|
||||
defaultPatchName,
|
||||
defaultPatchType,
|
||||
patchPhysicalTypes
|
||||
defaultPatchType
|
||||
);
|
||||
}
|
||||
else if (meshDescription.found("boundary"))
|
||||
|
||||
@ -57,49 +57,6 @@ void Foam::PointEdgeWave<Type>::offset(const label val, labelList& elems)
|
||||
// - list of halfA points (in cyclic patch points)
|
||||
// - list of halfB points (can overlap with A!)
|
||||
// - 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
|
||||
template <class Type>
|
||||
void Foam::PointEdgeWave<Type>::leaveDomain
|
||||
@ -559,96 +516,57 @@ void Foam::PointEdgeWave<Type>::handleCyclicPatches()
|
||||
// 1. Send all point info on cyclic patches. Send as
|
||||
// face label + offset in face.
|
||||
|
||||
label cycHalf = 0;
|
||||
|
||||
forAll(mesh_.boundaryMesh(), patchI)
|
||||
{
|
||||
const polyPatch& patch = mesh_.boundaryMesh()[patchI];
|
||||
|
||||
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 =
|
||||
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())
|
||||
{
|
||||
// received data from half1
|
||||
transform(cycPatch.forwardT(), halfAInfo);
|
||||
|
||||
// received data from half2
|
||||
transform(cycPatch.reverseT(), halfBInfo);
|
||||
transform(cycPatch.forwardT(), nbrInfo);
|
||||
}
|
||||
|
||||
if (debug)
|
||||
{
|
||||
Pout<< "Cyclic patch " << patchI << ' ' << patch.name()
|
||||
<< " Changed on first half : " << halfAInfo.size()
|
||||
<< " Changed on second half : " << halfBInfo.size()
|
||||
<< " Changed : " << nbrInfo.size()
|
||||
<< endl;
|
||||
}
|
||||
|
||||
// Half1: update with data from halfB
|
||||
updateFromPatchInfo
|
||||
(
|
||||
patch,
|
||||
halfA,
|
||||
halfBOwner,
|
||||
halfBIndex,
|
||||
halfBInfo
|
||||
);
|
||||
|
||||
// Half2: update with data from halfA
|
||||
updateFromPatchInfo
|
||||
(
|
||||
patch,
|
||||
halfB,
|
||||
halfAOwner,
|
||||
halfAIndex,
|
||||
halfAInfo
|
||||
cycPatch,
|
||||
cycPatch,
|
||||
nbrOwner,
|
||||
nbrIndex,
|
||||
nbrInfo
|
||||
);
|
||||
|
||||
if (debug)
|
||||
@ -687,7 +605,6 @@ Foam::PointEdgeWave<Type>::PointEdgeWave
|
||||
changedEdges_(mesh_.nEdges()),
|
||||
nChangedEdges_(0),
|
||||
nCyclicPatches_(countPatchType<cyclicPolyPatch>()),
|
||||
cycHalves_(2*nCyclicPatches_),
|
||||
nEvals_(0),
|
||||
nUnvisitedPoints_(mesh_.nPoints()),
|
||||
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
|
||||
setPointInfo(changedPoints, changedPointsInfo);
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user