42 void Foam::phaseProperties::reorder(
const wordList& specieNames)
53 List<word> names0(names_);
60 if (names_.
size() != names0.size())
74 if (names_[j] == names0[i])
85 <<
"Could not find specie " << names0[i]
86 <<
" in list " << names_
94 void Foam::phaseProperties::setCarrierIds
105 if (carrierNames[j] == names_[i])
115 void Foam::phaseProperties::checkTotalMassFraction()
const
120 total += Y_[speciei];
123 if (Y_.size() != 0 &&
mag(total - 1.0) > small)
126 <<
"Specie fractions must total to unity for phase "
127 << phaseTypeNames[phase_] <<
nl
128 <<
"Species: " <<
nl << names_ <<
nl
134 Foam::word Foam::phaseProperties::phaseToStateLabel(
const phaseType pt)
const
136 word state =
"(unknown)";
157 <<
"Invalid phase: " << phaseTypeNames[pt] <<
nl
158 <<
" phase must be gas, liquid or solid" <<
nl
172 stateLabel_(
"(unknown)"),
187 void Foam::phaseProperties::reorder
202 setCarrierIds(gasNames);
211 setCarrierIds(gasNames);
220 setCarrierIds(gasNames);
226 <<
"Invalid phase: " << phaseTypeNames[phase_] <<
nl
227 <<
" phase must be gas, liquid or solid" <<
nl
248 return phaseTypeNames[phase_];
260 if (speciei >= names_.size())
263 <<
"Requested specie " << speciei <<
"out of range" <<
nl
264 <<
"Available phase species:" <<
nl << names_ <<
nl
268 return names_[speciei];
280 if (speciei >= Y_.size())
283 <<
"Requested specie " << speciei <<
"out of range" <<
nl
284 <<
"Available phase species:" <<
nl << names_ <<
nl
294 if (carrierIds_[speciei] == -1)
297 <<
"Could not find specie " << names_[speciei]
298 <<
" in carrier " <<
nl
302 return carrierIds_[speciei];
310 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.
void mag(LagrangianPatchField< scalar > &f, const LagrangianPatchField< Type > &f1)
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)
scalarList Y0(nSpecie, 0.0)