Cantera  2.4.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  * @deprecated To be removed after Cantera 2.4
33  *
34  * This class is designed specifically for use by the class MultiSpeciesThermo.
35  * It implements a model for the thermodynamic properties of a molecule that can
36  * be modeled as a set of independent quantum harmonic oscillators.
37  *
38  * @ingroup spthermo
39  */
41 {
42 public:
43  //! Full Constructor
44  /*!
45  * @param tlow output - Minimum temperature
46  * @param thigh output - Maximum temperature
47  * @param pref output - reference pressure (Pa).
48  * @param coeffs Coefficients for the parameterization
49  */
50  Adsorbate(double tlow, double thigh, double pref, const double* coeffs)
51  : SpeciesThermoInterpType(tlow, thigh, pref)
52  {
53  warn_deprecated("Class Adsorbate", "To be removed after Cantera 2.4");
54  m_freq.resize(int(coeffs[0]));
55  m_be = coeffs[1];
56  std::copy(coeffs+2, coeffs + 2 + m_freq.size(), m_freq.begin());
57  }
58 
59  virtual int reportType() const {
60  return ADSORBATE;
61  }
62 
63  void updatePropertiesTemp(const doublereal temp,
64  doublereal* cp_R,
65  doublereal* h_RT,
66  doublereal* s_R) const {
67  *h_RT = _energy_RT(temp);
68  *cp_R = (temp**h_RT - (temp-0.01)*_energy_RT(temp-0.01))/0.01;
69  *s_R = *h_RT - _free_energy_RT(temp);
70  }
71 
72  void reportParameters(size_t& n, int& type,
73  doublereal& tlow, doublereal& thigh,
74  doublereal& pref,
75  doublereal* const coeffs) const {
76  n = 0;
77  type = ADSORBATE;
78  tlow = m_lowT;
79  thigh = m_highT;
80  pref = m_Pref;
81  coeffs[0] = static_cast<double>(m_freq.size());
82  coeffs[1] = m_be;
83  for (size_t i = 2; i < m_freq.size()+2; i++) {
84  coeffs[i] = m_freq[i-2];
85  }
86  }
87 
88 protected:
89  //! array of vib frequencies
91  doublereal m_be;
92 
93  doublereal _energy_RT(double T) const {
94  doublereal x, hnu_kt, hnu, sum = 0.0;
95  doublereal kt = T*Boltzmann;
96  for (size_t i = 0; i < m_freq.size(); i++) {
97  hnu = Planck * m_freq[i];
98  hnu_kt = hnu/kt;
99  x = exp(-hnu_kt);
100  sum += hnu_kt * x/(1.0 - x);
101  }
102  return sum + m_be/(GasConstant*T);
103  }
104 
105  doublereal _free_energy_RT(double T) const {
106  doublereal x, hnu_kt, sum = 0.0;
107  doublereal kt = T*Boltzmann;
108  for (size_t i = 0; i < m_freq.size(); i++) {
109  hnu_kt = Planck * m_freq[i] / kt;
110  x = exp(-hnu_kt);
111  sum += log(1.0 - x);
112  }
113  return sum + m_be/(GasConstant*T);
114  }
115 
116  doublereal _entropy_R(double T) const {
117  return _energy_RT(T) - _free_energy_RT(T);
118  }
119 };
120 
121 }
122 #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...
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
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: AnyMap.cpp:8
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.