33 template<
class CloudType>
42 template<
class CloudType>
54 this->coeffDict().
lookup(
"phases"),
55 thermo_.carrier().species(),
56 thermo_.liquids().components(),
57 thermo_.solids().components()
62 template<
class CloudType>
70 phaseProps_(cm.phaseProps_)
76 template<
class CloudType>
83 template<
class CloudType>
90 template<
class CloudType>
94 return thermo_.carrier();
98 template<
class CloudType>
102 return thermo_.liquids();
106 template<
class CloudType>
110 return thermo_.solids();
114 template<
class CloudType>
122 template<
class CloudType>
125 return phaseProps_.size();
129 template<
class CloudType>
133 if (phaseProps_.size() == 1)
135 return phaseProps_[0].names();
139 return phaseProps_.phaseTypes();
144 template<
class CloudType>
147 return phaseProps_.stateLabels();
151 template<
class CloudType>
155 return phaseProps_[
phasei].names();
159 template<
class CloudType>
162 const word& cmptName,
163 const bool allowNotFound
166 label
id = thermo_.carrierId(cmptName);
168 if (
id < 0 && !allowNotFound)
171 <<
"Unable to determine global id for requested component " 172 << cmptName <<
". Available components are " <<
nl 173 << thermo_.carrier().species()
181 template<
class CloudType>
185 const word& cmptName,
186 const bool allowNotFound
189 label
id = phaseProps_[
phasei].id(cmptName);
191 if (
id < 0 && !allowNotFound)
194 <<
"Unable to determine local id for component " << cmptName
202 template<
class CloudType>
207 const bool allowNotFound
210 label cid = phaseProps_[
phasei].carrierIds()[id];
212 if (cid < 0 && !allowNotFound)
215 <<
"Unable to determine global carrier id for phase " 216 <<
phasei <<
" with local id " <<
id 224 template<
class CloudType>
230 return phaseProps_[
phasei].Y();
234 template<
class CloudType>
244 switch (props.
phase())
246 case phaseProperties::GAS:
251 X[i] =
Y[i]/thermo_.carrier().W(cid);
256 case phaseProperties::LIQUID:
260 X[i] =
Y[i]/thermo_.liquids().properties()[i].W();
265 case phaseProperties::SOLID:
269 X[i] =
Y[i]/thermo_.solids().properties()[i].W();
281 template<
class CloudType>
291 scalar HMixture = 0.0;
292 switch (props.
phase())
294 case phaseProperties::GAS:
299 HMixture +=
Y[i]*thermo_.carrier().Ha(cid,
p,
T);
303 case phaseProperties::LIQUID:
307 HMixture +=
Y[i]*thermo_.liquids().properties()[i].h(
p,
T);
311 case phaseProperties::SOLID:
318 thermo_.solids().properties()[i].Hf()
319 + thermo_.solids().properties()[i].Cp()*
T 335 template<
class CloudType>
345 scalar HsMixture = 0.0;
346 switch (props.
phase())
348 case phaseProperties::GAS:
353 HsMixture +=
Y[i]*thermo_.carrier().Hs(cid,
p,
T);
357 case phaseProperties::LIQUID:
364 thermo_.liquids().properties()[i].h(
p,
T)
365 - thermo_.liquids().properties()[i].h(
p, 298.15)
370 case phaseProperties::SOLID:
374 HsMixture +=
Y[i]*thermo_.solids().properties()[i].Cp()*
T;
381 <<
"Unknown phase enumeration" 390 template<
class CloudType>
400 scalar HcMixture = 0.0;
401 switch (props.
phase())
403 case phaseProperties::GAS:
408 HcMixture +=
Y[i]*thermo_.carrier().Hc(cid);
412 case phaseProperties::LIQUID:
417 Y[i]*thermo_.liquids().properties()[i].h(
p, 298.15);
421 case phaseProperties::SOLID:
425 HcMixture +=
Y[i]*thermo_.solids().properties()[i].Hf();
432 <<
"Unknown phase enumeration" 441 template<
class CloudType>
451 scalar CpMixture = 0.0;
452 switch (props.
phase())
454 case phaseProperties::GAS:
459 CpMixture +=
Y[i]*thermo_.carrier().Cp(cid,
p,
T);
463 case phaseProperties::LIQUID:
467 CpMixture +=
Y[i]*thermo_.liquids().properties()[i].Cp(
p,
T);
471 case phaseProperties::SOLID:
475 CpMixture +=
Y[i]*thermo_.solids().properties()[i].Cp();
482 <<
"Unknown phase enumeration" 491 template<
class CloudType>
501 scalar LMixture = 0.0;
502 switch (props.
phase())
504 case phaseProperties::GAS:
509 <<
"No support for gaseous components" <<
endl;
513 case phaseProperties::LIQUID:
517 LMixture +=
Y[i]*thermo_.liquids().properties()[i].hl(
p,
T);
521 case phaseProperties::SOLID:
526 <<
"No support for solid components" <<
endl;
533 <<
"Unknown phase enumeration" 542 template<
class CloudType>
554 const auto& carrier = this->carrier();
561 label cid = phaseProps_[idGas()].carrierIds()[i];
562 Xgas[i] = YMix[idGas()]*Ygas[i]/carrier.W(cid);
569 Xliq[i] = YMix[idLiquid()]*Yliq[i]/
thermo.liquids().properties()[i].W();
576 Xsol[i] = YMix[idSolid()]*Ysol[i]/
thermo.solids().properties()[i].W();
580 Xgas /= (WInv + ROOTVSMALL);
581 Xliq /= (WInv + ROOTVSMALL);
582 Xsol /= (WInv + ROOTVSMALL);
588 label cid = phaseProps_[idGas()].carrierIds()[i];
589 rho += Xgas[i]*carrier.rho(cid,
p,
T);
593 rho += Xliq[i]*
thermo.liquids().properties()[i].rho(
p,
T);
597 rho += Xsol[i]*
thermo.solids().properties()[i].rho();
virtual scalar L(const label phaseI, const scalarField &Y, const scalar p, const scalar T) const
Return latent heat for the phase phaseI.
void size(const label n)
Older name for setAddressableSize.
const SLGThermo & thermo() const
Return the thermo database.
const phasePropertiesList & phaseProps() const
Return the list of phase properties.
virtual scalar rho(const scalarField &Ygas, const scalarField &Yliq, const scalarField &Ysol, const scalar T, const scalar p) const
Return rho of the full composition.
CompositionModel(CloudType &owner)
Construct null from owner.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
A list of keyword definitions, which are a keyword followed by a number of values (eg...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
Helper class to manage multi-specie phase properties.
constexpr char nl
The newline '\n' character (0x0a)
const scalarField & Y0(const label phaseI) const
Return the list of phase phaseI mass fractions.
Ostream & endl(Ostream &os)
Add newline and flush stream.
tmp< 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.
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.
Specialization of basicMultiComponentMixture for a mixture consisting of a number for molecular speci...
Lookup type of boundary radiation properties.
#define forAll(list, i)
Loop across all elements in list.
psiReactionThermo & thermo
const wordList & phaseTypes() const
Return the list of phase type names.
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package, and provides:
errorManip< error > abort(error &err)
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
const labelList & carrierIds() const
Return const access to the map to the carrier ids.
phaseType phase() const
Return const access to the phase type.
int debug
Static debugging option.
Simple container for a list of phase properties.
label nPhase() const
Return the number of phases.
#define WarningInFunction
Report a warning using Foam::Warning.
PtrList< volScalarField > & Y
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.
A class for managing temporary objects.
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.