39 { phaseType::GAS,
"gas" },
40 { phaseType::LIQUID,
"liquid" },
41 { phaseType::SOLID,
"solid" },
42 { phaseType::UNKNOWN,
"unknown" },
48void Foam::phaseProperties::reorder(
const wordList& specieNames)
59 List<word> names0(names_);
66 if (names_.size() != names0.size())
68 Y_.setSize(names_.size());
79 if (names_[j] == names0[i])
90 <<
"Could not find specie " << names0[i]
91 <<
" in list " << names_
99void Foam::phaseProperties::setCarrierIds
110 if (carrierNames[j] == names_[i])
116 if (carrierIds_[i] == -1)
119 <<
"Could not find carrier specie " << names_[i]
120 <<
" in species list" <<
nl
121 <<
"Available species are: " <<
nl << carrierNames <<
nl
128void Foam::phaseProperties::checkTotalMassFraction()
const
131 for (
const scalar& val : Y_)
136 if (Y_.size() &&
mag(total - 1.0) > SMALL)
139 <<
"Specie fractions must total to unity for phase "
140 << phaseTypeNames[phase_] <<
nl
147Foam::word Foam::phaseProperties::phaseToStateLabel(
const phaseType pt)
const
169 <<
"Invalid phase: " << phaseTypeNames[pt] <<
nl
170 <<
" phase must be gas, liquid or solid" <<
nl
185 stateLabel_(
"(unknown)"),
194void Foam::phaseProperties::reorder
209 setCarrierIds(gasNames);
218 setCarrierIds(gasNames);
233 <<
"Invalid phase: " << phaseTypeNames[phase_] <<
nl
234 <<
" phase must be gas, liquid or solid" <<
nl
268 if (speciei >= names_.size())
271 <<
"Requested specie " << speciei <<
"out of range" <<
nl
272 <<
"Available phase species:" <<
nl << names_ <<
nl
276 return names_[speciei];
288 if (speciei >= Y_.size())
291 <<
"Requested specie " << speciei <<
"out of range" <<
nl
292 <<
"Available phase species:" <<
nl << names_ <<
nl
308 return names_.
find(specieName);
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
label find(const T &val) const
Find index of the first occurrence of the value.
static const Enum< phaseType > phaseTypeNames
Corresponding word representations for phase type enumerations.
const List< word > & names() const
Return the list of specie names.
const labelList & carrierIds() const
Return const access to the map to the carrier ids.
const word & name(const label speciei) const
Return const access to a specie name.
phaseType
Phase type enumeration.
phaseProperties()
Default construct, as 'UNKNOWN' state.
phaseType phase() const
Return const access to the phase type.
const scalarField & Y() const
Return const access to all specie mass fractions.
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 Foam::string.
const wordList solidNames(rp["solid"])
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
#define WarningInFunction
Report a warning using Foam::Warning.
List< word > wordList
List of word.
List< label > labelList
A List of labels.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
errorManipArg< error, int > exit(error &err, const int errNo=1)
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
constexpr char nl
The newline '\n' character (0x0a).
scalarList Y0(nSpecie, Zero)
#define forAll(list, i)
Loop across all elements in list.