Cantera  2.3.0
AdsorbateThermo.h
Go to the documentation of this file.
1 /**
2  * @file AdsorbateThermo.h
3  *
4  * Header for a single-species standard state object derived from \link
5  * Cantera::SpeciesThermoInterpType SpeciesThermoInterpType\endlink based on the
6  * expressions for the thermo properties of a species with several vibrational
7  * models.
8  */
9 
10 // This file is part of Cantera. See License.txt in the top-level directory or
11 // at http://www.cantera.org/license.txt for license and copyright information.
12 
13 #ifndef CT_ADSORBATE_H
14 #define CT_ADSORBATE_H
15 
17 
18 namespace Cantera
19 {
20 
21 /**
22  * An adsorbed surface species.
23  *
24  * @attention This class currently does not have any test cases or examples. Its
25  * implementation may be incomplete, and future changes to Cantera may
26  * unexpectedly cause this class to stop working. If you use this class,
27  * please consider contributing examples or test cases. In the absence of
28  * new tests or examples, this class may be deprecated and removed in a
29  * future version of Cantera. See
30  * https://github.com/Cantera/cantera/issues/267 for additional information.
31  *
32  * This class is designed specifically for use by the class MultiSpeciesThermo.
33  * It implements a model for the thermodynamic properties of a molecule that can
34  * be modeled as a set of independent quantum harmonic oscillators.
35  *
36  * @ingroup spthermo
37  */
39 {
40 public:
41  //! Empty constructor
42  //! @deprecated Default constructor to be removed after Cantera 2.3.
44  warn_deprecated("Adsorbate::Adsorbate()",
45  "Default constructor to be removed after Cantera 2.3.");
46  }
47 
48  //! Full Constructor
49  /*!
50  * @param tlow output - Minimum temperature
51  * @param thigh output - Maximum temperature
52  * @param pref output - reference pressure (Pa).
53  * @param coeffs Coefficients for the parameterization
54  */
55  Adsorbate(double tlow, double thigh, double pref, const double* coeffs)
56  : SpeciesThermoInterpType(tlow, thigh, pref)
57  {
58  m_freq.resize(int(coeffs[0]));
59  m_be = coeffs[1];
60  std::copy(coeffs+2, coeffs + 2 + m_freq.size(), m_freq.begin());
61  }
62 
65  return new Adsorbate(*this);
66  }
67 
68  virtual int reportType() const {
69  return ADSORBATE;
70  }
71 
72  void updatePropertiesTemp(const doublereal temp,
73  doublereal* cp_R,
74  doublereal* h_RT,
75  doublereal* s_R) const {
76  *h_RT = _energy_RT(temp);
77  *cp_R = (temp**h_RT - (temp-0.01)*_energy_RT(temp-0.01))/0.01;
78  *s_R = *h_RT - _free_energy_RT(temp);
79  }
80 
81  void reportParameters(size_t& n, int& type,
82  doublereal& tlow, doublereal& thigh,
83  doublereal& pref,
84  doublereal* const coeffs) const {
85  n = 0;
86  type = ADSORBATE;
87  tlow = m_lowT;
88  thigh = m_highT;
89  pref = m_Pref;
90  coeffs[0] = static_cast<double>(m_freq.size());
91  coeffs[1] = m_be;
92  for (size_t i = 2; i < m_freq.size()+2; i++) {
93  coeffs[i] = m_freq[i-2];
94  }
95  }
96 
97 protected:
98  //! array of vib frequencies
100  doublereal m_be;
101 
102  doublereal _energy_RT(double T) const {
103  doublereal x, hnu_kt, hnu, sum = 0.0;
104  doublereal kt = T*Boltzmann;
105  for (size_t i = 0; i < m_freq.size(); i++) {
106  hnu = Planck * m_freq[i];
107  hnu_kt = hnu/kt;
108  x = exp(-hnu_kt);
109  sum += hnu_kt * x/(1.0 - x);
110  }
111  return sum + m_be/(GasConstant*T);
112  }
113 
114  doublereal _free_energy_RT(double T) const {
115  doublereal x, hnu_kt, sum = 0.0;
116  doublereal kt = T*Boltzmann;
117  for (size_t i = 0; i < m_freq.size(); i++) {
118  hnu_kt = Planck * m_freq[i] / kt;
119  x = exp(-hnu_kt);
120  sum += log(1.0 - x);
121  }
122  return sum + m_be/(GasConstant*T);
123  }
124 
125  doublereal _entropy_R(double T) const {
126  return _energy_RT(T) - _free_energy_RT(T);
127  }
128 };
129 
130 }
131 #endif
Abstract Base class for the thermodynamic manager for an individual species&#39; reference state...
void reportParameters(size_t &n, int &type, doublereal &tlow, doublereal &thigh, doublereal &pref, doublereal *const coeffs) const
This utility function reports back the type of parameterization and all of the parameters for the spe...
virtual SpeciesThermoInterpType * duplMyselfAsSpeciesThermoInterpType() const
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
Adsorbate()
Empty constructor.
vector_fp m_freq
array of vib frequencies
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
doublereal m_highT
Highest valid temperature.
const doublereal Planck
Planck&#39;s constant. [J-s].
Definition: ct_defs.h:79
doublereal m_lowT
lowest valid temperature
An adsorbed surface species.
std::vector< double > vector_fp
Turn on the use of stl vectors for the basic array type within cantera Vector of doubles.
Definition: ct_defs.h:157
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
virtual int reportType() const
Returns an integer representing the type of parameterization.
Adsorbate(double tlow, double thigh, double pref, const double *coeffs)
Full Constructor.
doublereal m_Pref
Reference state pressure.
Namespace for the Cantera kernel.
Definition: application.cpp:29
const doublereal Boltzmann
Boltzmann&#39;s constant [J/K].
Definition: ct_defs.h:76
#define ADSORBATE
Surface Adsorbate Model for a species on a surface.