ENH: Updated writing of cloud properties to file for consistent restarts

This commit is contained in:
andy
2011-12-15 16:54:36 +00:00
parent 944af16800
commit 96a4cf4097
42 changed files with 588 additions and 398 deletions

View File

@ -230,6 +230,16 @@ void Foam::KinematicCloud<CloudType>::postEvolve()
functions_.postEvolve();
solution_.nextIter();
if (this->db().time().outputTime())
{
outputProperties_.writeObject
(
IOstream::ASCII,
IOstream::currentVersion,
this->db().time().writeCompression()
);
}
}
@ -281,6 +291,18 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
IOobject::NO_WRITE
)
),
outputProperties_
(
IOobject
(
cloudName + "OutputProperties",
mesh_.time().timeName(),
"uniform"/cloud::prefix/cloudName,
mesh_,
IOobject::READ_IF_PRESENT,
IOobject::NO_WRITE
)
),
solution_(mesh_, particleProperties_.subDict("solution")),
constProps_(particleProperties_, solution_.active()),
subModelProperties_
@ -384,6 +406,7 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
cloudCopyPtr_(NULL),
mesh_(c.mesh_),
particleProperties_(c.particleProperties_),
outputProperties_(c.outputProperties_),
solution_(c.solution_),
constProps_(c.constProps_),
subModelProperties_(c.subModelProperties_),
@ -460,6 +483,19 @@ Foam::KinematicCloud<CloudType>::KinematicCloud
false
)
),
outputProperties_
(
IOobject
(
name + "OutputProperties",
mesh_.time().timeName(),
"uniform"/cloud::prefix/name,
mesh_,
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
),
solution_(mesh),
constProps_(),
subModelProperties_(dictionary::null),
@ -639,7 +675,7 @@ void Foam::KinematicCloud<CloudType>::motion(TrackData& td)
template<class CloudType>
void Foam::KinematicCloud<CloudType>::info() const
void Foam::KinematicCloud<CloudType>::info()
{
vector linearMomentum = linearMomentumOfSystem();
reduce(linearMomentum, sumOp<vector>());

View File

@ -143,6 +143,9 @@ protected:
//- Dictionary of particle properties
IOdictionary particleProperties_;
//- Dictionary of output properties
IOdictionary outputProperties_;
//- Solution properties
cloudSolution solution_;
@ -324,6 +327,12 @@ public:
//- Return particle properties dictionary
inline const IOdictionary& particleProperties() const;
//- Return output properties dictionary
inline const IOdictionary& outputProperties() const;
//- Return non-const access to the output properties dictionary
inline IOdictionary& outputProperties();
//- Return const access to the solution properties
inline const cloudSolution& solution() const;
@ -546,8 +555,11 @@ public:
template<class TrackData>
void motion(TrackData& td);
// I-O
//- Print cloud information
void info() const;
void info();
};

View File

@ -50,6 +50,21 @@ Foam::KinematicCloud<CloudType>::particleProperties() const
}
template<class CloudType>
inline const Foam::IOdictionary&
Foam::KinematicCloud<CloudType>::outputProperties() const
{
return outputProperties_;
}
template<class CloudType>
inline Foam::IOdictionary& Foam::KinematicCloud<CloudType>::outputProperties()
{
return outputProperties_;
}
template<class CloudType>
inline const Foam::cloudSolution&
Foam::KinematicCloud<CloudType>::solution() const

View File

@ -341,20 +341,13 @@ void Foam::ReactingCloud<CloudType>::evolve()
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::addToMassPhaseChange(const scalar dMass)
{
dMassPhaseChange_ += dMass;
}
template<class CloudType>
void Foam::ReactingCloud<CloudType>::info() const
void Foam::ReactingCloud<CloudType>::info()
{
CloudType::info();
Info<< " Mass transfer phase change = "
<< returnReduce(dMassPhaseChange_, sumOp<scalar>()) << nl;
this->phaseChange().info(Info);
}

View File

@ -215,14 +215,18 @@ public:
// Sub-models
//- Return reference to reacting composition model
//- Return const access to reacting composition model
inline const CompositionModel<ReactingCloud<CloudType> >&
composition() const;
//- Return reference to reacting phase change model
//- Return const access to reacting phase change model
inline const PhaseChangeModel<ReactingCloud<CloudType> >&
phaseChange() const;
//- Return reference to reacting phase change model
inline PhaseChangeModel<ReactingCloud<CloudType> >&
phaseChange();
// Sources
@ -259,12 +263,6 @@ public:
inline tmp<fvScalarMatrix> Srho(volScalarField& rho) const;
// Check
//- Add to cumulative phase change mass transfer
void addToMassPhaseChange(const scalar dMass);
// Cloud evolution functions
//- Set parcel thermo properties
@ -300,12 +298,12 @@ public:
//- Evolve the cloud
void evolve();
//- Print cloud information
void info() const;
// I-O
//- Print cloud information
void info();
//- Write the field data for the cloud
virtual void writeFields() const;
};

View File

@ -57,6 +57,14 @@ Foam::ReactingCloud<CloudType>::phaseChange() const
}
template<class CloudType>
inline Foam::PhaseChangeModel<Foam::ReactingCloud<CloudType> >&
Foam::ReactingCloud<CloudType>::phaseChange()
{
return phaseChangeModel_();
}
template<class CloudType>
inline Foam::DimensionedField<Foam::scalar, Foam::volMesh>&
Foam::ReactingCloud<CloudType>::rhoTrans(const label i)

View File

@ -253,33 +253,12 @@ void Foam::ReactingMultiphaseCloud<CloudType>::evolve()
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::addToMassDevolatilisation
(
const scalar dMass
)
{
dMassDevolatilisation_ += dMass;
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::addToMassSurfaceReaction
(
const scalar dMass
)
{
dMassSurfaceReaction_ += dMass;
}
template<class CloudType>
void Foam::ReactingMultiphaseCloud<CloudType>::info() const
void Foam::ReactingMultiphaseCloud<CloudType>::info()
{
CloudType::info();
Info<< " Mass transfer devolatilisation = "
<< returnReduce(dMassDevolatilisation_, sumOp<scalar>()) << nl;
Info<< " Mass transfer surface reaction = "
<< returnReduce(dMassSurfaceReaction_, sumOp<scalar>()) << nl;
this->devolatilisation().info(Info);
this->surfaceReaction().info(Info);
}

View File

@ -214,28 +214,33 @@ public:
// Sub-models
//- Return reference to devolatilisation model
//- Return const access to devolatilisation model
inline const DevolatilisationModel
<
ReactingMultiphaseCloud<CloudType>
>&
devolatilisation() const;
//- Return reference to reacting surface reaction model
//- Return reference to devolatilisation model
inline DevolatilisationModel
<
ReactingMultiphaseCloud<CloudType>
>&
devolatilisation();
//- Return const access to reacting surface reaction model
inline const SurfaceReactionModel
<
ReactingMultiphaseCloud<CloudType>
>&
surfaceReaction() const;
// Check
//- Add to cumulative volatilisation mass transfer
void addToMassDevolatilisation(const scalar dMass);
//- Add to cumulative surface reaction transfer
void addToMassSurfaceReaction(const scalar dMass);
//- Return reference to reacting surface reaction model
inline SurfaceReactionModel
<
ReactingMultiphaseCloud<CloudType>
>&
surfaceReaction();
// Cloud evolution functions
@ -267,12 +272,12 @@ public:
//- Evolve the cloud
void evolve();
//- Print cloud information
void info() const;
// I-O
//- Print cloud information
void info();
//- Write the field data for the cloud
virtual void writeFields() const;
};

View File

@ -52,6 +52,17 @@ Foam::ReactingMultiphaseCloud<CloudType>::devolatilisation() const
}
template<class CloudType>
inline Foam::DevolatilisationModel
<
Foam::ReactingMultiphaseCloud<CloudType>
>&
Foam::ReactingMultiphaseCloud<CloudType>::devolatilisation()
{
return devolatilisationModel_();
}
template<class CloudType>
inline const Foam::SurfaceReactionModel
<
@ -63,4 +74,15 @@ Foam::ReactingMultiphaseCloud<CloudType>::surfaceReaction() const
}
template<class CloudType>
inline Foam::SurfaceReactionModel
<
Foam::ReactingMultiphaseCloud<CloudType>
>&
Foam::ReactingMultiphaseCloud<CloudType>::surfaceReaction()
{
return surfaceReactionModel_();
}
// ************************************************************************* //

View File

@ -334,7 +334,7 @@ void Foam::ThermoCloud<CloudType>::evolve()
template<class CloudType>
void Foam::ThermoCloud<CloudType>::info() const
void Foam::ThermoCloud<CloudType>::info()
{
CloudType::info();
}

View File

@ -321,7 +321,7 @@ public:
// Check
//- Print cloud information
void info() const;
void info();
};

View File

@ -369,7 +369,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calc
td.cloud().hsTrans()[cellI] += dm*HsEff(td, pc, T0, idG, idL, idS);
td.cloud().addToMassPhaseChange(dm);
td.cloud().phaseChange().addToPhaseChangeMass(dm);
}
return;
@ -520,7 +520,10 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcDevolatilisation
scalar dMassTot = sum(dMassDV);
td.cloud().addToMassDevolatilisation(this->nParticle_*dMassTot);
td.cloud().devolatilisation().addToDevolatilisationMass
(
this->nParticle_*dMassTot
);
Sh -= dMassTot*td.cloud().constProps().LDevol()/dt;
@ -608,7 +611,7 @@ void Foam::ReactingMultiphaseParcel<ParcelType>::calcSurfaceReactions
dMassSRCarrier
);
td.cloud().addToMassSurfaceReaction
td.cloud().surfaceReaction().addToSurfaceReactionMass
(
this->nParticle_
*(sum(dMassSRGas) + sum(dMassSRLiquid) + sum(dMassSRSolid))

View File

@ -385,7 +385,7 @@ void Foam::ReactingParcel<ParcelType>::calc
}
td.cloud().UTrans()[cellI] += dm*U0;
td.cloud().addToMassPhaseChange(dm);
td.cloud().phaseChange().addToPhaseChangeMass(dm);
}
return;
@ -519,7 +519,7 @@ void Foam::ReactingParcel<ParcelType>::calcPhaseChange
const scalar dMassTot = sum(dMassPC);
// Add to cumulative phase change mass
td.cloud().addToMassPhaseChange(this->nParticle_*dMassTot);
td.cloud().phaseChange().addToPhaseChangeMass(this->nParticle_*dMassTot);
forAll(dMassPC, i)
{

View File

@ -51,7 +51,7 @@ Foam::CloudFunctionObject<CloudType>::CloudFunctionObject
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type, "")
SubModelBase<CloudType>(owner, dict, typeName, type, "")
{}

View File

@ -64,7 +64,7 @@ class CloudFunctionObject
public:
//- Runtime type information
TypeName("postProcessingModel");
TypeName("cloudFunctionObject");
//- Declare runtime constructor selection table
declareRunTimeSelectionTable

View File

@ -42,7 +42,7 @@ Foam::CollisionModel<CloudType>::CollisionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type)
SubModelBase<CloudType>(owner, dict, typeName, type)
{}

View File

@ -42,7 +42,7 @@ Foam::DispersionModel<CloudType>::DispersionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type)
SubModelBase<CloudType>(owner, dict, typeName, type)
{}

View File

@ -31,76 +31,6 @@ using namespace Foam::constant::mathematical;
// * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * * //
template<class CloudType>
void Foam::InjectionModel<CloudType>::readProps()
{
if (!this->owner().solution().transient())
{
return;
}
IOobject propsDictHeader
(
"injectionProperties",
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
);
if (propsDictHeader.headerOk())
{
const IOdictionary propsDict(propsDictHeader);
propsDict.readIfPresent("massInjected", massInjected_);
propsDict.readIfPresent("nInjections", nInjections_);
propsDict.readIfPresent("parcelsAddedTotal", parcelsAddedTotal_);
propsDict.readIfPresent("timeStep0", timeStep0_);
}
}
template<class CloudType>
void Foam::InjectionModel<CloudType>::writeProps()
{
if (!this->owner().solution().transient())
{
return;
}
if (this->owner().db().time().outputTime())
{
IOdictionary propsDict
(
IOobject
(
"injectionProperties",
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
propsDict.add("massInjected", massInjected_);
propsDict.add("nInjections", nInjections_);
propsDict.add("parcelsAddedTotal", parcelsAddedTotal_);
propsDict.add("timeStep0", timeStep0_);
propsDict.writeObject
(
IOstream::ASCII,
IOstream::currentVersion,
this->owner().db().time().writeCompression()
);
}
}
template<class CloudType>
bool Foam::InjectionModel<CloudType>::validInjection(const label parcelI)
{
@ -328,9 +258,6 @@ void Foam::InjectionModel<CloudType>::postInjectCheck
// Increment number of injections
nInjections_++;
// Write current state to properties file
writeProps();
}
@ -343,16 +270,17 @@ Foam::InjectionModel<CloudType>::InjectionModel(CloudType& owner)
SOI_(0.0),
volumeTotal_(0.0),
massTotal_(0.0),
massInjected_(0.0),
nInjections_(0),
parcelsAddedTotal_(0),
massInjected_(this->template getBaseProperty<scalar>("massInjected")),
nInjections_(this->template getBaseProperty<scalar>("nInjections")),
parcelsAddedTotal_
(
this->template getBaseProperty<scalar>("parcelsAddedTotal")
),
parcelBasis_(pbNumber),
nParticleFixed_(0.0),
time0_(0.0),
timeStep0_(0.0)
{
readProps();
}
timeStep0_(this->template getBaseProperty<scalar>("timeStep0"))
{}
template<class CloudType>
@ -363,17 +291,20 @@ Foam::InjectionModel<CloudType>::InjectionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type),
SubModelBase<CloudType>(owner, dict, typeName, type),
SOI_(0.0),
volumeTotal_(0.0),
massTotal_(0.0),
massInjected_(0.0),
nInjections_(0),
parcelsAddedTotal_(0),
massInjected_(this->template getBaseProperty<scalar>("massInjected")),
nInjections_(this->template getBaseProperty<scalar>("nInjections")),
parcelsAddedTotal_
(
this->template getBaseProperty<scalar>("parcelsAddedTotal")
),
parcelBasis_(pbNumber),
nParticleFixed_(0.0),
time0_(owner.db().time().value()),
timeStep0_(0.0)
timeStep0_(this->template getBaseProperty<scalar>("timeStep0"))
{
// Provide some info
// - also serves to initialise mesh dimensions - needed for parallel runs
@ -424,8 +355,6 @@ Foam::InjectionModel<CloudType>::InjectionModel
)<< "parcelBasisType must be either 'number', 'mass' or 'fixed'" << nl
<< exit(FatalError);
}
readProps();
}
@ -803,10 +732,22 @@ bool Foam::InjectionModel<CloudType>::fullyDescribed() const
template<class CloudType>
void Foam::InjectionModel<CloudType>::info(Ostream& os) const
void Foam::InjectionModel<CloudType>::info(Ostream& os)
{
os << " Total number of parcels added = " << parcelsAddedTotal_ << nl
<< " Total mass introduced = " << massInjected_ << nl;
if
(
this->owner().solution().transient()
&& this->owner().db().time().outputTime()
)
{
this->setBaseProperty("massInjected", massInjected_);
this->setBaseProperty("nInjections", nInjections_);
this->setBaseProperty("parcelsAddedTotal", parcelsAddedTotal_);
this->setBaseProperty("timeStep0", timeStep0_);
}
}

View File

@ -85,17 +85,6 @@ public:
};
private:
// Private Member Functions
//- Read injector properties from previous run (if applicable)
void readProps();
//- Write injector properties
void writeProps();
protected:
// Protected data
@ -328,7 +317,7 @@ public:
// I-O
//- Write injection info to stream
virtual void info(Ostream& os) const;
virtual void info(Ostream& os);
};

View File

@ -25,83 +25,6 @@ License
#include "LocalInteraction.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class CloudType>
void Foam::LocalInteraction<CloudType>::readProps()
{
if (!this->owner().solution().transient())
{
return;
}
IOobject propsDictHeader
(
"localInteractionProperties",
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
);
if (propsDictHeader.headerOk())
{
const IOdictionary propsDict(propsDictHeader);
propsDict.readIfPresent("nEscape", nEscape0_);
propsDict.readIfPresent("massEscape", massEscape0_);
propsDict.readIfPresent("nStick", nStick0_);
propsDict.readIfPresent("massStick", massStick0_);
}
}
template<class CloudType>
void Foam::LocalInteraction<CloudType>::writeProps
(
const labelList& nEscape,
const scalarList& massEscape,
const labelList& nStick,
const scalarList& massStick
) const
{
if (!this->owner().solution().transient())
{
return;
}
if (this->owner().db().time().outputTime())
{
IOdictionary propsDict
(
IOobject
(
"localInteractionProperties",
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
propsDict.add("nEscape", nEscape);
propsDict.add("massEscape", massEscape);
propsDict.add("nStick", nStick);
propsDict.add("massStick", massStick);
propsDict.writeObject
(
IOstream::ASCII,
IOstream::currentVersion,
this->owner().db().time().writeCompression()
);
}
}
// * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * * //
template<class CloudType>
@ -122,6 +45,12 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
nStick_(patchData_.size(), 0),
massStick_(patchData_.size(), 0.0)
{
// intialise starting counters
this->getModelProperty("nEscape", nEscape0_);
this->getModelProperty("massEscape", massEscape0_);
this->getModelProperty("nStick", nStick0_);
this->getModelProperty("massStick", massStick0_);
// check that interactions are valid/specified
forAll(patchData_, patchI)
{
@ -141,8 +70,6 @@ Foam::LocalInteraction<CloudType>::LocalInteraction
<< nl << exit(FatalError);
}
}
readProps();
}
@ -255,7 +182,7 @@ bool Foam::LocalInteraction<CloudType>::correct
"typename CloudType::parcelType&, "
"const polyPatch&, "
"bool&, "
"scalar&, "
"const scalar, "
"const tetIndices&"
") const"
) << "Unknown interaction type "
@ -275,7 +202,7 @@ bool Foam::LocalInteraction<CloudType>::correct
template<class CloudType>
void Foam::LocalInteraction<CloudType>::info(Ostream& os) const
void Foam::LocalInteraction<CloudType>::info(Ostream& os)
{
labelList npe(nEscape_);
Pstream::listCombineGather(npe, plusEqOp<label>());
@ -304,7 +231,17 @@ void Foam::LocalInteraction<CloudType>::info(Ostream& os) const
<< ", " << mps[i] << nl;
}
writeProps(npe, mpe, nps, mps);
if
(
this->owner().solution().transient()
&& this->owner().db().time().outputTime()
)
{
this->setModelProperty("nEscape", npe);
this->setModelProperty("massEscape", mpe);
this->setModelProperty("nStick", nps);
this->setModelProperty("massStick", mps);
}
}

View File

@ -84,21 +84,6 @@ class LocalInteraction
List<scalar> massStick_;
// Private Member Functions
//- Read interaction properties from file
void readProps();
//- Write interaction properties to file
void writeProps
(
const labelList& nEscape,
const scalarList& massEscape,
const labelList& nStick,
const scalarList& massStick
) const;
public:
//- Runtime type information
@ -144,7 +129,7 @@ public:
// I-O
//- Write patch interaction info to stream
virtual void info(Ostream& os) const;
virtual void info(Ostream& os);
};

View File

@ -122,7 +122,7 @@ Foam::PatchInteractionModel<CloudType>::PatchInteractionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type),
SubModelBase<CloudType>(owner, dict, typeName, type),
UName_(this->coeffDict().lookupOrDefault("UName", word("U")))
{}
@ -333,7 +333,7 @@ void Foam::PatchInteractionModel<CloudType>::patchData
template<class CloudType>
void Foam::PatchInteractionModel<CloudType>::info(Ostream& os) const
void Foam::PatchInteractionModel<CloudType>::info(Ostream& os)
{
// do nothing
}

View File

@ -180,7 +180,7 @@ public:
// I-O
//- Write patch interaction info to stream
virtual void info(Ostream& os) const;
virtual void info(Ostream& os);
};

View File

@ -25,83 +25,6 @@ License
#include "StandardWallInteraction.H"
// * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * * //
template<class CloudType>
void Foam::StandardWallInteraction<CloudType>::readProps()
{
if (!this->owner().solution().transient())
{
return;
}
IOobject propsDictHeader
(
"standardWallInteractionProperties",
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::MUST_READ_IF_MODIFIED,
IOobject::NO_WRITE,
false
);
if (propsDictHeader.headerOk())
{
const IOdictionary propsDict(propsDictHeader);
propsDict.readIfPresent("nEscape", nEscape0_);
propsDict.readIfPresent("massEscape", massEscape0_);
propsDict.readIfPresent("nStick", nStick0_);
propsDict.readIfPresent("massStick", massStick0_);
}
}
template<class CloudType>
void Foam::StandardWallInteraction<CloudType>::writeProps
(
const label nEscape,
const scalar massEscape,
const label nStick,
const scalar massStick
) const
{
if (!this->owner().solution().transient())
{
return;
}
if (this->owner().db().time().outputTime())
{
IOdictionary propsDict
(
IOobject
(
"standardWallInteractionProperties",
this->owner().db().time().timeName(),
"uniform"/cloud::prefix/this->owner().name(),
this->owner().db(),
IOobject::NO_READ,
IOobject::NO_WRITE,
false
)
);
propsDict.add("nEscape", nEscape);
propsDict.add("massEscape", massEscape);
propsDict.add("nStick", nStick);
propsDict.add("massStick", massStick);
propsDict.writeObject
(
IOstream::ASCII,
IOstream::currentVersion,
this->owner().db().time().writeCompression()
);
}
}
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class CloudType>
@ -118,10 +41,10 @@ Foam::StandardWallInteraction<CloudType>::StandardWallInteraction
),
e_(0.0),
mu_(0.0),
nEscape0_(0),
massEscape0_(0.0),
nStick0_(0),
massStick0_(0.0),
nEscape0_(this->template getModelProperty<label>("nEscape")),
massEscape0_(this->template getModelProperty<scalar>("massEscape")),
nStick0_(this->template getModelProperty<label>("nStick")),
massStick0_(this->template getModelProperty<scalar>("massStick")),
nEscape_(0),
massEscape_(0.0),
nStick_(0),
@ -279,7 +202,7 @@ bool Foam::StandardWallInteraction<CloudType>::correct
template<class CloudType>
void Foam::StandardWallInteraction<CloudType>::info(Ostream& os) const
void Foam::StandardWallInteraction<CloudType>::info(Ostream& os)
{
label npe = returnReduce(nEscape_, sumOp<label>()) + nEscape0_;
scalar mpe = returnReduce(massEscape_, sumOp<scalar>()) + massEscape0_;
@ -287,11 +210,21 @@ void Foam::StandardWallInteraction<CloudType>::info(Ostream& os) const
label nps = returnReduce(nStick_, sumOp<label>()) + nStick0_;
scalar mps = returnReduce(massStick_, sumOp<scalar>()) + massStick0_;
os << " Parcel fates:" << nl
os << " Parcel fate (number, mass)" << nl
<< " - escape = " << npe << ", " << mpe << nl
<< " - stick = " << nps << ", " << mps << nl;
writeProps(npe, mpe, nps, mps);
if
(
this->owner().solution().transient()
&& this->owner().db().time().outputTime()
)
{
this->setModelProperty("nEscape", npe);
this->setModelProperty("massEscape", mpe);
this->setModelProperty("nStick", nps);
this->setModelProperty("massStick", mps);
}
}

View File

@ -104,21 +104,6 @@ protected:
scalar massStick_;
// Protected Member Functions
//- Read interaction properties from file
void readProps();
//- Write interaction properties to file
void writeProps
(
const label nEscape,
const scalar massEscape,
const label nStick,
const scalar massStick
) const;
public:
//- Runtime type information
@ -164,7 +149,7 @@ public:
// I-O
//- Write patch interaction info to stream
virtual void info(Ostream& os) const;
virtual void info(Ostream& os);
};

View File

@ -57,7 +57,7 @@ Foam::SurfaceFilmModel<CloudType>::SurfaceFilmModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type),
SubModelBase<CloudType>(owner, dict, typeName, type),
g_(g),
ejectedParcelType_
(

View File

@ -44,7 +44,7 @@ Foam::CompositionModel<CloudType>::CompositionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type),
SubModelBase<CloudType>(owner, dict, typeName, type),
thermo_(owner.thermo()),
phaseProps_
(

View File

@ -76,7 +76,8 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
)
:
SubModelBase<CloudType>(owner),
enthalpyTransfer_(etLatentHeat)
enthalpyTransfer_(etLatentHeat),
dMass_(0.0)
{}
@ -87,7 +88,8 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
)
:
SubModelBase<CloudType>(pcm),
enthalpyTransfer_(pcm.enthalpyTransfer_)
enthalpyTransfer_(pcm.enthalpyTransfer_),
dMass_(pcm.dMass_)
{}
@ -99,11 +101,12 @@ Foam::PhaseChangeModel<CloudType>::PhaseChangeModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type),
SubModelBase<CloudType>(owner, dict, typeName, type),
enthalpyTransfer_
(
wordToEnthalpyTransfer(this->coeffDict().lookup("enthalpyTransfer"))
)
),
dMass_(0.0)
{}
@ -175,6 +178,33 @@ Foam::scalar Foam::PhaseChangeModel<CloudType>::dh
}
template<class CloudType>
void Foam::PhaseChangeModel<CloudType>::addToPhaseChangeMass(const scalar dMass)
{
dMass_ += dMass;
}
template<class CloudType>
void Foam::PhaseChangeModel<CloudType>::info(Ostream& os)
{
const scalar mass0 = this->template getBaseProperty<scalar>("mass");
const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
Info<< " Mass transfer phase change = " << massTotal << nl;
if
(
this->owner().solution().transient()
&& this->owner().db().time().outputTime()
)
{
this->setBaseProperty("mass", massTotal);
dMass_ = 0.0;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "PhaseChangeModelNew.C"

View File

@ -78,6 +78,12 @@ protected:
enthalpyTransferType enthalpyTransfer_;
// Counters
//- Mass of lagrangian phase converted
scalar dMass_;
// Protected Member Functions
//- Convert word to enthalpy transfer type
@ -177,6 +183,16 @@ public:
const label p,
const label T
) const;
//- Add to phase change mass
void addToPhaseChangeMass(const scalar dMass);
// I-O
//- Write injection info to stream
virtual void info(Ostream& os);
};

View File

@ -33,7 +33,8 @@ Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
CloudType& owner
)
:
SubModelBase<CloudType>(owner)
SubModelBase<CloudType>(owner),
dMass_(0.0)
{}
@ -45,7 +46,8 @@ Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type)
SubModelBase<CloudType>(owner, dict, typeName, type),
dMass_(0.0)
{}
@ -55,7 +57,8 @@ Foam::DevolatilisationModel<CloudType>::DevolatilisationModel
const DevolatilisationModel<CloudType>& dm
)
:
SubModelBase<CloudType>(dm)
SubModelBase<CloudType>(dm),
dMass_(dm.dMass_)
{}
@ -96,6 +99,36 @@ void Foam::DevolatilisationModel<CloudType>::calculate
}
template<class CloudType>
void Foam::DevolatilisationModel<CloudType>::addToDevolatilisationMass
(
const scalar dMass
)
{
dMass_ += dMass;
}
template<class CloudType>
void Foam::DevolatilisationModel<CloudType>::info(Ostream& os)
{
const scalar mass0 = this->template getBaseProperty<scalar>("mass");
const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
Info<< " Mass transfer devolatilisation = " << massTotal << nl;
if
(
this->owner().solution().transient()
&& this->owner().db().time().outputTime()
)
{
this->setBaseProperty("mass", massTotal);
dMass_ = 0.0;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "DevolatilisationModelNew.C"

View File

@ -55,6 +55,14 @@ class DevolatilisationModel
:
public SubModelBase<CloudType>
{
protected:
// Protected data
//- Mass of lagrangian phase converted
scalar dMass_;
public:
//- Runtime type information
@ -125,6 +133,15 @@ public:
bool& canCombust,
scalarField& dMassDV
) const;
//- Add to devolatilisation mass
void addToDevolatilisationMass(const scalar dMass);
// I-O
//- Write injection info to stream
virtual void info(Ostream& os);
};

View File

@ -33,7 +33,8 @@ Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
CloudType& owner
)
:
SubModelBase<CloudType>(owner)
SubModelBase<CloudType>(owner),
dMass_(0.0)
{}
@ -45,7 +46,8 @@ Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type)
SubModelBase<CloudType>(owner, dict, typeName, type),
dMass_(0.0)
{}
@ -55,7 +57,8 @@ Foam::SurfaceReactionModel<CloudType>::SurfaceReactionModel
const SurfaceReactionModel<CloudType>& srm
)
:
SubModelBase<CloudType>(srm)
SubModelBase<CloudType>(srm),
dMass_(srm.dMass_)
{}
@ -118,6 +121,36 @@ Foam::scalar Foam::SurfaceReactionModel<CloudType>::calculate
}
template<class CloudType>
void Foam::SurfaceReactionModel<CloudType>::addToSurfaceReactionMass
(
const scalar dMass
)
{
dMass_ += dMass;
}
template<class CloudType>
void Foam::SurfaceReactionModel<CloudType>::info(Ostream& os)
{
const scalar mass0 = this->template getBaseProperty<scalar>("mass");
const scalar massTotal = mass0 + returnReduce(dMass_, sumOp<scalar>());
Info<< " Mass transfer surface reaction = " << massTotal << nl;
if
(
this->owner().solution().transient()
&& this->owner().db().time().outputTime()
)
{
this->setBaseProperty("mass", massTotal);
dMass_ = 0.0;
}
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#include "SurfaceReactionModelNew.C"

View File

@ -56,6 +56,14 @@ class SurfaceReactionModel
:
public SubModelBase<CloudType>
{
protected:
// Protected data
//- Mass of lagrangian phase converted
scalar dMass_;
public:
//-Runtime type information
@ -138,6 +146,15 @@ public:
scalarField& dMassSolid,
scalarField& dMassSRCarrier
) const;
//- Add to devolatilisation mass
void addToSurfaceReactionMass(const scalar dMass);
// I-O
//- Write injection info to stream
virtual void info(Ostream& os);
};

View File

@ -32,6 +32,8 @@ Foam::SubModelBase<CloudType>::SubModelBase(CloudType& owner)
:
owner_(owner),
dict_(dictionary::null),
baseName_("none"),
name_("none"),
coeffDict_(dictionary::null)
{}
@ -41,12 +43,15 @@ Foam::SubModelBase<CloudType>::SubModelBase
(
CloudType& owner,
const dictionary& dict,
const word& baseName,
const word& name,
const word& dictExt
)
:
owner_(owner),
dict_(dict),
baseName_(baseName),
name_(name),
coeffDict_(dict.subDict(name + dictExt))
{}
@ -56,6 +61,8 @@ Foam::SubModelBase<CloudType>::SubModelBase(const SubModelBase<CloudType>& smb)
:
owner_(smb.owner_),
dict_(smb.dict_),
baseName_(smb.baseName_),
name_(smb.name_),
coeffDict_(smb.coeffDict_)
{}
@ -83,6 +90,20 @@ const Foam::dictionary& Foam::SubModelBase<CloudType>::dict() const
}
template<class CloudType>
const Foam::word& Foam::SubModelBase<CloudType>::baseName() const
{
return baseName_;
}
template<class CloudType>
const Foam::word& Foam::SubModelBase<CloudType>::name() const
{
return name_;
}
template<class CloudType>
const Foam::dictionary& Foam::SubModelBase<CloudType>::coeffDict() const
{
@ -126,6 +147,129 @@ void Foam::SubModelBase<CloudType>::cacheFields(const bool)
}
template<class CloudType>
template<class Type>
Type Foam::SubModelBase<CloudType>::getBaseProperty
(
const word& entryName
) const
{
Type result = pTraits<Type>::zero;
const dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
const dictionary& baseDict = properties.subDict(baseName_);
baseDict.readIfPresent(entryName, result);
}
return result;
}
template<class CloudType>
template<class Type>
void Foam::SubModelBase<CloudType>::setBaseProperty
(
const word& entryName,
const Type& value
)
{
dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
dictionary& baseDict = properties.subDict(baseName_);
baseDict.add(entryName, value, true);
}
else
{
properties.add(baseName_, dictionary());
properties.subDict(baseName_).add(entryName, value);
}
}
template<class CloudType>
template<class Type>
Type Foam::SubModelBase<CloudType>::getModelProperty
(
const word& entryName
) const
{
Type result = pTraits<Type>::zero;
const dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
const dictionary& baseDict = properties.subDict(baseName_);
if (baseDict.found(name_))
{
baseDict.subDict(name_).readIfPresent(entryName, result);
}
}
return result;
}
template<class CloudType>
template<class Type>
void Foam::SubModelBase<CloudType>::getModelProperty
(
const word& entryName,
Type& value
) const
{
const dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
const dictionary& baseDict = properties.subDict(baseName_);
if (baseDict.found(name_))
{
baseDict.subDict(name_).readIfPresent(entryName, value);
}
}
}
template<class CloudType>
template<class Type>
void Foam::SubModelBase<CloudType>::setModelProperty
(
const word& entryName,
const Type& value
)
{
dictionary& properties = this->owner().outputProperties();
if (properties.found(baseName_))
{
dictionary& baseDict = properties.subDict(baseName_);
if (baseDict.found(name_))
{
baseDict.subDict(name_).add(entryName, value, true);
}
else
{
baseDict.add(name_, dictionary());
baseDict.subDict(name_).add(entryName, value, true);
}
}
else
{
properties.add(baseName_, dictionary());
properties.subDict(baseName_).add(name_, dictionary());
properties.subDict(baseName_).subDict(name_).add(entryName, value);
}
}
template<class CloudType>
void Foam::SubModelBase<CloudType>::write(Ostream& os) const
{

View File

@ -63,6 +63,12 @@ protected:
//- Reference to the cloud dictionary
const dictionary& dict_;
//- Name of the sub-model bas class
const word baseName_;
//- Name of the sub-model
const word name_;
//- Coefficients dictionary
const dictionary& coeffDict_;
@ -79,6 +85,7 @@ public:
(
CloudType& owner,
const dictionary& dict,
const word& baseName,
const word& name,
const word& dictExt = "Coeffs"
);
@ -98,15 +105,24 @@ public:
// Access
//- Return const access to the cloud dictionary
const dictionary& dict() const;
//- Return const access to the owner cloud
const CloudType& owner() const;
//- Return const access to the cloud dictionary
const dictionary& dict() const;
//- Return const access to the base name of the sub-model
const word& baseName() const;
//- Return const access to the name of the sub-model
const word& name() const;
//- Return const access to the coefficients dictionary
const dictionary& coeffDict() const;
//- Return const access to the properties dictionary
const IOdictionary& properties() const;
//- Returns true if defaultCoeffs is true and outputs on printMsg
bool defaultCoeffs(const bool printMsg) const;
@ -122,6 +138,26 @@ public:
//- Return non-const access to the owner cloud for manipulation
CloudType& owner();
//- Retrieve generic property from sub-model
template<class Type>
Type getModelProperty(const word& entryName) const;
//- Retrieve generic property from sub-model
template<class Type>
void getModelProperty(const word& entryName, Type& value) const;
//- Add generic property from sub-model
template<class Type>
void setModelProperty(const word& entryName, const Type& value);
//- Retrieve generic property from base model
template<class Type>
Type getBaseProperty(const word& entryName) const;
//- Add generic property from base model
template<class Type>
void setBaseProperty(const word& entryName, const Type& value);
// I-O

View File

@ -43,7 +43,7 @@ Foam::HeatTransferModel<CloudType>::HeatTransferModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type),
SubModelBase<CloudType>(owner, dict, typeName, type),
BirdCorrection_(this->coeffDict().lookup("BirdCorrection"))
{}

View File

@ -358,7 +358,7 @@ void Foam::SprayCloud<CloudType>::motion(TrackData& td)
template<class CloudType>
void Foam::SprayCloud<CloudType>::info() const
void Foam::SprayCloud<CloudType>::info()
{
CloudType::info();
scalar d32 = 1.0e+6*this->Dij(3, 2);

View File

@ -192,22 +192,23 @@ public:
inline const AtomizationModel<SprayCloud<CloudType> >&
atomization() const;
//- Return reference to the atomization model
inline AtomizationModel<SprayCloud<CloudType> >& atomization();
//- Return const-access to the breakup model
inline const BreakupModel<SprayCloud<CloudType> >&
breakup() const;
//- Return non-const-access to the breakup model
//- Return reference to the breakup model
inline BreakupModel<SprayCloud<CloudType> >& breakup();
//- Return const-access to the breakup model
inline const StochasticCollisionModel<SprayCloud<CloudType> >&
stochasticCollision() const;
// Check
//- Print cloud information
void info() const;
//- Return reference to the breakup model
inline StochasticCollisionModel<SprayCloud<CloudType> >&
stochasticCollision();
// Cloud evolution functions
@ -239,6 +240,12 @@ public:
template<class TrackData>
void motion(TrackData& td);
// I-O
//- Print cloud information
void info();
};

View File

@ -41,6 +41,14 @@ Foam::SprayCloud<CloudType>::atomization() const
}
template<class CloudType>
inline Foam::AtomizationModel<Foam::SprayCloud<CloudType> >&
Foam::SprayCloud<CloudType>::atomization()
{
return atomizationModel_();
}
template<class CloudType>
inline const Foam::BreakupModel<Foam::SprayCloud<CloudType> >&
Foam::SprayCloud<CloudType>::breakup() const
@ -65,6 +73,14 @@ Foam::SprayCloud<CloudType>::stochasticCollision() const
}
template<class CloudType>
inline Foam::StochasticCollisionModel<Foam::SprayCloud<CloudType> >&
Foam::SprayCloud<CloudType>::stochasticCollision()
{
return stochasticCollisionModel_();
}
template<class CloudType>
inline Foam::scalar Foam::SprayCloud<CloudType>::averageParcelMass() const
{

View File

@ -55,7 +55,7 @@ Foam::AtomizationModel<CloudType>::AtomizationModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type)
SubModelBase<CloudType>(owner, dict, typeName, type)
{}

View File

@ -67,7 +67,7 @@ Foam::BreakupModel<CloudType>::BreakupModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type),
SubModelBase<CloudType>(owner, dict, typeName, type),
solveOscillationEq_(this->coeffDict().lookup("solveOscillationEq")),
y0_(0.0),
yDot0_(0.0),

View File

@ -55,7 +55,7 @@ Foam::StochasticCollisionModel<CloudType>::StochasticCollisionModel
const word& type
)
:
SubModelBase<CloudType>(owner, dict, type)
SubModelBase<CloudType>(owner, dict, typeName, type)
{}