33template<
class CloudType>
42template<
class CloudType>
54 this->coeffDict().
lookup(
"phases"),
57 thermo_.
solids().components()
62template<
class CloudType>
70 phaseProps_(cm.phaseProps_)
76template<
class CloudType>
83template<
class CloudType>
90template<
class CloudType>
94 return thermo_.carrier();
98template<
class CloudType>
102 return thermo_.liquids();
106template<
class CloudType>
110 return thermo_.solids();
114template<
class CloudType>
122template<
class CloudType>
125 return phaseProps_.
size();
129template<
class CloudType>
133 if (phaseProps_.size() == 1)
135 return phaseProps_[0].names();
139 return phaseProps_.phaseTypes();
144template<
class CloudType>
147 return phaseProps_.stateLabels();
151template<
class CloudType>
155 return phaseProps_[
phasei].names();
159template<
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()
181template<
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
202template<
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
224template<
class CloudType>
230 return phaseProps_[
phasei].Y();
234template<
class CloudType>
244 switch (props.
phase())
251 X[i] =
Y[i]/thermo_.carrier().W(cid);
260 X[i] =
Y[i]/thermo_.liquids().properties()[i].W();
269 X[i] =
Y[i]/thermo_.solids().properties()[i].W();
281template<
class CloudType>
291 scalar HMixture = 0.0;
292 switch (props.
phase())
299 HMixture +=
Y[i]*thermo_.carrier().Ha(cid,
p,
T);
307 HMixture +=
Y[i]*thermo_.liquids().properties()[i].h(
p,
T);
319 + thermo_.solids().properties()[i].Cp()*
T
335template<
class CloudType>
345 scalar HsMixture = 0.0;
346 switch (props.
phase())
353 HsMixture +=
Y[i]*thermo_.carrier().Hs(cid,
p,
T);
365 - thermo_.liquids().properties()[i].h(
p, 298.15)
374 HsMixture +=
Y[i]*thermo_.solids().properties()[i].Cp()*
T;
381 <<
"Unknown phase enumeration"
390template<
class CloudType>
399 const phaseProperties& props = phaseProps_[
phasei];
400 scalar HcMixture = 0.0;
401 switch (props.phase())
407 label cid = props.carrierIds()[i];
408 HcMixture +=
Y[i]*thermo_.carrier().Hc(cid);
417 Y[i]*thermo_.liquids().properties()[i].h(
p, 298.15);
425 HcMixture +=
Y[i]*thermo_.solids().properties()[i].Hf();
432 <<
"Unknown phase enumeration"
441template<
class CloudType>
450 const phaseProperties& props = phaseProps_[
phasei];
451 scalar CpMixture = 0.0;
452 switch (props.phase())
458 label cid = props.carrierIds()[i];
459 CpMixture +=
Y[i]*thermo_.carrier().Cp(cid,
p,
T);
467 CpMixture +=
Y[i]*thermo_.liquids().properties()[i].Cp(
p,
T);
475 CpMixture +=
Y[i]*thermo_.solids().properties()[i].Cp();
482 <<
"Unknown phase enumeration"
491template<
class CloudType>
500 const phaseProperties& props = phaseProps_[
phasei];
501 scalar LMixture = 0.0;
502 switch (props.phase())
509 <<
"No support for gaseous components" <<
endl;
517 LMixture +=
Y[i]*thermo_.liquids().properties()[i].hl(
p,
T);
526 <<
"No support for solid components" <<
endl;
533 <<
"Unknown phase enumeration"
542template<
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);
Base class for cloud sub-models.
const CloudType & owner() const
Return const access to the owner cloud.
CloudSubModelBase(CloudType &owner)
Construct null from owner cloud.
Templated reacting parcel composition model class Consists of carrier species (via thermo package),...
const liquidMixtureProperties & liquids() const
Return the global (additional) liquids.
virtual label idLiquid() const =0
Liquid id.
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.
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.
virtual const scalarField & YMixture0() const =0
Return the list of mixture mass fractions.
CompositionModel(CloudType &owner)
Construct null from owner.
const phasePropertiesList & phaseProps() const
Return the list of phase properties.
tmp< scalarField > X(const label phaseI, const scalarField &Y) const
Return the list of phase phaseI volume fractions fractions.
const basicSpecieMixture & carrier() const
Return the carrier components (wrapper function).
const SLGThermo & thermo() const
Return the thermo database.
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.
virtual label idSolid() const =0
Solid id.
virtual label idGas() const =0
Gas id.
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.
Thermo package for (S)olids (L)iquids and (G)ases Takes reference to thermo package,...
void size(const label n)
Older name for setAddressableSize.
Specialization of basicMultiComponentMixture for a mixture consisting of a number for molecular speci...
virtual tmp< volScalarField > W() const =0
Molecular weight [kg/kmol].
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Simple container for a list of phase properties.
label size() const
Return the size (number of phases).
Helper class to manage multi-specie phase properties.
const labelList & carrierIds() const
Return const access to the map to the carrier ids.
phaseType phase() const
Return const access to the phase type.
virtual tmp< volScalarField > rho() const
Density [kg/m^3] - uses current value of pressure.
Lookup type of boundary radiation properties.
const dictionary & coeffDict() const
Return const access to the coefficients dictionary.
const dictionary & properties() const
Return const access to the properties dictionary.
const dictionary & dict() const
Return const access to the cloud dictionary.
Basic thermodynamics type based on the use of fitting functions for cp, h, s obtained from the templa...
A class for managing temporary objects.
A class for handling words, derived from Foam::string.
PtrList< volScalarField > & Y
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
Namespace for handling debugging switches.
List< word > wordList
List of word.
DSMCCloud< dsmcParcel > CloudType
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
const word GlobalIOList< Tuple2< scalar, vector > >::typeName("scalarVectorTable")
Ostream & endl(Ostream &os)
Add newline and flush stream.
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).
psiReactionThermo & thermo
#define forAll(list, i)
Loop across all elements in list.