Cantera  2.3.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | List of all members
Phase Class Reference

Class Phase is the base class for phases of matter, managing the species and elements in a phase, as well as the independent variables of temperature, mass density, species mass/mole fraction, and other generalized forces and intrinsic properties (such as electric potential) that define the thermodynamic state. More...

#include <Phase.h>

Inheritance diagram for Phase:
[legend]
Collaboration diagram for Phase:
[legend]

Public Member Functions

 Phase ()
 Default constructor. More...
 
 Phase (const Phase &right)
 
Phaseoperator= (const Phase &right)
 
XML_Nodexml () const
 Returns a const reference to the XML_Node that describes the phase. More...
 
void setXMLdata (XML_Node &xmlPhase)
 Stores the XML tree information for the current phase. More...
 
void saveState (vector_fp &state) const
 Save the current internal state of the phase. More...
 
void saveState (size_t lenstate, doublereal *state) const
 Write to array 'state' the current internal state. More...
 
void restoreState (const vector_fp &state)
 Restore a state saved on a previous call to saveState. More...
 
void restoreState (size_t lenstate, const doublereal *state)
 Restore the state of the phase from a previously saved state vector. More...
 
doublereal molecularWeight (size_t k) const
 Molecular weight of species k. More...
 
void getMolecularWeights (vector_fp &weights) const
 Copy the vector of molecular weights into vector weights. More...
 
void getMolecularWeights (doublereal *weights) const
 Copy the vector of molecular weights into array weights. More...
 
const vector_fpmolecularWeights () const
 Return a const reference to the internal vector of molecular weights. More...
 
doublereal size (size_t k) const
 This routine returns the size of species k. More...
 
doublereal charge (size_t k) const
 Dimensionless electrical charge of a single molecule of species k The charge is normalized by the the magnitude of the electron charge. More...
 
doublereal chargeDensity () const
 Charge density [C/m^3]. More...
 
size_t nDim () const
 Returns the number of spatial dimensions (1, 2, or 3) More...
 
void setNDim (size_t ndim)
 Set the number of spatial dimensions (1, 2, or 3). More...
 
virtual bool ready () const
 Returns a bool indicating whether the object is ready for use. More...
 
int stateMFNumber () const
 Return the State Mole Fraction Number. More...
 
virtual void invalidateCache ()
 Invalidate any cached values which are normally updated only when a change in state is detected. More...
 
Name and ID

Class Phase contains two strings that identify a phase. The ID is the value of the ID attribute of the XML phase node that is used to initialize a phase when it is read. The name field is also initialized to the value of the ID attribute of the XML phase node.

However, the name field may be changed to another value during the course of a calculation. For example, if a phase is located in two places, but has the same constitutive input, the IDs of the two phases will be the same, but the names of the two phases may be different.

It is an error to have two phases in a single problem with the same name and ID (or the name from one phase being the same as the id of another phase). Thus, it is expected that there is a 1-1 correspondence between names and unique phases within a Cantera problem.

std::string id () const
 Return the string id for the phase. More...
 
void setID (const std::string &id)
 Set the string id for the phase. More...
 
std::string name () const
 Return the name of the phase. More...
 
void setName (const std::string &nm)
 Sets the string name for the phase. More...
 
Element and Species Information
std::string elementName (size_t m) const
 Name of the element with index m. More...
 
size_t elementIndex (const std::string &name) const
 Return the index of element named 'name'. More...
 
const std::vector< std::string > & elementNames () const
 Return a read-only reference to the vector of element names. More...
 
doublereal atomicWeight (size_t m) const
 Atomic weight of element m. More...
 
doublereal entropyElement298 (size_t m) const
 Entropy of the element in its standard state at 298 K and 1 bar. More...
 
int atomicNumber (size_t m) const
 Atomic number of element m. More...
 
int elementType (size_t m) const
 Return the element constraint type Possible types include: More...
 
int changeElementType (int m, int elem_type)
 Change the element type of the mth constraint Reassigns an element type. More...
 
const vector_fpatomicWeights () const
 Return a read-only reference to the vector of atomic weights. More...
 
size_t nElements () const
 Number of elements. More...
 
void checkElementIndex (size_t m) const
 Check that the specified element index is in range. More...
 
void checkElementArraySize (size_t mm) const
 Check that an array size is at least nElements(). More...
 
doublereal nAtoms (size_t k, size_t m) const
 Number of atoms of element m in species k. More...
 
void getAtoms (size_t k, double *atomArray) const
 Get a vector containing the atomic composition of species k. More...
 
size_t speciesIndex (const std::string &name) const
 Returns the index of a species named 'name' within the Phase object. More...
 
std::string speciesName (size_t k) const
 Name of the species with index k. More...
 
std::string speciesSPName (int k) const
 Returns the expanded species name of a species, including the phase name This is guaranteed to be unique within a Cantera problem. More...
 
const std::vector< std::string > & speciesNames () const
 Return a const reference to the vector of species names. More...
 
size_t nSpecies () const
 Returns the number of species in the phase. More...
 
void checkSpeciesIndex (size_t k) const
 Check that the specified species index is in range. More...
 
void checkSpeciesArraySize (size_t kk) const
 Check that an array size is at least nSpecies(). More...
 
Set thermodynamic state

Set the internal thermodynamic state by setting the internally stored temperature, density and species composition. Note that the composition is always set first.

Temperature and density are held constant if not explicitly set.

void setMoleFractionsByName (const compositionMap &xMap)
 Set the species mole fractions by name. More...
 
void setMoleFractionsByName (const std::string &x)
 Set the mole fractions of a group of species by name. More...
 
void setMassFractionsByName (const compositionMap &yMap)
 Set the species mass fractions by name. More...
 
void setMassFractionsByName (const std::string &x)
 Set the species mass fractions by name. More...
 
void setState_TRX (doublereal t, doublereal dens, const doublereal *x)
 Set the internally stored temperature (K), density, and mole fractions. More...
 
void setState_TRX (doublereal t, doublereal dens, const compositionMap &x)
 Set the internally stored temperature (K), density, and mole fractions. More...
 
void setState_TRY (doublereal t, doublereal dens, const doublereal *y)
 Set the internally stored temperature (K), density, and mass fractions. More...
 
void setState_TRY (doublereal t, doublereal dens, const compositionMap &y)
 Set the internally stored temperature (K), density, and mass fractions. More...
 
void setState_TNX (doublereal t, doublereal n, const doublereal *x)
 Set the internally stored temperature (K), molar density (kmol/m^3), and mole fractions. More...
 
void setState_TR (doublereal t, doublereal rho)
 Set the internally stored temperature (K) and density (kg/m^3) More...
 
void setState_TX (doublereal t, doublereal *x)
 Set the internally stored temperature (K) and mole fractions. More...
 
void setState_TY (doublereal t, doublereal *y)
 Set the internally stored temperature (K) and mass fractions. More...
 
void setState_RX (doublereal rho, doublereal *x)
 Set the density (kg/m^3) and mole fractions. More...
 
void setState_RY (doublereal rho, doublereal *y)
 Set the density (kg/m^3) and mass fractions. More...
 
Composition
compositionMap getMoleFractionsByName (double threshold=0.0) const
 Get the mole fractions by name. More...
 
doublereal moleFraction (size_t k) const
 Return the mole fraction of a single species. More...
 
doublereal moleFraction (const std::string &name) const
 Return the mole fraction of a single species. More...
 
compositionMap getMassFractionsByName (double threshold=0.0) const
 Get the mass fractions by name. More...
 
doublereal massFraction (size_t k) const
 Return the mass fraction of a single species. More...
 
doublereal massFraction (const std::string &name) const
 Return the mass fraction of a single species. More...
 
void getMoleFractions (doublereal *const x) const
 Get the species mole fraction vector. More...
 
virtual void setMoleFractions (const doublereal *const x)
 Set the mole fractions to the specified values. More...
 
virtual void setMoleFractions_NoNorm (const doublereal *const x)
 Set the mole fractions to the specified values without normalizing. More...
 
void getMassFractions (doublereal *const y) const
 Get the species mass fractions. More...
 
const doublereal * massFractions () const
 Return a const pointer to the mass fraction array. More...
 
virtual void setMassFractions (const doublereal *const y)
 Set the mass fractions to the specified values and normalize them. More...
 
virtual void setMassFractions_NoNorm (const doublereal *const y)
 Set the mass fractions to the specified values without normalizing. More...
 
void getConcentrations (doublereal *const c) const
 Get the species concentrations (kmol/m^3). More...
 
doublereal concentration (const size_t k) const
 Concentration of species k. More...
 
virtual void setConcentrations (const doublereal *const conc)
 Set the concentrations to the specified values within the phase. More...
 
virtual void setConcentrationsNoNorm (const double *const conc)
 Set the concentrations without ignoring negative concentrations. More...
 
doublereal elementalMassFraction (const size_t m) const
 Elemental mass fraction of element m. More...
 
doublereal elementalMoleFraction (const size_t m) const
 Elemental mole fraction of element m. More...
 
const doublereal * moleFractdivMMW () const
 Returns a const pointer to the start of the moleFraction/MW array. More...
 
Thermodynamic Properties
doublereal temperature () const
 Temperature (K). More...
 
virtual doublereal density () const
 Density (kg/m^3). More...
 
doublereal molarDensity () const
 Molar density (kmol/m^3). More...
 
doublereal molarVolume () const
 Molar volume (m^3/kmol). More...
 
virtual void setDensity (const doublereal density_)
 Set the internally stored density (kg/m^3) of the phase. More...
 
virtual void setMolarDensity (const doublereal molarDensity)
 Set the internally stored molar density (kmol/m^3) of the phase. More...
 
virtual void setTemperature (const doublereal temp)
 Set the internally stored temperature of the phase (K). More...
 
Mean Properties
doublereal mean_X (const doublereal *const Q) const
 Evaluate the mole-fraction-weighted mean of an array Q. More...
 
doublereal mean_X (const vector_fp &Q) const
 Evaluate the mole-fraction-weighted mean of an array Q. More...
 
doublereal meanMolecularWeight () const
 The mean molecular weight. Units: (kg/kmol) More...
 
doublereal sum_xlogx () const
 Evaluate \( \sum_k X_k \log X_k \). More...
 
Adding Elements and Species

These methods are used to add new elements or species.

These are not usually called by user programs.

Since species are checked to insure that they are only composed of declared elements, it is necessary to first add all elements before adding any species.

size_t addElement (const std::string &symbol, doublereal weight=-12345.0, int atomicNumber=0, doublereal entropy298=ENTROPY298_UNKNOWN, int elem_type=CT_ELEM_TYPE_ABSPOS)
 Add an element. More...
 
virtual bool addSpecies (shared_ptr< Species > spec)
 Add a Species to this Phase. More...
 
virtual void modifySpecies (size_t k, shared_ptr< Species > spec)
 Modify the thermodynamic data associated with a species. More...
 
shared_ptr< Speciesspecies (const std::string &name) const
 Return the Species object for the named species. More...
 
shared_ptr< Speciesspecies (size_t k) const
 Return the Species object for species whose index is k. More...
 
void ignoreUndefinedElements ()
 Set behavior when adding a species containing undefined elements to just skip the species. More...
 
void addUndefinedElements ()
 Set behavior when adding a species containing undefined elements to add those elements to the phase. More...
 
void throwUndefinedElements ()
 Set the behavior when adding a species containing undefined elements to throw an exception. More...
 

Protected Member Functions

void setMolecularWeight (const int k, const double mw)
 Set the molecular weight of a single species to a given value. More...
 
virtual void compositionChanged ()
 Apply changes to the state which are needed after the composition changes. More...
 

Protected Attributes

ValueCache m_cache
 Cached for saved calculations within each ThermoPhase. More...
 
size_t m_kk
 Number of species in the phase. More...
 
size_t m_ndim
 Dimensionality of the phase. More...
 
vector_fp m_speciesComp
 Atomic composition of the species. More...
 
vector_fp m_speciesSize
 Vector of species sizes. More...
 
vector_fp m_speciesCharge
 Vector of species charges. length m_kk. More...
 
std::map< std::string, shared_ptr< Species > > m_species
 
UndefElement::behavior m_undefinedElementBehavior
 Flag determining behavior when adding species with an undefined element. More...
 

Private Attributes

XML_Nodem_xml
 XML node containing the XML info for this phase. More...
 
std::string m_id
 ID of the phase. More...
 
std::string m_name
 Name of the phase. More...
 
doublereal m_temp
 Temperature (K). This is an independent variable. More...
 
doublereal m_dens
 Density (kg m-3). More...
 
doublereal m_mmw
 mean molecular weight of the mixture (kg kmol-1) More...
 
vector_fp m_ym
 m_ym[k] = mole fraction of species k divided by the mean molecular weight of mixture. More...
 
vector_fp m_y
 Mass fractions of the species. More...
 
vector_fp m_molwts
 species molecular weights (kg kmol-1) More...
 
vector_fp m_rmolwts
 inverse of species molecular weights (kmol kg-1) More...
 
int m_stateNum
 State Change variable. More...
 
std::vector< std::string > m_speciesNames
 Vector of the species names. More...
 
std::map< std::string, size_t > m_speciesIndices
 Map of species names to indices. More...
 
size_t m_mm
 Number of elements. More...
 
vector_fp m_atomicWeights
 element atomic weights (kg kmol-1) More...
 
vector_int m_atomicNumbers
 element atomic numbers More...
 
std::vector< std::string > m_elementNames
 element names More...
 
vector_int m_elem_type
 Vector of element types. More...
 
vector_fp m_entropy298
 Entropy at 298.15 K and 1 bar of stable state pure elements (J kmol-1) More...
 

Detailed Description

Class Phase is the base class for phases of matter, managing the species and elements in a phase, as well as the independent variables of temperature, mass density, species mass/mole fraction, and other generalized forces and intrinsic properties (such as electric potential) that define the thermodynamic state.

Class Phase provides information about the elements and species in a phase - names, index numbers (location in arrays), atomic or molecular weights, etc. The set of elements must include all those that compose the species, but may include additional elements.

It also stores an array of species molecular weights, which are used to convert between mole and mass representations of the composition. For efficiency in mass/mole conversion, the vector of mass fractions divided by molecular weight \( Y_k/M_k \) is also stored.

Class Phase is not usually used directly. Its primary use is as a base class for class ThermoPhase. It is not generally necessary to overloaded any of class Phase's methods, with the exception of incompressible phases. In that case, the density must be replaced by the pressure as the independent variable and functions such as setMassFraction within class Phase must actually now calculate the density (at constant T and P) instead of leaving it alone as befits an independent variable. This also applies for nearly- incompressible phases or phases which utilize standard states based on a T and P, in which case they need to overload these functions too.

Class Phase contains a number of utility functions that will set the state of the phase in its entirety, by first setting the composition, then the temperature and then the density. An example of this is the function Phase::setState_TRY(double t, double dens, const double* y).

Class Phase contains method for saving and restoring the full internal states of each phase. These are saveState() and restoreState(). These functions operate on a state vector, which is in general of length (2 + nSpecies()). The first two entries of the state vector are temperature and density.

A species name may be referred to via three methods:

The first two methods of naming may not yield a unique species within complicated assemblies of Cantera Phases.

Todo:
  • Make the concept of saving state vectors more general, so that it can handle other cases where there are additional internal state variables, such as the voltage, a potential energy, or a strain field.
  • Specify that the input mole, mass, and volume fraction vectors must sum to one on entry to the set state routines. Non-conforming mole/mass fraction vectors are not thermodynamically consistent. Moreover, unless we do this, the calculation of Jacobians will be altered whenever the treatment of non- conforming mole fractions is changed. Add setState functions corresponding to specifying mole numbers, which is actually what is being done (well one of the options, there are many) when non- conforming mole fractions are input. Note, we realize that most numerical Jacobian and some analytical Jacobians use non-conforming calculations. These can easily be changed to the set mole number setState functions.

Definition at line 96 of file Phase.h.

Constructor & Destructor Documentation

◆ Phase()

Phase ( )

Default constructor.

Definition at line 20 of file Phase.cpp.

Member Function Documentation

◆ xml()

XML_Node & xml ( ) const

Returns a const reference to the XML_Node that describes the phase.

The XML_Node for the phase contains all of the input data used to set up the model for the phase during its initialization.

Definition at line 117 of file Phase.cpp.

References Phase::m_xml.

Referenced by SimpleTransport::initLiquid(), TransportFactory::newTransport(), TransportFactory::setupLiquidTransport(), and TransportFactory::setupSolidTransport().

◆ setXMLdata()

void setXMLdata ( XML_Node xmlPhase)

Stores the XML tree information for the current phase.

This function now stores the complete XML_Node tree as read into the code via a file. This is needed to move around within the XML tree during construction of transport and kinetics mechanisms after copy construction operations.

Parameters
xmlPhaseReference to the XML node corresponding to the phase

Definition at line 122 of file Phase.cpp.

References XML_Node::copy(), Cantera::findXMLPhase(), XML_Node::id(), Phase::m_xml, and XML_Node::root().

Referenced by Cantera::importPhase().

◆ id()

std::string id ( ) const

◆ setID()

void setID ( const std::string &  id)

Set the string id for the phase.

Parameters
idString id of the phase

Definition at line 146 of file Phase.cpp.

References Phase::m_id.

Referenced by FixedChemPotSSTP::FixedChemPotSSTP(), and Cantera::importPhase().

◆ name()

std::string name ( ) const

Return the name of the phase.

Names are unique within a Cantera problem.

Definition at line 151 of file Phase.cpp.

References Phase::m_name.

Referenced by MultiPhase::addPhase(), Cantera::operator<<(), vcs_MultiPhaseEquil::reportCSV(), TransportFactory::setupSolidTransport(), Phase::species(), and Cantera::vcs_Cantera_to_vprob().

◆ setName()

void setName ( const std::string &  nm)

Sets the string name for the phase.

Parameters
nmString name of the phase

Definition at line 156 of file Phase.cpp.

References Phase::m_name.

Referenced by FixedChemPotSSTP::FixedChemPotSSTP(), and Cantera::importPhase().

◆ elementName()

string elementName ( size_t  m) const

◆ elementIndex()

size_t elementIndex ( const std::string &  name) const

Return the index of element named 'name'.

The index is an integer assigned to each element in the order it was added. Returns npos if the specified element is not found.

Parameters
nameName of the element

Definition at line 186 of file Phase.cpp.

References Phase::elementName(), Phase::m_elementNames, Phase::m_mm, and Cantera::npos.

Referenced by Phase::addSpecies(), MultiPhase::init(), WaterSSTP::initThermoXML(), and PDSS_HKFT::LookupGe().

◆ elementNames()

const vector< string > & elementNames ( ) const

Return a read-only reference to the vector of element names.

Definition at line 196 of file Phase.cpp.

References Phase::m_elementNames.

Referenced by IonsFromNeutralVPSSTP::initThermoXML().

◆ atomicWeight()

doublereal atomicWeight ( size_t  m) const

Atomic weight of element m.

Parameters
mElement index

Definition at line 201 of file Phase.cpp.

References Phase::m_atomicWeights.

Referenced by Phase::elementalMassFraction(), ChemEquil::initialize(), and WaterSSTP::initThermoXML().

◆ entropyElement298()

doublereal entropyElement298 ( size_t  m) const

Entropy of the element in its standard state at 298 K and 1 bar.

Parameters
mElement index

Definition at line 206 of file Phase.cpp.

References AssertThrowMsg, AssertTrace, ENTROPY298_UNKNOWN, Phase::m_entropy298, and Phase::m_mm.

Referenced by LatticeSolidPhase::initThermo(), and PDSS_HKFT::LookupGe().

◆ atomicNumber()

int atomicNumber ( size_t  m) const

Atomic number of element m.

Parameters
mElement index

Definition at line 220 of file Phase.cpp.

References Phase::m_atomicNumbers.

Referenced by MultiPhase::addPhase(), and LatticeSolidPhase::initThermo().

◆ elementType()

int elementType ( size_t  m) const

Return the element constraint type Possible types include:

  • CT_ELEM_TYPE_TURNEDOFF -1
  • CT_ELEM_TYPE_ABSPOS 0
  • CT_ELEM_TYPE_ELECTRONCHARGE 1
  • CT_ELEM_TYPE_CHARGENEUTRALITY 2
  • CT_ELEM_TYPE_LATTICERATIO 3
  • CT_ELEM_TYPE_KINETICFROZEN 4
  • CT_ELEM_TYPE_SURFACECONSTRAINT 5
  • CT_ELEM_TYPE_OTHERCONSTRAINT 6

The default is CT_ELEM_TYPE_ABSPOS.

Parameters
mElement index
Returns
the element type

Definition at line 225 of file Phase.cpp.

References Phase::m_elem_type.

Referenced by LatticeSolidPhase::initThermo(), and vcs_VolPhase::transferElementsFM().

◆ changeElementType()

int changeElementType ( int  m,
int  elem_type 
)

Change the element type of the mth constraint Reassigns an element type.

Parameters
mElement index
elem_typeNew elem type to be assigned
Returns
the old element type

Definition at line 230 of file Phase.cpp.

References Phase::m_elem_type.

◆ atomicWeights()

const vector_fp & atomicWeights ( ) const

Return a read-only reference to the vector of atomic weights.

Definition at line 215 of file Phase.cpp.

References Phase::m_atomicWeights.

Referenced by Phase::addSpecies(), and LatticeSolidPhase::initThermo().

◆ nElements()

size_t nElements ( ) const

◆ checkElementIndex()

void checkElementIndex ( size_t  m) const

Check that the specified element index is in range.

Throws an exception if m is greater than nElements()-1

Definition at line 166 of file Phase.cpp.

References Phase::m_mm.

Referenced by Phase::elementalMassFraction(), Phase::elementalMoleFraction(), Phase::elementName(), and Phase::nAtoms().

◆ checkElementArraySize()

void checkElementArraySize ( size_t  mm) const

Check that an array size is at least nElements().

Throws an exception if mm is less than nElements(). Used before calls which take an array pointer.

Definition at line 173 of file Phase.cpp.

References Phase::m_mm.

◆ nAtoms()

doublereal nAtoms ( size_t  k,
size_t  m 
) const

◆ getAtoms()

void getAtoms ( size_t  k,
double *  atomArray 
) const

Get a vector containing the atomic composition of species k.

Parameters
kspecies index
atomArrayvector containing the atomic number in the species. Length: m_mm

Definition at line 244 of file Phase.cpp.

References Phase::m_mm, and Phase::m_speciesComp.

◆ speciesIndex()

size_t speciesIndex ( const std::string &  name) const

◆ speciesName()

string speciesName ( size_t  k) const

Name of the species with index k.

Parameters
kindex of the species

Definition at line 267 of file Phase.cpp.

References Phase::checkSpeciesIndex(), and Phase::m_speciesNames.

Referenced by Reactor::addSensitivitySpeciesEnthalpy(), StFlow::componentName(), Reactor::componentName(), ReactingSurf1D::componentName(), PDSS_ConstVol::constructPDSSFile(), PDSS_HKFT::constructPDSSFile(), PDSS_IonsFromNeutral::constructPDSSFile(), PDSS_SSVol::constructPDSSFile(), MolalityVPSSTP::findCLMIndex(), Phase::getMassFractionsByName(), Phase::getMoleFractionsByName(), MultiPhase::init(), ChemEquil::initialize(), LiquidTransport::initLiquid(), SimpleTransport::initLiquid(), PDSS_HKFT::initThermo(), VPSSMgr_ConstVol::initThermoXML(), VPSSMgr_Water_ConstVol::initThermoXML(), VPSSMgr_Water_HKFT::initThermoXML(), IdealMolalSoln::initThermoXML(), IdealSolidSolnPhase::initThermoXML(), LatticePhase::initThermoXML(), FlowDevice::install(), Kinetics::kineticsSpeciesName(), Phase::modifySpecies(), ThermoPhase::modifySpecies(), HMWSoln::printCoeffs(), MixedSolventElectrolyte::readXMLBinarySpecies(), MargulesVPSSTP::readXMLBinarySpecies(), RedlichKisterVPSSTP::readXMLBinarySpecies(), PhaseCombo_Interaction::readXMLBinarySpecies(), vcs_MultiPhaseEquil::reportCSV(), ThermoPhase::reportCSV(), StFlow::save(), OutletRes1D::save(), ReactingSurf1D::save(), ChemEquil::setInitialMoles(), MolalityVPSSTP::setMolalitiesByName(), Transport::setThermo(), ReactingSurf1D::showSolution(), Phase::speciesSPName(), and ChemEquil::update().

◆ speciesSPName()

std::string speciesSPName ( int  k) const

Returns the expanded species name of a species, including the phase name This is guaranteed to be unique within a Cantera problem.

Parameters
kSpecies index within the phase
Returns
The "phaseName:speciesName" string

Definition at line 292 of file Phase.cpp.

References Phase::m_name, and Phase::speciesName().

◆ speciesNames()

const vector< string > & speciesNames ( ) const

Return a const reference to the vector of species names.

Definition at line 273 of file Phase.cpp.

References Phase::m_speciesNames.

Referenced by IdealMolalSoln::initThermoXML(), SurfPhase::setCoveragesByName(), MolalityVPSSTP::setMolalitiesByName(), and TransportFactory::setupLiquidTransport().

◆ nSpecies()

size_t nSpecies ( ) const
inline

Returns the number of species in the phase.

Definition at line 262 of file Phase.h.

References Phase::m_kk.

Referenced by MultiPhase::addPhase(), Reactor::addSensitivitySpeciesEnthalpy(), InterfaceKinetics::applyVoltageKfwdCorrection(), Kinetics::assignShallowPointers(), MultiPhase::calcElemAbundances(), InterfaceKinetics::checkPartialEquil(), Reactor::componentName(), MultiPhaseEquil::computeReactionSteps(), PDSS_IonsFromNeutral::constructPDSSXML(), MargulesVPSSTP::cp_mole(), SolidTransport::electricalConductivity(), MargulesVPSSTP::enthalpy_mole(), MargulesVPSSTP::entropy_mole(), ChemEquil::equilibrate(), vcs_MultiPhaseEquil::equilibrate_TP(), ThermoPhase::getActivities(), MetalPhase::getChemPotentials(), ImplicitSurfChem::getConcSpecies(), MolalityVPSSTP::getCsvReportData(), ThermoPhase::getCsvReportData(), MetalPhase::getEnthalpy_RT(), MetalPhase::getEntropy_R(), AqueousKinetics::getEquilibriumConstants(), MultiTransport::getMassFluxes(), LTI_Pairwise_Interaction::getMatrixTransProp(), LTI_StefanMaxwell_PPN::getMatrixTransProp(), LTI_MoleFracs::getMixTransProp(), LTI_MassFracs::getMixTransProp(), LTI_Log_MoleFracs::getMixTransProp(), LTI_MoleFracs_ExpT::getMixTransProp(), SolidTransport::getMobilities(), MultiTransport::getMolarFluxes(), MultiPhase::getMoles(), MetalPhase::getStandardChemPotentials(), Cantera::hasChargedSpecies(), GasTransport::init(), LiquidTranInteraction::init(), MultiPhase::init(), ChemEquil::initialize(), DustyGasTransport::initialize(), IonsFromNeutralVPSSTP::initLengths(), VPSSMgr::initLengths(), LiquidTransport::initLiquid(), SimpleTransport::initLiquid(), LatticeSolidPhase::initThermo(), FlowDevice::install(), vcs_MultiPhaseEquil::reportCSV(), ThermoPhase::reportCSV(), ThermoPhase::resetHf298(), StFlow::restore(), Phase::restoreState(), IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN(), Phase::saveState(), Kinetics::selectPhase(), ImplicitSurfChem::setConcSpecies(), MultiPhase::setMoles(), SolidTransport::setParameters(), MultiPhase::setPhaseMoleFractions(), Transport::setThermo(), ReactorBase::setThermoMgr(), TransportFactory::setupLiquidTransport(), TransportFactory::setupSolidTransport(), HighPressureGasTransport::thermalConductivity(), vcs_VolPhase::transferElementsFM(), MultiTransport::update_T(), MixTransport::update_T(), InterfaceKinetics::updateExchangeCurrentQuantities(), AqueousKinetics::updateKc(), InterfaceKinetics::updateMu0(), MultiPhase::uploadMoleFractionsFromPhases(), Cantera::vcs_Cantera_to_vprob(), Cantera::vcs_Cantera_update_vprob(), and HighPressureGasTransport::viscosity().

◆ checkSpeciesIndex()

void checkSpeciesIndex ( size_t  k) const

Check that the specified species index is in range.

Throws an exception if k is greater than nSpecies()-1

Definition at line 278 of file Phase.cpp.

References Phase::m_kk.

Referenced by Phase::concentration(), Phase::massFraction(), Phase::molecularWeight(), Phase::moleFraction(), Phase::nAtoms(), and Phase::speciesName().

◆ checkSpeciesArraySize()

void checkSpeciesArraySize ( size_t  kk) const

Check that an array size is at least nSpecies().

Throws an exception if kk is less than nSpecies(). Used before calls which take an array pointer.

Definition at line 285 of file Phase.cpp.

References Phase::m_kk.

◆ saveState() [1/2]

void saveState ( vector_fp state) const

Save the current internal state of the phase.

Write to vector 'state' the current internal state.

Parameters
stateoutput vector. Will be resized to nSpecies() + 2.

Definition at line 297 of file Phase.cpp.

References Phase::nSpecies().

Referenced by ChemEquil::equilibrate(), ThermoPhase::equilibrate(), ChemEquil::estimateEP_Brinkley(), TransportFactory::newTransport(), ReactorBase::setThermoMgr(), ReactorBase::syncState(), and FlowReactor::updateState().

◆ saveState() [2/2]

void saveState ( size_t  lenstate,
doublereal *  state 
) const

Write to array 'state' the current internal state.

Parameters
lenstatelength of the state array. Must be >= nSpecies()+2
stateoutput vector. Must be of length nSpecies() + 2 or greater.

Definition at line 302 of file Phase.cpp.

References Phase::density(), Phase::getMassFractions(), and Phase::temperature().

◆ restoreState() [1/2]

void restoreState ( const vector_fp state)

Restore a state saved on a previous call to saveState.

Parameters
stateState vector containing the previously saved state.

Definition at line 309 of file Phase.cpp.

References Phase::compositionChanged().

Referenced by ChemEquil::equilibrate(), FlowReactor::evalEqs(), Reactor::evalEqs(), MultiTransport::getMassFluxes(), FlowReactor::getState(), Reactor::getState(), FlowReactor::initialize(), Reactor::initialize(), TransportFactory::newTransport(), and ReactorBase::restoreState().

◆ restoreState() [2/2]

void restoreState ( size_t  lenstate,
const doublereal *  state 
)

Restore the state of the phase from a previously saved state vector.

Parameters
lenstateLength of the state vector
stateVector of state conditions.

Definition at line 315 of file Phase.cpp.

References Phase::nSpecies(), Phase::setDensity(), Phase::setMassFractions_NoNorm(), and Phase::setTemperature().

◆ setMoleFractionsByName() [1/2]

void setMoleFractionsByName ( const compositionMap xMap)

Set the species mole fractions by name.

Species not listed by name in xMap are set to zero.

Parameters
xMapmap from species names to mole fraction values.

Definition at line 368 of file Phase.cpp.

References Phase::m_kk, Phase::m_speciesIndices, and Phase::setMoleFractions().

Referenced by OutletRes1D::setMoleFractions(), Phase::setMoleFractionsByName(), ThermoPhase::setState_RPX(), ThermoPhase::setState_TPX(), Phase::setState_TRX(), MixtureFugacityTP::setStateFromXML(), and ThermoPhase::setStateFromXML().

◆ setMoleFractionsByName() [2/2]

void setMoleFractionsByName ( const std::string &  x)

Set the mole fractions of a group of species by name.

Species which are not listed by name in the composition map are set to zero.

Parameters
xstring x in the form of a composition map

Definition at line 382 of file Phase.cpp.

References Cantera::parseCompString(), and Phase::setMoleFractionsByName().

◆ setMassFractionsByName() [1/2]

void setMassFractionsByName ( const compositionMap yMap)

Set the species mass fractions by name.

Species not listed by name in yMap are set to zero.

Parameters
yMapmap from species names to mass fraction values.

Definition at line 412 of file Phase.cpp.

References Phase::m_kk, Phase::m_speciesIndices, and Phase::setMassFractions().

Referenced by Phase::setMassFractionsByName(), ThermoPhase::setState_RPY(), ThermoPhase::setState_TPY(), Phase::setState_TRY(), MixtureFugacityTP::setStateFromXML(), and ThermoPhase::setStateFromXML().

◆ setMassFractionsByName() [2/2]

void setMassFractionsByName ( const std::string &  x)

Set the species mass fractions by name.

Species not listed by name in x are set to zero.

Parameters
xString containing a composition map

Definition at line 426 of file Phase.cpp.

References Cantera::parseCompString(), and Phase::setMassFractionsByName().

◆ setState_TRX() [1/2]

void setState_TRX ( doublereal  t,
doublereal  dens,
const doublereal *  x 
)

Set the internally stored temperature (K), density, and mole fractions.

Parameters
tTemperature in kelvin
densDensity (kg/m^3)
xvector of species mole fractions, length m_kk

Definition at line 431 of file Phase.cpp.

References Phase::setDensity(), Phase::setMoleFractions(), and Phase::setTemperature().

◆ setState_TRX() [2/2]

void setState_TRX ( doublereal  t,
doublereal  dens,
const compositionMap x 
)

Set the internally stored temperature (K), density, and mole fractions.

Parameters
tTemperature in kelvin
densDensity (kg/m^3)
xComposition Map containing the mole fractions. Species not included in the map are assumed to have a zero mole fraction.

Definition at line 445 of file Phase.cpp.

References Phase::setDensity(), Phase::setMoleFractionsByName(), and Phase::setTemperature().

◆ setState_TRY() [1/2]

void setState_TRY ( doublereal  t,
doublereal  dens,
const doublereal *  y 
)

Set the internally stored temperature (K), density, and mass fractions.

Parameters
tTemperature in kelvin
densDensity (kg/m^3)
yvector of species mass fractions, length m_kk

Definition at line 452 of file Phase.cpp.

References Phase::setDensity(), Phase::setMassFractions(), and Phase::setTemperature().

◆ setState_TRY() [2/2]

void setState_TRY ( doublereal  t,
doublereal  dens,
const compositionMap y 
)

Set the internally stored temperature (K), density, and mass fractions.

Parameters
tTemperature in kelvin
densDensity (kg/m^3)
yComposition Map containing the mass fractions. Species not included in the map are assumed to have a zero mass fraction.

Definition at line 459 of file Phase.cpp.

References Phase::setDensity(), Phase::setMassFractionsByName(), and Phase::setTemperature().

◆ setState_TNX()

void setState_TNX ( doublereal  t,
doublereal  n,
const doublereal *  x 
)

Set the internally stored temperature (K), molar density (kmol/m^3), and mole fractions.

Parameters
tTemperature in kelvin
nmolar density (kmol/m^3)
xvector of species mole fractions, length m_kk

Definition at line 438 of file Phase.cpp.

References Phase::setMolarDensity(), Phase::setMoleFractions(), and Phase::setTemperature().

◆ setState_TR()

void setState_TR ( doublereal  t,
doublereal  rho 
)

Set the internally stored temperature (K) and density (kg/m^3)

Parameters
tTemperature in kelvin
rhoDensity (kg/m^3)

Definition at line 466 of file Phase.cpp.

References Phase::setDensity(), and Phase::setTemperature().

◆ setState_TX()

void setState_TX ( doublereal  t,
doublereal *  x 
)

Set the internally stored temperature (K) and mole fractions.

Parameters
tTemperature in kelvin
xvector of species mole fractions, length m_kk

Definition at line 472 of file Phase.cpp.

References Phase::setMoleFractions(), and Phase::setTemperature().

◆ setState_TY()

void setState_TY ( doublereal  t,
doublereal *  y 
)

Set the internally stored temperature (K) and mass fractions.

Parameters
tTemperature in kelvin
yvector of species mass fractions, length m_kk

Definition at line 478 of file Phase.cpp.

References Phase::setMassFractions(), and Phase::setTemperature().

◆ setState_RX()

void setState_RX ( doublereal  rho,
doublereal *  x 
)

Set the density (kg/m^3) and mole fractions.

Parameters
rhoDensity (kg/m^3)
xvector of species mole fractions, length m_kk

Definition at line 484 of file Phase.cpp.

References Phase::setDensity(), and Phase::setMoleFractions().

◆ setState_RY()

void setState_RY ( doublereal  rho,
doublereal *  y 
)

Set the density (kg/m^3) and mass fractions.

Parameters
rhoDensity (kg/m^3)
yvector of species mass fractions, length m_kk

Definition at line 490 of file Phase.cpp.

References Phase::setDensity(), and Phase::setMassFractions().

◆ molecularWeight()

doublereal molecularWeight ( size_t  k) const

◆ getMolecularWeights() [1/2]

void getMolecularWeights ( vector_fp weights) const

Copy the vector of molecular weights into vector weights.

Parameters
weightsOutput vector of molecular weights (kg/kmol)

Definition at line 502 of file Phase.cpp.

References Phase::molecularWeights().

◆ getMolecularWeights() [2/2]

void getMolecularWeights ( doublereal *  weights) const

Copy the vector of molecular weights into array weights.

Parameters
weightsOutput array of molecular weights (kg/kmol)

Definition at line 507 of file Phase.cpp.

References Phase::molecularWeights().

◆ molecularWeights()

const vector_fp & molecularWeights ( ) const

◆ size()

doublereal size ( size_t  k) const
inline

This routine returns the size of species k.

The meaning and dimensions are model-dependent. For surface phases, the size is the number of sites occupied by one molecule of the species [nondimensional]. For models which utilize the species partial molar volumes, this is the molar volume of the species in its reference state. For other models, this value may have no meaning.

Parameters
kindex of the species
Returns
The size of the species

Definition at line 414 of file Phase.h.

References Phase::m_speciesSize.

Referenced by SurfPhase::addSpecies(), InterfaceKinetics::buildSurfaceArrhenius(), SurfPhase::entropy_mole(), ReactingSurf1D::eval(), SurfPhase::getCoverages(), MolarityIonicVPSSTP::initThermoXML(), PhaseCombo_Interaction::initThermoXML(), SurfPhase::setCoverages(), SurfPhase::setCoveragesNoNorm(), and SurfPhase::standardConcentration().

◆ getMoleFractionsByName()

compositionMap getMoleFractionsByName ( double  threshold = 0.0) const

Get the mole fractions by name.

Parameters
thresholdExclude species with mole fractions less than or equal to this threshold.
Returns
Map of species names to mole fractions

Definition at line 518 of file Phase.cpp.

References Phase::m_kk, Phase::moleFraction(), and Phase::speciesName().

◆ moleFraction() [1/2]

doublereal moleFraction ( size_t  k) const

Return the mole fraction of a single species.

Parameters
kspecies index
Returns
Mole fraction of the species

Definition at line 547 of file Phase.cpp.

References Phase::checkSpeciesIndex(), Phase::m_mmw, and Phase::m_ym.

Referenced by Phase::chargeDensity(), SolidTransport::electricalConductivity(), Phase::elementalMoleFraction(), MaskellSolidSolnPhase::enthalpy_mole(), SurfPhase::entropy_mole(), ChemEquil::equilibrate(), IdealMolalSoln::getActivities(), DebyeHuckel::getActivities(), HMWSoln::getActivities(), MaskellSolidSolnPhase::getActivityCoefficients(), MolalityVPSSTP::getActivityCoefficients(), ConstDensityThermo::getChemPotentials(), MaskellSolidSolnPhase::getChemPotentials(), IdealSolnGasVPSS::getChemPotentials(), RedlichKwongMFTP::getChemPotentials(), IdealMolalSoln::getChemPotentials(), IdealSolidSolnPhase::getChemPotentials(), LatticePhase::getChemPotentials(), IdealGasPhase::getChemPotentials(), DebyeHuckel::getChemPotentials(), HMWSoln::getChemPotentials(), IdealSolidSolnPhase::getChemPotentials_RT(), IdealMolalSoln::getMolalityActivityCoefficients(), Phase::getMoleFractionsByName(), IdealSolnGasVPSS::getPartialMolarEntropies(), RedlichKwongMFTP::getPartialMolarEntropies(), IdealMolalSoln::getPartialMolarEntropies(), IdealSolidSolnPhase::getPartialMolarEntropies(), LatticePhase::getPartialMolarEntropies(), IdealGasPhase::getPartialMolarEntropies(), DebyeHuckel::getPartialMolarEntropies(), HMWSoln::getPartialMolarEntropies(), Phase::moleFraction(), DebyeHuckel::s_update_d2lnMolalityActCoeff_dT2(), DebyeHuckel::s_update_dlnMolalityActCoeff_dP(), DebyeHuckel::s_update_dlnMolalityActCoeff_dT(), DebyeHuckel::s_update_lnMolalityActCoeff(), IdealMolalSoln::s_updateIMS_lnMolalityActCoeff(), HMWSoln::s_updateIMS_lnMolalityActCoeff(), and ChemEquil::setInitialMoles().

◆ moleFraction() [2/2]

doublereal moleFraction ( const std::string &  name) const

Return the mole fraction of a single species.

Parameters
nameString name of the species
Returns
Mole fraction of the species

Definition at line 553 of file Phase.cpp.

References Phase::moleFraction(), Cantera::npos, and Phase::speciesIndex().

◆ getMassFractionsByName()

compositionMap getMassFractionsByName ( double  threshold = 0.0) const

Get the mass fractions by name.

Parameters
thresholdExclude species with mass fractions less than or equal to this threshold.
Returns
Map of species names to mass fractions

Definition at line 530 of file Phase.cpp.

References Phase::m_kk, Phase::massFraction(), and Phase::speciesName().

◆ massFraction() [1/2]

doublereal massFraction ( size_t  k) const

Return the mass fraction of a single species.

Parameters
kspecies index
Returns
Mass fraction of the species

Definition at line 568 of file Phase.cpp.

References Phase::checkSpeciesIndex(), and Phase::m_y.

Referenced by Phase::elementalMassFraction(), and Phase::getMassFractionsByName().

◆ massFraction() [2/2]

doublereal massFraction ( const std::string &  name) const

Return the mass fraction of a single species.

Parameters
nameString name of the species
Returns
Mass Fraction of the species

Definition at line 574 of file Phase.cpp.

References Phase::massFractions(), Cantera::npos, and Phase::speciesIndex().

◆ getMoleFractions()

void getMoleFractions ( doublereal *const  x) const

◆ setMoleFractions()

void setMoleFractions ( const doublereal *const  x)
virtual

Set the mole fractions to the specified values.

There is no restriction on the sum of the mole fraction vector. Internally, the Phase object will normalize this vector before storing its contents.

Parameters
xArray of unnormalized mole fraction values (input). Must have a length greater than or equal to the number of species, m_kk.

Reimplemented in LatticeSolidPhase, and SingleSpeciesTP.

Definition at line 327 of file Phase.cpp.

References Phase::compositionChanged(), Phase::m_kk, Phase::m_mmw, Phase::m_molwts, Phase::m_y, and Phase::m_ym.

Referenced by SingleSpeciesTP::addSpecies(), ChemEquil::calcEmoles(), IonsFromNeutralVPSSTP::compositionChanged(), ChemEquil::equilibrate(), MolalityVPSSTP::setMolalities(), MolalityVPSSTP::setMolalitiesByName(), OutletRes1D::setMoleFractions(), LatticeSolidPhase::setMoleFractions(), Phase::setMoleFractionsByName(), ThermoPhase::setState_PX(), ThermoPhase::setState_RPX(), Phase::setState_RX(), Phase::setState_TNX(), ThermoPhase::setState_TPX(), Phase::setState_TRX(), and Phase::setState_TX().

◆ setMoleFractions_NoNorm()

void setMoleFractions_NoNorm ( const doublereal *const  x)
virtual

Set the mole fractions to the specified values without normalizing.

This is useful when the normalization condition is being handled by some other means, for example by a constraint equation as part of a larger set of equations.

Parameters
xInput vector of mole fractions. Length is m_kk.

Definition at line 359 of file Phase.cpp.

References Phase::compositionChanged(), Cantera::dot(), Phase::m_kk, Phase::m_mmw, Phase::m_molwts, Phase::m_y, and Phase::m_ym.

◆ getMassFractions()

void getMassFractions ( doublereal *const  y) const

◆ massFractions()

const doublereal* massFractions ( ) const
inline

◆ setMassFractions()

void setMassFractions ( const doublereal *const  y)
virtual

Set the mass fractions to the specified values and normalize them.

Parameters
[in]yArray of unnormalized mass fraction values. Length must be greater than or equal to the number of species. The Phase object will normalize this vector before storing its contents.

Reimplemented in LatticeSolidPhase, and SingleSpeciesTP.

Definition at line 387 of file Phase.cpp.

References Phase::compositionChanged(), Phase::m_kk, Phase::m_mmw, Phase::m_rmolwts, Phase::m_y, Phase::m_ym, and Cantera::scale().

Referenced by StFlow::resetBadValues(), Phase::setMassFractionsByName(), ThermoPhase::setState_PY(), ThermoPhase::setState_RPY(), Phase::setState_RY(), ThermoPhase::setState_TPY(), Phase::setState_TRY(), Phase::setState_TY(), and FlowReactor::updateState().

◆ setMassFractions_NoNorm()

void setMassFractions_NoNorm ( const doublereal *const  y)
virtual

Set the mass fractions to the specified values without normalizing.

This is useful when the normalization condition is being handled by some other means, for example by a constraint equation as part of a larger set of equations.

Parameters
yInput vector of mass fractions. Length is m_kk.

Reimplemented in LatticeSolidPhase.

Definition at line 401 of file Phase.cpp.

References Phase::compositionChanged(), Phase::m_kk, Phase::m_mmw, Phase::m_rmolwts, Phase::m_y, and Phase::m_ym.

Referenced by Phase::restoreState(), StFlow::setGas(), StFlow::setGasAtMidpoint(), and Reactor::updateState().

◆ getConcentrations()

void getConcentrations ( doublereal *const  c) const

Get the species concentrations (kmol/m^3).

Parameters
[out]cThe vector of species concentrations. Units are kmol/m^3. The length of the vector must be greater than or equal to the number of species within the phase.

Definition at line 595 of file Phase.cpp.

Referenced by InterfaceKinetics::_update_rates_C(), ImplicitSurfChem::getConcSpecies(), SurfPhase::getCoverages(), SimpleTransport::update_C(), and LiquidTransport::update_C().

◆ concentration()

doublereal concentration ( const size_t  k) const

Concentration of species k.

If k is outside the valid range, an exception will be thrown.

Parameters
[in]kIndex of the species within the phase.
Returns
the concentration of species k (kmol m-3).

Definition at line 589 of file Phase.cpp.

References Phase::checkSpeciesIndex(), Phase::m_dens, Phase::m_rmolwts, and Phase::m_y.

Referenced by SurfPhase::entropy_mole().

◆ setConcentrations()

void setConcentrations ( const doublereal *const  conc)
virtual

Set the concentrations to the specified values within the phase.

We set the concentrations here and therefore we set the overall density of the phase. We hold the temperature constant during this operation. Therefore, we have possibly changed the pressure of the phase by calling this routine.

Parameters
[in]concArray of concentrations in dimensional units. For bulk phases c[k] is the concentration of the kth species in kmol/m3. For surface phases, c[k] is the concentration in kmol/m2. The length of the vector is the number of species in the phase.

Reimplemented in LatticeSolidPhase.

Definition at line 600 of file Phase.cpp.

References Phase::compositionChanged(), Phase::m_kk, Phase::m_mmw, Phase::m_molwts, Phase::m_y, Phase::m_ym, and Phase::setDensity().

Referenced by ImplicitSurfChem::setConcSpecies(), and SurfPhase::setCoverages().

◆ setConcentrationsNoNorm()

void setConcentrationsNoNorm ( const double *const  conc)
virtual

Set the concentrations without ignoring negative concentrations.

Definition at line 620 of file Phase.cpp.

References Phase::compositionChanged(), Phase::m_kk, Phase::m_mmw, Phase::m_molwts, Phase::m_y, Phase::m_ym, and Phase::setDensity().

Referenced by SurfPhase::setCoveragesNoNorm().

◆ elementalMassFraction()

doublereal elementalMassFraction ( const size_t  m) const

Elemental mass fraction of element m.

The elemental mass fraction \(Z_{\mathrm{mass},m}\) of element \(m\) is defined as

\[ Z_{\mathrm{mass},m} = \sum_k \frac{a_{m,k} M_m}{M_k} Y_k \]

with \(a_{m,k}\) being the number of atoms of element \(m\) in species \(k\), \(M_m\) the atomic weight of element \(m\), \(M_k\) the molecular weight of species \(k\), and \(Y_k\) the mass fraction of species \(k\).

Parameters
[in]mIndex of the element within the phase. If m is outside the valid range, an exception will be thrown.
Returns
the elemental mass fraction of element m.

Definition at line 637 of file Phase.cpp.

References Phase::atomicWeight(), Phase::checkElementIndex(), Phase::m_kk, Phase::massFraction(), Phase::molecularWeight(), and Phase::nAtoms().

◆ elementalMoleFraction()

doublereal elementalMoleFraction ( const size_t  m) const

Elemental mole fraction of element m.

The elemental mole fraction \(Z_{\mathrm{mole},m}\) of element \(m\) is the number of atoms of element m divided by the total number of atoms. It is defined as:

\[ Z_{\mathrm{mole},m} = \frac{\sum_k a_{m,k} X_k} {\sum_k \sum_j a_{j,k} X_k} \]

with \(a_{m,k}\) being the number of atoms of element \(m\) in species \(k\), \(\sum_j\) being a sum over all elements, and \(X_k\) being the mole fraction of species \(k\).

Parameters
[in]mIndex of the element within the phase. If m is outside the valid range, an exception will be thrown.
Returns
the elemental mole fraction of element m.

Definition at line 648 of file Phase.cpp.

References Phase::checkElementIndex(), Phase::m_kk, Phase::moleFraction(), Phase::nAtoms(), and Phase::nElements().

◆ moleFractdivMMW()

const doublereal * moleFractdivMMW ( ) const

Returns a const pointer to the start of the moleFraction/MW array.

This array is the array of mole fractions, each divided by the mean molecular weight.

Definition at line 563 of file Phase.cpp.

References Phase::m_ym.

Referenced by IdealSolnGasVPSS::calcDensity(), RedlichKwongMFTP::calcDensity(), and IdealSolidSolnPhase::calcDensity().

◆ charge()

doublereal charge ( size_t  k) const
inline

◆ chargeDensity()

doublereal chargeDensity ( ) const

Charge density [C/m^3].

Definition at line 681 of file Phase.cpp.

References Phase::charge(), Phase::m_kk, and Phase::moleFraction().

◆ nDim()

size_t nDim ( ) const
inline

Returns the number of spatial dimensions (1, 2, or 3)

Definition at line 585 of file Phase.h.

References Phase::m_ndim.

Referenced by Kinetics::addPhase(), InterfaceKinetics::buildSurfaceArrhenius(), and InterfaceKinetics::init().

◆ setNDim()

void setNDim ( size_t  ndim)
inline

Set the number of spatial dimensions (1, 2, or 3).

The number of spatial dimensions is used for vector involving directions.

Parameters
ndimInput number of dimensions.

Definition at line 592 of file Phase.h.

References Phase::m_ndim.

Referenced by EdgePhase::EdgePhase(), FixedChemPotSSTP::FixedChemPotSSTP(), Cantera::importPhase(), and SurfPhase::SurfPhase().

◆ temperature()

doublereal temperature ( ) const
inline

Temperature (K).

Returns
The temperature of the phase

Definition at line 601 of file Phase.h.

References Phase::m_temp.

Referenced by StFlow::_getInitialSoln(), ThermoPhase::_RT(), MixtureFugacityTP::_updateReferenceStateThermo(), VPStandardStateTP::_updateStandardStateThermo(), MaskellSolidSolnPhase::_updateThermo(), ConstDensityThermo::_updateThermo(), SingleSpeciesTP::_updateThermo(), SurfPhase::_updateThermo(), LatticeSolidPhase::_updateThermo(), IdealGasPhase::_updateThermo(), IdealSolidSolnPhase::_updateThermo(), LatticePhase::_updateThermo(), MultiPhase::addPhase(), IonsFromNeutralVPSSTP::calcDensity(), HMWSoln::calcDensity(), MixtureFugacityTP::calculatePsat(), InterfaceKinetics::checkPartialEquil(), RedlichKwongMFTP::cp_mole(), RedlichKwongMFTP::cv_mole(), ChemEquil::equilibrate(), MaskellSolidSolnPhase::getActivityCoefficients(), RedlichKwongMFTP::getActivityCoefficients(), RedlichKwongMFTP::getChemPotentials(), IdealSolidSolnPhase::getChemPotentials_RT(), PureFluidPhase::getEnthalpy_RT_ref(), PureFluidPhase::getEntropy_R_ref(), PureFluidPhase::getGibbs_RT_ref(), LTI_Pairwise_Interaction::getMatrixTransProp(), LTI_StefanMaxwell_PPN::getMatrixTransProp(), LTI_MoleFracs::getMixTransProp(), LTI_MassFracs::getMixTransProp(), LTI_Log_MoleFracs::getMixTransProp(), LTI_MoleFracs_ExpT::getMixTransProp(), SolidTransport::getMobilities(), DebyeHuckel::getPartialMolarCp(), HMWSoln::getPartialMolarCp(), RedlichKwongMFTP::getPartialMolarEnthalpies(), IonsFromNeutralVPSSTP::getPartialMolarEnthalpies(), MixedSolventElectrolyte::getPartialMolarEnthalpies(), MargulesVPSSTP::getPartialMolarEnthalpies(), DebyeHuckel::getPartialMolarEnthalpies(), HMWSoln::getPartialMolarEnthalpies(), RedlichKwongMFTP::getPartialMolarEntropies(), IonsFromNeutralVPSSTP::getPartialMolarEntropies(), RedlichKwongMFTP::getPartialMolarVolumes(), LTPspecies_Arrhenius::getSpeciesTransProp(), LTPspecies_Poly::getSpeciesTransProp(), LTPspecies_ExpT::getSpeciesTransProp(), WaterSSTP::getStandardChemPotentials(), ThermoPhase::gibbs_mole(), MixtureFugacityTP::phaseState(), IdealGasPhase::pressure(), MixTransport::pressure_ig(), RedlichKwongMFTP::pressureDerivatives(), ThermoPhase::RT(), HMWSoln::s_update_d2lnMolalityActCoeff_dT2(), MargulesVPSSTP::s_update_dlnActCoeff_dT(), HMWSoln::s_update_dlnMolalityActCoeff_dP(), HMWSoln::s_update_dlnMolalityActCoeff_dT(), HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP(), WaterSSTP::satPressure(), HMWSoln::satPressure(), Phase::saveState(), WaterSSTP::setDensity(), ChemEquil::setInitialMoles(), VPStandardStateTP::setPressure(), MixtureFugacityTP::setPressure(), vcs_VolPhase::setPtrThermoPhase(), SingleSpeciesTP::setState_HP(), SingleSpeciesTP::setState_SP(), SingleSpeciesTP::setState_SV(), SingleSpeciesTP::setState_UV(), MixtureFugacityTP::setStateFromXML(), MixtureFugacityTP::setTemperature(), ImplicitSurfChem::solvePseudoSteadyStateProblem(), SolidTransport::thermalConductivity(), HighPressureGasTransport::thermalConductivity(), MetalSHEelectrons::thermalExpansionCoeff(), IdealGasPhase::thermalExpansionCoeff(), ChemEquil::update(), MultiTransport::update_T(), MixTransport::update_T(), SimpleTransport::update_T(), LiquidTransport::update_T(), RedlichKwongMFTP::updateAB(), VPStandardStateTP::updateStandardStateThermo(), MultiTransport::updateThermal_T(), DustyGasTransport::updateTransport_T(), WaterSSTP::vaporFraction(), and HighPressureGasTransport::viscosity().

◆ density()

virtual doublereal density ( ) const
inlinevirtual

◆ molarDensity()

doublereal molarDensity ( ) const

◆ molarVolume()

doublereal molarVolume ( ) const

◆ setDensity()

virtual void setDensity ( const doublereal  density_)
inlinevirtual

◆ setMolarDensity()

void setMolarDensity ( const doublereal  molarDensity)
virtual

Set the internally stored molar density (kmol/m^3) of the phase.

Parameters
[in]molarDensityInput molar density (kmol/m^3).

Reimplemented in HMWSoln, DebyeHuckel, IdealSolidSolnPhase, IdealMolalSoln, and MaskellSolidSolnPhase.

Definition at line 671 of file Phase.cpp.

References Phase::m_dens, and Phase::meanMolecularWeight().

Referenced by LatticePhase::calcDensity(), and Phase::setState_TNX().

◆ setTemperature()

virtual void setTemperature ( const doublereal  temp)
inlinevirtual

◆ mean_X() [1/2]

doublereal mean_X ( const doublereal *const  Q) const

Evaluate the mole-fraction-weighted mean of an array Q.

\[ \sum_k X_k Q_k. \]

Q should contain pure-species molar property values.

Parameters
[in]QArray of length m_kk that is to be averaged.
Returns
mole-fraction-weighted mean of Q

Definition at line 690 of file Phase.cpp.

References Phase::m_mmw, and Phase::m_ym.

Referenced by IdealMolalSoln::calcDensity(), DebyeHuckel::calcDensity(), HMWSoln::calcDensity(), ConstDensityThermo::cp_mole(), RedlichKwongMFTP::cp_mole(), IdealSolnGasVPSS::cp_mole(), IdealSolidSolnPhase::cp_mole(), IonsFromNeutralVPSSTP::cp_mole(), IdealMolalSoln::cp_mole(), SurfPhase::cp_mole(), LatticePhase::cp_mole(), IdealGasPhase::cp_mole(), DebyeHuckel::cp_mole(), HMWSoln::cp_mole(), RedlichKwongMFTP::cv_mole(), IonsFromNeutralVPSSTP::cv_mole(), ConstDensityThermo::enthalpy_mole(), MaskellSolidSolnPhase::enthalpy_mole(), RedlichKwongMFTP::enthalpy_mole(), IdealSolnGasVPSS::enthalpy_mole(), IdealSolidSolnPhase::enthalpy_mole(), IdealMolalSoln::enthalpy_mole(), IonsFromNeutralVPSSTP::enthalpy_mole(), SurfPhase::enthalpy_mole(), LatticePhase::enthalpy_mole(), IdealGasPhase::enthalpy_mole(), DebyeHuckel::enthalpy_mole(), HMWSoln::enthalpy_mole(), ConstDensityThermo::entropy_mole(), RedlichKwongMFTP::entropy_mole(), IdealSolnGasVPSS::entropy_mole(), IdealSolidSolnPhase::entropy_mole(), IdealMolalSoln::entropy_mole(), IonsFromNeutralVPSSTP::entropy_mole(), LatticePhase::entropy_mole(), IdealGasPhase::entropy_mole(), DebyeHuckel::entropy_mole(), HMWSoln::entropy_mole(), IdealSolidSolnPhase::gibbs_mole(), IdealMolalSoln::gibbs_mole(), IonsFromNeutralVPSSTP::gibbs_mole(), DebyeHuckel::gibbs_mole(), HMWSoln::gibbs_mole(), IdealMolalSoln::intEnergy_mole(), and HMWSoln::relative_enthalpy().

◆ mean_X() [2/2]

doublereal mean_X ( const vector_fp Q) const

Evaluate the mole-fraction-weighted mean of an array Q.

\[ \sum_k X_k Q_k. \]

Q should contain pure-species molar property values.

Parameters
[in]QArray of length m_kk that is to be averaged.
Returns
mole-fraction-weighted mean of Q

Definition at line 695 of file Phase.cpp.

References Phase::m_mmw, and Phase::m_ym.

◆ meanMolecularWeight()

doublereal meanMolecularWeight ( ) const
inline

◆ sum_xlogx()

doublereal sum_xlogx ( ) const

◆ addElement()

size_t addElement ( const std::string &  symbol,
doublereal  weight = -12345.0,
int  atomicNumber = 0,
doublereal  entropy298 = ENTROPY298_UNKNOWN,
int  elem_type = CT_ELEM_TYPE_ABSPOS 
)

Add an element.

Parameters
symbolAtomic symbol std::string.
weightAtomic mass in amu.
atomicNumberAtomic number of the element (unitless)
entropy298Entropy of the element at 298 K and 1 bar in its most stable form. The default is the value ENTROPY298_UNKNOWN, which is interpreted as an unknown, and if used will cause Cantera to throw an error.
elem_typeSpecifies the type of the element constraint equation. This defaults to CT_ELEM_TYPE_ABSPOS, i.e., an element.
Returns
index of the element added

Definition at line 705 of file Phase.cpp.

References CT_ELEM_TYPE_ELECTRONCHARGE, Cantera::getElementWeight(), Phase::m_atomicNumbers, Phase::m_atomicWeights, Phase::m_elem_type, Phase::m_elementNames, Phase::m_entropy298, Phase::m_kk, Phase::m_mm, and Phase::m_speciesComp.

Referenced by Phase::addSpecies(), FixedChemPotSSTP::FixedChemPotSSTP(), LatticeSolidPhase::initThermo(), and Cantera::installElements().

◆ addSpecies()

bool addSpecies ( shared_ptr< Species spec)
virtual

Add a Species to this Phase.

Returns true if the species was successfully added, or false if the species was ignored.

Derived classes which need to size arrays according to the number of species should overload this method. The derived class implementation should call the base class method, and, if this returns true (indicating that the species has been added), adjust their array sizes accordingly.

See also
ignoreUndefinedElements addUndefinedElements throwUndefinedElements

Reimplemented in ThermoPhase, DebyeHuckel, LatticePhase, IdealSolidSolnPhase, IdealGasPhase, MolalityVPSSTP, LatticeSolidPhase, IdealMolalSoln, MixtureFugacityTP, SurfPhase, VPStandardStateTP, SingleSpeciesTP, GibbsExcessVPSSTP, RedlichKwongMFTP, IdealSolnGasVPSS, and ConstDensityThermo.

Definition at line 761 of file Phase.cpp.

References Phase::addElement(), Phase::atomicWeights(), CT_ELEM_TYPE_ELECTRONCHARGE, Phase::elementIndex(), Phase::invalidateCache(), Phase::m_kk, Phase::m_mmw, Phase::m_molwts, Phase::m_name, Phase::m_rmolwts, Phase::m_speciesCharge, Phase::m_speciesComp, Phase::m_speciesIndices, Phase::m_speciesNames, Phase::m_speciesSize, Phase::m_undefinedElementBehavior, Phase::m_y, Phase::m_ym, Phase::nElements(), Cantera::npos, and Cantera::Tiny.

Referenced by VPStandardStateTP::addSpecies(), and ThermoPhase::addSpecies().

◆ modifySpecies()

void modifySpecies ( size_t  k,
shared_ptr< Species spec 
)
virtual

Modify the thermodynamic data associated with a species.

The species name, elemental composition, and type of thermo parameterization must be unchanged. If there are Kinetics objects that depend on this phase, Kinetics::invalidateCache() should be called on those objects after calling this function.

Reimplemented in ThermoPhase.

Definition at line 851 of file Phase.cpp.

References Phase::invalidateCache(), and Phase::speciesName().

Referenced by ThermoPhase::modifySpecies().

◆ species() [1/2]

shared_ptr< Species > species ( const std::string &  name) const

Return the Species object for the named species.

Definition at line 868 of file Phase.cpp.

References Phase::name().

Referenced by LatticeSolidPhase::initThermo(), and Phase::species().

◆ species() [2/2]

shared_ptr< Species > species ( size_t  k) const

Return the Species object for species whose index is k.

Definition at line 873 of file Phase.cpp.

References Phase::m_speciesNames, and Phase::species().

◆ ignoreUndefinedElements()

void ignoreUndefinedElements ( )

Set behavior when adding a species containing undefined elements to just skip the species.

Definition at line 878 of file Phase.cpp.

References Phase::m_undefinedElementBehavior.

Referenced by Cantera::importPhase().

◆ addUndefinedElements()

void addUndefinedElements ( )

Set behavior when adding a species containing undefined elements to add those elements to the phase.

Definition at line 882 of file Phase.cpp.

References Phase::m_undefinedElementBehavior.

◆ throwUndefinedElements()

void throwUndefinedElements ( )

Set the behavior when adding a species containing undefined elements to throw an exception.

This is the default behavior.

Definition at line 886 of file Phase.cpp.

References Phase::m_undefinedElementBehavior.

◆ ready()

bool ready ( ) const
virtual

Returns a bool indicating whether the object is ready for use.

Returns
true if the object is ready for calculation, false otherwise.

Reimplemented in Interface, IdealGasMix, Edge, PureFluid, IncompressibleSolid, and Metal.

Definition at line 890 of file Phase.cpp.

References Phase::m_kk.

◆ stateMFNumber()

int stateMFNumber ( ) const
inline

◆ invalidateCache()

void invalidateCache ( )
virtual

Invalidate any cached values which are normally updated only when a change in state is detected.

Reimplemented in ThermoPhase, MixtureFugacityTP, and VPStandardStateTP.

Definition at line 895 of file Phase.cpp.

References ValueCache::clear(), and Phase::m_cache.

Referenced by Phase::addSpecies(), ThermoPhase::invalidateCache(), and Phase::modifySpecies().

◆ setMolecularWeight()

void setMolecularWeight ( const int  k,
const double  mw 
)
inlineprotected

Set the molecular weight of a single species to a given value.

Used by phases where the equation of state is defined for a specific value of the molecular weight which may not exactly correspond to the value computed from the chemical formula.

Parameters
kid of the species
mwMolecular Weight (kg kmol-1)

Definition at line 770 of file Phase.h.

References Phase::m_molwts, and Phase::m_rmolwts.

Referenced by WaterSSTP::initThermoXML().

◆ compositionChanged()

void compositionChanged ( )
protectedvirtual

Apply changes to the state which are needed after the composition changes.

This function is called after any call to setMassFractions(), setMoleFractions(), or similar. For phases which need to execute a callback after any change to the composition, it should be done by overriding this function rather than overriding all of the composition- setting functions. Derived class implementations of compositionChanged() should call the parent class method as well.

Reimplemented in LatticePhase, IdealSolidSolnPhase, IonsFromNeutralVPSSTP, MixtureFugacityTP, GibbsExcessVPSSTP, and RedlichKwongMFTP.

Definition at line 899 of file Phase.cpp.

References Phase::m_stateNum.

Referenced by MixtureFugacityTP::compositionChanged(), IdealSolidSolnPhase::compositionChanged(), LatticePhase::compositionChanged(), Phase::restoreState(), Phase::setConcentrations(), Phase::setConcentrationsNoNorm(), Phase::setMassFractions(), Phase::setMassFractions_NoNorm(), Phase::setMoleFractions(), and Phase::setMoleFractions_NoNorm().

Member Data Documentation

◆ m_cache

ValueCache m_cache
mutableprotected

Cached for saved calculations within each ThermoPhase.

For more information on how to use this, see examples within the source code and documentation for this within ValueCache class itself.

Definition at line 761 of file Phase.h.

Referenced by MaskellSolidSolnPhase::_updateThermo(), IdealGasPhase::_updateThermo(), HMWSoln::calcDensity(), MaskellSolidSolnPhase::getActivityCoefficients(), Phase::invalidateCache(), HMWSoln::s_update_d2lnMolalityActCoeff_dT2(), HMWSoln::s_update_dlnMolalityActCoeff_dP(), and HMWSoln::s_update_dlnMolalityActCoeff_dT().

◆ m_kk

size_t m_kk
protected

Number of species in the phase.

Definition at line 784 of file Phase.h.

Referenced by DebyeHuckel::_lnactivityWaterHelgesonFixedForm(), MixtureFugacityTP::_updateReferenceStateThermo(), MaskellSolidSolnPhase::_updateThermo(), ConstDensityThermo::_updateThermo(), SurfPhase::_updateThermo(), IdealGasPhase::_updateThermo(), IdealSolidSolnPhase::_updateThermo(), LatticePhase::_updateThermo(), Phase::addElement(), RedlichKwongMFTP::addSpecies(), SingleSpeciesTP::addSpecies(), SurfPhase::addSpecies(), MixtureFugacityTP::addSpecies(), MolalityVPSSTP::addSpecies(), IdealGasPhase::addSpecies(), IdealSolidSolnPhase::addSpecies(), LatticePhase::addSpecies(), Phase::addSpecies(), ThermoPhase::addSpecies(), HMWSoln::applyphScale(), RedlichKwongMFTP::applyStandardMixingRules(), MaskellSolidSolnPhase::calcDensity(), IonsFromNeutralVPSSTP::calcIonMoleFractions(), MolalityVPSSTP::calcMolalities(), HMWSoln::calcMolalitiesCropped(), IonsFromNeutralVPSSTP::calcNeutralMoleculeMoleFractions(), RedlichKwongMFTP::calculateAB(), Phase::chargeDensity(), Phase::checkSpeciesArraySize(), Phase::checkSpeciesIndex(), HMWSoln::counterIJ_setup(), MixedSolventElectrolyte::cp_mole(), RedlichKisterVPSSTP::cp_mole(), PhaseCombo_Interaction::cp_mole(), RedlichKwongMFTP::critCompressibility(), RedlichKwongMFTP::critDensity(), RedlichKwongMFTP::critPressure(), RedlichKwongMFTP::critTemperature(), RedlichKwongMFTP::critVolume(), Phase::elementalMassFraction(), Phase::elementalMoleFraction(), MixedSolventElectrolyte::enthalpy_mole(), RedlichKisterVPSSTP::enthalpy_mole(), PhaseCombo_Interaction::enthalpy_mole(), SurfPhase::entropy_mole(), MixedSolventElectrolyte::entropy_mole(), RedlichKisterVPSSTP::entropy_mole(), PhaseCombo_Interaction::entropy_mole(), MolalityVPSSTP::findCLMIndex(), IdealMolalSoln::getActivities(), DebyeHuckel::getActivities(), HMWSoln::getActivities(), ConstDensityThermo::getActivityCoefficients(), IdealSolnGasVPSS::getActivityCoefficients(), RedlichKwongMFTP::getActivityCoefficients(), IonsFromNeutralVPSSTP::getActivityCoefficients(), MixedSolventElectrolyte::getActivityCoefficients(), LatticeSolidPhase::getActivityCoefficients(), IdealSolidSolnPhase::getActivityCoefficients(), PhaseCombo_Interaction::getActivityCoefficients(), MolalityVPSSTP::getActivityCoefficients(), LatticePhase::getActivityCoefficients(), ThermoPhase::getActivityCoefficients(), IdealGasPhase::getActivityCoefficients(), ConstDensityThermo::getChemPotentials(), MolarityIonicVPSSTP::getChemPotentials(), IdealSolnGasVPSS::getChemPotentials(), RedlichKwongMFTP::getChemPotentials(), SurfPhase::getChemPotentials(), MixedSolventElectrolyte::getChemPotentials(), MargulesVPSSTP::getChemPotentials(), RedlichKisterVPSSTP::getChemPotentials(), IdealMolalSoln::getChemPotentials(), IdealSolidSolnPhase::getChemPotentials(), PhaseCombo_Interaction::getChemPotentials(), LatticePhase::getChemPotentials(), IdealGasPhase::getChemPotentials(), DebyeHuckel::getChemPotentials(), HMWSoln::getChemPotentials(), VPStandardStateTP::getChemPotentials_RT(), MaskellSolidSolnPhase::getChemPotentials_RT(), MixtureFugacityTP::getChemPotentials_RT(), RedlichKwongMFTP::getChemPotentials_RT(), IdealSolidSolnPhase::getChemPotentials_RT(), SurfPhase::getCoverages(), IdealSolidSolnPhase::getCp_R_ref(), MixedSolventElectrolyte::getd2lnActCoeffdT2(), MargulesVPSSTP::getd2lnActCoeffdT2(), RedlichKisterVPSSTP::getd2lnActCoeffdT2(), PhaseCombo_Interaction::getd2lnActCoeffdT2(), IonsFromNeutralVPSSTP::getdlnActCoeffdlnN(), MixedSolventElectrolyte::getdlnActCoeffdlnN(), MargulesVPSSTP::getdlnActCoeffdlnN(), RedlichKisterVPSSTP::getdlnActCoeffdlnN(), PhaseCombo_Interaction::getdlnActCoeffdlnN(), ThermoPhase::getdlnActCoeffdlnN(), IonsFromNeutralVPSSTP::getdlnActCoeffdlnN_diag(), MixedSolventElectrolyte::getdlnActCoeffdlnN_diag(), MargulesVPSSTP::getdlnActCoeffdlnN_diag(), RedlichKisterVPSSTP::getdlnActCoeffdlnN_diag(), PhaseCombo_Interaction::getdlnActCoeffdlnN_diag(), IonsFromNeutralVPSSTP::getdlnActCoeffdlnX_diag(), MixedSolventElectrolyte::getdlnActCoeffdlnX_diag(), MargulesVPSSTP::getdlnActCoeffdlnX_diag(), RedlichKisterVPSSTP::getdlnActCoeffdlnX_diag(), PhaseCombo_Interaction::getdlnActCoeffdlnX_diag(), IonsFromNeutralVPSSTP::getdlnActCoeffds(), RedlichKisterVPSSTP::getdlnActCoeffds(), MixedSolventElectrolyte::getdlnActCoeffdT(), MargulesVPSSTP::getdlnActCoeffdT(), RedlichKisterVPSSTP::getdlnActCoeffdT(), PhaseCombo_Interaction::getdlnActCoeffdT(), ThermoPhase::getElectrochemPotentials(), IdealSolidSolnPhase::getEnthalpy_RT(), LatticePhase::getEnthalpy_RT(), IdealSolidSolnPhase::getEnthalpy_RT_ref(), MixtureFugacityTP::getEntropy_R(), IdealGasPhase::getEntropy_R(), IdealSolidSolnPhase::getEntropy_R_ref(), WaterSSTP::getGibbs_ref(), LatticeSolidPhase::getGibbs_ref(), IdealSolidSolnPhase::getGibbs_ref(), LatticePhase::getGibbs_ref(), MixtureFugacityTP::getGibbs_RT(), IdealSolidSolnPhase::getGibbs_RT(), IdealGasPhase::getGibbs_RT(), LatticePhase::getGibbs_RT(), IdealSolidSolnPhase::getGibbs_RT_ref(), LatticePhase::getGibbs_RT_ref(), MixtureFugacityTP::getIntEnergy_RT(), IdealSolidSolnPhase::getIntEnergy_RT(), IdealGasPhase::getIntEnergy_RT(), IdealGasPhase::getIntEnergy_RT_ref(), IdealSolidSolnPhase::getIntEnergy_RT_ref(), MolarityIonicVPSSTP::getLnActivityCoefficients(), MargulesVPSSTP::getLnActivityCoefficients(), RedlichKisterVPSSTP::getLnActivityCoefficients(), ThermoPhase::getLnActivityCoefficients(), Phase::getMassFractionsByName(), MolalityVPSSTP::getMolalities(), IdealMolalSoln::getMolalityActivityCoefficients(), DebyeHuckel::getMolalityActivityCoefficients(), Phase::getMoleFractionsByName(), IonsFromNeutralVPSSTP::getNeutralMoleculeMoleGrads(), IdealSolnGasVPSS::getPartialMolarCp(), RedlichKwongMFTP::getPartialMolarCp(), SurfPhase::getPartialMolarCp(), IdealMolalSoln::getPartialMolarCp(), IdealSolidSolnPhase::getPartialMolarCp(), LatticePhase::getPartialMolarCp(), DebyeHuckel::getPartialMolarCp(), HMWSoln::getPartialMolarCp(), IdealSolnGasVPSS::getPartialMolarEnthalpies(), RedlichKwongMFTP::getPartialMolarEnthalpies(), SurfPhase::getPartialMolarEnthalpies(), IonsFromNeutralVPSSTP::getPartialMolarEnthalpies(), MixedSolventElectrolyte::getPartialMolarEnthalpies(), MargulesVPSSTP::getPartialMolarEnthalpies(), IdealMolalSoln::getPartialMolarEnthalpies(), DebyeHuckel::getPartialMolarEnthalpies(), HMWSoln::getPartialMolarEnthalpies(), IdealSolnGasVPSS::getPartialMolarEntropies(), RedlichKwongMFTP::getPartialMolarEntropies(), SurfPhase::getPartialMolarEntropies(), IonsFromNeutralVPSSTP::getPartialMolarEntropies(), IdealMolalSoln::getPartialMolarEntropies(), IdealSolidSolnPhase::getPartialMolarEntropies(), LatticePhase::getPartialMolarEntropies(), IdealGasPhase::getPartialMolarEntropies(), DebyeHuckel::getPartialMolarEntropies(), HMWSoln::getPartialMolarEntropies(), IdealSolnGasVPSS::getPartialMolarIntEnergies(), RedlichKwongMFTP::getPartialMolarIntEnergies(), IdealGasPhase::getPartialMolarIntEnergies(), MolarityIonicVPSSTP::getPartialMolarVolumes(), RedlichKwongMFTP::getPartialMolarVolumes(), RedlichKisterVPSSTP::getPartialMolarVolumes(), IdealGasPhase::getPartialMolarVolumes(), DebyeHuckel::getPartialMolarVolumes(), HMWSoln::getPartialMolarVolumes(), MaskellSolidSolnPhase::getPureGibbs(), MixtureFugacityTP::getPureGibbs(), LatticePhase::getPureGibbs(), IdealSolidSolnPhase::getPureGibbs(), IdealGasPhase::getPureGibbs(), VPStandardStateTP::getStandardChemPotentials(), MixtureFugacityTP::getStandardChemPotentials(), IdealGasPhase::getStandardChemPotentials(), MixtureFugacityTP::getStandardVolumes(), SurfPhase::getStandardVolumes(), IdealGasPhase::getStandardVolumes(), MixtureFugacityTP::getStandardVolumes_ref(), IdealGasPhase::getStandardVolumes_ref(), HMWSoln::getUnscaledMolalityActivityCoefficients(), MolarityIonicVPSSTP::initLengths(), IonsFromNeutralVPSSTP::initLengths(), MixedSolventElectrolyte::initLengths(), MargulesVPSSTP::initLengths(), RedlichKisterVPSSTP::initLengths(), PhaseCombo_Interaction::initLengths(), HMWSoln::initLengths(), MolarityIonicVPSSTP::initThermo(), VPStandardStateTP::initThermo(), StoichSubstance::initThermo(), ThermoPhase::initThermo(), MaskellSolidSolnPhase::initThermoXML(), RedlichKwongMFTP::initThermoXML(), VPStandardStateTP::initThermoXML(), IonsFromNeutralVPSSTP::initThermoXML(), IdealMolalSoln::initThermoXML(), IdealSolidSolnPhase::initThermoXML(), LatticePhase::initThermoXML(), ThermoPhase::initThermoXML(), Phase::nSpecies(), ThermoPhase::operator=(), MolalityVPSSTP::osmoticCoefficient(), HMWSoln::printCoeffs(), RedlichKwongMFTP::readXMLCrossFluid(), RedlichKwongMFTP::readXMLPureFluid(), Phase::ready(), IdealSolidSolnPhase::referenceConcentration(), HMWSoln::relative_enthalpy(), HMWSoln::relative_molal_enthalpy(), DebyeHuckel::s_update_d2lnMolalityActCoeff_dT2(), HMWSoln::s_update_d2lnMolalityActCoeff_dT2(), IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN(), IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnN_diag(), IonsFromNeutralVPSSTP::s_update_dlnActCoeff_dlnX_diag(), MargulesVPSSTP::s_update_dlnActCoeff_dT(), RedlichKisterVPSSTP::s_update_dlnActCoeff_dT(), IonsFromNeutralVPSSTP::s_update_dlnActCoeffdT(), DebyeHuckel::s_update_dlnMolalityActCoeff_dP(), HMWSoln::s_update_dlnMolalityActCoeff_dP(), DebyeHuckel::s_update_dlnMolalityActCoeff_dT(), HMWSoln::s_update_dlnMolalityActCoeff_dT(), MolarityIonicVPSSTP::s_update_lnActCoeff(), IonsFromNeutralVPSSTP::s_update_lnActCoeff(), DebyeHuckel::s_update_lnMolalityActCoeff(), IdealMolalSoln::s_updateIMS_lnMolalityActCoeff(), HMWSoln::s_updateIMS_lnMolalityActCoeff(), HMWSoln::s_updatePitzer_d2lnMolalityActCoeff_dT2(), HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dP(), HMWSoln::s_updatePitzer_dlnMolalityActCoeff_dT(), HMWSoln::s_updatePitzer_lnMolalityActCoeff(), HMWSoln::s_updateScaling_pHScaling(), HMWSoln::s_updateScaling_pHScaling_dP(), HMWSoln::s_updateScaling_pHScaling_dT(), HMWSoln::s_updateScaling_pHScaling_dT2(), Phase::setConcentrations(), Phase::setConcentrationsNoNorm(), SurfPhase::setCoverages(), SurfPhase::setCoveragesByName(), SurfPhase::setCoveragesNoNorm(), Phase::setMassFractions(), Phase::setMassFractions_NoNorm(), Phase::setMassFractionsByName(), MolalityVPSSTP::setMolalities(), MolalityVPSSTP::setMolalitiesByName(), Phase::setMoleFractions(), Phase::setMoleFractions_NoNorm(), Phase::setMoleFractionsByName(), ThermoPhase::setReferenceComposition(), MolalityVPSSTP::setSolvent(), IdealSolnGasVPSS::setToEquilState(), RedlichKwongMFTP::setToEquilState(), IdealGasPhase::setToEquilState(), IdealSolidSolnPhase::setToEquilState(), ThermoPhase::speciesData(), IdealSolidSolnPhase::standardConcentration(), and RedlichKwongMFTP::updateAB().

◆ m_ndim

size_t m_ndim
protected

Dimensionality of the phase.

Volumetric phases have dimensionality 3 and surface phases have dimensionality 2.

Definition at line 788 of file Phase.h.

Referenced by Phase::nDim(), and Phase::setNDim().

◆ m_speciesComp

vector_fp m_speciesComp
protected

Atomic composition of the species.

The number of atoms of element i in species k is equal to m_speciesComp[k * m_mm + i] The length of this vector is equal to m_kk * m_mm

Definition at line 793 of file Phase.h.

Referenced by Phase::addElement(), Phase::addSpecies(), Phase::getAtoms(), LatticeSolidPhase::initThermo(), and Phase::nAtoms().

◆ m_speciesSize

vector_fp m_speciesSize
protected

Vector of species sizes.

length m_kk. Used in some equations of state which employ the constant partial molar volume approximation, and for surface phases.

Definition at line 798 of file Phase.h.

Referenced by Phase::addSpecies(), DebyeHuckel::addSpecies(), HMWSoln::initLengths(), Phase::size(), and DebyeHuckel::standardConcentration().

◆ m_speciesCharge

vector_fp m_speciesCharge
protected

◆ m_undefinedElementBehavior

UndefElement::behavior m_undefinedElementBehavior
protected

Flag determining behavior when adding species with an undefined element.

Definition at line 805 of file Phase.h.

Referenced by Phase::addSpecies(), Phase::addUndefinedElements(), Phase::ignoreUndefinedElements(), and Phase::throwUndefinedElements().

◆ m_xml

XML_Node* m_xml
private

XML node containing the XML info for this phase.

Definition at line 808 of file Phase.h.

Referenced by Phase::setXMLdata(), and Phase::xml().

◆ m_id

std::string m_id
private

ID of the phase.

This is the value of the ID attribute of the XML phase node. The field will stay that way even if the name is changed.

Definition at line 812 of file Phase.h.

Referenced by Phase::id(), Phase::setID(), and Phase::speciesIndex().

◆ m_name

std::string m_name
private

Name of the phase.

Initially, this is the value of the ID attribute of the XML phase node. It may be changed to another value during the course of a calculation.

Definition at line 817 of file Phase.h.

Referenced by Phase::addSpecies(), Phase::name(), Phase::setName(), Phase::speciesIndex(), and Phase::speciesSPName().

◆ m_temp

doublereal m_temp
private

Temperature (K). This is an independent variable.

Definition at line 819 of file Phase.h.

Referenced by Phase::setTemperature(), and Phase::temperature().

◆ m_dens

doublereal m_dens
private

Density (kg m-3).

This is an independent variable except in the incompressible degenerate case. Thus, the pressure is determined from this variable rather than other way round.

Definition at line 824 of file Phase.h.

Referenced by Phase::concentration(), Phase::density(), Phase::setDensity(), and Phase::setMolarDensity().

◆ m_mmw

doublereal m_mmw
private

◆ m_ym

vector_fp m_ym
mutableprivate

◆ m_y

vector_fp m_y
mutableprivate

◆ m_molwts

vector_fp m_molwts
private

◆ m_rmolwts

vector_fp m_rmolwts
private

inverse of species molecular weights (kmol kg-1)

Definition at line 841 of file Phase.h.

Referenced by Phase::addSpecies(), Phase::concentration(), Phase::setMassFractions(), Phase::setMassFractions_NoNorm(), and Phase::setMolecularWeight().

◆ m_stateNum

int m_stateNum
private

State Change variable.

Whenever the mole fraction vector changes, this int is incremented.

Definition at line 845 of file Phase.h.

Referenced by Phase::compositionChanged(), and Phase::stateMFNumber().

◆ m_speciesNames

std::vector<std::string> m_speciesNames
private

Vector of the species names.

Definition at line 848 of file Phase.h.

Referenced by Phase::addSpecies(), Phase::species(), Phase::speciesName(), and Phase::speciesNames().

◆ m_speciesIndices

std::map<std::string, size_t> m_speciesIndices
private

Map of species names to indices.

Definition at line 851 of file Phase.h.

Referenced by Phase::addSpecies(), Phase::setMassFractionsByName(), Phase::setMoleFractionsByName(), and Phase::speciesIndex().

◆ m_mm

size_t m_mm
private

◆ m_atomicWeights

vector_fp m_atomicWeights
private

element atomic weights (kg kmol-1)

Definition at line 854 of file Phase.h.

Referenced by Phase::addElement(), Phase::atomicWeight(), and Phase::atomicWeights().

◆ m_atomicNumbers

vector_int m_atomicNumbers
private

element atomic numbers

Definition at line 855 of file Phase.h.

Referenced by Phase::addElement(), and Phase::atomicNumber().

◆ m_elementNames

std::vector<std::string> m_elementNames
private

element names

Definition at line 856 of file Phase.h.

Referenced by Phase::addElement(), Phase::elementIndex(), Phase::elementName(), and Phase::elementNames().

◆ m_elem_type

vector_int m_elem_type
private

Vector of element types.

Definition at line 857 of file Phase.h.

Referenced by Phase::addElement(), Phase::changeElementType(), and Phase::elementType().

◆ m_entropy298

vector_fp m_entropy298
private

Entropy at 298.15 K and 1 bar of stable state pure elements (J kmol-1)

Definition at line 860 of file Phase.h.

Referenced by Phase::addElement(), and Phase::entropyElement298().


The documentation for this class was generated from the following files: