31 template<
class CloudType>
35 carrierThermo_(owner.carrierThermo()),
47 template<
class CloudType>
56 carrierThermo_(owner.carrierThermo()),
66 this->coeffDict().lookup(
"phases"),
67 carrierMcThermoPtr_ == nullptr
69 : carrierMcThermoPtr_->species(),
70 thermo_.liquids().components(),
71 thermo_.solids().components()
76 template<
class CloudType>
83 carrierThermo_(cm.carrierThermo_),
84 carrierMcThermoPtr_(cm.carrierMcThermoPtr_),
86 phaseProps_(cm.phaseProps_)
92 template<
class CloudType>
99 template<
class CloudType>
106 template<
class CloudType>
110 if (carrierMcThermoPtr_ ==
nullptr)
113 <<
"carrier requested, but object is not allocated"
117 return *carrierMcThermoPtr_;
121 template<
class CloudType>
125 return thermo_.liquids();
129 template<
class CloudType>
133 return thermo_.solids();
137 template<
class CloudType>
145 template<
class CloudType>
148 return phaseProps_.size();
152 template<
class CloudType>
156 if (phaseProps_.size() == 1)
158 return phaseProps_[0].names();
162 return phaseProps_.phaseTypes();
167 template<
class CloudType>
170 return phaseProps_.stateLabels();
174 template<
class CloudType>
178 return phaseProps_[phasei].names();
182 template<
class CloudType>
185 const word& cmptName,
186 const bool allowNotFound
191 forAll(carrierMcThermoPtr_->species(), i)
193 if (cmptName == carrierMcThermoPtr_->species()[i])
199 if (
id < 0 && !allowNotFound)
202 <<
"Unable to determine global id for requested component "
203 << cmptName <<
". Available components are " <<
nl
204 << carrierMcThermoPtr_->species()
212 template<
class CloudType>
216 const word& cmptName,
217 const bool allowNotFound
220 label id = phaseProps_[phasei].id(cmptName);
222 if (
id < 0 && !allowNotFound)
225 <<
"Unable to determine local id for component " << cmptName
233 template<
class CloudType>
238 const bool allowNotFound
241 label cid = phaseProps_[phasei].carrierId(
id);
243 if (cid < 0 && !allowNotFound)
246 <<
"Unable to determine global carrier id for phase "
247 << phasei <<
" with local id " <<
id
255 template<
class CloudType>
261 return phaseProps_[phasei].Y();
265 template<
class CloudType>
275 switch (props.
phase())
282 X[i] =
Y[i]/carrierMcThermoPtr_->WiValue(cid);
291 X[i] =
Y[i]/thermo_.liquids().properties()[i].W();
299 <<
"Only possible to convert gas and liquid mass fractions"
310 template<
class CloudType>
320 scalar HMixture = 0.0;
321 switch (props.
phase())
328 HMixture +=
Y[i]*carrierMcThermoPtr_->hai(cid,
p,
T);
336 HMixture +=
Y[i]*thermo_.liquids().properties()[i].ha(
p,
T);
344 HMixture +=
Y[i]*thermo_.solids().properties()[i].ha(
T);
359 template<
class CloudType>
369 scalar hsMixture = 0.0;
370 switch (props.
phase())
377 hsMixture +=
Y[i]*carrierMcThermoPtr_->hsi(cid,
p,
T);
386 Y[i]*(thermo_.liquids().properties()[i].hs(
p,
T));
394 hsMixture +=
Y[i]*thermo_.solids().properties()[i].hs(
T);
401 <<
"Unknown phase enumeration"
410 template<
class CloudType>
420 scalar CpMixture = 0.0;
421 switch (props.
phase())
428 CpMixture +=
Y[i]*carrierMcThermoPtr_->Cpi(cid,
p,
T);
436 CpMixture +=
Y[i]*thermo_.liquids().properties()[i].Cp(
p,
T);
444 CpMixture +=
Y[i]*thermo_.solids().properties()[i].Cp();
451 <<
"Unknown phase enumeration"
460 template<
class CloudType>
470 scalar LMixture = 0.0;
471 switch (props.
phase())
478 <<
"No support for gaseous components" <<
endl;
486 LMixture +=
Y[i]*thermo_.liquids().properties()[i].hl(
p,
T);
495 <<
"No support for solid components" <<
endl;
502 <<
"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.
const wordList & stateLabels() const
Return the list of state labels (s), (l), (g) etc.
CompositionModel(CloudType &owner)
Construct null from owner.
virtual scalar ha(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return total enthalpy for the phase phaseI.
const phasePropertiesList & phaseProps() const
Return the list of phase properties.
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 fluidMulticomponentThermo & carrier() const
Return the carrier components (wrapper function)
const wordList & componentNames(const label phaseI) const
Return the list of component names for phaseI.
label nPhase() const
Return the number of phases.
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.
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.
virtual scalar hs(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return sensible enthalpy for the 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.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Base-class for multi-component fluid thermodynamic properties.
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