30 template<
class CloudType>
34 carrierThermo_(owner.carrierThermo()),
46 template<
class CloudType>
55 carrierThermo_(owner.carrierThermo()),
65 this->coeffDict().lookup(
"phases"),
66 carrierMixture_ == nullptr
68 : carrierMixture_->species(),
69 thermo_.liquids().components(),
70 thermo_.solids().components()
75 template<
class CloudType>
82 carrierThermo_(cm.carrierThermo_),
83 carrierMixture_(cm.carrierMixture_),
85 phaseProps_(cm.phaseProps_)
91 template<
class CloudType>
98 template<
class CloudType>
105 template<
class CloudType>
109 if (carrierMixture_ ==
nullptr)
112 <<
"carrier requested, but object is not allocated"
116 return *carrierMixture_;
120 template<
class CloudType>
124 return thermo_.liquids();
128 template<
class CloudType>
132 return thermo_.solids();
136 template<
class CloudType>
144 template<
class CloudType>
147 return phaseProps_.size();
151 template<
class CloudType>
155 if (phaseProps_.size() == 1)
157 return phaseProps_[0].names();
161 return phaseProps_.phaseTypes();
166 template<
class CloudType>
169 return phaseProps_.stateLabels();
173 template<
class CloudType>
177 return phaseProps_[phasei].names();
181 template<
class CloudType>
184 const word& cmptName,
185 const bool allowNotFound
190 forAll(carrierMixture_->species(), i)
192 if (cmptName == carrierMixture_->species()[i])
198 if (
id < 0 && !allowNotFound)
201 <<
"Unable to determine global id for requested component "
202 << cmptName <<
". Available components are " <<
nl
203 << carrierMixture_->species()
211 template<
class CloudType>
215 const word& cmptName,
216 const bool allowNotFound
219 label id = phaseProps_[phasei].id(cmptName);
221 if (
id < 0 && !allowNotFound)
224 <<
"Unable to determine local id for component " << cmptName
232 template<
class CloudType>
237 const bool allowNotFound
240 label cid = phaseProps_[phasei].carrierId(
id);
242 if (cid < 0 && !allowNotFound)
245 <<
"Unable to determine global carrier id for phase "
246 << phasei <<
" with local id " <<
id
254 template<
class CloudType>
260 return phaseProps_[phasei].Y();
264 template<
class CloudType>
274 switch (props.
phase())
281 X[i] =
Y[i]/carrierMixture_->Wi(cid);
290 X[i] =
Y[i]/thermo_.liquids().properties()[i].W();
298 <<
"Only possible to convert gas and liquid mass fractions"
309 template<
class CloudType>
319 scalar HMixture = 0.0;
320 switch (props.
phase())
327 HMixture +=
Y[i]*carrierMixture_->Ha(cid,
p,
T);
335 HMixture +=
Y[i]*thermo_.liquids().properties()[i].Ha(
p,
T);
343 HMixture +=
Y[i]*thermo_.solids().properties()[i].Ha(
T);
358 template<
class CloudType>
368 scalar HsMixture = 0.0;
369 switch (props.
phase())
376 HsMixture +=
Y[i]*carrierMixture_->Hs(cid,
p,
T);
385 Y[i]*(thermo_.liquids().properties()[i].Hs(
p,
T));
393 HsMixture +=
Y[i]*thermo_.solids().properties()[i].Hs(
T);
400 <<
"Unknown phase enumeration"
409 template<
class CloudType>
419 scalar HcMixture = 0.0;
420 switch (props.
phase())
427 HcMixture +=
Y[i]*carrierMixture_->Hf(cid);
435 HcMixture +=
Y[i]*thermo_.liquids().properties()[i].Hf();
443 HcMixture +=
Y[i]*thermo_.solids().properties()[i].Hf();
450 <<
"Unknown phase enumeration"
459 template<
class CloudType>
469 scalar CpMixture = 0.0;
470 switch (props.
phase())
477 CpMixture +=
Y[i]*carrierMixture_->Cp(cid,
p,
T);
485 CpMixture +=
Y[i]*thermo_.liquids().properties()[i].Cp(
p,
T);
493 CpMixture +=
Y[i]*thermo_.solids().properties()[i].Cp();
500 <<
"Unknown phase enumeration"
509 template<
class CloudType>
519 scalar LMixture = 0.0;
520 switch (props.
phase())
527 <<
"No support for gaseous components" <<
endl;
535 LMixture +=
Y[i]*thermo_.liquids().properties()[i].hl(
p,
T);
544 <<
"No support for solid components" <<
endl;
551 <<
"Unknown phase enumeration"
#define forAll(list, i)
Loop across all elements in list.
Base class for cloud sub-models.
Templated reacting parcel composition model class Consists of carrier species (via thermo package),...
const liquidMixtureProperties & liquids() const
Return the global (additional) liquids.
scalarField X(const label phaseI, const scalarField &Y) const
Return the list of phase phaseI volume fractions fractions.
const parcelThermo & thermo() const
Return the thermo database.
virtual scalar H(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return total enthalpy for the phase phaseI.
const wordList & stateLabels() const
Return the list of state labels (s), (l), (g) etc.
CompositionModel(CloudType &owner)
Construct null from owner.
const phasePropertiesList & phaseProps() const
Return the list of phase properties.
const basicSpecieMixture & carrier() const
Return the carrier components (wrapper function)
virtual scalar L(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return latent heat for the phase phaseI.
virtual ~CompositionModel()
Destructor.
const wordList & componentNames(const label phaseI) const
Return the list of component names for phaseI.
label nPhase() const
Return the number of phases.
virtual scalar Hc(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return chemical enthalpy for the phase phaseI.
label localToCarrierId(const label phaseI, const label id, const bool allowNotFound=false) const
Return carrier id of component given local id.
virtual scalar Cp(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return specific heat capacity for the phase phaseI.
virtual scalar Hs(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return sensible enthalpy for the phase phaseI.
const solidMixtureProperties & solids() const
Return the global (additional) solids.
label localId(const label phaseI, const word &cmptName, const bool allowNotFound=false) const
Return local id of component cmptName in phase phaseI.
label carrierId(const word &cmptName, const bool allowNotFound=false) const
Return global id of component cmptName in carrier thermo.
const scalarField & Y0(const label phaseI) const
Return the list of phase phaseI mass fractions.
const wordList & phaseTypes() const
Return the list of phase type names.
Templated base class for dsmc cloud.
Specialisation of basicMixture for a mixture consisting of a number for molecular species.
A list of keyword definitions, which are a keyword followed by any number of values (e....
A wordList with hashed indices for faster lookup by name.
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
Simple container for a list of phase properties.
Helper class to manage multi-specie phase properties.
label carrierId(const label speciei) const
Return the carrier id for a given specie.
phaseType phase() const
Return const access to the phase type.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
To & refCast(From &r)
Reference type cast template function.
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
PtrList< volScalarField > & Y
fluidMulticomponentThermo & thermo