Go to the documentation of this file.
38 { phaseType::GAS,
"gas" },
39 { phaseType::LIQUID,
"liquid" },
40 { phaseType::SOLID,
"solid" },
41 { phaseType::UNKNOWN,
"unknown" },
47 void Foam::phaseProperties::reorder(
const wordList& specieNames)
58 List<word> names0(names_);
65 if (names_.size() != names0.size())
78 if (names_[j] == names0[i])
89 <<
"Could not find specie " << names0[i]
90 <<
" in list " << names_
98 void Foam::phaseProperties::setCarrierIds
109 if (carrierNames[j] == names_[i])
115 if (carrierIds_[i] == -1)
118 <<
"Could not find carrier specie " << names_[i]
119 <<
" in species list" <<
nl
120 <<
"Available species are: " <<
nl << carrierNames <<
nl
127 void Foam::phaseProperties::checkTotalMassFraction()
const
130 for (
const scalar&
val : Y_)
135 if (Y_.size() &&
mag(total - 1.0) > SMALL)
138 <<
"Specie fractions must total to unity for phase "
139 << phaseTypeNames[phase_] <<
nl
146 Foam::word Foam::phaseProperties::phaseToStateLabel(
const phaseType pt)
const
168 <<
"Invalid phase: " << phaseTypeNames[pt] <<
nl
169 <<
" phase must be gas, liquid or solid" <<
nl
184 stateLabel_(
"(unknown)"),
194 stateLabel_(pp.stateLabel_),
197 carrierIds_(pp.carrierIds_)
203 void Foam::phaseProperties::reorder
218 setCarrierIds(gasNames);
227 setCarrierIds(gasNames);
242 <<
"Invalid phase: " << phaseTypeNames[phase_] <<
nl
243 <<
" phase must be gas, liquid or solid" <<
nl
265 return phaseTypeNames[phase_];
277 if (speciei >= names_.size())
280 <<
"Requested specie " << speciei <<
"out of range" <<
nl
281 <<
"Available phase species:" <<
nl << names_ <<
nl
285 return names_[speciei];
297 if (speciei >= Y_.size())
300 <<
"Requested specie " << speciei <<
"out of range" <<
nl
301 <<
"Available phase species:" <<
nl << names_ <<
nl
317 return names_.find(specieName);
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
label ListType::const_reference val
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
static const Enum< phaseType > phaseTypeNames
Corresponding word representations for phase type enumerations.
A class for handling words, derived from Foam::string.
word phaseTypeName() const
Return word representation of the phase type.
Helper class to manage multi-specie phase properties.
label id(const word &specieName) const
Return the id of a specie in the local list by name.
#define forAll(list, i)
Loop across all elements in list.
const labelList & carrierIds() const
Return const access to the map to the carrier ids.
const List< word > & names() const
Return the list of specie names.
List< word > wordList
A List of words.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
phaseProperties()
Null constructor.
errorManipArg< error, int > exit(error &err, const int errNo=1)
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
FlatOutput< Container > flatOutput(const Container &obj, label len=0)
Global flatOutput function.
phaseType
Phase type enumeration.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
const word & stateLabel() const
Return const access to the phase state label.
phaseType phase() const
Return const access to the phase type.
scalarList Y0(nSpecie, Zero)
void setSize(const label newSize)
Alias for resize(const label)
const wordList solidNames(rp["solid"])
const word & name(const label speciei) const
Return const access to a specie name.
const scalarField & Y() const
Return const access to all specie mass fractions.