Cantera 2.6.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 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
14namespace Cantera
15{
16
17/**
18 * @ingroup thermoprops
19 *
20 * Class MetalPhase represents electrons in a metal.
21 */
22class MetalPhase : public ThermoPhase
23{
24public:
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 getParameters(AnyMap& phaseNode) const {
118 phaseNode["density"].setQuantity(density(), "kg/m^3");
119 }
120
121 virtual void setParametersFromXML(const XML_Node& eosdata) {
122 eosdata._require("model","Metal");
123 doublereal rho = getFloat(eosdata, "density", "density");
124 assignDensity(rho);
125 }
126
127private:
128 doublereal m_press;
129};
130}
131
132#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:399
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:1508
bool hasKey(const std::string &key) const
Returns true if the map contains an item named key.
Definition: AnyMap.cpp:1406
Class MetalPhase represents electrons in a metal.
Definition: MetalPhase.h:23
virtual doublereal gibbs_mole() const
Molar Gibbs function. Units: J/kmol.
Definition: MetalPhase.h:46
virtual void initThermo()
Initialize the ThermoPhase object after all species have been set up.
Definition: MetalPhase.h:110
virtual void setPressure(doublereal pres)
Set the internally stored pressure (Pa) at constant temperature and composition.
Definition: MetalPhase.h:56
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
virtual void getChemPotentials(doublereal *mu) const
Get the species chemical potentials. Units: J/kmol.
Definition: MetalPhase.h:63
virtual doublereal entropy_mole() const
Molar entropy. Units: J/kmol/K.
Definition: MetalPhase.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:75
virtual Units standardConcentrationUnits() const
Returns the units of the "standard concentration" for this phase.
Definition: MetalPhase.h:98
virtual doublereal logStandardConc(size_t k=0) const
Natural logarithm of the standard concentration of the kth species.
Definition: MetalPhase.h:106
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
virtual doublereal cp_mole() const
Molar heat capacity at constant pressure. Units: J/kmol/K.
Definition: MetalPhase.h:49
virtual bool isCompressible() const
Return whether phase represents a compressible substance.
Definition: MetalPhase.h:33
virtual doublereal cv_mole() const
Molar heat capacity at constant volume. Units: J/kmol/K.
Definition: MetalPhase.h:52
virtual doublereal intEnergy_mole() const
Molar internal energy. Units: J/kmol.
Definition: MetalPhase.h:40
virtual void getActivityConcentrations(doublereal *c) const
This method returns an array of generalized concentrations.
Definition: MetalPhase.h:87
virtual doublereal standardConcentration(size_t k=0) const
Return the standard concentration for the kth species.
Definition: MetalPhase.h:102
virtual void getParameters(AnyMap &phaseNode) const
Store the parameters of a ThermoPhase object such that an identical one could be reconstructed using ...
Definition: MetalPhase.h:116
virtual std::string type() const
String indicating the thermodynamic model implemented.
Definition: MetalPhase.h:29
virtual doublereal pressure() const
Return the thermodynamic pressure (Pa).
Definition: MetalPhase.h:59
virtual void getPartialMolarEnthalpies(doublereal *h) const
Returns an array of partial molar enthalpies for the species in the mixture.
Definition: MetalPhase.h:92
virtual doublereal enthalpy_mole() const
Molar enthalpy. Units: J/kmol.
Definition: MetalPhase.h:37
virtual void setParametersFromXML(const XML_Node &eosdata)
Set equation of state parameter values from XML entries.
Definition: MetalPhase.h:121
void assignDensity(const double density_)
Set the internally stored constant density (kg/m^3) of the phase.
Definition: Phase.cpp:698
size_t nSpecies() const
Returns the number of species in the phase.
Definition: Phase.h:273
virtual double density() const
Density (kg/m^3).
Definition: Phase.h:679
Base class for a phase with thermodynamic properties.
Definition: ThermoPhase.h:102
AnyMap m_input
Data supplied via setParameters.
Definition: ThermoPhase.h:1898
virtual void getParameters(int &n, doublereal *const c) const
Get the equation of state parameters in a vector.
A representation of the units associated with a dimensional quantity.
Definition: Units.h:30
Class XML_Node is a tree-based representation of the contents of an XML file.
Definition: xml.h:103
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:577
CTML ("Cantera Markup Language") is the variant of XML that Cantera uses to store data.
Namespace for the Cantera kernel.
Definition: AnyMap.h:29
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:166