30 template<
class CloudType>
34 carrierThermo_(owner.carrierThermo()),
46 template<
class CloudType>
55 carrierThermo_(owner.carrierThermo()),
58 isA<basicSpecieMixture>(carrierThermo_)
59 ? &refCast<const basicSpecieMixture>(carrierThermo_)
62 thermo_(owner.thermo()),
65 this->coeffDict().lookup(
"phases"),
66 carrierMixture_ ==
nullptr 67 ? hashedWordList::null()
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
221 if (
id < 0 && !allowNotFound)
224 <<
"Unable to determine local id for component " << cmptName
232 template<
class CloudType>
237 const bool allowNotFound
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())
276 case phaseProperties::GAS:
281 X[i] = Y[i]/carrierMixture_->Wi(cid);
286 case phaseProperties::LIQUID:
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())
322 case phaseProperties::GAS:
327 HMixture += Y[i]*carrierMixture_->Ha(cid, p, T);
331 case phaseProperties::LIQUID:
335 HMixture += Y[i]*thermo_.liquids().properties()[i].Ha(p, T);
339 case phaseProperties::SOLID:
343 HMixture += Y[i]*thermo_.solids().properties()[i].Ha(T);
358 template<
class CloudType>
368 scalar HsMixture = 0.0;
369 switch (props.
phase())
371 case phaseProperties::GAS:
376 HsMixture += Y[i]*carrierMixture_->Hs(cid, p, T);
380 case phaseProperties::LIQUID:
385 Y[i]*(thermo_.liquids().properties()[i].Hs(p, T));
389 case phaseProperties::SOLID:
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())
422 case phaseProperties::GAS:
427 HcMixture += Y[i]*carrierMixture_->Hf(cid);
431 case phaseProperties::LIQUID:
435 HcMixture += Y[i]*thermo_.liquids().properties()[i].Hf();
439 case phaseProperties::SOLID:
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())
472 case phaseProperties::GAS:
477 CpMixture += Y[i]*carrierMixture_->Cp(cid, p, T);
481 case phaseProperties::LIQUID:
485 CpMixture += Y[i]*thermo_.liquids().properties()[i].Cp(p, T);
489 case phaseProperties::SOLID:
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())
522 case phaseProperties::GAS:
527 <<
"No support for gaseous components" <<
endl;
531 case phaseProperties::LIQUID:
535 LMixture += Y[i]*thermo_.liquids().properties()[i].hl(p, T);
539 case phaseProperties::SOLID:
544 <<
"No support for solid components" <<
endl;
551 <<
"Unknown phase enumeration" virtual scalar L(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return latent heat for the phase phaseI.
bool isA(const Type &t)
Check if a dynamic_cast to typeid is possible.
#define forAll(list, i)
Loop across all elements in list.
fluidReactionThermo & thermo
const phasePropertiesList & phaseProps() const
Return the list of phase properties.
CompositionModel(CloudType &owner)
Construct null from owner.
A list of keyword definitions, which are a keyword followed by any number of values (e...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package, and provides:
Helper class to manage multi-specie phase properties.
To & refCast(From &r)
Reference type cast template function.
void size(const label)
Override size to be inconsistent with allocated storage.
const scalarField & Y0(const label phaseI) const
Return the list of phase phaseI mass fractions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
scalarField X(const label phaseI, const scalarField &Y) const
Return the list of phase phaseI volume fractions fractions.
virtual scalar Hs(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return sensible enthalpy for the phase phaseI.
const parcelThermo & thermo() const
Return the thermo database.
label localToCarrierId(const label phaseI, const label id, const bool allowNotFound=false) const
Return carrier id of component given local id.
virtual scalar H(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return total enthalpy for the phase phaseI.
Base class for cloud sub-models.
virtual scalar Cp(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return specific heat capacity for the phase phaseI.
Specialisation of basicMixture for a mixture consisting of a number for molecular species...
const wordList & phaseTypes() const
Return the list of phase type names.
A class for handling words, derived from string.
label carrierId(const label speciei) const
Return the carrier id for a given specie.
errorManip< error > abort(error &err)
phaseType phase() const
Return const access to the phase type.
Simple container for a list of phase properties.
label nPhase() const
Return the number of phases.
#define WarningInFunction
Report a warning using Foam::Warning.
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
virtual ~CompositionModel()
Destructor.
label localId(const label phaseI, const word &cmptName, const bool allowNotFound=false) const
Return local id of component cmptName in phase phaseI.
const wordList & stateLabels() const
Return the list of state labels (s), (l), (g) etc.
Templated reacting parcel composition model class Consists of carrier species (via thermo package)...
virtual scalar Hc(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return chemical enthalpy for the phase phaseI.
Templated base class for dsmc cloud.
const basicSpecieMixture & carrier() const
Return the carrier components (wrapper function)
const wordList & componentNames(const label phaseI) const
Return the list of component names for phaseI.
label carrierId(const word &cmptName, const bool allowNotFound=false) const
Return global id of component cmptName in carrier thermo.
const liquidMixtureProperties & liquids() const
Return the global (additional) liquids.
const solidMixtureProperties & solids() const
Return the global (additional) solids.