Constituents Class Reference
[Models of Phases of Matter]

Class Constituents manages a set of elements and species. More...

#include <Constituents.h>

Inheritance diagram for Constituents:
Inheritance graph
[legend]
Collaboration diagram for Constituents:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Constituents (Elements *ptr_Elements=0)
 Constructor.
 ~Constituents ()
 Destructor.
 Constituents (const Constituents &right)
 This copy constructor just calls the assignment operator for this class.
Constituentsoperator= (const Constituents &right)
 Assignment operator.
int nSpecies () const
 Returns the number of species in the phase.
doublereal molecularWeight (int k) const
 Molecular weight of species k.
doublereal molarMass (int k) const
 Return the Molar mass of species k.
const vector_fp & molecularWeights () const
 Return a const reference to the vector of molecular weights of the species.
doublereal charge (int k) const
bool ready () const
 True if both elements and species have been frozen.
doublereal nAtoms (int k, int m) const
 Number of atoms of element m in species k.
void getAtoms (int k, double *atomArray) const
 Get a vector containing the atomic composition of species k.
Element Information

std::string elementName (int m) const
 Name of the element with index m.
int elementIndex (std::string name) const
 Index of element named 'name'.
doublereal atomicWeight (int m) const
 Atomic weight of element m.
doublereal entropyElement298 (int m) const
 Entropy of the element in its standard state at 298 K and 1 bar.
int atomicNumber (int m) const
 Atomic number of element m.
const std::vector< std::string > & elementNames () const
 Return a read-only reference to the vector of element names.
const vector_fp & atomicWeights () const
 Return a read-only reference to the vector of atomic weights.
int nElements () const
 Number of elements.
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.

void addElement (const std::string &symbol, doublereal weight)
 Add an element.
void addElement (const XML_Node &e)
 Add an element from an XML specification.
void addUniqueElement (const std::string &symbol, doublereal weight, int atomicNumber=0, doublereal entropy298=ENTROPY298_UNKNOWN)
 Add an element, checking for uniqueness.
void addUniqueElement (const XML_Node &e)
 Adde an element, checking for uniqueness.
void addElementsFromXML (const XML_Node &phase)
 Add all elements referenced in an XML_Node tree.
void freezeElements ()
 Prohibit addition of more elements, and prepare to add species.
bool elementsFrozen ()
 True if freezeElements has been called.
Adding Species

These methods are used to add new species.

They are not usually called by user programs.

void addSpecies (const std::string &name, const doublereal *comp, doublereal charge=0.0, doublereal size=1.0)
void addUniqueSpecies (const std::string &name, const doublereal *comp, doublereal charge=0.0, doublereal size=1.0)
 Add a species to the phase, checking for uniqueness of the name.
int speciesIndex (std::string name) const
 Index of species named 'name'.
std::string speciesName (int k) const
 Name of the species with index k.
const std::vector< std::string > & speciesNames () const
 Return a const referernce to the vector of species names.
doublereal size (int k) const
 This routine returns the size of species k.
void freezeSpecies ()
 Prohibit addition of more species, and prepare for calculations with this set of elements and species.
bool speciesFrozen ()
 True if freezeSpecies has been called.
void clear ()
 Remove all elements and species.

Protected Attributes

int m_kk
 Number of species in the phase.
vector_fp m_weight
 Vector of molecular weights of the species.
bool m_speciesFrozen
 Boolean indicating whether the number of species has been frozen.
Elementsm_Elements
std::vector< std::string > m_speciesNames
 Vector of the species names.
vector_fp m_speciesComp
 Atomic composition of the species.
vector_fp m_speciesCharge
 m_speciesCharge: Vector of species charges length = m_kk
vector_fp m_speciesSize
 m_speciesSize(): Vector of species sizes.

Detailed Description

Class Constituents manages a set of elements and species.

Class Constituents is designed to provide information about the elements and species in a phase - names, index numbers (location in arrays), atomic or molecular weights, etc. No computations are performed by the methods of this class. The set of elements must include all those that compose the species, but may include additional elements. The species all must belong to the same phase.

Definition at line 68 of file Constituents.h.


Constructor & Destructor Documentation

Constituents ( Elements ptr_Elements = 0  ) 

Constructor.

Constructor sets all base variable types to zero. Also, it sets the pointer to the Elements object for this object.

Parameters:
ptr_Elements The default is that a new Elements object is created, so this Constituents object is independent of any other object. But if ptr_Elements is supplied, it will be used. This way, a class implementing a multi-phase mixture is responsible for maintaining the global elements list for the mixture, and no static global element list is required.

Definition at line 49 of file Constituents.cpp.

References Constituents::m_Elements, and Elements::subscribe().

~Constituents (  ) 

Destructor.

Destructor for class Constituents.

Some cleanup of of the Global_Elements_List array is effected by unsubscribing to m_Elements.

Definition at line 67 of file Constituents.cpp.

References Elements::Global_Elements_List, Constituents::m_Elements, and Elements::unsubscribe().

Constituents ( const Constituents right  ) 

This copy constructor just calls the assignment operator for this class.

Parameters:
right reference to the object to be copied.

Definition at line 493 of file Constituents.cpp.


Member Function Documentation

void addElement ( const XML_Node e  ) 

Add an element from an XML specification.

Parameters:
e Reference to the XML_Node where the element is described.

Definition at line 138 of file Constituents.cpp.

References Elements::addElement(), and Constituents::m_Elements.

void addElement ( const std::string &  symbol,
doublereal  weight 
)

Add an element.

Parameters:
symbol Atomic symbol std::string.
weight Atomic mass in amu.

Definition at line 132 of file Constituents.cpp.

References Elements::addElement(), and Constituents::m_Elements.

void addElementsFromXML ( const XML_Node phase  ) 

Add all elements referenced in an XML_Node tree.

Parameters:
phase Reference to the top XML_Node of a phase

Definition at line 169 of file Constituents.cpp.

References Elements::addElementsFromXML(), and Constituents::m_Elements.

void addUniqueElement ( const XML_Node e  ) 

Adde an element, checking for uniqueness.

The uniqueness is checked by comparing the string symbol. If not unique, nothing is done.

Parameters:
e Reference to the XML_Node where the element is described.

Definition at line 164 of file Constituents.cpp.

References Elements::addUniqueElement(), and Constituents::m_Elements.

void addUniqueElement ( const std::string &  symbol,
doublereal  weight,
int  atomicNumber = 0,
doublereal  entropy298 = ENTROPY298_UNKNOWN 
)

Add an element, checking for uniqueness.

The uniqueness is checked by comparing the string symbol. If not unique, nothing is done.

Parameters:
symbol String symbol of the element
weight Atomic weight of the element (kg kmol-1).
atomicNumber Atomic number of the element (unitless)
entropy298 Entropy 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.

Definition at line 157 of file Constituents.cpp.

References Elements::addUniqueElement(), and Constituents::m_Elements.

void addUniqueSpecies ( const std::string &  name,
const doublereal *  comp,
doublereal  charge = 0.0,
doublereal  size = 1.0 
)

Add a species to the phase, checking for uniqueness of the name.

This routine checks for uniqueness of the string name. It only adds the species if it is unique.

Parameters:
name String name of the species
comp Double vector containing the elemental composition of the species.
charge Charge of the species. Defaults to zero.
size Size of the species (meters). Defaults to 1 meter.

Definition at line 357 of file Constituents.cpp.

References Constituents::m_Elements, Constituents::m_speciesCharge, Constituents::m_speciesComp, Constituents::m_speciesNames, Constituents::m_speciesSize, and Elements::nElements().

int atomicNumber ( int  m  )  const

Atomic number of element m.

Parameters:
m Element index

Definition at line 117 of file Constituents.cpp.

References Elements::atomicNumber(), and Constituents::m_Elements.

Referenced by MultiPhase::addPhase().

doublereal atomicWeight ( int  m  )  const

Atomic weight of element m.

Parameters:
m Element index

Definition at line 95 of file Constituents.cpp.

References Elements::atomicWeight(), and Constituents::m_Elements.

Referenced by WaterSSTP::initThermoXML().

const vector_fp & atomicWeights (  )  const

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

Definition at line 109 of file Constituents.cpp.

References Elements::atomicWeights(), and Constituents::m_Elements.

doublereal charge ( int  k  )  const
void clear (  ) 

Remove all elements and species.

int elementIndex ( std::string  name  )  const

Index of element named 'name'.

The index is an integer assigned to each element in the order it was added, beginning with 0 for the first element.

Parameters:
name name of the element

If 'name' is not the name of an element in the set, then the value -1 is returned.

Definition at line 197 of file Constituents.cpp.

References Elements::elementIndex(), and Constituents::m_Elements.

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

string elementName ( int  m  )  const

Name of the element with index m.

This is a passthrough routine to the Element object.

Parameters:
m Element index.
Exceptions:
If m < 0 or m >= nElements(), the exception, ElementRangeError, is thrown.

Definition at line 209 of file Constituents.cpp.

References Elements::elementName(), and Constituents::m_Elements.

Referenced by MultiPhase::addPhase(), PDSS_HKFT::convertDGFormation(), and MolalityVPSSTP::findCLMIndex().

const vector< string > & elementNames (  )  const

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

Definition at line 229 of file Constituents.cpp.

References Elements::elementNames(), and Constituents::m_Elements.

bool elementsFrozen (  ) 

True if freezeElements has been called.

Definition at line 183 of file Constituents.cpp.

References Elements::elementsFrozen(), and Constituents::m_Elements.

doublereal entropyElement298 ( int  m  )  const

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

Parameters:
m Element index

Definition at line 100 of file Constituents.cpp.

References Elements::entropyElement298(), and Constituents::m_Elements.

Referenced by PDSS_HKFT::LookupGe().

void freezeElements (  ) 

Prohibit addition of more elements, and prepare to add species.

Definition at line 176 of file Constituents.cpp.

References Elements::freezeElements(), and Constituents::m_Elements.

void freezeSpecies (  ) 

Prohibit addition of more species, and prepare for calculations with this set of elements and species.

Reimplemented in Phase.

Definition at line 398 of file Constituents.cpp.

References Constituents::m_speciesFrozen.

void getAtoms ( int  k,
double *  atomArray 
) const

Get a vector containing the atomic composition of species k.

Parameters:
k species index
atomArray vector containing the atomic number in the species. Length: m_mm

Definition at line 480 of file Constituents.cpp.

References Constituents::m_Elements, Constituents::m_speciesComp, and Elements::nElements().

doublereal molarMass ( int  k  )  const [inline]

Return the Molar mass of species k.

Preferred name for molecular weight.

Parameters:
k index for species
Returns:
Return the molar mass of species k kg/kmol.

Definition at line 240 of file Constituents.h.

References Constituents::molecularWeight().

doublereal molecularWeight ( int  k  )  const
const array_fp & molecularWeights (  )  const

Return a const reference to the vector of molecular weights of the species.

Reimplemented in Phase.

Definition at line 256 of file Constituents.cpp.

References Constituents::m_weight.

Referenced by Phase::freezeSpecies().

doublereal nAtoms ( int  k,
int  m 
) const
int nElements (  )  const
int nSpecies (  )  const [inline]
Constituents & operator= ( const Constituents right  ) 
bool ready (  )  const

True if both elements and species have been frozen.

Reimplemented in Phase.

Definition at line 456 of file Constituents.cpp.

References Elements::elementsFrozen(), Constituents::m_Elements, and Constituents::m_speciesFrozen.

Referenced by Phase::ready().

doublereal size ( int  k  )  const [inline]
bool speciesFrozen (  )  [inline]

True if freezeSpecies has been called.

Definition at line 318 of file Constituents.h.

References Constituents::m_speciesFrozen.

int speciesIndex ( std::string  name  )  const
string speciesName ( int  k  )  const
const vector< string > & speciesNames (  )  const

Member Data Documentation

Elements* m_Elements [protected]
int m_kk [protected]

Number of species in the phase.

Reimplemented in Phase.

Definition at line 346 of file Constituents.h.

Referenced by Constituents::nSpecies(), and Constituents::operator=().

vector_fp m_speciesCharge [protected]
vector_fp m_speciesComp [protected]

Atomic composition of the species.

the number of atoms of 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 377 of file Constituents.h.

Referenced by Constituents::addUniqueSpecies(), Constituents::getAtoms(), Constituents::nAtoms(), and Constituents::operator=().

bool m_speciesFrozen [protected]

Boolean indicating whether the number of species has been frozen.

During the construction of the phase, this is false. After construction of the the phase, this is true.

Definition at line 359 of file Constituents.h.

Referenced by Constituents::freezeSpecies(), Constituents::operator=(), Constituents::ready(), and Constituents::speciesFrozen().

std::vector<std::string> m_speciesNames [protected]
vector_fp m_speciesSize [protected]

m_speciesSize(): Vector of species sizes.

length m_kk This is used in some equations of state which employ the constant partial molar volume approximation. It's so fundamental we've put it at the Constituents class level

Definition at line 393 of file Constituents.h.

Referenced by Constituents::addUniqueSpecies(), HMWSoln::initLengths(), DebyeHuckel::initLengths(), MineralEQ3::initThermoXML(), HMWSoln::initThermoXML(), DebyeHuckel::initThermoXML(), Constituents::operator=(), Constituents::size(), and DebyeHuckel::standardConcentration().

vector_fp m_weight [protected]

Vector of molecular weights of the species.

This vector has length m_kk. The units of the vector are kg kmol-1.

Definition at line 352 of file Constituents.h.

Referenced by WaterSSTP::initThermoXML(), Constituents::molecularWeight(), Constituents::molecularWeights(), and Constituents::operator=().


The documentation for this class was generated from the following files:
Generated by  doxygen 1.6.3