Cantera  3.1.0a1
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 
13 namespace Cantera
14 {
15 
16 /**
17  * @ingroup thermoprops
18  *
19  * Class MetalPhase represents electrons in a metal.
20  */
21 class MetalPhase : public ThermoPhase
22 {
23 public:
24  MetalPhase() {}
25 
26  // Overloaded methods of class ThermoPhase
27 
28  string type() const override {
29  return "electron-cloud";
30  }
31 
32  bool isCompressible() const override {
33  return false;
34  }
35 
36  double enthalpy_mole() const override {
37  return 0.0;
38  }
39  double intEnergy_mole() const override {
40  return - pressure() * molarVolume();
41  }
42  double entropy_mole() const override {
43  return 0.0;
44  }
45  double gibbs_mole() const override {
46  return 0.0;
47  }
48  double cp_mole() const override {
49  return 0.0;
50  }
51  double cv_mole() const override {
52  return 0.0;
53  }
54 
55  void setPressure(double pres) override {
56  m_press = pres;
57  }
58  double pressure() const override {
59  return m_press;
60  }
61 
62  void getChemPotentials(double* mu) const override {
63  for (size_t n = 0; n < nSpecies(); n++) {
64  mu[n] = 0.0;
65  }
66  }
67 
68  void getEnthalpy_RT(double* hrt) const override {
69  for (size_t n = 0; n < nSpecies(); n++) {
70  hrt[n] = 0.0;
71  }
72  }
73 
74  void getEntropy_R(double* sr) const override {
75  for (size_t n = 0; n < nSpecies(); n++) {
76  sr[n] = 0.0;
77  }
78  }
79 
80  void getStandardChemPotentials(double* mu0) const override {
81  for (size_t n = 0; n < nSpecies(); n++) {
82  mu0[n] = 0.0;
83  }
84  }
85 
86  void getActivityConcentrations(double* c) const override {
87  for (size_t n = 0; n < nSpecies(); n++) {
88  c[n] = 1.0;
89  }
90  }
91  void getPartialMolarEnthalpies(double *h) const override {
92  for (size_t n = 0; n < nSpecies(); n++) {
93  h[n] = 0.0;
94  }
95  }
96 
97  Units standardConcentrationUnits() const override {
98  return Units(1.0);
99  }
100 
101  double standardConcentration(size_t k=0) const override {
102  return 1.0;
103  }
104 
105  double logStandardConc(size_t k=0) const override {
106  return 0.0;
107  }
108 
109  void initThermo() override {
110  if (m_input.hasKey("density")) {
111  assignDensity(m_input.convert("density", "kg/m^3"));
112  }
113  }
114 
115  void getParameters(AnyMap& phaseNode) const override {
116  ThermoPhase::getParameters(phaseNode);
117  phaseNode["density"].setQuantity(density(), "kg/m^3");
118  }
119 
120 private:
121  double m_press;
122 };
123 }
124 
125 #endif
Header file for class ThermoPhase, the base class for phases with thermodynamic properties,...
A map of string keys to values whose type can vary at runtime.
Definition: AnyMap.h:427
bool hasKey(const string &key) const
Returns true if the map contains an item named key.
Definition: AnyMap.cpp:1423
double convert(const string &key, const string &units) const
Convert the item stored by the given key to the units specified in units.
Definition: AnyMap.cpp:1535
Class MetalPhase represents electrons in a metal.
Definition: MetalPhase.h:22
void setPressure(double pres) override
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition: MetalPhase.h:55
void getStandardChemPotentials(double *mu0) const override
Get the array of chemical potentials at unit activity for the species at their standard states at the...
Definition: MetalPhase.h:80
double enthalpy_mole() const override
Molar enthalpy. Units: J/kmol.
Definition: MetalPhase.h:36
double logStandardConc(size_t k=0) const override
Natural logarithm of the standard concentration of the kth species.
Definition: MetalPhase.h:105
void getChemPotentials(double *mu) const override
Get the species chemical potentials. Units: J/kmol.
Definition: MetalPhase.h:62
double pressure() const override
Return the thermodynamic pressure (Pa).
Definition: MetalPhase.h:58
bool isCompressible() const override
Return whether phase represents a compressible substance.
Definition: MetalPhase.h:32
void getEntropy_R(double *sr) const override
Get the array of nondimensional Entropy functions for the standard state species at the current T and...
Definition: MetalPhase.h:74
void getParameters(AnyMap &phaseNode) const override
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition: MetalPhase.h:115
string type() const override
String indicating the thermodynamic model implemented.
Definition: MetalPhase.h:28
void initThermo() override
Initialize the ThermoPhase object after all species have been set up.
Definition: MetalPhase.h:109
void getActivityConcentrations(double *c) const override
This method returns an array of generalized concentrations.
Definition: MetalPhase.h:86
double cv_mole() const override
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: MetalPhase.h:51
void getEnthalpy_RT(double *hrt) const override
Get the nondimensional Enthalpy functions for the species at their standard states at the current T a...
Definition: MetalPhase.h:68
double intEnergy_mole() const override
Molar internal energy. Units: J/kmol.
Definition: MetalPhase.h:39
double entropy_mole() const override
Molar entropy. Units: J/kmol/K.
Definition: MetalPhase.h:42
double cp_mole() const override
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: MetalPhase.h:48
Units standardConcentrationUnits() const override
Returns the units of the "standard concentration" for this phase.
Definition: MetalPhase.h:97
double gibbs_mole() const override
Molar Gibbs function. Units: J/kmol.
Definition: MetalPhase.h:45
double standardConcentration(size_t k=0) const override
Return the standard concentration for the kth species.
Definition: MetalPhase.h:101
void getPartialMolarEnthalpies(double *h) const override
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: MetalPhase.h:91
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
Definition: Phase.cpp:597
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:231
virtual double density() const
Density (kg/m^3).
Definition: Phase.h:587
virtual double molarVolume() const
Molar volume (m^3/kmol).
Definition: Phase.cpp:581
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:390
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
AnyMap m_input
Data supplied via setParameters.
Definition: ThermoPhase.h:1966
A representation of the units associated with a dimensional quantity.
Definition: Units.h:35
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:564