Cantera  2.5.1
MetalPhase.h
Go to the documentation of this file.
1 /**
2  * @file MetalPhase.h
3  */
4 
5 // This file is part of Cantera. See License.txt in the top-level directory or
6 // at https://cantera.org/license.txt for license and copyright information.
7 
8 #ifndef CT_METALPHASE_H
9 #define CT_METALPHASE_H
10 
11 #include "ThermoPhase.h"
12 #include "cantera/base/ctml.h"
13 
14 namespace Cantera
15 {
16 
17 /**
18  * @ingroup thermoprops
19  *
20  * Class MetalPhase represents electrons in a metal.
21  */
22 class MetalPhase : public ThermoPhase
23 {
24 public:
25  MetalPhase() {}
26 
27  // Overloaded methods of class ThermoPhase
28 
29  virtual std::string type() const {
30  return "Metal";
31  }
32 
33  virtual bool isCompressible() const {
34  return false;
35  }
36 
37  virtual doublereal enthalpy_mole() const {
38  return 0.0;
39  }
40  virtual doublereal intEnergy_mole() const {
41  return 0.0;
42  }
43  virtual doublereal entropy_mole() const {
44  return 0.0;
45  }
46  virtual doublereal gibbs_mole() const {
47  return 0.0;
48  }
49  virtual doublereal cp_mole() const {
50  return 0.0;
51  }
52  virtual doublereal cv_mole() const {
53  return 0.0;
54  }
55 
56  virtual void setPressure(doublereal pres) {
57  m_press = pres;
58  }
59  virtual doublereal pressure() const {
60  return m_press;
61  }
62 
63  virtual void getChemPotentials(doublereal* mu) const {
64  for (size_t n = 0; n < nSpecies(); n++) {
65  mu[n] = 0.0;
66  }
67  }
68 
69  virtual void getEnthalpy_RT(doublereal* hrt) const {
70  for (size_t n = 0; n < nSpecies(); n++) {
71  hrt[n] = 0.0;
72  }
73  }
74 
75  virtual void getEntropy_R(doublereal* sr) const {
76  for (size_t n = 0; n < nSpecies(); n++) {
77  sr[n] = 0.0;
78  }
79  }
80 
81  virtual void getStandardChemPotentials(doublereal* mu0) const {
82  for (size_t n = 0; n < nSpecies(); n++) {
83  mu0[n] = 0.0;
84  }
85  }
86 
87  virtual void getActivityConcentrations(doublereal* c) const {
88  for (size_t n = 0; n < nSpecies(); n++) {
89  c[n] = 1.0;
90  }
91  }
92  virtual void getPartialMolarEnthalpies(doublereal *h) const {
93  for (size_t n = 0; n < nSpecies(); n++) {
94  h[n] = 0.0;
95  }
96  }
97 
99  return Units(1.0);
100  }
101 
102  virtual doublereal standardConcentration(size_t k=0) const {
103  return 1.0;
104  }
105 
106  virtual doublereal logStandardConc(size_t k=0) const {
107  return 0.0;
108  }
109 
110  virtual void initThermo() {
111  if (m_input.hasKey("density")) {
112  assignDensity(m_input.convert("density", "kg/m^3"));
113  }
114  }
115 
116  virtual void setParametersFromXML(const XML_Node& eosdata) {
117  eosdata._require("model","Metal");
118  doublereal rho = getFloat(eosdata, "density", "density");
119  assignDensity(rho);
120  }
121 
122 private:
123  doublereal m_press;
124 };
125 }
126 
127 #endif
Cantera::MetalPhase::standardConcentration
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: MetalPhase.h:102
Cantera::AnyMap::convert
double convert(const std::string &key, const std::string &units) const
Convert the item stored by the given key to the units specified in units.
Definition: AnyMap.cpp:1055
Cantera::AnyMap::hasKey
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
Definition: AnyMap.cpp:984
Cantera::MetalPhase::setPressure
virtual void setPressure(doublereal pres)
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition: MetalPhase.h:56
Cantera::Phase::assignDensity
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
Definition: Phase.cpp:727
Cantera::MetalPhase::getPartialMolarEnthalpies
virtual void getPartialMolarEnthalpies(doublereal *h) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: MetalPhase.h:92
Cantera::MetalPhase::logStandardConc
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
Definition: MetalPhase.h:106
Cantera::MetalPhase::initThermo
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
Definition: MetalPhase.h:110
Cantera::MetalPhase
Definition: MetalPhase.h:22
Cantera::MetalPhase::pressure
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: MetalPhase.h:59
Cantera::ThermoPhase::m_input
AnyMap m_input
Data supplied via setParameters.
Definition: ThermoPhase.h:1874
Cantera::MetalPhase::getActivityConcentrations
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Definition: MetalPhase.h:87
Cantera::MetalPhase::entropy_mole
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: MetalPhase.h:43
Cantera::MetalPhase::cp_mole
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: MetalPhase.h:49
Cantera::XML_Node
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
Cantera::ThermoPhase
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:101
ctml.h
Cantera::MetalPhase::getStandardChemPotentials
virtual void getStandardChemPotentials(doublereal *mu0) const
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition: MetalPhase.h:81
Cantera::MetalPhase::cv_mole
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: MetalPhase.h:52
Cantera::Phase::nSpecies
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:285
Cantera::MetalPhase::enthalpy_mole
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: MetalPhase.h:37
Cantera::getFloat
doublereal getFloat(const XML_Node &parent, const std::string &name, const std::string &type)
Get a floating-point value from a child element.
Definition: ctml.cpp:164
Cantera::Units
A representation of the units associated with a dimensional quantity.
Definition: Units.h:29
Cantera::MetalPhase::setParametersFromXML
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
Definition: MetalPhase.h:116
Cantera::MetalPhase::standardConcentrationUnits
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
Definition: MetalPhase.h:98
Cantera::MetalPhase::getEntropy_R
virtual void getEntropy_R(doublereal *sr) const
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition: MetalPhase.h:75
Cantera::MetalPhase::gibbs_mole
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
Definition: MetalPhase.h:46
Cantera::MetalPhase::getChemPotentials
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: MetalPhase.h:63
Cantera::XML_Node::_require
void _require(const std::string &a, const std::string &v) const
Require that the current XML node has an attribute named by the first argument, a,...
Definition: xml.cpp:576
Cantera::MetalPhase::isCompressible
virtual bool isCompressible() const
Return whether phase represents a compressible substance.
Definition: MetalPhase.h:33
Cantera::MetalPhase::type
virtual std::string type() const
String indicating the thermodynamic model implemented.
Definition: MetalPhase.h:29
Cantera
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:263
Cantera::MetalPhase::getEnthalpy_RT
virtual void getEnthalpy_RT(doublereal *hrt) const
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition: MetalPhase.h:69
Cantera::MetalPhase::intEnergy_mole
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
Definition: MetalPhase.h:40
ThermoPhase.h