Cantera  2.3.0
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 http://www.cantera.org/license.txt for license and copyright information.
7 
8 #ifndef CT_METALPHASE_H
9 #define CT_METALPHASE_H
10 
11 #include "mix_defs.h"
12 #include "ThermoPhase.h"
13 #include "cantera/base/ctml.h"
14 
15 namespace Cantera
16 {
17 
18 /**
19  * @ingroup thermoprops
20  *
21  * Class MetalPhase represents electrons in a metal.
22  */
23 class MetalPhase : public ThermoPhase
24 {
25 public:
26  MetalPhase() {}
27 
28  MetalPhase(const MetalPhase& right) {
29  *this = right;
30  }
31 
32  MetalPhase& operator=(const MetalPhase& right) {
33  if (&right != this) {
35  m_press = right.m_press;
36  }
37  return *this;
38  }
39 
41  MetalPhase* idg = new MetalPhase(*this);
42  return (ThermoPhase*) idg;
43  }
44 
45  // Overloaded methods of class ThermoPhase
46 
47  virtual int eosType() const {
48  warn_deprecated("MetalPhase::eosType",
49  "To be removed after Cantera 2.3.");
50  return cMetal;
51  }
52  virtual std::string type() const {
53  return "Metal";
54  }
55 
56  virtual doublereal enthalpy_mole() const {
57  return 0.0;
58  }
59  virtual doublereal intEnergy_mole() const {
60  return 0.0;
61  }
62  virtual doublereal entropy_mole() const {
63  return 0.0;
64  }
65  virtual doublereal gibbs_mole() const {
66  return 0.0;
67  }
68  virtual doublereal cp_mole() const {
69  return 0.0;
70  }
71  virtual doublereal cv_mole() const {
72  return 0.0;
73  }
74 
75  virtual void setPressure(doublereal pres) {
76  m_press = pres;
77  }
78  virtual doublereal pressure() const {
79  return m_press;
80  }
81 
82  virtual void getChemPotentials(doublereal* mu) const {
83  for (size_t n = 0; n < nSpecies(); n++) {
84  mu[n] = 0.0;
85  }
86  }
87 
88  virtual void getEnthalpy_RT(doublereal* hrt) const {
89  for (size_t n = 0; n < nSpecies(); n++) {
90  hrt[n] = 0.0;
91  }
92  }
93 
94  virtual void getEntropy_R(doublereal* sr) const {
95  for (size_t n = 0; n < nSpecies(); n++) {
96  sr[n] = 0.0;
97  }
98  }
99 
100  virtual void getStandardChemPotentials(doublereal* mu0) const {
101  for (size_t n = 0; n < nSpecies(); n++) {
102  mu0[n] = 0.0;
103  }
104  }
105 
106  virtual void getActivityConcentrations(doublereal* c) const {
107  for (size_t n = 0; n < nSpecies(); n++) {
108  c[n] = 1.0;
109  }
110  }
111 
112  virtual doublereal standardConcentration(size_t k=0) const {
113  return 1.0;
114  }
115 
116  virtual doublereal logStandardConc(size_t k=0) const {
117  return 0.0;
118  }
119 
120  virtual void setParametersFromXML(const XML_Node& eosdata) {
121  eosdata._require("model","Metal");
122  doublereal rho = getFloat(eosdata, "density", "density");
123  setDensity(rho);
124  }
125 
126 private:
127  doublereal m_press;
128 };
129 }
130 
131 #endif
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: MetalPhase.h:78
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:120
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
Definition: MetalPhase.h:65
ThermoPhase & operator=(const ThermoPhase &right)
Definition: ThermoPhase.cpp:59
Class MetalPhase represents electrons in a metal.
Definition: MetalPhase.h:23
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:97
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:262
virtual ThermoPhase * duplMyselfAsThermoPhase() const
Duplication routine for objects which inherit from ThermoPhase.
Definition: MetalPhase.h:40
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:93
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: MetalPhase.h:71
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: MetalPhase.h:82
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Definition: MetalPhase.h:106
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: MetalPhase.h:62
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:576
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:88
virtual int eosType() const
Equation of state type flag.
Definition: MetalPhase.h:47
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: MetalPhase.h:112
const int cMetal
A metal phase.
Definition: mix_defs.h:44
virtual std::string type() const
String indicating the thermodynamic model implemented.
Definition: MetalPhase.h:52
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: MetalPhase.h:56
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: MetalPhase.h:68
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:94
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:100
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
Definition: MetalPhase.h:116
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:178
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
Definition: MetalPhase.h:59
Namespace for the Cantera kernel.
Definition: application.cpp:29
virtual void setPressure(doublereal pres)
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition: MetalPhase.h:75
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 void setDensity(const doublereal density_)
Set the internally stored density (kg/m^3) of the phase.
Definition: Phase.h:622