Cantera  2.0
GeneralSpeciesThermo.h
Go to the documentation of this file.
1 /**
2  * @file GeneralSpeciesThermo.h
3  * Headers for a completely general species thermodynamic property
4  * manager for a phase (see \ref mgrsrefcalc and
5  * \link Cantera::GeneralSpeciesThermo GeneralSpeciesThermo\endlink).
6  *
7  * Because it is general, it is slow.
8  */
9 #ifndef CT_GENERALSPECIESTHERMO_H
10 #define CT_GENERALSPECIESTHERMO_H
11 #include <string>
12 #include "cantera/base/ct_defs.h"
13 #include "SpeciesThermoMgr.h"
14 #include "NasaPoly1.h"
15 #include "Nasa9Poly1.h"
16 #include "speciesThermoTypes.h"
17 
18 
19 namespace Cantera
20 {
21 
22 //! A species thermodynamic property manager for a phase.
23 /*!
24  * This is a general manager that can handle a wide variety
25  * of species thermodynamic polynomials for individual species.
26  * It is slow, however, because it recomputes the functions of
27  * temperature needed for each species. What it does is to create
28  * a vector of SpeciesThermoInterpType objects.
29  *
30  * @ingroup mgrsrefcalc
31  */
33 {
34 
35 public:
36 
37  //! Constructor
39 
40  //! Copy constructor
41  /*!
42  * @param b Object to be copied
43  */
45 
46  //! Assignment operator
47  /*!
48  * @param b Object to be copied
49  */
51 
52  //! Destructor
53  virtual ~GeneralSpeciesThermo();
54 
55  //! Duplicator
56  virtual SpeciesThermo* duplMyselfAsSpeciesThermo() const ;
57 
58  //! Install a new species thermodynamic property
59  //! parameterization for one species.
60  /*!
61  * Install a SpeciesThermoInterpType object for the species, index.
62  * This routine contains an internal list of SpeciesThermoInterpType
63  * objects that it knows about. A factory-type lookup is done
64  * to create the object.
65  *
66  * @param name Name of the species
67  * @param index The 'update' method will update the property
68  * values for this species
69  * at position i index in the property arrays.
70  * @param type int flag specifying the type of parameterization to be
71  * installed.
72  * @param c vector of coefficients for the parameterization.
73  * This vector is simply passed through to the
74  * parameterization constructor. Its length depends upon
75  * the parameterization.
76  * @param minTemp minimum temperature for which this parameterization
77  * is valid.
78  * @param maxTemp maximum temperature for which this parameterization
79  * is valid.
80  * @param refPressure standard-state pressure for this
81  * parameterization.
82  * @see speciesThermoTypes.h
83  *
84  * @todo Create a factory method for SpeciesThermoInterpType.
85  * That's basically what we are doing here.
86  */
87  virtual void install(std::string name, size_t index, int type,
88  const doublereal* c,
89  doublereal minTemp, doublereal maxTemp,
90  doublereal refPressure);
91 
92  //! Install a new species thermodynamic property
93  //! parameterization for one species.
94  /*!
95  * @param stit_ptr Pointer to the SpeciesThermoInterpType object
96  * This will set up the thermo for one species
97  */
98  virtual void install_STIT(SpeciesThermoInterpType* stit_ptr);
99 
100  //! Install a PDSS object to handle the reference state thermodynamics
101  //! calculation
102  /*!
103  * @param k species index
104  * @param PDSS_ptr Pressure dependent standard state (PDSS) object
105  * that will handle the reference state calc
106  * @param vpssmgr_ptr Pointer to the variable pressure standard state
107  * manager that handles the PDSS object.
108  */
109  void installPDSShandler(size_t k, PDSS* PDSS_ptr, VPSSMgr* vpssmgr_ptr);
110 
111  //! Like update(), but only updates the single species k.
112  /*!
113  * @param k species index
114  * @param T Temperature (Kelvin)
115  * @param cp_R Vector of Dimensionless heat capacities.
116  * (length m_kk).
117  * @param h_RT Vector of Dimensionless enthalpies.
118  * (length m_kk).
119  * @param s_R Vector of Dimensionless entropies.
120  * (length m_kk).
121  */
122  virtual void update_one(size_t k, doublereal T, doublereal* cp_R,
123  doublereal* h_RT,
124  doublereal* s_R) const;
125 
126  //! Compute the reference-state properties for all species.
127  /*!
128  * Given temperature T in K, this method updates the values of
129  * the non-dimensional heat capacity at constant pressure,
130  * enthalpy, and entropy, at the reference pressure, Pref
131  * of each of the standard states.
132  *
133  * @param T Temperature (Kelvin)
134  * @param cp_R Vector of Dimensionless heat capacities.
135  * (length m_kk).
136  * @param h_RT Vector of Dimensionless enthalpies.
137  * (length m_kk).
138  * @param s_R Vector of Dimensionless entropies.
139  * (length m_kk).
140  */
141  virtual void update(doublereal T, doublereal* cp_R,
142  doublereal* h_RT, doublereal* s_R) const;
143 
144  //! Minimum temperature.
145  /*!
146  * If no argument is supplied, this
147  * method returns the minimum temperature for which \e all
148  * parameterizations are valid. If an integer index k is
149  * supplied, then the value returned is the minimum
150  * temperature for species k in the phase.
151  *
152  * @param k Species index
153  */
154  virtual doublereal minTemp(size_t k=npos) const;
155 
156  //! Maximum temperature.
157  /*!
158  * If no argument is supplied, this
159  * method returns the maximum temperature for which \e all
160  * parameterizations are valid. If an integer index k is
161  * supplied, then the value returned is the maximum
162  * temperature for parameterization k.
163  *
164  * @param k Species Index
165  */
166  virtual doublereal maxTemp(size_t k=npos) const;
167 
168  //! The reference-state pressure for species k.
169  /*!
170  *
171  * returns the reference state pressure in Pascals for
172  * species k. If k is left out of the argument list,
173  * it returns the reference state pressure for the first
174  * species.
175  * Note that some SpeciesThermo implementations, such
176  * as those for ideal gases, require that all species
177  * in the same phase have the same reference state pressures.
178  *
179  * @param k Species Index
180  */
181  virtual doublereal refPressure(size_t k=npos) const;
182 
183  //! This utility function reports the type of parameterization
184  //! used for the species with index number index.
185  /*!
186  *
187  * @param index Species index
188  */
189  virtual int reportType(size_t index) const;
190 
191  //! This utility function reports back the type of
192  //! parameterization and all of the parameters for the species, index.
193  /*!
194  * @param index Species index
195  * @param type Integer type of the standard type
196  * @param c Vector of coefficients used to set the
197  * parameters for the standard state.
198  * @param minTemp output - Minimum temperature
199  * @param maxTemp output - Maximum temperature
200  * @param refPressure output - reference pressure (Pa).
201  */
202  virtual void reportParams(size_t index, int& type,
203  doublereal* const c,
204  doublereal& minTemp,
205  doublereal& maxTemp,
206  doublereal& refPressure) const;
207 
208  //! Modify parameters for the standard state
209  /*!
210  * @param index Species index
211  * @param c Vector of coefficients used to set the
212  * parameters for the standard state.
213  * @deprecated
214  */
215  DEPRECATED(virtual void modifyParams(size_t index, doublereal* c));
216 
217 #ifdef H298MODIFY_CAPABILITY
218 
219  virtual doublereal reportOneHf298(int k) const;
220 
221  virtual void modifyOneHf298(const int k, const doublereal Hf298New);
222 
223 #endif
224 
225 private:
226  //! Provide the SpeciesthermoInterpType object
227  /*!
228  * provide access to the SpeciesThermoInterpType object.
229  * This
230  *
231  * @param k integer parameter
232  *
233  * @return pointer to the SpeciesThermoInterpType object.
234  */
236 
237 protected:
238 
239  /**
240  * This is the main unknown in the object. It is
241  * a list of pointers to type SpeciesThermoInterpType.
242  * Note, this object owns the objects, so they are deleted
243  * in the destructor of this object.
244  * Note, that in some instances, m_sp[k] = 0, e.g., no
245  * SpeciesThermoInterpType is installed for one or more
246  * species. These cases must be handled by the calling
247  * routine.
248  */
249  std::vector<SpeciesThermoInterpType*> m_sp;
250 
251  //! Maximum value of the lowest temperature
252  doublereal m_tlow_max;
253 
254  //! Minimum value of the highest temperature
255  doublereal m_thigh_min;
256 
257  //! reference pressure (Pa)
258  doublereal m_p0;
259 
260  /**
261  * Internal variable indicating the length of the
262  * number of species in the phase.
263  */
264  size_t m_kk;
265 
266 
267  //! Make the class VPSSMgr a friend because we need to access
268  //! the function provideSTIT()
269  friend class VPSSMgr;
270 
271 
272 };
273 
274 }
275 
276 #endif
277