Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev
This commit is contained in:
commit
395a07ce2a
@ -34,7 +34,7 @@ Description
|
||||
#include "fvMesh.H"
|
||||
#include "volFields.H"
|
||||
#include "Time.H"
|
||||
#include "mapDistribute.H"
|
||||
//#include "mapDistribute.H"
|
||||
#include "OFstream.H"
|
||||
#include "meshTools.H"
|
||||
//#include "FECCellToFaceStencil.H"
|
||||
|
@ -23,19 +23,23 @@ License
|
||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
|
||||
Application
|
||||
icoFoam
|
||||
parallelTest
|
||||
|
||||
Description
|
||||
Incompressible laminar CFD code.
|
||||
Test for various parallel routines.
|
||||
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "List.H"
|
||||
#include "mapDistribute.H"
|
||||
#include "argList.H"
|
||||
#include "Time.H"
|
||||
#include "IPstream.H"
|
||||
#include "OPstream.H"
|
||||
#include "vector.H"
|
||||
#include "IOstreams.H"
|
||||
#include "Random.H"
|
||||
#include "Tuple2.H"
|
||||
|
||||
using namespace Foam;
|
||||
|
||||
@ -47,6 +51,99 @@ int main(int argc, char *argv[])
|
||||
# include "setRootCase.H"
|
||||
# include "createTime.H"
|
||||
|
||||
|
||||
// Test mapDistribute
|
||||
// ~~~~~~~~~~~~~~~~~~
|
||||
|
||||
if (false)
|
||||
{
|
||||
Random rndGen(43544*Pstream::myProcNo());
|
||||
|
||||
// Generate random data.
|
||||
List<Tuple2<label, List<scalar> > > complexData(100);
|
||||
forAll(complexData, i)
|
||||
{
|
||||
complexData[i].first() = rndGen.integer(0, Pstream::nProcs()-1);
|
||||
complexData[i].second().setSize(3);
|
||||
complexData[i].second()[0] = 1;
|
||||
complexData[i].second()[1] = 2;
|
||||
complexData[i].second()[2] = 3;
|
||||
}
|
||||
|
||||
// Send all ones to processor indicated by .first()
|
||||
|
||||
|
||||
// Count how many to send
|
||||
labelList nSend(Pstream::nProcs(), 0);
|
||||
forAll(complexData, i)
|
||||
{
|
||||
label procI = complexData[i].first();
|
||||
nSend[procI]++;
|
||||
}
|
||||
|
||||
// Sync how many to send
|
||||
labelListList allNTrans(Pstream::nProcs());
|
||||
allNTrans[Pstream::myProcNo()] = nSend;
|
||||
combineReduce(allNTrans, mapDistribute::listEq());
|
||||
|
||||
// Collect items to be sent
|
||||
labelListList sendMap(Pstream::nProcs());
|
||||
forAll(sendMap, procI)
|
||||
{
|
||||
sendMap[procI].setSize(nSend[procI]);
|
||||
}
|
||||
nSend = 0;
|
||||
forAll(complexData, i)
|
||||
{
|
||||
label procI = complexData[i].first();
|
||||
sendMap[procI][nSend[procI]++] = i;
|
||||
}
|
||||
|
||||
// Collect items to be received
|
||||
labelListList recvMap(Pstream::nProcs());
|
||||
forAll(recvMap, procI)
|
||||
{
|
||||
recvMap[procI].setSize(allNTrans[procI][Pstream::myProcNo()]);
|
||||
}
|
||||
|
||||
label constructSize = 0;
|
||||
// Construct with my own elements first
|
||||
forAll(recvMap[Pstream::myProcNo()], i)
|
||||
{
|
||||
recvMap[Pstream::myProcNo()][i] = constructSize++;
|
||||
}
|
||||
// Construct from other processors
|
||||
forAll(recvMap, procI)
|
||||
{
|
||||
if (procI != Pstream::myProcNo())
|
||||
{
|
||||
forAll(recvMap[procI], i)
|
||||
{
|
||||
recvMap[procI][i] = constructSize++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Construct distribute map (destructively)
|
||||
mapDistribute map(constructSize, sendMap.xfer(), recvMap.xfer());
|
||||
|
||||
// Distribute complexData
|
||||
mapDistribute::distribute
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
List<labelPair>(),
|
||||
map.constructSize(),
|
||||
map.subMap(),
|
||||
map.constructMap(),
|
||||
complexData
|
||||
);
|
||||
|
||||
Pout<< "complexData:" << complexData << endl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
Perr<< "\nStarting transfers\n" << endl;
|
||||
@ -60,13 +157,13 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
Perr<< "slave sending to master "
|
||||
<< Pstream::masterNo() << endl;
|
||||
OPstream toMaster(Pstream::masterNo());
|
||||
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
|
||||
toMaster << data;
|
||||
}
|
||||
|
||||
Perr<< "slave receiving from master "
|
||||
<< Pstream::masterNo() << endl;
|
||||
IPstream fromMaster(Pstream::masterNo());
|
||||
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
|
||||
fromMaster >> data;
|
||||
|
||||
Perr<< data << endl;
|
||||
@ -81,7 +178,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
{
|
||||
Perr << "master receiving from slave " << slave << endl;
|
||||
IPstream fromSlave(slave);
|
||||
IPstream fromSlave(Pstream::blocking, slave);
|
||||
fromSlave >> data;
|
||||
|
||||
Perr<< data << endl;
|
||||
@ -95,7 +192,7 @@ int main(int argc, char *argv[])
|
||||
)
|
||||
{
|
||||
Perr << "master sending to slave " << slave << endl;
|
||||
OPstream toSlave(slave);
|
||||
OPstream toSlave(Pstream::blocking, slave);
|
||||
toSlave << data;
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ License
|
||||
|
||||
Foam::labelList Foam::blockMesh::createMergeList()
|
||||
{
|
||||
Info<< nl << "Creating merge list " << flush;
|
||||
Info<< nl << "Creating merge list" << flush;
|
||||
|
||||
labelList MergeList(nPoints_, -1);
|
||||
|
||||
|
@ -158,45 +158,33 @@ int main(int argc, char *argv[])
|
||||
|
||||
|
||||
label trianglei = 0;
|
||||
label maxRegion1 = labelMin;
|
||||
|
||||
// Copy triangles1 into trianglesAll
|
||||
// Determine max region.
|
||||
|
||||
forAll(surface1, faceI)
|
||||
{
|
||||
facesAll[trianglei] = surface1[faceI];
|
||||
|
||||
maxRegion1 = max(maxRegion1, facesAll[trianglei].region());
|
||||
|
||||
trianglei++;
|
||||
facesAll[trianglei++] = surface1[faceI];
|
||||
}
|
||||
label nRegions1 = surface1.patches().size();
|
||||
|
||||
label nRegions1 = maxRegion1 + 1;
|
||||
|
||||
if (!mergeRegions)
|
||||
{
|
||||
Info<< "Surface " << inFileName1 << " has " << nRegions1 << " regions"
|
||||
Info<< "Surface " << inFileName1 << " has " << nRegions1
|
||||
<< " regions"
|
||||
<< nl
|
||||
<< "All region numbers in " << inFileName2 << " will be offset"
|
||||
<< " by this amount" << nl << endl;
|
||||
}
|
||||
|
||||
// Add (renumbered) surface2 triangles
|
||||
label maxRegion2 = labelMin;
|
||||
|
||||
forAll(surface2, faceI)
|
||||
{
|
||||
const labelledTri& tri = surface2[faceI];
|
||||
|
||||
labelledTri& destTri = facesAll[trianglei++];
|
||||
|
||||
destTri[0] = tri[0] + points1.size();
|
||||
destTri[1] = tri[1] + points1.size();
|
||||
destTri[2] = tri[2] + points1.size();
|
||||
|
||||
maxRegion2 = max(maxRegion2, tri.region());
|
||||
|
||||
if (mergeRegions)
|
||||
{
|
||||
destTri.region() = tri.region();
|
||||
@ -207,7 +195,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
|
||||
label nRegions2 = maxRegion2 + 1;
|
||||
label nRegions2 = surface2.patches().size();
|
||||
|
||||
geometricSurfacePatchList newPatches;
|
||||
|
||||
@ -218,11 +206,11 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(surface1.patches(), patchI)
|
||||
{
|
||||
newPatches[patchI] = surface1.patches()[ patchI];
|
||||
newPatches[patchI] = surface1.patches()[patchI];
|
||||
}
|
||||
forAll(surface2.patches(), patchI)
|
||||
{
|
||||
newPatches[patchI] = surface2.patches()[ patchI];
|
||||
newPatches[patchI] = surface2.patches()[patchI];
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -244,12 +232,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
forAll(surface1.patches(), patchI)
|
||||
{
|
||||
newPatches[newPatchI++] = surface1.patches()[ patchI];
|
||||
newPatches[newPatchI++] = surface1.patches()[patchI];
|
||||
}
|
||||
|
||||
forAll(surface2.patches(), patchI)
|
||||
{
|
||||
newPatches[newPatchI++] = surface2.patches()[ patchI];
|
||||
newPatches[newPatchI++] = surface2.patches()[patchI];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@ FoamFile
|
||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||
|
||||
// Select triangles by label
|
||||
faces ();
|
||||
faces #include "badFaces";
|
||||
|
||||
// Select triangles using given points (local point numbering)
|
||||
localPoints ( );
|
||||
|
@ -162,13 +162,14 @@ Foam::List<T>::List(const UList<T>& a, const unallocLabelList& map)
|
||||
{
|
||||
if (this->size_)
|
||||
{
|
||||
// Note:cannot use List_ELEM since third argument has to be index.
|
||||
|
||||
this->v_ = new T[this->size_];
|
||||
|
||||
List_ACCESS(T, (*this), vp);
|
||||
List_CONST_ACCESS(T, a, ap);
|
||||
List_FOR_ALL(map, i)
|
||||
List_ELEM((*this), vp, i) = List_ELEM(a, ap, (map[i]));
|
||||
List_END_FOR_ALL
|
||||
forAll(*this, i)
|
||||
{
|
||||
this->v_[i] = a[map[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -127,11 +127,10 @@ void Foam::Time::setControls()
|
||||
}
|
||||
else
|
||||
{
|
||||
WarningIn("Time::setControls()")
|
||||
<< " expected startTime, firstTime or latestTime"
|
||||
<< " found '" << startFrom
|
||||
<< "' in dictionary " << controlDict_.name() << nl
|
||||
<< " Setting time to " << startTime_ << endl;
|
||||
FatalIOErrorIn("Time::setControls()", controlDict_)
|
||||
<< "expected startTime, firstTime or latestTime"
|
||||
<< " found '" << startFrom << "'"
|
||||
<< exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,10 +150,10 @@ void Foam::Time::setControls()
|
||||
> Pstream::nProcs()*deltaT_/10.0
|
||||
)
|
||||
{
|
||||
FatalErrorIn("Time::setControls()")
|
||||
FatalIOErrorIn("Time::setControls()", controlDict_)
|
||||
<< "Start time is not the same for all processors" << nl
|
||||
<< "processor " << Pstream::myProcNo() << " has startTime "
|
||||
<< startTime_ << exit(FatalError);
|
||||
<< startTime_ << exit(FatalIOError);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -172,8 +172,8 @@ const Foam::List<Foam::labelPair>& Foam::mapDistribute::schedule() const
|
||||
Foam::mapDistribute::mapDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
const labelListList& subMap,
|
||||
const labelListList& constructMap
|
||||
const Xfer<labelListList>& subMap,
|
||||
const Xfer<labelListList>& constructMap
|
||||
)
|
||||
:
|
||||
constructSize_(constructSize),
|
||||
@ -183,22 +183,6 @@ Foam::mapDistribute::mapDistribute
|
||||
{}
|
||||
|
||||
|
||||
//- (optionally destructively) construct from components
|
||||
Foam::mapDistribute::mapDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
labelListList& subMap,
|
||||
labelListList& constructMap,
|
||||
const bool reUse // clone or reuse
|
||||
)
|
||||
:
|
||||
constructSize_(constructSize),
|
||||
subMap_(subMap, reUse),
|
||||
constructMap_(constructMap, reUse),
|
||||
schedulePtr_()
|
||||
{}
|
||||
|
||||
|
||||
Foam::mapDistribute::mapDistribute
|
||||
(
|
||||
const labelList& sendProcs,
|
||||
|
@ -83,23 +83,36 @@ class mapDistribute
|
||||
|
||||
public:
|
||||
|
||||
// Public classes
|
||||
|
||||
//- combineReduce operator for lists. Used for counting.
|
||||
class listEq
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
template<class T>
|
||||
void operator()(T& x, const T& y) const
|
||||
{
|
||||
forAll(y, i)
|
||||
{
|
||||
if (y[i].size())
|
||||
{
|
||||
x[i] = y[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Constructors
|
||||
|
||||
//- Construct from components
|
||||
mapDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
const labelListList& subMap,
|
||||
const labelListList& constructMap
|
||||
);
|
||||
|
||||
//- (optionally destructively) construct from components
|
||||
mapDistribute
|
||||
(
|
||||
const label constructSize,
|
||||
labelListList& subMap,
|
||||
labelListList& constructMap,
|
||||
const bool reUse // clone or reuse
|
||||
const Xfer<labelListList>& subMap,
|
||||
const Xfer<labelListList>& constructMap
|
||||
);
|
||||
|
||||
//- Construct from reverse addressing: per data item the send
|
||||
@ -205,11 +218,7 @@ public:
|
||||
template<class T>
|
||||
void distribute(List<T>& fld) const
|
||||
{
|
||||
if
|
||||
(
|
||||
Pstream::defaultCommsType == Pstream::nonBlocking
|
||||
&& contiguous<T>()
|
||||
)
|
||||
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||
{
|
||||
distribute
|
||||
(
|
||||
|
@ -68,35 +68,15 @@ public:
|
||||
mapDistributeLagrangian
|
||||
(
|
||||
const label nNewParticles,
|
||||
const labelListList& subParticleMap,
|
||||
const labelListList& constructParticleMap,
|
||||
const labelListList& constructCellLabels
|
||||
const Xfer<labelListList>& subParticleMap,
|
||||
const Xfer<labelListList>& constructParticleMap,
|
||||
const Xfer<labelListList>& constructCellLabels
|
||||
)
|
||||
:
|
||||
particleMap_(nNewParticles, subParticleMap, constructParticleMap),
|
||||
constructCellLabels_(constructCellLabels)
|
||||
{}
|
||||
|
||||
//- Construct from components and steal storage
|
||||
mapDistributeLagrangian
|
||||
(
|
||||
const label nNewParticles,
|
||||
labelListList& subParticleMap,
|
||||
labelListList& constructParticleMap,
|
||||
labelListList& constructCellLabels,
|
||||
const bool reUse
|
||||
)
|
||||
:
|
||||
particleMap_
|
||||
(
|
||||
nNewParticles,
|
||||
subParticleMap,
|
||||
constructParticleMap,
|
||||
reUse
|
||||
),
|
||||
constructCellLabels_(constructCellLabels, reUse)
|
||||
{}
|
||||
|
||||
|
||||
// Member Functions
|
||||
|
||||
|
@ -66,27 +66,27 @@ Foam::mapDistributePolyMesh::mapDistributePolyMesh
|
||||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
const labelList& oldPatchStarts,
|
||||
const labelList& oldPatchNMeshPoints,
|
||||
const Xfer<labelList>& oldPatchStarts,
|
||||
const Xfer<labelList>& oldPatchNMeshPoints,
|
||||
|
||||
// how to subset pieces of mesh to send across
|
||||
const labelListList& subPointMap,
|
||||
const labelListList& subFaceMap,
|
||||
const labelListList& subCellMap,
|
||||
const labelListList& subPatchMap,
|
||||
const Xfer<labelListList>& subPointMap,
|
||||
const Xfer<labelListList>& subFaceMap,
|
||||
const Xfer<labelListList>& subCellMap,
|
||||
const Xfer<labelListList>& subPatchMap,
|
||||
|
||||
// how to reconstruct received mesh
|
||||
const labelListList& constructPointMap,
|
||||
const labelListList& constructFaceMap,
|
||||
const labelListList& constructCellMap,
|
||||
const labelListList& constructPatchMap
|
||||
const Xfer<labelListList>& constructPointMap,
|
||||
const Xfer<labelListList>& constructFaceMap,
|
||||
const Xfer<labelListList>& constructCellMap,
|
||||
const Xfer<labelListList>& constructPatchMap
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
nOldPoints_(nOldPoints),
|
||||
nOldFaces_(nOldFaces),
|
||||
nOldCells_(nOldCells),
|
||||
oldPatchSizes_(oldPatchStarts.size()),
|
||||
oldPatchSizes_(oldPatchStarts().size()),
|
||||
oldPatchStarts_(oldPatchStarts),
|
||||
oldPatchNMeshPoints_(oldPatchNMeshPoints),
|
||||
pointMap_(mesh.nPoints(), subPointMap, constructPointMap),
|
||||
@ -98,44 +98,6 @@ Foam::mapDistributePolyMesh::mapDistributePolyMesh
|
||||
}
|
||||
|
||||
|
||||
//- (optionally destructively) construct from components
|
||||
Foam::mapDistributePolyMesh::mapDistributePolyMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
labelList& oldPatchStarts,
|
||||
labelList& oldPatchNMeshPoints,
|
||||
|
||||
labelListList& subPointMap,
|
||||
labelListList& subFaceMap,
|
||||
labelListList& subCellMap,
|
||||
labelListList& subPatchMap,
|
||||
labelListList& constructPointMap,
|
||||
labelListList& constructFaceMap,
|
||||
labelListList& constructCellMap,
|
||||
labelListList& constructPatchMap,
|
||||
const bool reUse // clone or reuse
|
||||
)
|
||||
:
|
||||
mesh_(mesh),
|
||||
nOldPoints_(nOldPoints),
|
||||
nOldFaces_(nOldFaces),
|
||||
nOldCells_(nOldCells),
|
||||
oldPatchSizes_(oldPatchStarts.size()),
|
||||
oldPatchStarts_(oldPatchStarts, reUse),
|
||||
oldPatchNMeshPoints_(oldPatchNMeshPoints, reUse),
|
||||
|
||||
pointMap_(mesh.nPoints(), subPointMap, constructPointMap, reUse),
|
||||
faceMap_(mesh.nFaces(), subFaceMap, constructFaceMap, reUse),
|
||||
cellMap_(mesh.nCells(), subCellMap, constructCellMap, reUse),
|
||||
patchMap_(mesh.boundaryMesh().size(), subPatchMap, constructPatchMap, reUse)
|
||||
{
|
||||
calcPatchSizes();
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||
|
||||
void Foam::mapDistributePolyMesh::distributePointIndices(labelList& lst) const
|
||||
|
@ -120,42 +120,20 @@ public:
|
||||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
const labelList& oldPatchStarts,
|
||||
const labelList& oldPatchNMeshPoints,
|
||||
const Xfer<labelList>& oldPatchStarts,
|
||||
const Xfer<labelList>& oldPatchNMeshPoints,
|
||||
|
||||
// how to subset pieces of mesh to send across
|
||||
const labelListList& subPointMap,
|
||||
const labelListList& subFaceMap,
|
||||
const labelListList& subCellMap,
|
||||
const labelListList& subPatchMap,
|
||||
const Xfer<labelListList>& subPointMap,
|
||||
const Xfer<labelListList>& subFaceMap,
|
||||
const Xfer<labelListList>& subCellMap,
|
||||
const Xfer<labelListList>& subPatchMap,
|
||||
|
||||
// how to reconstruct received mesh
|
||||
const labelListList& constructPointMap,
|
||||
const labelListList& constructFaceMap,
|
||||
const labelListList& constructCellMap,
|
||||
const labelListList& constructPatchMap
|
||||
);
|
||||
|
||||
//- (optionally destructively) construct from components
|
||||
// Note that mesh has to be changed already!
|
||||
mapDistributePolyMesh
|
||||
(
|
||||
const polyMesh& mesh,
|
||||
const label nOldPoints,
|
||||
const label nOldFaces,
|
||||
const label nOldCells,
|
||||
labelList& oldPatchStarts,
|
||||
labelList& oldPatchNMeshPoints,
|
||||
|
||||
labelListList& subPointMap,
|
||||
labelListList& subFaceMap,
|
||||
labelListList& subCellMap,
|
||||
labelListList& subPatchMap,
|
||||
labelListList& constructPointMap,
|
||||
labelListList& constructFaceMap,
|
||||
labelListList& constructCellMap,
|
||||
labelListList& constructPatchMap,
|
||||
const bool reUse // clone or reuse
|
||||
const Xfer<labelListList>& constructPointMap,
|
||||
const Xfer<labelListList>& constructFaceMap,
|
||||
const Xfer<labelListList>& constructCellMap,
|
||||
const Xfer<labelListList>& constructPatchMap
|
||||
);
|
||||
|
||||
|
||||
|
@ -25,6 +25,7 @@ License
|
||||
\*---------------------------------------------------------------------------*/
|
||||
|
||||
#include "Pstream.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
|
||||
@ -184,138 +185,269 @@ void Foam::mapDistribute::distribute
|
||||
{
|
||||
if (!contiguous<T>())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class T>\n"
|
||||
"void mapDistribute::distribute\n"
|
||||
"(\n"
|
||||
" const Pstream::commsTypes commsType,\n"
|
||||
" const List<labelPair>& schedule,\n"
|
||||
" const label constructSize,\n"
|
||||
" const labelListList& subMap,\n"
|
||||
" const labelListList& constructMap,\n"
|
||||
" List<T>& field\n"
|
||||
")\n"
|
||||
) << "Non-blocking only supported for contiguous data."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
// 1. convert to contiguous buffer
|
||||
// 2. send buffer
|
||||
// 3. receive buffer
|
||||
// 4. read from buffer into List<T>
|
||||
|
||||
// Set up sends to neighbours
|
||||
List<List<char> > sendFields(Pstream::nProcs());
|
||||
labelListList allNTrans(Pstream::nProcs());
|
||||
labelList& nsTransPs = allNTrans[Pstream::myProcNo()];
|
||||
nsTransPs.setSize(Pstream::nProcs(), 0);
|
||||
|
||||
List<List<T > > sendFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
// Stream data into sendField buffers
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
List<T>& subField = sendFields[domain];
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
// Put data into send buffer
|
||||
OPstream toDomain(Pstream::nonBlocking, domain);
|
||||
toDomain << UIndirectList<T>(field, map);
|
||||
|
||||
// Store the size
|
||||
nsTransPs[domain] = toDomain.bufPosition();
|
||||
|
||||
// Transfer buffer out
|
||||
sendFields[domain].transfer(toDomain.buf());
|
||||
toDomain.bufPosition() = 0;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Send sizes across
|
||||
combineReduce(allNTrans, listEq());
|
||||
|
||||
// Start sending buffers
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<const char*>
|
||||
(
|
||||
sendFields[domain].begin()
|
||||
),
|
||||
nsTransPs[domain]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up receives from neighbours
|
||||
|
||||
PtrList<IPstream> fromSlave(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
// Start receiving
|
||||
fromSlave.set
|
||||
(
|
||||
domain,
|
||||
new IPstream
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
allNTrans[domain][Pstream::myProcNo()]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// Set up 'send' to myself
|
||||
const labelList& mySubMap = subMap[Pstream::myProcNo()];
|
||||
List<T> mySubField(mySubMap.size());
|
||||
forAll(mySubMap, i)
|
||||
{
|
||||
mySubField[i] = field[mySubMap[i]];
|
||||
}
|
||||
// Combine bits. Note that can reuse field storage
|
||||
field.setSize(constructSize);
|
||||
// Receive sub field from myself
|
||||
{
|
||||
const labelList& map = constructMap[Pstream::myProcNo()];
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
field[map[i]] = mySubField[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait till all finished
|
||||
IPstream::waitRequests();
|
||||
OPstream::waitRequests();
|
||||
|
||||
// Consume
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
List<T> recvField(fromSlave[domain]);
|
||||
|
||||
if (recvField.size() != map.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class T>\n"
|
||||
"void mapDistribute::distribute\n"
|
||||
"(\n"
|
||||
" const Pstream::commsTypes commsType,\n"
|
||||
" const List<labelPair>& schedule,\n"
|
||||
" const label constructSize,\n"
|
||||
" const labelListList& subMap,\n"
|
||||
" const labelListList& constructMap,\n"
|
||||
" List<T>& field\n"
|
||||
")\n"
|
||||
) << "Expected from processor " << domain
|
||||
<< " " << map.size() << " but received "
|
||||
<< recvField.size() << " elements."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
field[map[i]] = recvField[i];
|
||||
}
|
||||
|
||||
// Delete receive buffer
|
||||
fromSlave.set(domain, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set up sends to neighbours
|
||||
|
||||
List<List<T > > sendFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
List<T>& subField = sendFields[domain];
|
||||
subField.setSize(map.size());
|
||||
forAll(map, i)
|
||||
{
|
||||
subField[i] = field[map[i]];
|
||||
}
|
||||
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<const char*>(subField.begin()),
|
||||
subField.byteSize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up receives from neighbours
|
||||
|
||||
List<List<T > > recvFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
recvFields[domain].setSize(map.size());
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<char*>(recvFields[domain].begin()),
|
||||
recvFields[domain].byteSize()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set up 'send' to myself
|
||||
|
||||
{
|
||||
const labelList& map = subMap[Pstream::myProcNo()];
|
||||
|
||||
List<T>& subField = sendFields[Pstream::myProcNo()];
|
||||
subField.setSize(map.size());
|
||||
forAll(map, i)
|
||||
{
|
||||
subField[i] = field[map[i]];
|
||||
}
|
||||
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<const char*>(subField.begin()),
|
||||
subField.size()*sizeof(T)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up receives from neighbours
|
||||
|
||||
List<List<T > > recvFields(Pstream::nProcs());
|
||||
// Combine bits. Note that can reuse field storage
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
field.setSize(constructSize);
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
|
||||
// Receive sub field from myself (sendFields[Pstream::myProcNo()])
|
||||
{
|
||||
recvFields[domain].setSize(map.size());
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<char*>(recvFields[domain].begin()),
|
||||
recvFields[domain].size()*sizeof(T)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set up 'send' to myself
|
||||
|
||||
{
|
||||
const labelList& map = subMap[Pstream::myProcNo()];
|
||||
|
||||
List<T>& subField = sendFields[Pstream::myProcNo()];
|
||||
subField.setSize(map.size());
|
||||
forAll(map, i)
|
||||
{
|
||||
subField[i] = field[map[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Combine bits. Note that can reuse field storage
|
||||
|
||||
field.setSize(constructSize);
|
||||
|
||||
|
||||
// Receive sub field from myself (sendFields[Pstream::myProcNo()])
|
||||
{
|
||||
const labelList& map = constructMap[Pstream::myProcNo()];
|
||||
const List<T>& subField = sendFields[Pstream::myProcNo()];
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
field[map[i]] = subField[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait for all to finish
|
||||
|
||||
OPstream::waitRequests();
|
||||
IPstream::waitRequests();
|
||||
|
||||
// Collect neighbour fields
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
if (recvFields[domain].size() != map.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class T>\n"
|
||||
"void mapDistribute::distribute\n"
|
||||
"(\n"
|
||||
" const Pstream::commsTypes commsType,\n"
|
||||
" const List<labelPair>& schedule,\n"
|
||||
" const label constructSize,\n"
|
||||
" const labelListList& subMap,\n"
|
||||
" const labelListList& constructMap,\n"
|
||||
" List<T>& field\n"
|
||||
")\n"
|
||||
) << "Expected from processor " << domain
|
||||
<< " " << map.size() << " but received "
|
||||
<< recvFields[domain].size() << " elements."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
const labelList& map = constructMap[Pstream::myProcNo()];
|
||||
const List<T>& subField = sendFields[Pstream::myProcNo()];
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
field[map[i]] = recvFields[domain][i];
|
||||
field[map[i]] = subField[i];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait for all to finish
|
||||
|
||||
OPstream::waitRequests();
|
||||
IPstream::waitRequests();
|
||||
|
||||
// Collect neighbour fields
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
if (recvFields[domain].size() != map.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class T>\n"
|
||||
"void mapDistribute::distribute\n"
|
||||
"(\n"
|
||||
" const Pstream::commsTypes commsType,\n"
|
||||
" const List<labelPair>& schedule,\n"
|
||||
" const label constructSize,\n"
|
||||
" const labelListList& subMap,\n"
|
||||
" const labelListList& constructMap,\n"
|
||||
" List<T>& field\n"
|
||||
")\n"
|
||||
) << "Expected from processor " << domain
|
||||
<< " " << map.size() << " but received "
|
||||
<< recvFields[domain].size() << " elements."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
field[map[i]] = recvFields[domain][i];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -488,137 +620,263 @@ void Foam::mapDistribute::distribute
|
||||
{
|
||||
if (!contiguous<T>())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class T>\n"
|
||||
"void mapDistribute::distribute\n"
|
||||
"(\n"
|
||||
" const Pstream::commsTypes commsType,\n"
|
||||
" const List<labelPair>& schedule,\n"
|
||||
" const label constructSize,\n"
|
||||
" const labelListList& subMap,\n"
|
||||
" const labelListList& constructMap,\n"
|
||||
" List<T>& field\n"
|
||||
")\n"
|
||||
) << "Non-blocking only supported for contiguous data."
|
||||
<< exit(FatalError);
|
||||
}
|
||||
// 1. convert to contiguous buffer
|
||||
// 2. send buffer
|
||||
// 3. receive buffer
|
||||
// 4. read from buffer into List<T>
|
||||
|
||||
// Set up sends to neighbours
|
||||
List<List<char> > sendFields(Pstream::nProcs());
|
||||
labelListList allNTrans(Pstream::nProcs());
|
||||
labelList& nsTransPs = allNTrans[Pstream::myProcNo()];
|
||||
nsTransPs.setSize(Pstream::nProcs());
|
||||
|
||||
List<List<T > > sendFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
// Stream data into sendField buffers
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
List<T>& subField = sendFields[domain];
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
// Put data into send buffer
|
||||
OPstream toDomain(Pstream::nonBlocking, domain);
|
||||
toDomain << UIndirectList<T>(field, map);
|
||||
|
||||
// Store the size
|
||||
nsTransPs[domain] = toDomain.bufPosition();
|
||||
|
||||
// Transfer buffer out
|
||||
sendFields[domain].transfer(toDomain.buf());
|
||||
toDomain.bufPosition() = 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Send sizes across
|
||||
combineReduce(allNTrans, listEq());
|
||||
|
||||
// Start sending buffers
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<const char*>
|
||||
(
|
||||
sendFields[domain].begin()
|
||||
),
|
||||
nsTransPs[domain]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up receives from neighbours
|
||||
|
||||
PtrList<IPstream> fromSlave(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
// Start receiving
|
||||
fromSlave.set
|
||||
(
|
||||
domain,
|
||||
new IPstream
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
allNTrans[domain][Pstream::myProcNo()]
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
{
|
||||
// Set up 'send' to myself
|
||||
List<T> mySubField(field, subMap[Pstream::myProcNo()]);
|
||||
// Combine bits. Note that can reuse field storage
|
||||
field.setSize(constructSize);
|
||||
field = nullValue;
|
||||
// Receive sub field from myself
|
||||
{
|
||||
const labelList& map = constructMap[Pstream::myProcNo()];
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
cop(field[map[i]], mySubField[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait till all finished
|
||||
IPstream::waitRequests();
|
||||
OPstream::waitRequests();
|
||||
|
||||
// Consume
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
List<T> recvField(fromSlave[domain]);
|
||||
|
||||
if (recvField.size() != map.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class T>\n"
|
||||
"void mapDistribute::distribute\n"
|
||||
"(\n"
|
||||
" const Pstream::commsTypes commsType,\n"
|
||||
" const List<labelPair>& schedule,\n"
|
||||
" const label constructSize,\n"
|
||||
" const labelListList& subMap,\n"
|
||||
" const labelListList& constructMap,\n"
|
||||
" List<T>& field\n"
|
||||
")\n"
|
||||
) << "Expected from processor " << domain
|
||||
<< " " << map.size() << " but received "
|
||||
<< recvField.size() << " elements."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
cop(field[map[i]], recvField[i]);
|
||||
}
|
||||
|
||||
// Delete receive buffer
|
||||
fromSlave.set(domain, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set up sends to neighbours
|
||||
|
||||
List<List<T > > sendFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = subMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
List<T>& subField = sendFields[domain];
|
||||
subField.setSize(map.size());
|
||||
forAll(map, i)
|
||||
{
|
||||
subField[i] = field[map[i]];
|
||||
}
|
||||
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<const char*>(subField.begin()),
|
||||
subField.size()*sizeof(T)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up receives from neighbours
|
||||
|
||||
List<List<T > > recvFields(Pstream::nProcs());
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
recvFields[domain].setSize(map.size());
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<char*>(recvFields[domain].begin()),
|
||||
recvFields[domain].size()*sizeof(T)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up 'send' to myself
|
||||
|
||||
{
|
||||
const labelList& map = subMap[Pstream::myProcNo()];
|
||||
|
||||
List<T>& subField = sendFields[Pstream::myProcNo()];
|
||||
subField.setSize(map.size());
|
||||
forAll(map, i)
|
||||
{
|
||||
subField[i] = field[map[i]];
|
||||
}
|
||||
|
||||
OPstream::write
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<const char*>(subField.begin()),
|
||||
subField.size()*sizeof(T)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up receives from neighbours
|
||||
|
||||
List<List<T > > recvFields(Pstream::nProcs());
|
||||
// Combine bits. Note that can reuse field storage
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
field.setSize(constructSize);
|
||||
field = nullValue;
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
// Receive sub field from myself (subField)
|
||||
{
|
||||
recvFields[domain].setSize(map.size());
|
||||
IPstream::read
|
||||
(
|
||||
Pstream::nonBlocking,
|
||||
domain,
|
||||
reinterpret_cast<char*>(recvFields[domain].begin()),
|
||||
recvFields[domain].size()*sizeof(T)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Set up 'send' to myself
|
||||
|
||||
{
|
||||
const labelList& map = subMap[Pstream::myProcNo()];
|
||||
|
||||
List<T>& subField = sendFields[Pstream::myProcNo()];
|
||||
subField.setSize(map.size());
|
||||
forAll(map, i)
|
||||
{
|
||||
subField[i] = field[map[i]];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Combine bits. Note that can reuse field storage
|
||||
|
||||
field.setSize(constructSize);
|
||||
field = nullValue;
|
||||
|
||||
// Receive sub field from myself (subField)
|
||||
{
|
||||
const labelList& map = constructMap[Pstream::myProcNo()];
|
||||
const List<T>& subField = sendFields[Pstream::myProcNo()];
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
cop(field[map[i]], subField[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait for all to finish
|
||||
|
||||
OPstream::waitRequests();
|
||||
IPstream::waitRequests();
|
||||
|
||||
// Collect neighbour fields
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
if (recvFields[domain].size() != map.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class T>\n"
|
||||
"void mapDistribute::distribute\n"
|
||||
"(\n"
|
||||
" const Pstream::commsTypes commsType,\n"
|
||||
" const List<labelPair>& schedule,\n"
|
||||
" const label constructSize,\n"
|
||||
" const labelListList& subMap,\n"
|
||||
" const labelListList& constructMap,\n"
|
||||
" List<T>& field\n"
|
||||
")\n"
|
||||
) << "Expected from processor " << domain
|
||||
<< " " << map.size() << " but received "
|
||||
<< recvFields[domain].size() << " elements."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
const labelList& map = constructMap[Pstream::myProcNo()];
|
||||
const List<T>& subField = sendFields[Pstream::myProcNo()];
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
cop(field[map[i]], recvFields[domain][i]);
|
||||
cop(field[map[i]], subField[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Wait for all to finish
|
||||
|
||||
OPstream::waitRequests();
|
||||
IPstream::waitRequests();
|
||||
|
||||
// Collect neighbour fields
|
||||
|
||||
for (label domain = 0; domain < Pstream::nProcs(); domain++)
|
||||
{
|
||||
const labelList& map = constructMap[domain];
|
||||
|
||||
if (domain != Pstream::myProcNo() && map.size())
|
||||
{
|
||||
if (recvFields[domain].size() != map.size())
|
||||
{
|
||||
FatalErrorIn
|
||||
(
|
||||
"template<class T>\n"
|
||||
"void mapDistribute::distribute\n"
|
||||
"(\n"
|
||||
" const Pstream::commsTypes commsType,\n"
|
||||
" const List<labelPair>& schedule,\n"
|
||||
" const label constructSize,\n"
|
||||
" const labelListList& subMap,\n"
|
||||
" const labelListList& constructMap,\n"
|
||||
" List<T>& field\n"
|
||||
")\n"
|
||||
) << "Expected from processor " << domain
|
||||
<< " " << map.size() << " but received "
|
||||
<< recvFields[domain].size() << " elements."
|
||||
<< abort(FatalError);
|
||||
}
|
||||
|
||||
forAll(map, i)
|
||||
{
|
||||
cop(field[map[i]], recvFields[domain][i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,12 +28,9 @@ License
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "boundBox.H"
|
||||
#include "globalIndex.H"
|
||||
#include "wallPolyPatch.H"
|
||||
#include "mapDistributePolyMesh.H"
|
||||
#include "cellSet.H"
|
||||
#include "syncTools.H"
|
||||
#include "motionSmoother.H"
|
||||
#include "refinementParameters.H"
|
||||
#include "snapParameters.H"
|
||||
#include "layerParameters.H"
|
||||
|
@ -28,14 +28,13 @@ License
|
||||
#include "meshRefinement.H"
|
||||
#include "fvMesh.H"
|
||||
#include "Time.H"
|
||||
#include "boundBox.H"
|
||||
#include "mapDistributePolyMesh.H"
|
||||
#include "cellSet.H"
|
||||
#include "syncTools.H"
|
||||
#include "refinementParameters.H"
|
||||
#include "featureEdgeMesh.H"
|
||||
#include "refinementSurfaces.H"
|
||||
#include "shellSurfaces.H"
|
||||
#include "mapDistributePolyMesh.H"
|
||||
|
||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||
|
||||
|
@ -1418,18 +1418,18 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
nOldPoints,
|
||||
nOldFaces,
|
||||
nOldCells,
|
||||
oldPatchStarts,
|
||||
oldPatchNMeshPoints,
|
||||
oldPatchStarts.xfer(),
|
||||
oldPatchNMeshPoints.xfer(),
|
||||
|
||||
labelListList(1, identity(mesh_.nPoints())),//subPointMap
|
||||
labelListList(1, identity(mesh_.nFaces())), //subFaceMap
|
||||
labelListList(1, identity(mesh_.nCells())), //subCellMap
|
||||
labelListList(1, identity(patches.size())), //subPatchMap
|
||||
labelListList(1, identity(mesh_.nPoints())).xfer(),//subPointMap
|
||||
labelListList(1, identity(mesh_.nFaces())).xfer(), //subFaceMap
|
||||
labelListList(1, identity(mesh_.nCells())).xfer(), //subCellMap
|
||||
labelListList(1, identity(patches.size())).xfer(), //subPatchMap
|
||||
|
||||
labelListList(1, identity(mesh_.nPoints())),//constructPointMap
|
||||
labelListList(1, identity(mesh_.nFaces())), //constructFaceMap
|
||||
labelListList(1, identity(mesh_.nCells())), //constructCellMap
|
||||
labelListList(1, identity(patches.size())) //constructPatchMap
|
||||
labelListList(1, identity(mesh_.nPoints())).xfer(),//pointMap
|
||||
labelListList(1, identity(mesh_.nFaces())).xfer(), //faceMap
|
||||
labelListList(1, identity(mesh_.nCells())).xfer(), //cellMap
|
||||
labelListList(1, identity(patches.size())).xfer() //patchMap
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -2207,19 +2207,18 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
||||
nOldPoints,
|
||||
nOldFaces,
|
||||
nOldCells,
|
||||
oldPatchStarts,
|
||||
oldPatchNMeshPoints,
|
||||
oldPatchStarts.xfer(),
|
||||
oldPatchNMeshPoints.xfer(),
|
||||
|
||||
subPointMap,
|
||||
subFaceMap,
|
||||
subCellMap,
|
||||
subPatchMap,
|
||||
subPointMap.xfer(),
|
||||
subFaceMap.xfer(),
|
||||
subCellMap.xfer(),
|
||||
subPatchMap.xfer(),
|
||||
|
||||
constructPointMap,
|
||||
constructFaceMap,
|
||||
constructCellMap,
|
||||
constructPatchMap,
|
||||
true // reuse storage
|
||||
constructPointMap.xfer(),
|
||||
constructFaceMap.xfer(),
|
||||
constructCellMap.xfer(),
|
||||
constructPatchMap.xfer()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -280,9 +280,8 @@ Foam::extendedCellToFaceStencil::calcDistributeMap
|
||||
new mapDistribute
|
||||
(
|
||||
nCompact,
|
||||
sendCompact,
|
||||
recvCompact,
|
||||
true // reuse send/recv maps.
|
||||
sendCompact.xfer(),
|
||||
recvCompact.xfer()
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -340,9 +340,8 @@ Foam::distributedTriSurfaceMesh::distributeSegments
|
||||
new mapDistribute
|
||||
(
|
||||
segmentI, // size after construction
|
||||
sendMap,
|
||||
constructMap,
|
||||
true // reuse storage
|
||||
sendMap.xfer(),
|
||||
constructMap.xfer()
|
||||
)
|
||||
);
|
||||
}
|
||||
@ -642,9 +641,8 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
|
||||
new mapDistribute
|
||||
(
|
||||
segmentI, // size after construction
|
||||
sendMap,
|
||||
constructMap,
|
||||
true // reuse storage
|
||||
sendMap.xfer(),
|
||||
constructMap.xfer()
|
||||
)
|
||||
);
|
||||
const mapDistribute& map = mapPtr();
|
||||
@ -806,9 +804,8 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
|
||||
new mapDistribute
|
||||
(
|
||||
segmentI, // size after construction
|
||||
sendMap,
|
||||
constructMap,
|
||||
true // reuse storage
|
||||
sendMap.xfer(),
|
||||
constructMap.xfer()
|
||||
)
|
||||
);
|
||||
return mapPtr;
|
||||
@ -2399,9 +2396,8 @@ void Foam::distributedTriSurfaceMesh::distribute
|
||||
new mapDistribute
|
||||
(
|
||||
allTris.size(),
|
||||
faceSendMap,
|
||||
faceConstructMap,
|
||||
true
|
||||
faceSendMap.xfer(),
|
||||
faceConstructMap.xfer()
|
||||
)
|
||||
);
|
||||
pointMap.reset
|
||||
@ -2409,9 +2405,8 @@ void Foam::distributedTriSurfaceMesh::distribute
|
||||
new mapDistribute
|
||||
(
|
||||
allPoints.size(),
|
||||
pointSendMap,
|
||||
pointConstructMap,
|
||||
true
|
||||
pointSendMap.xfer(),
|
||||
pointConstructMap.xfer()
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -128,6 +128,12 @@ public:
|
||||
return index_;
|
||||
}
|
||||
|
||||
//- Return the index of this patch in the boundaryMesh
|
||||
label& index()
|
||||
{
|
||||
return index_;
|
||||
}
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
|
||||
|
@ -544,6 +544,8 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
|
||||
{
|
||||
surfacePatch& newPatch = newPatches[newPatchI];
|
||||
|
||||
newPatch.index() = newPatchI;
|
||||
|
||||
label oldPatchI = newPatchI;
|
||||
|
||||
// start of patch
|
||||
@ -592,6 +594,7 @@ void Foam::triSurface::setDefaultPatches()
|
||||
|
||||
forAll(newPatches, patchI)
|
||||
{
|
||||
patches_[patchI].index() = patchI;
|
||||
patches_[patchI].name() = newPatches[patchI].name();
|
||||
patches_[patchI].geometricType() = newPatches[patchI].geometricType();
|
||||
}
|
||||
|
@ -56,6 +56,32 @@ void epsilonWallFunctionFvPatchScalarField::checkType()
|
||||
}
|
||||
|
||||
|
||||
scalar epsilonWallFunctionFvPatchScalarField::calcYPlusLam
|
||||
(
|
||||
const scalar kappa,
|
||||
const scalar E
|
||||
) const
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
ypl = log(E*ypl)/kappa;
|
||||
}
|
||||
|
||||
return ypl;
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
||||
{
|
||||
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
@ -65,15 +91,13 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF),
|
||||
UName_("U"),
|
||||
kName_("k"),
|
||||
GName_("RASModel::G"),
|
||||
rhoName_("rho"),
|
||||
muName_("mu"),
|
||||
mutName_("mut"),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8)
|
||||
E_(9.8),
|
||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||
|
||||
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -88,15 +112,12 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
kName_(ptf.kName_),
|
||||
GName_(ptf.GName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
muName_(ptf.muName_),
|
||||
mutName_(ptf.mutName_),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_)
|
||||
E_(ptf.E_),
|
||||
yPlusLam_(ptf.yPlusLam_)
|
||||
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -110,15 +131,12 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k")),
|
||||
GName_(dict.lookupOrDefault<word>("G", "RASModel::G")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu")),
|
||||
mutName_(dict.lookupOrDefault<word>("mut", "mut")),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8))
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -130,15 +148,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ewfpsf),
|
||||
UName_(ewfpsf.UName_),
|
||||
kName_(ewfpsf.kName_),
|
||||
GName_(ewfpsf.GName_),
|
||||
rhoName_(ewfpsf.rhoName_),
|
||||
muName_(ewfpsf.muName_),
|
||||
mutName_(ewfpsf.mutName_),
|
||||
Cmu_(ewfpsf.Cmu_),
|
||||
kappa_(ewfpsf.kappa_),
|
||||
E_(ewfpsf.E_)
|
||||
E_(ewfpsf.E_),
|
||||
yPlusLam_(ewfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -151,15 +165,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF),
|
||||
UName_(ewfpsf.UName_),
|
||||
kName_(ewfpsf.kName_),
|
||||
GName_(ewfpsf.GName_),
|
||||
rhoName_(ewfpsf.rhoName_),
|
||||
muName_(ewfpsf.muName_),
|
||||
mutName_(ewfpsf.mutName_),
|
||||
Cmu_(ewfpsf.Cmu_),
|
||||
kappa_(ewfpsf.kappa_),
|
||||
E_(ewfpsf.E_)
|
||||
E_(ewfpsf.E_),
|
||||
yPlusLam_(ewfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -174,33 +184,36 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const label patchI = patch().index();
|
||||
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
|
||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||
const scalar Cmu75 = pow(Cmu_, 0.75);
|
||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
|
||||
const scalarField& y = rasModel.y()[patch().index()];
|
||||
const scalarField& y = rasModel.y()[patchI];
|
||||
|
||||
volScalarField& G = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>(GName_));
|
||||
volScalarField& G =
|
||||
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));
|
||||
|
||||
volScalarField& epsilon = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>(dimensionedInternalField().name()));
|
||||
DimensionedField<scalar, volMesh>& epsilon =
|
||||
const_cast<DimensionedField<scalar, volMesh>&>
|
||||
(
|
||||
dimensionedInternalField()
|
||||
);
|
||||
|
||||
const volScalarField& k = db().lookupObject<volScalarField>(kName_);
|
||||
const tmp<volScalarField> tk = rasModel.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
|
||||
const scalarField& mutw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(mutName_);
|
||||
const tmp<volScalarField> tmut = rasModel.mut();
|
||||
const volScalarField& mut = tmut();
|
||||
const scalarField& mutw = mut.boundaryField()[patchI];
|
||||
|
||||
const fvPatchVectorField& Uw =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
|
||||
const scalarField magGradUw = mag(Uw.snGrad());
|
||||
|
||||
@ -215,7 +228,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
|
||||
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
if (yPlus > yPlusLam_)
|
||||
{
|
||||
G[faceCellI] =
|
||||
(mutw[faceI] + muw[faceI])
|
||||
@ -247,15 +260,7 @@ void epsilonWallFunctionFvPatchScalarField::evaluate
|
||||
void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "k", "k", kName_);
|
||||
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "mu", "mu", muName_);
|
||||
writeEntryIfDifferent<word>(os, "mut", "mut", mutName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
writeLocalEntries(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
@ -57,26 +57,13 @@ class epsilonWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedInternalValueFvPatchField<scalar>
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
|
||||
//- Name of turbulence kinetic energy field
|
||||
word kName_;
|
||||
// Protected data
|
||||
|
||||
//- Name of turbulence generation field
|
||||
word GName_;
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word muName_;
|
||||
|
||||
//- Name of turbulent viscosity field
|
||||
word mutName_;
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
@ -86,11 +73,20 @@ class epsilonWallFunctionFvPatchScalarField
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
// Private member functions
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Check the type of the patch
|
||||
void checkType();
|
||||
virtual void checkType();
|
||||
|
||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
|
||||
|
||||
//- Write local wall function variables
|
||||
virtual void writeLocalEntries(Ostream&) const;
|
||||
|
||||
|
||||
public:
|
||||
@ -176,7 +172,7 @@ public:
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace compressible
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
@ -56,6 +56,32 @@ void omegaWallFunctionFvPatchScalarField::checkType()
|
||||
}
|
||||
|
||||
|
||||
scalar omegaWallFunctionFvPatchScalarField::calcYPlusLam
|
||||
(
|
||||
const scalar kappa,
|
||||
const scalar E
|
||||
) const
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
ypl = log(E*ypl)/kappa;
|
||||
}
|
||||
|
||||
return ypl;
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
||||
{
|
||||
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
@ -65,15 +91,12 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF),
|
||||
UName_("U"),
|
||||
rhoName_("rho"),
|
||||
kName_("k"),
|
||||
GName_("RASModel::G"),
|
||||
muName_("mu"),
|
||||
mutName_("mut"),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8)
|
||||
E_(9.8),
|
||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -88,15 +111,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
rhoName_(ptf.rhoName_),
|
||||
kName_(ptf.kName_),
|
||||
GName_(ptf.GName_),
|
||||
muName_(ptf.muName_),
|
||||
mutName_(ptf.mutName_),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_)
|
||||
E_(ptf.E_),
|
||||
yPlusLam_(ptf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -110,15 +129,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
rhoName_(dict.lookupOrDefault<word>("rho", "rho")),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k")),
|
||||
GName_(dict.lookupOrDefault<word>("G", "RASModel::G")),
|
||||
muName_(dict.lookupOrDefault<word>("mu", "mu")),
|
||||
mutName_(dict.lookupOrDefault<word>("mut", "mut")),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8))
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -130,15 +145,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(owfpsf),
|
||||
UName_(owfpsf.UName_),
|
||||
rhoName_(owfpsf.rhoName_),
|
||||
kName_(owfpsf.kName_),
|
||||
GName_(owfpsf.GName_),
|
||||
muName_(owfpsf.muName_),
|
||||
mutName_(owfpsf.mutName_),
|
||||
Cmu_(owfpsf.Cmu_),
|
||||
kappa_(owfpsf.kappa_),
|
||||
E_(owfpsf.E_)
|
||||
E_(owfpsf.E_),
|
||||
yPlusLam_(owfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -151,15 +162,12 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(owfpsf, iF),
|
||||
UName_(owfpsf.UName_),
|
||||
rhoName_(owfpsf.rhoName_),
|
||||
kName_(owfpsf.kName_),
|
||||
GName_(owfpsf.GName_),
|
||||
muName_(owfpsf.muName_),
|
||||
mutName_(owfpsf.mutName_),
|
||||
Cmu_(owfpsf.Cmu_),
|
||||
kappa_(owfpsf.kappa_),
|
||||
E_(owfpsf.E_)
|
||||
E_(owfpsf.E_),
|
||||
yPlusLam_(owfpsf.yPlusLam_)
|
||||
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -174,8 +182,9 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const label patchI = patch().index();
|
||||
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
const scalarField& y = rasModel.y()[patch().index()];
|
||||
|
||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||
@ -183,22 +192,24 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
volScalarField& G = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>(GName_));
|
||||
|
||||
volScalarField& omega = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>(dimensionedInternalField().name()));
|
||||
DimensionedField<scalar, volMesh>& omega =
|
||||
const_cast<DimensionedField<scalar, volMesh>&>
|
||||
(
|
||||
dimensionedInternalField()
|
||||
);
|
||||
|
||||
const scalarField& k = db().lookupObject<volScalarField>(kName_);
|
||||
const tmp<volScalarField> tk = rasModel.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const scalarField& rhow =
|
||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
||||
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||
|
||||
const scalarField& muw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
||||
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||
|
||||
const scalarField& mutw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(mutName_);
|
||||
const tmp<volScalarField> tmut = rasModel.mut();
|
||||
const volScalarField& mut = tmut();
|
||||
const scalarField& mutw = mut.boundaryField()[patchI];
|
||||
|
||||
const fvPatchVectorField& Uw =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
|
||||
const scalarField magGradUw = mag(Uw.snGrad());
|
||||
|
||||
@ -213,7 +224,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
|
||||
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
if (yPlus > yPlusLam_)
|
||||
{
|
||||
G[faceCellI] =
|
||||
(mutw[faceI] + muw[faceI])
|
||||
@ -236,15 +247,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "rho", "rho", rhoName_);
|
||||
writeEntryIfDifferent<word>(os, "k", "k", kName_);
|
||||
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
|
||||
writeEntryIfDifferent<word>(os, "mu", "mu", muName_);
|
||||
writeEntryIfDifferent<word>(os, "mut", "mut", mutName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
writeLocalEntries(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
@ -55,26 +55,13 @@ class omegaWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedInternalValueFvPatchField<scalar>
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
|
||||
//- Name of density field
|
||||
word rhoName_;
|
||||
|
||||
//- Name of turbulence kinetic energy field
|
||||
word kName_;
|
||||
// Protected data
|
||||
|
||||
//- Name of turbulence generation field
|
||||
word GName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word muName_;
|
||||
|
||||
//- Name of turbulent viscosity field
|
||||
word mutName_;
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
@ -84,11 +71,20 @@ class omegaWallFunctionFvPatchScalarField
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
// Private member functions
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Check the type of the patch
|
||||
void checkType();
|
||||
virtual void checkType();
|
||||
|
||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
|
||||
|
||||
//- Write local wall function variables
|
||||
virtual void writeLocalEntries(Ostream&) const;
|
||||
|
||||
|
||||
public:
|
||||
@ -171,7 +167,7 @@ public:
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -56,6 +56,32 @@ void epsilonWallFunctionFvPatchScalarField::checkType()
|
||||
}
|
||||
|
||||
|
||||
scalar epsilonWallFunctionFvPatchScalarField::calcYPlusLam
|
||||
(
|
||||
const scalar kappa,
|
||||
const scalar E
|
||||
) const
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
ypl = log(E*ypl)/kappa;
|
||||
}
|
||||
|
||||
return ypl;
|
||||
}
|
||||
|
||||
|
||||
void epsilonWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
||||
{
|
||||
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
@ -65,14 +91,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF),
|
||||
UName_("U"),
|
||||
kName_("k"),
|
||||
GName_("RASModel::G"),
|
||||
nuName_("nu"),
|
||||
nutName_("nut"),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8)
|
||||
E_(9.8),
|
||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -87,14 +110,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
kName_(ptf.kName_),
|
||||
GName_(ptf.GName_),
|
||||
nuName_(ptf.nuName_),
|
||||
nutName_(ptf.nutName_),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_)
|
||||
E_(ptf.E_),
|
||||
yPlusLam_(ptf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -108,14 +128,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k")),
|
||||
GName_(dict.lookupOrDefault<word>("G", "RASModel::G")),
|
||||
nuName_(dict.lookupOrDefault<word>("nu", "nu")),
|
||||
nutName_(dict.lookupOrDefault<word>("nut", "nut")),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8))
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -127,14 +144,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ewfpsf),
|
||||
UName_(ewfpsf.UName_),
|
||||
kName_(ewfpsf.kName_),
|
||||
GName_(ewfpsf.GName_),
|
||||
nuName_(ewfpsf.nuName_),
|
||||
nutName_(ewfpsf.nutName_),
|
||||
Cmu_(ewfpsf.Cmu_),
|
||||
kappa_(ewfpsf.kappa_),
|
||||
E_(ewfpsf.E_)
|
||||
E_(ewfpsf.E_),
|
||||
yPlusLam_(ewfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -147,14 +161,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF),
|
||||
UName_(ewfpsf.UName_),
|
||||
kName_(ewfpsf.kName_),
|
||||
GName_(ewfpsf.GName_),
|
||||
nuName_(ewfpsf.nuName_),
|
||||
nutName_(ewfpsf.nutName_),
|
||||
Cmu_(ewfpsf.Cmu_),
|
||||
kappa_(ewfpsf.kappa_),
|
||||
E_(ewfpsf.E_)
|
||||
E_(ewfpsf.E_),
|
||||
yPlusLam_(ewfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -169,29 +180,33 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const label patchI = patch().index();
|
||||
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
const scalarField& y = rasModel.y()[patch().index()];
|
||||
const scalarField& y = rasModel.y()[patchI];
|
||||
|
||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||
const scalar Cmu75 = pow(Cmu_, 0.75);
|
||||
|
||||
volScalarField& G = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>(GName_));
|
||||
volScalarField& G =
|
||||
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));
|
||||
|
||||
volScalarField& epsilon = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>(dimensionedInternalField().name()));
|
||||
DimensionedField<scalar, volMesh>& epsilon =
|
||||
const_cast<DimensionedField<scalar, volMesh>&>
|
||||
(
|
||||
dimensionedInternalField()
|
||||
);
|
||||
|
||||
const volScalarField& k = db().lookupObject<volScalarField>(kName_);
|
||||
const tmp<volScalarField> tk = rasModel.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const scalarField& nuw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(nuName_);
|
||||
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
|
||||
|
||||
const scalarField& nutw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(nutName_);
|
||||
const tmp<volScalarField> tnut = rasModel.nut();
|
||||
const volScalarField& nut = tnut();
|
||||
const scalarField& nutw = nut.boundaryField()[patchI];
|
||||
|
||||
const fvPatchVectorField& Uw =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
|
||||
const scalarField magGradUw = mag(Uw.snGrad());
|
||||
|
||||
@ -204,7 +219,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
|
||||
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
if (yPlus > yPlusLam_)
|
||||
{
|
||||
G[faceCellI] =
|
||||
(nutw[faceI] + nuw[faceI])
|
||||
@ -236,14 +251,7 @@ void epsilonWallFunctionFvPatchScalarField::evaluate
|
||||
void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "k", "k", kName_);
|
||||
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
|
||||
writeEntryIfDifferent<word>(os, "nu", "nu", nuName_);
|
||||
writeEntryIfDifferent<word>(os, "nut", "nut", nutName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
writeLocalEntries(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
@ -57,23 +57,13 @@ class epsilonWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedInternalValueFvPatchField<scalar>
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
|
||||
//- Name of turbulence kinetic energy field
|
||||
word kName_;
|
||||
// Protected data
|
||||
|
||||
//- Name of turbulence generation field
|
||||
word GName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word nuName_;
|
||||
|
||||
//- Name of turbulent viscosity field
|
||||
word nutName_;
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
@ -84,10 +74,20 @@ class epsilonWallFunctionFvPatchScalarField
|
||||
scalar E_;
|
||||
|
||||
|
||||
// Private member functions
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Check the type of the patch
|
||||
void checkType();
|
||||
virtual void checkType();
|
||||
|
||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
|
||||
|
||||
//- Write local wall function variables
|
||||
virtual void writeLocalEntries(Ostream&) const;
|
||||
|
||||
|
||||
public:
|
||||
@ -173,7 +173,7 @@ public:
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace incompressible
|
||||
namespace RASModels
|
||||
{
|
||||
|
||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::checkType()
|
||||
{
|
||||
@ -56,6 +56,32 @@ void omegaWallFunctionFvPatchScalarField::checkType()
|
||||
}
|
||||
|
||||
|
||||
scalar omegaWallFunctionFvPatchScalarField::calcYPlusLam
|
||||
(
|
||||
const scalar kappa,
|
||||
const scalar E
|
||||
) const
|
||||
{
|
||||
scalar ypl = 11.0;
|
||||
|
||||
for (int i=0; i<10; i++)
|
||||
{
|
||||
ypl = log(E*ypl)/kappa;
|
||||
}
|
||||
|
||||
return ypl;
|
||||
}
|
||||
|
||||
|
||||
void omegaWallFunctionFvPatchScalarField::writeLocalEntries(Ostream& os) const
|
||||
{
|
||||
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
}
|
||||
|
||||
|
||||
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||
|
||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
@ -65,14 +91,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF),
|
||||
UName_("U"),
|
||||
kName_("k"),
|
||||
GName_("RASModel::G"),
|
||||
nuName_("nu"),
|
||||
nutName_("nut"),
|
||||
Cmu_(0.09),
|
||||
kappa_(0.41),
|
||||
E_(9.8)
|
||||
E_(9.8),
|
||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -87,14 +110,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||
UName_(ptf.UName_),
|
||||
kName_(ptf.kName_),
|
||||
GName_(ptf.GName_),
|
||||
nuName_(ptf.nuName_),
|
||||
nutName_(ptf.nutName_),
|
||||
Cmu_(ptf.Cmu_),
|
||||
kappa_(ptf.kappa_),
|
||||
E_(ptf.E_)
|
||||
E_(ptf.E_),
|
||||
yPlusLam_(ptf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -108,14 +128,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
||||
kName_(dict.lookupOrDefault<word>("k", "k")),
|
||||
GName_(dict.lookupOrDefault<word>("G", "RASModel::G")),
|
||||
nuName_(dict.lookupOrDefault<word>("nu", "nu")),
|
||||
nutName_(dict.lookupOrDefault<word>("nut", "nut")),
|
||||
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8))
|
||||
E_(dict.lookupOrDefault<scalar>("E", 9.8)),
|
||||
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -127,14 +144,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(owfpsf),
|
||||
UName_(owfpsf.UName_),
|
||||
kName_(owfpsf.kName_),
|
||||
GName_(owfpsf.GName_),
|
||||
nuName_(owfpsf.nuName_),
|
||||
nutName_(owfpsf.nutName_),
|
||||
Cmu_(owfpsf.Cmu_),
|
||||
kappa_(owfpsf.kappa_),
|
||||
E_(owfpsf.E_)
|
||||
E_(owfpsf.E_),
|
||||
yPlusLam_(owfpsf.yPlusLam_)
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -147,14 +161,12 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||
)
|
||||
:
|
||||
fixedInternalValueFvPatchField<scalar>(owfpsf, iF),
|
||||
UName_(owfpsf.UName_),
|
||||
kName_(owfpsf.kName_),
|
||||
GName_(owfpsf.GName_),
|
||||
nuName_(owfpsf.nuName_),
|
||||
nutName_(owfpsf.nutName_),
|
||||
Cmu_(owfpsf.Cmu_),
|
||||
kappa_(owfpsf.kappa_),
|
||||
E_(owfpsf.E_)
|
||||
E_(owfpsf.E_),
|
||||
yPlusLam_(owfpsf.yPlusLam_)
|
||||
|
||||
{
|
||||
checkType();
|
||||
}
|
||||
@ -169,28 +181,32 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
return;
|
||||
}
|
||||
|
||||
const label patchI = patch().index();
|
||||
|
||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
||||
const scalarField& y = rasModel.y()[patch().index()];
|
||||
const scalarField& y = rasModel.y()[patchI];
|
||||
|
||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||
|
||||
volScalarField& G = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>(GName_));
|
||||
volScalarField& G =
|
||||
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));
|
||||
|
||||
volScalarField& omega = const_cast<volScalarField&>
|
||||
(db().lookupObject<volScalarField>(dimensionedInternalField().name()));
|
||||
DimensionedField<scalar, volMesh>& omega =
|
||||
const_cast<DimensionedField<scalar, volMesh>&>
|
||||
(
|
||||
dimensionedInternalField()
|
||||
);
|
||||
|
||||
const scalarField& k = db().lookupObject<volScalarField>(kName_);
|
||||
const tmp<volScalarField> tk = rasModel.k();
|
||||
const volScalarField& k = tk();
|
||||
|
||||
const scalarField& nuw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(nuName_);
|
||||
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
|
||||
|
||||
const scalarField& nutw =
|
||||
patch().lookupPatchField<volScalarField, scalar>(nutName_);
|
||||
const tmp<volScalarField> tnut = rasModel.nut();
|
||||
const volScalarField& nut = tnut();
|
||||
const scalarField& nutw = nut.boundaryField()[patchI];
|
||||
|
||||
const fvPatchVectorField& Uw =
|
||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
||||
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||
|
||||
const scalarField magGradUw = mag(Uw.snGrad());
|
||||
|
||||
@ -203,7 +219,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
|
||||
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
|
||||
|
||||
if (yPlus > yPlusLam)
|
||||
if (yPlus > yPlusLam_)
|
||||
{
|
||||
G[faceCellI] =
|
||||
(nutw[faceI] + nuw[faceI])
|
||||
@ -226,14 +242,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
||||
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||
{
|
||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
||||
writeEntryIfDifferent<word>(os, "k", "k", kName_);
|
||||
writeEntryIfDifferent<word>(os, "G", "RASModel::G", GName_);
|
||||
writeEntryIfDifferent<word>(os, "nu", "nu", nuName_);
|
||||
writeEntryIfDifferent<word>(os, "nut", "nut", nutName_);
|
||||
os.writeKeyword("Cmu") << Cmu_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("kappa") << kappa_ << token::END_STATEMENT << nl;
|
||||
os.writeKeyword("E") << E_ << token::END_STATEMENT << nl;
|
||||
writeLocalEntries(os);
|
||||
writeEntry("value", os);
|
||||
}
|
||||
|
||||
|
@ -55,23 +55,13 @@ class omegaWallFunctionFvPatchScalarField
|
||||
:
|
||||
public fixedInternalValueFvPatchField<scalar>
|
||||
{
|
||||
// Private data
|
||||
protected:
|
||||
|
||||
//- Name of velocity field
|
||||
word UName_;
|
||||
|
||||
//- Name of turbulence kinetic energy field
|
||||
word kName_;
|
||||
// Protected data
|
||||
|
||||
//- Name of turbulence generation field
|
||||
word GName_;
|
||||
|
||||
//- Name of laminar viscosity field
|
||||
word nuName_;
|
||||
|
||||
//- Name of turbulent viscosity field
|
||||
word nutName_;
|
||||
|
||||
//- Cmu coefficient
|
||||
scalar Cmu_;
|
||||
|
||||
@ -81,11 +71,20 @@ class omegaWallFunctionFvPatchScalarField
|
||||
//- E coefficient
|
||||
scalar E_;
|
||||
|
||||
//- Y+ at the edge of the laminar sublayer
|
||||
scalar yPlusLam_;
|
||||
|
||||
// Private member functions
|
||||
|
||||
// Protected member functions
|
||||
|
||||
//- Check the type of the patch
|
||||
void checkType();
|
||||
virtual void checkType();
|
||||
|
||||
//- Calculate the Y+ at the edge of the laminar sublayer
|
||||
virtual scalar calcYPlusLam(const scalar kappa, const scalar E) const;
|
||||
|
||||
//- Write local wall function variables
|
||||
virtual void writeLocalEntries(Ostream&) const;
|
||||
|
||||
|
||||
public:
|
||||
@ -168,7 +167,7 @@ public:
|
||||
// I-O
|
||||
|
||||
//- Write
|
||||
void write(Ostream&) const;
|
||||
virtual void write(Ostream&) const;
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,7 +1,4 @@
|
||||
CGAL_PATH = ${WM_THIRD_PARTY_DIR}/CGAL-${CGAL_VERSION}
|
||||
|
||||
CGAL_INC = \
|
||||
-Wno-old-style-cast \
|
||||
-I${CGAL_SRC}/include \
|
||||
-I${CGAL_PATH} \
|
||||
-I${BOOST_SRC}
|
||||
-I${BOOST_ROOT}/include/boost-${BOOST_LIB_VERSION}
|
||||
|
Loading…
Reference in New Issue
Block a user