Merge branch 'master' of ssh://noisy/home/noisy3/OpenFOAM/OpenFOAM-dev

This commit is contained in:
henry
2009-10-26 14:01:45 +00:00
124 changed files with 1697 additions and 582 deletions

View File

@ -121,7 +121,7 @@ void Foam::SIBS::solve
kMax_ = kOpt_;
}
label k=0;
label k = 0;
scalar h = hTry;
yTemp_ = y;
@ -213,7 +213,7 @@ void Foam::SIBS::solve
x = xNew_;
hDid = h;
first_=0;
first_ = 0;
scalar wrkmin = GREAT;
scalar scale = 1.0;

View File

@ -27,7 +27,7 @@ License
#include "mapDistribute.H"
#include "commSchedule.H"
#include "HashSet.H"
#include "ListOps.H"
#include "globalIndex.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
@ -257,6 +257,292 @@ Foam::mapDistribute::mapDistribute
}
Foam::mapDistribute::mapDistribute
(
const globalIndex& globalNumbering,
labelList& elements,
List<Map<label> >& compactMap
)
:
constructSize_(0),
schedulePtr_()
{
// 1. Construct per processor compact addressing of the global elements
// needed. The ones from the local processor are not included since
// these are always all needed.
compactMap.setSize(Pstream::nProcs());
{
// Count all (non-local) elements needed. Just for presizing map.
labelList nNonLocal(Pstream::nProcs(), 0);
forAll(elements, i)
{
label globalIndex = elements[i];
if (!globalNumbering.isLocal(globalIndex))
{
label procI = globalNumbering.whichProcID(globalIndex);
nNonLocal[procI]++;
}
}
forAll(compactMap, procI)
{
if (procI != Pstream::myProcNo())
{
compactMap[procI].resize(2*nNonLocal[procI]);
}
}
// Collect all (non-local) elements needed.
forAll(elements, i)
{
label globalIndex = elements[i];
if (!globalNumbering.isLocal(globalIndex))
{
label procI = globalNumbering.whichProcID(globalIndex);
label index = globalNumbering.toLocal(procI, globalIndex);
label nCompact = compactMap[procI].size();
compactMap[procI].insert(index, nCompact);
}
}
//// Sort remote elements needed (not really necessary)
//forAll(compactMap, procI)
//{
// if (procI != Pstream::myProcNo())
// {
// Map<label>& globalMap = compactMap[procI];
//
// SortableList<label> sorted(globalMap.toc().xfer());
//
// forAll(sorted, i)
// {
// Map<label>::iterator iter = globalMap.find(sorted[i]);
// iter() = i;
// }
// }
//}
}
// 2. The overall compact addressing is
// - myProcNo data first (uncompacted)
// - all other processors consecutively
labelList compactStart(Pstream::nProcs());
compactStart[Pstream::myProcNo()] = 0;
constructSize_ = globalNumbering.localSize();
forAll(compactStart, procI)
{
if (procI != Pstream::myProcNo())
{
compactStart[procI] = constructSize_;
constructSize_ += compactMap[procI].size();
}
}
// 3. Find out what to receive/send in compact addressing.
// What I want to receive is what others have to send
labelListList wantedRemoteElements(Pstream::nProcs());
// Compact addressing for received data
constructMap_.setSize(Pstream::nProcs());
forAll(compactMap, procI)
{
if (procI == Pstream::myProcNo())
{
// All my own elements are used
label nLocal = globalNumbering.localSize();
wantedRemoteElements[procI] = identity(nLocal);
constructMap_[procI] = identity(nLocal);
}
else
{
// Remote elements wanted from processor procI
labelList& remoteElem = wantedRemoteElements[procI];
labelList& localElem = constructMap_[procI];
remoteElem.setSize(compactMap[procI].size());
localElem.setSize(compactMap[procI].size());
label i = 0;
forAllIter(Map<label>, compactMap[procI], iter)
{
remoteElem[i] = iter.key();
label compactI = compactStart[procI]+iter();
localElem[i] = compactI;
iter() = compactI;
i++;
}
}
}
subMap_.setSize(Pstream::nProcs());
exchange(wantedRemoteElements, subMap_);
// Renumber elements
forAll(elements, i)
{
elements[i] = renumber(globalNumbering, compactMap, elements[i]);
}
}
Foam::mapDistribute::mapDistribute
(
const globalIndex& globalNumbering,
labelListList& cellCells,
List<Map<label> >& compactMap
)
:
constructSize_(0),
schedulePtr_()
{
// 1. Construct per processor compact addressing of the global elements
// needed. The ones from the local processor are not included since
// these are always all needed.
compactMap.setSize(Pstream::nProcs());
{
// Count all (non-local) elements needed. Just for presizing map.
labelList nNonLocal(Pstream::nProcs(), 0);
forAll(cellCells, cellI)
{
const labelList& cCells = cellCells[cellI];
forAll(cCells, i)
{
label globalIndex = cCells[i];
if (!globalNumbering.isLocal(globalIndex))
{
label procI = globalNumbering.whichProcID(globalIndex);
nNonLocal[procI]++;
}
}
}
forAll(compactMap, procI)
{
if (procI != Pstream::myProcNo())
{
compactMap[procI].resize(2*nNonLocal[procI]);
}
}
// Collect all (non-local) elements needed.
// Collect all (non-local) elements needed.
forAll(cellCells, cellI)
{
const labelList& cCells = cellCells[cellI];
forAll(cCells, i)
{
label globalIndex = cCells[i];
if (!globalNumbering.isLocal(globalIndex))
{
label procI = globalNumbering.whichProcID(globalIndex);
label index = globalNumbering.toLocal(procI, globalIndex);
label nCompact = compactMap[procI].size();
compactMap[procI].insert(index, nCompact);
}
}
}
//// Sort remote elements needed (not really necessary)
//forAll(compactMap, procI)
//{
// if (procI != Pstream::myProcNo())
// {
// Map<label>& globalMap = compactMap[procI];
//
// SortableList<label> sorted(globalMap.toc().xfer());
//
// forAll(sorted, i)
// {
// Map<label>::iterator iter = globalMap.find(sorted[i]);
// iter() = i;
// }
// }
//}
}
// 2. The overall compact addressing is
// - myProcNo data first (uncompacted)
// - all other processors consecutively
labelList compactStart(Pstream::nProcs());
compactStart[Pstream::myProcNo()] = 0;
constructSize_ = globalNumbering.localSize();
forAll(compactStart, procI)
{
if (procI != Pstream::myProcNo())
{
compactStart[procI] = constructSize_;
constructSize_ += compactMap[procI].size();
}
}
// 3. Find out what to receive/send in compact addressing.
// What I want to receive is what others have to send
labelListList wantedRemoteElements(Pstream::nProcs());
// Compact addressing for received data
constructMap_.setSize(Pstream::nProcs());
forAll(compactMap, procI)
{
if (procI == Pstream::myProcNo())
{
// All my own elements are used
label nLocal = globalNumbering.localSize();
wantedRemoteElements[procI] = identity(nLocal);
constructMap_[procI] = identity(nLocal);
}
else
{
// Remote elements wanted from processor procI
labelList& remoteElem = wantedRemoteElements[procI];
labelList& localElem = constructMap_[procI];
remoteElem.setSize(compactMap[procI].size());
localElem.setSize(compactMap[procI].size());
label i = 0;
forAllIter(Map<label>, compactMap[procI], iter)
{
remoteElem[i] = iter.key();
label compactI = compactStart[procI]+iter();
localElem[i] = compactI;
iter() = compactI;
i++;
}
}
}
subMap_.setSize(Pstream::nProcs());
exchange(wantedRemoteElements, subMap_);
// Renumber elements
forAll(cellCells, cellI)
{
labelList& cCells = cellCells[cellI];
forAll(cCells, i)
{
cCells[i] = renumber(globalNumbering, compactMap, cCells[i]);
}
}
}
Foam::mapDistribute::mapDistribute(const mapDistribute& map)
:
constructSize_(map.constructSize_),
@ -266,7 +552,27 @@ Foam::mapDistribute::mapDistribute(const mapDistribute& map)
{}
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
Foam::label Foam::mapDistribute::renumber
(
const globalIndex& globalNumbering,
const List<Map<label> >& compactMap,
const label globalI
)
{
if (globalNumbering.isLocal(globalI))
{
return globalNumbering.toLocal(globalI);
}
else
{
label procI = globalNumbering.whichProcID(globalI);
label index = globalNumbering.toLocal(procI, globalI);
return compactMap[procI][index];
}
}
void Foam::mapDistribute::compact(const boolList& elemIsUsed)
{

View File

@ -39,6 +39,16 @@ Note:
Note2: number of items send on one processor have to equal the number
of items received on the other processor.
Constructors using compact numbering: all my own elements first
(whether used or not) followed by used-only remote elements.
So e.g 4 procs and on proc 1 the compact
table will first have all globalIndex.localSize() elements from proc1
followed by used-only elements of proc0, proc2, proc3.
The constructed mapDistribute sends the local elements from and
receives the remote elements into their compact position.
compactMap[procI] is the position of elements from procI in the compact
map. compactMap[myProcNo()] is empty since trivial addressing. The indices
into compactMap[procI] are local, not global, indices.
SourceFiles
mapDistribute.C
@ -52,6 +62,7 @@ SourceFiles
#include "labelPair.H"
#include "Pstream.H"
#include "boolList.H"
#include "Map.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -59,6 +70,7 @@ namespace Foam
{
class mapPolyMesh;
class globalIndex;
/*---------------------------------------------------------------------------*\
Class mapDistribute Declaration
@ -81,6 +93,15 @@ class mapDistribute
mutable autoPtr<List<labelPair> > schedulePtr_;
//- Exchange data. sendBuf[procI] : data to send to processor procI
// To be moved into Pstream.
template<class T>
static void exchange
(
const List<List<T> >& sendBuf,
List<List<T> >& recvBuf
);
public:
// Public classes
@ -123,6 +144,27 @@ public:
const labelList& recvProcs
);
//- Construct from list of (possibly) remote elements in globalIndex
// numbering. Determines compact numbering (see above) and
// distribute map to get data into this ordering and renumbers the
// elements to be in compact numbering.
mapDistribute
(
const globalIndex&,
labelList& elements,
List<Map<label> >& compactMap
);
//- Special variant that works with the into sorted into bins
// according to local indices. E.g. think cellCells where
// cellCells[localCellI] is a list of global cells
mapDistribute
(
const globalIndex&,
labelListList& cellCells,
List<Map<label> >& compactMap
);
//- Construct copy
mapDistribute(const mapDistribute&);
@ -180,6 +222,15 @@ public:
// Other
//- Helper for construct from globalIndex. Renumbers element
// (in globalIndex numbering) into compact indices.
static label renumber
(
const globalIndex&,
const List<Map<label> >& compactMap,
const label globalElement
);
//- Compact maps. Gets per field a bool whether it is used (locally)
// and works out itself what this side and sender side can remove
// from maps.

View File

@ -886,4 +886,78 @@ void Foam::mapDistribute::distribute
}
template<class T>
void Foam::mapDistribute::exchange
(
const List<List<T> >& sendBuf,
List<List<T> >& recvBuf
)
{
if (!contiguous<T>())
{
FatalErrorIn("mapDistribute::exchange(..)")
<< "Not contiguous" << exit(FatalError);
}
if (Pstream::parRun())
{
// Determine sizes
// ~~~~~~~~~~~~~~~
labelListList allNTrans(Pstream::nProcs());
allNTrans[Pstream::myProcNo()].setSize(Pstream::nProcs());
forAll(allNTrans, procI)
{
allNTrans[Pstream::myProcNo()][procI] = sendBuf[procI].size();
}
combineReduce(allNTrans, listEq());
// Set up receives
// ~~~~~~~~~~~~~~~
recvBuf.setSize(Pstream::nProcs());
forAll(recvBuf, procI)
{
if (procI != Pstream::myProcNo())
{
recvBuf[procI].setSize(allNTrans[procI][Pstream::myProcNo()]);
IPstream::read
(
Pstream::nonBlocking,
procI,
reinterpret_cast<char*>(recvBuf[procI].begin()),
recvBuf[procI].byteSize()
);
}
}
// Set up sends
// ~~~~~~~~~~~~
forAll(sendBuf, procI)
{
if (procI != Pstream::myProcNo())
{
OPstream::write
(
Pstream::nonBlocking,
procI,
reinterpret_cast<const char*>(sendBuf[procI].begin()),
sendBuf[procI].byteSize()
);
}
}
// Wait for completion
Pstream::waitRequests();
}
// Do myself
recvBuf[Pstream::myProcNo()] = sendBuf[Pstream::myProcNo()];
}
// ************************************************************************* //

View File

@ -39,10 +39,10 @@ if (mesh.nInternalFaces())
mesh.surfaceInterpolation::deltaCoeffs()*mag(mesh.phi());
meshCoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
meanMeshCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
}
Info<< "Mesh Courant Number mean: " << meanMeshCoNum

View File

@ -119,7 +119,7 @@ void fvMotionSolverEngineMesh::move()
pistonPosition_.value() += deltaZ;
scalar pistonSpeed = deltaZ/engineDB_.deltaT().value();
scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
<< "Piston speed = " << pistonSpeed << " m/s" << endl;

View File

@ -121,7 +121,7 @@ void layeredEngineMesh::move()
}
pistonPosition_.value() += deltaZ;
scalar pistonSpeed = deltaZ/engineDB_.deltaT().value();
scalar pistonSpeed = deltaZ/engineDB_.deltaTValue();
Info<< "clearance: " << deckHeight_.value() - pistonPosition_.value() << nl
<< "Piston speed = " << pistonSpeed << " m/s" << endl;

View File

@ -165,7 +165,7 @@ Foam::scalar Foam::engineTime::thetaRevolution() const
Foam::scalar Foam::engineTime::deltaTheta() const
{
return timeToDeg(deltaT().value());
return timeToDeg(deltaTValue());
}
@ -216,7 +216,7 @@ Foam::dimensionedScalar Foam::engineTime::pistonSpeed() const
(
"pistonSpeed",
dimVelocity,
pistonDisplacement().value()/(deltaT().value() + VSMALL)
pistonDisplacement().value()/(deltaTValue() + VSMALL)
);
}

View File

@ -208,7 +208,7 @@ Foam::scalar Foam::engineValve::curVelocity() const
lift(engineDB_.theta() - engineDB_.deltaTheta()),
minLift_
)
)/(engineDB_.deltaT().value() + VSMALL);
)/(engineDB_.deltaTValue() + VSMALL);
}

View File

@ -106,7 +106,7 @@ const labelList& ignitionSite::cells() const
bool ignitionSite::igniting() const
{
scalar curTime = db_.value();
scalar deltaT = db_.deltaT().value();
scalar deltaT = db_.deltaTValue();
return
(
@ -120,7 +120,7 @@ bool ignitionSite::igniting() const
bool ignitionSite::ignited() const
{
scalar curTime = db_.value();
scalar deltaT = db_.deltaT().value();
scalar deltaT = db_.deltaTValue();
return(curTime - deltaT >= time_);
}

View File

@ -39,10 +39,10 @@ if (mesh.nInternalFaces())
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi)/fvc::interpolate(rho);
CoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
}
Info<< "Courant Number mean: " << meanCoNum

View File

@ -180,7 +180,7 @@ Foam::timeActivatedExplicitMulticomponentPointSource::Su
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaT().value();
const scalar dt = runTime_.deltaTValue();
forAll(pointSources_, sourceI)
{
@ -240,7 +240,7 @@ Foam::timeActivatedExplicitMulticomponentPointSource::Su()
DimensionedField<scalar, volMesh>& sourceField = tSource();
const scalarField& V = mesh_.V();
const scalar dt = runTime_.deltaT().value();
const scalar dt = runTime_.deltaTValue();
forAll(pointSources_, sourceI)
{

View File

@ -41,12 +41,12 @@ if (adjustTimeStep)
(
min
(
deltaTFact*runTime.deltaT().value(),
deltaTFact*runTime.deltaTValue(),
maxDeltaT
)
);
Info<< "deltaT = " << runTime.deltaT().value() << endl;
Info<< "deltaT = " << runTime.deltaTValue() << endl;
}
// ************************************************************************* //

View File

@ -39,7 +39,7 @@ if (adjustTimeStep)
(
min
(
maxCo*runTime.deltaT().value()/CoNum,
maxCo*runTime.deltaTValue()/CoNum,
maxDeltaT
)
);

View File

@ -4,12 +4,12 @@
// Backward Differencing in time.
conserve.internalField() +=
(1.0 - mesh.V0()/mesh.V())/runTime.deltaT().value();
(1.0 - mesh.V0()/mesh.V())/runTime.deltaTValue();
scalar sumLocalContErr = runTime.deltaT().value()*
scalar sumLocalContErr = runTime.deltaTValue()*
mag(conserve)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaT().value()*
scalar globalContErr = runTime.deltaTValue()*
conserve.weightedAverage(mesh.V()).value();
Info<< "volume continuity errors : sum local = " << sumLocalContErr

View File

@ -39,10 +39,10 @@ if (mesh.nInternalFaces())
mesh.surfaceInterpolation::deltaCoeffs()*mag(phi);
CoNum = max(SfUfbyDelta/mesh.magSf())
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
meanCoNum = (sum(SfUfbyDelta)/sum(mesh.magSf()))
.value()*runTime.deltaT().value();
.value()*runTime.deltaTValue();
}
Info<< "Courant Number mean: " << meanCoNum

View File

@ -33,10 +33,10 @@ Description
{
volScalarField contErr = fvc::div(phi);
scalar sumLocalContErr = runTime.deltaT().value()*
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaT().value()*
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
cumulativeContErr += globalContErr;

View File

@ -33,10 +33,10 @@ Description
{
volScalarField contErr = fvc::div(phi + fvc::meshPhi(U));
scalar sumLocalContErr = runTime.deltaT().value()*
scalar sumLocalContErr = runTime.deltaTValue()*
mag(contErr)().weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaT().value()*
scalar globalContErr = runTime.deltaTValue()*
contErr.weightedAverage(mesh.V()).value();
cumulativeContErr += globalContErr;

View File

@ -32,11 +32,11 @@ Description
if (mesh.moving())
{
scalar sumLocalContErr = runTime.deltaT().value()*
scalar sumLocalContErr = runTime.deltaTValue()*
mag(fvc::div(phi + fvc::meshPhi(rho, U)))()
.weightedAverage(mesh.V()).value();
scalar globalContErr = runTime.deltaT().value()*
scalar globalContErr = runTime.deltaTValue()*
fvc::div(phi + fvc::meshPhi(rho, U))()
.weightedAverage(mesh.V()).value();

View File

@ -223,7 +223,7 @@ void Foam::activeBaffleVelocityFvPatchVectorField::updateCoeffs()
openFraction_
+ max
(
this->db().time().deltaT().value()/openingTime_,
this->db().time().deltaTValue()/openingTime_,
maxOpenFractionDelta_
)
*(orientation_*sign(forceDiff)),

View File

@ -202,7 +202,7 @@ void advectiveFvPatchField<Type>::updateCoeffs()
this->dimensionedInternalField().mesh()
.ddtScheme(this->dimensionedInternalField().name())
);
scalar deltaT = this->db().time().deltaT().value();
scalar deltaT = this->db().time().deltaTValue();
const GeometricField<Type, fvPatchField, volMesh>& field =
this->db().objectRegistry::

View File

@ -112,7 +112,7 @@ void movingWallVelocityFvPatchVectorField::updateCoeffs()
oldFc[i] = pp[i].centre(oldPoints);
}
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaT().value();
vectorField Up = (pp.faceCentres() - oldFc)/mesh.time().deltaTValue();
const volVectorField& U = db().lookupObject<volVectorField>("U");
scalarField phip =

View File

@ -196,7 +196,7 @@ void syringePressureFvPatchScalarField::updateCoeffs()
}
scalar t = db().time().value();
scalar deltaT = db().time().deltaT().value();
scalar deltaT = db().time().deltaTValue();
const surfaceScalarField& phi =
db().lookupObject<surfaceScalarField>("phi");

View File

@ -59,8 +59,8 @@ EulerD2dt2Scheme<Type>::fvcD2dt2
IOobject::NO_WRITE
);
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
@ -137,8 +137,8 @@ EulerD2dt2Scheme<Type>::fvcD2dt2
IOobject::NO_WRITE
);
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
@ -246,8 +246,8 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
fvMatrix<Type>& fvm = tfvm();
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
@ -307,8 +307,8 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
fvMatrix<Type>& fvm = tfvm();
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);
@ -368,8 +368,8 @@ EulerD2dt2Scheme<Type>::fvmD2dt2
fvMatrix<Type>& fvm = tfvm();
scalar deltaT = mesh().time().deltaT().value();
scalar deltaT0 = mesh().time().deltaT0().value();
scalar deltaT = mesh().time().deltaTValue();
scalar deltaT0 = mesh().time().deltaT0Value();
scalar coefft = (deltaT + deltaT0)/(2*deltaT);
scalar coefft00 = (deltaT + deltaT0)/(2*deltaT0);

View File

@ -276,7 +276,7 @@ EulerDdtScheme<Type>::fvmDdt
fvMatrix<Type>& fvm = tfvm();
scalar rDeltaT = 1.0/mesh().time().deltaT().value();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
fvm.diag() = rDeltaT*mesh().V();
@ -311,7 +311,7 @@ EulerDdtScheme<Type>::fvmDdt
);
fvMatrix<Type>& fvm = tfvm();
scalar rDeltaT = 1.0/mesh().time().deltaT().value();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
fvm.diag() = rDeltaT*rho.value()*mesh().V();
@ -348,7 +348,7 @@ EulerDdtScheme<Type>::fvmDdt
);
fvMatrix<Type>& fvm = tfvm();
scalar rDeltaT = 1.0/mesh().time().deltaT().value();
scalar rDeltaT = 1.0/mesh().time().deltaTValue();
fvm.diag() = rDeltaT*rho.internalField()*mesh().V();

View File

@ -44,14 +44,14 @@ namespace fv
template<class Type>
scalar backwardDdtScheme<Type>::deltaT_() const
{
return mesh().time().deltaT().value();
return mesh().time().deltaTValue();
}
template<class Type>
scalar backwardDdtScheme<Type>::deltaT0_() const
{
return mesh().time().deltaT0().value();
return mesh().time().deltaT0Value();
}

View File

@ -42,13 +42,13 @@ namespace fv
scalar boundedBackwardDdtScheme::deltaT_() const
{
return mesh().time().deltaT().value();
return mesh().time().deltaTValue();
}
scalar boundedBackwardDdtScheme::deltaT0_() const
{
return mesh().time().deltaT0().value();
return mesh().time().deltaT0Value();
}

View File

@ -99,7 +99,7 @@ void Foam::MULES::explicitSolve
scalarField& psiIf = psi;
const scalarField& psi0 = psi.oldTime();
const scalar deltaT = mesh.time().deltaT().value();
const scalar deltaT = mesh.time().deltaTValue();
psiIf = 0.0;
fvc::surfaceIntegrate(psiIf, phiPsi);
@ -328,7 +328,7 @@ void Foam::MULES::limiter
const unallocLabelList& owner = mesh.owner();
const unallocLabelList& neighb = mesh.neighbour();
const scalarField& V = mesh.V();
const scalar deltaT = mesh.time().deltaT().value();
const scalar deltaT = mesh.time().deltaTValue();
const scalarField& phiBDIf = phiBD;
const surfaceScalarField::GeometricBoundaryField& phiBDBf =

View File

@ -55,7 +55,7 @@ class centredCPCCellToFaceStencilObject
public:
TypeName("centredCFCCellToFaceStencil");
TypeName("centredCPCCellToFaceStencil");
// Constructors

View File

@ -55,7 +55,7 @@ class centredFECCellToFaceStencilObject
public:
TypeName("centredCFCCellToFaceStencil");
TypeName("centredFECCellToFaceStencil");
// Constructors

View File

@ -55,7 +55,7 @@ class upwindCECCellToFaceStencilObject
public:
TypeName("upwindCFCCellToFaceStencil");
TypeName("upwindCECCellToFaceStencil");
// Constructors

View File

@ -55,7 +55,7 @@ class upwindCPCCellToFaceStencilObject
public:
TypeName("upwindCFCCellToFaceStencil");
TypeName("upwindCPCCellToFaceStencil");
// Constructors

View File

@ -55,7 +55,7 @@ class upwindFECCellToFaceStencilObject
public:
TypeName("upwindCFCCellToFaceStencil");
TypeName("upwindFECCellToFaceStencil");
// Constructors

View File

@ -93,202 +93,6 @@ void Foam::extendedCellToFaceStencil::writeStencilStats
}
Foam::autoPtr<Foam::mapDistribute>
Foam::extendedCellToFaceStencil::calcDistributeMap
(
const polyMesh& mesh,
const globalIndex& globalNumbering,
labelListList& faceStencil
)
{
// Convert stencil to schedule
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~
// We now know what information we need from other processors. This needs
// to be converted into what information I need to send as well
// (mapDistribute)
// 1. Construct per processor compact addressing of the global cells
// needed. The ones from the local processor are not included since
// these are always all needed.
List<Map<label> > globalToProc(Pstream::nProcs());
{
const labelList& procPatchMap = mesh.globalData().procPatchMap();
const polyBoundaryMesh& patches = mesh.boundaryMesh();
// Presize with (as estimate) size of patch to neighbour.
forAll(procPatchMap, procI)
{
if (procPatchMap[procI] != -1)
{
globalToProc[procI].resize
(
patches[procPatchMap[procI]].size()
);
}
}
// Collect all (non-local) globalcells/faces needed.
forAll(faceStencil, faceI)
{
const labelList& stencilCells = faceStencil[faceI];
forAll(stencilCells, i)
{
label globalCellI = stencilCells[i];
label procI = globalNumbering.whichProcID(stencilCells[i]);
if (procI != Pstream::myProcNo())
{
label nCompact = globalToProc[procI].size();
globalToProc[procI].insert(globalCellI, nCompact);
}
}
}
// Sort global cells needed (not really necessary)
forAll(globalToProc, procI)
{
if (procI != Pstream::myProcNo())
{
Map<label>& globalMap = globalToProc[procI];
SortableList<label> sorted(globalMap.toc().xfer());
forAll(sorted, i)
{
Map<label>::iterator iter = globalMap.find(sorted[i]);
iter() = i;
}
}
}
//forAll(globalToProc, procI)
//{
// Pout<< "From processor:" << procI << " want cells/faces:" << endl;
// forAllConstIter(Map<label>, globalToProc[procI], iter)
// {
// Pout<< " global:" << iter.key()
// << " local:" << globalNumbering.toLocal(procI, iter.key())
// << endl;
// }
// Pout<< endl;
//}
}
// 2. The overall compact addressing is
// - myProcNo data first (uncompacted)
// - all other processors consecutively
labelList compactStart(Pstream::nProcs());
compactStart[Pstream::myProcNo()] = 0;
label nCompact = globalNumbering.localSize();
forAll(compactStart, procI)
{
if (procI != Pstream::myProcNo())
{
compactStart[procI] = nCompact;
nCompact += globalToProc[procI].size();
}
}
// 3. Find out what to receive/send in compact addressing.
labelListList recvCompact(Pstream::nProcs());
for (label procI = 0; procI < Pstream::nProcs(); procI++)
{
if (procI != Pstream::myProcNo())
{
labelList wantedGlobals(globalToProc[procI].size());
recvCompact[procI].setSize(globalToProc[procI].size());
label i = 0;
forAllConstIter(Map<label>, globalToProc[procI], iter)
{
wantedGlobals[i] = iter.key();
recvCompact[procI][i] = compactStart[procI]+iter();
i++;
}
// Send the global cell numbers I need from procI
OPstream str(Pstream::blocking, procI);
str << wantedGlobals;
}
else
{
recvCompact[procI] =
compactStart[procI]
+ identity(globalNumbering.localSize());
}
}
labelListList sendCompact(Pstream::nProcs());
for (label procI = 0; procI < Pstream::nProcs(); procI++)
{
if (procI != Pstream::myProcNo())
{
// See what neighbour wants to receive (= what I need to send)
IPstream str(Pstream::blocking, procI);
labelList globalCells(str);
labelList& procCompact = sendCompact[procI];
procCompact.setSize(globalCells.size());
// Convert from globalCells (all on my processor!) into compact
// addressing
forAll(globalCells, i)
{
label cellI = globalNumbering.toLocal(globalCells[i]);
procCompact[i] = compactStart[Pstream::myProcNo()]+cellI;
}
}
else
{
sendCompact[procI] = recvCompact[procI];
}
}
// Convert stencil to compact numbering
forAll(faceStencil, faceI)
{
labelList& stencilCells = faceStencil[faceI];
forAll(stencilCells, i)
{
label globalCellI = stencilCells[i];
label procI = globalNumbering.whichProcID(globalCellI);
if (procI != Pstream::myProcNo())
{
label localCompact = globalToProc[procI][globalCellI];
stencilCells[i] = compactStart[procI]+localCompact;
}
else
{
label localCompact = globalNumbering.toLocal(globalCellI);
stencilCells[i] = compactStart[procI]+localCompact;
}
}
}
// Constuct map for distribution of compact data.
autoPtr<mapDistribute> mapPtr
(
new mapDistribute
(
nCompact,
sendCompact.xfer(),
recvCompact.xfer()
)
);
return mapPtr;
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedCellToFaceStencil::extendedCellToFaceStencil(const polyMesh& mesh)

View File

@ -112,14 +112,6 @@ public:
// Member Functions
//- Calculate distribute map
static autoPtr<mapDistribute> calcDistributeMap
(
const polyMesh& mesh,
const globalIndex& globalNumbering,
labelListList& faceStencil
);
//- Use map to get the data into stencil order
template<class T>
static void collectData

View File

@ -35,16 +35,19 @@ Foam::extendedCentredCellToFaceStencil::extendedCentredCellToFaceStencil
const cellToFaceStencil& stencil
)
:
extendedCellToFaceStencil(stencil.mesh())
extendedCellToFaceStencil(stencil.mesh()),
stencil_(stencil)
{
stencil_ = stencil;
// Calculate distribute map (also renumbers elements in stencil)
mapPtr_ = calcDistributeMap
List<Map<label> > compactMap(Pstream::nProcs());
mapPtr_.reset
(
stencil.mesh(),
stencil.globalNumbering(),
stencil_
new mapDistribute
(
stencil.globalNumbering(),
stencil_,
compactMap
)
);
}

View File

@ -419,19 +419,32 @@ Foam::extendedUpwindCellToFaceStencil::extendedUpwindCellToFaceStencil
neiStencil_
);
ownMapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
ownStencil_
);
{
List<Map<label> > compactMap(Pstream::nProcs());
ownMapPtr_.reset
(
new mapDistribute
(
stencil.globalNumbering(),
ownStencil_,
compactMap
)
);
}
neiMapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
neiStencil_
);
{
List<Map<label> > compactMap(Pstream::nProcs());
neiMapPtr_.reset
(
new mapDistribute
(
stencil.globalNumbering(),
neiStencil_,
compactMap
)
);
}
// stencil now in compact form
if (pureUpwind_)
@ -515,12 +528,18 @@ Foam::extendedUpwindCellToFaceStencil::extendedUpwindCellToFaceStencil
ownStencil_ = stencil;
ownMapPtr_ = calcDistributeMap
(
stencil.mesh(),
stencil.globalNumbering(),
ownStencil_
);
{
List<Map<label> > compactMap(Pstream::nProcs());
ownMapPtr_.reset
(
new mapDistribute
(
stencil.globalNumbering(),
ownStencil_,
compactMap
)
);
}
const fvMesh& mesh = dynamic_cast<const fvMesh&>(stencil.mesh());

View File

@ -28,9 +28,6 @@ License
#include "extendedCentredFaceToCellStencil.H"
#include "faceToCellStencil.H"
// Only for access to calcDistributeMap <- needs to be moved out
#include "extendedCellToFaceStencil.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
Foam::extendedCentredFaceToCellStencil::extendedCentredFaceToCellStencil
@ -38,16 +35,19 @@ Foam::extendedCentredFaceToCellStencil::extendedCentredFaceToCellStencil
const faceToCellStencil& stencil
)
:
extendedFaceToCellStencil(stencil.mesh())
extendedFaceToCellStencil(stencil.mesh()),
stencil_(stencil)
{
stencil_ = stencil;
// Calculate distribute map (also renumbers elements in stencil)
mapPtr_ = extendedCellToFaceStencil::calcDistributeMap
List<Map<label> > compactMap(Pstream::nProcs());
mapPtr_.reset
(
stencil.mesh(),
stencil.globalNumbering(),
stencil_
new mapDistribute
(
stencil.globalNumbering(),
stencil_,
compactMap
)
);
}

View File

@ -576,7 +576,7 @@ Foam::tmp<Foam::scalarField> Foam::fvMesh::movePoints(const pointField& p)
// Move the polyMesh and set the mesh motion fluxes to the swept-volumes
scalar rDeltaT = 1.0/time().deltaT().value();
scalar rDeltaT = 1.0/time().deltaTValue();
tmp<scalarField> tsweptVols = polyMesh::movePoints(p);
scalarField& sweptVols = tsweptVols();

View File

@ -142,7 +142,7 @@ Foam::velocityComponentLaplacianFvMotionSolver::curPoints() const
(
cmpt_,
tcurPoints().component(cmpt_)
+ fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
+ fvMesh_.time().deltaTValue()*pointMotionU_.internalField()
);
twoDCorrectPoints(tcurPoints());

View File

@ -112,7 +112,7 @@ Foam::velocityLaplacianFvMotionSolver::curPoints() const
tmp<pointField> tcurPoints
(
fvMesh_.points()
+ fvMesh_.time().deltaT().value()*pointMotionU_.internalField()
+ fvMesh_.time().deltaTValue()*pointMotionU_.internalField()
);
twoDCorrectPoints(tcurPoints());

View File

@ -146,7 +146,7 @@ void angularOscillatingVelocityPointPatchVectorField::updateCoeffs()
+ (axisHat ^ p0Rel*sin(angle))
+ (axisHat & p0Rel)*(1 - cos(angle))*axisHat
- p.localPoints()
)/t.deltaT().value()
)/t.deltaTValue()
);
fixedValuePointPatchField<vector>::updateCoeffs();

View File

@ -125,7 +125,7 @@ void oscillatingVelocityPointPatchVectorField::updateCoeffs()
Field<vector>::operator=
(
(p0_ + amplitude_*sin(omega_*t.value()) - p.localPoints())
/t.deltaT().value()
/t.deltaTValue()
);
fixedValuePointPatchField<vector>::updateCoeffs();

View File

@ -129,7 +129,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
// calculate the forces on the motion object from this data, then
// update the positions
motion_.updatePosition(t.deltaT().value());
motion_.updatePosition(t.deltaTValue());
dictionary forcesDict;
@ -157,7 +157,7 @@ void sixDoFRigidBodyDisplacementPointPatchVectorField::updateCoeffs()
(
fm.first().first() + fm.first().second() + gravity*motion_.mass(),
fm.second().first() + fm.second().second(),
t.deltaT().value()
t.deltaTValue()
);
Field<vector>::operator=(motion_.generatePositions(p0_) - p0_);

View File

@ -64,7 +64,7 @@ void surfaceDisplacementPointPatchVectorField::calcProjection
const pointField& localPoints = patch().localPoints();
const labelList& meshPoints = patch().meshPoints();
//const scalar deltaT = mesh.time().deltaT().value();
//const scalar deltaT = mesh.time().deltaTValue();
// Construct large enough vector in direction of projectDir so
// we're guaranteed to hit something.
@ -451,7 +451,7 @@ void surfaceDisplacementPointPatchVectorField::updateCoeffs()
// Clip offset to maximum displacement possible: velocity*timestep
const scalar deltaT = mesh.time().deltaT().value();
const scalar deltaT = mesh.time().deltaTValue();
const vector clipVelocity = velocity_*deltaT;
forAll(displacement, i)

View File

@ -63,7 +63,7 @@ void surfaceSlipDisplacementPointPatchVectorField::calcProjection
const pointField& localPoints = patch().localPoints();
const labelList& meshPoints = patch().meshPoints();
//const scalar deltaT = mesh.time().deltaT().value();
//const scalar deltaT = mesh.time().deltaTValue();
// Construct large enough vector in direction of projectDir so
// we're guaranteed to hit something.

View File

@ -373,7 +373,7 @@ inline Foam::scalar Foam::Particle<ParticleType>::currentTime() const
{
return
cloud_.pMesh().time().value()
+ stepFraction_*cloud_.pMesh().time().deltaT().value();
+ stepFraction_*cloud_.pMesh().time().deltaTValue();
}

View File

@ -100,7 +100,7 @@ bool Foam::parcel::move(spray& sDB)
const liquidMixture& fuels = sDB.fuels();
scalar deltaT = sDB.runTime().deltaT().value();
scalar deltaT = sDB.runTime().deltaTValue();
label Nf = fuels.components().size();
label Ns = sDB.composition().Y().size();

View File

@ -157,7 +157,7 @@ inline tmp<volVectorField> spray::momentumSource() const
)
);
tsource().internalField() = sms_/runTime_.deltaT().value()/mesh_.V();
tsource().internalField() = sms_/runTime_.deltaTValue()/mesh_.V();
return tsource;
}
@ -185,7 +185,7 @@ inline tmp<volScalarField> spray::evaporationSource(const label si) const
if (isLiquidFuel_[si])
{
label fi = gasToLiquidIndex_[si];
tsource().internalField() = srhos_[fi]/runTime_.deltaT().value()/mesh_.V();
tsource().internalField() = srhos_[fi]/runTime_.deltaTValue()/mesh_.V();
}
else
{
@ -216,7 +216,7 @@ inline tmp<volScalarField> spray::heatTransferSource() const
)
);
tsource().internalField() = shs_/runTime_.deltaT().value()/mesh_.V();
tsource().internalField() = shs_/runTime_.deltaTValue()/mesh_.V();
return tsource;
}

View File

@ -71,7 +71,7 @@ void spray::inject()
// deltaT is the duration of injection during this timestep
scalar deltaT = min
(
runTime_.deltaT().value(),
runTime_.deltaTValue(),
min
(
time - it->tsoi(),
@ -150,8 +150,8 @@ void spray::inject()
scalar dt = time - toi;
pPtr->stepFraction() =
(runTime_.deltaT().value() - dt)
/runTime_.deltaT().value();
(runTime_.deltaTValue() - dt)
/runTime_.deltaTValue();
bool keepParcel = pPtr->move(*this);

View File

@ -58,7 +58,7 @@ void spray::evolve()
calculateAmbientPressure();
calculateAmbientTemperature();
collisions().collideParcels(runTime_.deltaT().value());
collisions().collideParcels(runTime_.deltaTValue());
move();
dispersion().disperseParcels();
inject();
@ -103,7 +103,7 @@ void spray::breakupLoop()
breakup().updateParcelProperties
(
elmnt(),
runTime_.deltaT().value(),
runTime_.deltaTValue(),
velocity,
fuels_
);
@ -111,7 +111,7 @@ void spray::breakupLoop()
breakup().breakupParcel
(
elmnt(),
runTime_.deltaT().value(),
runTime_.deltaTValue(),
velocity,
fuels_
);
@ -137,7 +137,7 @@ void spray::atomizationLoop()
atomization().atomizeParcel
(
elmnt(),
runTime_.deltaT().value(),
runTime_.deltaTValue(),
velocity,
fuels_
);

View File

@ -72,7 +72,7 @@ void gradientDispersionRAS::disperseParcels() const
const scalar cps = 0.16432;
scalar dt = spray_.runTime().deltaT().value();
scalar dt = spray_.runTime().deltaTValue();
const volScalarField& k = turbulence().k();
volVectorField gradk = fvc::grad(k);
const volScalarField& epsilon = turbulence().epsilon();

View File

@ -73,7 +73,7 @@ void stochasticDispersionRAS::disperseParcels() const
const scalar cps = 0.16432;
const vector one(1.0, 1.0, 1.0);
scalar dt = spray_.runTime().deltaT().value();
scalar dt = spray_.runTime().deltaTValue();
const volScalarField& k = turbulence().k();
//volVectorField gradk = fvc::grad(k);
const volScalarField& epsilon = turbulence().epsilon();

View File

@ -104,7 +104,7 @@ bool reflectParcel::wallTreatment
vector Ub1 = U_.boundaryField()[patchi][facei];
vector Ub0 = U_.oldTime().boundaryField()[patchi][facei];
scalar dt = spray_.runTime().deltaT().value();
scalar dt = spray_.runTime().deltaTValue();
const vectorField& oldPoints = mesh.oldPoints();
const vector& Cf1 = mesh.faceCentres()[globalFacei];

View File

@ -128,7 +128,7 @@ inline Foam::Random& Foam::DsmcCloud<ParcelType>::rndGen()
template<class ParcelType>
inline void Foam::DsmcCloud<ParcelType>::storeDeltaT()
{
cachedDeltaT_ = mesh().time().deltaT().value();
cachedDeltaT_ = mesh().time().deltaTValue();
}

View File

@ -47,6 +47,7 @@ $(REACTINGMPPARCEL)/makeBasicReactingMultiphaseParcelSubmodels.C
/* bolt-on models */
submodels/addOns/radiation/absorptionEmission/cloudAbsorptionEmission/cloudAbsorptionEmission.C
submodels/addOns/radiation/scatter/cloudScatter/cloudScatter.C
submodels/Kinematic/PatchInteractionModel/LocalInteraction/patchInteractionData.C
/* data entries */

View File

@ -167,7 +167,7 @@ void Foam::KinematicCloud<ParcelType>::checkParcelProperties
parcel.rho() = constProps_.rho0();
}
scalar carrierDt = this->db().time().deltaT().value();
scalar carrierDt = this->db().time().deltaTValue();
parcel.stepFraction() = (carrierDt - lagrangianDt)/carrierDt;
}

View File

@ -84,7 +84,7 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
false
),
this->mesh(),
dimensionedScalar("zero", dimensionSet(1, 2, -2, 0, 0), 0.0)
dimensionedScalar("zero", dimEnergy, 0.0)
),
hcTrans_
(
@ -98,7 +98,7 @@ Foam::ThermoCloud<ParcelType>::ThermoCloud
false
),
this->mesh(),
dimensionedScalar("zero", dimensionSet(1, 2, -2, 0, 0), 0.0)
dimensionedScalar("zero", dimEnergy, 0.0)
)
{
if (readFields)

View File

@ -226,7 +226,7 @@ bool Foam::KinematicParcel<ParcelType>::move(TrackData& td)
const polyMesh& mesh = td.cloud().pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
const scalar deltaT = mesh.time().deltaT().value();
const scalar deltaT = mesh.time().deltaTValue();
scalar tEnd = (1.0 - p.stepFraction())*deltaT;
const scalar dtMax = tEnd;
@ -286,7 +286,13 @@ bool Foam::KinematicParcel<ParcelType>::hitPatch
ParcelType& p = static_cast<ParcelType&>(*this);
td.cloud().postProcessing().postPatch(p, patchI);
return td.cloud().patchInteraction().correct(pp, this->face(), U_);
return td.cloud().patchInteraction().correct
(
pp,
this->face(),
td.keepParticle,
U_
);
}

View File

@ -462,15 +462,21 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
{
const label idc =
td.cloud().composition().localToGlobalCarrierId(idPhase, i);
const scalar hv = td.cloud().mcCarrierThermo().speciesData()[idc].H(T);
const label idl = td.cloud().composition().globalIds(idPhase)[i];
const scalar hl =
td.cloud().composition().liquids().properties()[idl].h(pc_, T);
// Enthalphy transfer to carrier phase
const scalar hv = td.cloud().mcCarrierThermo().speciesData()[idc].H(Ts);
const scalar hl =
td.cloud().composition().liquids().properties()[idl].h(pc_, Ts);
// Enthalphy transfer to carrier phase - method 1 using enthalpy diff
Sh += dMassPC[i]*(hl - hv)/dt;
// Enthalphy transfer to carrier phase - method 2 using latent heat
// const scalar hl =
// td.cloud().composition().liquids().properties()[idl].hl(pc_, Ts);
// Sh -= dMassPC[i]*hl/dt;
// Update particle surface thermo properties
const scalar Dab =
td.cloud().composition().liquids().properties()[idl].D(pc_, Ts, Wc);

View File

@ -351,7 +351,7 @@ void Foam::InjectionModel<CloudType>::inject(TrackData& td)
}
const scalar time = owner_.db().time().value();
const scalar carrierDt = owner_.db().time().deltaT().value();
const scalar carrierDt = owner_.db().time().deltaTValue();
const polyMesh& mesh = owner_.mesh();
// Prepare for next time step

View File

@ -26,7 +26,7 @@ License
#include "LocalInteraction.H"
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template <class CloudType>
Foam::label Foam::LocalInteraction<CloudType>::applyToPatch
@ -46,7 +46,7 @@ Foam::label Foam::LocalInteraction<CloudType>::applyToPatch
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template <class CloudType>
Foam::LocalInteraction<CloudType>::LocalInteraction
@ -62,6 +62,7 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
const polyMesh& mesh = cloud.mesh();
const polyBoundaryMesh& bMesh = mesh.boundaryMesh();
// check that user patches are valid region patches
forAll(patchData_, patchI)
{
const word& patchName = patchData_[patchI].patchName();
@ -70,7 +71,7 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
{
FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)")
<< "Patch " << patchName << " not found. Available patches "
<< "are: " << bMesh.names() << exit(FatalError);
<< "are: " << bMesh.names() << nl << exit(FatalError);
}
}
@ -95,6 +96,26 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
<< "interaction. Please specify data for patches:" << nl
<< badWalls << nl << exit(FatalError);
}
// check that interactions are valid/specified
forAll(patchData_, patchI)
{
const word& interactionTypeName =
patchData_[patchI].interactionTypeName();
const typename PatchInteractionModel<CloudType>::interactionType& it =
this->wordToInteractionType(interactionTypeName);
if (it == PatchInteractionModel<CloudType>::itOther)
{
const word& patchName = patchData_[patchI].patchName();
FatalErrorIn("LocalInteraction(const dictionary&, CloudType&)")
<< "Unknown patch interaction type "
<< interactionTypeName << " for patch " << patchName
<< ". Valid selections are:"
<< this->PatchInteractionModel<CloudType>::interactionTypeNames_
<< nl << exit(FatalError);
}
}
}
@ -105,7 +126,7 @@ Foam::LocalInteraction<CloudType>::~LocalInteraction()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
template<class CloudType>
bool Foam::LocalInteraction<CloudType>::active() const
@ -119,6 +140,7 @@ bool Foam::LocalInteraction<CloudType>::correct
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const
{
@ -126,18 +148,64 @@ bool Foam::LocalInteraction<CloudType>::correct
if (patchI >= 0)
{
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);
typename PatchInteractionModel<CloudType>::interactionType it =
this->wordToInteractionType
(
patchData_[patchI].interactionTypeName()
);
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0)
switch (it)
{
U -= (1.0 + patchData_[patchI].e())*Un*nw;
}
case PatchInteractionModel<CloudType>::itEscape:
{
keepParticle = false;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itStick:
{
keepParticle = true;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itRebound:
{
keepParticle = true;
U -= patchData_[patchI].mu()*Ut;
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0)
{
U -= (1.0 + patchData_[patchI].e())*Un*nw;
}
U -= patchData_[patchI].mu()*Ut;
break;
}
default:
{
FatalErrorIn
(
"bool LocalInteraction<CloudType>::correct"
"("
"const polyPatch&, "
"const label, "
"bool&, "
"vector&"
") const"
) << "Unknown interaction type "
<< patchData_[patchI].interactionTypeName()
<< "(" << it << ") for patch "
<< patchData_[patchI].patchName()
<< ". Valid selections are:" << this->interactionTypeNames_
<< endl << abort(FatalError);
}
}
return true;
}

View File

@ -34,7 +34,7 @@ Description
#define LocalInteraction_H
#include "PatchInteractionModel.H"
#include "dictionaryEntry.H"
#include "patchInteractionData.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -49,78 +49,6 @@ class LocalInteraction
:
public PatchInteractionModel<CloudType>
{
class patchInteractionData
{
// Private data
//- Patch name
word patchName_;
//- Elasticity coefficient
scalar e_;
//- Restitution coefficient
scalar mu_;
public:
//- Construct null
patchInteractionData()
:
patchName_("unknownPatch"),
e_(0.0),
mu_(0.0)
{}
//- Construct from dictionary
patchInteractionData(const dictionary& dict);
// Member functions
// Access
//- Return const access to the patch name
const word& patchName() const
{
return patchName_;
}
//- Return const access to the elasticity coefficient
scalar e() const
{
return e_;
}
//- Return const access to the restitution coefficient
scalar mu() const
{
return mu_;
}
// I-O
//- Istream operator
friend Istream& operator>>(Istream& is, patchInteractionData& pid)
{
is.check
(
"Istream& operator>>"
"(Istream&, patchInteractionData&)"
);
const dictionaryEntry entry(dictionary::null, is);
pid.patchName_ = entry.keyword();
entry.lookup("e") >> pid.e_;
entry.lookup("mu") >> pid.mu_;
return is;
}
};
// Private data
//- List of participating patches
@ -164,6 +92,7 @@ public:
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const;
};

View File

@ -0,0 +1,89 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "patchInteractionData.H"
#include "dictionaryEntry.H"
#include "PatchInteractionModel.H"
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
Foam::patchInteractionData::patchInteractionData()
:
interactionTypeName_("unknownInteractionTypeName"),
patchName_("unknownPatch"),
e_(0.0),
mu_(0.0)
{}
// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * //
const Foam::word& Foam::patchInteractionData::interactionTypeName() const
{
return interactionTypeName_;
}
const Foam::word& Foam::patchInteractionData::patchName() const
{
return patchName_;
}
Foam::scalar Foam::patchInteractionData::e() const
{
return e_;
}
Foam::scalar Foam::patchInteractionData::mu() const
{
return mu_;
}
// * * * * * * * * * * * * * * * IOstream Operators * * * * * * * * * * * * //
Foam::Istream& Foam::operator>>
(
Istream& is,
patchInteractionData& pid
)
{
is.check("Istream& operator>>(Istream&, patchInteractionData&)");
const dictionaryEntry entry(dictionary::null, is);
pid.patchName_ = entry.keyword();
entry.lookup("type") >> pid.interactionTypeName_;
pid.e_ = entry.lookupOrDefault<scalar>("e", 1.0);
pid.mu_ = entry.lookupOrDefault<scalar>("mu", 0.0);
return is;
}
// ************************************************************************* //

View File

@ -0,0 +1,157 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 2009-2009 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
OpenFOAM is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with OpenFOAM; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class
Foam::patchInteractionData
Description
Helper class for the LocalInteraction patch interaction model
\*---------------------------------------------------------------------------*/
#ifndef patchInteractionData_H
#define patchInteractionData_H
#include "Istream.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class patchInteractionData Declaration
\*---------------------------------------------------------------------------*/
// Forward declaration of classes
class patchInteractionData;
// Forward declaration of friend functions
Istream& operator>>
(
Istream& is,
patchInteractionData& pid
);
class patchInteractionData
{
// Private data
//- Interaction type name
word interactionTypeName_;
//- Patch name
word patchName_;
//- Elasticity coefficient
scalar e_;
//- Restitution coefficient
scalar mu_;
public:
// Constructor
//- Construct null
patchInteractionData();
// Member functions
// Access
//- Return const access to the interaction type name
const word& interactionTypeName() const;
//- Return const access to the patch name
const word& patchName() const;
//- Return const access to the elasticity coefficient
scalar e() const;
//- Return const access to the restitution coefficient
scalar mu() const;
// I-O
//- Istream operator
friend Istream& operator>>
(
Istream& is,
patchInteractionData& pid
);
/* {
is.check
(
"Istream& operator>>"
"(Istream&, patchInteractionData&)"
);
const dictionaryEntry entry(dictionary::null, is);
pid.patchName_ = entry.keyword();
entry.lookup("type") >> pid.interactionTypeName_;
pid.e_ = entry.lookupOrDefault<scalar>("e", 1.0);
pid.mu_ = entry.lookupOrDefault<scalar>("mu", 0.0);
if
(
PatchInteractionModel<CloudType>::wordToInteractionType
(
pid.interactionTypeName_
)
== PatchInteractionModel<CloudType>::itOther)
{
FatalErrorIn
(
"friend Istream& operator>>"
"("
"Istream&, "
"patchInteractionData&"
")"
) << "Unknown patch interaction type "
<< pid.interactionTypeName_
<< ". Valid selections are:"
<< PatchInteractionModel<CloudType>::
interactionTypeNames_
<< endl << abort(FatalError);
}
return is;
}
*/};
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -26,6 +26,76 @@ License
#include "PatchInteractionModel.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
template<class CloudType>
Foam::wordList Foam::PatchInteractionModel<CloudType>::interactionTypeNames_
(
IStringStream
(
"(rebound stick escape)"
)()
);
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::word Foam::PatchInteractionModel<CloudType>::interactionTypeToWord
(
const interactionType& itEnum
)
{
switch (itEnum)
{
case itRebound:
{
return "rebound";
break;
}
case itStick:
{
return "stick";
break;
}
case itEscape:
{
return "escape";
break;
}
default:
{
return "other";
}
}
}
template<class CloudType>
typename Foam::PatchInteractionModel<CloudType>::interactionType
Foam::PatchInteractionModel<CloudType>::wordToInteractionType
(
const word& itWord
)
{
if (itWord == "rebound")
{
return itRebound;
}
else if (itWord == "stick")
{
return itStick;
}
else if (itWord == "escape")
{
return itEscape;
}
else
{
return itOther;
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>

View File

@ -40,6 +40,7 @@ SourceFiles
#include "IOdictionary.H"
#include "autoPtr.H"
#include "runTimeSelectionTables.H"
#include "polyPatch.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -53,6 +54,24 @@ namespace Foam
template<class CloudType>
class PatchInteractionModel
{
public:
// Public enumerations
// Interaction types
enum interactionType
{
itRebound,
itStick,
itEscape,
itOther
};
static wordList interactionTypeNames_;
private:
// Private data
//- The cloud dictionary
@ -121,6 +140,12 @@ public:
// Member Functions
//- Convert interaction result to word
static word interactionTypeToWord(const interactionType& itEnum);
//- Convert word to interaction result
static interactionType wordToInteractionType(const word& itWord);
//- Flag to indicate whether model activates patch interaction model
virtual bool active() const = 0;
@ -130,6 +155,7 @@ public:
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const = 0;
};

View File

@ -61,9 +61,12 @@ bool Foam::Rebound<CloudType>::correct
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const
{
keepParticle = true;
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);

View File

@ -82,6 +82,7 @@ public:
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const;
};

View File

@ -36,9 +36,45 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
)
:
PatchInteractionModel<CloudType>(dict, cloud, typeName),
e_(dimensionedScalar(this->coeffDict().lookup("e")).value()),
mu_(dimensionedScalar(this->coeffDict().lookup("mu")).value())
{}
interactionType_
(
this->wordToInteractionType(this->coeffDict().lookup("type"))
),
e_(0.0),
mu_(0.0)
{
switch (interactionType_)
{
case PatchInteractionModel<CloudType>::itOther:
{
word interactionTypeName(this->coeffDict().lookup("type"));
FatalErrorIn
(
"StandardWallInteraction<CloudType>::StandardWallInteraction"
"("
"const dictionary&, "
"CloudType& cloud"
")"
) << "Unknown interaction result type "
<< interactionTypeName
<< ". Valid selections are:" << this->interactionTypeNames_
<< endl << exit(FatalError);
break;
}
case PatchInteractionModel<CloudType>::itRebound:
{
e_ = this->coeffDict().lookupOrDefault("e", 1.0);
mu_ = this->coeffDict().lookupOrDefault("mu", 0.0);
break;
}
default:
{
// do nothing
}
}
}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
@ -62,23 +98,62 @@ bool Foam::StandardWallInteraction<CloudType>::correct
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const
{
if (isA<wallPolyPatch>(pp))
{
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0)
switch (interactionType_)
{
U -= (1.0 + e_)*Un*nw;
}
case PatchInteractionModel<CloudType>::itEscape:
{
keepParticle = false;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itStick:
{
keepParticle = true;
U = vector::zero;
break;
}
case PatchInteractionModel<CloudType>::itRebound:
{
keepParticle = true;
U -= mu_*Ut;
vector nw = pp.faceAreas()[pp.whichFace(faceId)];
nw /= mag(nw);
scalar Un = U & nw;
vector Ut = U - Un*nw;
if (Un > 0)
{
U -= (1.0 + e_)*Un*nw;
}
U -= mu_*Ut;
break;
}
default:
{
FatalErrorIn
(
"bool StandardWallInteraction<CloudType>::correct"
"("
"const polyPatch&, "
"const label, "
"bool&, "
"vector&"
") const"
) << "Unknown interaction type "
<< this->interactionTypeToWord(interactionType_)
<< "(" << interactionType_ << ")" << endl
<< abort(FatalError);
}
}
return true;
}

View File

@ -26,7 +26,19 @@ Class
Foam::StandardWallInteraction
Description
Wall interaction based on restitution and elasticity coefficients
Wall interaction model. Three choices:
- rebound - optionally specify elasticity and resitution coefficients
- stick - particles assigined zero velocity
- escape - remove particle from the domain
Example usage:
StandardWallInteractionCoeffs
{
type rebound; // stick, escape
e 1; // optional - elasticity coeff
mu 0; // optional - restitution coeff
}
\*---------------------------------------------------------------------------*/
@ -40,7 +52,7 @@ Description
namespace Foam
{
/*---------------------------------------------------------------------------*\
Class StandardWallInteraction Declaration
Class StandardWallInteraction Declaration
\*---------------------------------------------------------------------------*/
template<class CloudType>
@ -48,13 +60,19 @@ class StandardWallInteraction
:
public PatchInteractionModel<CloudType>
{
// Private data
protected:
//- Elasticity
const scalar e_;
// Protected data
//- Interaction type
typename PatchInteractionModel<CloudType>::interactionType
interactionType_;
//- Elasticity coefficient
scalar e_;
//- Restitution coefficient
const scalar mu_;
scalar mu_;
public:
@ -84,6 +102,7 @@ public:
(
const polyPatch& pp,
const label faceId,
bool& keepParticle,
vector& U
) const;
};

View File

@ -161,7 +161,7 @@ void Foam::LiquidEvaporation<CloudType>::calculate
// vapour diffusivity [m2/s]
scalar Dab = liquids_->properties()[lid].D(pc, Ts);
// Saturation pressure for species i [pa]
// saturation pressure for species i [pa]
// - carrier phase pressure assumed equal to the liquid vapour pressure
// close to the surface
// NOTE: if pSat > pc then particle is superheated

View File

@ -41,9 +41,9 @@ void Foam::correlationFunction<Type>::setTimesAndSizes
const label tZeroBufferSize
)
{
sampleSteps_ = ceil(sampleInterval_/mesh_.time().deltaT().value());
sampleSteps_ = ceil(sampleInterval_/mesh_.time().deltaTValue());
sampleInterval_ = sampleSteps_*mesh_.time().deltaT().value();
sampleInterval_ = sampleSteps_*mesh_.time().deltaTValue();
label bufferLength(ceil(duration_/sampleInterval_));

View File

@ -88,7 +88,7 @@ bool Foam::molecule::move(molecule::trackData& td)
const constantProperties& constProps(td.molCloud().constProps(id_));
scalar deltaT = cloud().pMesh().time().deltaT().value();
scalar deltaT = cloud().pMesh().time().deltaTValue();
if (td.part() == 0)
{

View File

@ -36,7 +36,7 @@ bool Foam::solidParticle::move(solidParticle::trackData& td)
const polyMesh& mesh = cloud().pMesh();
const polyBoundaryMesh& pbMesh = mesh.boundaryMesh();
scalar deltaT = mesh.time().deltaT().value();
scalar deltaT = mesh.time().deltaTValue();
scalar tEnd = (1.0 - stepFraction())*deltaT;
scalar dtMax = tEnd;

View File

@ -93,7 +93,7 @@ bool Foam::trackedParticle::move(trackedParticle::trackData& td)
td.switchProcessor = false;
td.keepParticle = true;
scalar deltaT = cloud().pMesh().time().deltaT().value();
scalar deltaT = cloud().pMesh().time().deltaTValue();
scalar tEnd = (1.0 - stepFraction())*deltaT;
scalar dtMax = tEnd;

View File

@ -70,7 +70,7 @@ void Foam::fieldAverage::initialize()
totalIter_.setSize(faItems_.size(), 1);
totalTime_.clear();
totalTime_.setSize(faItems_.size(), obr_.time().deltaT().value());
totalTime_.setSize(faItems_.size(), obr_.time().deltaTValue());
// Add mean fields to the field lists
@ -170,7 +170,7 @@ void Foam::fieldAverage::calcAverages()
forAll(faItems_, fieldI)
{
totalIter_[fieldI]++;
totalTime_[fieldI] += obr_.time().deltaT().value();
totalTime_[fieldI] += obr_.time().deltaTValue();
}
addMeanSqrToPrime2Mean<scalar, scalar>

View File

@ -150,7 +150,7 @@ const
{
typedef GeometricField<Type, fvPatchField, volMesh> fieldType;
const scalar dt = obr_.time().deltaT().value();
const scalar dt = obr_.time().deltaTValue();
forAll(faItems_, i)
{
@ -193,7 +193,7 @@ void Foam::fieldAverage::calculatePrime2MeanFields
typedef GeometricField<Type1, fvPatchField, volMesh> fieldType1;
typedef GeometricField<Type2, fvPatchField, volMesh> fieldType2;
const scalar dt = obr_.time().deltaT().value();
const scalar dt = obr_.time().deltaTValue();
forAll(faItems_, i)
{

View File

@ -164,7 +164,7 @@ bool Foam::streamLineParticle::move(streamLineParticle::trackData& td)
td.switchProcessor = false;
td.keepParticle = true;
scalar deltaT = GREAT; //cloud().pMesh().time().deltaT().value();
scalar deltaT = GREAT; //cloud().pMesh().time().deltaTValue();
scalar tEnd = (1.0 - stepFraction())*deltaT;
scalar dtMax = tEnd;

View File

@ -65,7 +65,15 @@ Foam::C7H16::C7H16()
182.274175063868,
-254.530511150515
),
h_(-3.1469964e+6,7.3072e+3,-3.52884e+1,1.10637e-1,-1.634831e-4,9.64941e-8),
h_
(
-3.1469964e+6,
7.3072e+3,
-3.52884e+1,
1.10637e-1,
-1.634831e-4,
9.64941e-8
),
cpg_(1199.05392998284, 3992.85457666361, 1676.6, 2734.42177956968, 756.4),
B_
(
@ -80,7 +88,7 @@ Foam::C7H16::C7H16()
K_(0.215, -0.000303, 0.0, 0.0, 0.0, 0.0),
Kg_(-0.070028, 0.38068, -7049.9, -2400500.0),
sigma_(540.20, 0.054143, 1.2512, 0.0, 0.0, 0.0),
D_(147.18, 20.1, 100.204, 28.0) // note: Same as C7H16
D_(147.18, 20.1, 100.204, 28.0)
{}

View File

@ -126,7 +126,7 @@ public:
//- Liquid heat capacity [J/(kg K)]
inline scalar cp(scalar p, scalar T) const;
//- Liquid Enthalpy [J/(kg)]
//- Liquid Enthalpy [J/kg]
inline scalar h(scalar p, scalar T) const;
//- Ideal gas heat capacity [J/(kg K)]

View File

@ -219,7 +219,7 @@ public:
//- Liquid heat capacity [J/(kg K)]
virtual scalar cp(scalar p, scalar T) const = 0;
//- Liquid h [J/kg]
//- Liquid enthalpy [J/kg] - reference to 298.15 K
virtual scalar h(scalar p, scalar T) const = 0;
//- Ideal gas heat capacity [J/(kg K)]

View File

@ -99,7 +99,7 @@ class icoPolynomial
{
// Private data
//- Density
//- Density [kg/m^3]
Polynomial<PolySize> rhoPolynomial_;

View File

@ -40,8 +40,11 @@ Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
Sf_(readScalar(is)),
cpPolynomial_("cpPolynomial", is),
dhPolynomial_(cpPolynomial_.integrate()),
sPolynomial_(cpPolynomial_.integrateMinus1())
{}
dsPolynomial_(cpPolynomial_.integrateMinus1())
{
// Offset dh poly so that it is relative to the enthalpy at Tstd
dhPolynomial_[0] -= dhPolynomial_.evaluate(specie::Tstd);
}
// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
@ -58,7 +61,7 @@ Foam::Ostream& Foam::operator<<
<< pt.Sf_ << tab
<< pt.cpPolynomial_ << tab
<< pt.dhPolynomial_ << tab
<< pt.sPolynomial;
<< pt.dsPolynomial;
os.check
(

View File

@ -106,14 +106,14 @@ class hPolynomialThermo
//- Standard entropy [J/(kg.K)]
scalar Sf_;
//- Specific heat at constant pressure
//- Specific heat at constant pressure [J/(kg.K)]
Polynomial<PolySize> cpPolynomial_;
//- Enthalpy - derived from cp
//- Enthalpy - derived from cp [J/kg] - relative to Tstd
typename Polynomial<PolySize>::intPolyType dhPolynomial_;
//- Entropy - derived from cp
Polynomial<PolySize> sPolynomial_;
//- Entropy - derived from cp [J/(kg.K)]
Polynomial<PolySize> dsPolynomial_;
// Private member functions
@ -125,8 +125,8 @@ class hPolynomialThermo
const scalar Hf,
const scalar Sf,
const Polynomial<PolySize>& cpPoly,
const typename Polynomial<PolySize>::intPolyType& hPoly,
const Polynomial<PolySize>& sPoly
const typename Polynomial<PolySize>::intPolyType& dhPoly,
const Polynomial<PolySize>& dsPoly
);

View File

@ -36,7 +36,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
const scalar Sf,
const Polynomial<PolySize>& cpPoly,
const typename Polynomial<PolySize>::intPolyType& dhPoly,
const Polynomial<PolySize>& sPoly
const Polynomial<PolySize>& dsPoly
)
:
EquationOfState(pt),
@ -44,7 +44,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
Sf_(Sf),
cpPolynomial_(cpPoly),
dhPolynomial_(dhPoly),
sPolynomial_(sPoly)
dsPolynomial_(dsPoly)
{}
@ -62,8 +62,11 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize>::hPolynomialThermo
Sf_(pt.Sf_),
cpPolynomial_(pt.cpPolynomial_),
dhPolynomial_(pt.dhPolynomial_),
sPolynomial_(pt.sPolynomial_)
{}
dsPolynomial_(pt.dsPolynomial_)
{
// Offset dh poly so that it is relative to the enthalpy at Tstd
dhPolynomial_[0] -= dhPolynomial_.evaluate(specie::Tstd);
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -112,7 +115,7 @@ inline Foam::scalar Foam::hPolynomialThermo<EquationOfState, PolySize>::s
const scalar T
) const
{
return (sPolynomial_.evaluate(T) + Sf_)*this->W();
return (dsPolynomial_.evaluate(T) + Sf_)*this->W();
}
@ -135,7 +138,7 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator+=
Sf_ = molr1*Sf_ + molr2*pt.Sf_;
cpPolynomial_ = molr1*cpPolynomial_ + molr2*pt.cpPolynomial_;
dhPolynomial_ = molr1*dhPolynomial_ + molr2*pt.dhPolynomial_;
sPolynomial_ = molr1*sPolynomial_ + molr2*pt.sPolynomial_;
dsPolynomial_ = molr1*dsPolynomial_ + molr2*pt.dsPolynomial_;
}
@ -153,10 +156,10 @@ inline void Foam::hPolynomialThermo<EquationOfState, PolySize>::operator-=
scalar molr2 = pt.nMoles()/this->nMoles();
Hf_ = molr1*Hf_ - molr2*pt.Hf_;
Sf_ = molr1*Hf_ - molr2*pt.Sf_;
Sf_ = molr1*Sf_ - molr2*pt.Sf_;
cpPolynomial_ = molr1*cpPolynomial_ - molr2*pt.cpPolynomial_;
dhPolynomial_ = molr1*dhPolynomial_ - molr2*pt.dhPolynomial_;
sPolynomial_ = molr1*sPolynomial_ - molr2*pt.sPolynomial_;
dsPolynomial_ = molr1*dsPolynomial_ - molr2*pt.dsPolynomial_;
}
@ -184,7 +187,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator+
molr1*pt1.Sf_ + molr2*pt2.Sf_,
molr1*pt1.cpPolynomial_ + molr2*pt2.cpPolynomial_,
molr1*pt1.dhPolynomial_ + molr2*pt2.dhPolynomial_,
molr1*pt1.sPolynomial_ + molr2*pt2.sPolynomial_
molr1*pt1.dsPolynomial_ + molr2*pt2.dsPolynomial_
);
}
@ -211,7 +214,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator-
molr1*pt1.Sf_ - molr2*pt2.Sf_,
molr1*pt1.cpPolynomial_ - molr2*pt2.cpPolynomial_,
molr1*pt1.dhPolynomial_ - molr2*pt2.dhPolynomial_,
molr1*pt1.sPolynomial_ - molr2*pt2.sPolynomial_
molr1*pt1.dsPolynomial_ - molr2*pt2.dsPolynomial_
);
}
@ -230,7 +233,7 @@ inline Foam::hPolynomialThermo<EquationOfState, PolySize> Foam::operator*
pt.Sf_,
pt.cpPolynomial_,
pt.dhPolynomial_,
pt.sPolynomial_
pt.dsPolynomial_
);
}

View File

@ -131,23 +131,23 @@ public:
// Member Functions
// Fundamaental properties
// Fundamental properties
// (These functions must be provided in derived types)
// Heat capacity at constant pressure [J/(kmol K)]
//scalar cp(const scalar) const;
// scalar cp(const scalar) const;
// Enthalpy [J/kmol]
//scalar h(const scalar) const;
// scalar h(const scalar) const;
// Sensible enthalpy [J/kmol]
//scalar hs(const scalar) const;
// scalar hs(const scalar) const;
// Chemical enthalpy [J/kmol]
//scalar hc(const scalar) const;
// scalar hc(const scalar) const;
// Entropy [J/(kmol K)]
//scalar s(const scalar) const;
// scalar s(const scalar) const;
// Calculate and return derived properties

View File

@ -79,7 +79,7 @@ public:
wf_(wf),
wa_(wa),
alpha_(sqrt(1/wf_ + 1/wa_)),
beta_(sqr((cbrt(a_) + cbrt(b_))))
beta_(sqr(cbrt(a_) + cbrt(b_)))
{}
//- Construct from Istream

View File

@ -330,7 +330,7 @@ Foam::tmp<Foam::pointField> Foam::linearValveLayersFvMesh::newPoints() const
forAll (patchPoints, ppI)
{
np[patchPoints[ppI]] += vel*time().deltaT().value();
np[patchPoints[ppI]] += vel*time().deltaTValue();
}
return tnewPoints;

View File

@ -349,7 +349,7 @@ bool Foam::mixerFvMesh::update()
csPtr_->globalPosition
(
csPtr_->localPosition(points())
+ vector(0, rpm_*360.0*time().deltaT().value()/60.0, 0)
+ vector(0, rpm_*360.0*time().deltaTValue()/60.0, 0)
*movingPointsMask()
)
);
@ -372,7 +372,7 @@ bool Foam::mixerFvMesh::update()
csPtr_->globalPosition
(
csPtr_->localPosition(oldPoints())
+ vector(0, rpm_*360.0*time().deltaT().value()/60.0, 0)
+ vector(0, rpm_*360.0*time().deltaTValue()/60.0, 0)
*movingPointsMask()
)
);

View File

@ -420,7 +420,7 @@ bool Foam::movingConeTopoFvMesh::update()
// )/
// (curLeft_ - leftEdge_)
// )
)*curMotionVel_*time().deltaT().value();
)*curMotionVel_*time().deltaTValue();
}
else
{
@ -442,11 +442,11 @@ bool Foam::movingConeTopoFvMesh::update()
// )/
// (curLeft_ - leftEdge_)
// )
)*curMotionVel_*time().deltaT().value();
)*curMotionVel_*time().deltaTValue();
}
// curLeft_ += curMotionVel_.x()*time().deltaT().value();
// curRight_ += curMotionVel_.x()*time().deltaT().value();
// curLeft_ += curMotionVel_.x()*time().deltaTValue();
// curRight_ += curMotionVel_.x()*time().deltaTValue();
curLeft_ = average
(
faceZones()