Cantera  2.4.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 {
15 
16 ConstCpPoly::ConstCpPoly(double tlow, double thigh, double pref,
17  const double* coeffs) :
18  SpeciesThermoInterpType(tlow, thigh, pref)
19 {
20  m_t0 = coeffs[0];
21  m_h0_R = coeffs[1] / GasConstant;
22  m_s0_R = coeffs[2] / GasConstant;
23  m_cp0_R = coeffs[3] / GasConstant;
24  m_logt0 = log(m_t0);
26 }
27 
28 void ConstCpPoly::updateProperties(const doublereal* tt,
29  doublereal* cp_R,
30  doublereal* h_RT,
31  doublereal* s_R) const
32 {
33  double t = *tt;
34  doublereal logt = log(t);
35  doublereal rt = 1.0/t;
36  *cp_R = m_cp0_R;
37  *h_RT = rt*(m_h0_R + (t - m_t0) * m_cp0_R);
38  *s_R = m_s0_R + m_cp0_R * (logt - m_logt0);
39 }
40 
41 void ConstCpPoly::updatePropertiesTemp(const doublereal temp,
42  doublereal* cp_R,
43  doublereal* h_RT,
44  doublereal* s_R) const
45 {
46  doublereal logt = log(temp);
47  doublereal rt = 1.0/temp;
48  *cp_R = m_cp0_R;
49  *h_RT = rt*(m_h0_R + (temp - m_t0) * m_cp0_R);
50  *s_R = m_s0_R + m_cp0_R * (logt - m_logt0);
51 }
52 
53 void ConstCpPoly::reportParameters(size_t& n, int& type,
54  doublereal& tlow, doublereal& thigh,
55  doublereal& pref,
56  doublereal* const coeffs) const
57 {
58  n = 0;
59  type = CONSTANT_CP;
60  tlow = m_lowT;
61  thigh = m_highT;
62  pref = m_Pref;
63  coeffs[0] = m_t0;
64  coeffs[1] = m_h0_R * GasConstant;
65  coeffs[2] = m_s0_R * GasConstant;
66  coeffs[3] = m_cp0_R * GasConstant;
67 }
68 
69 doublereal ConstCpPoly::reportHf298(doublereal* const h298) const
70 {
71  double temp = 298.15;
72  doublereal h = GasConstant * (m_h0_R + (temp - m_t0) * m_cp0_R);
73  if (h298) {
74  *h298 = h;
75  }
76  return h;
77 }
78 
79 void ConstCpPoly::modifyOneHf298(const size_t k, const doublereal Hf298New)
80 {
81  doublereal hnow = reportHf298();
82  doublereal delH = Hf298New - hnow;
83  m_h0_R += delH / GasConstant;
84 }
85 
88 }
89 
90 }
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:41
ConstCpPoly(double tlow, double thigh, double pref, const double *coeffs)
Normal constructor.
Definition: ConstCpPoly.cpp:16
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) ...
Definition: ConstCpPoly.cpp:79
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:53
doublereal m_s0_R
Dimensionless value of the entropy at t0.
Definition: ConstCpPoly.h:96
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:28
doublereal m_highT
Highest valid temperature.
double m_h0_R_orig
Original value of h0_R, restored by calling resetHf298()
Definition: ConstCpPoly.h:100
doublereal m_h0_R
dimensionless value of the enthaply at t0
Definition: ConstCpPoly.h:94
doublereal m_t0
Base temperature.
Definition: ConstCpPoly.h:90
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:69
doublereal m_Pref
Reference state pressure.
Namespace for the Cantera kernel.
Definition: AnyMap.cpp:8
virtual void resetHf298()
Restore the original heat of formation for this species.
Definition: ConstCpPoly.cpp:86
doublereal m_logt0
log of the t0 value
Definition: ConstCpPoly.h:98
doublereal m_cp0_R
Dimensionless value of the heat capacity.
Definition: ConstCpPoly.h:92