39 { phaseType::GAS,
"gas" },
40 { phaseType::LIQUID,
"liquid" },
41 { phaseType::SOLID,
"solid" },
42 { phaseType::UNKNOWN,
"unknown" },
48 void Foam::phaseProperties::reorder(
const wordList& specieNames)
59 List<word> names0(names_);
66 if (names_.
size() != names0.size())
79 if (names_[j] == names0[i])
90 <<
"Could not find specie " << names0[i]
91 <<
" in list " << names_
99 void 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 128 void 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 147 Foam::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)"),
194 void Foam::phaseProperties::reorder
209 setCarrierIds(gasNames);
218 setCarrierIds(gasNames);
233 <<
"Invalid phase: " << phaseTypeNames[phase_] <<
nl 234 <<
" phase must be gas, liquid or solid" <<
nl 256 return phaseTypeNames[phase_];
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);
const word & stateLabel() const
Return const access to the phase state label.
void size(const label n)
Older name for setAddressableSize.
scalarList Y0(nSpecie, Zero)
errorManipArg< error, int > exit(error &err, const int errNo=1)
label id(const word &specieName) const
Return the id of a specie in the local list by name.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
constexpr char nl
The newline '\n' character (0x0a)
const scalarField & Y() const
Return const access to all specie mass fractions.
const wordList solidNames(rp["solid"])
static const Enum< phaseType > phaseTypeNames
Corresponding word representations for phase type enumerations.
#define forAll(list, i)
Loop across all elements in list.
void setSize(const label n)
Alias for resize()
A class for handling words, derived from Foam::string.
Field< scalar > scalarField
Specialisation of Field<T> for scalar.
phaseType
Phase type enumeration.
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.
phaseType phase() const
Return const access to the phase type.
const word & name(const label speciei) const
Return const access to a specie name.
List< word > wordList
List of word.
#define WarningInFunction
Report a warning using Foam::Warning.
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
phaseProperties()
Default construct, as 'UNKNOWN' state.
ListType reorder(const labelUList &oldToNew, const ListType &input, const bool prune=false)
Reorder the elements of a list.
word phaseTypeName() const
Return word representation of the phase type.
FlatOutput::OutputAdaptor< Container, Delimiters > flatOutput(const Container &obj, Delimiters delim)
Global flatOutput() function with specified output delimiters.