52 void Foam::phaseProperties::reorder(
const wordList& specieNames)
63 List<word> names0(names_);
70 if (names_.
size() != names0.size())
84 if (names_[j] == names0[i])
95 <<
"Could not find specie " << names0[i]
96 <<
" in list " << names_
104 void Foam::phaseProperties::setCarrierIds
115 if (carrierNames[j] == names_[i])
125 void Foam::phaseProperties::checkTotalMassFraction()
const
130 total += Y_[speciei];
133 if (Y_.size() != 0 &&
mag(total - 1.0) > small)
136 <<
"Specie fractions must total to unity for phase "
137 << phaseTypeNames[phase_] <<
nl
138 <<
"Species: " <<
nl << names_ <<
nl
144 Foam::word Foam::phaseProperties::phaseToStateLabel(
const phaseType pt)
const
146 word state =
"(unknown)";
167 <<
"Invalid phase: " << phaseTypeNames[pt] <<
nl
168 <<
" phase must be gas, liquid or solid" <<
nl
182 stateLabel_(
"(unknown)"),
197 void Foam::phaseProperties::reorder
212 setCarrierIds(gasNames);
221 setCarrierIds(gasNames);
230 setCarrierIds(gasNames);
236 <<
"Invalid phase: " << phaseTypeNames[phase_] <<
nl
237 <<
" phase must be gas, liquid or solid" <<
nl
258 return phaseTypeNames[phase_];
270 if (speciei >= names_.size())
273 <<
"Requested specie " << speciei <<
"out of range" <<
nl
274 <<
"Available phase species:" <<
nl << names_ <<
nl
278 return names_[speciei];
290 if (speciei >= Y_.size())
293 <<
"Requested specie " << speciei <<
"out of range" <<
nl
294 <<
"Available phase species:" <<
nl << names_ <<
nl
304 if (carrierIds_[speciei] == -1)
307 <<
"Could not find specie " << names_[speciei]
308 <<
" in carrier " <<
nl
312 return carrierIds_[speciei];
320 if (names_[speciei] == specieName)
#define forAll(list, i)
Loop across all elements in list.
void size(const label)
Override size to be inconsistent with allocated storage.
void setSize(const label)
Reset size of List.
Initialise the NamedEnum HashTable from the static list of names.
static const NamedEnum< phaseType, 4 > phaseTypeNames
Corresponding word representations for phase type enumerations.
const List< word > & names() const
Return the list of specie names.
const word & name(const label speciei) const
Return const access to a specie name.
phaseType
Phase type enumeration.
label carrierId(const label speciei) const
Return the carrier id for a given specie.
phaseProperties()
Null constructor.
phaseType phase() const
Return const access to the phase type.
const scalarField & Y() const
Return const access to all specie mass fractions.
~phaseProperties()
Destructor.
const word & stateLabel() const
Return const access to the phase state label.
label id(const word &specieName) const
Return the id of a specie in the local list by name.
word phaseTypeName() const
Return word representation of the phase type.
A class for handling words, derived from string.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
errorManipArg< error, int > exit(error &err, const int errNo=1)
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.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
ListType reorder(const label size, const typename ListType::value_type &defaultValue, const labelUList &oldToNew, const ListType &lst)
dimensioned< scalar > mag(const dimensioned< Type > &)
scalarList Y0(nSpecie, 0.0)