mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: cloud face post-processing: renamed mass-flux -> mass flow rate
This commit is contained in:
@ -31,32 +31,6 @@ License
|
|||||||
|
|
||||||
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
|
||||||
|
|
||||||
template<class CloudType>
|
|
||||||
void Foam::FacePostProcessing<CloudType>::applyToFace
|
|
||||||
(
|
|
||||||
const label faceIn,
|
|
||||||
label& zoneI,
|
|
||||||
label& faceI
|
|
||||||
) const
|
|
||||||
{
|
|
||||||
const faceZoneMesh& fzm = this->owner().mesh().faceZones();
|
|
||||||
|
|
||||||
forAll(faceZoneIDs_, i)
|
|
||||||
{
|
|
||||||
const faceZone& fz = fzm[faceZoneIDs_[i]];
|
|
||||||
forAll(fz, j)
|
|
||||||
{
|
|
||||||
if (fz[j] == faceIn)
|
|
||||||
{
|
|
||||||
zoneI = i;
|
|
||||||
faceI = j;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
template<class CloudType>
|
template<class CloudType>
|
||||||
void Foam::FacePostProcessing<CloudType>::makeLogFile
|
void Foam::FacePostProcessing<CloudType>::makeLogFile
|
||||||
(
|
(
|
||||||
@ -93,7 +67,7 @@ void Foam::FacePostProcessing<CloudType>::makeLogFile
|
|||||||
<< "# Face zone : " << zoneName << nl
|
<< "# Face zone : " << zoneName << nl
|
||||||
<< "# Faces : " << nFaces << nl
|
<< "# Faces : " << nFaces << nl
|
||||||
<< "# Area : " << totArea << nl
|
<< "# Area : " << totArea << nl
|
||||||
<< "# Time" << tab << "mass" << tab << "massFlux" << endl;
|
<< "# Time" << tab << "mass" << tab << "massFlowRate" << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -105,25 +79,27 @@ void Foam::FacePostProcessing<CloudType>::write()
|
|||||||
const fvMesh& mesh = this->owner().mesh();
|
const fvMesh& mesh = this->owner().mesh();
|
||||||
const Time& time = mesh.time();
|
const Time& time = mesh.time();
|
||||||
const faceZoneMesh& fzm = mesh.faceZones();
|
const faceZoneMesh& fzm = mesh.faceZones();
|
||||||
const scalar dt = time.deltaTValue();
|
scalar timeNew = time.value();
|
||||||
|
scalar timeElapsed = timeNew-timeOld_;
|
||||||
|
|
||||||
totalTime_ += dt;
|
totalTime_ += timeElapsed;
|
||||||
|
|
||||||
const scalar alpha = (totalTime_ - dt)/totalTime_;
|
const scalar alpha = (totalTime_ - timeElapsed)/totalTime_;
|
||||||
const scalar beta = dt/totalTime_;
|
const scalar beta = timeElapsed/totalTime_; //correct
|
||||||
|
|
||||||
forAll(faceZoneIDs_, zoneI)
|
forAll(faceZoneIDs_, zoneI)
|
||||||
{
|
{
|
||||||
|
massFlowRate_[zoneI] =
|
||||||
|
alpha*massFlowRate_[zoneI] + beta*mass_[zoneI]/timeElapsed;
|
||||||
massTotal_[zoneI] += mass_[zoneI];
|
massTotal_[zoneI] += mass_[zoneI];
|
||||||
massFlux_[zoneI] = alpha*massFlux_[zoneI] + beta*mass_[zoneI]/dt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const label procI = Pstream::myProcNo();
|
const label procI = Pstream::myProcNo();
|
||||||
|
|
||||||
Info<< "particleFaceFlux output:" << nl;
|
Info<< "particleFaceFlowRate output:" << nl;
|
||||||
|
|
||||||
List<scalarField> zoneMassTotal(mass_.size());
|
List<scalarField> zoneMassTotal(mass_.size());
|
||||||
List<scalarField> zoneMassFlux(massFlux_.size());
|
List<scalarField> zoneMassFlowRate(massFlowRate_.size());
|
||||||
forAll(faceZoneIDs_, zoneI)
|
forAll(faceZoneIDs_, zoneI)
|
||||||
{
|
{
|
||||||
const word& zoneName = fzm[faceZoneIDs_[zoneI]].name();
|
const word& zoneName = fzm[faceZoneIDs_[zoneI]].name();
|
||||||
@ -138,26 +114,26 @@ void Foam::FacePostProcessing<CloudType>::write()
|
|||||||
);
|
);
|
||||||
const scalar sumMassTotal = sum(zoneMassTotal[zoneI]);
|
const scalar sumMassTotal = sum(zoneMassTotal[zoneI]);
|
||||||
|
|
||||||
scalarListList allProcMassFlux(Pstream::nProcs());
|
scalarListList allProcMassFlowRate(Pstream::nProcs());
|
||||||
allProcMassFlux[procI] = massFlux_[zoneI];
|
allProcMassFlowRate[procI] = massFlowRate_[zoneI];
|
||||||
Pstream::gatherList(allProcMassFlux);
|
Pstream::gatherList(allProcMassFlowRate);
|
||||||
zoneMassFlux[zoneI] =
|
zoneMassFlowRate[zoneI] =
|
||||||
ListListOps::combine<scalarList>
|
ListListOps::combine<scalarList>
|
||||||
(
|
(
|
||||||
allProcMassFlux, accessOp<scalarList>()
|
allProcMassFlowRate, accessOp<scalarList>()
|
||||||
);
|
);
|
||||||
const scalar sumMassFlux = sum(zoneMassFlux[zoneI]);
|
const scalar sumMassFlowRate = sum(zoneMassFlowRate[zoneI]);
|
||||||
|
|
||||||
Info<< " " << zoneName
|
Info<< " " << zoneName
|
||||||
<< ": total mass = " << sumMassTotal
|
<< ": total mass = " << sumMassTotal
|
||||||
<< "; average mass flux = " << sumMassFlux
|
<< "; average mass flow rate = " << sumMassFlowRate
|
||||||
<< nl;
|
<< nl;
|
||||||
|
|
||||||
if (outputFilePtr_.set(zoneI))
|
if (outputFilePtr_.set(zoneI))
|
||||||
{
|
{
|
||||||
OFstream& os = outputFilePtr_[zoneI];
|
OFstream& os = outputFilePtr_[zoneI];
|
||||||
os << time.timeName() << token::TAB << sumMassTotal << token::TAB
|
os << time.timeName() << token::TAB << sumMassTotal << token::TAB
|
||||||
<< sumMassFlux<< endl;
|
<< sumMassFlowRate<< endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,8 +211,8 @@ void Foam::FacePostProcessing<CloudType>::write()
|
|||||||
fZone.name(),
|
fZone.name(),
|
||||||
allPoints,
|
allPoints,
|
||||||
allFaces,
|
allFaces,
|
||||||
"massFlux",
|
"massFlowRate",
|
||||||
zoneMassFlux[zoneI],
|
zoneMassFlowRate[zoneI],
|
||||||
false
|
false
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -248,8 +224,9 @@ void Foam::FacePostProcessing<CloudType>::write()
|
|||||||
{
|
{
|
||||||
forAll(faceZoneIDs_, zoneI)
|
forAll(faceZoneIDs_, zoneI)
|
||||||
{
|
{
|
||||||
massFlux_[zoneI] = 0.0;
|
massFlowRate_[zoneI] = 0.0;
|
||||||
}
|
}
|
||||||
|
timeOld_ = timeNew;
|
||||||
totalTime_ = 0.0;
|
totalTime_ = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,15 +255,16 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
|
|||||||
totalTime_(0.0),
|
totalTime_(0.0),
|
||||||
mass_(),
|
mass_(),
|
||||||
massTotal_(),
|
massTotal_(),
|
||||||
massFlux_(),
|
massFlowRate_(),
|
||||||
log_(this->coeffDict().lookup("log")),
|
log_(this->coeffDict().lookup("log")),
|
||||||
outputFilePtr_(),
|
outputFilePtr_(),
|
||||||
outputDir_(owner.mesh().time().path())
|
outputDir_(owner.mesh().time().path()),
|
||||||
|
timeOld_(owner.mesh().time().value())
|
||||||
{
|
{
|
||||||
wordList faceZoneNames(this->coeffDict().lookup("faceZones"));
|
wordList faceZoneNames(this->coeffDict().lookup("faceZones"));
|
||||||
mass_.setSize(faceZoneNames.size());
|
mass_.setSize(faceZoneNames.size());
|
||||||
massTotal_.setSize(faceZoneNames.size());
|
massTotal_.setSize(faceZoneNames.size());
|
||||||
massFlux_.setSize(faceZoneNames.size());
|
massFlowRate_.setSize(faceZoneNames.size());
|
||||||
|
|
||||||
outputFilePtr_.setSize(faceZoneNames.size());
|
outputFilePtr_.setSize(faceZoneNames.size());
|
||||||
|
|
||||||
@ -317,7 +295,7 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
|
|||||||
const faceZone& fz = fzm[zoneI];
|
const faceZone& fz = fzm[zoneI];
|
||||||
mass_[i].setSize(fz.size(), 0.0);
|
mass_[i].setSize(fz.size(), 0.0);
|
||||||
massTotal_[i].setSize(fz.size(), 0.0);
|
massTotal_[i].setSize(fz.size(), 0.0);
|
||||||
massFlux_[i].setSize(fz.size(), 0.0);
|
massFlowRate_[i].setSize(fz.size(), 0.0);
|
||||||
|
|
||||||
label nFaces = returnReduce(fz.size(), sumOp<label>());
|
label nFaces = returnReduce(fz.size(), sumOp<label>());
|
||||||
Info<< " " << zoneName << " faces: " << nFaces << nl;
|
Info<< " " << zoneName << " faces: " << nFaces << nl;
|
||||||
@ -372,10 +350,11 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
|
|||||||
totalTime_(pff.totalTime_),
|
totalTime_(pff.totalTime_),
|
||||||
mass_(pff.mass_),
|
mass_(pff.mass_),
|
||||||
massTotal_(pff.massTotal_),
|
massTotal_(pff.massTotal_),
|
||||||
massFlux_(pff.massFlux_),
|
massFlowRate_(pff.massFlowRate_),
|
||||||
log_(pff.log_),
|
log_(pff.log_),
|
||||||
outputFilePtr_(),
|
outputFilePtr_(),
|
||||||
outputDir_(pff.outputDir_)
|
outputDir_(pff.outputDir_),
|
||||||
|
timeOld_(0.0)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
|
||||||
@ -401,13 +380,26 @@ void Foam::FacePostProcessing<CloudType>::postFace
|
|||||||
|| this->owner().solution().transient()
|
|| this->owner().solution().transient()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
label zoneId = -1;
|
const faceZoneMesh& fzm = this->owner().mesh().faceZones();
|
||||||
label faceId = -1;
|
|
||||||
applyToFace(faceI, zoneId, faceId);
|
|
||||||
|
|
||||||
if ((zoneId != -1) && (faceId != -1))
|
forAll(faceZoneIDs_, i)
|
||||||
{
|
{
|
||||||
mass_[zoneId][faceId] += p.mass()*p.nParticle();
|
const faceZone& fz = fzm[faceZoneIDs_[i]];
|
||||||
|
|
||||||
|
label faceId = -1;
|
||||||
|
forAll(fz, j)
|
||||||
|
{
|
||||||
|
if (fz[j] == faceI)
|
||||||
|
{
|
||||||
|
faceId = j;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (faceId != -1)
|
||||||
|
{
|
||||||
|
mass_[i][faceId] += p.mass()*p.nParticle();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -82,8 +82,8 @@ class FacePostProcessing
|
|||||||
//- Mass total storage
|
//- Mass total storage
|
||||||
List<scalarField> massTotal_;
|
List<scalarField> massTotal_;
|
||||||
|
|
||||||
//- Mass flux storage
|
//- Mass flow rate storage
|
||||||
List<scalarField> massFlux_;
|
List<scalarField> massFlowRate_;
|
||||||
|
|
||||||
//- Flag to indicate whether data should be written to file
|
//- Flag to indicate whether data should be written to file
|
||||||
Switch log_;
|
Switch log_;
|
||||||
@ -94,6 +94,9 @@ class FacePostProcessing
|
|||||||
//- Output directory
|
//- Output directory
|
||||||
fileName outputDir_;
|
fileName outputDir_;
|
||||||
|
|
||||||
|
//- Last calculation time
|
||||||
|
scalar timeOld_;
|
||||||
|
|
||||||
|
|
||||||
// Private Member Functions
|
// Private Member Functions
|
||||||
|
|
||||||
@ -106,14 +109,6 @@ class FacePostProcessing
|
|||||||
const scalar totArea
|
const scalar totArea
|
||||||
);
|
);
|
||||||
|
|
||||||
//- Return index into storage lists if valid zone and face
|
|
||||||
void applyToFace
|
|
||||||
(
|
|
||||||
const label faceIn,
|
|
||||||
label& zoneI, label&
|
|
||||||
faceI
|
|
||||||
) const;
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user