Merge branch 'feature-clouds-log-output' into 'develop'

ENH: added option to control log frequency of lagrangian calculations

See merge request Development/openfoam!583
This commit is contained in:
Mark OLESEN
2022-12-09 10:05:40 +00:00
58 changed files with 252 additions and 218 deletions

View File

@ -365,6 +365,10 @@ extern messageStream SeriousError;
#define Log \
if (log) Info
//- Report write to Foam::Info if the class log switch is true
#define Log_ \
if (this->log) Info
//- Report an IO information message using Foam::Info
// for functionName in file __FILE__ at line __LINE__

View File

@ -45,7 +45,8 @@ Foam::subModelBase::subModelBase(dictionary& properties)
dict_(),
baseName_(),
modelType_(),
coeffDict_()
coeffDict_(),
log(properties.getOrDefault<bool>("log", true))
{}
@ -63,7 +64,8 @@ Foam::subModelBase::subModelBase
dict_(dict),
baseName_(baseName),
modelType_(modelType),
coeffDict_(dict.subDict(modelType + dictExt))
coeffDict_(dict.subDict(modelType + dictExt)),
log(coeffDict_.getOrDefault<bool>("log", true))
{}
@ -81,7 +83,8 @@ Foam::subModelBase::subModelBase
dict_(dict),
baseName_(baseName),
modelType_(modelType),
coeffDict_(dict)
coeffDict_(dict),
log(coeffDict_.getOrDefault<bool>("log", true))
{}
@ -92,13 +95,8 @@ Foam::subModelBase::subModelBase(const subModelBase& smb)
dict_(smb.dict_),
baseName_(smb.baseName_),
modelType_(smb.modelType_),
coeffDict_(smb.coeffDict_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
Foam::subModelBase::~subModelBase()
coeffDict_(smb.coeffDict_),
log(coeffDict_.getOrDefault<bool>("log", true))
{}
@ -145,6 +143,7 @@ bool Foam::subModelBase::defaultCoeffs(const bool printMsg) const
bool def = coeffDict_.getOrDefault("defaultCoeffs", false);
if (printMsg && def)
{
// Note: not using Log<< for output
Info<< incrIndent;
Info<< indent << "Employing default coefficients" << endl;
Info<< decrIndent;

View File

@ -91,6 +91,12 @@ protected:
public:
// Public Data
//- Flag to write log into Info
bool log;
// Constructors
//- Construct null
@ -121,7 +127,7 @@ public:
//- Destructor
virtual ~subModelBase();
virtual ~subModelBase() = default;
// Member Functions

View File

@ -208,7 +208,7 @@ void Foam::CollidingCloud<CloudType>::motion
if (nSubCycles > 1)
{
Info<< " " << nSubCycles << " move-collide subCycles" << endl;
Log_<< " " << nSubCycles << " move-collide subCycles" << endl;
subCycleTime moveCollideSubCycle
(
@ -238,7 +238,7 @@ void Foam::CollidingCloud<CloudType>::info()
scalar rotationalKineticEnergy = rotationalKineticEnergyOfSystem();
reduce(rotationalKineticEnergy, sumOp<scalar>());
Info<< " Rotational kinetic energy = "
Log_<< " Rotational kinetic energy = "
<< rotationalKineticEnergy << nl;
}

View File

@ -133,6 +133,8 @@ void Foam::KinematicCloud<CloudType>::solve
{
addProfiling(prof, "cloud::solve");
log = solution_.log();
if (solution_.steadyState())
{
cloud.storeState();
@ -267,7 +269,7 @@ void Foam::KinematicCloud<CloudType>::postEvolve
const typename parcelType::trackingData& td
)
{
Info<< endl;
Log_<< endl;
if (debug)
{
@ -457,7 +459,8 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
mesh_,
dimensionedScalar(dimMass, Zero)
)
)
),
log(true)
{
if (solution_.active())
{
@ -545,7 +548,8 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
),
c.UCoeff_()
)
)
),
log(c.log)
{}
@ -611,7 +615,8 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
UIntegrator_(nullptr),
UTrans_(nullptr),
UCoeff_(nullptr)
UCoeff_(nullptr),
log(c.log)
{}
@ -743,7 +748,7 @@ void Foam::KinematicCloud<CloudType>::preEvolve
// with topology change due to lazy evaluation of valid mesh dimensions
label nGeometricD = mesh_.nGeometricD();
Info<< "\nSolving" << nGeometricD << "-D cloud " << this->name() << endl;
Log_<< "\nSolving" << nGeometricD << "-D cloud " << this->name() << endl;
this->dispersion().cacheFields(true);
forces_.cacheFields(true);
@ -881,7 +886,7 @@ void Foam::KinematicCloud<CloudType>::info()
: 0
);
Info<< "Cloud: " << this->name() << nl
Log_<< "Cloud: " << this->name() << nl
<< " Current number of parcels = " << nTotParcel << nl
<< " Current mass in system = "
<< returnReduce(massInSystem(), sumOp<scalar>()) << nl
@ -890,9 +895,10 @@ void Foam::KinematicCloud<CloudType>::info()
<< " Linear kinetic energy = " << linearKineticEnergy << nl
<< " Average particle per parcel = " << particlePerParcel << nl;
injectors_.info(Info);
this->surfaceFilm().info(Info);
this->patchInteraction().info(Info);
injectors_.info();
this->surfaceFilm().info();
this->patchInteraction().info();
if (this->packingModel().active())
{
@ -906,8 +912,8 @@ void Foam::KinematicCloud<CloudType>::info()
const scalar alphaMin = gMin(alpha().primitiveField());
const scalar alphaMax = gMax(alpha().primitiveField());
Info<< " Min cell volume fraction = " << alphaMin << endl;
Info<< " Max cell volume fraction = " << alphaMax << endl;
Log_<< " Min cell volume fraction = " << alphaMin << nl
<< " Max cell volume fraction = " << alphaMax << endl;
if (alphaMax < SMALL)
{
@ -933,7 +939,7 @@ void Foam::KinematicCloud<CloudType>::info()
reduce(nMin, minOp<scalar>());
Info<< " Min dense number of parcels = " << nMin << endl;
Log_<< " Min dense number of parcels = " << nMin << endl;
}
}

View File

@ -302,6 +302,12 @@ protected:
public:
// Public Data
//- Flag to write log into Info
bool log;
// Constructors
//- Construct given carrier gas fields

View File

@ -39,6 +39,7 @@ Foam::cloudSolution::cloudSolution(const fvMesh& mesh, const dictionary& dict)
active_(dict.lookup("active")),
transient_(false),
calcFrequency_(1),
logFrequency_(1),
maxCo_(0.3),
iter_(1),
trackTime_(0.0),
@ -82,6 +83,7 @@ Foam::cloudSolution::cloudSolution(const cloudSolution& cs)
active_(cs.active_),
transient_(cs.transient_),
calcFrequency_(cs.calcFrequency_),
logFrequency_(cs.logFrequency_),
maxCo_(cs.maxCo_),
iter_(cs.iter_),
trackTime_(cs.trackTime_),
@ -101,6 +103,7 @@ Foam::cloudSolution::cloudSolution(const fvMesh& mesh)
active_(false),
transient_(false),
calcFrequency_(0),
logFrequency_(0),
maxCo_(GREAT),
iter_(0),
trackTime_(0.0),
@ -153,6 +156,8 @@ void Foam::cloudSolution::read()
dict_.readIfPresent("maxCo", maxCo_);
dict_.readIfPresent("deltaTMax", deltaTMax_);
dict_.readIfPresent("logFrequency", logFrequency_);
if (steadyState())
{
dict_.readEntry("calcFrequency", calcFrequency_);
@ -264,6 +269,15 @@ bool Foam::cloudSolution::canEvolve()
}
bool Foam::cloudSolution::log() const
{
return
active_
&& (logFrequency_ > 0)
&& (mesh_.time().timeIndex() % logFrequency_ == 0);
}
bool Foam::cloudSolution::output() const
{
return active_ && mesh_.time().writeTime();

View File

@ -71,6 +71,10 @@ class cloudSolution
// NOTE: Steady operation only
label calcFrequency_;
//- Output log frequency - carrier steps per cloud step
// Default = 1
label logFrequency_;
//- Maximum particle Courant number
// Max fraction of current cell that can be traversed in a single
// step
@ -210,9 +214,12 @@ public:
bool solveThisStep() const;
//- Returns true if possible to evolve the cloud and sets timestep
// parameters
//- parameters
bool canEvolve();
//- Returns true if possible to log this step
bool log() const;
//- Returns true if writing this step
bool output() const;

View File

@ -286,8 +286,8 @@ void Foam::MPPICCloud<CloudType>::info()
const scalar alphaMin = gMin(alpha().primitiveField());
const scalar alphaMax = gMax(alpha().primitiveField());
Info<< " Min cell volume fraction = " << alphaMin << endl;
Info<< " Max cell volume fraction = " << alphaMax << endl;
Log_ << " Min cell volume fraction = " << alphaMin << nl
<< " Max cell volume fraction = " << alphaMax << endl;
if (alphaMax < SMALL)
{
@ -313,7 +313,7 @@ void Foam::MPPICCloud<CloudType>::info()
reduce(nMin, minOp<scalar>());
Info<< " Min dense number of parcels = " << nMin << endl;
Log_<< " Min dense number of parcels = " << nMin << endl;
}

View File

@ -336,7 +336,7 @@ void Foam::ReactingCloud<CloudType>::info()
{
CloudType::info();
this->phaseChange().info(Info);
this->phaseChange().info();
}

View File

@ -247,7 +247,8 @@ template<class CloudType>
void Foam::ReactingHeterogeneousCloud<CloudType>::info()
{
CloudType::info();
heterogeneousReactionModel_->info(Info);
heterogeneousReactionModel_->info();
}

View File

@ -287,8 +287,8 @@ void Foam::ReactingMultiphaseCloud<CloudType>::info()
{
CloudType::info();
this->devolatilisation().info(Info);
this->surfaceReaction().info(Info);
this->devolatilisation().info();
this->surfaceReaction().info();
}

View File

@ -484,7 +484,7 @@ void Foam::ThermoCloud<CloudType>::info()
{
CloudType::info();
Info<< " Temperature min/max = " << Tmin() << ", " << Tmax()
Log_<< " Temperature min/max = " << Tmin() << ", " << Tmax()
<< endl;
}

View File

@ -226,13 +226,11 @@ template<class CloudType>
inline Foam::tmp<Foam::fvScalarMatrix>
Foam::ThermoCloud<CloudType>::Sh(volScalarField& hs) const
{
if (debug)
{
Info<< "hsTrans min/max = " << min(hsTrans()).value() << ", "
<< max(hsTrans()).value() << nl
<< "hsCoeff min/max = " << min(hsCoeff()).value() << ", "
<< max(hsCoeff()).value() << endl;
}
DebugInfo
<< "hsTrans min/max = " << min(hsTrans()).value() << ", "
<< max(hsTrans()).value() << nl
<< "hsCoeff min/max = " << min(hsCoeff()).value() << ", "
<< max(hsCoeff()).value() << endl;
if (this->solution().coupled())
{

View File

@ -70,7 +70,7 @@ void Foam::FaceInteraction<CloudType>::write()
const fvMesh& mesh = this->owner().mesh();
const faceZoneMesh& fzm = mesh.faceZones();
Info<< type() << " output:" << nl;
Log_<< type() << " output:" << nl;
// Retrieve any stored data
const label nZones = faceZoneIDs_.size();
@ -98,7 +98,7 @@ void Foam::FaceInteraction<CloudType>::write()
forAll(faceZoneIDs_, i)
{
const label zonei = faceZoneIDs_[i];
Info<< " Zone : " << fzm[zonei].name() << nl
Log_<< " Zone : " << fzm[zonei].name() << nl
<< " Escape : " << npe[i] << nl
<< " Stick : " << nps[i] << nl
<< " Rebound : " << npr[i] << nl;
@ -116,7 +116,7 @@ void Foam::FaceInteraction<CloudType>::write()
<< endl;
}
}
Info<< endl;
Log_<< endl;
// Set restart data
this->setModelProperty("nEscape", npe);

View File

@ -44,12 +44,9 @@ void Foam::FacePostProcessing<CloudType>::makeLogFile
)
{
// Create the output file if not already created
if (log_)
if (logToFile_)
{
if (debug)
{
Info<< "Creating output file." << endl;
}
DebugInfo << "Creating output file." << endl;
if (Pstream::master())
{
@ -102,7 +99,7 @@ void Foam::FacePostProcessing<CloudType>::write()
const label proci = Pstream::myProcNo();
Info<< type() << " output:" << nl;
Log_<< type() << " output:" << nl;
List<scalarField> zoneMassTotal(mass_.size());
List<scalarField> zoneMassFlowRate(massFlowRate_.size());
@ -130,7 +127,7 @@ void Foam::FacePostProcessing<CloudType>::write()
);
const scalar sumMassFlowRate = sum(zoneMassFlowRate[zoneI]);
Info<< " " << zoneName
Log_<< " " << zoneName
<< ": total mass = " << sumMassTotal
<< "; average mass flow rate = " << sumMassFlowRate
<< nl;
@ -143,7 +140,7 @@ void Foam::FacePostProcessing<CloudType>::write()
}
}
Info<< endl;
Log_<< endl;
if (surfaceFormat_ != "none")
@ -259,7 +256,7 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
faceZoneIDs_(),
surfaceFormat_(this->coeffDict().getWord("surfaceFormat")),
resetOnWrite_(this->coeffDict().getBool("resetOnWrite")),
log_(this->coeffDict().getBool("log")),
logToFile_(this->coeffDict().getBool("log")),
totalTime_(0.0),
mass_(),
massTotal_(),
@ -340,7 +337,7 @@ Foam::FacePostProcessing<CloudType>::FacePostProcessing
faceZoneIDs_(pff.faceZoneIDs_),
surfaceFormat_(pff.surfaceFormat_),
resetOnWrite_(pff.resetOnWrite_),
log_(pff.log_),
logToFile_(pff.logToFile_),
totalTime_(pff.totalTime_),
mass_(pff.mass_),
massTotal_(pff.massTotal_),

View File

@ -78,7 +78,7 @@ class FacePostProcessing
bool resetOnWrite_;
//- Flag to indicate whether data should be written to file
bool log_;
bool logToFile_;
//- Total time
scalar totalTime_;

View File

@ -45,12 +45,9 @@ void Foam::ParticleCollector<CloudType>::makeLogFile
)
{
// Create the output file if not already created
if (log_)
if (logToFile_)
{
if (debug)
{
Info<< "Creating output file" << endl;
}
DebugInfo<< "Creating output file" << endl;
if (Pstream::master())
{
@ -419,7 +416,7 @@ void Foam::ParticleCollector<CloudType>::write()
massTotal_[facei] += mass_[facei];
}
Info<< type() << " output:" << nl;
Log_<< type() << " output:" << nl;
Field<scalar> faceMassTotal(mass_.size(), Zero);
this->getModelProperty("massTotal", faceMassTotal);
@ -452,7 +449,7 @@ void Foam::ParticleCollector<CloudType>::write()
}
}
Info<< " sum(total mass) = " << sumTotalMass << nl
Log_<< " sum(total mass) = " << sumTotalMass << nl
<< " sum(average mass flow rate) = " << sumAverageMFR << nl
<< endl;
@ -523,7 +520,7 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
parcelType_(this->coeffDict().getOrDefault("parcelType", -1)),
removeCollected_(this->coeffDict().getBool("removeCollected")),
resetOnWrite_(this->coeffDict().getBool("resetOnWrite")),
log_(this->coeffDict().getBool("log")),
logToFile_(this->coeffDict().getBool("log")),
points_(),
faces_(),
faceTris_(),
@ -608,7 +605,7 @@ Foam::ParticleCollector<CloudType>::ParticleCollector
parcelType_(pc.parcelType_),
removeCollected_(pc.removeCollected_),
resetOnWrite_(pc.resetOnWrite_),
log_(pc.log_),
logToFile_(pc.logToFile_),
points_(pc.points_),
faces_(pc.faces_),
faceTris_(pc.faceTris_),

View File

@ -144,7 +144,7 @@ private:
bool resetOnWrite_;
//- Flag to indicate whether data should be written to file
bool log_;
bool logToFile_;
//- List of points
Field<point> points_;

View File

@ -287,7 +287,7 @@ void Foam::ParticleZoneInfo<CloudType>::postEvolve
const typename parcelType::trackingData& td
)
{
Info<< this->type() << ":" << nl
Log_<< this->type() << ":" << nl
<< " Cell zone = " << cellZoneName_ << nl
<< " Contributions = "
<< returnReduce(movedParticles_.size(), sumOp<label>())
@ -295,7 +295,7 @@ void Foam::ParticleZoneInfo<CloudType>::postEvolve
if (!this->writeTime())
{
Info<< endl;
Log_<< endl;
}
for (const auto& p : movedParticles_)
@ -412,7 +412,7 @@ void Foam::ParticleZoneInfo<CloudType>::write()
}
}
Info<< " Number of particles = " << nData << nl
Log_<< " Number of particles = " << nData << nl
<< " Written data to " << os.name() << endl;
this->setModelProperty("data", globalParticles);
@ -437,14 +437,14 @@ void Foam::ParticleZoneInfo<CloudType>::write()
os << p << nl;
}
Info<< " Number of particles = " << data_.size() << nl
Log_<< " Number of particles = " << data_.size() << nl
<< " Written data to " << os.name() << endl;
this->setModelProperty("data", data_);
this->setModelProperty("maxIDs", maxIDs_);
}
Info<< endl;
Log_<< endl;
}

View File

@ -43,7 +43,7 @@ void Foam::RemoveParcels<CloudType>::makeLogFile
)
{
// Create the output file if not already created
if (log_)
if (logToFile_)
{
DebugInfo<< "Creating output file." << endl;
@ -81,7 +81,7 @@ void Foam::RemoveParcels<CloudType>::postEvolve
const typename parcelType::trackingData& td
)
{
Info<< this->modelName() << " output:" << nl;
Log_<< this->modelName() << " output:" << nl;
const fvMesh& mesh = this->owner().mesh();
const faceZoneMesh& fzm = mesh.faceZones();
@ -93,7 +93,7 @@ void Foam::RemoveParcels<CloudType>::postEvolve
scalar zoneMass = returnReduce(mass_[i], sumOp<scalar>());
label zoneNParcels = returnReduce(nParcels_[i], sumOp<label>());
Info<< " faceZone " << zoneName
Log_<< " faceZone " << zoneName
<< ": removed " << zoneNParcels
<< " parcels with mass " << zoneMass
<< nl;
@ -127,7 +127,7 @@ void Foam::RemoveParcels<CloudType>::write()
}
}
Info<< endl;
Log_<< endl;
if (resetOnWrite_)
{
@ -158,7 +158,7 @@ Foam::RemoveParcels<CloudType>::RemoveParcels
nParcels_(),
mass_(),
typeId_(this->coeffDict().template getOrDefault<label>("parcelType", -1)),
log_(this->coeffDict().getBool("log")),
logToFile_(this->coeffDict().getBool("log")),
resetOnWrite_(this->coeffDict().getBool("resetOnWrite")),
resetOnStart_(this->coeffDict().getBool("resetOnStart")),
outputFilePtr_()
@ -239,7 +239,7 @@ Foam::RemoveParcels<CloudType>::RemoveParcels
nParcels_(rpf.nParcels_),
mass_(rpf.mass_),
typeId_(rpf.typeId_),
log_(rpf.log_),
logToFile_(rpf.logToFile_),
resetOnWrite_(rpf.resetOnWrite_),
resetOnStart_(rpf.resetOnStart_),
outputFilePtr_()

View File

@ -89,7 +89,7 @@ class RemoveParcels
label typeId_;
//- Flag to indicate whether data should be written to file
bool log_;
bool logToFile_;
//- Flag to reset counters on write
bool resetOnWrite_;

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -35,7 +36,9 @@ Foam::CloudSubModelBase<CloudType>::CloudSubModelBase(CloudType& owner)
:
subModelBase(owner.outputProperties()),
owner_(owner)
{}
{
this->log = owner_.solution().log();
}
template<class CloudType>
@ -57,7 +60,9 @@ Foam::CloudSubModelBase<CloudType>::CloudSubModelBase
dictExt
),
owner_(owner)
{}
{
this->log = owner_.solution().log();
}
template<class CloudType>
@ -79,7 +84,9 @@ Foam::CloudSubModelBase<CloudType>::CloudSubModelBase
modelType
),
owner_(owner)
{}
{
this->log = owner_.solution().log();
}
template<class CloudType>
@ -90,14 +97,9 @@ Foam::CloudSubModelBase<CloudType>::CloudSubModelBase
:
subModelBase(smb),
owner_(smb.owner_)
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::CloudSubModelBase<CloudType>::~CloudSubModelBase()
{}
{
this->log = owner_.solution().log();
}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
@ -138,6 +140,13 @@ Foam::fileName Foam::CloudSubModelBase<CloudType>::localPath() const
}
template<class CloudType>
void Foam::CloudSubModelBase<CloudType>::info()
{
this->log = owner_.solution().log();
}
template<class CloudType>
void Foam::CloudSubModelBase<CloudType>::write(Ostream& os) const
{

View File

@ -93,7 +93,7 @@ public:
//- Destructor
virtual ~CloudSubModelBase();
virtual ~CloudSubModelBase() = default;
//- Type of cloud this model was instantiated for
typedef CloudType cloudType;
@ -121,7 +121,10 @@ public:
// I-O
//- Write
//- Write to info
virtual void info();
//- Write to os
virtual void write(Ostream& os) const;
};

View File

@ -87,12 +87,14 @@ Foam::label Foam::HeterogeneousReactingModel<CloudType>::nF() const
template<class CloudType>
void Foam::HeterogeneousReactingModel<CloudType>::info(Ostream& os)
void Foam::HeterogeneousReactingModel<CloudType>::info()
{
CloudSubModelBase<CloudType>::info();
const scalar mass0 = this->template getBaseProperty<scalar>("mass");
const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
Info<< " Mass transfer surface reaction = " << massTotal << nl;
Log_<< " Mass transfer surface reaction = " << massTotal << nl;
if (this->writeTime())
{

View File

@ -164,8 +164,8 @@ public:
//- Number of progress variable
virtual label nF() const;
//- Write injection info to stream
virtual void info(Ostream& os);
//- Write injection info
virtual void info();
};

View File

@ -501,9 +501,9 @@ bool Foam::InjectedParticleDistributionInjection<CloudType>::validInjection
template<class CloudType>
void Foam::InjectedParticleDistributionInjection<CloudType>::info(Ostream& os)
void Foam::InjectedParticleDistributionInjection<CloudType>::info()
{
InjectionModel<CloudType>::info(os);
InjectionModel<CloudType>::info();
if (this->writeTime())
{

View File

@ -243,8 +243,8 @@ public:
// I-O
//- Write injection info to stream
void info(Ostream& os);
//- Write injection info
void info();
};

View File

@ -364,9 +364,9 @@ bool Foam::InjectedParticleInjection<CloudType>::validInjection
template<class CloudType>
void Foam::InjectedParticleInjection<CloudType>::info(Ostream& os)
void Foam::InjectedParticleInjection<CloudType>::info()
{
InjectionModel<CloudType>::info(os);
InjectionModel<CloudType>::info();
if (this->writeTime())
{

View File

@ -208,8 +208,8 @@ public:
// I-O
//- Write injection info to stream
void info(Ostream& os);
//- Write injection info
void info();
};

View File

@ -237,7 +237,7 @@ void Foam::InjectionModel<CloudType>::postInjectCheck
if (allParcelsAdded > 0)
{
Info<< nl
Log_<< nl
<< "Cloud: " << this->owner().name()
<< " injector: " << this->modelName() << nl
<< " Added " << allParcelsAdded << " new parcels" << nl << endl;
@ -666,9 +666,11 @@ void Foam::InjectionModel<CloudType>::injectSteadyState
template<class CloudType>
void Foam::InjectionModel<CloudType>::info(Ostream& os)
void Foam::InjectionModel<CloudType>::info()
{
os << " Injector " << this->modelName() << ":" << nl
CloudSubModelBase<CloudType>::info();
Log_<< " Injector " << this->modelName() << ":" << nl
<< " - parcels added = " << parcelsAddedTotal_ << nl
<< " - mass introduced = " << massInjected_ << nl;

View File

@ -367,8 +367,8 @@ public:
// I-O
//- Write injection info to stream
virtual void info(Ostream& os);
//- Write injection info
virtual void info();
};

View File

@ -6,6 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2012-2017 OpenFOAM Foundation
Copyright (C) 2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -105,22 +106,15 @@ Foam::InjectionModelList<CloudType>::InjectionModelList
{}
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class CloudType>
Foam::InjectionModelList<CloudType>::~InjectionModelList()
{}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class CloudType>
Foam::scalar Foam::InjectionModelList<CloudType>::timeStart() const
{
scalar minTime = GREAT;
forAll(*this, i)
for (const auto& model : *this)
{
minTime = min(minTime, this->operator[](i).timeStart());
minTime = min(minTime, model.timeStart());
}
return minTime;
@ -131,9 +125,9 @@ template<class CloudType>
Foam::scalar Foam::InjectionModelList<CloudType>::timeEnd() const
{
scalar maxTime = -GREAT;
forAll(*this, i)
for (const auto& model : *this)
{
maxTime = max(maxTime, this->operator[](i).timeEnd());
maxTime = max(maxTime, model.timeEnd());
}
return maxTime;
@ -148,9 +142,9 @@ Foam::scalar Foam::InjectionModelList<CloudType>::volumeToInject
)
{
scalar vol = 0.0;
forAll(*this, i)
for (auto& model : *this)
{
vol += this->operator[](i).volumeToInject(time0, time1);
vol += model.volumeToInject(time0, time1);
}
return vol;
@ -162,10 +156,10 @@ Foam::scalar Foam::InjectionModelList<CloudType>::averageParcelMass()
{
scalar mass = 0.0;
scalar massTotal = 0.0;
forAll(*this, i)
for (auto& model : *this)
{
scalar mt = this->operator[](i).massTotal();
mass += mt*this->operator[](i).averageParcelMass();
scalar mt = model.massTotal();
mass += mt*model.averageParcelMass();
massTotal += mt;
}
@ -176,9 +170,9 @@ Foam::scalar Foam::InjectionModelList<CloudType>::averageParcelMass()
template<class CloudType>
void Foam::InjectionModelList<CloudType>::updateMesh()
{
forAll(*this, i)
for (auto& model : *this)
{
this->operator[](i).updateMesh();
model.updateMesh();
}
}
@ -191,9 +185,9 @@ void Foam::InjectionModelList<CloudType>::inject
typename CloudType::parcelType::trackingData& td
)
{
forAll(*this, i)
for (auto& model : *this)
{
this->operator[](i).inject(cloud, td);
model.inject(cloud, td);
}
}
@ -207,19 +201,19 @@ void Foam::InjectionModelList<CloudType>::injectSteadyState
const scalar trackTime
)
{
forAll(*this, i)
for (auto& model : *this)
{
this->operator[](i).injectSteadyState(cloud, td, trackTime);
model.injectSteadyState(cloud, td, trackTime);
}
}
template<class CloudType>
void Foam::InjectionModelList<CloudType>::info(Ostream& os)
void Foam::InjectionModelList<CloudType>::info()
{
forAll(*this, i)
for (auto& model : *this)
{
this->operator[](i).info(os);
model.info();
}
}

View File

@ -78,7 +78,7 @@ public:
//- Destructor
virtual ~InjectionModelList();
virtual ~InjectionModelList() = default;
@ -127,8 +127,8 @@ public:
// I-O
//- Write injection info to stream
virtual void info(Ostream& os);
//- Write injection info
virtual void info();
};

View File

@ -341,9 +341,9 @@ bool Foam::LocalInteraction<CloudType>::correct
template<class CloudType>
void Foam::LocalInteraction<CloudType>::info(Ostream& os)
void Foam::LocalInteraction<CloudType>::info()
{
PatchInteractionModel<CloudType>::info(os);
PatchInteractionModel<CloudType>::info();
// retrieve any stored data
labelListList npe0(patchData_.size());
@ -411,7 +411,7 @@ void Foam::LocalInteraction<CloudType>::info(Ostream& os)
{
const word& patchName = patchData_[patchi].patchName();
os << " Parcel fate: patch " << patchName
Log_<< " Parcel fate: patch " << patchName
<< " (number, mass)" << nl
<< " - escape (injector " << indexToInjector[indexi]
<< " ) = " << npe[patchi][indexi]
@ -428,7 +428,7 @@ void Foam::LocalInteraction<CloudType>::info(Ostream& os)
{
const word& patchName = patchData_[patchi].patchName();
os << " Parcel fate: patch " << patchName
Log_<< " Parcel fate: patch " << patchName
<< " (number, mass)" << nl
<< " - escape = "
<< npe[patchi][0] << ", " << mpe[patchi][0] << nl

View File

@ -145,8 +145,8 @@ public:
);
//- Write patch interaction info to stream
virtual void info(Ostream& os);
//- Write patch interaction info
virtual void info();
};

View File

@ -187,12 +187,14 @@ void Foam::MultiInteraction<CloudType>::postEvolve()
template<class CloudType>
void Foam::MultiInteraction<CloudType>::info(Ostream& os)
void Foam::MultiInteraction<CloudType>::info()
{
PatchInteractionModel<CloudType>::info();
for (auto& m : models_)
{
Info<< "Patch interaction model " << m.type() << ':' << endl;
m.info(os);
Log_<< "Patch interaction model " << m.type() << ':' << endl;
m.info();
}
}

View File

@ -152,8 +152,8 @@ public:
//- Post-evolve hook
virtual void postEvolve();
//- Write patch interaction info to stream
virtual void info(Ostream& os);
//- Write patch interaction
virtual void info();
};

View File

@ -214,8 +214,10 @@ void Foam::PatchInteractionModel<CloudType>::postEvolve()
template<class CloudType>
void Foam::PatchInteractionModel<CloudType>::info(Ostream& os)
void Foam::PatchInteractionModel<CloudType>::info()
{
CloudSubModelBase<CloudType>::info();
const label escapedParcels0 =
this->template getBaseProperty<label>("escapedParcels");
const label escapedParcelsTotal =
@ -226,7 +228,7 @@ void Foam::PatchInteractionModel<CloudType>::info(Ostream& os)
const scalar escapedMassTotal =
escapedMass0 + returnReduce(escapedMass_, sumOp<scalar>());
os << " Parcel fate: system (number, mass)" << nl
Log_<< " Parcel fate: system (number, mass)" << nl
<< " - escape = " << escapedParcelsTotal
<< ", " << escapedMassTotal << endl;

View File

@ -191,8 +191,8 @@ public:
//- Post-evolve hook
virtual void postEvolve();
//- Write patch interaction info to stream
virtual void info(Ostream& os);
//- Write patch interaction info
virtual void info();
};

View File

@ -349,9 +349,9 @@ void Foam::RecycleInteraction<CloudType>::postEvolve()
template<class CloudType>
void Foam::RecycleInteraction<CloudType>::info(Ostream& os)
void Foam::RecycleInteraction<CloudType>::info()
{
PatchInteractionModel<CloudType>::info(os);
PatchInteractionModel<CloudType>::info();
labelListList npr0(nRemoved_.size());
scalarListList mpr0(massRemoved_.size());
@ -416,12 +416,12 @@ void Foam::RecycleInteraction<CloudType>::info(Ostream& os)
{
const word& outPatchName = recyclePatches_[i].first();
os << " Parcel fate: patch " << outPatchName
Log_<< " Parcel fate: patch " << outPatchName
<< " (number, mass)" << nl;
forAll(mpr[i], indexi)
{
os << " - removed (injector " << indexToInjector[indexi]
Log_<< " - removed (injector " << indexToInjector[indexi]
<< ") = " << npr[i][indexi]
<< ", " << mpr[i][indexi] << nl;
@ -431,12 +431,12 @@ void Foam::RecycleInteraction<CloudType>::info(Ostream& os)
const word& inPatchName = recyclePatches_[i].second();
os << " Parcel fate: patch " << inPatchName
Log_<< " Parcel fate: patch " << inPatchName
<< " (number, mass)" << nl;
forAll(mpi[i], indexi)
{
os << " - injected (injector " << indexToInjector[indexi]
Log_<< " - injected (injector " << indexToInjector[indexi]
<< ") = " << npi[i][indexi]
<< ", " << mpi[i][indexi] << nl;
this->file()
@ -452,7 +452,7 @@ void Foam::RecycleInteraction<CloudType>::info(Ostream& os)
{
const word& outPatchName = recyclePatches_[i].first();
os << " Parcel fate: patch " << outPatchName
Log_<< " Parcel fate: patch " << outPatchName
<< " (number, mass)" << nl
<< " - removed = " << npr[i][0] << ", " << mpr[i][0]
<< nl;
@ -465,7 +465,7 @@ void Foam::RecycleInteraction<CloudType>::info(Ostream& os)
{
const word& inPatchName = recyclePatches_[i].second();
os << " Parcel fate: patch " << inPatchName
Log_<< " Parcel fate: patch " << inPatchName
<< " (number, mass)" << nl
<< " - injected = " << npi[i][0] << ", " << mpi[i][0]
<< nl;

View File

@ -204,8 +204,8 @@ public:
//- Post-evolve hook
virtual void postEvolve();
//- Write patch interaction info to stream
virtual void info(Ostream& os);
//- Write patch interaction info
virtual void info();
};

View File

@ -257,9 +257,9 @@ bool Foam::StandardWallInteraction<CloudType>::correct
template<class CloudType>
void Foam::StandardWallInteraction<CloudType>::info(Ostream& os)
void Foam::StandardWallInteraction<CloudType>::info()
{
PatchInteractionModel<CloudType>::info(os);
PatchInteractionModel<CloudType>::info();
labelListList npe0(nEscape_.size());
scalarListList mpe0(nEscape_.size());
@ -326,7 +326,7 @@ void Foam::StandardWallInteraction<CloudType>::info(Ostream& os)
{
const word& patchName = mesh_.boundary()[patchi].name() ;
os << " Parcel fate: patch " << patchName
Log_<< " Parcel fate: patch " << patchName
<< " (number, mass)" << nl
<< " - escape (injector " << indexToInjector[indexi]
<< ") = " << npe[patchi][indexi]
@ -349,7 +349,7 @@ void Foam::StandardWallInteraction<CloudType>::info(Ostream& os)
{
const word& patchName = mesh_.boundary()[patchi].name();
os << " Parcel fate: patch (number, mass) "
Log_<< " Parcel fate: patch (number, mass) "
<< patchName << nl
<< " - escape = "
<< npe[patchi][0] << ", " << mpe[patchi][0] << nl

View File

@ -155,8 +155,8 @@ public:
);
//- Write patch interaction info to stream
virtual void info(Ostream& os);
//- Write patch interaction info
virtual void info();
};

View File

@ -184,10 +184,7 @@ void Foam::KinematicSurfaceFilm<CloudType>::absorbInteraction
bool& keepParticle
)
{
if (debug)
{
Info<< "Parcel " << p.origId() << " absorbInteraction" << endl;
}
DebugInfo<< "Parcel " << p.origId() << " absorbInteraction" << endl;
// Patch face normal
const vector& nf = pp.faceNormals()[facei];
@ -231,10 +228,7 @@ void Foam::KinematicSurfaceFilm<CloudType>::bounceInteraction
bool& keepParticle
) const
{
if (debug)
{
Info<< "Parcel " << p.origId() << " bounceInteraction" << endl;
}
DebugInfo<< "Parcel " << p.origId() << " bounceInteraction" << endl;
// Patch face normal
const vector& nf = pp.faceNormals()[facei];
@ -265,10 +259,7 @@ void Foam::KinematicSurfaceFilm<CloudType>::drySplashInteraction
bool& keepParticle
)
{
if (debug)
{
Info<< "Parcel " << p.origId() << " drySplashInteraction" << endl;
}
DebugInfo<< "Parcel " << p.origId() << " drySplashInteraction" << endl;
// Patch face velocity and normal
const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
@ -321,10 +312,7 @@ void Foam::KinematicSurfaceFilm<CloudType>::wetSplashInteraction
bool& keepParticle
)
{
if (debug)
{
Info<< "Parcel " << p.origId() << " wetSplashInteraction" << endl;
}
DebugInfo<< "Parcel " << p.origId() << " wetSplashInteraction" << endl;
// Patch face velocity and normal
const vector& Up = this->owner().U().boundaryField()[pp.index()][facei];
@ -815,15 +803,15 @@ void Foam::KinematicSurfaceFilm<CloudType>::setParcelProperties
template<class CloudType>
void Foam::KinematicSurfaceFilm<CloudType>::info(Ostream& os)
void Foam::KinematicSurfaceFilm<CloudType>::info()
{
SurfaceFilmModel<CloudType>::info(os);
SurfaceFilmModel<CloudType>::info();
label nSplash0 = this->template getModelProperty<label>("nParcelsSplashed");
label nSplashTotal =
nSplash0 + returnReduce(nParcelsSplashed_, sumOp<label>());
os << " - new splash parcels = " << nSplashTotal << endl;
Log_<< " - new splash parcels = " << nSplashTotal << endl;
if (this->writeTime())
{

View File

@ -342,8 +342,8 @@ public:
// I-O
//- Write surface film info to stream
virtual void info(Ostream& os);
//- Write surface film info
virtual void info();
};

View File

@ -88,9 +88,4 @@ void Foam::NoSurfaceFilm<CloudType>::setParcelProperties
{}
template<class CloudType>
void Foam::NoSurfaceFilm<CloudType>::info(Ostream&)
{}
// ************************************************************************* //

View File

@ -114,12 +114,6 @@ public:
parcelType& p,
const label filmCelli
) const;
// I-O
//- Write surface film info to stream
virtual void info(Ostream& os);
};

View File

@ -436,8 +436,10 @@ void Foam::SurfaceFilmModel<CloudType>::setParcelProperties
template<class CloudType>
void Foam::SurfaceFilmModel<CloudType>::info(Ostream& os)
void Foam::SurfaceFilmModel<CloudType>::info()
{
CloudSubModelBase<CloudType>::info();
label nTrans0 =
this->template getModelProperty<label>("nParcelsTransferred");
@ -457,7 +459,7 @@ void Foam::SurfaceFilmModel<CloudType>::info(Ostream& os)
massTransferred0 + returnReduce(totalMassTransferred_, sumOp<scalar>());
os << " Surface film:" << nl
Log_<< " Surface film:" << nl
<< " - parcels absorbed = " << nTransTotal << nl
<< " - mass absorbed = " << massTransferredTotal << nl
<< " - parcels ejected = " << nInjectTotal << endl;

View File

@ -275,8 +275,8 @@ public:
// I-O
//- Write surface film info to stream
virtual void info(Ostream& os);
//- Write surface film info
virtual void info();
};

View File

@ -152,12 +152,14 @@ void Foam::PhaseChangeModel<CloudType>::addToPhaseChangeMass(const scalar dMass)
template<class CloudType>
void Foam::PhaseChangeModel<CloudType>::info(Ostream& os)
void Foam::PhaseChangeModel<CloudType>::info()
{
CloudSubModelBase<CloudType>::info();
const scalar mass0 = this->template getBaseProperty<scalar>("mass");
const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
Info<< " Mass transfer phase change = " << massTotal << nl;
Log_<< " Mass transfer phase change = " << massTotal << nl;
if (this->writeTime())
{

View File

@ -199,8 +199,8 @@ public:
// I-O
//- Write injection info to stream
virtual void info(Ostream& os);
//- Write injection info
virtual void info();
};

View File

@ -84,12 +84,14 @@ void Foam::DevolatilisationModel<CloudType>::addToDevolatilisationMass
template<class CloudType>
void Foam::DevolatilisationModel<CloudType>::info(Ostream& os)
void Foam::DevolatilisationModel<CloudType>::info()
{
CloudSubModelBase<CloudType>::info();
const scalar mass0 = this->template getBaseProperty<scalar>("mass");
const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
Info<< " Mass transfer devolatilisation = " << massTotal << nl;
Log_<< " Mass transfer devolatilisation = " << massTotal << nl;
if (this->writeTime())
{

View File

@ -142,8 +142,8 @@ public:
// I-O
//- Write injection info to stream
virtual void info(Ostream& os);
//- Write injection info
virtual void info();
};

View File

@ -78,12 +78,14 @@ void Foam::SurfaceReactionModel<CloudType>::addToSurfaceReactionMass
template<class CloudType>
void Foam::SurfaceReactionModel<CloudType>::info(Ostream& os)
void Foam::SurfaceReactionModel<CloudType>::info()
{
CloudSubModelBase<CloudType>::info();
const scalar mass0 = this->template getBaseProperty<scalar>("mass");
const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
Info<< " Mass transfer surface reaction = " << massTotal << nl;
Log_<< " Mass transfer surface reaction = " << massTotal << nl;
if (this->writeTime())
{

View File

@ -155,8 +155,8 @@ public:
// I-O
//- Write injection info to stream
virtual void info(Ostream& os);
//- Write injection info
virtual void info();
};

View File

@ -275,9 +275,9 @@ void Foam::ThermoSurfaceFilm<CloudType>::setParcelProperties
template<class CloudType>
void Foam::ThermoSurfaceFilm<CloudType>::info(Ostream& os)
void Foam::ThermoSurfaceFilm<CloudType>::info()
{
KinematicSurfaceFilm<CloudType>::info(os);
KinematicSurfaceFilm<CloudType>::info();
}

View File

@ -157,8 +157,8 @@ public:
// I-O
//- Write surface film info to stream
virtual void info(Ostream& os);
//- Write surface film info
virtual void info();
};