Cantera  2.1.2
StatMech.h
Go to the documentation of this file.
1 /**
2  * @file StatMech.h
3  * Header for a single-species standard state object derived
4  * from
5  */
6 /*
7  * Copyright(2006) Sandia Corporation. Under the terms of
8  * Contract DE-AC04-94AL85000 with Sandia Corporation, the
9  * U.S. Government retains certain rights in this software.
10  */
11 
12 #ifndef CT_STATMECH_H
13 #define CT_STATMECH_H
14 
15 #include "cantera/base/global.h"
17 #include "SpeciesThermoMgr.h"
18 
19 namespace Cantera
20 {
21 
22 //! Statistical mechanics
23 /*!
24  * @ingroup spthermo
25  */
27 {
28 
29 public:
30 
31  //! Empty constructor
32  StatMech();
33 
34 
35  //! constructor used in templated instantiations
36  /*!
37  * @param n Species index
38  * @param tlow Minimum temperature
39  * @param thigh Maximum temperature
40  * @param pref reference pressure (Pa).
41  * @param coeffs Vector of coefficients used to set the
42  * parameters for the standard state.
43  */
44  StatMech(int n, doublereal tlow, doublereal thigh, doublereal pref,
45  const doublereal* coeffs, const std::string& my_name);
46 
47  //! copy constructor
48  /*!
49  * @param b object to be copied
50  */
51  StatMech(const StatMech& b);
52 
53  //! assignment operator
54  /*!
55  * @param b object to be copied
56  */
57  StatMech& operator=(const StatMech& b);
58 
59  //! duplicator
62 
63  //! Returns an integer representing the type of parameterization
64  virtual int reportType() const;
65  //! Build a series of maps for the properties needed for species
66  int buildmap();
67 
68  //! Update the properties for this species, given a temperature polynomial
69  /*!
70  * This method is called with a pointer to an array containing the
71  * functions of temperature needed by this parameterization, and three
72  * pointers to arrays where the computed property values should be
73  * written. This method updates only one value in each array.
74  *
75  * \f[
76  * \frac{C_p^0(T)}{R} = \frac{C_v^0(T)}{R} + 1
77  * \f]
78  *
79  * Where,
80  * \f[
81  * \frac{C_v^0(T)}{R} = \frac{C_v^{tr}(T)}{R} + \frac{C_v^{vib}(T)}{R}
82  * \f]
83  *
84  * Temperature Polynomial:
85  * tt[0] = t;
86  *
87  * @param tt vector of temperature polynomials
88  * @param cp_R Vector of Dimensionless heat capacities. (length m_kk).
89  * @param h_RT Vector of Dimensionless enthalpies. (length m_kk).
90  * @param s_R Vector of Dimensionless entropies. (length m_kk).
91  */
92  virtual void updateProperties(const doublereal* tt,
93  doublereal* cp_R, doublereal* h_RT, doublereal* s_R) const;
94 
95 
96  //! Compute the reference-state property of one species
97  /*!
98  * Given temperature T in K, this method updates the values of the non-
99  * dimensional heat capacity at constant pressure, enthalpy, and entropy,
100  * at the reference pressure, Pref of one of the species. The species
101  * index is used to reference into the cp_R, h_RT, and s_R arrays.
102  *
103  * @param temp Temperature (Kelvin)
104  * @param cp_R Vector of Dimensionless heat capacities. (length m_kk).
105  * @param h_RT Vector of Dimensionless enthalpies. (length m_kk).
106  * @param s_R Vector of Dimensionless entropies. (length m_kk).
107  */
108  virtual void updatePropertiesTemp(const doublereal temp,
109  doublereal* cp_R, doublereal* h_RT,
110  doublereal* s_R) const;
111 
112  //! This utility function reports back the type of parameterization and
113  //! all of the parameters for the species, index.
114  /*!
115  * All parameters are output variables
116  *
117  * @param n Species index
118  * @param type Integer type of the standard type
119  * @param tlow output - Minimum temperature
120  * @param thigh output - Maximum temperature
121  * @param pref output - reference pressure (Pa).
122  * @param coeffs Vector of coefficients used to set the
123  * parameters for the standard state. There are
124  * 12 of them, designed to be compatible
125  * with the multiple temperature formulation.
126  * coeffs[0] is equal to one.
127  * coeffs[1] is min temperature
128  * coeffs[2] is max temperature
129  * coeffs[3+i] from i =0,9 are the coefficients themselves
130  */
131  virtual void reportParameters(size_t& n, int& type,
132  doublereal& tlow, doublereal& thigh,
133  doublereal& pref,
134  doublereal* const coeffs) const;
135 
136  //! Modify parameters for the standard state
137  /*!
138  * @param coeffs Vector of coefficients used to set the
139  * parameters for the standard state.
140  */
141  virtual void modifyParameters(doublereal* coeffs);
142 
143 protected:
144  //! array of polynomial coefficients
146 
147  std::string sp_name;
148 
149  //*generic species struct that contains everything we need here
150  // achtung: add doxygen markup here
151  // achtung: convert doubles to realdoubles
152  struct species {
153  //Nominal T-R Degrees of freedom (cv = cfs*k*T)
154  doublereal cfs;
155 
156  // Mol. Wt. Molecular weight (kg/kmol)
157  doublereal mol_weight;
158 
159  // number of vibrational temperatures necessary
160  int nvib;
161 
162  // Theta_v Characteristic vibrational temperature(s) (K)
163  doublereal theta[5];
164  };
165 
166  std::map<std::string,species*> name_map;
167 
168 };
169 
170 }
171 #endif
Statistical mechanics.
Definition: StatMech.h:26
Pure Virtual Base class for the thermodynamic manager for an individual species' reference state...
virtual void updateProperties(const doublereal *tt, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
Definition: StatMech.cpp:552
virtual int reportType() const
Returns an integer representing the type of parameterization.
Definition: StatMech.cpp:49
This file contains definitions for utility functions and text for modules, inputfiles, logs, textlogs, HTML_logs (see Input File Handling, Diagnostic Output, Writing messages to the screen and Writing HTML Logfiles).
virtual void modifyParameters(doublereal *coeffs)
Modify parameters for the standard state.
Definition: StatMech.cpp:652
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
StatMech()
Empty constructor.
Definition: StatMech.cpp:13
virtual void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
Definition: StatMech.cpp:598
virtual 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...
Definition: StatMech.cpp:607
int buildmap()
Build a series of maps for the properties needed for species.
Definition: StatMech.cpp:54
This file contains descriptions of templated subclasses of the virtual base class, SpeciesThermo, which includes SpeciesThermoDuo (see Managers for Calculating Reference-State Thermodynamics and class SpeciesThermoDuo)
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:165
StatMech & operator=(const StatMech &b)
assignment operator
Definition: StatMech.cpp:35
virtual SpeciesThermoInterpType * duplMyselfAsSpeciesThermoInterpType() const
duplicator
Definition: StatMech.cpp:44
vector_fp m_coeff
array of polynomial coefficients
Definition: StatMech.h:145