Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MetalPhase.h
Go to the documentation of this file.
1 /**
2  * @file MetalPhase.h
3  */
4 
5 // Copyright 2003 California Institute of Technology
6 
7 #ifndef CT_METALPHASE_H
8 #define CT_METALPHASE_H
9 
10 #include "mix_defs.h"
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  */
23 class MetalPhase : public ThermoPhase
24 {
25 
26 public:
27 
28  MetalPhase() {}
29 
30  MetalPhase(const MetalPhase& right) {
31  *this = right;
32  }
33 
34  MetalPhase& operator=(const MetalPhase& right) {
35  if (&right != this) {
37  m_press = right.m_press;
38  }
39  return *this;
40  }
41 
42  //! Duplicator
44  MetalPhase* idg = new MetalPhase(*this);
45  return (ThermoPhase*) idg;
46  }
47 
48  // Overloaded methods of class ThermoPhase
49 
50  virtual int eosType() const {
51  return cMetal;
52  }
53 
54  virtual doublereal enthalpy_mole() const {
55  return 0.0;
56  }
57  virtual doublereal intEnergy_mole() const {
58  return 0.0;
59  }
60  virtual doublereal entropy_mole() const {
61  return 0.0;
62  }
63  virtual doublereal gibbs_mole() const {
64  return 0.0;
65  }
66  virtual doublereal cp_mole() const {
67  return 0.0;
68  }
69  virtual doublereal cv_mole() const {
70  return 0.0;
71  }
72 
73  virtual void setPressure(doublereal pres) {
74  m_press = pres;
75  }
76  virtual doublereal pressure() const {
77  return m_press;
78  }
79 
80  virtual void getChemPotentials(doublereal* mu) const {
81  for (size_t n = 0; n < nSpecies(); n++) {
82  mu[n] = 0.0;
83  }
84  }
85 
86  virtual void getEnthalpy_RT(doublereal* hrt) const {
87  for (size_t n = 0; n < nSpecies(); n++) {
88  hrt[n] = 0.0;
89  }
90  }
91 
92  virtual void getEntropy_R(doublereal* sr) const {
93  for (size_t n = 0; n < nSpecies(); n++) {
94  sr[n] = 0.0;
95  }
96  }
97 
98  virtual void getStandardChemPotentials(doublereal* mu0) const {
99  for (size_t n = 0; n < nSpecies(); n++) {
100  mu0[n] = 0.0;
101  }
102  }
103 
104  virtual void getActivityConcentrations(doublereal* c) const {
105  for (size_t n = 0; n < nSpecies(); n++) {
106  c[n] = 1.0;
107  }
108  }
109 
110  virtual doublereal standardConcentration(size_t k=0) const {
111  return 1.0;
112  }
113 
114  virtual doublereal logStandardConc(size_t k=0) const {
115  return 0.0;
116  }
117 
118  virtual void setParametersFromXML(const XML_Node& eosdata) {
119  eosdata._require("model","Metal");
120  doublereal rho = getFloat(eosdata, "density", "density");
121  setDensity(rho);
122  }
123 
124 protected:
125 
126 private:
127  doublereal m_press;
128 };
129 }
130 
131 #endif
void _require(const std::string &a, const std::string &v) const
Require that the current XML node have an attribute named by the first argument, a, and that this attribute have the the string value listed in the second argument, v.
Definition: xml.cpp:603
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: MetalPhase.h:69
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Definition: MetalPhase.h:104
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data...
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
Definition: MetalPhase.h:118
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
Definition: MetalPhase.h:114
ThermoPhase & operator=(const ThermoPhase &right)
Assignment operator.
Definition: ThermoPhase.cpp:60
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:86
Class MetalPhase represents electrons in a metal.
Definition: MetalPhase.h:23
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
Definition: MetalPhase.h:57
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:100
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: MetalPhase.h:54
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
Definition: MetalPhase.h:63
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:98
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:97
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: MetalPhase.h:110
virtual int eosType() const
Equation of state type flag.
Definition: MetalPhase.h:50
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: MetalPhase.h:60
const int cMetal
A metal phase.
Definition: mix_defs.h:43
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:92
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: MetalPhase.h:80
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:265
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: MetalPhase.h:76
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: MetalPhase.h:66
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:194
virtual void setPressure(doublereal pres)
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition: MetalPhase.h:73
Header file for class ThermoPhase, the base class for phases with thermodynamic properties, and the text for the Module thermoprops (see Thermodynamic Properties and class ThermoPhase).
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplicator.
Definition: MetalPhase.h:43
virtual void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase Note the density of a phase is an independent...
Definition: Phase.h:623