Cantera  2.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
SpeciesThermoInterpType.cpp
Go to the documentation of this file.
1 /**
2  * @file SpeciesThermoInterpType.cpp
3  */
4 // Copyright 2007 Sandia National Laboratories
5 
8 #include "cantera/thermo/PDSS.h"
10 
11 namespace Cantera
12 {
13 
14 SpeciesThermoInterpType::SpeciesThermoInterpType() :
15  m_lowT(0.0),
16  m_highT(0.0),
17  m_Pref(0.0),
18  m_index(0)
19 {
20 }
21 
22 SpeciesThermoInterpType::SpeciesThermoInterpType(size_t n, doublereal tlow,
23  doublereal thigh,
24  doublereal pref) :
25  m_lowT(tlow),
26  m_highT(thigh),
27  m_Pref(pref),
28  m_index(n)
29 {
30  warn_deprecated("Constructor SpeciesThermoInterpType(size_t n, ...)",
31  "Use the constructor which does not take a species index."
32  " Applies to all classes derived from SpeciesThermoInterpType."
33  " To be removed after Cantera 2.2.");
34 }
35 
36 SpeciesThermoInterpType::SpeciesThermoInterpType(double tlow,
37  double thigh,
38  double pref) :
39  m_lowT(tlow),
40  m_highT(thigh),
41  m_Pref(pref),
42  m_index(0)
43 {
44 }
45 
46 SpeciesThermoInterpType::SpeciesThermoInterpType(const SpeciesThermoInterpType &b) :
47  m_lowT(b.m_lowT),
48  m_highT(b.m_highT),
49  m_Pref(b.m_Pref),
50  m_index(b.m_index)
51 {
52 }
53 
54 void SpeciesThermoInterpType::updateProperties(const doublereal* tempPoly,
55  doublereal* cp_R, doublereal* h_RT, doublereal* s_R) const
56 {
57  double T = tempPoly[0];
58  updatePropertiesTemp(T, cp_R, h_RT, s_R);
59 }
60 
61 doublereal SpeciesThermoInterpType::reportHf298(doublereal* const h298) const
62 {
63  throw CanteraError("SpeciesThermoInterpType::reportHf298",
64  "Not implemented");
65 }
66 
68  const doublereal Hf298New)
69 {
70  throw CanteraError("SpeciesThermoInterpType::modifyOneHf298",
71  "Not implemented");
72 }
73 
74 //=============================================================================
75 
77 {
78  m_index = npos;
79 }
80 
81 STITbyPDSS::STITbyPDSS(size_t k, VPSSMgr* vpssmgr_ptr, PDSS* PDSS_ptr) :
83  m_vpssmgr_ptr(vpssmgr_ptr),
84  m_PDSS_ptr(PDSS_ptr)
85 {
86  m_index = k;
87 }
88 
89 STITbyPDSS::STITbyPDSS(VPSSMgr* vpssmgr_ptr, PDSS* PDSS_ptr) :
91  m_vpssmgr_ptr(vpssmgr_ptr),
92  m_PDSS_ptr(PDSS_ptr)
93 {
94 }
95 
98  m_vpssmgr_ptr(b.m_vpssmgr_ptr),
99  m_PDSS_ptr(b.m_PDSS_ptr)
100 {
101 }
102 
104 STITbyPDSS::duplMyselfAsSpeciesThermoInterpType() const
105 {
106  return new STITbyPDSS(*this);
107 }
108 
109 void STITbyPDSS::initAllPtrs(size_t speciesIndex, VPSSMgr* vpssmgr_ptr,
110  PDSS* PDSS_ptr)
111 {
112  AssertThrow(speciesIndex == m_index,
113  "STITbyPDSS::initAllPtrs internal confusion");
114  m_vpssmgr_ptr = vpssmgr_ptr;
115  m_PDSS_ptr = PDSS_ptr;
116 }
117 
118 doublereal STITbyPDSS::minTemp() const
119 {
120  return m_PDSS_ptr->minTemp();
121 }
122 
123 doublereal STITbyPDSS::maxTemp() const
124 {
125  return m_PDSS_ptr->maxTemp();
126 }
127 
128 doublereal STITbyPDSS::refPressure() const
129 {
130  return m_PDSS_ptr->refPressure();
131 }
132 
134 {
135  return PDSS_TYPE;
136 }
137 
138 void STITbyPDSS::updateProperties(const doublereal* tempPoly,
139  doublereal* cp_R, doublereal* h_RT,
140  doublereal* s_R) const
141 {
142  doublereal T = tempPoly[0];
143  updatePropertiesTemp(T, cp_R, h_RT, s_R);
144 }
145 
146 void STITbyPDSS::updatePropertiesTemp(const doublereal temp,
147  doublereal* cp_R,
148  doublereal* h_RT,
149  doublereal* s_R) const
150 {
151  m_PDSS_ptr->setTemperature(temp);
152  AssertThrowMsg(m_index != npos, "STITbyPDSS::updatePropertiesTemp",
153  "object was probably not installed correctly");
155  cp_R[m_index] = m_PDSS_ptr->cp_R_ref();
156  s_R[m_index] = m_PDSS_ptr->entropy_R_ref();
157 }
158 
159 void STITbyPDSS::reportParameters(size_t& index, int& type,
160  doublereal& minTemp, doublereal& maxTemp,
161  doublereal& refPressure,
162  doublereal* const coeffs) const
163 {
164  index = m_index;
165  type = PDSS_TYPE;
166  minTemp = m_vpssmgr_ptr->minTemp(m_index);
167  maxTemp = m_vpssmgr_ptr->maxTemp(m_index);
168  refPressure = m_PDSS_ptr->refPressure();
169 }
170 
171 }
#define PDSS_TYPE
Type of reference state thermo which is a wrapper around a pressure dependent standard state object...
Pure Virtual Base class for the thermodynamic manager for an individual species' reference state...
virtual doublereal cp_R_ref() const
Return the molar heat capacity divided by R at reference pressure.
Definition: PDSS.cpp:282
virtual doublereal reportHf298(doublereal *const h298=0) const
Report the 298 K Heat of Formation of the standard state of one species (J kmol-1) ...
doublereal maxTemp() const
return the minimum temperature
Definition: PDSS.h:365
Virtual base class for the classes that manage the calculation of standard state properties for all t...
Definition: VPSSMgr.h:235
Declaration file for a virtual base class that manages the calculation of standard state properties f...
const size_t npos
index returned by functions to indicate "no position"
Definition: ct_defs.h:165
virtual doublereal maxTemp(size_t k=npos) const
Maximum temperature.
Definition: VPSSMgr.cpp:420
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:78
doublereal refPressure() const
Return the reference pressure for this phase.
Definition: PDSS.h:355
doublereal minTemp() const
return the minimum temperature
Definition: PDSS.h:360
void initAllPtrs(size_t speciesIndex, VPSSMgr *vpssmgr_ptr, PDSS *PDSS_ptr)
Initialize and/or Reinitialize all the pointers for this object.
virtual void reportParameters(size_t &index, int &type, doublereal &minTemp, doublereal &maxTemp, doublereal &refPressure, doublereal *const coeffs) const
This utility function reports back the type of parameterization and all of the parameters for the spe...
PDSS * m_PDSS_ptr
Pointer to the PDSS object that handles calls for this object.
virtual void modifyOneHf298(const size_t k, const doublereal Hf298New)
Modify the value of the 298 K Heat of Formation of one species in the phase (J kmol-1) ...
#define AssertThrowMsg(expr, procedure, message)
Assertion must be true or an error is thrown.
Definition: ctexceptions.h:301
Pure Virtual Base class for individual species reference state thermodynamic managers and text for th...
Declarations for the virtual base class PDSS (pressure dependent standard state) which handles calcul...
virtual void setTemperature(doublereal temp)
Set the internal temperature.
Definition: PDSS.cpp:348
Class for the thermodynamic manager for an individual species' reference state which uses the PDSS ba...
virtual void updateProperties(const doublereal *tempPoly, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
virtual void updateProperties(const doublereal *tempPoly, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Update the properties for this species, given a temperature polynomial.
#define AssertThrow(expr, procedure)
Assertion must be true or an error is thrown.
Definition: ctexceptions.h:283
Base class for exceptions thrown by Cantera classes.
Definition: ctexceptions.h:99
virtual doublereal minTemp(size_t k=npos) const
Minimum temperature.
Definition: VPSSMgr.cpp:412
virtual int reportType() const
Returns an integer representing the type of parameterization.
virtual doublereal refPressure() const
Returns the reference pressure (Pa)
Virtual base class for a species with a pressure dependent standard state.
Definition: PDSS.h:193
virtual doublereal minTemp() const
Returns the minimum temperature that the thermo parameterization is valid.
virtual void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const =0
Compute the reference-state property of one species.
virtual doublereal entropy_R_ref() const
Return the molar entropy divided by R at reference pressure.
Definition: PDSS.cpp:277
virtual doublereal maxTemp() const
Returns the maximum temperature that the thermo parameterization is valid.
virtual void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
VPSSMgr * m_vpssmgr_ptr
Pointer to the Variable pressure standard state manager that owns the PDSS object that will handle ca...
Definitions for the classes that are thrown when Cantera experiences an error condition (also contain...
virtual doublereal enthalpy_RT_ref() const
Return the molar enthalpy divided by RT at reference pressure.
Definition: PDSS.cpp:272