Cantera  2.3.0
ConstCpPoly.cpp
Go to the documentation of this file.
1 /**
2  * @file ConstCpPoly.cpp
3  * Declarations for the \link Cantera::SpeciesThermoInterpType SpeciesThermoInterpType \endlink object that
4  * employs a constant heat capacity assumption (see \ref spthermo and
5  * \link Cantera::ConstCpPoly ConstCpPoly \endlink).
6  */
7 
8 // This file is part of Cantera. See License.txt in the top-level directory or
9 // at http://www.cantera.org/license.txt for license and copyright information.
10 
12 
13 namespace Cantera
14 {
16  : m_t0(0.0),
17  m_cp0_R(0.0),
18  m_h0_R(0.0),
19  m_s0_R(0.0),
20  m_logt0(0.0)
21 {
22  warn_deprecated("ConstCpPoly::ConstCpPoly()",
23  "Default constructor to be removed after Cantera 2.3.");
24 }
25 
26 ConstCpPoly::ConstCpPoly(double tlow, double thigh, double pref,
27  const double* coeffs) :
28  SpeciesThermoInterpType(tlow, thigh, pref)
29 {
30  m_t0 = coeffs[0];
31  m_h0_R = coeffs[1] / GasConstant;
32  m_s0_R = coeffs[2] / GasConstant;
33  m_cp0_R = coeffs[3] / GasConstant;
34  m_logt0 = log(m_t0);
36 }
37 
40 {
41  return new ConstCpPoly(*this);
42 }
43 
44 void ConstCpPoly::updateProperties(const doublereal* tt,
45  doublereal* cp_R,
46  doublereal* h_RT,
47  doublereal* s_R) const
48 {
49  double t = *tt;
50  doublereal logt = log(t);
51  doublereal rt = 1.0/t;
52  *cp_R = m_cp0_R;
53  *h_RT = rt*(m_h0_R + (t - m_t0) * m_cp0_R);
54  *s_R = m_s0_R + m_cp0_R * (logt - m_logt0);
55 }
56 
57 void ConstCpPoly::updatePropertiesTemp(const doublereal temp,
58  doublereal* cp_R,
59  doublereal* h_RT,
60  doublereal* s_R) const
61 {
62  doublereal logt = log(temp);
63  doublereal rt = 1.0/temp;
64  *cp_R = m_cp0_R;
65  *h_RT = rt*(m_h0_R + (temp - m_t0) * m_cp0_R);
66  *s_R = m_s0_R + m_cp0_R * (logt - m_logt0);
67 }
68 
69 void ConstCpPoly::reportParameters(size_t& n, int& type,
70  doublereal& tlow, doublereal& thigh,
71  doublereal& pref,
72  doublereal* const coeffs) const
73 {
74  n = 0;
75  type = CONSTANT_CP;
76  tlow = m_lowT;
77  thigh = m_highT;
78  pref = m_Pref;
79  coeffs[0] = m_t0;
80  coeffs[1] = m_h0_R * GasConstant;
81  coeffs[2] = m_s0_R * GasConstant;
82  coeffs[3] = m_cp0_R * GasConstant;
83 }
84 
85 void ConstCpPoly::modifyParameters(doublereal* coeffs)
86 {
87  warn_deprecated("ConstCpPoly::modifyParameters", "To be removed after "
88  "Cantera 2.3. Use MultiSpeciesThermo::modifySpecies instead.");
89  m_t0 = coeffs[0];
90  m_h0_R = coeffs[1] / GasConstant;
91  m_s0_R = coeffs[2] / GasConstant;
92  m_cp0_R = coeffs[3] / GasConstant;
93  m_logt0 = log(m_t0);
94 }
95 
96 doublereal ConstCpPoly::reportHf298(doublereal* const h298) const
97 {
98  double temp = 298.15;
99  doublereal h = GasConstant * (m_h0_R + (temp - m_t0) * m_cp0_R);
100  if (h298) {
101  *h298 = h;
102  }
103  return h;
104 }
105 
106 void ConstCpPoly::modifyOneHf298(const size_t k, const doublereal Hf298New)
107 {
108  doublereal hnow = reportHf298();
109  doublereal delH = Hf298New - hnow;
110  m_h0_R += delH / GasConstant;
111 }
112 
115 }
116 
117 }
void updatePropertiesTemp(const doublereal temp, doublereal *cp_R, doublereal *h_RT, doublereal *s_R) const
Compute the reference-state property of one species.
Definition: ConstCpPoly.cpp:57
Abstract Base class for the thermodynamic manager for an individual species' reference state...
#define CONSTANT_CP
Constant Cp.
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) ...
virtual SpeciesThermoInterpType * duplMyselfAsSpeciesThermoInterpType() const
Definition: ConstCpPoly.cpp:39
void warn_deprecated(const std::string &method, const std::string &extra)
Print a warning indicating that method is deprecated.
Definition: global.cpp:54
virtual void modifyParameters(doublereal *coeffs)
Definition: ConstCpPoly.cpp:85
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: ConstCpPoly.cpp:69
doublereal m_s0_R
Dimensionless value of the entropy at t0.
Definition: ConstCpPoly.h:107
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: ConstCpPoly.cpp:44
doublereal m_highT
Highest valid temperature.
double m_h0_R_orig
Original value of h0_R, restored by calling resetHf298()
Definition: ConstCpPoly.h:111
doublereal m_h0_R
dimensionless value of the enthaply at t0
Definition: ConstCpPoly.h:105
doublereal m_t0
Base temperature.
Definition: ConstCpPoly.h:101
doublereal m_lowT
lowest valid temperature
Headers for the SpeciesThermoInterpType object that employs a constant heat capacity assumption (see ...
const doublereal GasConstant
Universal Gas Constant. [J/kmol/K].
Definition: ct_defs.h:64
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) ...
Definition: ConstCpPoly.cpp:96
doublereal m_Pref
Reference state pressure.
Namespace for the Cantera kernel.
Definition: application.cpp:29
virtual void resetHf298()
Restore the original heat of formation for this species.
ConstCpPoly()
empty constructor
Definition: ConstCpPoly.cpp:15
doublereal m_logt0
log of the t0 value
Definition: ConstCpPoly.h:109
doublereal m_cp0_R
Dimensionless value of the heat capacity.
Definition: ConstCpPoly.h:103