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 "fvMesh.H"
|
||||||
#include "volFields.H"
|
#include "volFields.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "mapDistribute.H"
|
//#include "mapDistribute.H"
|
||||||
#include "OFstream.H"
|
#include "OFstream.H"
|
||||||
#include "meshTools.H"
|
#include "meshTools.H"
|
||||||
//#include "FECCellToFaceStencil.H"
|
//#include "FECCellToFaceStencil.H"
|
||||||
|
@ -23,19 +23,23 @@ License
|
|||||||
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
|
||||||
Application
|
Application
|
||||||
icoFoam
|
parallelTest
|
||||||
|
|
||||||
Description
|
Description
|
||||||
Incompressible laminar CFD code.
|
Test for various parallel routines.
|
||||||
|
|
||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
#include "List.H"
|
||||||
|
#include "mapDistribute.H"
|
||||||
#include "argList.H"
|
#include "argList.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "IPstream.H"
|
#include "IPstream.H"
|
||||||
#include "OPstream.H"
|
#include "OPstream.H"
|
||||||
#include "vector.H"
|
#include "vector.H"
|
||||||
#include "IOstreams.H"
|
#include "IOstreams.H"
|
||||||
|
#include "Random.H"
|
||||||
|
#include "Tuple2.H"
|
||||||
|
|
||||||
using namespace Foam;
|
using namespace Foam;
|
||||||
|
|
||||||
@ -47,6 +51,99 @@ int main(int argc, char *argv[])
|
|||||||
# include "setRootCase.H"
|
# include "setRootCase.H"
|
||||||
# include "createTime.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;
|
Perr<< "\nStarting transfers\n" << endl;
|
||||||
@ -60,13 +157,13 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
Perr<< "slave sending to master "
|
Perr<< "slave sending to master "
|
||||||
<< Pstream::masterNo() << endl;
|
<< Pstream::masterNo() << endl;
|
||||||
OPstream toMaster(Pstream::masterNo());
|
OPstream toMaster(Pstream::blocking, Pstream::masterNo());
|
||||||
toMaster << data;
|
toMaster << data;
|
||||||
}
|
}
|
||||||
|
|
||||||
Perr<< "slave receiving from master "
|
Perr<< "slave receiving from master "
|
||||||
<< Pstream::masterNo() << endl;
|
<< Pstream::masterNo() << endl;
|
||||||
IPstream fromMaster(Pstream::masterNo());
|
IPstream fromMaster(Pstream::blocking, Pstream::masterNo());
|
||||||
fromMaster >> data;
|
fromMaster >> data;
|
||||||
|
|
||||||
Perr<< data << endl;
|
Perr<< data << endl;
|
||||||
@ -81,7 +178,7 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
Perr << "master receiving from slave " << slave << endl;
|
Perr << "master receiving from slave " << slave << endl;
|
||||||
IPstream fromSlave(slave);
|
IPstream fromSlave(Pstream::blocking, slave);
|
||||||
fromSlave >> data;
|
fromSlave >> data;
|
||||||
|
|
||||||
Perr<< data << endl;
|
Perr<< data << endl;
|
||||||
@ -95,7 +192,7 @@ int main(int argc, char *argv[])
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
Perr << "master sending to slave " << slave << endl;
|
Perr << "master sending to slave " << slave << endl;
|
||||||
OPstream toSlave(slave);
|
OPstream toSlave(Pstream::blocking, slave);
|
||||||
toSlave << data;
|
toSlave << data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,45 +158,33 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
|
|
||||||
label trianglei = 0;
|
label trianglei = 0;
|
||||||
label maxRegion1 = labelMin;
|
|
||||||
|
|
||||||
// Copy triangles1 into trianglesAll
|
// Copy triangles1 into trianglesAll
|
||||||
// Determine max region.
|
|
||||||
|
|
||||||
forAll(surface1, faceI)
|
forAll(surface1, faceI)
|
||||||
{
|
{
|
||||||
facesAll[trianglei] = surface1[faceI];
|
facesAll[trianglei++] = surface1[faceI];
|
||||||
|
|
||||||
maxRegion1 = max(maxRegion1, facesAll[trianglei].region());
|
|
||||||
|
|
||||||
trianglei++;
|
|
||||||
}
|
}
|
||||||
|
label nRegions1 = surface1.patches().size();
|
||||||
|
|
||||||
label nRegions1 = maxRegion1 + 1;
|
|
||||||
|
|
||||||
if (!mergeRegions)
|
if (!mergeRegions)
|
||||||
{
|
{
|
||||||
Info<< "Surface " << inFileName1 << " has " << nRegions1 << " regions"
|
Info<< "Surface " << inFileName1 << " has " << nRegions1
|
||||||
|
<< " regions"
|
||||||
<< nl
|
<< nl
|
||||||
<< "All region numbers in " << inFileName2 << " will be offset"
|
<< "All region numbers in " << inFileName2 << " will be offset"
|
||||||
<< " by this amount" << nl << endl;
|
<< " by this amount" << nl << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add (renumbered) surface2 triangles
|
// Add (renumbered) surface2 triangles
|
||||||
label maxRegion2 = labelMin;
|
|
||||||
|
|
||||||
forAll(surface2, faceI)
|
forAll(surface2, faceI)
|
||||||
{
|
{
|
||||||
const labelledTri& tri = surface2[faceI];
|
const labelledTri& tri = surface2[faceI];
|
||||||
|
|
||||||
labelledTri& destTri = facesAll[trianglei++];
|
labelledTri& destTri = facesAll[trianglei++];
|
||||||
|
|
||||||
destTri[0] = tri[0] + points1.size();
|
destTri[0] = tri[0] + points1.size();
|
||||||
destTri[1] = tri[1] + points1.size();
|
destTri[1] = tri[1] + points1.size();
|
||||||
destTri[2] = tri[2] + points1.size();
|
destTri[2] = tri[2] + points1.size();
|
||||||
|
|
||||||
maxRegion2 = max(maxRegion2, tri.region());
|
|
||||||
|
|
||||||
if (mergeRegions)
|
if (mergeRegions)
|
||||||
{
|
{
|
||||||
destTri.region() = tri.region();
|
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;
|
geometricSurfacePatchList newPatches;
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ FoamFile
|
|||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
// Select triangles by label
|
// Select triangles by label
|
||||||
faces ();
|
faces #include "badFaces";
|
||||||
|
|
||||||
// Select triangles using given points (local point numbering)
|
// Select triangles using given points (local point numbering)
|
||||||
localPoints ( );
|
localPoints ( );
|
||||||
|
@ -162,13 +162,14 @@ Foam::List<T>::List(const UList<T>& a, const unallocLabelList& map)
|
|||||||
{
|
{
|
||||||
if (this->size_)
|
if (this->size_)
|
||||||
{
|
{
|
||||||
|
// Note:cannot use List_ELEM since third argument has to be index.
|
||||||
|
|
||||||
this->v_ = new T[this->size_];
|
this->v_ = new T[this->size_];
|
||||||
|
|
||||||
List_ACCESS(T, (*this), vp);
|
forAll(*this, i)
|
||||||
List_CONST_ACCESS(T, a, ap);
|
{
|
||||||
List_FOR_ALL(map, i)
|
this->v_[i] = a[map[i]];
|
||||||
List_ELEM((*this), vp, i) = List_ELEM(a, ap, (map[i]));
|
}
|
||||||
List_END_FOR_ALL
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -127,11 +127,10 @@ void Foam::Time::setControls()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WarningIn("Time::setControls()")
|
FatalIOErrorIn("Time::setControls()", controlDict_)
|
||||||
<< "expected startTime, firstTime or latestTime"
|
<< "expected startTime, firstTime or latestTime"
|
||||||
<< " found '" << startFrom
|
<< " found '" << startFrom << "'"
|
||||||
<< "' in dictionary " << controlDict_.name() << nl
|
<< exit(FatalIOError);
|
||||||
<< " Setting time to " << startTime_ << endl;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,10 +150,10 @@ void Foam::Time::setControls()
|
|||||||
> Pstream::nProcs()*deltaT_/10.0
|
> Pstream::nProcs()*deltaT_/10.0
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
FatalErrorIn("Time::setControls()")
|
FatalIOErrorIn("Time::setControls()", controlDict_)
|
||||||
<< "Start time is not the same for all processors" << nl
|
<< "Start time is not the same for all processors" << nl
|
||||||
<< "processor " << Pstream::myProcNo() << " has startTime "
|
<< "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
|
Foam::mapDistribute::mapDistribute
|
||||||
(
|
(
|
||||||
const label constructSize,
|
const label constructSize,
|
||||||
const labelListList& subMap,
|
const Xfer<labelListList>& subMap,
|
||||||
const labelListList& constructMap
|
const Xfer<labelListList>& constructMap
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
constructSize_(constructSize),
|
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
|
Foam::mapDistribute::mapDistribute
|
||||||
(
|
(
|
||||||
const labelList& sendProcs,
|
const labelList& sendProcs,
|
||||||
|
@ -83,23 +83,36 @@ class mapDistribute
|
|||||||
|
|
||||||
public:
|
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
|
// Constructors
|
||||||
|
|
||||||
//- Construct from components
|
//- Construct from components
|
||||||
mapDistribute
|
mapDistribute
|
||||||
(
|
(
|
||||||
const label constructSize,
|
const label constructSize,
|
||||||
const labelListList& subMap,
|
const Xfer<labelListList>& subMap,
|
||||||
const labelListList& constructMap
|
const Xfer<labelListList>& constructMap
|
||||||
);
|
|
||||||
|
|
||||||
//- (optionally destructively) construct from components
|
|
||||||
mapDistribute
|
|
||||||
(
|
|
||||||
const label constructSize,
|
|
||||||
labelListList& subMap,
|
|
||||||
labelListList& constructMap,
|
|
||||||
const bool reUse // clone or reuse
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Construct from reverse addressing: per data item the send
|
//- Construct from reverse addressing: per data item the send
|
||||||
@ -205,11 +218,7 @@ public:
|
|||||||
template<class T>
|
template<class T>
|
||||||
void distribute(List<T>& fld) const
|
void distribute(List<T>& fld) const
|
||||||
{
|
{
|
||||||
if
|
if (Pstream::defaultCommsType == Pstream::nonBlocking)
|
||||||
(
|
|
||||||
Pstream::defaultCommsType == Pstream::nonBlocking
|
|
||||||
&& contiguous<T>()
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
distribute
|
distribute
|
||||||
(
|
(
|
||||||
|
@ -68,35 +68,15 @@ public:
|
|||||||
mapDistributeLagrangian
|
mapDistributeLagrangian
|
||||||
(
|
(
|
||||||
const label nNewParticles,
|
const label nNewParticles,
|
||||||
const labelListList& subParticleMap,
|
const Xfer<labelListList>& subParticleMap,
|
||||||
const labelListList& constructParticleMap,
|
const Xfer<labelListList>& constructParticleMap,
|
||||||
const labelListList& constructCellLabels
|
const Xfer<labelListList>& constructCellLabels
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
particleMap_(nNewParticles, subParticleMap, constructParticleMap),
|
particleMap_(nNewParticles, subParticleMap, constructParticleMap),
|
||||||
constructCellLabels_(constructCellLabels)
|
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
|
// Member Functions
|
||||||
|
|
||||||
|
@ -66,27 +66,27 @@ Foam::mapDistributePolyMesh::mapDistributePolyMesh
|
|||||||
const label nOldPoints,
|
const label nOldPoints,
|
||||||
const label nOldFaces,
|
const label nOldFaces,
|
||||||
const label nOldCells,
|
const label nOldCells,
|
||||||
const labelList& oldPatchStarts,
|
const Xfer<labelList>& oldPatchStarts,
|
||||||
const labelList& oldPatchNMeshPoints,
|
const Xfer<labelList>& oldPatchNMeshPoints,
|
||||||
|
|
||||||
// how to subset pieces of mesh to send across
|
// how to subset pieces of mesh to send across
|
||||||
const labelListList& subPointMap,
|
const Xfer<labelListList>& subPointMap,
|
||||||
const labelListList& subFaceMap,
|
const Xfer<labelListList>& subFaceMap,
|
||||||
const labelListList& subCellMap,
|
const Xfer<labelListList>& subCellMap,
|
||||||
const labelListList& subPatchMap,
|
const Xfer<labelListList>& subPatchMap,
|
||||||
|
|
||||||
// how to reconstruct received mesh
|
// how to reconstruct received mesh
|
||||||
const labelListList& constructPointMap,
|
const Xfer<labelListList>& constructPointMap,
|
||||||
const labelListList& constructFaceMap,
|
const Xfer<labelListList>& constructFaceMap,
|
||||||
const labelListList& constructCellMap,
|
const Xfer<labelListList>& constructCellMap,
|
||||||
const labelListList& constructPatchMap
|
const Xfer<labelListList>& constructPatchMap
|
||||||
)
|
)
|
||||||
:
|
:
|
||||||
mesh_(mesh),
|
mesh_(mesh),
|
||||||
nOldPoints_(nOldPoints),
|
nOldPoints_(nOldPoints),
|
||||||
nOldFaces_(nOldFaces),
|
nOldFaces_(nOldFaces),
|
||||||
nOldCells_(nOldCells),
|
nOldCells_(nOldCells),
|
||||||
oldPatchSizes_(oldPatchStarts.size()),
|
oldPatchSizes_(oldPatchStarts().size()),
|
||||||
oldPatchStarts_(oldPatchStarts),
|
oldPatchStarts_(oldPatchStarts),
|
||||||
oldPatchNMeshPoints_(oldPatchNMeshPoints),
|
oldPatchNMeshPoints_(oldPatchNMeshPoints),
|
||||||
pointMap_(mesh.nPoints(), subPointMap, constructPointMap),
|
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 * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
|
||||||
|
|
||||||
void Foam::mapDistributePolyMesh::distributePointIndices(labelList& lst) const
|
void Foam::mapDistributePolyMesh::distributePointIndices(labelList& lst) const
|
||||||
|
@ -120,42 +120,20 @@ public:
|
|||||||
const label nOldPoints,
|
const label nOldPoints,
|
||||||
const label nOldFaces,
|
const label nOldFaces,
|
||||||
const label nOldCells,
|
const label nOldCells,
|
||||||
const labelList& oldPatchStarts,
|
const Xfer<labelList>& oldPatchStarts,
|
||||||
const labelList& oldPatchNMeshPoints,
|
const Xfer<labelList>& oldPatchNMeshPoints,
|
||||||
|
|
||||||
// how to subset pieces of mesh to send across
|
// how to subset pieces of mesh to send across
|
||||||
const labelListList& subPointMap,
|
const Xfer<labelListList>& subPointMap,
|
||||||
const labelListList& subFaceMap,
|
const Xfer<labelListList>& subFaceMap,
|
||||||
const labelListList& subCellMap,
|
const Xfer<labelListList>& subCellMap,
|
||||||
const labelListList& subPatchMap,
|
const Xfer<labelListList>& subPatchMap,
|
||||||
|
|
||||||
// how to reconstruct received mesh
|
// how to reconstruct received mesh
|
||||||
const labelListList& constructPointMap,
|
const Xfer<labelListList>& constructPointMap,
|
||||||
const labelListList& constructFaceMap,
|
const Xfer<labelListList>& constructFaceMap,
|
||||||
const labelListList& constructCellMap,
|
const Xfer<labelListList>& constructCellMap,
|
||||||
const labelListList& constructPatchMap
|
const Xfer<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
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,6 +25,7 @@ License
|
|||||||
\*---------------------------------------------------------------------------*/
|
\*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
#include "Pstream.H"
|
#include "Pstream.H"
|
||||||
|
#include "PstreamCombineReduceOps.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
@ -183,6 +184,122 @@ void Foam::mapDistribute::distribute
|
|||||||
else if (commsType == Pstream::nonBlocking)
|
else if (commsType == Pstream::nonBlocking)
|
||||||
{
|
{
|
||||||
if (!contiguous<T>())
|
if (!contiguous<T>())
|
||||||
|
{
|
||||||
|
// 1. convert to contiguous buffer
|
||||||
|
// 2. send buffer
|
||||||
|
// 3. receive buffer
|
||||||
|
// 4. read from buffer into List<T>
|
||||||
|
|
||||||
|
List<List<char> > sendFields(Pstream::nProcs());
|
||||||
|
labelListList allNTrans(Pstream::nProcs());
|
||||||
|
labelList& nsTransPs = allNTrans[Pstream::myProcNo()];
|
||||||
|
nsTransPs.setSize(Pstream::nProcs(), 0);
|
||||||
|
|
||||||
|
// Stream data into sendField buffers
|
||||||
|
for (label domain = 0; domain < Pstream::nProcs(); 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
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
@ -196,10 +313,24 @@ void Foam::mapDistribute::distribute
|
|||||||
" const labelListList& constructMap,\n"
|
" const labelListList& constructMap,\n"
|
||||||
" List<T>& field\n"
|
" List<T>& field\n"
|
||||||
")\n"
|
")\n"
|
||||||
) << "Non-blocking only supported for contiguous data."
|
) << "Expected from processor " << domain
|
||||||
<< exit(FatalError);
|
<< " " << 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
|
// Set up sends to neighbours
|
||||||
|
|
||||||
List<List<T > > sendFields(Pstream::nProcs());
|
List<List<T > > sendFields(Pstream::nProcs());
|
||||||
@ -222,7 +353,7 @@ void Foam::mapDistribute::distribute
|
|||||||
Pstream::nonBlocking,
|
Pstream::nonBlocking,
|
||||||
domain,
|
domain,
|
||||||
reinterpret_cast<const char*>(subField.begin()),
|
reinterpret_cast<const char*>(subField.begin()),
|
||||||
subField.size()*sizeof(T)
|
subField.byteSize()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,7 +374,7 @@ void Foam::mapDistribute::distribute
|
|||||||
Pstream::nonBlocking,
|
Pstream::nonBlocking,
|
||||||
domain,
|
domain,
|
||||||
reinterpret_cast<char*>(recvFields[domain].begin()),
|
reinterpret_cast<char*>(recvFields[domain].begin()),
|
||||||
recvFields[domain].size()*sizeof(T)
|
recvFields[domain].byteSize()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -320,6 +451,7 @@ void Foam::mapDistribute::distribute
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn("mapDistribute::distribute(..)")
|
FatalErrorIn("mapDistribute::distribute(..)")
|
||||||
@ -487,6 +619,117 @@ void Foam::mapDistribute::distribute
|
|||||||
else if (commsType == Pstream::nonBlocking)
|
else if (commsType == Pstream::nonBlocking)
|
||||||
{
|
{
|
||||||
if (!contiguous<T>())
|
if (!contiguous<T>())
|
||||||
|
{
|
||||||
|
// 1. convert to contiguous buffer
|
||||||
|
// 2. send buffer
|
||||||
|
// 3. receive buffer
|
||||||
|
// 4. read from buffer into List<T>
|
||||||
|
|
||||||
|
List<List<char> > sendFields(Pstream::nProcs());
|
||||||
|
labelListList allNTrans(Pstream::nProcs());
|
||||||
|
labelList& nsTransPs = allNTrans[Pstream::myProcNo()];
|
||||||
|
nsTransPs.setSize(Pstream::nProcs());
|
||||||
|
|
||||||
|
// Stream data into sendField buffers
|
||||||
|
for (label domain = 0; domain < Pstream::nProcs(); 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
|
FatalErrorIn
|
||||||
(
|
(
|
||||||
@ -500,10 +743,24 @@ void Foam::mapDistribute::distribute
|
|||||||
" const labelListList& constructMap,\n"
|
" const labelListList& constructMap,\n"
|
||||||
" List<T>& field\n"
|
" List<T>& field\n"
|
||||||
")\n"
|
")\n"
|
||||||
) << "Non-blocking only supported for contiguous data."
|
) << "Expected from processor " << domain
|
||||||
<< exit(FatalError);
|
<< " " << 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
|
// Set up sends to neighbours
|
||||||
|
|
||||||
List<List<T > > sendFields(Pstream::nProcs());
|
List<List<T > > sendFields(Pstream::nProcs());
|
||||||
@ -623,6 +880,7 @@ void Foam::mapDistribute::distribute
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FatalErrorIn("mapDistribute::distribute(..)")
|
FatalErrorIn("mapDistribute::distribute(..)")
|
||||||
|
@ -28,12 +28,9 @@ License
|
|||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "boundBox.H"
|
#include "boundBox.H"
|
||||||
#include "globalIndex.H"
|
|
||||||
#include "wallPolyPatch.H"
|
#include "wallPolyPatch.H"
|
||||||
#include "mapDistributePolyMesh.H"
|
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "motionSmoother.H"
|
|
||||||
#include "refinementParameters.H"
|
#include "refinementParameters.H"
|
||||||
#include "snapParameters.H"
|
#include "snapParameters.H"
|
||||||
#include "layerParameters.H"
|
#include "layerParameters.H"
|
||||||
|
@ -28,14 +28,13 @@ License
|
|||||||
#include "meshRefinement.H"
|
#include "meshRefinement.H"
|
||||||
#include "fvMesh.H"
|
#include "fvMesh.H"
|
||||||
#include "Time.H"
|
#include "Time.H"
|
||||||
#include "boundBox.H"
|
|
||||||
#include "mapDistributePolyMesh.H"
|
|
||||||
#include "cellSet.H"
|
#include "cellSet.H"
|
||||||
#include "syncTools.H"
|
#include "syncTools.H"
|
||||||
#include "refinementParameters.H"
|
#include "refinementParameters.H"
|
||||||
#include "featureEdgeMesh.H"
|
#include "featureEdgeMesh.H"
|
||||||
#include "refinementSurfaces.H"
|
#include "refinementSurfaces.H"
|
||||||
#include "shellSurfaces.H"
|
#include "shellSurfaces.H"
|
||||||
|
#include "mapDistributePolyMesh.H"
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
|
||||||
|
|
||||||
|
@ -1418,18 +1418,18 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
|||||||
nOldPoints,
|
nOldPoints,
|
||||||
nOldFaces,
|
nOldFaces,
|
||||||
nOldCells,
|
nOldCells,
|
||||||
oldPatchStarts,
|
oldPatchStarts.xfer(),
|
||||||
oldPatchNMeshPoints,
|
oldPatchNMeshPoints.xfer(),
|
||||||
|
|
||||||
labelListList(1, identity(mesh_.nPoints())),//subPointMap
|
labelListList(1, identity(mesh_.nPoints())).xfer(),//subPointMap
|
||||||
labelListList(1, identity(mesh_.nFaces())), //subFaceMap
|
labelListList(1, identity(mesh_.nFaces())).xfer(), //subFaceMap
|
||||||
labelListList(1, identity(mesh_.nCells())), //subCellMap
|
labelListList(1, identity(mesh_.nCells())).xfer(), //subCellMap
|
||||||
labelListList(1, identity(patches.size())), //subPatchMap
|
labelListList(1, identity(patches.size())).xfer(), //subPatchMap
|
||||||
|
|
||||||
labelListList(1, identity(mesh_.nPoints())),//constructPointMap
|
labelListList(1, identity(mesh_.nPoints())).xfer(),//pointMap
|
||||||
labelListList(1, identity(mesh_.nFaces())), //constructFaceMap
|
labelListList(1, identity(mesh_.nFaces())).xfer(), //faceMap
|
||||||
labelListList(1, identity(mesh_.nCells())), //constructCellMap
|
labelListList(1, identity(mesh_.nCells())).xfer(), //cellMap
|
||||||
labelListList(1, identity(patches.size())) //constructPatchMap
|
labelListList(1, identity(patches.size())).xfer() //patchMap
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -2207,19 +2207,18 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::fvMeshDistribute::distribute
|
|||||||
nOldPoints,
|
nOldPoints,
|
||||||
nOldFaces,
|
nOldFaces,
|
||||||
nOldCells,
|
nOldCells,
|
||||||
oldPatchStarts,
|
oldPatchStarts.xfer(),
|
||||||
oldPatchNMeshPoints,
|
oldPatchNMeshPoints.xfer(),
|
||||||
|
|
||||||
subPointMap,
|
subPointMap.xfer(),
|
||||||
subFaceMap,
|
subFaceMap.xfer(),
|
||||||
subCellMap,
|
subCellMap.xfer(),
|
||||||
subPatchMap,
|
subPatchMap.xfer(),
|
||||||
|
|
||||||
constructPointMap,
|
constructPointMap.xfer(),
|
||||||
constructFaceMap,
|
constructFaceMap.xfer(),
|
||||||
constructCellMap,
|
constructCellMap.xfer(),
|
||||||
constructPatchMap,
|
constructPatchMap.xfer()
|
||||||
true // reuse storage
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -280,9 +280,8 @@ Foam::extendedCellToFaceStencil::calcDistributeMap
|
|||||||
new mapDistribute
|
new mapDistribute
|
||||||
(
|
(
|
||||||
nCompact,
|
nCompact,
|
||||||
sendCompact,
|
sendCompact.xfer(),
|
||||||
recvCompact,
|
recvCompact.xfer()
|
||||||
true // reuse send/recv maps.
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -340,9 +340,8 @@ Foam::distributedTriSurfaceMesh::distributeSegments
|
|||||||
new mapDistribute
|
new mapDistribute
|
||||||
(
|
(
|
||||||
segmentI, // size after construction
|
segmentI, // size after construction
|
||||||
sendMap,
|
sendMap.xfer(),
|
||||||
constructMap,
|
constructMap.xfer()
|
||||||
true // reuse storage
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -642,9 +641,8 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
|
|||||||
new mapDistribute
|
new mapDistribute
|
||||||
(
|
(
|
||||||
segmentI, // size after construction
|
segmentI, // size after construction
|
||||||
sendMap,
|
sendMap.xfer(),
|
||||||
constructMap,
|
constructMap.xfer()
|
||||||
true // reuse storage
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
const mapDistribute& map = mapPtr();
|
const mapDistribute& map = mapPtr();
|
||||||
@ -806,9 +804,8 @@ Foam::distributedTriSurfaceMesh::calcLocalQueries
|
|||||||
new mapDistribute
|
new mapDistribute
|
||||||
(
|
(
|
||||||
segmentI, // size after construction
|
segmentI, // size after construction
|
||||||
sendMap,
|
sendMap.xfer(),
|
||||||
constructMap,
|
constructMap.xfer()
|
||||||
true // reuse storage
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
return mapPtr;
|
return mapPtr;
|
||||||
@ -2399,9 +2396,8 @@ void Foam::distributedTriSurfaceMesh::distribute
|
|||||||
new mapDistribute
|
new mapDistribute
|
||||||
(
|
(
|
||||||
allTris.size(),
|
allTris.size(),
|
||||||
faceSendMap,
|
faceSendMap.xfer(),
|
||||||
faceConstructMap,
|
faceConstructMap.xfer()
|
||||||
true
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
pointMap.reset
|
pointMap.reset
|
||||||
@ -2409,9 +2405,8 @@ void Foam::distributedTriSurfaceMesh::distribute
|
|||||||
new mapDistribute
|
new mapDistribute
|
||||||
(
|
(
|
||||||
allPoints.size(),
|
allPoints.size(),
|
||||||
pointSendMap,
|
pointSendMap.xfer(),
|
||||||
pointConstructMap,
|
pointConstructMap.xfer()
|
||||||
true
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -128,6 +128,12 @@ public:
|
|||||||
return index_;
|
return index_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//- Return the index of this patch in the boundaryMesh
|
||||||
|
label& index()
|
||||||
|
{
|
||||||
|
return index_;
|
||||||
|
}
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
void write(Ostream&) const;
|
void write(Ostream&) const;
|
||||||
|
|
||||||
|
@ -544,6 +544,8 @@ Foam::surfacePatchList Foam::triSurface::calcPatches(labelList& faceMap) const
|
|||||||
{
|
{
|
||||||
surfacePatch& newPatch = newPatches[newPatchI];
|
surfacePatch& newPatch = newPatches[newPatchI];
|
||||||
|
|
||||||
|
newPatch.index() = newPatchI;
|
||||||
|
|
||||||
label oldPatchI = newPatchI;
|
label oldPatchI = newPatchI;
|
||||||
|
|
||||||
// start of patch
|
// start of patch
|
||||||
@ -592,6 +594,7 @@ void Foam::triSurface::setDefaultPatches()
|
|||||||
|
|
||||||
forAll(newPatches, patchI)
|
forAll(newPatches, patchI)
|
||||||
{
|
{
|
||||||
|
patches_[patchI].index() = patchI;
|
||||||
patches_[patchI].name() = newPatches[patchI].name();
|
patches_[patchI].name() = newPatches[patchI].name();
|
||||||
patches_[patchI].geometricType() = newPatches[patchI].geometricType();
|
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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||||
@ -65,15 +91,13 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(p, iF),
|
fixedInternalValueFvPatchField<scalar>(p, iF),
|
||||||
UName_("U"),
|
|
||||||
kName_("k"),
|
|
||||||
GName_("RASModel::G"),
|
GName_("RASModel::G"),
|
||||||
rhoName_("rho"),
|
|
||||||
muName_("mu"),
|
|
||||||
mutName_("mut"),
|
|
||||||
Cmu_(0.09),
|
Cmu_(0.09),
|
||||||
kappa_(0.41),
|
kappa_(0.41),
|
||||||
E_(9.8)
|
E_(9.8),
|
||||||
|
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -88,15 +112,12 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||||
UName_(ptf.UName_),
|
|
||||||
kName_(ptf.kName_),
|
|
||||||
GName_(ptf.GName_),
|
GName_(ptf.GName_),
|
||||||
rhoName_(ptf.rhoName_),
|
|
||||||
muName_(ptf.muName_),
|
|
||||||
mutName_(ptf.mutName_),
|
|
||||||
Cmu_(ptf.Cmu_),
|
Cmu_(ptf.Cmu_),
|
||||||
kappa_(ptf.kappa_),
|
kappa_(ptf.kappa_),
|
||||||
E_(ptf.E_)
|
E_(ptf.E_),
|
||||||
|
yPlusLam_(ptf.yPlusLam_)
|
||||||
|
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -110,15 +131,12 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
||||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
|
||||||
kName_(dict.lookupOrDefault<word>("k", "k")),
|
|
||||||
GName_(dict.lookupOrDefault<word>("G", "RASModel::G")),
|
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)),
|
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
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();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -130,15 +148,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(ewfpsf),
|
fixedInternalValueFvPatchField<scalar>(ewfpsf),
|
||||||
UName_(ewfpsf.UName_),
|
|
||||||
kName_(ewfpsf.kName_),
|
|
||||||
GName_(ewfpsf.GName_),
|
GName_(ewfpsf.GName_),
|
||||||
rhoName_(ewfpsf.rhoName_),
|
|
||||||
muName_(ewfpsf.muName_),
|
|
||||||
mutName_(ewfpsf.mutName_),
|
|
||||||
Cmu_(ewfpsf.Cmu_),
|
Cmu_(ewfpsf.Cmu_),
|
||||||
kappa_(ewfpsf.kappa_),
|
kappa_(ewfpsf.kappa_),
|
||||||
E_(ewfpsf.E_)
|
E_(ewfpsf.E_),
|
||||||
|
yPlusLam_(ewfpsf.yPlusLam_)
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -151,15 +165,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF),
|
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF),
|
||||||
UName_(ewfpsf.UName_),
|
|
||||||
kName_(ewfpsf.kName_),
|
|
||||||
GName_(ewfpsf.GName_),
|
GName_(ewfpsf.GName_),
|
||||||
rhoName_(ewfpsf.rhoName_),
|
|
||||||
muName_(ewfpsf.muName_),
|
|
||||||
mutName_(ewfpsf.mutName_),
|
|
||||||
Cmu_(ewfpsf.Cmu_),
|
Cmu_(ewfpsf.Cmu_),
|
||||||
kappa_(ewfpsf.kappa_),
|
kappa_(ewfpsf.kappa_),
|
||||||
E_(ewfpsf.E_)
|
E_(ewfpsf.E_),
|
||||||
|
yPlusLam_(ewfpsf.yPlusLam_)
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -174,33 +184,36 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||||
|
|
||||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||||
const scalar Cmu75 = pow(Cmu_, 0.75);
|
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&>
|
volScalarField& G =
|
||||||
(db().lookupObject<volScalarField>(GName_));
|
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));
|
||||||
|
|
||||||
volScalarField& epsilon = const_cast<volScalarField&>
|
DimensionedField<scalar, volMesh>& epsilon =
|
||||||
(db().lookupObject<volScalarField>(dimensionedInternalField().name()));
|
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 =
|
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
|
||||||
|
|
||||||
const scalarField& muw =
|
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
|
||||||
|
|
||||||
const scalarField& mutw =
|
const tmp<volScalarField> tmut = rasModel.mut();
|
||||||
patch().lookupPatchField<volScalarField, scalar>(mutName_);
|
const volScalarField& mut = tmut();
|
||||||
|
const scalarField& mutw = mut.boundaryField()[patchI];
|
||||||
|
|
||||||
const fvPatchVectorField& Uw =
|
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
|
||||||
|
|
||||||
const scalarField magGradUw = mag(Uw.snGrad());
|
const scalarField magGradUw = mag(Uw.snGrad());
|
||||||
|
|
||||||
@ -215,7 +228,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]);
|
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]);
|
||||||
|
|
||||||
if (yPlus > yPlusLam)
|
if (yPlus > yPlusLam_)
|
||||||
{
|
{
|
||||||
G[faceCellI] =
|
G[faceCellI] =
|
||||||
(mutw[faceI] + muw[faceI])
|
(mutw[faceI] + muw[faceI])
|
||||||
@ -247,15 +260,7 @@ void epsilonWallFunctionFvPatchScalarField::evaluate
|
|||||||
void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
|
void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
writeLocalEntries(os);
|
||||||
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;
|
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,26 +57,13 @@ class epsilonWallFunctionFvPatchScalarField
|
|||||||
:
|
:
|
||||||
public fixedInternalValueFvPatchField<scalar>
|
public fixedInternalValueFvPatchField<scalar>
|
||||||
{
|
{
|
||||||
// Private data
|
protected:
|
||||||
|
|
||||||
//- Name of velocity field
|
// Protected data
|
||||||
word UName_;
|
|
||||||
|
|
||||||
//- Name of turbulence kinetic energy field
|
|
||||||
word kName_;
|
|
||||||
|
|
||||||
//- Name of turbulence generation field
|
//- Name of turbulence generation field
|
||||||
word GName_;
|
word GName_;
|
||||||
|
|
||||||
//- Name of density field
|
|
||||||
word rhoName_;
|
|
||||||
|
|
||||||
//- Name of laminar viscosity field
|
|
||||||
word muName_;
|
|
||||||
|
|
||||||
//- Name of turbulent viscosity field
|
|
||||||
word mutName_;
|
|
||||||
|
|
||||||
//- Cmu coefficient
|
//- Cmu coefficient
|
||||||
scalar Cmu_;
|
scalar Cmu_;
|
||||||
|
|
||||||
@ -86,11 +73,20 @@ class epsilonWallFunctionFvPatchScalarField
|
|||||||
//- E coefficient
|
//- E coefficient
|
||||||
scalar E_;
|
scalar E_;
|
||||||
|
|
||||||
|
//- Y+ at the edge of the laminar sublayer
|
||||||
|
scalar yPlusLam_;
|
||||||
|
|
||||||
// Private member functions
|
|
||||||
|
// Protected member functions
|
||||||
|
|
||||||
//- Check the type of the patch
|
//- 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:
|
public:
|
||||||
@ -176,7 +172,7 @@ public:
|
|||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ namespace compressible
|
|||||||
namespace RASModels
|
namespace RASModels
|
||||||
{
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void omegaWallFunctionFvPatchScalarField::checkType()
|
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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||||
@ -65,15 +91,12 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(p, iF),
|
fixedInternalValueFvPatchField<scalar>(p, iF),
|
||||||
UName_("U"),
|
|
||||||
rhoName_("rho"),
|
|
||||||
kName_("k"),
|
|
||||||
GName_("RASModel::G"),
|
GName_("RASModel::G"),
|
||||||
muName_("mu"),
|
|
||||||
mutName_("mut"),
|
|
||||||
Cmu_(0.09),
|
Cmu_(0.09),
|
||||||
kappa_(0.41),
|
kappa_(0.41),
|
||||||
E_(9.8)
|
E_(9.8),
|
||||||
|
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||||
|
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -88,15 +111,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||||
UName_(ptf.UName_),
|
|
||||||
rhoName_(ptf.rhoName_),
|
|
||||||
kName_(ptf.kName_),
|
|
||||||
GName_(ptf.GName_),
|
GName_(ptf.GName_),
|
||||||
muName_(ptf.muName_),
|
|
||||||
mutName_(ptf.mutName_),
|
|
||||||
Cmu_(ptf.Cmu_),
|
Cmu_(ptf.Cmu_),
|
||||||
kappa_(ptf.kappa_),
|
kappa_(ptf.kappa_),
|
||||||
E_(ptf.E_)
|
E_(ptf.E_),
|
||||||
|
yPlusLam_(ptf.yPlusLam_)
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -110,15 +129,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
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")),
|
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)),
|
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
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();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -130,15 +145,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(owfpsf),
|
fixedInternalValueFvPatchField<scalar>(owfpsf),
|
||||||
UName_(owfpsf.UName_),
|
|
||||||
rhoName_(owfpsf.rhoName_),
|
|
||||||
kName_(owfpsf.kName_),
|
|
||||||
GName_(owfpsf.GName_),
|
GName_(owfpsf.GName_),
|
||||||
muName_(owfpsf.muName_),
|
|
||||||
mutName_(owfpsf.mutName_),
|
|
||||||
Cmu_(owfpsf.Cmu_),
|
Cmu_(owfpsf.Cmu_),
|
||||||
kappa_(owfpsf.kappa_),
|
kappa_(owfpsf.kappa_),
|
||||||
E_(owfpsf.E_)
|
E_(owfpsf.E_),
|
||||||
|
yPlusLam_(owfpsf.yPlusLam_)
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -151,15 +162,12 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(owfpsf, iF),
|
fixedInternalValueFvPatchField<scalar>(owfpsf, iF),
|
||||||
UName_(owfpsf.UName_),
|
|
||||||
rhoName_(owfpsf.rhoName_),
|
|
||||||
kName_(owfpsf.kName_),
|
|
||||||
GName_(owfpsf.GName_),
|
GName_(owfpsf.GName_),
|
||||||
muName_(owfpsf.muName_),
|
|
||||||
mutName_(owfpsf.mutName_),
|
|
||||||
Cmu_(owfpsf.Cmu_),
|
Cmu_(owfpsf.Cmu_),
|
||||||
kappa_(owfpsf.kappa_),
|
kappa_(owfpsf.kappa_),
|
||||||
E_(owfpsf.E_)
|
E_(owfpsf.E_),
|
||||||
|
yPlusLam_(owfpsf.yPlusLam_)
|
||||||
|
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -174,8 +182,9 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
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()[patch().index()];
|
||||||
|
|
||||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||||
@ -183,22 +192,24 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
volScalarField& G = const_cast<volScalarField&>
|
volScalarField& G = const_cast<volScalarField&>
|
||||||
(db().lookupObject<volScalarField>(GName_));
|
(db().lookupObject<volScalarField>(GName_));
|
||||||
|
|
||||||
volScalarField& omega = const_cast<volScalarField&>
|
DimensionedField<scalar, volMesh>& omega =
|
||||||
(db().lookupObject<volScalarField>(dimensionedInternalField().name()));
|
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 =
|
const scalarField& rhow = rasModel.rho().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volScalarField, scalar>(rhoName_);
|
|
||||||
|
|
||||||
const scalarField& muw =
|
const scalarField& muw = rasModel.mu().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volScalarField, scalar>(muName_);
|
|
||||||
|
|
||||||
const scalarField& mutw =
|
const tmp<volScalarField> tmut = rasModel.mut();
|
||||||
patch().lookupPatchField<volScalarField, scalar>(mutName_);
|
const volScalarField& mut = tmut();
|
||||||
|
const scalarField& mutw = mut.boundaryField()[patchI];
|
||||||
|
|
||||||
const fvPatchVectorField& Uw =
|
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
|
||||||
|
|
||||||
const scalarField magGradUw = mag(Uw.snGrad());
|
const scalarField magGradUw = mag(Uw.snGrad());
|
||||||
|
|
||||||
@ -213,7 +224,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
|
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
|
||||||
|
|
||||||
if (yPlus > yPlusLam)
|
if (yPlus > yPlusLam_)
|
||||||
{
|
{
|
||||||
G[faceCellI] =
|
G[faceCellI] =
|
||||||
(mutw[faceI] + muw[faceI])
|
(mutw[faceI] + muw[faceI])
|
||||||
@ -236,15 +247,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
|
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
writeLocalEntries(os);
|
||||||
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;
|
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,26 +55,13 @@ class omegaWallFunctionFvPatchScalarField
|
|||||||
:
|
:
|
||||||
public fixedInternalValueFvPatchField<scalar>
|
public fixedInternalValueFvPatchField<scalar>
|
||||||
{
|
{
|
||||||
// Private data
|
protected:
|
||||||
|
|
||||||
//- Name of velocity field
|
// Protected data
|
||||||
word UName_;
|
|
||||||
|
|
||||||
//- Name of density field
|
|
||||||
word rhoName_;
|
|
||||||
|
|
||||||
//- Name of turbulence kinetic energy field
|
|
||||||
word kName_;
|
|
||||||
|
|
||||||
//- Name of turbulence generation field
|
//- Name of turbulence generation field
|
||||||
word GName_;
|
word GName_;
|
||||||
|
|
||||||
//- Name of laminar viscosity field
|
|
||||||
word muName_;
|
|
||||||
|
|
||||||
//- Name of turbulent viscosity field
|
|
||||||
word mutName_;
|
|
||||||
|
|
||||||
//- Cmu coefficient
|
//- Cmu coefficient
|
||||||
scalar Cmu_;
|
scalar Cmu_;
|
||||||
|
|
||||||
@ -84,11 +71,20 @@ class omegaWallFunctionFvPatchScalarField
|
|||||||
//- E coefficient
|
//- E coefficient
|
||||||
scalar E_;
|
scalar E_;
|
||||||
|
|
||||||
|
//- Y+ at the edge of the laminar sublayer
|
||||||
|
scalar yPlusLam_;
|
||||||
|
|
||||||
// Private member functions
|
|
||||||
|
// Protected member functions
|
||||||
|
|
||||||
//- Check the type of the patch
|
//- 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:
|
public:
|
||||||
@ -171,7 +167,7 @@ public:
|
|||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
//- Write
|
//- 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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
||||||
@ -65,14 +91,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(p, iF),
|
fixedInternalValueFvPatchField<scalar>(p, iF),
|
||||||
UName_("U"),
|
|
||||||
kName_("k"),
|
|
||||||
GName_("RASModel::G"),
|
GName_("RASModel::G"),
|
||||||
nuName_("nu"),
|
|
||||||
nutName_("nut"),
|
|
||||||
Cmu_(0.09),
|
Cmu_(0.09),
|
||||||
kappa_(0.41),
|
kappa_(0.41),
|
||||||
E_(9.8)
|
E_(9.8),
|
||||||
|
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -87,14 +110,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||||
UName_(ptf.UName_),
|
|
||||||
kName_(ptf.kName_),
|
|
||||||
GName_(ptf.GName_),
|
GName_(ptf.GName_),
|
||||||
nuName_(ptf.nuName_),
|
|
||||||
nutName_(ptf.nutName_),
|
|
||||||
Cmu_(ptf.Cmu_),
|
Cmu_(ptf.Cmu_),
|
||||||
kappa_(ptf.kappa_),
|
kappa_(ptf.kappa_),
|
||||||
E_(ptf.E_)
|
E_(ptf.E_),
|
||||||
|
yPlusLam_(ptf.yPlusLam_)
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -108,14 +128,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
||||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
|
||||||
kName_(dict.lookupOrDefault<word>("k", "k")),
|
|
||||||
GName_(dict.lookupOrDefault<word>("G", "RASModel::G")),
|
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)),
|
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
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();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -127,14 +144,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(ewfpsf),
|
fixedInternalValueFvPatchField<scalar>(ewfpsf),
|
||||||
UName_(ewfpsf.UName_),
|
|
||||||
kName_(ewfpsf.kName_),
|
|
||||||
GName_(ewfpsf.GName_),
|
GName_(ewfpsf.GName_),
|
||||||
nuName_(ewfpsf.nuName_),
|
|
||||||
nutName_(ewfpsf.nutName_),
|
|
||||||
Cmu_(ewfpsf.Cmu_),
|
Cmu_(ewfpsf.Cmu_),
|
||||||
kappa_(ewfpsf.kappa_),
|
kappa_(ewfpsf.kappa_),
|
||||||
E_(ewfpsf.E_)
|
E_(ewfpsf.E_),
|
||||||
|
yPlusLam_(ewfpsf.yPlusLam_)
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -147,14 +161,11 @@ epsilonWallFunctionFvPatchScalarField::epsilonWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF),
|
fixedInternalValueFvPatchField<scalar>(ewfpsf, iF),
|
||||||
UName_(ewfpsf.UName_),
|
|
||||||
kName_(ewfpsf.kName_),
|
|
||||||
GName_(ewfpsf.GName_),
|
GName_(ewfpsf.GName_),
|
||||||
nuName_(ewfpsf.nuName_),
|
|
||||||
nutName_(ewfpsf.nutName_),
|
|
||||||
Cmu_(ewfpsf.Cmu_),
|
Cmu_(ewfpsf.Cmu_),
|
||||||
kappa_(ewfpsf.kappa_),
|
kappa_(ewfpsf.kappa_),
|
||||||
E_(ewfpsf.E_)
|
E_(ewfpsf.E_),
|
||||||
|
yPlusLam_(ewfpsf.yPlusLam_)
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -169,29 +180,33 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
const scalarField& y = rasModel.y()[patchI];
|
||||||
const scalarField& y = rasModel.y()[patch().index()];
|
|
||||||
|
|
||||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||||
const scalar Cmu75 = pow(Cmu_, 0.75);
|
const scalar Cmu75 = pow(Cmu_, 0.75);
|
||||||
|
|
||||||
volScalarField& G = const_cast<volScalarField&>
|
volScalarField& G =
|
||||||
(db().lookupObject<volScalarField>(GName_));
|
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));
|
||||||
|
|
||||||
volScalarField& epsilon = const_cast<volScalarField&>
|
DimensionedField<scalar, volMesh>& epsilon =
|
||||||
(db().lookupObject<volScalarField>(dimensionedInternalField().name()));
|
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 =
|
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volScalarField, scalar>(nuName_);
|
|
||||||
|
|
||||||
const scalarField& nutw =
|
const tmp<volScalarField> tnut = rasModel.nut();
|
||||||
patch().lookupPatchField<volScalarField, scalar>(nutName_);
|
const volScalarField& nut = tnut();
|
||||||
|
const scalarField& nutw = nut.boundaryField()[patchI];
|
||||||
|
|
||||||
const fvPatchVectorField& Uw =
|
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
|
||||||
|
|
||||||
const scalarField magGradUw = mag(Uw.snGrad());
|
const scalarField magGradUw = mag(Uw.snGrad());
|
||||||
|
|
||||||
@ -204,7 +219,7 @@ void epsilonWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]);
|
epsilon[faceCellI] = Cmu75*pow(k[faceCellI], 1.5)/(kappa_*y[faceI]);
|
||||||
|
|
||||||
if (yPlus > yPlusLam)
|
if (yPlus > yPlusLam_)
|
||||||
{
|
{
|
||||||
G[faceCellI] =
|
G[faceCellI] =
|
||||||
(nutw[faceI] + nuw[faceI])
|
(nutw[faceI] + nuw[faceI])
|
||||||
@ -236,14 +251,7 @@ void epsilonWallFunctionFvPatchScalarField::evaluate
|
|||||||
void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
|
void epsilonWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
writeLocalEntries(os);
|
||||||
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;
|
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,23 +57,13 @@ class epsilonWallFunctionFvPatchScalarField
|
|||||||
:
|
:
|
||||||
public fixedInternalValueFvPatchField<scalar>
|
public fixedInternalValueFvPatchField<scalar>
|
||||||
{
|
{
|
||||||
// Private data
|
protected:
|
||||||
|
|
||||||
//- Name of velocity field
|
// Protected data
|
||||||
word UName_;
|
|
||||||
|
|
||||||
//- Name of turbulence kinetic energy field
|
|
||||||
word kName_;
|
|
||||||
|
|
||||||
//- Name of turbulence generation field
|
//- Name of turbulence generation field
|
||||||
word GName_;
|
word GName_;
|
||||||
|
|
||||||
//- Name of laminar viscosity field
|
|
||||||
word nuName_;
|
|
||||||
|
|
||||||
//- Name of turbulent viscosity field
|
|
||||||
word nutName_;
|
|
||||||
|
|
||||||
//- Cmu coefficient
|
//- Cmu coefficient
|
||||||
scalar Cmu_;
|
scalar Cmu_;
|
||||||
|
|
||||||
@ -84,10 +74,20 @@ class epsilonWallFunctionFvPatchScalarField
|
|||||||
scalar E_;
|
scalar E_;
|
||||||
|
|
||||||
|
|
||||||
// Private member functions
|
//- Y+ at the edge of the laminar sublayer
|
||||||
|
scalar yPlusLam_;
|
||||||
|
|
||||||
|
|
||||||
|
// Protected member functions
|
||||||
|
|
||||||
//- Check the type of the patch
|
//- 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:
|
public:
|
||||||
@ -173,7 +173,7 @@ public:
|
|||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
//- Write
|
//- Write
|
||||||
void write(Ostream&) const;
|
virtual void write(Ostream&) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ namespace incompressible
|
|||||||
namespace RASModels
|
namespace RASModels
|
||||||
{
|
{
|
||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
void omegaWallFunctionFvPatchScalarField::checkType()
|
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 * * * * * * * * * * * * * * //
|
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
|
||||||
|
|
||||||
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
||||||
@ -65,14 +91,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(p, iF),
|
fixedInternalValueFvPatchField<scalar>(p, iF),
|
||||||
UName_("U"),
|
|
||||||
kName_("k"),
|
|
||||||
GName_("RASModel::G"),
|
GName_("RASModel::G"),
|
||||||
nuName_("nu"),
|
|
||||||
nutName_("nut"),
|
|
||||||
Cmu_(0.09),
|
Cmu_(0.09),
|
||||||
kappa_(0.41),
|
kappa_(0.41),
|
||||||
E_(9.8)
|
E_(9.8),
|
||||||
|
yPlusLam_(calcYPlusLam(kappa_, E_))
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -87,14 +110,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
fixedInternalValueFvPatchField<scalar>(ptf, p, iF, mapper),
|
||||||
UName_(ptf.UName_),
|
|
||||||
kName_(ptf.kName_),
|
|
||||||
GName_(ptf.GName_),
|
GName_(ptf.GName_),
|
||||||
nuName_(ptf.nuName_),
|
|
||||||
nutName_(ptf.nutName_),
|
|
||||||
Cmu_(ptf.Cmu_),
|
Cmu_(ptf.Cmu_),
|
||||||
kappa_(ptf.kappa_),
|
kappa_(ptf.kappa_),
|
||||||
E_(ptf.E_)
|
E_(ptf.E_),
|
||||||
|
yPlusLam_(ptf.yPlusLam_)
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -108,14 +128,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
fixedInternalValueFvPatchField<scalar>(p, iF, dict),
|
||||||
UName_(dict.lookupOrDefault<word>("U", "U")),
|
|
||||||
kName_(dict.lookupOrDefault<word>("k", "k")),
|
|
||||||
GName_(dict.lookupOrDefault<word>("G", "RASModel::G")),
|
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)),
|
Cmu_(dict.lookupOrDefault<scalar>("Cmu", 0.09)),
|
||||||
kappa_(dict.lookupOrDefault<scalar>("kappa", 0.41)),
|
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();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -127,14 +144,11 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(owfpsf),
|
fixedInternalValueFvPatchField<scalar>(owfpsf),
|
||||||
UName_(owfpsf.UName_),
|
|
||||||
kName_(owfpsf.kName_),
|
|
||||||
GName_(owfpsf.GName_),
|
GName_(owfpsf.GName_),
|
||||||
nuName_(owfpsf.nuName_),
|
|
||||||
nutName_(owfpsf.nutName_),
|
|
||||||
Cmu_(owfpsf.Cmu_),
|
Cmu_(owfpsf.Cmu_),
|
||||||
kappa_(owfpsf.kappa_),
|
kappa_(owfpsf.kappa_),
|
||||||
E_(owfpsf.E_)
|
E_(owfpsf.E_),
|
||||||
|
yPlusLam_(owfpsf.yPlusLam_)
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -147,14 +161,12 @@ omegaWallFunctionFvPatchScalarField::omegaWallFunctionFvPatchScalarField
|
|||||||
)
|
)
|
||||||
:
|
:
|
||||||
fixedInternalValueFvPatchField<scalar>(owfpsf, iF),
|
fixedInternalValueFvPatchField<scalar>(owfpsf, iF),
|
||||||
UName_(owfpsf.UName_),
|
|
||||||
kName_(owfpsf.kName_),
|
|
||||||
GName_(owfpsf.GName_),
|
GName_(owfpsf.GName_),
|
||||||
nuName_(owfpsf.nuName_),
|
|
||||||
nutName_(owfpsf.nutName_),
|
|
||||||
Cmu_(owfpsf.Cmu_),
|
Cmu_(owfpsf.Cmu_),
|
||||||
kappa_(owfpsf.kappa_),
|
kappa_(owfpsf.kappa_),
|
||||||
E_(owfpsf.E_)
|
E_(owfpsf.E_),
|
||||||
|
yPlusLam_(owfpsf.yPlusLam_)
|
||||||
|
|
||||||
{
|
{
|
||||||
checkType();
|
checkType();
|
||||||
}
|
}
|
||||||
@ -169,28 +181,32 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const label patchI = patch().index();
|
||||||
|
|
||||||
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
const RASModel& rasModel = db().lookupObject<RASModel>("RASProperties");
|
||||||
const scalar yPlusLam = rasModel.yPlusLam(kappa_, E_);
|
const scalarField& y = rasModel.y()[patchI];
|
||||||
const scalarField& y = rasModel.y()[patch().index()];
|
|
||||||
|
|
||||||
const scalar Cmu25 = pow(Cmu_, 0.25);
|
const scalar Cmu25 = pow(Cmu_, 0.25);
|
||||||
|
|
||||||
volScalarField& G = const_cast<volScalarField&>
|
volScalarField& G =
|
||||||
(db().lookupObject<volScalarField>(GName_));
|
const_cast<volScalarField&>(db().lookupObject<volScalarField>(GName_));
|
||||||
|
|
||||||
volScalarField& omega = const_cast<volScalarField&>
|
DimensionedField<scalar, volMesh>& omega =
|
||||||
(db().lookupObject<volScalarField>(dimensionedInternalField().name()));
|
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 =
|
const scalarField& nuw = rasModel.nu().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volScalarField, scalar>(nuName_);
|
|
||||||
|
|
||||||
const scalarField& nutw =
|
const tmp<volScalarField> tnut = rasModel.nut();
|
||||||
patch().lookupPatchField<volScalarField, scalar>(nutName_);
|
const volScalarField& nut = tnut();
|
||||||
|
const scalarField& nutw = nut.boundaryField()[patchI];
|
||||||
|
|
||||||
const fvPatchVectorField& Uw =
|
const fvPatchVectorField& Uw = rasModel.U().boundaryField()[patchI];
|
||||||
patch().lookupPatchField<volVectorField, vector>(UName_);
|
|
||||||
|
|
||||||
const scalarField magGradUw = mag(Uw.snGrad());
|
const scalarField magGradUw = mag(Uw.snGrad());
|
||||||
|
|
||||||
@ -203,7 +219,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
|
|
||||||
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
|
omega[faceCellI] = sqrt(k[faceCellI])/(Cmu25*kappa_*y[faceI]);
|
||||||
|
|
||||||
if (yPlus > yPlusLam)
|
if (yPlus > yPlusLam_)
|
||||||
{
|
{
|
||||||
G[faceCellI] =
|
G[faceCellI] =
|
||||||
(nutw[faceI] + nuw[faceI])
|
(nutw[faceI] + nuw[faceI])
|
||||||
@ -226,14 +242,7 @@ void omegaWallFunctionFvPatchScalarField::updateCoeffs()
|
|||||||
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
|
void omegaWallFunctionFvPatchScalarField::write(Ostream& os) const
|
||||||
{
|
{
|
||||||
fixedInternalValueFvPatchField<scalar>::write(os);
|
fixedInternalValueFvPatchField<scalar>::write(os);
|
||||||
writeEntryIfDifferent<word>(os, "U", "U", UName_);
|
writeLocalEntries(os);
|
||||||
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;
|
|
||||||
writeEntry("value", os);
|
writeEntry("value", os);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,23 +55,13 @@ class omegaWallFunctionFvPatchScalarField
|
|||||||
:
|
:
|
||||||
public fixedInternalValueFvPatchField<scalar>
|
public fixedInternalValueFvPatchField<scalar>
|
||||||
{
|
{
|
||||||
// Private data
|
protected:
|
||||||
|
|
||||||
//- Name of velocity field
|
// Protected data
|
||||||
word UName_;
|
|
||||||
|
|
||||||
//- Name of turbulence kinetic energy field
|
|
||||||
word kName_;
|
|
||||||
|
|
||||||
//- Name of turbulence generation field
|
//- Name of turbulence generation field
|
||||||
word GName_;
|
word GName_;
|
||||||
|
|
||||||
//- Name of laminar viscosity field
|
|
||||||
word nuName_;
|
|
||||||
|
|
||||||
//- Name of turbulent viscosity field
|
|
||||||
word nutName_;
|
|
||||||
|
|
||||||
//- Cmu coefficient
|
//- Cmu coefficient
|
||||||
scalar Cmu_;
|
scalar Cmu_;
|
||||||
|
|
||||||
@ -81,11 +71,20 @@ class omegaWallFunctionFvPatchScalarField
|
|||||||
//- E coefficient
|
//- E coefficient
|
||||||
scalar E_;
|
scalar E_;
|
||||||
|
|
||||||
|
//- Y+ at the edge of the laminar sublayer
|
||||||
|
scalar yPlusLam_;
|
||||||
|
|
||||||
// Private member functions
|
|
||||||
|
// Protected member functions
|
||||||
|
|
||||||
//- Check the type of the patch
|
//- 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:
|
public:
|
||||||
@ -168,7 +167,7 @@ public:
|
|||||||
// I-O
|
// I-O
|
||||||
|
|
||||||
//- Write
|
//- 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 = \
|
CGAL_INC = \
|
||||||
-Wno-old-style-cast \
|
-Wno-old-style-cast \
|
||||||
-I${CGAL_SRC}/include \
|
-I${CGAL_SRC}/include \
|
||||||
-I${CGAL_PATH} \
|
-I${BOOST_ROOT}/include/boost-${BOOST_LIB_VERSION}
|
||||||
-I${BOOST_SRC}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user